From patchwork Mon Apr 27 23:55:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 465324 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9B57E1400B7 for ; Tue, 28 Apr 2015 09:57:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=Ehy3owIl; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932223AbbD0X5s (ORCPT ); Mon, 27 Apr 2015 19:57:48 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:32842 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933107AbbD0X5r (ORCPT ); Mon, 27 Apr 2015 19:57:47 -0400 Received: by pdbnk13 with SMTP id nk13so144763113pdb.0; Mon, 27 Apr 2015 16:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pnlnz4UCwb/quP6G5izuwfEgU65uCmeFhXBF4HV+5uE=; b=Ehy3owIlFacjDPGS5mgqqzCcgHmurLXYsyEsWpjaeeI/DCdrudchtgcpuFnm0wa/as D9qMTItRgW0855qIVN3OSI0WkiQQI5uBsaaVMoSNS959SzI/lzCsi7tZ3zPkTfacYe5o GerkyFjZmIwFlpnzA81gmdwSZd9p4fQMrmaHodl9yND/IGTJTgB7zV0QrYo7zz4saPgw Z8Ft5jAM8C4+fwbCGVF1hbS0l7Hu+VL3lCUVF51M3a+b+Q/cTf2vjQebwi6F2puPm191 IB8z/4kPb2caDXSURZrXkZDge9qzQ9zAirS/BGDlRazuSG0dsYrks15F5ufHRiI/XgYX ZU3g== X-Received: by 10.70.101.200 with SMTP id fi8mr26481822pdb.161.1430179066419; Mon, 27 Apr 2015 16:57:46 -0700 (PDT) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id pv2sm20428375pbb.12.2015.04.27.16.57.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Apr 2015 16:57:45 -0700 (PDT) From: Dmitry Eremin-Solenikov To: Russell King , Daniel Mack , Robert Jarzmik , Linus Walleij , Alexandre Courbot , Wolfram Sang , Dmitry Torokhov , Bryan Wu , Richard Purdie , Samuel Ortiz , Lee Jones , Mark Brown , Jingoo Han , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Liam Girdwood , Andrea Adami Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-spi@vger.kernel.org, linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 13/17] ASoC: pxa: poodle: make use of new locomo GPIO interface Date: Tue, 28 Apr 2015 02:55:50 +0300 Message-Id: <1430178954-11138-14-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430178954-11138-1-git-send-email-dbaryshkov@gmail.com> References: <1430178954-11138-1-git-send-email-dbaryshkov@gmail.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Since LoCoMo driver has been converted to provide proper gpiolib interface, make poodle ASoC platform driver use gpiolib API. Signed-off-by: Dmitry Eremin-Solenikov Acked-by: Mark Brown Reviewed-by: Linus Walleij --- sound/soc/pxa/poodle.c | 52 +++++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 0fce8c4..c5b7c5e 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -20,15 +20,11 @@ #include #include #include +#include #include #include #include -#include -#include -#include -#include - #include "../codecs/wm8731.h" #include "pxa2xx-i2s.h" @@ -42,22 +38,18 @@ static int poodle_jack_func; static int poodle_spk_func; +static struct gpio_desc *poodle_mute_l, *poodle_mute_r, *poodle_amp_on; static void poodle_ext_control(struct snd_soc_dapm_context *dapm) { /* set up jack connection */ if (poodle_jack_func == POODLE_HP) { - /* set = unmute headphone */ - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_L, 1); - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_R, 1); + gpiod_set_value(poodle_mute_l, 0); + gpiod_set_value(poodle_mute_r, 0); snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); } else { - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_L, 0); - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_R, 0); + gpiod_set_value(poodle_mute_l, 1); + gpiod_set_value(poodle_mute_r, 1); snd_soc_dapm_disable_pin(dapm, "Headphone Jack"); } @@ -84,11 +76,8 @@ static int poodle_startup(struct snd_pcm_substream *substream) /* we need to unmute the HP at shutdown as the mute burns power on poodle */ static void poodle_shutdown(struct snd_pcm_substream *substream) { - /* set = unmute headphone */ - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_L, 1); - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_R, 1); + gpiod_set_value(poodle_mute_l, 0); + gpiod_set_value(poodle_mute_r, 0); } static int poodle_hw_params(struct snd_pcm_substream *substream, @@ -178,12 +167,7 @@ static int poodle_set_spk(struct snd_kcontrol *kcontrol, static int poodle_amp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { - if (SND_SOC_DAPM_EVENT_ON(event)) - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_AMP_ON, 0); - else - locomo_gpio_write(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_AMP_ON, 1); + gpiod_set_value(poodle_amp_on, (SND_SOC_DAPM_EVENT_ON(event))); return 0; } @@ -268,13 +252,17 @@ static int poodle_probe(struct platform_device *pdev) struct snd_soc_card *card = &poodle; int ret; - locomo_gpio_set_dir(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_AMP_ON, 0); - /* should we mute HP at startup - burning power ?*/ - locomo_gpio_set_dir(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_L, 0); - locomo_gpio_set_dir(&poodle_locomo_device.dev, - POODLE_LOCOMO_GPIO_MUTE_R, 0); + poodle_mute_l = devm_gpiod_get(&pdev->dev, "mute-l", GPIOD_OUT_HIGH); + if (IS_ERR(poodle_mute_l)) + return PTR_ERR(poodle_mute_l); + + poodle_mute_r = devm_gpiod_get(&pdev->dev, "mute-r", GPIOD_OUT_HIGH); + if (IS_ERR(poodle_mute_r)) + return PTR_ERR(poodle_mute_l); + + poodle_amp_on = devm_gpiod_get(&pdev->dev, "amp-on", GPIOD_OUT_LOW); + if (IS_ERR(poodle_amp_on)) + return PTR_ERR(poodle_amp_on); card->dev = &pdev->dev;