From patchwork Tue Oct 28 00:02:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 5167571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C1AC69F349 for ; Tue, 28 Oct 2014 00:09:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA964201DD for ; Tue, 28 Oct 2014 00:09:03 +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 EBF44201F5 for ; Tue, 28 Oct 2014 00:09:02 +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 1XiuIw-00085x-5C; Tue, 28 Oct 2014 00:06:30 +0000 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XiuFl-0004By-Mz for linux-arm-kernel@lists.infradead.org; Tue, 28 Oct 2014 00:03:14 +0000 Received: by mail-wg0-f46.google.com with SMTP id x13so2528087wgg.5 for ; Mon, 27 Oct 2014 17:02:51 -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=XHO8qjQ4ufPaTWIM8yYmyc7jg/AnvUn56jDaZHAKkJE=; b=pD5CVk3Ajcw2FELEf8yEJgmwLgTRuzCqGB8rOSv3pWSo/g0rGFRjyIoI9a9QTgX4QX h+3/hWTWHovoc9JPlZ1l1TiVbnfLPOaG99KkfYZD8SD+P37xMHajbhQ2IcX5O8v8YLpC QzETNMsg0WW6+sWXLyyxq3BozObuc0CGv/96MvcuT+8zFvnyMm6xU3YXS/PxcQ/kM2H0 zONjag6030boDYbDOuwi92l7ryllCUMIUE8YsYnkT9pqI+16SlSn6nm8dhVMWekh352R oTphTty5FW5tM3eUp1myx6rpHWc3AMS8Sw8ymNq1FBJ86vk8YGvUZDv6t6YS8e717YP9 Bgiw== X-Received: by 10.180.87.73 with SMTP id v9mr24362448wiz.22.1414454571407; Mon, 27 Oct 2014 17:02:51 -0700 (PDT) Received: from fangorn.rup.mentorg.com (nat-min.mentorg.com. [139.181.32.34]) by mx.google.com with ESMTPSA id fq1sm13495340wib.12.2014.10.27.17.02.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Oct 2014 17:02:50 -0700 (PDT) From: Dmitry Eremin-Solenikov To: 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 11/15] sound: soc: poodle: make use of new locomo GPIO interface Date: Tue, 28 Oct 2014 03:02:04 +0300 Message-Id: <1414454528-24240-12-git-send-email-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1414454528-24240-1-git-send-email-dbaryshkov@gmail.com> References: <1414454528-24240-1-git-send-email-dbaryshkov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141027_170313_958084_189AD61A X-CRM114-Status: GOOD ( 15.77 ) X-Spam-Score: -0.8 (/) Cc: Alexandre Courbot , Bryan Wu , Russell King , Samuel Ortiz , Lee Jones , Linus Walleij , Dmitry Torokhov , Liam Girdwood , Haojian Zhuang , Mark Brown , Andrea Adami , Jingoo Han , Richard Purdie , Robert Jarzmik , Daniel Mack 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=-2.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 --- sound/soc/pxa/poodle.c | 51 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 21f3400..a593bff 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -20,12 +20,12 @@ #include #include #include +#include #include #include #include #include -#include #include #include @@ -48,16 +48,12 @@ 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); + gpio_set_value(POODLE_GPIO_MUTE_L, 1); + gpio_set_value(POODLE_GPIO_MUTE_R, 1); 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); + gpio_set_value(POODLE_GPIO_MUTE_L, 0); + gpio_set_value(POODLE_GPIO_MUTE_R, 0); snd_soc_dapm_disable_pin(dapm, "Headphone Jack"); } @@ -85,10 +81,8 @@ static int poodle_startup(struct snd_pcm_substream *substream) 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); + gpio_set_value(POODLE_GPIO_MUTE_L, 1); + gpio_set_value(POODLE_GPIO_MUTE_R, 1); } static int poodle_hw_params(struct snd_pcm_substream *substream, @@ -178,12 +172,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); + gpio_set_value(POODLE_GPIO_AMP_ON, !(SND_SOC_DAPM_EVENT_ON(event))); return 0; } @@ -263,25 +252,32 @@ static struct snd_soc_card poodle = { .num_dapm_routes = ARRAY_SIZE(poodle_audio_map), }; +struct gpio poodle_gpios[] = { + { POODLE_GPIO_AMP_ON, GPIOF_OUT_INIT_HIGH, "Amplifier" }, + { POODLE_GPIO_MUTE_L, GPIOF_OUT_INIT_LOW, "Mute left" }, + { POODLE_GPIO_MUTE_R, GPIOF_OUT_INIT_LOW, "Mute right" }, +}; + 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); + ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios)); + if (ret) { + dev_err(&pdev->dev, "gpio_request_array() failed: %d\n", + ret); + return ret; + } card->dev = &pdev->dev; ret = snd_soc_register_card(card); - if (ret) + if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + gpio_free_array(poodle_gpios, ARRAY_SIZE(poodle_gpios)); + } return ret; } @@ -290,6 +286,7 @@ static int poodle_remove(struct platform_device *pdev) struct snd_soc_card *card = platform_get_drvdata(pdev); snd_soc_unregister_card(card); + gpio_free_array(poodle_gpios, ARRAY_SIZE(poodle_gpios)); return 0; }