max5821.c (f83d9396d1f63048c423efa00e4e244da10a35fd) max5821.c (c9ccad99113d99a0c187f909caa326062db5de55)
1// SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * iio/dac/max5821.c
4 * Copyright (C) 2014 Philippe Reynes
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>

--- 253 unchanged lines hidden (view full) ---

262 switch (mask) {
263 case IIO_CHAN_INFO_RAW:
264 return max5821_set_value(indio_dev, val, chan->channel);
265 default:
266 return -EINVAL;
267 }
268}
269
1// SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * iio/dac/max5821.c
4 * Copyright (C) 2014 Philippe Reynes
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>

--- 253 unchanged lines hidden (view full) ---

262 switch (mask) {
263 case IIO_CHAN_INFO_RAW:
264 return max5821_set_value(indio_dev, val, chan->channel);
265 default:
266 return -EINVAL;
267 }
268}
269
270static int __maybe_unused max5821_suspend(struct device *dev)
270static int max5821_suspend(struct device *dev)
271{
272 u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
273 MAX5821_EXTENDED_DAC_A |
274 MAX5821_EXTENDED_DAC_B |
275 MAX5821_EXTENDED_POWER_DOWN_MODE2 };
276
277 return i2c_master_send(to_i2c_client(dev), outbuf, 2);
278}
279
271{
272 u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
273 MAX5821_EXTENDED_DAC_A |
274 MAX5821_EXTENDED_DAC_B |
275 MAX5821_EXTENDED_POWER_DOWN_MODE2 };
276
277 return i2c_master_send(to_i2c_client(dev), outbuf, 2);
278}
279
280static int __maybe_unused max5821_resume(struct device *dev)
280static int max5821_resume(struct device *dev)
281{
282 u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
283 MAX5821_EXTENDED_DAC_A |
284 MAX5821_EXTENDED_DAC_B |
285 MAX5821_EXTENDED_POWER_UP };
286
287 return i2c_master_send(to_i2c_client(dev), outbuf, 2);
288}
289
281{
282 u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE,
283 MAX5821_EXTENDED_DAC_A |
284 MAX5821_EXTENDED_DAC_B |
285 MAX5821_EXTENDED_POWER_UP };
286
287 return i2c_master_send(to_i2c_client(dev), outbuf, 2);
288}
289
290static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume);
290static DEFINE_SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend,
291 max5821_resume);
291
292static const struct iio_info max5821_info = {
293 .read_raw = max5821_read_raw,
294 .write_raw = max5821_write_raw,
295};
296
297static void max5821_regulator_disable(void *reg)
298{

--- 70 unchanged lines hidden (view full) ---

369 { }
370};
371MODULE_DEVICE_TABLE(of, max5821_of_match);
372
373static struct i2c_driver max5821_driver = {
374 .driver = {
375 .name = "max5821",
376 .of_match_table = max5821_of_match,
292
293static const struct iio_info max5821_info = {
294 .read_raw = max5821_read_raw,
295 .write_raw = max5821_write_raw,
296};
297
298static void max5821_regulator_disable(void *reg)
299{

--- 70 unchanged lines hidden (view full) ---

370 { }
371};
372MODULE_DEVICE_TABLE(of, max5821_of_match);
373
374static struct i2c_driver max5821_driver = {
375 .driver = {
376 .name = "max5821",
377 .of_match_table = max5821_of_match,
377 .pm = &max5821_pm_ops,
378 .pm = pm_sleep_ptr(&max5821_pm_ops),
378 },
379 .probe = max5821_probe,
380 .id_table = max5821_id,
381};
382module_i2c_driver(max5821_driver);
383
384MODULE_AUTHOR("Philippe Reynes <tremyfr@yahoo.fr>");
385MODULE_DESCRIPTION("MAX5821 DAC");
386MODULE_LICENSE("GPL v2");
379 },
380 .probe = max5821_probe,
381 .id_table = max5821_id,
382};
383module_i2c_driver(max5821_driver);
384
385MODULE_AUTHOR("Philippe Reynes <tremyfr@yahoo.fr>");
386MODULE_DESCRIPTION("MAX5821 DAC");
387MODULE_LICENSE("GPL v2");