From f21feb49d05e80f4fb4ba99cc23500c9f9534481 Mon Sep 17 00:00:00 2001 From: Adrian Alonso Date: Mon, 19 Dec 2011 16:10:31 -0600 Subject: [PATCH] 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 --- include/linux/fsl_devices.h | 1 + sound/soc/imx/imx-cs42888.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index d629691ae539..2e99580f6e9e 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h @@ -316,6 +316,7 @@ struct mxc_audio_platform_data { int hp_active_low; /* headphone irq is active loaw */ int sysclk; + int rst_gpio; int (*init) (void); /* board specific init */ int (*amp_enable) (int enable); 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; } -- 2.39.5