aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-09-17 01:34:31 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-17 07:35:08 -0400
commitd41789b2660e5b18b8401bf83ebcd502916c2cb5 (patch)
tree847bc18e076d820d8956dce1f681a7e02c1c2ac1 /sound
parent7f22fd9c03c0b67ee6aa138bd10ae91bb0d22151 (diff)
ASoC: mx27vis: retrieve gpio numbers from platform_data
Rather than including mach/iomux-mx27.h to define gpio numbers and set up the pins, the patch moves all these into machine code and has the gpio numbers passed to driver via platform_data. As the result, we can remove the mach/iomux-mx27.h inclusion from driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/mx27vis-aic32x4.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/sound/soc/fsl/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c
index f6d04ad4bb39..2b76877b1789 100644
--- a/sound/soc/fsl/mx27vis-aic32x4.c
+++ b/sound/soc/fsl/mx27vis-aic32x4.c
@@ -26,13 +26,13 @@
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/platform_data/asoc-mx27vis.h>
29#include <sound/core.h> 30#include <sound/core.h>
30#include <sound/pcm.h> 31#include <sound/pcm.h>
31#include <sound/soc.h> 32#include <sound/soc.h>
32#include <sound/soc-dapm.h> 33#include <sound/soc-dapm.h>
33#include <sound/tlv.h> 34#include <sound/tlv.h>
34#include <asm/mach-types.h> 35#include <asm/mach-types.h>
35#include <mach/iomux-mx27.h>
36 36
37#include "../codecs/tlv320aic32x4.h" 37#include "../codecs/tlv320aic32x4.h"
38#include "imx-ssi.h" 38#include "imx-ssi.h"
@@ -41,20 +41,12 @@
41#define MX27VIS_AMP_GAIN 0 41#define MX27VIS_AMP_GAIN 0
42#define MX27VIS_AMP_MUTE 1 42#define MX27VIS_AMP_MUTE 1
43 43
44#define MX27VIS_PIN_G0 (GPIO_PORTF + 9)
45#define MX27VIS_PIN_G1 (GPIO_PORTF + 8)
46#define MX27VIS_PIN_SDL (GPIO_PORTE + 5)
47#define MX27VIS_PIN_SDR (GPIO_PORTF + 7)
48
49static int mx27vis_amp_gain; 44static int mx27vis_amp_gain;
50static int mx27vis_amp_mute; 45static int mx27vis_amp_mute;
51 46static int mx27vis_amp_gain0_gpio;
52static const int mx27vis_amp_pins[] = { 47static int mx27vis_amp_gain1_gpio;
53 MX27VIS_PIN_G0 | GPIO_GPIO | GPIO_OUT, 48static int mx27vis_amp_mutel_gpio;
54 MX27VIS_PIN_G1 | GPIO_GPIO | GPIO_OUT, 49static int mx27vis_amp_muter_gpio;
55 MX27VIS_PIN_SDL | GPIO_GPIO | GPIO_OUT,
56 MX27VIS_PIN_SDR | GPIO_GPIO | GPIO_OUT,
57};
58 50
59static int mx27vis_aic32x4_hw_params(struct snd_pcm_substream *substream, 51static int mx27vis_aic32x4_hw_params(struct snd_pcm_substream *substream,
60 struct snd_pcm_hw_params *params) 52 struct snd_pcm_hw_params *params)
@@ -109,13 +101,13 @@ static int mx27vis_amp_set(struct snd_kcontrol *kcontrol,
109 101
110 switch (reg) { 102 switch (reg) {
111 case MX27VIS_AMP_GAIN: 103 case MX27VIS_AMP_GAIN:
112 gpio_set_value(MX27VIS_PIN_G0, value & 1); 104 gpio_set_value(mx27vis_amp_gain0_gpio, value & 1);
113 gpio_set_value(MX27VIS_PIN_G1, value >> 1); 105 gpio_set_value(mx27vis_amp_gain1_gpio, value >> 1);
114 mx27vis_amp_gain = value; 106 mx27vis_amp_gain = value;
115 break; 107 break;
116 case MX27VIS_AMP_MUTE: 108 case MX27VIS_AMP_MUTE:
117 gpio_set_value(MX27VIS_PIN_SDL, value & 1); 109 gpio_set_value(mx27vis_amp_mutel_gpio, value & 1);
118 gpio_set_value(MX27VIS_PIN_SDR, value >> 1); 110 gpio_set_value(mx27vis_amp_muter_gpio, value >> 1);
119 mx27vis_amp_mute = value; 111 mx27vis_amp_mute = value;
120 break; 112 break;
121 } 113 }
@@ -190,8 +182,19 @@ static struct snd_soc_card mx27vis_aic32x4 = {
190 182
191static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev) 183static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev)
192{ 184{
185 struct snd_mx27vis_platform_data *pdata = pdev->dev.platform_data;
193 int ret; 186 int ret;
194 187
188 if (!pdata) {
189 dev_err(&pdev->dev, "No platform data supplied\n");
190 return -EINVAL;
191 }
192
193 mx27vis_amp_gain0_gpio = pdata->amp_gain0_gpio;
194 mx27vis_amp_gain1_gpio = pdata->amp_gain1_gpio;
195 mx27vis_amp_mutel_gpio = pdata->amp_mutel_gpio;
196 mx27vis_amp_muter_gpio = pdata->amp_muter_gpio;
197
195 mx27vis_aic32x4.dev = &pdev->dev; 198 mx27vis_aic32x4.dev = &pdev->dev;
196 ret = snd_soc_register_card(&mx27vis_aic32x4); 199 ret = snd_soc_register_card(&mx27vis_aic32x4);
197 if (ret) { 200 if (ret) {
@@ -213,11 +216,6 @@ static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev)
213 IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) 216 IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0)
214 ); 217 );
215 218
216 ret = mxc_gpio_setup_multiple_pins(mx27vis_amp_pins,
217 ARRAY_SIZE(mx27vis_amp_pins), "MX27VIS_AMP");
218 if (ret)
219 printk(KERN_ERR "ASoC: unable to setup gpios\n");
220
221 return ret; 219 return ret;
222} 220}
223 221