From patchwork Mon May 25 11:41:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 6473931 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9BCDD9F399 for ; Mon, 25 May 2015 11:52:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E5D882049C for ; Mon, 25 May 2015 11:52:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CA31D20253 for ; Mon, 25 May 2015 11:52:30 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DF5322614D4; Mon, 25 May 2015 13:52:29 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1F738261A5F; Mon, 25 May 2015 13:45:23 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7841B261A76; Mon, 25 May 2015 13:45:22 +0200 (CEST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by alsa0.perex.cz (Postfix) with ESMTP id EC02F2612E3 for ; Mon, 25 May 2015 13:42:47 +0200 (CEST) Received: by lbbqq2 with SMTP id qq2so50062605lbb.3 for ; Mon, 25 May 2015 04:42:47 -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=8gkTU9/h77hgTeFAW+YoWneTbfBovIEJTLkik4+5nYM=; b=LIf/GSXz9W1i78CSHFzPFiPar+k75Ci2ZTcFLqrrRNq8HxRFyb9lGLV28Czzg7xKz6 cTDu9nb+mVYOaon82X5KWOYcZQTPOycI+oHUkvb27XUZaZbaOhQbujkOM1nNIt0mrRKy A6qw45vaN5DjPrESZ7QkTqQ6XEZbo83szW3yUd4rO0gfCJ0/p16jtfAWDR0CfpXPXkxq lImxZY/3AnIC083wYBijiRV/xm4XfpcV+y9RHe8BWG+R+1dCFihO8yOPy4PTCU0g664l EEy/LZ0uG5/SVV6daSg4CBQJCSCoEEgARwDKwvV39PFA+pZwn2s29001gDs/K7UB3HoG YE8A== X-Received: by 10.152.234.139 with SMTP id ue11mr17949148lac.28.1432554167267; Mon, 25 May 2015 04:42:47 -0700 (PDT) Received: from anuminas.rup.mentorg.com (ppp89-110-13-209.pppoe.avangarddsl.ru. [89.110.13.209]) by mx.google.com with ESMTPSA id si3sm2315895lbb.32.2015.05.25.04.42.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 May 2015 04:42:46 -0700 (PDT) From: Dmitry Eremin-Solenikov To: Russell King , Daniel Mack , Robert Jarzmik , Linus Walleij , Alexandre Courbot , Dmitry Torokhov , Samuel Ortiz , Lee Jones , Mark Brown , Jingoo Han , Liam Girdwood , Andrea Adami Date: Mon, 25 May 2015 14:41:49 +0300 Message-Id: <1432554113-26280-15-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432554113-26280-1-git-send-email-dbaryshkov@gmail.com> References: <1432554113-26280-1-git-send-email-dbaryshkov@gmail.com> Cc: linux-gpio@vger.kernel.org, alsa-devel@alsa-project.org, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org Subject: [alsa-devel] [PATCH v4 14/18] ASoC: pxa: poodle: make use of new locomo GPIO interface X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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;