From patchwork Mon Mar 18 20:07:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13595789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B28E9C54E69 for ; Mon, 18 Mar 2024 20:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=lHrMiGPhkOIbJw6v30DWatWEXK0q1XzOnkEJJ0IJvBk=; b=gja88t9RcX1UPA NpUvOMe5NAp5Io+5QWUtK1Zc/ysyB3+2q7CPQGmyJXuPdB1ZCdSsycpBNuUGPHNTHzFA0aOyOoOnA XzJDjASV/h3u0Rql4qVDRHtoXrEqQ4eLvVRBVMVNUvsD9pu77Zgjq/JHlphfbgTA6hJUGQ8ZBwvCH 7DixtDgPmm9U8uyHGQ6WNM138Fy7xAMgRhy/Bn40BjZEJhc8y4NxwPjmZC16CguOJpghyr2ifhZyz JHGOCVRFSWwD2POUjpC9A5Ndz0m83LX7YuM1JHStSdnhJJGokbCTZnCnQtobbyRqgPWJxApwe/sQI mjmfZIA0Vh5uaVp8CJyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmJHL-00000009zCx-33Oa; Mon, 18 Mar 2024 20:08:19 +0000 Received: from mgamail.intel.com ([192.198.163.9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmJHI-00000009zC5-2tKV for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2024 20:08:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710792493; x=1742328493; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sMw7esYZrxxW1kATPTh6O4ptDRoE3Q+nZihwtYXZxlg=; b=nkl2AuxaP05PAGbkFTxOZXNU5nRwU7GFBPbAjM3agO/YnA3m+iyNrqOV 7Ough/jqFtSuY4r8Xs6Ls9rNScVeG/Ozl9AayiXR5oBsauv80CpMt2wRp 3VWTnvWuOo3uGrQjd+m3S189WkITNgAl8klIwVsALhQUMerdpdYlap32w EzS9SjNecz0G5NP31wjog1F4XS8/uRf8nX6LbffWoe0563inamhmq4OUc LxNl9kYln5HHxn8VeKDyl7Vs2JFZjLi3BiNSUSzocPBcNOjpsvk8Ca84e I/L5IEyEXTIOOMY8v0ifCQvBIjsL4YdKFyFUjzrCMwsqPtEx2NwQUHUbB w==; X-IronPort-AV: E=McAfee;i="6600,9927,11017"; a="16354710" X-IronPort-AV: E=Sophos;i="6.07,135,1708416000"; d="scan'208";a="16354710" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2024 13:08:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11017"; a="937060635" X-IronPort-AV: E=Sophos;i="6.07,135,1708416000"; d="scan'208";a="937060635" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 18 Mar 2024 13:08:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 68B82241; Mon, 18 Mar 2024 22:08:06 +0200 (EET) From: Andy Shevchenko To: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-sound@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andy Shevchenko Subject: [PATCH v2 1/1] ASoC: fsl: imx-es8328: Switch to using gpiod API Date: Mon, 18 Mar 2024 22:07:56 +0200 Message-ID: <20240318200804.181516-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240318_130812_764288_8874328B X-CRM114-Status: GOOD ( 17.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This updates the driver to gpiod API, and removes yet another use of of_get_named_gpio(). Signed-off-by: Andy Shevchenko --- v2: fixed compilation error sound/soc/fsl/imx-es8328.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sound/soc/fsl/imx-es8328.c b/sound/soc/fsl/imx-es8328.c index 6f0d031c1d5f..d67b8a149bff 100644 --- a/sound/soc/fsl/imx-es8328.c +++ b/sound/soc/fsl/imx-es8328.c @@ -3,7 +3,7 @@ // Copyright 2012 Freescale Semiconductor, Inc. // Copyright 2012 Linaro Ltd. -#include +#include #include #include #include @@ -23,7 +23,7 @@ struct imx_es8328_data { struct snd_soc_card card; char codec_dai_name[DAI_NAME_SIZE]; char platform_name[DAI_NAME_SIZE]; - int jack_gpio; + struct gpio_desc *jack_gpiod; }; static struct snd_soc_jack_gpio headset_jack_gpios[] = { @@ -54,8 +54,8 @@ static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd) struct imx_es8328_data, card); int ret = 0; - /* Headphone jack detection */ - if (gpio_is_valid(data->jack_gpio)) { + if (data->jack_gpiod) { + /* Headphone jack detection */ ret = snd_soc_card_jack_new_pins(rtd->card, "Headphone", SND_JACK_HEADSET | SND_JACK_BTN_0, &headset_jack, @@ -64,7 +64,7 @@ static int imx_es8328_dai_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - headset_jack_gpios[0].gpio = data->jack_gpio; + headset_jack_gpios[0].desc = data->jack_gpiod; ret = snd_soc_jack_add_gpios(&headset_jack, ARRAY_SIZE(headset_jack_gpios), headset_jack_gpios); @@ -174,7 +174,11 @@ static int imx_es8328_probe(struct platform_device *pdev) data->dev = dev; - data->jack_gpio = of_get_named_gpio(pdev->dev.of_node, "jack-gpio", 0); + data->jack_gpiod = devm_gpiod_get_optional(dev, "jack", GPIOD_IN); + if (IS_ERR(data->jack_gpiod)) { + ret = PTR_ERR(data->jack_gpiod); + goto put_device; + } /* * CPU == Platform