19f90fd65SNuno Sá // SPDX-License-Identifier: GPL-2.0 29f90fd65SNuno Sá /* 39f90fd65SNuno Sá * Analog Devices LTC2947 high precision power and energy monitor over I2C 49f90fd65SNuno Sá * 59f90fd65SNuno Sá * Copyright 2019 Analog Devices Inc. 69f90fd65SNuno Sá */ 79f90fd65SNuno Sá #include <linux/i2c.h> 89f90fd65SNuno Sá #include <linux/module.h> 99f90fd65SNuno Sá #include <linux/regmap.h> 109f90fd65SNuno Sá 119f90fd65SNuno Sá #include "ltc2947.h" 129f90fd65SNuno Sá 139f90fd65SNuno Sá static const struct regmap_config ltc2947_regmap_config = { 149f90fd65SNuno Sá .reg_bits = 8, 159f90fd65SNuno Sá .val_bits = 8, 169f90fd65SNuno Sá }; 179f90fd65SNuno Sá 18c1e60c0dSStephen Kitt static int ltc2947_probe(struct i2c_client *i2c) 199f90fd65SNuno Sá { 209f90fd65SNuno Sá struct regmap *map; 219f90fd65SNuno Sá 229f90fd65SNuno Sá map = devm_regmap_init_i2c(i2c, <c2947_regmap_config); 239f90fd65SNuno Sá if (IS_ERR(map)) 249f90fd65SNuno Sá return PTR_ERR(map); 259f90fd65SNuno Sá 269f90fd65SNuno Sá return ltc2947_core_probe(map, i2c->name); 279f90fd65SNuno Sá } 289f90fd65SNuno Sá 299f90fd65SNuno Sá static const struct i2c_device_id ltc2947_id[] = { 309f90fd65SNuno Sá {"ltc2947", 0}, 319f90fd65SNuno Sá {} 329f90fd65SNuno Sá }; 339f90fd65SNuno Sá MODULE_DEVICE_TABLE(i2c, ltc2947_id); 349f90fd65SNuno Sá 359f90fd65SNuno Sá static struct i2c_driver ltc2947_driver = { 369f90fd65SNuno Sá .driver = { 379f90fd65SNuno Sá .name = "ltc2947", 389f90fd65SNuno Sá .of_match_table = ltc2947_of_match, 39*ca19f965SJonathan Cameron .pm = pm_sleep_ptr(<c2947_pm_ops), 409f90fd65SNuno Sá }, 41c1e60c0dSStephen Kitt .probe_new = ltc2947_probe, 429f90fd65SNuno Sá .id_table = ltc2947_id, 439f90fd65SNuno Sá }; 449f90fd65SNuno Sá module_i2c_driver(ltc2947_driver); 459f90fd65SNuno Sá 469f90fd65SNuno Sá MODULE_AUTHOR("Nuno Sa <nuno.sa@analog.com>"); 479f90fd65SNuno Sá MODULE_DESCRIPTION("LTC2947 I2C power and energy monitor driver"); 489f90fd65SNuno Sá MODULE_LICENSE("GPL"); 49