msm: mpq8064: Add support to enable 100KHz level shifter
cs8427 chip will be functional at i2c 100KHz frequency and
3.3 to 5V to enable this level shifter should be enabled
Change-Id: I4d30c597edc3367be89280edc85e2a272a67ae1e
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index d02b4be..d868d52 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -892,9 +892,31 @@
},
};
+/* enable the level shifter for cs8427 to make sure the I2C
+ * clock is running at 100KHz and voltage levels are at 3.3
+ * and 5 volts
+ */
+static int enable_100KHz_ls(int enable)
+{
+ int ret = 0;
+ if (enable) {
+ ret = gpio_request(SX150X_GPIO(1, 10),
+ "cs8427_100KHZ_ENABLE");
+ if (ret) {
+ pr_err("%s: Failed to request gpio %d\n", __func__,
+ SX150X_GPIO(1, 10));
+ return ret;
+ }
+ gpio_direction_output(SX150X_GPIO(1, 10), 1);
+ } else
+ gpio_free(SX150X_GPIO(1, 10));
+ return ret;
+}
+
static struct cs8427_platform_data cs8427_i2c_platform_data = {
.irq = SX150X_GPIO(1, 4),
.reset_gpio = SX150X_GPIO(1, 6),
+ .enable = enable_100KHz_ls,
};
static struct i2c_board_info cs8427_device_info[] __initdata = {