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: 6424721 Return-Path: X-Original-To: patchwork-linux-input@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 EE8BEC0432 for ; Sun, 17 May 2015 16:29:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F03E82046F for ; Sun, 17 May 2015 16:29:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02721205FA for ; Sun, 17 May 2015 16:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753191AbbEQQ3o (ORCPT ); Sun, 17 May 2015 12:29:44 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:35607 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbbEQQ3m (ORCPT ); Sun, 17 May 2015 12:29:42 -0400 Received: by pdea3 with SMTP id a3so110492463pde.2; 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 Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@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 v3 13/17] ASoC: pxa: poodle: make use of new locomo GPIO interface 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> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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;