summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorAdrian Alonso <aalonso@freescale.com>2011-12-19 16:10:31 -0600
committerJason Liu <r64343@freescale.com>2012-01-09 21:12:00 +0800
commite7d420f8d354b8dbd1546e957646660d2f990e46 (patch)
treec3155891870d83e6aa717dbf32f0228b077bf91b /sound/soc
parente30391fd3de9414f98841d7fd589e896054ae9c8 (diff)
ENGR00170626 imx-cs42888: avoid codded gpio reset definition
* Remove hard codded gpio reset definition * Add in mxc_audio_platform_data reset gpio reference to be able to pass gpio reset assignment in board definition file instead of a macro for each different board. * Add plat_data null check, return EINV if no set. Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/imx/imx-cs42888.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sound/soc/imx/imx-cs42888.c b/sound/soc/imx/imx-cs42888.c
index 4c9ca9857464..71d519e676e4 100644
--- a/sound/soc/imx/imx-cs42888.c
+++ b/sound/soc/imx/imx-cs42888.c
@@ -40,6 +40,7 @@ struct imx_priv_state {
static struct imx_priv_state hw_state;
unsigned int mclk_freq;
+int rst_gpio;
static int imx_3stack_startup(struct snd_pcm_substream *substream)
{
@@ -48,9 +49,15 @@ static int imx_3stack_startup(struct snd_pcm_substream *substream)
if (!cpu_dai->active) {
hw_state.hw = 0;
- gpio_direction_output(CS42888_RST, 0);
- msleep(100);
- gpio_direction_output(CS42888_RST, 1);
+ if (rst_gpio) {
+ gpio_direction_output(rst_gpio, 0);
+ msleep(100);
+ gpio_direction_output(rst_gpio, 1);
+ } else {
+ gpio_direction_output(CS42888_RST, 0);
+ msleep(100);
+ gpio_direction_output(CS42888_RST, 1);
+ }
}
return 0;
@@ -254,7 +261,13 @@ static struct snd_soc_card snd_soc_card_imx_3stack = {
static int __devinit imx_3stack_cs42888_probe(struct platform_device *pdev)
{
struct mxc_audio_platform_data *plat_data = pdev->dev.platform_data;
+
+ if (!plat_data) {
+ dev_err(&pdev->dev, "plat_data is missing\n");
+ return -EINVAL;
+ }
mclk_freq = plat_data->sysclk;
+ rst_gpio = plat_data->rst_gpio;
return 0;
}