]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00170626 imx-cs42888: avoid codded gpio reset definition
authorAdrian Alonso <aalonso@freescale.com>
Mon, 19 Dec 2011 22:10:31 +0000 (16:10 -0600)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:10:23 +0000 (14:10 +0200)
* 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>
include/linux/fsl_devices.h
sound/soc/imx/imx-cs42888.c

index d629691ae539222dd924f6eb26bc91a379755496..2e99580f6e9ecdef299a23b4fbbbe50f5914e6e1 100644 (file)
@@ -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);
index 4c9ca9857464696c7107b5d88ad5acb8b475239d..71d519e676e47710621c3f95932e4fcda371f33f 100644 (file)
@@ -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;
 }