mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
mfd: Support LP3974 RTC
The first releases of LP3974 have a large delay in RTC registers, which requires 2 seconds of delay after writing to a rtc register (recommended by National Semiconductor's engineers) before reading it. If "rtc_delay" field of the platform data is true, the rtc driver assumes that such delays are required. Although we have not seen LP3974s without requiring such delays, we assume that such LP3974s will be released soon (or they have done so already) and they are supported by "lp3974" without setting "rtc_delay" at the platform data. This patch adds delays with msleep when writing values to RTC registers if the platform data has rtc_delay set. Signed-off-by: MyungJoo Ham <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Reviewed-by: Mark Brown <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]>
This commit is contained in:
parent
de8255ccd2
commit
337ce5d1c5
4 changed files with 83 additions and 8 deletions
|
|
@ -42,6 +42,14 @@ static struct mfd_cell max8998_devs[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct mfd_cell lp3974_devs[] = {
|
||||
{
|
||||
.name = "lp3974-pmic",
|
||||
}, {
|
||||
.name = "lp3974-rtc",
|
||||
},
|
||||
};
|
||||
|
||||
int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
|
||||
{
|
||||
struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
|
||||
|
|
@ -146,11 +154,23 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
|
|||
|
||||
max8998_irq_init(max8998);
|
||||
|
||||
ret = mfd_add_devices(max8998->dev, -1,
|
||||
max8998_devs, ARRAY_SIZE(max8998_devs),
|
||||
NULL, 0);
|
||||
pm_runtime_set_active(max8998->dev);
|
||||
|
||||
switch (id->driver_data) {
|
||||
case TYPE_LP3974:
|
||||
ret = mfd_add_devices(max8998->dev, -1,
|
||||
lp3974_devs, ARRAY_SIZE(lp3974_devs),
|
||||
NULL, 0);
|
||||
break;
|
||||
case TYPE_MAX8998:
|
||||
ret = mfd_add_devices(max8998->dev, -1,
|
||||
max8998_devs, ARRAY_SIZE(max8998_devs),
|
||||
NULL, 0);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue