aboutsummaryrefslogtreecommitdiffstats
path: root/bsp/pandaboard/ASoC-sdp4430-Configure-TPS6130x-to-provide-VDDHF.patch
blob: c6cf9be2a949d254d7c74c8443383732a95caf65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
From 461c26ec4a6f3de0bff21ef16d82ce6cccc7f613 Mon Sep 17 00:00:00 2001
From: David Anders <x0132446@ti.com>
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 <misael.lopez@ti.com>
Signed-off-by: David Anders <x0132446@ti.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Integrated-by: Jingdong Lu <jingdong.lu@windriver.com>
---
 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 <linux/clk.h>
 #include <linux/platform_device.h>
 #include <sound/core.h>
+#include <linux/i2c.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
 #include <sound/jack.h>
@@ -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