11 #include <linux/kernel.h>
12 #include <linux/module.h>
14 #include <linux/i2c.h>
16 #include <linux/slab.h>
18 #define RTC_I2C_ADDR 0x68
19 #define ADC_I2C_ADDR 0x47
21 static inline int max8925_read_device(
struct i2c_client *i2c,
32 *(
unsigned char *)dest = (
unsigned char)
ret;
37 static inline int max8925_write_device(
struct i2c_client *i2c,
40 unsigned char buf[bytes + 1];
43 buf[0] = (
unsigned char)reg;
44 memcpy(&buf[1], src, bytes);
55 unsigned char data = 0;
59 ret = max8925_read_device(i2c, reg, 1, &data);
76 ret = max8925_write_device(i2c, reg, 1, &data);
84 int count,
unsigned char *buf)
90 ret = max8925_read_device(i2c, reg, count, buf);
98 int count,
unsigned char *buf)
104 ret = max8925_write_device(i2c, reg, count, buf);
112 unsigned char mask,
unsigned char data)
119 ret = max8925_read_device(i2c, reg, 1, &value);
124 ret = max8925_write_device(i2c, reg, 1, &value);
145 pr_info(
"%s: platform data is missing\n", __func__);
154 i2c_set_clientdata(client, chip);
159 i2c_set_clientdata(chip->
rtc, chip);
162 i2c_set_clientdata(chip->
adc, chip);
182 #ifdef CONFIG_PM_SLEEP
183 static int max8925_suspend(
struct device *
dev)
193 static int max8925_resume(
struct device *dev)
210 .pm = &max8925_pm_ops,
212 .probe = max8925_probe,
214 .id_table = max8925_id_table,
217 static int __init max8925_i2c_init(
void)
221 ret = i2c_add_driver(&max8925_driver);
223 pr_err(
"Failed to register MAX8925 I2C driver: %d\n", ret);
228 static void __exit max8925_i2c_exit(
void)