From patchwork Tue Jun 18 13:55:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 13702458 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 7B5C3C27C4F for ; Tue, 18 Jun 2024 14:23:51 +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 B26EADF8; Tue, 18 Jun 2024 16:23:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B26EADF8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1718720629; bh=+4CUL0HKoZlb276ERUwdvPbHn/bW1BFwyupgf2+mb/Q=; h=From:Date:Subject:To:Cc:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=DzQjAe4mRcyJabxGH5oYOtVc4CbTpEE4DVi4Ew3BIef3pEO3PchUgo6VBuSlkzfyd HzSG94PLS/YuePY08ZqgKK5YqGaW9WsBQRYzW9+IoNb1F2NLK880rIJrTkwtqYRcej 97gthMduQdyR8IRentwMI4eue6FxfPR0KuRHmEMw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C776DF80674; Tue, 18 Jun 2024 16:22:24 +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 AB48EF805ED; Tue, 18 Jun 2024 16:22:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0E21FF80266; Tue, 18 Jun 2024 16:20:20 +0200 (CEST) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D6E0FF80578 for ; Tue, 18 Jun 2024 16:15:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D6E0FF80578 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=EgI2w9/I Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4217c7eb6b4so48482915e9.2 for ; Tue, 18 Jun 2024 07:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718719872; x=1719324672; darn=alsa-project.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=D6ChPm2ZVDCBI9wwPc6qqPViwCOCp7xGdlugGTVGuBk=; b=EgI2w9/IAAo+xTleSaP2fIc6v/TJiocTwKZyBl1SnAR8AFu6BH86Vrb6tZHEN37Boo eU++8kDsOZ9NqpTkJ3PJDBeGsUDsFrQCcdnSE8oLMGpax2GTK2krNhqeDjw8Q5c3B23l FYbbI5M7N8Bk+sEpWo5QnaK291Q7SjSDLuI5tqPt9QuamgAHRus9H+e6WmBzycQTnPzV fol9g6/y4nE1URBcFBb8Yr1DvwGjXlBX2nDSg88X8qL0MvwM5/K9IbGNNd38lIkd3eis 4GkcuPKmNR8N6RHZlEz6uPAfygwOzgkTESUIVGBZ/ENBpw3vDPbIwq7jE6pc/glaC1+O OKUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719872; x=1719324672; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D6ChPm2ZVDCBI9wwPc6qqPViwCOCp7xGdlugGTVGuBk=; b=PeD+LvqRlAzfvWp/6FTHJOqdJZ2MNQIJ/vLDjYOjAUC3hjmiKu4MfQWrnCANB3YU1+ utz9MCf9wWbtLyOM/EyB4TC1L9/s+I/ha+JsirEu9LPMFzcjQapsc1UCC33PmQ3bKmlf PEVchk3T55cBzzPYXPidI4eXNe/Vej6CgilEGBotf5JsmEgn0LCC63IFsncP4EA7N0Oe oU6JwJoruQXOOdp5lCW4LGiWNjY2pUCaqKVmKJVSwSVWchv70vX0t1xXh021NT5v7Td5 eokXzztgNKfuJdhzdKbHhcpMKoFNdqy1yRek57qwBMGL+uq4R8SpM0HK+BDlIzcH4axP txww== X-Forwarded-Encrypted: i=1; AJvYcCU4ZG44QnDVTaU+2+M1MSpLuuxMjdzfqERaM5FwUT7KuifaXoXzVOJMJzwljV6wR31EV9zc1GDKdYtDDXMsVfElmnOVarCP7KtBkqs= X-Gm-Message-State: AOJu0YyVmDKtrtxzMePPVBCo3rA7iebJReyQA9VPufXSUjSQOXZV9zRX pXIRV/s5mRbC3NlyRoeB8p+K6Dal4dvLiBMdyWgiRC+E5/UjWDaVbhXEy+sOxc8WPD44RmoaNTd rjqY= X-Google-Smtp-Source: AGHT+IG3ro8Zjz5M3lMie8NKLPIuT19SAyYyyup6jrLjzzoy1DgniE0/49fX7ZOxIcmnlH11xqxWAw== X-Received: by 2002:a17:907:c713:b0:a6f:69ee:dcd2 with SMTP id a640c23a62f3a-a6f69eee6famr911053966b.57.1718718917112; Tue, 18 Jun 2024 06:55:17 -0700 (PDT) Received: from [192.168.1.195] ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56f41721sm622645566b.154.2024.06.18.06.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 06:55:16 -0700 (PDT) From: Srinivas Kandagatla Date: Tue, 18 Jun 2024 14:55:15 +0100 Subject: [PATCH] drivers:soundwire: qcom: cleanup port maask calculations MIME-Version: 1.0 Message-Id: <20240618-soundwire-port-map-v1-1-9644e5545b9b@linaro.org> X-B4-Tracking: v=1; b=H4sIAMKRcWYC/x2NQQqDQAwAvyI5NxClFO1XSg/RzdYc3F0Sawvi3 7v2OAzD7OBiKg73ZgeTTV1zqtBeGphmTi9BDZWho+5Kt7ZHz+8UPmqCJduKCxck6uMQIgvFAWo 4sguOxmmaz3RhX8VOUUyifv+3x/M4fgWldN59AAAA To: Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale Cc: linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2420; i=srinivas.kandagatla@linaro.org; h=from:subject:message-id; bh=+4CUL0HKoZlb276ERUwdvPbHn/bW1BFwyupgf2+mb/Q=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBmcZHEZx0WD6S7YcEFm9sOro2WXS44qUag4slA8 6hz7200ceOJATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZnGRxAAKCRB6of1ZxzRV N882B/9JXKa/oPIDvV+BnarwrBTCXvFaYTVycNw4sgqDsEa5a2aE+ggUnpksuZjjus/nv6VBUL8 d80oUOZ6Y2d2qduf7Wvw76pLJtNYdDLeBE35ADRjR9yTYfFVSPlIXTi2HxpqanUkEJCF7MQ45Gn nnLw9qj2K7E8NCVzkgdVBAFNI9F0NoHbKf2WUSQSwEH+L6RUyxj8YCstMJEH5Wctwl8fphZZrOT RXWgc0sZ4pQfdULRQ+KTXGBGoJrMpwy5oMZa8ZhB6DiNnHJTaL7lhebUeRAY0u8hIcbALAkO2qC 8vcgFAOEuDXK/ttKLumsSmLcYRkJ0xhPPkrVn2GXEqsHZVIf X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Message-ID-Hash: YHSUQH2R5QCB64RO6MLSPAHPAMFDJ2QM X-Message-ID-Hash: YHSUQH2R5QCB64RO6MLSPAHPAMFDJ2QM X-MailFrom: srinivas.kandagatla@linaro.org 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: Cleanup the port map calculations, existing masks of having separate masks for in and out ports is not really required. Having a single mask for all the ports in the controller is simple and cuts of some unnecessary code. Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) --- base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0 change-id: 20240618-soundwire-port-map-008f9dfae0f9 Best regards, diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index ce5cf3ecceb5..aed57002fd0e 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -197,8 +197,7 @@ struct qcom_swrm_ctrl { int num_dout_ports; int cols_index; int rows_index; - unsigned long dout_port_mask; - unsigned long din_port_mask; + unsigned long port_mask; u32 intr_mask; u8 rcmd_id; u8 wcmd_id; @@ -1146,11 +1145,7 @@ static void qcom_swrm_stream_free_ports(struct qcom_swrm_ctrl *ctrl, mutex_lock(&ctrl->port_lock); list_for_each_entry(m_rt, &stream->master_list, stream_node) { - if (m_rt->direction == SDW_DATA_DIR_RX) - port_mask = &ctrl->dout_port_mask; - else - port_mask = &ctrl->din_port_mask; - + port_mask = &ctrl->port_mask; list_for_each_entry(p_rt, &m_rt->port_list, port_node) clear_bit(p_rt->num, port_mask); } @@ -1195,13 +1190,9 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl, if (ctrl->bus.id != m_rt->bus->id) continue; - if (m_rt->direction == SDW_DATA_DIR_RX) { - maxport = ctrl->num_dout_ports; - port_mask = &ctrl->dout_port_mask; - } else { - maxport = ctrl->num_din_ports; - port_mask = &ctrl->din_port_mask; - } + port_mask = &ctrl->port_mask; + maxport = ctrl->num_dout_ports + ctrl->num_din_ports; + list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { slave = s_rt->slave; @@ -1401,8 +1392,7 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl) return -EINVAL; /* Valid port numbers are from 1-14, so mask out port 0 explicitly */ - set_bit(0, &ctrl->dout_port_mask); - set_bit(0, &ctrl->din_port_mask); + set_bit(0, &ctrl->port_mask); ret = of_property_read_u8_array(np, "qcom,ports-offset1", off1, nports);