1 // SPDX-License-Identifier: GPL-2.0
3 * Analog Devices LTC2947 high precision power and energy monitor over SPI
5 * Copyright 2019 Analog Devices Inc.
7 #include <linux/module.h>
9 #include <linux/regmap.h>
10 #include <linux/spi/spi.h>
14 static const struct regmap_config ltc2947_regmap_config
= {
17 .read_flag_mask
= BIT(0),
20 static int ltc2947_probe(struct spi_device
*spi
)
24 map
= devm_regmap_init_spi(spi
, <c2947_regmap_config
);
28 return ltc2947_core_probe(map
, spi_get_device_id(spi
)->name
);
31 static const struct spi_device_id ltc2947_id
[] = {
35 MODULE_DEVICE_TABLE(spi
, ltc2947_id
);
37 static struct spi_driver ltc2947_driver
= {
40 .of_match_table
= ltc2947_of_match
,
41 .pm
= <c2947_pm_ops
,
43 .probe
= ltc2947_probe
,
44 .id_table
= ltc2947_id
,
46 module_spi_driver(ltc2947_driver
);
48 MODULE_AUTHOR("Nuno Sa <nuno.sa@analog.com>");
49 MODULE_DESCRIPTION("LTC2947 SPI power and energy monitor driver");
50 MODULE_LICENSE("GPL");