From 461c26ec4a6f3de0bff21ef16d82ce6cccc7f613 Mon Sep 17 00:00:00 2001 From: David Anders Date: Fri, 13 Aug 2010 10:45:16 -0500 Subject: [PATCH 44/60] ASoC: sdp4430: Configure TPS6130x to provide VDDHF commit 8a8964b4384d1b1d37c73a680caad2f2eee21583 upstream SDP4430 uses a TPS6130X boost converter to provide TWL6040 VDDHF supply. TPS61300/TPS61301 have ENVM to force voltage regulation mode which is connected to TWL6040 GPO2, and there is no need to explicitly enable the regulator. TPS61305/TPS61306 don't have ENVM, so it's required to enable voltage regulation mode through i2c registers. Change-Id: Iedfcf2933563d9c1fa07e290de6fd473374276a9 Signed-off-by: Misael Lopez Cruz Signed-off-by: David Anders Signed-off-by: Liam Girdwood Signed-off-by: Margarita Olaya Cabrera Integrated-by: Jingdong Lu --- sound/soc/omap/sdp4430.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 809f5fc..96fc030 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,28 @@ static int twl6040_power_mode; +static struct i2c_client *tps6130x_client; +static struct i2c_board_info tps6130x_hwmon_info = { + I2C_BOARD_INFO("tps6130x", 0x33), +}; + +/* configure the TPS6130x Handsfree Boost Converter */ +static int sdp4430_tps6130x_configure(void) +{ + u8 data[2]; + + data[0] = 0x01; + data[1] = 0x60; + if (i2c_master_send(tps6130x_client, data, 2) != 2) + printk(KERN_ERR "I2C write to TPS6130x failed\n"); + + data[0] = 0x02; + if (i2c_master_send(tps6130x_client, data, 2) != 2) + printk(KERN_ERR "I2C write to TPS6130x failed\n"); + + return 0; +} + static int sdp4430_mcpdm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -717,6 +740,7 @@ static struct platform_device *sdp4430_snd_device; static int __init sdp4430_soc_init(void) { + struct i2c_adapter *adapter; int ret; if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda()) { @@ -739,6 +763,22 @@ static int __init sdp4430_soc_init(void) if (ret) goto err; + adapter = i2c_get_adapter(1); + if (!adapter) { + printk(KERN_ERR "can't get i2c adapter\n"); + return -ENODEV; + } + + tps6130x_client = i2c_new_device(adapter, &tps6130x_hwmon_info); + if (!tps6130x_client) { + printk(KERN_ERR "can't add i2c device\n"); + return -ENODEV; + } + + /* Only configure the TPS6130x on SDP4430 */ + if (machine_is_omap_4430sdp()) + sdp4430_tps6130x_configure(); + /* Codec starts in HP mode */ twl6040_power_mode = 1; @@ -754,6 +794,7 @@ module_init(sdp4430_soc_init); static void __exit sdp4430_soc_exit(void) { platform_device_unregister(sdp4430_snd_device); + i2c_unregister_device(tps6130x_client); } module_exit(sdp4430_soc_exit); -- 1.7.4.1