ltc2632.c (74f582ec127e3b10aec71e8d15f1c14b0f0481ec) ltc2632.c (a9d1a34f2a025708b2eaffddc9a338e289e5bb65)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * LTC2632 Digital to analog convertors spi driver
4 *
5 * Copyright 2017 Maxime Roussin-Bélanger
6 * expanded by Silvan Murer <silvan.murer@gmail.com>
7 */
8
9#include <linux/device.h>
10#include <linux/spi/spi.h>
11#include <linux/module.h>
12#include <linux/iio/iio.h>
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * LTC2632 Digital to analog convertors spi driver
4 *
5 * Copyright 2017 Maxime Roussin-Bélanger
6 * expanded by Silvan Murer <silvan.murer@gmail.com>
7 */
8
9#include <linux/device.h>
10#include <linux/spi/spi.h>
11#include <linux/module.h>
12#include <linux/iio/iio.h>
13#include <linux/property.h>
13#include <linux/regulator/consumer.h>
14
15#include <asm/unaligned.h>
16
17#define LTC2632_CMD_WRITE_INPUT_N 0x0
18#define LTC2632_CMD_UPDATE_DAC_N 0x1
19#define LTC2632_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2
20#define LTC2632_CMD_WRITE_INPUT_N_UPDATE_N 0x3

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

357 if (ret) {
358 dev_err(&spi->dev,
359 "Set external reference command failed, %d\n",
360 ret);
361 return ret;
362 }
363 }
364
14#include <linux/regulator/consumer.h>
15
16#include <asm/unaligned.h>
17
18#define LTC2632_CMD_WRITE_INPUT_N 0x0
19#define LTC2632_CMD_UPDATE_DAC_N 0x1
20#define LTC2632_CMD_WRITE_INPUT_N_UPDATE_ALL 0x2
21#define LTC2632_CMD_WRITE_INPUT_N_UPDATE_N 0x3

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

358 if (ret) {
359 dev_err(&spi->dev,
360 "Set external reference command failed, %d\n",
361 ret);
362 return ret;
363 }
364 }
365
365 indio_dev->name = dev_of_node(&spi->dev) ? dev_of_node(&spi->dev)->name
366 : spi_get_device_id(spi)->name;
366 indio_dev->name = fwnode_get_name(dev_fwnode(&spi->dev)) ?: spi_get_device_id(spi)->name;
367 indio_dev->info = &ltc2632_info;
368 indio_dev->modes = INDIO_DIRECT_MODE;
369 indio_dev->channels = chip_info->channels;
370 indio_dev->num_channels = chip_info->num_channels;
371
372 return iio_device_register(indio_dev);
373}
374

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

464 },
465 {}
466};
467MODULE_DEVICE_TABLE(of, ltc2632_of_match);
468
469static struct spi_driver ltc2632_driver = {
470 .driver = {
471 .name = "ltc2632",
367 indio_dev->info = &ltc2632_info;
368 indio_dev->modes = INDIO_DIRECT_MODE;
369 indio_dev->channels = chip_info->channels;
370 indio_dev->num_channels = chip_info->num_channels;
371
372 return iio_device_register(indio_dev);
373}
374

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

464 },
465 {}
466};
467MODULE_DEVICE_TABLE(of, ltc2632_of_match);
468
469static struct spi_driver ltc2632_driver = {
470 .driver = {
471 .name = "ltc2632",
472 .of_match_table = of_match_ptr(ltc2632_of_match),
472 .of_match_table = ltc2632_of_match,
473 },
474 .probe = ltc2632_probe,
475 .remove = ltc2632_remove,
476 .id_table = ltc2632_id,
477};
478module_spi_driver(ltc2632_driver);
479
480MODULE_AUTHOR("Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>");
481MODULE_DESCRIPTION("LTC2632 DAC SPI driver");
482MODULE_LICENSE("GPL v2");
473 },
474 .probe = ltc2632_probe,
475 .remove = ltc2632_remove,
476 .id_table = ltc2632_id,
477};
478module_spi_driver(ltc2632_driver);
479
480MODULE_AUTHOR("Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>");
481MODULE_DESCRIPTION("LTC2632 DAC SPI driver");
482MODULE_LICENSE("GPL v2");