18 #include <linux/kernel.h>
19 #include <linux/module.h>
22 #include <linux/slab.h>
23 #include <linux/i2c.h>
28 #define ADM1275_PEAK_IOUT 0xd0
29 #define ADM1275_PEAK_VIN 0xd1
30 #define ADM1275_PEAK_VOUT 0xd2
31 #define ADM1275_PMON_CONFIG 0xd4
33 #define ADM1275_VIN_VOUT_SELECT (1 << 6)
34 #define ADM1275_VRANGE (1 << 5)
35 #define ADM1075_IRANGE_50 (1 << 4)
36 #define ADM1075_IRANGE_25 (1 << 3)
37 #define ADM1075_IRANGE_MASK ((1 << 3) | (1 << 4))
39 #define ADM1275_IOUT_WARN2_LIMIT 0xd7
40 #define ADM1275_DEVICE_CONFIG 0xd8
42 #define ADM1275_IOUT_WARN2_SELECT (1 << 4)
44 #define ADM1276_PEAK_PIN 0xda
46 #define ADM1275_MFR_STATUS_IOUT_WARN2 (1 << 0)
48 #define ADM1075_READ_VAUX 0xdd
49 #define ADM1075_VAUX_OV_WARN_LIMIT 0xde
50 #define ADM1075_VAUX_UV_WARN_LIMIT 0xdf
51 #define ADM1075_VAUX_STATUS 0xf6
53 #define ADM1075_VAUX_OV_WARN (1<<7)
54 #define ADM1075_VAUX_UV_WARN (1<<6)
62 #define to_adm1275_data(x) container_of(x, struct adm1275_data, info)
175 static int adm1275_read_byte_data(
struct i2c_client *client,
int page,
int reg)
191 if (mfr_status < 0) {
228 static int adm1275_probe(
struct i2c_client *client,
232 int config, device_config;
238 if (!i2c_check_functionality(client->
adapter,
245 dev_err(&client->
dev,
"Failed to read Manufacturer ID\n");
248 if (ret != 3 ||
strncmp(block_buffer,
"ADI", 3)) {
249 dev_err(&client->
dev,
"Unsupported Manufacturer ID\n");
255 dev_err(&client->
dev,
"Failed to read Manufacturer Model\n");
258 for (mid = adm1275_id; mid->
name[0]; mid++) {
263 dev_err(&client->
dev,
"Unsupported device\n");
267 if (id->driver_data != mid->driver_data)
268 dev_notice(&client->
dev,
269 "Device mismatch: Configured %s, detected %s\n",
277 if (device_config < 0)
278 return device_config;
285 data->
id = mid->driver_data;
343 dev_err(&client->
dev,
"Invalid input current range");
355 if (config & ADM1275_VIN_VOUT_SELECT)
366 if (config & ADM1275_VIN_VOUT_SELECT)
369 if (config & ADM1275_VRANGE) {
388 .probe = adm1275_probe,
390 .id_table = adm1275_id,