From patchwork Mon Jun 8 20:56:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 6568091 Return-Path: X-Original-To: patchwork-linux-arm@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 667A7C0020 for ; Mon, 8 Jun 2015 21:05:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BC4C2044C for ; Mon, 8 Jun 2015 21:05:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D1C420450 for ; Mon, 8 Jun 2015 21:05:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z24Bx-0005d2-Go; Mon, 08 Jun 2015 21:02:45 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z247F-0000u1-Ss for linux-arm-kernel@bombadil.infradead.org; Mon, 08 Jun 2015 20:57:54 +0000 Received: from mail-lb0-x230.google.com ([2a00:1450:4010:c04::230]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z247D-0001XG-07 for linux-arm-kernel@lists.infradead.org; Mon, 08 Jun 2015 20:57:51 +0000 Received: by lbbqq2 with SMTP id qq2so88389330lbb.3 for ; Mon, 08 Jun 2015 13:57:28 -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=HQySzERXFnj/BAQxpZnBfUtt6CRWiaO+Q9nTTNBSu+c=; b=nMp559ldnI8kc7QXL5KU3eT3/BrqLjwD2dz+7vbbYJLreXwYZpqiyaUKJzchqN1Hrh L56CbiU/dbKvrVTdFjQWD8tyq8U6xv6aFs2diJ4G+J+JTmgh/IZJ9CNpNCJz5bCF9BV4 L+IPJS1oJuKUMxcKfsI8ib40f9Kpk6NC1t1ot31oomRXWWkfYAC1V8doVLZ0Vc8aV+po wrTIsiL/yOVC4AMor17k194o1I9jt+WefvcRG8HFPzLCfzT3yTR9nTNwIcv+RF/EGOlO aIUB7/D85k+SkDcH1NoXRb5TwHQN/VpNhKDpUD6lwb/n7kfEVBdLKwYgxbKy0F9Dftgo ntZg== X-Received: by 10.152.5.2 with SMTP id o2mr13928167lao.79.1433797048446; Mon, 08 Jun 2015 13:57:28 -0700 (PDT) Received: from anuminas.rup.mentorg.com (ppp89-110-20-81.pppoe.avangarddsl.ru. [89.110.20.81]) by mx.google.com with ESMTPSA id s8sm892556las.29.2015.06.08.13.57.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Jun 2015 13:57:27 -0700 (PDT) From: Dmitry Eremin-Solenikov To: Russell King , Lee Jones Subject: [PATCH v5 13/17] ASoC: pxa: poodle: make use of new locomo GPIO interface Date: Mon, 8 Jun 2015 23:56:44 +0300 Message-Id: <1433797008-6246-14-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433797008-6246-1-git-send-email-dbaryshkov@gmail.com> References: <1433797008-6246-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150608_215751_108858_868CFC54 X-CRM114-Status: GOOD ( 14.59 ) X-Spam-Score: -2.7 (--) Cc: Andrea Adami , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 Reviewed-by: Linus Walleij Acked-by: Mark Brown --- 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;