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: 5714901 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3F7CF9F358 for ; Tue, 27 Jan 2015 06:26:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64A75201EC for ; Tue, 27 Jan 2015 06:26:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3E219201E4 for ; Tue, 27 Jan 2015 06:26:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 234E42606DF; Tue, 27 Jan 2015 07:25:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 A962C2604CF; Tue, 27 Jan 2015 07:25:46 +0100 (CET) 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 5C9372604CF; Mon, 26 Jan 2015 21:53:16 +0100 (CET) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by alsa0.perex.cz (Postfix) with ESMTP id 5D8FC26047B for ; Mon, 26 Jan 2015 21:53:09 +0100 (CET) Received: by mail-wi0-f178.google.com with SMTP id em10so868932wid.5 for ; 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 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 X-Mailman-Approved-At: Tue, 27 Jan 2015 07:25:46 +0100 Cc: alsa-devel@alsa-project.org, Ivaylo Dimitrov , Aaro Koskinen , Sebastian Reichel , linux-kernel@vger.kernel.org, Pavel Machek , =?UTF-8?q?Pali=20Roh=C3=A1r?= , linux-omap@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: rx51: do not fail if could not get jack detection gpio 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.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");