aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@ti.com>2011-07-24 15:59:49 -0400
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:18:28 -0400
commit3af1d2688b9e3a99e6eba3be193fd5096751d328 (patch)
tree0600c4f155566c42d660c9517f49625fbc34959b
parente6f33a4f8a57e31ba386eab5d2d7c06a88268553 (diff)
Subject: [PATCH 090/104] ASoC: sdp4430 - enable boost hands free converter
This enables the handsfree coost converter on the sdp4430. TODO: Make this use DAPM, make I2C logic sdp4430 only Signed-off-by: Liam Girdwood <lrg@ti.com>
-rw-r--r--sound/soc/omap/sdp4430.c57
1 files changed, 52 insertions, 5 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 283c42feb70..c6c09559385 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -45,6 +45,27 @@
45 45
46static int twl6040_power_mode; 46static int twl6040_power_mode;
47static int mcbsp_cfg; 47static int mcbsp_cfg;
48static struct i2c_client *tps6130x_client;
49static struct i2c_board_info tps6130x_hwmon_info = {
50 I2C_BOARD_INFO("tps6130x", 0x33),
51};
52
53/* configure the TPS6130x Handsfree Boost Converter */
54static int sdp4430_tps6130x_configure(void)
55{
56 u8 data[2];
57
58 data[0] = 0x01;
59 data[1] = 0x60;
60 if (i2c_master_send(tps6130x_client, data, 2) != 2)
61 printk(KERN_ERR "I2C write to TPS6130x failed\n");
62
63 data[0] = 0x02;
64 if (i2c_master_send(tps6130x_client, data, 2) != 2)
65 printk(KERN_ERR "I2C write to TPS6130x failed\n");
66
67 return 0;
68}
48 69
49static int sdp4430_mcpdm_hw_params(struct snd_pcm_substream *substream, 70static int sdp4430_mcpdm_hw_params(struct snd_pcm_substream *substream,
50 struct snd_pcm_hw_params *params) 71 struct snd_pcm_hw_params *params)
@@ -750,7 +771,7 @@ static struct snd_soc_card snd_soc_sdp4430 = {
750}; 771};
751 772
752static struct platform_device *sdp4430_snd_device; 773static struct platform_device *sdp4430_snd_device;
753struct i2c_adapter *adapter; 774static struct i2c_adapter *adapter;
754 775
755static int __init sdp4430_soc_init(void) 776static int __init sdp4430_soc_init(void)
756{ 777{
@@ -774,17 +795,40 @@ static int __init sdp4430_soc_init(void)
774 795
775 ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); 796 ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai));
776 if (ret < 0) 797 if (ret < 0)
777 goto err; 798 goto err_dai;
778 platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); 799 platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430);
779 800
780 ret = platform_device_add(sdp4430_snd_device); 801 ret = platform_device_add(sdp4430_snd_device);
781 if (ret) 802 if (ret)
782 goto err; 803 goto err_dev;
804
805 adapter = i2c_get_adapter(1);
806 if (!adapter) {
807 printk(KERN_ERR "can't get i2c adapter\n");
808 ret = -ENODEV;
809 goto err_adap;
810 }
811
812 tps6130x_client = i2c_new_device(adapter, &tps6130x_hwmon_info);
813 if (!tps6130x_client) {
814 printk(KERN_ERR "can't add i2c device\n");
815 ret = -ENODEV;
816 goto err_i2c;
817 }
818
819 /* Only configure the TPS6130x on SDP4430 */
820 if (machine_is_omap_4430sdp())
821 sdp4430_tps6130x_configure();
783 822
784 return 0; 823 return 0;
785 824
786err: 825err_i2c:
787 printk(KERN_ERR "Unable to add platform device\n"); 826 i2c_put_adapter(adapter);
827err_adap:
828 platform_device_del(sdp4430_snd_device);
829err_dev:
830 snd_soc_unregister_dais(&sdp4430_snd_device->dev, ARRAY_SIZE(dai));
831err_dai:
788 platform_device_put(sdp4430_snd_device); 832 platform_device_put(sdp4430_snd_device);
789 return ret; 833 return ret;
790} 834}
@@ -793,6 +837,9 @@ module_init(sdp4430_soc_init);
793static void __exit sdp4430_soc_exit(void) 837static void __exit sdp4430_soc_exit(void)
794{ 838{
795 platform_device_unregister(sdp4430_snd_device); 839 platform_device_unregister(sdp4430_snd_device);
840 snd_soc_unregister_dais(&sdp4430_snd_device->dev, ARRAY_SIZE(dai));
841 i2c_unregister_device(tps6130x_client);
842 i2c_put_adapter(adapter);
796} 843}
797module_exit(sdp4430_soc_exit); 844module_exit(sdp4430_soc_exit);
798 845