From patchwork Mon Jan 26 20:51:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 5712651 Return-Path: X-Original-To: patchwork-linux-omap@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 D47C8C058D for ; Mon, 26 Jan 2015 20:53:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C907C2010C for ; Mon, 26 Jan 2015 20:53:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3A802011E for ; Mon, 26 Jan 2015 20:53:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753568AbbAZUxL (ORCPT ); Mon, 26 Jan 2015 15:53:11 -0500 Received: from mail-we0-f175.google.com ([74.125.82.175]:34898 "EHLO mail-we0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754058AbbAZUxK (ORCPT ); Mon, 26 Jan 2015 15:53:10 -0500 Received: by mail-we0-f175.google.com with SMTP id p10so11375090wes.6; Mon, 26 Jan 2015 12:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=tDvuIcNV7yNj6tbAkvvnRDufQbD7uhe0Iu7FdgVRBEc=; b=xYF1oO928aUd8YN7I40Kv7bIdy5uLpeNptkTPpTd0jjyqGCDjZ6CwN0WcPd4sKTpWu uuVsr+SybOqeGYmRsDd6HRCgxxQKNl+jU/54wf02t5pT+t9mSUmkwovAlMB/NiwDwtGD NqGR2pINQKq6bzt3K4KfnVvldG2un/70pEqyRz+NoRMcM58ngglpw/TxEoMEwyXsofWN dWKwDmPAwHLLtkSrWt+4H55pC13jzcNqtjpTFLaxi1zVHvQ8ZRdowIT0zRAQpb7Bzm8p h0qb6HysdSvjEXFFr9K4Ie0Af7LTOwY3sH9bbdPrz0MhTu/vi9nknP/me+XFFYnDPX0v ZBLg== X-Received: by 10.194.119.137 with SMTP id ku9mr8923720wjb.96.1422305588985; Mon, 26 Jan 2015 12:53:08 -0800 (PST) Received: from Pali-Latitude.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPSA id i4sm6417414wje.20.2015.01.26.12.53.07 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 12:53:08 -0800 (PST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Peter Ujfalusi , Jarkko Nikula , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: linux-omap@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Pavel Machek , Sebastian Reichel , Ivaylo Dimitrov , Aaro Koskinen , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH] ASoC: rx51: do not fail if could not get jack detection gpio Date: Mon, 26 Jan 2015 21:51:47 +0100 Message-Id: <1422305507-10533-1-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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 qemu does not emulate it Signed-off-by: Pali Rohár --- sound/soc/omap/rx51.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 04896d6..a689021 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -310,25 +310,27 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) return err; } - /* AV jack detection */ - err = snd_soc_jack_new(codec, "AV Jack", - SND_JACK_HEADSET | SND_JACK_VIDEOOUT, - &rx51_av_jack); - if (err) { - dev_err(card->dev, "Failed to add AV Jack\n"); - return err; - } + if (!IS_ERR(pdata->jack_detection_gpio)) { + /* AV jack detection */ + err = snd_soc_jack_new(codec, "AV Jack", + SND_JACK_HEADSET | SND_JACK_VIDEOOUT, + &rx51_av_jack); + if (err) { + dev_err(card->dev, "Failed to add AV Jack\n"); + return err; + } - /* prepare gpio for snd_soc_jack_add_gpios */ - rx51_av_jack_gpios[0].gpio = desc_to_gpio(pdata->jack_detection_gpio); - devm_gpiod_put(card->dev, pdata->jack_detection_gpio); + /* prepare gpio for snd_soc_jack_add_gpios */ + rx51_av_jack_gpios[0].gpio = desc_to_gpio(pdata->jack_detection_gpio); + devm_gpiod_put(card->dev, pdata->jack_detection_gpio); - err = snd_soc_jack_add_gpios(&rx51_av_jack, - ARRAY_SIZE(rx51_av_jack_gpios), - rx51_av_jack_gpios); - if (err) { - dev_err(card->dev, "Failed to add GPIOs\n"); - return err; + err = snd_soc_jack_add_gpios(&rx51_av_jack, + ARRAY_SIZE(rx51_av_jack_gpios), + rx51_av_jack_gpios); + if (err) { + dev_err(card->dev, "Failed to add GPIOs\n"); + return err; + } } return err; @@ -336,8 +338,11 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) static int rx51_card_remove(struct snd_soc_card *card) { - snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), - rx51_av_jack_gpios); + struct rx51_audio_pdata *pdata = snd_soc_card_get_drvdata(card); + + if (!IS_ERR(pdata->jack_detection_gpio)) + snd_soc_jack_free_gpios(&rx51_av_jack, ARRAY_SIZE(rx51_av_jack_gpios), + rx51_av_jack_gpios); return 0; } @@ -470,8 +475,8 @@ static int rx51_soc_probe(struct platform_device *pdev) pdata->jack_detection_gpio = devm_gpiod_get(card->dev, "jack-detection"); if (IS_ERR(pdata->jack_detection_gpio)) { + /* Do not fail, qemu does not emulate jack detection gpio */ dev_err(card->dev, "could not get jack detection gpio\n"); - return PTR_ERR(pdata->jack_detection_gpio); } pdata->eci_sw_gpio = devm_gpiod_get(card->dev, "eci-switch");