diff options
author | Prabhu Kuttiyam <pkuttiyam@nvidia.com> | 2013-12-18 16:07:03 -0800 |
---|---|---|
committer | Bibek Basu <bbasu@nvidia.com> | 2013-12-18 23:09:58 -0800 |
commit | b714c5e402c1261c1860e4bda3db3da2c4919b45 (patch) | |
tree | a6c9de9bfc2b4b485e84e650ed752a721c12bc61 | |
parent | e972e1b2e1ae60ec7ecef5e633e91ee95b0defa9 (diff) |
regulator: as3722 : SD0 init val based on boardid
Decide the PMIC version based on board id as
AMS PMIC rev id is not correct in silicon.
Add DT support also.
Bug 1425474
Change-Id: Ia51462980da582c958a26e156b48a1e5d655559f
Signed-off-by: Prabhu Kuttiyam <pkuttiyam@nvidia.com>
Reviewed-on: http://git-master/r/347241
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
-rw-r--r-- | drivers/mfd/as3722.c | 4 | ||||
-rw-r--r-- | drivers/regulator/as3722-regulator.c | 12 | ||||
-rw-r--r-- | include/linux/mfd/as3722-plat.h | 2 | ||||
-rw-r--r-- | include/linux/mfd/as3722.h | 12 |
4 files changed, 25 insertions, 5 deletions
diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c index 3c552389f872..46329ebb6dc0 100644 --- a/drivers/mfd/as3722.c +++ b/drivers/mfd/as3722.c @@ -370,6 +370,8 @@ static int as3722_i2c_of_probe(struct i2c_client *i2c, "ams,enable-internal-i2c-pullup"); as3722->irq_flags = irqd_get_trigger_type(irq_data); as3722->irq_base = -1; + of_property_read_u32(np, "ams,major-rev", &as3722->major_rev); + of_property_read_u32(np, "ams,minor-rev", &as3722->minor_rev); dev_dbg(&i2c->dev, "IRQ flags are 0x%08lx\n", as3722->irq_flags); return 0; } @@ -386,6 +388,8 @@ static int as3722_i2c_non_of_probe(struct i2c_client *i2c, as3722->irq_base = pdata->irq_base; as3722->en_intern_i2c_pullup = pdata->use_internal_i2c_pullup; as3722->en_intern_int_pullup = pdata->use_internal_int_pullup; + as3722->major_rev = pdata->major_rev; + as3722->minor_rev = pdata->minor_rev; return 0; } diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 83a42764240e..f63a8420900f 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -785,7 +785,6 @@ static int as3722_regulator_probe(struct platform_device *pdev) struct regulator_ops *ops; int id; int ret; - u32 val; as3722_regs = devm_kzalloc(&pdev->dev, sizeof(*as3722_regs), GFP_KERNEL); @@ -863,11 +862,14 @@ static int as3722_regulator_probe(struct platform_device *pdev) else ops = &as3722_sd016_ops; if (id == AS3722_REGULATOR_ID_SD0) { - as3722_read(as3722, AS3722_FUSE15, &val); - if ((val & AS3722_NCELL_MASK) == 1) - as3722_regs->desc[id].min_uV = 610000; - else if ((val & AS3722_NCELL_MASK) == 2) + /* AMS version revision id is wrong in silicon + * and therefore this woraround to decide based + * on boardID + */ + if (as3722_device_rev(as3722, 1, 2)) as3722_regs->desc[id].min_uV = 410000; + else + as3722_regs->desc[id].min_uV = 610000; } else as3722_regs->desc[id].min_uV = 610000; as3722_regs->desc[id].uV_step = 10000; diff --git a/include/linux/mfd/as3722-plat.h b/include/linux/mfd/as3722-plat.h index 9c6aa348d550..7a50838cbb3c 100644 --- a/include/linux/mfd/as3722-plat.h +++ b/include/linux/mfd/as3722-plat.h @@ -156,6 +156,8 @@ struct as3722_platform_data { struct as3722_adc_extcon_platform_data *extcon_pdata; int watchdog_timer_initial_period; int watchdog_timer_mode; + u32 major_rev; + u32 minor_rev; bool enable_clk32k_out; }; diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h index dc7903069a65..ad51056522f4 100644 --- a/include/linux/mfd/as3722.h +++ b/include/linux/mfd/as3722.h @@ -405,6 +405,8 @@ struct as3722 { bool en_intern_int_pullup; bool en_intern_i2c_pullup; struct regmap_irq_chip_data *irq_data; + u32 major_rev; + u32 minor_rev; }; static inline int as3722_read(struct as3722 *as3722, u32 reg, u32 *dest) @@ -440,4 +442,14 @@ static inline int as3722_irq_get_virq(struct as3722 *as3722, int irq) return regmap_irq_get_virq(as3722->irq_data, irq); } +static inline bool as3722_device_rev(struct as3722 *as3722, u32 major_rev, + u32 minor_rev) +{ + + if ((as3722->major_rev == major_rev) && + (as3722->minor_rev == minor_rev)) + return true; + else + return false; +} #endif |