audio: fixed the WARNING caused by audio driver [1/1]
authorjian.zhou <jian.zhou@amlogic.com>
Tue, 6 Aug 2019 11:33:19 +0000 (07:33 -0400)
committerTao Zeng <tao.zeng@amlogic.com>
Thu, 8 Aug 2019 06:35:38 +0000 (23:35 -0700)
PD#SWPL-12161

Problem:
Power on the DUT, look at the  printing log,
it will prompt WARNING:gpio/gpiolib.c:106

Solution:
when get gpio below 0,
no need to call devm_gpio_request_one function
as 2 ad82584f use the same gpio

Verify:
T962E2 AB311

Change-Id: Iad8ded3a8a0e94229281aa50462b7c09c627a70f
Signed-off-by: jian.zhou <jian.zhou@amlogic.com>
sound/soc/codecs/amlogic/ad82584f.c

index f76a2f9..1f384d0 100644 (file)
@@ -856,7 +856,7 @@ static int ad82584f_probe(struct snd_soc_codec *codec)
 {
        struct ad82584f_priv *ad82584f = snd_soc_codec_get_drvdata(codec);
        struct ad82584f_platform_data *pdata = ad82584f->pdata;
-       int ret;
+       int ret = 0;
 
 #ifdef CONFIG_HAS_EARLYSUSPEND
        ad82584f->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;
@@ -866,12 +866,15 @@ static int ad82584f_probe(struct snd_soc_codec *codec)
        register_early_suspend(&(ad82584f->early_suspend));
 #endif
 
-       ret = devm_gpio_request_one(codec->dev, pdata->reset_pin,
-                                       GPIOF_OUT_INIT_LOW,
-                                       "ad82584f-reset-pin");
-       if (ret < 0) {
-               dev_err(codec->dev, "ad82584f get gpio error!\n");
-               return -1;
+       if (pdata->reset_pin > 0) {
+               ret = devm_gpio_request_one(codec->dev, pdata->reset_pin,
+                                               GPIOF_OUT_INIT_LOW,
+                                               "ad82584f-reset-pin");
+
+               if (ret < 0) {
+                       dev_err(codec->dev, "ad82584f get gpio error!\n");
+                       return -1;
+               }
        }
 
        ad82584f_init(codec);