From 184de70057ae33df858639ed3f03e32d2cace1af Mon Sep 17 00:00:00 2001 From: Misael Lopez Cruz Date: Thu, 15 Jul 2010 12:08:07 -0500 Subject: ASoC: SDP4430: Configure TPS61305 to provide VDDHF Latest versions of SDP4430 ES2.0 have a TPS61305 boost converter to provide VDDHF supply. TPS61305 needs to be configured via I2C in order to provide the appropriate power supply. Signed-off-by: Misael Lopez Cruz Signed-off-by: Margarita Olaya Cabrera --- sound/soc/omap/sdp4430.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'sound') diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 1373a9164217..fc8d8dc44ab9 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -45,6 +46,27 @@ static int twl6040_power_mode; static struct snd_soc_card snd_soc_sdp4430; +static struct i2c_client *tps61305_client; +static struct i2c_board_info tps61305_hwmon_info = { + I2C_BOARD_INFO("tps61305", 0x33), +}; + +static int sdp4430_tps61305_configure(void) +{ + u8 data[2]; + + data[0] = 0x01; + data[1] = 0x60; + if (i2c_master_send(tps61305_client, data, 2) != 2) + printk(KERN_ERR "I2C write to TSP61305 failed\n"); + + data[0] = 0x02; + if (i2c_master_send(tps61305_client, data, 2) != 2) + printk(KERN_ERR "I2C write to TSP61305 failed\n"); + + return 0; +} + static int sdp4430_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -343,6 +365,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()) { @@ -355,6 +378,20 @@ static int __init sdp4430_soc_init(void) snd_soc_register_dais(&null_dai, 1); #endif + adapter = i2c_get_adapter(1); + if (!adapter) { + printk(KERN_ERR "can't get i2c adapter\n"); + return -ENODEV; + } + + tps61305_client = i2c_new_device(adapter, &tps61305_hwmon_info); + if (!tps61305_client) { + printk(KERN_ERR "can't add i2c device\n"); + return -ENODEV; + } + + sdp4430_tps61305_configure(); + sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); @@ -391,6 +428,7 @@ module_init(sdp4430_soc_init); static void __exit sdp4430_soc_exit(void) { platform_device_unregister(sdp4430_snd_device); + i2c_unregister_device(tps61305_client); } module_exit(sdp4430_soc_exit); -- cgit v1.2.3