From patchwork Sun May 17 16:27:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 6425061 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 81687C0432 for ; Sun, 17 May 2015 16:37:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2A88200DC for ; Sun, 17 May 2015 16:37:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5A7CE205D4 for ; Sun, 17 May 2015 16:37:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6F4AA2604D1; Sun, 17 May 2015 18:37:36 +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 60FF0260573; Sun, 17 May 2015 18:32:02 +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 CA336260595; Sun, 17 May 2015 18:32:01 +0200 (CEST) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by alsa0.perex.cz (Postfix) with ESMTP id C84BA260440 for ; Sun, 17 May 2015 18:29:42 +0200 (CEST) Received: by padbw4 with SMTP id bw4so113870986pad.0 for ; Sun, 17 May 2015 09:29:42 -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=N9g6Twg/cQRtdAAGBiwz6KGDR5wWa6CreJeWV/heyq24RNK+x9naB5hzrPJGMzvjKl DETaZh3CVneHjA/ejuE22juq/QRpO7hZUmyvobnJZ2v/zb9+IRSI8VfL0f5BZxqXi5LL UX0t9rvkdtQ61CSqX/DxuO3uTydxhBXNQ6Nq8i9U2XkKPV29hXI0UOx0n/3WYUBNh+w/ PGYld1oPDeyp9b/Nxo/Ruq6L4kFQ6nECPhVDsLS6sPHsNtCIArNJvNh97oPdkmcSz60j v6W1RfpbuKo4YFUWnVh708e5OzmcS0duCfDqDaAj2K6t4HG0CzAnDXCh5wcC2JndrcG1 NdrQ== X-Received: by 10.66.145.162 with SMTP id sv2mr36857749pab.124.1431880182161; Sun, 17 May 2015 09:29:42 -0700 (PDT) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id pw9sm7574264pac.27.2015.05.17.09.29.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 09:29:41 -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 Date: Sun, 17 May 2015 19:27:53 +0300 Message-Id: <1431880077-26321-14-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431880077-26321-1-git-send-email-dbaryshkov@gmail.com> References: <1431880077-26321-1-git-send-email-dbaryshkov@gmail.com> Cc: linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org, linux-spi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org Subject: [alsa-devel] [PATCH v3 13/17] 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;