From nobody Sat Oct 4 00:21:54 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0991E2F90E9 for ; Fri, 22 Aug 2025 10:49:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755859777; cv=none; b=UwqzVgm4q67QbTJxqGYJS59agKAA26stmrMkrJB8wByGdxgAL9HsgB4bwjxD+CL11/DgM+FRKrjay9OSimTFa9K+WlJGNeIUkuW0ICwRKC6vT2XtqBZMgHRlYfXrdThlkI8Mb69MJsVaUzUa0EpYGi1gL7dz1IJJ+0mc0Kv3pwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755859777; c=relaxed/simple; bh=eb1++42vJtab/bRoZe1IgHIlej0YZe+avuEdhyeK5EQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qs5VlSWXHo0pikspQd/BCmIUnRVuMCPJp7uRAcbt0vjH+mRSO8ps+SpG7WHdBGh93y3YCBzYftk2QCCOwLU3TS7PDqfi4Eh5/df05J7VoP+EKNvwYd1BV6nY6g49BwDfohFnPYhK5aVShVwB8+7GCvOcHNkXdZ+fbMmYdLtZVXM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=jh1nLFur; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="jh1nLFur" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57M8UKNa028630 for ; Fri, 22 Aug 2025 10:49:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=qXANymfI6Y2 KCwlYYSn+zbhAwc6YettxatxPwC+mh5Q=; b=jh1nLFurjaqVTSVK+fOJOqF/EVX qoa9jQ0zBtlW+GX2HxLIdqVKO1vcT55M18Tb/5UUYLm1r0yn9rkzLxqQG+Kr+tza Kl34/u1/ZaqWf7/tgQX9sBXxK6OIlHanC1Kvc4dxeZ1ZEJx7OIUUFAzCYnVOhLPE M6RPOxBxAAFXHlIaVXLJ7q7cxZ71TNiCEtLaGr4152v+QI0oXKGUB4HiQBgJeHTb jeqKOH6JzuA80vl/spA4CN0X8AoL3EpIHkdai3zlqi++ifeIaDZ/iBM4fJlGpM3t 4KvDsKwS9HlJ2IdfS8jwo5GTIZ4gZNnLh9ECgHKs5LkSIJ5/QQeVCeNpa+Q== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48n52crx4c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 22 Aug 2025 10:49:35 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4b109c7e901so43670371cf.3 for ; Fri, 22 Aug 2025 03:49:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755859774; x=1756464574; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qXANymfI6Y2KCwlYYSn+zbhAwc6YettxatxPwC+mh5Q=; b=PhDNlqppMkiW2sFxI4nvfnXe3I0e+0Xk9wSyyUzHsgBOmbtfLQercP9aLpwTr3L/13 3xUf50vbAdT4TG09AHvHD1743Kp+lUF6gZ7RZVwzr+xstBiGZQwBLpHPjt7u9dpI+Pgl 61j38OM7lY1zvrWt2J2tdgIynfCAOIYB29wE4xeUedOAarniatFoMDhrJnCSu2t69ASR cB+LInO5tWqezpandAjhw/1jd8XS2na58pNBvlLotUkUfW3+Cu+kYFjSj7Ux0S9ePnYS r7RZMoQ+4345STyG6PXq1V8xkbLBp7Ad/A2alaAvJojonUb2MamFhWjmh492lZ4pEsoI idKg== X-Forwarded-Encrypted: i=1; AJvYcCXg9aDJnMX81jx2JB7T4oJ9RKc/ERd4USTozCuMdFiZ7ZQdFyOBecHqEw3J9KQyGlwnxV7g4DoN57ERs0U=@vger.kernel.org X-Gm-Message-State: AOJu0YzRnD+um+uyA+6yoAO2FIaQW70WHHgMh/M5qUWrmmWXkVYRuLPO QO01OgT+72anb/+HkkgWKO9kdMGTF3jQ5TRLLHmSZMGlGI9NPFhD8fo8zNTKu9eCNR78OFZ8mjC oYSeDN23e/qVsRxlmfSdEBIz7+oiiFQf6asOwtRzdNKgfOoGlpmi8MlXUf3k/CI3umRM= X-Gm-Gg: ASbGncvbyls1K2AlJf3kumwAk/MurerCG25GTHLSKqT1Z5APCOkyDIDxDX/EXTZhrDj hiXkWu5ehWupfdUloK55aBmkaTJKZU20mIY6OZNVLFb7ZX56A2L5EYrcFIfhYUPCgaBaAerjnZg URCJCuZkWJqP/XYpadAxacKLbGtRjLXt6cu2ojP59/FQV7i8Yvpf93+3vRg/Z02FxCyQUwQvI8P vwbNdQezJ9uREGq36MqTrEfJ/sPPZ6dbKX+kXy0Boe0aW36UQOnbi9s4JJ9Eh47NzFXmUnYxNx3 oYz80TP1xGzWIBNAaPHXnQUSTNPhNQs2c3+f/9zORY8BvGtNr7K4uQ== X-Received: by 2002:ac8:5791:0:b0:4af:1712:acc9 with SMTP id d75a77b69052e-4b2aab3dbdcmr32627811cf.38.1755859773761; Fri, 22 Aug 2025 03:49:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3+e2gNtbKC+jqpuzA+86WI5aL4wGrGXR7knhAcPNPO1KrFKtvHax4kAeIbXuuHCS6TDpo+g== X-Received: by 2002:ac8:5791:0:b0:4af:1712:acc9 with SMTP id d75a77b69052e-4b2aab3dbdcmr32627471cf.38.1755859773123; Fri, 22 Aug 2025 03:49:33 -0700 (PDT) Received: from debian ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b50e4249bsm31367155e9.25.2025.08.22.03.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Aug 2025 03:49:32 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, srini@kernel.org, lgirdwood@gmail.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, krzysztof.kozlowski@linaro.org, neil.armstrong@linaro.org, Srinivas Kandagatla Subject: [PATCH v2 3/8] ASoC: codecs: wcd-common: move WCD_SDW_CH to common Date: Fri, 22 Aug 2025 11:49:22 +0100 Message-ID: <20250822104927.2621866-4-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250822104927.2621866-1-srinivas.kandagatla@oss.qualcomm.com> References: <20250822104927.2621866-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: S3LqG1UxnSER6mkKOJic9RKxDmhPqdSD X-Proofpoint-ORIG-GUID: S3LqG1UxnSER6mkKOJic9RKxDmhPqdSD X-Authority-Analysis: v=2.4 cv=Xpij+VF9 c=1 sm=1 tr=0 ts=68a84b3f cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=2OwXVqhp2XgA:10 a=EUspDBNiAAAA:8 a=AbvtZVZmey0OcoHPdAYA:9 a=a_PwQJl-kcHnX1M80qC6:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIwMDAxMyBTYWx0ZWRfX57WMhBnsIMts vzpjSPg2kYgh67frotlvmFiQS6EXIDy/GosXSSzANkOxPsNbYGY9KdmhFMCSqtrQuKDsRKf6Umz i3BtdyyFGe4mhDfvmUxdWHucTVOzXvIK2Ute9Og/kiOTDXBWBlnqQezR/Kmdxlw5v2Vsnjf7t8B cVdSBp5ZS+pZ8rAnxTzAx8XztkINpXbYqwtrTvfq70HDhiPcYWMFiTHtNDX8gE5QNQVECQ0foTf LQFfgIvEZVdhEsBctNdk/n78XzERW1SZ7zoVGy1MSwhSE/shxN7YQtW7a/U/9GUE11jwwlWfcSQ 9HXeEWr3wIbqvd14g2nvZXQH88qnFXnzEh1UeOzLA9S6SXakYU/sUnumYb5IcUFKldd+T4d5rV+ BaXJYgOhff9Ts3JVOCb3QGdSCMe0yg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-22_03,2025-08-20_03,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 impostorscore=0 adultscore=0 spamscore=0 phishscore=0 malwarescore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2508110000 definitions=main-2508200013 Content-Type: text/plain; charset="utf-8" sdw_ch_info and WCD_SDW_CH macro is duplicated across wcd937x, wcd938x, wcd939x soundwire codec drivers. Move this to wcd common driver to remove this code duplication. Signed-off-by: Srinivas Kandagatla Reviewed-by: Dmitry Baryshkov --- sound/soc/codecs/wcd-common.h | 11 +++++++++++ sound/soc/codecs/wcd937x-sdw.c | 4 ++-- sound/soc/codecs/wcd937x.h | 16 ++-------------- sound/soc/codecs/wcd938x-sdw.c | 4 ++-- sound/soc/codecs/wcd938x.c | 2 +- sound/soc/codecs/wcd938x.h | 13 +------------ sound/soc/codecs/wcd939x-sdw.c | 4 ++-- sound/soc/codecs/wcd939x.c | 2 +- sound/soc/codecs/wcd939x.h | 13 +------------ 9 files changed, 23 insertions(+), 46 deletions(-) diff --git a/sound/soc/codecs/wcd-common.h b/sound/soc/codecs/wcd-common.h index 08c8e7ce9814..ee101f8547d5 100644 --- a/sound/soc/codecs/wcd-common.h +++ b/sound/soc/codecs/wcd-common.h @@ -11,6 +11,17 @@ #define WCD_MAX_MICBIAS_MV 2850 #define WCD_MAX_MICBIAS 4 =20 +struct wcd_sdw_ch_info { + int port_num; + unsigned int ch_mask; +}; + +#define WCD_SDW_CH(id, pn, cmask) \ + [id] =3D { \ + .port_num =3D pn, \ + .ch_mask =3D cmask, \ + } + struct wcd_common { struct device *dev; int max_bias; diff --git a/sound/soc/codecs/wcd937x-sdw.c b/sound/soc/codecs/wcd937x-sdw.c index e7cc699bd8bc..8f2819163527 100644 --- a/sound/soc/codecs/wcd937x-sdw.c +++ b/sound/soc/codecs/wcd937x-sdw.c @@ -19,7 +19,7 @@ #include #include "wcd937x.h" =20 -static struct wcd937x_sdw_ch_info wcd937x_sdw_rx_ch_info[] =3D { +static struct wcd_sdw_ch_info wcd937x_sdw_rx_ch_info[] =3D { WCD_SDW_CH(WCD937X_HPH_L, WCD937X_HPH_PORT, BIT(0)), WCD_SDW_CH(WCD937X_HPH_R, WCD937X_HPH_PORT, BIT(1)), WCD_SDW_CH(WCD937X_CLSH, WCD937X_CLSH_PORT, BIT(0)), @@ -30,7 +30,7 @@ static struct wcd937x_sdw_ch_info wcd937x_sdw_rx_ch_info[= ] =3D { WCD_SDW_CH(WCD937X_DSD_R, WCD937X_DSD_PORT, BIT(1)), }; =20 -static struct wcd937x_sdw_ch_info wcd937x_sdw_tx_ch_info[] =3D { +static struct wcd_sdw_ch_info wcd937x_sdw_tx_ch_info[] =3D { WCD_SDW_CH(WCD937X_ADC1, WCD937X_ADC_1_PORT, BIT(0)), WCD_SDW_CH(WCD937X_ADC2, WCD937X_ADC_2_3_PORT, BIT(0)), WCD_SDW_CH(WCD937X_ADC3, WCD937X_ADC_2_3_PORT, BIT(0)), diff --git a/sound/soc/codecs/wcd937x.h b/sound/soc/codecs/wcd937x.h index 0f96b7108a7e..3d0ba3cc0ee6 100644 --- a/sound/soc/codecs/wcd937x.h +++ b/sound/soc/codecs/wcd937x.h @@ -7,6 +7,7 @@ =20 #include #include +#include "wcd-common.h" =20 #define WCD937X_BASE_ADDRESS 0x3000 #define WCD937X_ANA_BIAS 0x3001 @@ -507,26 +508,13 @@ enum wcd937x_rx_sdw_ports { WCD937X_MAX_SWR_PORTS =3D WCD937X_DSD_PORT, }; =20 -struct wcd937x_sdw_ch_info { - int port_num; - unsigned int ch_mask; - unsigned int master_ch_mask; -}; - -#define WCD_SDW_CH(id, pn, cmask) \ - [id] =3D { \ - .port_num =3D pn, \ - .ch_mask =3D cmask, \ - .master_ch_mask =3D cmask, \ - } - struct wcd937x_priv; struct wcd937x_sdw_priv { struct sdw_slave *sdev; struct sdw_stream_config sconfig; struct sdw_stream_runtime *sruntime; struct sdw_port_config port_config[WCD937X_MAX_SWR_PORTS]; - struct wcd937x_sdw_ch_info *ch_info; + struct wcd_sdw_ch_info *ch_info; bool port_enable[WCD937X_MAX_SWR_CH_IDS]; unsigned int master_channel_map[SDW_MAX_PORTS]; int active_ports; diff --git a/sound/soc/codecs/wcd938x-sdw.c b/sound/soc/codecs/wcd938x-sdw.c index 8bcd8396f375..40c6896eb781 100644 --- a/sound/soc/codecs/wcd938x-sdw.c +++ b/sound/soc/codecs/wcd938x-sdw.c @@ -21,7 +21,7 @@ =20 #define SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(m) (0xE0 + 0x10 * (m)) =20 -static const struct wcd938x_sdw_ch_info wcd938x_sdw_rx_ch_info[] =3D { +static const struct wcd_sdw_ch_info wcd938x_sdw_rx_ch_info[] =3D { WCD_SDW_CH(WCD938X_HPH_L, WCD938X_HPH_PORT, BIT(0)), WCD_SDW_CH(WCD938X_HPH_R, WCD938X_HPH_PORT, BIT(1)), WCD_SDW_CH(WCD938X_CLSH, WCD938X_CLSH_PORT, BIT(0)), @@ -32,7 +32,7 @@ static const struct wcd938x_sdw_ch_info wcd938x_sdw_rx_ch= _info[] =3D { WCD_SDW_CH(WCD938X_DSD_R, WCD938X_DSD_PORT, BIT(1)), }; =20 -static const struct wcd938x_sdw_ch_info wcd938x_sdw_tx_ch_info[] =3D { +static const struct wcd_sdw_ch_info wcd938x_sdw_tx_ch_info[] =3D { WCD_SDW_CH(WCD938X_ADC1, WCD938X_ADC_1_2_PORT, BIT(0)), WCD_SDW_CH(WCD938X_ADC2, WCD938X_ADC_1_2_PORT, BIT(1)), WCD_SDW_CH(WCD938X_ADC3, WCD938X_ADC_3_4_PORT, BIT(0)), diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 6d77cbcafa70..678e4052a255 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -393,7 +393,7 @@ static int wcd938x_io_init(struct wcd938x_priv *wcd938x) =20 } =20 -static int wcd938x_sdw_connect_port(const struct wcd938x_sdw_ch_info *ch_i= nfo, +static int wcd938x_sdw_connect_port(const struct wcd_sdw_ch_info *ch_info, struct sdw_port_config *port_config, u8 enable) { diff --git a/sound/soc/codecs/wcd938x.h b/sound/soc/codecs/wcd938x.h index a6fda63d7f98..a37962c4cef1 100644 --- a/sound/soc/codecs/wcd938x.h +++ b/sound/soc/codecs/wcd938x.h @@ -588,17 +588,6 @@ =20 #define WCD938X_MAX_SWR_CH_IDS 15 =20 -struct wcd938x_sdw_ch_info { - int port_num; - unsigned int ch_mask; -}; - -#define WCD_SDW_CH(id, pn, cmask) \ - [id] =3D { \ - .port_num =3D pn, \ - .ch_mask =3D cmask, \ - } - enum wcd938x_tx_sdw_ports { WCD938X_ADC_1_2_PORT =3D 1, WCD938X_ADC_3_4_PORT, @@ -650,7 +639,7 @@ struct wcd938x_sdw_priv { struct sdw_stream_config sconfig; struct sdw_stream_runtime *sruntime; struct sdw_port_config port_config[WCD938X_MAX_SWR_PORTS]; - const struct wcd938x_sdw_ch_info *ch_info; + const struct wcd_sdw_ch_info *ch_info; bool port_enable[WCD938X_MAX_SWR_CH_IDS]; int active_ports; bool is_tx; diff --git a/sound/soc/codecs/wcd939x-sdw.c b/sound/soc/codecs/wcd939x-sdw.c index 477d6cf27d32..b5a35c3b22e1 100644 --- a/sound/soc/codecs/wcd939x-sdw.c +++ b/sound/soc/codecs/wcd939x-sdw.c @@ -23,7 +23,7 @@ =20 #define SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(m) (0xE0 + 0x10 * (m)) =20 -static const struct wcd939x_sdw_ch_info wcd939x_sdw_rx_ch_info[] =3D { +static const struct wcd_sdw_ch_info wcd939x_sdw_rx_ch_info[] =3D { WCD_SDW_CH(WCD939X_HPH_L, WCD939X_HPH_PORT, BIT(0)), WCD_SDW_CH(WCD939X_HPH_R, WCD939X_HPH_PORT, BIT(1)), WCD_SDW_CH(WCD939X_CLSH, WCD939X_CLSH_PORT, BIT(0)), @@ -36,7 +36,7 @@ static const struct wcd939x_sdw_ch_info wcd939x_sdw_rx_ch= _info[] =3D { WCD_SDW_CH(WCD939X_HIFI_PCM_R, WCD939X_HIFI_PCM_PORT, BIT(1)), }; =20 -static const struct wcd939x_sdw_ch_info wcd939x_sdw_tx_ch_info[] =3D { +static const struct wcd_sdw_ch_info wcd939x_sdw_tx_ch_info[] =3D { WCD_SDW_CH(WCD939X_ADC1, WCD939X_ADC_1_4_PORT, BIT(0)), WCD_SDW_CH(WCD939X_ADC2, WCD939X_ADC_1_4_PORT, BIT(1)), WCD_SDW_CH(WCD939X_ADC3, WCD939X_ADC_1_4_PORT, BIT(2)), diff --git a/sound/soc/codecs/wcd939x.c b/sound/soc/codecs/wcd939x.c index ef8def695219..6bbdfa426365 100644 --- a/sound/soc/codecs/wcd939x.c +++ b/sound/soc/codecs/wcd939x.c @@ -412,7 +412,7 @@ static int wcd939x_io_init(struct snd_soc_component *co= mponent) return 0; } =20 -static int wcd939x_sdw_connect_port(const struct wcd939x_sdw_ch_info *ch_i= nfo, +static int wcd939x_sdw_connect_port(const struct wcd_sdw_ch_info *ch_info, struct sdw_port_config *port_config, u8 enable) { diff --git a/sound/soc/codecs/wcd939x.h b/sound/soc/codecs/wcd939x.h index f587cf22f86f..0ee0fbb49ff9 100644 --- a/sound/soc/codecs/wcd939x.h +++ b/sound/soc/codecs/wcd939x.h @@ -845,17 +845,6 @@ =20 #define WCD939X_MAX_SWR_CH_IDS (15) =20 -struct wcd939x_sdw_ch_info { - int port_num; - unsigned int ch_mask; -}; - -#define WCD_SDW_CH(id, pn, cmask) \ - [id] =3D { \ - .port_num =3D pn, \ - .ch_mask =3D cmask, \ - } - enum wcd939x_tx_sdw_ports { WCD939X_ADC_1_4_PORT =3D 1, WCD939X_ADC_DMIC_1_2_PORT, @@ -910,7 +899,7 @@ struct wcd939x_sdw_priv { struct sdw_stream_config sconfig; struct sdw_stream_runtime *sruntime; struct sdw_port_config port_config[WCD939X_MAX_SWR_PORTS]; - const struct wcd939x_sdw_ch_info *ch_info; + const struct wcd_sdw_ch_info *ch_info; bool port_enable[WCD939X_MAX_SWR_CH_IDS]; int active_ports; bool is_tx; --=20 2.50.0