[PATCH] regulator: s5m8767: Disable OVCB in probe

From: Krzysztof Kozlowski
Date: Tue Nov 12 2013 - 08:42:33 EST


According to SW Guide the Over-Voltage Clamp may malfunction at VBatt
5.25V and 110'C temperature. This may result in overshooting or
undershooting LDO's voltage outputs.
Disable the Over-Voltage Clamp in probe by updating proper bit in all
LDO registers.

The patch uses sec_bulk_read/write() API with reordered buf and count
parameters so it depends on:
"mfd: sec: reorder params in API for regmap consistency"
http://www.spinics.net/lists/kernel/msg1632519.html

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
drivers/regulator/s5m8767.c | 26 ++++++++++++++++++++++++++
include/linux/mfd/samsung/s5m8767.h | 1 +
2 files changed, 27 insertions(+)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index ac10db4..7c6fb97 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -478,6 +478,26 @@ static struct regulator_desc regulators[] = {
s5m8767_regulator_desc(BUCK9),
};

+/*
+ * Disables Over-Voltage Clamp for all LDO-s.
+ */
+static int s5m8767_reg_disable_ldo_ovcb(struct s5m8767_info *s5m8767)
+{
+ u8 data[28];
+ int i, ret;
+
+ ret = sec_bulk_read(s5m8767->iodev, S5M8767_REG_LDO1, data,
+ ARRAY_SIZE(data));
+ if (ret)
+ return ret;
+
+ for (i = 0; i < ARRAY_SIZE(data); i++)
+ data[i] |= (1 << S5M8767_REG_LDO_SHIFT);
+
+ return sec_bulk_write(s5m8767->iodev, S5M8767_REG_LDO1, data,
+ ARRAY_SIZE(data));
+}
+
#ifdef CONFIG_OF
static int s5m8767_pmic_dt_parse_dvs_gpio(struct sec_pmic_dev *iodev,
struct sec_platform_data *pdata,
@@ -886,6 +906,12 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
}
}

+ /*
+ * Disable Over-Voltage Clamp,
+ * possible malfunction at VBatt 5.25V and 110'C temperature
+ */
+ s5m8767_reg_disable_ldo_ovcb(s5m8767);
+
for (i = 0; i < pdata->num_regulators; i++) {
const struct sec_voltage_desc *desc;
int id = pdata->regulators[i].id;
diff --git a/include/linux/mfd/samsung/s5m8767.h b/include/linux/mfd/samsung/s5m8767.h
index 306a95f..d6c09a0 100644
--- a/include/linux/mfd/samsung/s5m8767.h
+++ b/include/linux/mfd/samsung/s5m8767.h
@@ -184,5 +184,6 @@ enum s5m8767_regulators {
};

#define S5M8767_ENCTRL_SHIFT 6
+#define S5M8767_REG_LDO_SHIFT 7

#endif /* __LINUX_MFD_S5M8767_H */
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/