From patchwork Wed Mar 12 13:31:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 14013569 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20DDE5474C for ; Wed, 12 Mar 2025 13:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741786320; cv=none; b=UExaEj/OjBUvqeiU3uGOiMkiaUvMfw5RdvnxWMVA7wamyQc3tJ3A3mmPRgzLRUGnAURpPcM2jBRO+bEkCEVLF78SB0Mu06w/6NNTmET+0oGTms8ONzUN0LEJWHrx/6WBaFSHcwVY1bkcqIi156YPJmPN8a1YGgQ4XQSFMGz92lI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741786320; c=relaxed/simple; bh=0lBofCX6g27h8ZYIWlpX5XDIcclfdXbqFe5axN5qaO4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FKtFSFMAVU13RRt1hLEiPm4NROSdi7mrEV4jZjecO7HT/PwBs7FTaMRimSAS0N5fqwlmYcSRJu5tBGF78oRydMg7eqCClbJDBPfWJJjkaTUm7ArQArWBQY2eXu6HxEt09NsL75ahNXqybtFpLr8bVLUsvtFtgPOft6+8b73fDJY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=KsA9tvEg; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KsA9tvEg" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-54298ec925bso9064592e87.3 for ; Wed, 12 Mar 2025 06:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741786317; x=1742391117; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HCSC23yZBDagGDh6Umna2avJcVR5NE9Nb/Nl+uRoktk=; b=KsA9tvEg2fq02W1JLAZy/pNW9pCbZN0+pIlcpuFBOPLkf6mLJpOz5t5jRIn6JMLm0P LISJfh7+GbqfP9JmBOxkd8w+sLyzBviPAdbFYQYibsUI/DQ11Ynm0z9EhqV5r5cwqwSf TzmGR/btvwohCQhEp2k5D0knl4y75Gbnl64WDdGKKZ2tK6M/HqmWEWn0PE6gkysTgOG3 sI5DL3C3dC6QksrSgnAefFzSBdYz+Ip6IscLP+09FwYfIVoY4YCJdAxPzEhlOYsiZNg5 G8WA18W54lIGlfiH5yp3RAVy57jdz6pCxuLQumNjQzpXL7ofQLibPppvQvUJf/LCNM6w rBUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741786317; x=1742391117; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HCSC23yZBDagGDh6Umna2avJcVR5NE9Nb/Nl+uRoktk=; b=gkIvhSi7Jv2YUy+OZyULbnt0n3jBO5jK95fUfJP2wS3QwH/ElC9v8kZ+CD2Ktiy1H6 6/YHXaZxGgp3M35WLF02DI9Ckx211rGzl7+JaR2BWywyJrMgUXODVbOz2nmZyf1c/e2H Y+PT9wCn+SpHWa5Hfw//YP/D03zejguisSYJPUU5eYMK6pXE0jSfrGgAwsHR89nzPj/r PWk6Y1dYNOEu5uGJiItKgfaMbUKsYnwIvm+gPGJDDTpDzm/iE+icNt9D7n2XkBLNhdu7 igboJxqWeHNE7ylBrlHABbl8sxVup/V7WM6jQSHNplVO/edsQQG28Xz55vOUD5xOABlH nrFA== X-Gm-Message-State: AOJu0Yy+lIesLqyvYKiHmO32Slgv+i7WmaksnuzGgEqU+vhx9CT7YnoG MVCtodpfBwn2VvG8M8BL7AE2YRDSR/TC03VgPUZJjVQS2n3+W2HQeUewJp8WZp4= X-Gm-Gg: ASbGncsEIGxPcpKjRwPcgMp3OmCROsqg/w0rAAvw0Yzhz/AEQqd/mW/E7n5MoW15ogj r8wzLY4jYERHH5JDEzWrz/C4PbX6MCXO0sa2HcsR/YtscnAEHPxj3R94ILfrJzf4UBAilJLQOPa VRCH6AQkDj71wGdbGi2r1vFliT3ev6DNjR4bh8su0fktxySg++tKwhqJf9KLtAtm5Ax5G2JPhku RYcNfYvX6NsKSsmnsM0MxYJbtut8yqv4Y++AioaVLA/K+hU5CMcBuCOX8UH7C3dHZrrW8zbWrM2 U7R2+svqI8pIt0o0rxSbhxlQ/dciQtznt8sb/lXFcdWgajS60fwKjik= X-Google-Smtp-Source: AGHT+IGkeuRFRrDQUVjbYY2DOOImsP2qePYqpHH0bQIKsDXf3iZf2a5DWrTYE0cLmP5HctIa/Xg+1g== X-Received: by 2002:a05:6512:ea5:b0:545:2f9b:7584 with SMTP id 2adb3069b0e04-549910b5e7emr7273720e87.36.1741786317099; Wed, 12 Mar 2025 06:31:57 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5498ae460desm2121858e87.24.2025.03.12.06.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 06:31:56 -0700 (PDT) From: Linus Walleij Date: Wed, 12 Mar 2025 14:31:50 +0100 Subject: [PATCH 1/3] ASoC: pcm1681: Drop unused include Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250312-pcm-codecs-v1-1-41ffc4f8fc5c@linaro.org> References: <20250312-pcm-codecs-v1-0-41ffc4f8fc5c@linaro.org> In-Reply-To: <20250312-pcm-codecs-v1-0-41ffc4f8fc5c@linaro.org> To: Shenghao Ding , Kevin Lu , Baojun Xu , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Bartosz Golaszewski Cc: linux-sound@vger.kernel.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.2 This driver includes the legacy GPIO header but does not use any symbols from it so drop the include. Signed-off-by: Linus Walleij --- sound/soc/codecs/pcm1681.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c index fc152496d5dc53dae527a537146f18a44387222c..a1ec881d70841ad10cbb65ad7d59419ebb6f7722 100644 --- a/sound/soc/codecs/pcm1681.c +++ b/sound/soc/codecs/pcm1681.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include From patchwork Wed Mar 12 13:31:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 14013570 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCF572405FD for ; Wed, 12 Mar 2025 13:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741786323; cv=none; b=UuR123kTTGwmIs4qfDmh4lyTO7snOdiJte8j6sGty6lEzzuoFbLgK8ZB40pr+yFxv+1e+0DMWvcyfAzvElNbWbIF+HeWGouzoI3R72+BriPLGFzBPde7TAGMeATc/GJKWnsEgHbBKKZ77v5RlKQrCGgt+LigNPe72lguaQ8/n1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741786323; c=relaxed/simple; bh=B2zg89GIjP4Vel9rjY60WJg2IxDwXSUmQq5358BYne8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SQmkO8MY9m8OFuAxl+CW46z1PURlq8OYyt/qOM2EecuDFkoJwe/iFGOoJOkA8K3LubTU3D/SC1hk5X7S83GNBdVzSsMUP/55gh/FEpTb43+0/7jFoFT777yB4IPucZP5TnwgmEcR239mjWhYp9jHRlhqul+cjZdnNd56FzxACE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=P/rsYzAl; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P/rsYzAl" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5499659e669so5853234e87.3 for ; Wed, 12 Mar 2025 06:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741786319; x=1742391119; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rhEAQfn62WOeRCSbphjKXE9NxiHRh23KMe48CXfTNhE=; b=P/rsYzAlGsx4IP/leeQuVQV/uH8fdhRh9JyUxFmp5MYITIuqPIKI7HyiJNgxV5lF2J RPtTfbVw4EqUnG+s8C2BBZQi3jmf2jVhfXOCRv+5dV5NXuRuaGdzBVXjq4y3RfxtXRvE tQh96atuTvoTFFhanoYUT5uXl31cum9gUjcBe0xHcjRb+K2tTyXaSG8IkHnJ3lMbYM+f r+AQnDexG+jzE/uwlHQtknFo0FHGW285ZA+0acc80pTBMkvAT+SN9HEwRfdFPl+jlRi1 0crnExtP97a0HvxCW1WkA4noZvB9vB2MlMoVQXIKyfnADMXyUCtU12fNVq1isUN0Bmpi bLaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741786319; x=1742391119; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rhEAQfn62WOeRCSbphjKXE9NxiHRh23KMe48CXfTNhE=; b=LBrTUs5t4LpjQnR3/NPxBGGf1GDw2geP+ondSpSW5kjFs3TYtRxWCjTLHpqCusTZkZ fCfhNPHcZXJGSz4UKtGISaOslZhG+Hki9TNyw3VC+dFh9u6/dO7pB/gcP5GaigW90RVq KW4gL+QYiBPNjIjEw997KVAWZ+/QJUwEBzIk+s/5KFcWVbOutif5TUmYUKo7WpJuDIhy +yKwqOOmorP3KehdT7nEGyPMvhkjn4gL0Af8LGD9zNH4UrmNTquyccVaif3MLi9WBH79 qEGBMmXf6u9QjOG3CZjurLwiTL66Ub6MvgPL6lFQEQo/7Cc9sxlVLdlGjoxNQqIW232a TmHQ== X-Gm-Message-State: AOJu0YyxCssPuC2i6T5AEiNWDni31NnwMe/8AArpjKAzkjh6+OFA32z5 NAqgTIfMvFAZbxgtIzpyVuaCfDnQ1Ko+SEgc0B6uA1bbQ+Z6vMtVXiUFxWBF45k= X-Gm-Gg: ASbGncvQ/MPmV0vjJmxiCFaJ2cdy4yRD/oyHeaE5ioL1Gbrn/a+6gBM7gc/bm40ncMA Qd8/8J8nnqGtezLhcJhLT0J/OG+N4IBEOeJAAKcbYcKTbhNAjQ45KPO2vpX355IILHiaMDevHyc Ekr3q6Ie0T88cBBJNArPSYLflSS3nO4Op6Vbw82sUUX2ae8iBceHKKLaG2oOOidNimMNnDftOLP GaRKzXg6+5rHVJ/1zNdWY5MW0kYxFCexH2Rppn5sJwkXgfcgd+huMXO6JmFB/ZS0H0et3liGJZ2 MK/52oEjrVCS1H+ntsqrSaGRXMV8dXqjY47APBA9AYYY/5zq+0N4Zdw= X-Google-Smtp-Source: AGHT+IHWnYCBrhTvqZlyPcM3tIeZ8BhMfC97IsTwkUhgOge8nCWIzSOCXKGn/GCNcPGwk8qaNI9Vyw== X-Received: by 2002:ac2:5b04:0:b0:549:91db:c14b with SMTP id 2adb3069b0e04-549abaaad27mr2034068e87.8.1741786318790; Wed, 12 Mar 2025 06:31:58 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5498ae460desm2121858e87.24.2025.03.12.06.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 06:31:57 -0700 (PDT) From: Linus Walleij Date: Wed, 12 Mar 2025 14:31:51 +0100 Subject: [PATCH 2/3] ASoC: pcm3008: Convert to GPIO descriptors Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250312-pcm-codecs-v1-2-41ffc4f8fc5c@linaro.org> References: <20250312-pcm-codecs-v1-0-41ffc4f8fc5c@linaro.org> In-Reply-To: <20250312-pcm-codecs-v1-0-41ffc4f8fc5c@linaro.org> To: Shenghao Ding , Kevin Lu , Baojun Xu , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Bartosz Golaszewski Cc: linux-sound@vger.kernel.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.2 This converts the PCM3008 driver to look up the GPIO lines using descriptors. Apparently there are no in-tree users of the platform data struct, so users need to adopt. New users can associate the GPIO lines with the platform device "pcm3008-codec". Signed-off-by: Linus Walleij --- sound/soc/codecs/pcm3008.c | 61 ++++++++++++++++++++++++---------------------- sound/soc/codecs/pcm3008.h | 19 --------------- 2 files changed, 32 insertions(+), 48 deletions(-) diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index 09c6c1326833d66dd12c60ff243c9bd9ffda36d9..d3d2e7f40170c8335f5f8ca4d20863accb638c61 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,17 +22,22 @@ #include #include -#include "pcm3008.h" +struct pcm3008 { + struct gpio_desc *dem0_pin; + struct gpio_desc *dem1_pin; + struct gpio_desc *pdad_pin; + struct gpio_desc *pdda_pin; +}; static int pcm3008_dac_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - struct pcm3008_setup_data *setup = component->dev->platform_data; + struct pcm3008 *pcm = component->dev->platform_data; - gpio_set_value_cansleep(setup->pdda_pin, - SND_SOC_DAPM_EVENT_ON(event)); + gpiod_set_value_cansleep(pcm->pdda_pin, + SND_SOC_DAPM_EVENT_ON(event)); return 0; } @@ -42,10 +47,10 @@ static int pcm3008_adc_ev(struct snd_soc_dapm_widget *w, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); - struct pcm3008_setup_data *setup = component->dev->platform_data; + struct pcm3008 *pcm = component->dev->platform_data; - gpio_set_value_cansleep(setup->pdad_pin, - SND_SOC_DAPM_EVENT_ON(event)); + gpiod_set_value_cansleep(pcm->pdad_pin, + SND_SOC_DAPM_EVENT_ON(event)); return 0; } @@ -106,11 +111,13 @@ static const struct snd_soc_component_driver soc_component_dev_pcm3008 = { static int pcm3008_codec_probe(struct platform_device *pdev) { - struct pcm3008_setup_data *setup = pdev->dev.platform_data; - int ret; + struct device *dev = &pdev->dev; + struct pcm3008 *pcm; - if (!setup) - return -EINVAL; + pcm = devm_kzalloc(dev, sizeof(*pcm), GFP_KERNEL); + if (!pcm) + return -ENOMEM; + platform_set_drvdata(pdev, pcm); /* DEM1 DEM0 DE-EMPHASIS_MODE * Low Low De-emphasis 44.1 kHz ON @@ -120,30 +127,26 @@ static int pcm3008_codec_probe(struct platform_device *pdev) */ /* Configure DEM0 GPIO (turning OFF DAC De-emphasis). */ - ret = devm_gpio_request_one(&pdev->dev, setup->dem0_pin, - GPIOF_OUT_INIT_HIGH, "codec_dem0"); - if (ret != 0) - return ret; + pcm->dem0_pin = devm_gpiod_get(dev, "dem0", GPIOD_OUT_HIGH); + if (IS_ERR(pcm->dem0_pin)) + return PTR_ERR(pcm->dem0_pin); /* Configure DEM1 GPIO (turning OFF DAC De-emphasis). */ - ret = devm_gpio_request_one(&pdev->dev, setup->dem1_pin, - GPIOF_OUT_INIT_LOW, "codec_dem1"); - if (ret != 0) - return ret; + pcm->dem1_pin = devm_gpiod_get(dev, "dem1", GPIOD_OUT_LOW); + if (IS_ERR(pcm->dem1_pin)) + return PTR_ERR(pcm->dem1_pin); /* Configure PDAD GPIO. */ - ret = devm_gpio_request_one(&pdev->dev, setup->pdad_pin, - GPIOF_OUT_INIT_LOW, "codec_pdad"); - if (ret != 0) - return ret; + pcm->pdad_pin = devm_gpiod_get(dev, "pdad", GPIOD_OUT_LOW); + if (IS_ERR(pcm->pdad_pin)) + return PTR_ERR(pcm->pdad_pin); /* Configure PDDA GPIO. */ - ret = devm_gpio_request_one(&pdev->dev, setup->pdda_pin, - GPIOF_OUT_INIT_LOW, "codec_pdda"); - if (ret != 0) - return ret; + pcm->pdda_pin = devm_gpiod_get(dev, "pdda", GPIOD_OUT_LOW); + if (IS_ERR(pcm->pdda_pin)) + return PTR_ERR(pcm->pdda_pin); - return devm_snd_soc_register_component(&pdev->dev, + return devm_snd_soc_register_component(dev, &soc_component_dev_pcm3008, &pcm3008_dai, 1); } diff --git a/sound/soc/codecs/pcm3008.h b/sound/soc/codecs/pcm3008.h deleted file mode 100644 index f7f4fbbd89db2bd4fb8d29059bf404d34d939dad..0000000000000000000000000000000000000000 --- a/sound/soc/codecs/pcm3008.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * PCM3008 ALSA SoC Layer - * - * Author: Hugo Villeneuve - * Copyright (C) 2008 Lyrtech inc - */ - -#ifndef __LINUX_SND_SOC_PCM3008_H -#define __LINUX_SND_SOC_PCM3008_H - -struct pcm3008_setup_data { - unsigned dem0_pin; - unsigned dem1_pin; - unsigned pdad_pin; - unsigned pdda_pin; -}; - -#endif From patchwork Wed Mar 12 13:31:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 14013571 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 670CF24293B for ; Wed, 12 Mar 2025 13:32:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741786324; cv=none; b=brVIwQOyYtGILEEF9DEb4yY/iKrhtqCo7mgZYY9WK+jPoeDpDXaZk7vBQ8tHeraF/OaWoKJ1R3cO+23GLz9v6GZPnpHGg+jI04jjoXtjOnvY2HouBWunX1QNe4/4ZcZZ0ACv4bYNvVxWf9w6+7R+Il71uclVmuA5iBaom9Ubk+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741786324; c=relaxed/simple; bh=OKx2k02z23zEcvhATOXAT7P378GIrQR3T0tzoq4hdxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ns1QBAzdXRlJ3bR4kXOKFSs3YtnlwuWyd8ytGn4xN+mD9bofPbmTW8BF1zIIObxD2NsgmUABTf5XhS7dK0q1NnNkH+vzOS9gBhpgwl6SO4K8E8VgZ+A9U0Rvxc08bE3elGJkKJv56ug0N4fOoRc1oOxrBqCKgi6A7jZNjB2vmz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MpXKQhev; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MpXKQhev" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5499bd3084aso4000028e87.0 for ; Wed, 12 Mar 2025 06:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741786320; x=1742391120; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=d6227D3p3P0gwc0KnsTIE+k7HQimstZwQXxJIFYQCaY=; b=MpXKQhevzkYAPR0eiTFlGxAUeEUHi+1ZCHrtfun8JkgV4YDe9XVpNZl4Tg3c119fDF UwKviwTUlRAfnPPUFe5pNuShM2rNDVMG14wzbny/5RhJMg0+WMtOTbUKnS6P9d/2Kqg/ 8ScFb7/t0//ww/LvZ9lAb53Gw9yOJh94RLcssE879Y9zDSHpZ1td0YEBbqOJBNGdRh7a ZhK+vVcpYD117S/mw7jRKRCUW2E7z6bJrz9FY94DaTQA4qMxhufkGTt/Zrks2BRy9gcD a9iEJjozeYX+jEQK2wOApdJH6+0sFz2KzpEn/frOv8NrDEYmpwurgJQq54PQFEzPMTtO GaWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741786320; x=1742391120; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d6227D3p3P0gwc0KnsTIE+k7HQimstZwQXxJIFYQCaY=; b=b5Aw8gJ+WgzEZf3MT2CPu5hZH4W5hqiIa/3/WgLggo8dLkFK6M+YNdDq2JZMSgtLto sFv34Yi817KYwuSPOgZZSEkySw/gTSi6spfk3j0OLpXzT1mE5VEyM9GwUs5phznAB1x3 PqVJzHfRftc0VLYefVjejJuhJ1+2JLhjeaFrN/l1sQyzMd/jXptbVQts9zPWeb7zHDUg UQAnk6Q+t5B9dAujyp7YLXarMR0WQN4zuPxKfZuSgR6Vys8GsHila09q1KvDQuBhzs9D MFeudBAz6d+zA51eJlodI8/p3ubx4Vy/FMkEsJR38l112k6n6+m9rEEGV3B3riUtYuj6 AeBw== X-Gm-Message-State: AOJu0Yz3elcor2M0Elbheco3fCyxy1Ro4NjLEYU+szZsP71P4tR7D5UG ASOXT7041iOM3NXd9n4b4LcFkA+HJEQkt/HHhUV2cNLWiWfd3I2uEujLqRTSaYU= X-Gm-Gg: ASbGncvbtYQH+JVzttuw5TOAyCUgEUebIwuVxh0ntHxuB75E9Hpj2X2DTvoafKRDt6Y LJW6DXHxzVzAm0e0nt94rC9tH9pBiJeIi7BHvvY+zW7qV61IBOLvNo0ZIV19eC+oJag7+vRbABd XOXtUAWFxEfE5RcVgSU+jHknFRpu7C/HrObyepuSu8dIIjq+Nqal72Flfix2twmXU235Fri6DoY DR+78+yBtRft3SCw/qdFUa2WUYvpmIcP3/Ki95k2MFmh78oZIx/manbcGooTBpl8G0HHcJdAcZv U3kG6j4V4gP9FU9jnfcLhbIZoUql4FZPata8oCs2VbeISmz12qZ3jb33mKf8Kq/isQ== X-Google-Smtp-Source: AGHT+IG+ADSPCoGqvuEtats2T3CM9fitXUnTzvBoqRBCavMLmRzv5GI1OBEpjzCqM7eEbpTXVT3w1w== X-Received: by 2002:a05:6512:3da4:b0:549:39b1:65c6 with SMTP id 2adb3069b0e04-54990eaa699mr7963530e87.34.1741786320407; Wed, 12 Mar 2025 06:32:00 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5498ae460desm2121858e87.24.2025.03.12.06.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 06:31:59 -0700 (PDT) From: Linus Walleij Date: Wed, 12 Mar 2025 14:31:52 +0100 Subject: [PATCH 3/3] ASoC: pcm6240: Drop bogus code handling IRQ as GPIO Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250312-pcm-codecs-v1-3-41ffc4f8fc5c@linaro.org> References: <20250312-pcm-codecs-v1-0-41ffc4f8fc5c@linaro.org> In-Reply-To: <20250312-pcm-codecs-v1-0-41ffc4f8fc5c@linaro.org> To: Shenghao Ding , Kevin Lu , Baojun Xu , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Bartosz Golaszewski Cc: linux-sound@vger.kernel.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.2 The current code for the IRQ in pcm6240 makes no sense: it looks up an IRQ with of_irq_get(), treat it as a GPIO by issuing gpio_request(), gpio_direction_input() and gpio_to_irq() on it. This is just wrong, if the device tree assigns the IRQ from a GPIO number this is just incorrect: it is clearly stated that GPIO providers and IRQ providers are orthogonal. It is possible to look up an IRQ to a corresponding GPIO line but this is taking an IRQ and pretending it's a GPIO, which is just semantically wrong. Drop the offending code and treat the IRQ that we get from the device tree as any other IRQ, see for example other codec drivers. The DT bindings for this codec does not have any in-tree DTS files, which may explain why things are weird. As a bonus, this moves the driver away from the legacy include. Signed-off-by: Linus Walleij --- sound/soc/codecs/pcm6240.c | 28 +++++++--------------------- sound/soc/codecs/pcm6240.h | 7 +------ 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/sound/soc/codecs/pcm6240.c b/sound/soc/codecs/pcm6240.c index 4ff39e0b95b272c9c6b6f5cca50f595ae39ef056..b2bd2f172ae76e6baa7e6f4ef5fe894701ea4385 100644 --- a/sound/soc/codecs/pcm6240.c +++ b/sound/soc/codecs/pcm6240.c @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include @@ -2035,10 +2035,8 @@ static const struct regmap_config pcmdevice_i2c_regmap = { static void pcmdevice_remove(struct pcmdevice_priv *pcm_dev) { - if (gpio_is_valid(pcm_dev->irq_info.gpio)) { - gpio_free(pcm_dev->irq_info.gpio); - free_irq(pcm_dev->irq_info.nmb, pcm_dev); - } + if (pcm_dev->irq) + free_irq(pcm_dev->irq, pcm_dev); mutex_destroy(&pcm_dev->codec_lock); } @@ -2109,7 +2107,7 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c) ndev = 1; dev_addrs[0] = i2c->addr; } - pcm_dev->irq_info.gpio = of_irq_get(np, 0); + pcm_dev->irq = of_irq_get(np, 0); for (i = 0; i < ndev; i++) pcm_dev->addr[i] = dev_addrs[i]; @@ -2132,22 +2130,10 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c) if (pcm_dev->chip_id == PCM1690) goto skip_interrupt; - if (gpio_is_valid(pcm_dev->irq_info.gpio)) { - dev_dbg(pcm_dev->dev, "irq-gpio = %d", pcm_dev->irq_info.gpio); - - ret = gpio_request(pcm_dev->irq_info.gpio, "PCMDEV-IRQ"); - if (!ret) { - int gpio = pcm_dev->irq_info.gpio; - - gpio_direction_input(gpio); - pcm_dev->irq_info.nmb = gpio_to_irq(gpio); - - } else - dev_err(pcm_dev->dev, "%s: GPIO %d request error\n", - __func__, pcm_dev->irq_info.gpio); + if (pcm_dev->irq) { + dev_dbg(pcm_dev->dev, "irq = %d", pcm_dev->irq); } else - dev_err(pcm_dev->dev, "Looking up irq-gpio failed %d\n", - pcm_dev->irq_info.gpio); + dev_err(pcm_dev->dev, "No irq provided\n"); skip_interrupt: ret = devm_snd_soc_register_component(&i2c->dev, diff --git a/sound/soc/codecs/pcm6240.h b/sound/soc/codecs/pcm6240.h index 1e125bb97286030f7e6006970d0be9f40348e952..2d8f9e798139ac7df30606c0e5381a7b24d84728 100644 --- a/sound/soc/codecs/pcm6240.h +++ b/sound/soc/codecs/pcm6240.h @@ -208,11 +208,6 @@ struct pcmdevice_regbin { struct pcmdevice_config_info **cfg_info; }; -struct pcmdevice_irqinfo { - int gpio; - int nmb; -}; - struct pcmdevice_priv { struct snd_soc_component *component; struct i2c_client *client; @@ -221,7 +216,7 @@ struct pcmdevice_priv { struct gpio_desc *hw_rst; struct regmap *regmap; struct pcmdevice_regbin regbin; - struct pcmdevice_irqinfo irq_info; + int irq; unsigned int addr[PCMDEVICE_MAX_I2C_DEVICES]; unsigned int chip_id; int cur_conf;