From patchwork Mon Sep 9 10:55:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Rafi Shaik X-Patchwork-Id: 826656 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 6F5CFECE57A for ; Mon, 9 Sep 2024 10:58:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 116B4852; Mon, 9 Sep 2024 12:58:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 116B4852 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1725879490; bh=8Vd/OSojNgrcBBDFLqFIisQRt6JC3d7ABI1zc+MA35w=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KQrmFgNd4NVJW6e+GbAmklDUjPxulRK+gQ0ZOi7q2XIqt0PXDN53FqVsuK+X0FDZP w6St8qChJ0jDQFHEytoj9tL5CXaOgAEbGasxVmK3tRbNjWGTh1RQKwWrp4ibRGZy3S SCCUelHzHxWnwzlyuVMdN1Vh9YTJ1uKUoihaY7wA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 29E21F805AE; Mon, 9 Sep 2024 12:57:06 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 82DC2F8061B; Mon, 9 Sep 2024 12:57:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E19A3F8060D; Mon, 9 Sep 2024 12:57:02 +0200 (CEST) Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0CA34F80536 for ; Mon, 9 Sep 2024 12:57:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0CA34F80536 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=NuzOYVSp Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4899K7pu031036; Mon, 9 Sep 2024 10:57:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= ihbuH8ZE0WoVokeOq+71+6Vox3J6l793D//UVXzSd8A=; b=NuzOYVSpSghN7evz wxYLZeyDXCrIAiAHYMyAbH8UlsNkAJfjNtwZhOk+mgOTCUIAdmGvu22Ls9OJFms/ uSh5JRcaukSvycxrWQsylSgtNVGDKQV9kuClttUmRVEWDEAQIz7nCX6lOq3waafB 7Vnkim53nk8obFLdOPjX1PzqgVOX/J/4NJPkDiucXYjhR+JZoH7kscKUcInlwuKZ Mkhm3Z/MO34/kDa0Am1pBijYAuD38UBPsGA+M3kzrcMNlkd6Dsuyg89JUhh05UQV ySpBN/Gt8uHfPYiC0pzoF5A7y0lzMRy6+vQ4pUOMa7bvLQzbPNzN7TZeL+XmRITb T/6lQw== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41gy5rahf5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 09 Sep 2024 10:56:59 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 489Auwvv016942 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 9 Sep 2024 10:56:58 GMT Received: from hu-mohs-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 9 Sep 2024 03:56:50 -0700 From: Mohammad Rafi Shaik To: Srinivas Kandagatla , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Bard Liao , Jaroslav Kysela , "Takashi Iwai" CC: Pierre-Louis Bossart , Sanyog Kale , , , , , , , , , Mohammad Rafi Shaik Subject: [PATCH v1 3/4] soundwire: qcom: Add static channel mapping support in soundwire master Date: Mon, 9 Sep 2024 16:25:46 +0530 Message-ID: <20240909105547.2691015-4-quic_mohs@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240909105547.2691015-1-quic_mohs@quicinc.com> References: <20240909105547.2691015-1-quic_mohs@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 2N1-ngBqMyy-wj7nDpgNQfaJBVAndt6B X-Proofpoint-ORIG-GUID: 2N1-ngBqMyy-wj7nDpgNQfaJBVAndt6B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 clxscore=1015 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2408220000 definitions=main-2409090087 Message-ID-Hash: FQXRUBKCXBZPDDC6WBCF7ILCDTK4P45Y X-Message-ID-Hash: FQXRUBKCXBZPDDC6WBCF7ILCDTK4P45Y X-MailFrom: quic_mohs@quicinc.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add static channel mapping support in soundwire master. The qcom_swrm_set_channel_map() will update the master channel mask based on master port number. Signed-off-by: Mohammad Rafi Shaik --- drivers/soundwire/qcom.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index aed57002fd0e..65ed1ff7888f 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -156,6 +156,7 @@ struct qcom_swrm_port_config { u8 word_length; u8 blk_group_count; u8 lane_control; + u8 ch_mask; }; /* @@ -1048,8 +1049,14 @@ static int qcom_swrm_port_enable(struct sdw_bus *bus, { u32 reg = SWRM_DP_PORT_CTRL_BANK(enable_ch->port_num, bank); struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus); + struct qcom_swrm_port_config *pcfg; u32 val; + pcfg = &ctrl->pconfig[enable_ch->port_num]; + + if (pcfg->ch_mask != SWR_INVALID_PARAM && pcfg->ch_mask != 0) + enable_ch->ch_mask = pcfg->ch_mask; + ctrl->reg_read(ctrl, reg, &val); if (enable_ch->enable) @@ -1060,6 +1067,16 @@ static int qcom_swrm_port_enable(struct sdw_bus *bus, return ctrl->reg_write(ctrl, reg, val); } +static int qcom_swrm_set_channel_map(struct sdw_bus *bus, int *ch_mask, unsigned int port_num) +{ + struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus); + + if (ch_mask && port_num) + ctrl->pconfig[port_num].ch_mask = ch_mask[port_num]; + + return 0; +} + static const struct sdw_master_port_ops qcom_swrm_port_ops = { .dpn_set_port_params = qcom_swrm_port_params, .dpn_set_port_transport_params = qcom_swrm_transport_params, @@ -1070,6 +1087,7 @@ static const struct sdw_master_ops qcom_swrm_ops = { .read_prop = qcom_swrm_read_prop, .xfer_msg = qcom_swrm_xfer_msg, .pre_bank_switch = qcom_swrm_pre_bank_switch, + .set_master_channel_map = qcom_swrm_set_channel_map, }; static int qcom_swrm_compute_params(struct sdw_bus *bus)