summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMisael Lopez Cruz <misael.lopez@ti.com>2011-02-06 21:38:52 -0600
committerDan Murphy <dmurphy@ti.com>2011-02-07 12:55:53 -0600
commit629625a0de585728ff420e95f06d9b454e8fd977 (patch)
tree465c99084e7a44060f8fb14080893f998c749d3c /sound
parentdad4c4585ef6a3cabd12b42da92329128b96e4af (diff)
ASoC: sdp4430: Enable tps6130x during machine probe
A different version of TPS6130x has been used in different sdp4430 versions. TWL6040 GPO2 is connected to TPS6130x D3 pin, which may correspond to NRESET (TPS61301/TPS61305) or ENDCL (TPS61300/TP61306). Asserting GPO2 is required to allow i2c access to TPS6130x chip. GPO2 was enabled before in TWL6040 CODEC driver, but is moved from there as it's a machine specific configuration. Change-Id: Ifa397a65cc69cb790b17281e68416e12a34a1269 Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/sdp4430.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index f845e9b9db78..69dbe1bee648 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -23,6 +23,7 @@
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/mfd/twl6040-codec.h>
+#include <linux/i2c/twl.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -45,6 +46,8 @@
#include "omap-hdmi.h"
#endif
+#define TPS6130X_I2C_ADAPTER 1
+
static int twl6040_power_mode;
static int mcbsp_cfg;
@@ -829,6 +832,7 @@ static struct platform_device *sdp4430_snd_device;
static int __init sdp4430_soc_init(void)
{
struct i2c_adapter *adapter;
+ u8 gpoctl;
int ret;
if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda()) {
@@ -851,24 +855,41 @@ 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;
- }
+ /* enable tps6130x */
+ ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &gpoctl,
+ TWL6040_REG_GPOCTL);
+ if (ret)
+ goto err;
+
+ ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, gpoctl | TWL6040_GPO2,
+ TWL6040_REG_GPOCTL);
+ if (ret)
+ goto err;
+
+ adapter = i2c_get_adapter(TPS6130X_I2C_ADAPTER);
+ if (!adapter) {
+ printk(KERN_ERR "can't get i2c adapter\n");
+ ret = -ENODEV;
+ goto adp_err;
+ }
tps6130x_client = i2c_new_device(adapter, &tps6130x_hwmon_info);
if (!tps6130x_client) {
- printk(KERN_ERR "can't add i2c device\n");
- return -ENODEV;
- }
+ printk(KERN_ERR "can't add i2c device\n");
+ ret = -ENODEV;
+ goto tps_err;
+ }
/* Only configure the TPS6130x on SDP4430 */
if (machine_is_omap_4430sdp())
sdp4430_tps6130x_configure();
- return 0;
+ return ret;
+tps_err:
+ i2c_put_adapter(adapter);
+adp_err:
+ twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, gpoctl, TWL6040_REG_GPOCTL);
err:
printk(KERN_ERR "Unable to add platform device\n");
platform_device_put(sdp4430_snd_device);