From patchwork Thu Feb 9 13:13:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 652373 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 2BF2EC61DA4 for ; Thu, 9 Feb 2023 13:15:53 +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 756C7E73; Thu, 9 Feb 2023 14:15:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 756C7E73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675948551; bh=6m7JCq6puJC6MDMhPLCN6YB/xjS2bTIc2JwbKjSzti4=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lSmQPVS8/168pA4A/Wg1bEqwNPCk9vh32JTuk9s+qB0KNPaG/WfR45p4B08TKQzqZ 89oPU/eojEv97F/SI3mOKDYKARwLp1PftEP19sLrOH1fuagkqpeAwf8Ycq/5nykoaQ DDZoZBye3r0yArKc0SH9HqKM/HETwHmo5P2lqn48= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 65442F80533; Thu, 9 Feb 2023 14:14:06 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4504F80526; Thu, 9 Feb 2023 14:14:02 +0100 (CET) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 2AEFBF80027 for ; Thu, 9 Feb 2023 14:13:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2AEFBF80027 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=DX+gWntv Received: by mail-wm1-x32d.google.com with SMTP id az4-20020a05600c600400b003dff767a1f1so1494937wmb.2 for ; Thu, 09 Feb 2023 05:13:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jZXq8dEw8EGIO/pGDRaHOOzvG+p+V2k3SWMSCz374AM=; b=DX+gWntv9kzkTbjK0gkqW7XZcfeX5kAYrPiXrCQo21K0scAgIXpVJAP1rndjdvAOMg 3whWi/KWru5IkCXPKpJ4ShsNfXompA7GSrV/b0dE6EOGjxmSCoIe+bMxEf7GZWxEZ4aq DHfe35AEE8QEF/FxgngYLPkbVxAvxK0ayyKDFV1om9I7xdIG5+7m0ycVnGhdSr9tHRKn schucCCwbIDdqWoYmE1GXdDa1dGPxa4Ky4b+1bLpWDBwr0xasXjMwEPrYlpqbfT0YMa6 lXjNl36Og+9c2kjZnZxqNpB9B47TUlgJBy424l8ja96M7rV0ikg36ZcxUnAJtrEuggmM KMpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=jZXq8dEw8EGIO/pGDRaHOOzvG+p+V2k3SWMSCz374AM=; b=MGncZ53WG7Z4odbDegdlSGAUWM2aWe9XH/0Ty6uRVabmneAmEoZMlWuYG4mz5A/Kjb QocjIP1FOlu5/pf7DIyqCBQ/KZ7Kn4Pw2ZPDgQhjVgN6NpmokT0sxucsmwqd5IxnCx27 dMgf6e9FIyrKTjdBpviBl53HO4H3R4dsjxg1tqNE9dLUJG8fFJqGS99zF9i+cAGhrEtW brPOkfll4b0NU9fLVvxzvnpfvPFyfhwbWqDctQHXqpKWNkRbEIHap/4nZU/9DDIi+DRi aeOR0ZYBSLehgwq9pz0vnIwfUFlwl9hfxMiuLvXylqPCZ0M++JFXocdjSICd8ApbADvs d/0A== X-Gm-Message-State: AO0yUKUEfM9M6HCvEzKsVJWgatZ8gteCMILN1c0CNo2xn0iFH5AhWJM4 jYE++VHy4aBaONarlGdpbxAOYQ== X-Google-Smtp-Source: AK7set9UDllZp++Y9sSAO87/EiOBjOXXsU2IfXA+F46MbiAOkm7RnkGwp/TzTkkcsgE8um4uO9+/8w== X-Received: by 2002:a05:600c:331b:b0:3dc:4356:533c with SMTP id q27-20020a05600c331b00b003dc4356533cmr9840352wmp.5.1675948428277; Thu, 09 Feb 2023 05:13:48 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ja13-20020a05600c556d00b003dc4b4dea31sm1789394wmb.27.2023.02.09.05.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 05:13:47 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH 1/5] soundwire: qcom: update status correctly with mask Date: Thu, 9 Feb 2023 13:13:32 +0000 Message-Id: <20230209131336.18252-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> References: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: 5ZDSJPRKMX43FIKHJ2RRPYJFNRQ4MEZO X-Message-ID-Hash: 5ZDSJPRKMX43FIKHJ2RRPYJFNRQ4MEZO 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 CC: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, steev@kali.org, johan+linaro@kernel.org, quic_bjorande@quicinc.com, Srinivas Kandagatla X-Mailman-Version: 3.3.8 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: SoundWire device status can be incorrectly updated without proper mask, fix this by adding a mask before updating the status. Fixes: c7d49c76d1d5 ("soundwire: qcom: add support to new interrupts") Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 335424870290..9d8ae77bad0a 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -434,7 +434,7 @@ static int qcom_swrm_get_alert_slave_dev_num(struct qcom_swrm_ctrl *ctrl) status = (val >> (dev_num * SWRM_MCP_SLV_STATUS_SZ)); if ((status & SWRM_MCP_SLV_STATUS_MASK) == SDW_SLAVE_ALERT) { - ctrl->status[dev_num] = status; + ctrl->status[dev_num] = status & SWRM_MCP_SLV_STATUS_MASK; return dev_num; } } From patchwork Thu Feb 9 13:13:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 652118 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 B7E6DC61DA4 for ; Thu, 9 Feb 2023 13:16: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 B2BBCE7E; Thu, 9 Feb 2023 14:15:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B2BBCE7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675948570; bh=uSRxXerqS4Brn1LW4cMOJhEMzgI8uc0+nr5PziKZ94I=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Nstggo9eTcbTWsaet40vmeg4jdVOtknfYisBSvaXaOrnRM06kECR1LDAhp+4Mmyls GPHA0V4kflX1TUA2pANLzTWhEayLC/hocCMEgbnQhChY3YNa8ilLC3C/l+hSasnBet uDGlAnyefE6AOCrcUXeirTHxePiviBX+9dejAh8g= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id EB907F80551; Thu, 9 Feb 2023 14:14:43 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8B05BF80551; Thu, 9 Feb 2023 14:14:40 +0100 (CET) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 3C102F8021D for ; Thu, 9 Feb 2023 14:13:51 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3C102F8021D 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=ULYJnwqN Received: by mail-wm1-x335.google.com with SMTP id j29-20020a05600c1c1d00b003dc52fed235so1499296wms.1 for ; Thu, 09 Feb 2023 05:13:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nPXVzG5o2X54MLB3ZyDSI4pawnltFzWU5Saextq817o=; b=ULYJnwqNMeRiea9IJdFP6yvfpxaRwkju4sp2HMcBIO6UHM0rdl40OPLuvrjmSSH4OQ fpScO6nXREnk/uZlVm+PA0saUgUMEmCFnW5NCC9kCeEAOKtmcNsrx7ogiJ6TB335qgHA CldrEYHwLgk7qatZ91j1dre1BD6oBWD0L9U/KbLV3gEdL58WEI6i5db+AgDPJOe6pxVK rQQoGLiXpE/k3cYKnVBMHn4E9BWxgeSkl1ny+vpFIAqEa6Vsypkb77sMWf551sHbIURF KB0pIBFLrVjTUtsMuN76ljfwuGHip+Xb5xVwWvy+MARzu1zprHOqFyTiW2V25COrRGcI +Ugw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=nPXVzG5o2X54MLB3ZyDSI4pawnltFzWU5Saextq817o=; b=VYncHIFANVnlvgR8dsX1tek6eoodRE2CcQtN8qpcKVHtIWAPyrXN7wXRn5s8JWJSGt LNFiE6LaslhmCDAuQWiomZwgV572AA94rA87jpd2NwJjN2e9SKF77TfL+lt6A7BJCSsk OZuhkRVlhsmlbQLM6FHcwRU90dszBlyk/Lxr0S1oTxX1LC3Qpul1ck6LSjPeYsADK8Ce +fGSFGhBDy1oFHSBlSCKg/3PnN8zEMzjh8TQ5d3XLx8S+IRaFZ84bS/XtRoUwUVYsmo/ oF6LhIPbl9yRkRgHWao6L/yW2NMjlJ3EqJHopy4DexsjuUFbkHPEgwlxxL6cA/LnSUAr HihQ== X-Gm-Message-State: AO0yUKVRViUTTzrmvLkJpR1CnLfN8ucL8MKLmJ6v344I8QjpIh+AsaMx enbJ8PPItQoT3OjtDbNG6WaPnQ== X-Google-Smtp-Source: AK7set9KVelqkabFmlPe2AeCDVnSLTivPIjdspWLcsVhNmF8H4NdG9Vd9VAvODpDmSKyXrZx8cstZw== X-Received: by 2002:a05:600c:a293:b0:3dc:59e9:9285 with SMTP id hu19-20020a05600ca29300b003dc59e99285mr11100382wmb.18.1675948429591; Thu, 09 Feb 2023 05:13:49 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ja13-20020a05600c556d00b003dc4b4dea31sm1789394wmb.27.2023.02.09.05.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 05:13:48 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH 2/5] soundwire: qcom: enable runtime pm before controller is registered Date: Thu, 9 Feb 2023 13:13:33 +0000 Message-Id: <20230209131336.18252-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> References: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: HGBWVEXUSZQO3XLZ55T74FKZFXGSENIM X-Message-ID-Hash: HGBWVEXUSZQO3XLZ55T74FKZFXGSENIM 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 CC: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, steev@kali.org, johan+linaro@kernel.org, quic_bjorande@quicinc.com, Srinivas Kandagatla X-Mailman-Version: 3.3.8 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: Registering controller even before pm runtime is enabled will result in pm runtime underflow warnings. Fix this by properly moving the runtime pm enable before registering controller. Fixes: 74e79da9fd46 ("soundwire: qcom: add runtime pm support") Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 9d8ae77bad0a..b2363839624c 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -1417,6 +1417,12 @@ static int qcom_swrm_probe(struct platform_device *pdev) } } + pm_runtime_set_autosuspend_delay(dev, 3000); + pm_runtime_use_autosuspend(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode); if (ret) { dev_err(dev, "Failed to register Soundwire controller (%d)\n", @@ -1435,12 +1441,6 @@ static int qcom_swrm_probe(struct platform_device *pdev) (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff, ctrl->version & 0xffff); - pm_runtime_set_autosuspend_delay(dev, 3000); - pm_runtime_use_autosuspend(dev); - pm_runtime_mark_last_busy(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - /* Clk stop is not supported on WSA Soundwire masters */ if (ctrl->version <= 0x01030000) { ctrl->clock_stop_not_supported = true; From patchwork Thu Feb 9 13:13:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 652119 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 CFCB7C05027 for ; Thu, 9 Feb 2023 13:15:44 +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 85CA5DF3; Thu, 9 Feb 2023 14:14:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 85CA5DF3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675948542; bh=rrBHItTWM+PKFev/ycwJhvOMBsHpY53m6R9FWU66jfw=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=BuXSOg7UTdeAbMgPKTjtRYeXimeXKHo0dNoLMZYjY2vH6bZf4NfBbJs9ETOI78F2z Kjo21ITg8jbjbsh0ntBSL3qQck6+F3Cu7ul8v83sHcrMHOz0+36sMWCNnqJW69wdbv teT8Bf4madRUr7qBTB1G4aYFUrqwiLRmsDUEvU1s= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E8B14F80526; Thu, 9 Feb 2023 14:14:03 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A37AAF804F2; Thu, 9 Feb 2023 14:14:00 +0100 (CET) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 B634FF800B8 for ; Thu, 9 Feb 2023 14:13:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B634FF800B8 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=eSuI9Zqf Received: by mail-wm1-x32f.google.com with SMTP id bg26so1437028wmb.0 for ; Thu, 09 Feb 2023 05:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PtCm7HHmygVV89PU04X4kKxKy0d9QS0qb0ALCWzJ2AE=; b=eSuI9ZqfTFGJOUknn/oOE6Qc01UKQtJJwm8VLN8g1fySb9QrJk6G4Hp6FLYreiKmA8 0CiV/M+NSOwLIvlOFBCO4kCFbkNmdhiNUkHEYUa4+yYKKPcx4Ixm2Y3/d8ZhNTYpJlPQ mdTKwLDVP3iLzONlcUZT9P5bT2/jVxg6HJbRiRhm3e0LsXBCkALnt9kpadjxUtx9SM5e dN9Run2nQ2NC0RJEXdwEcXzfWAsUNAPXeVJzYrRM8oZZ+Jm/GuoGWHFpbyBzUnw/TViC 33RQpX9wjEPe/5l2sAsCHy+7eCHOPTipoEnzHpRfNTZO3KvAIuFmqNZ5CKwZ+9yWPfJs Abkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=PtCm7HHmygVV89PU04X4kKxKy0d9QS0qb0ALCWzJ2AE=; b=TcVZIUlO3MRoFqO7JVtUp9mh4EyW/HYrXkIKSpl0j/x1eRKQjXhuL386DzM1xL2mf1 fDSntab79aXmZb9dbIPfL5QrYAjZLDeA+rFdbIib0QkAWlrKXRhi9xJD4wsE+e3o6VVR RuQkZsVuKRkjvXhNrKB99Cp+7uhLDfJHao0ejk36fcdfeeLXEMlZc0nDyIZ/Rt732I/k 9QpCnw0fmtgQ4bHhKqXvPKnP4KfX7zSqS0ZmOKwD2NlQDYvoJor7yeLpErSSuPuHE0MQ GHEiwhre9Po0TLajCtOwoCsoCxz615B3oFJ4Br/eHd4N03IHbTqHse1/8vROP+pma1SN DzJg== X-Gm-Message-State: AO0yUKWLSwpNzqKTeB+vQACOORP9+u1HsfA8KcxMN8jT0f5newv8aTXN 9O8sxDUxsDUNxO2fV5PGwrbn+w== X-Google-Smtp-Source: AK7set/MyhWYDmBCQIobeqNcHgJIA0aF22fzJ/STfU/NfAy05+kaDxntzWIP9Kfc8s8dkxaOHTLHPg== X-Received: by 2002:a05:600c:3198:b0:3e0:15c:3573 with SMTP id s24-20020a05600c319800b003e0015c3573mr9426269wmp.35.1675948430859; Thu, 09 Feb 2023 05:13:50 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ja13-20020a05600c556d00b003dc4b4dea31sm1789394wmb.27.2023.02.09.05.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 05:13:50 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH 3/5] soundwire: qcom: wait for fifo to be empty before suspend Date: Thu, 9 Feb 2023 13:13:34 +0000 Message-Id: <20230209131336.18252-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> References: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: IAAOZMVJF3PS4IUS52WM3GV5XQLV75BB X-Message-ID-Hash: IAAOZMVJF3PS4IUS52WM3GV5XQLV75BB 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 CC: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, steev@kali.org, johan+linaro@kernel.org, quic_bjorande@quicinc.com, Srinivas Kandagatla X-Mailman-Version: 3.3.8 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: Wait for Fifo to be empty before going to suspend or before bank switch happens. Just to make sure that all the reads/writes are done. Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index b2363839624c..465b2a2ef0d5 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -325,6 +325,32 @@ static int swrm_wait_for_wr_fifo_avail(struct qcom_swrm_ctrl *swrm) return 0; } +static bool swrm_wait_for_wr_fifo_done(struct qcom_swrm_ctrl *swrm) +{ + u32 fifo_outstanding_cmds, value; + int fifo_retry_count = SWR_OVERFLOW_RETRY_COUNT; + + /* Check for fifo overflow during write */ + swrm->reg_read(swrm, SWRM_CMD_FIFO_STATUS, &value); + fifo_outstanding_cmds = FIELD_GET(SWRM_WR_CMD_FIFO_CNT_MASK, value); + + if (fifo_outstanding_cmds) { + while (fifo_retry_count) { + usleep_range(500, 510); + swrm->reg_read(swrm, SWRM_CMD_FIFO_STATUS, &value); + fifo_outstanding_cmds = FIELD_GET(SWRM_WR_CMD_FIFO_CNT_MASK, value); + fifo_retry_count--; + if (fifo_outstanding_cmds == 0) + return true; + } + } else { + return true; + } + + + return false; +} + static int qcom_swrm_cmd_fifo_wr_cmd(struct qcom_swrm_ctrl *swrm, u8 cmd_data, u8 dev_addr, u16 reg_addr) { @@ -356,6 +382,7 @@ static int qcom_swrm_cmd_fifo_wr_cmd(struct qcom_swrm_ctrl *swrm, u8 cmd_data, usleep_range(150, 155); if (cmd_id == SWR_BROADCAST_CMD_ID) { + swrm_wait_for_wr_fifo_done(swrm); /* * sleep for 10ms for MSM soundwire variant to allow broadcast * command to complete. @@ -1122,6 +1149,7 @@ static void qcom_swrm_shutdown(struct snd_pcm_substream *substream, { struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dai->dev); + swrm_wait_for_wr_fifo_done(ctrl); sdw_release_stream(ctrl->sruntime[dai->id]); ctrl->sruntime[dai->id] = NULL; pm_runtime_mark_last_busy(ctrl->dev); @@ -1558,6 +1586,7 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev) struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev); int ret; + swrm_wait_for_wr_fifo_done(ctrl); if (!ctrl->clock_stop_not_supported) { /* Mask bus clash interrupt */ ctrl->intr_mask &= ~SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET; From patchwork Thu Feb 9 13:13:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 652372 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 22E78C05027 for ; Thu, 9 Feb 2023 13:16:35 +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 0CD75E78; Thu, 9 Feb 2023 14:15:43 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0CD75E78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675948593; bh=YpUC/NNZCttaGWgcQUrhszQEVYAmOb60e2JhlDsr2VE=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Mw2hgZSDrX+YX0HlC1FO3XGn73XU5Hq0R+QJI7fd2imIvyDzTLoHT3c3vefXVtBep qFjKuRfA+luCiqGEo6TRH+8IRZfY0I6sA1uWzwsBWiK8CPy11QAT5V7sLEuQ8tTEzr 6MthCs8TejIay1ixRI4fAgAKBxT8ow4UuZ+dzXyY= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 84167F8051F; Thu, 9 Feb 2023 14:14:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 06554F80557; Thu, 9 Feb 2023 14:14:44 +0100 (CET) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 379C3F800E4 for ; Thu, 9 Feb 2023 14:13:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 379C3F800E4 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=Hm2UVZKn Received: by mail-wm1-x331.google.com with SMTP id l21-20020a05600c1d1500b003dfe462b7e4so4091593wms.0 for ; Thu, 09 Feb 2023 05:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=efw37swPmywJmQt7P4bh+b3QJPTdP5Sd+iv+/8BqF9I=; b=Hm2UVZKn8j00Xjy+/2jHbryM9Im/P1TEbXrvCJSQWCI6WDeX7JKZNB+r2LeTFR8Duw 52SEspmzdvCK7mZpMpE6Agh8BZZJihf+YT70iQ1F4ISTC7PC3AOpxn9ITwD8rZ+JfnoI HOvRf/nRzH9eqPec2J9G+fldT14gl3Rt7V/8u6ZrQ2pAJYnunMy+MIxLx219gj5BUEM7 6GKNHu1jwzOCT8D3gVJWXcntWIifvc4H8c9q/fdeGKyghfeMfbS9X5WY/dfG1PxFYu/i McaheEHsr8hGwE0cqZi0umwPzXKer2TiGkMMnBSXrisXnd3RzyOpGL/JY22nDtqROyfR Fg9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=efw37swPmywJmQt7P4bh+b3QJPTdP5Sd+iv+/8BqF9I=; b=b2NzH8Vv7C0WD2lpwrL35Mp8qMWM6+6D9jFCqJWSLMs3OhtXetIRnSj9MR8Bpi0155 di8UaWVUCYplxz5un1rLXcsJdAx9pH1PZwF1TcvxnjLIF/3uMX5NuC2il1RFu4namDSR IOHV3woh7Yvp3fYg/3duoUfmBz1k2X0qD4IRqR+WqprPbN12co5Z9QziRJcEawgU1UUu qvBOxbfsYruYPrqdW+5hfXYRumEqDzV2ZxnJaSXA6MuR46jY+sauqBE848L/wKqYgz66 Sc1sg0PxrfqoC1DMJGy5fWvI5ehAA37itjcbmvrlKKDrXQ/uOughcZlPGcP6VixmnwFS 8m0A== X-Gm-Message-State: AO0yUKXpiMcyMdrktVhvE5adUfenWpy6h5FDSJXOCx3XYgWXepmM+34v RovE0iB9xu63KT4AIM3+5+G/Ng== X-Google-Smtp-Source: AK7set/5t4R6vkbCi7xHYljKhRpCdrMwM173eSMG153XkPcECEZOP9zQsPoLSZqZJbWVxrvSBb6VEA== X-Received: by 2002:a05:600c:1686:b0:3db:2df0:f2b8 with SMTP id k6-20020a05600c168600b003db2df0f2b8mr5574813wmn.36.1675948432059; Thu, 09 Feb 2023 05:13:52 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ja13-20020a05600c556d00b003dc4b4dea31sm1789394wmb.27.2023.02.09.05.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 05:13:51 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH 4/5] soundwire: qcom: add software workaround for bus clash interrupt assertion Date: Thu, 9 Feb 2023 13:13:35 +0000 Message-Id: <20230209131336.18252-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> References: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: FPJVOLVUDPPOWVOXBMOSJUGHMHZLBX3B X-Message-ID-Hash: FPJVOLVUDPPOWVOXBMOSJUGHMHZLBX3B 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 CC: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, steev@kali.org, johan+linaro@kernel.org, quic_bjorande@quicinc.com, Srinivas Kandagatla X-Mailman-Version: 3.3.8 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: Sometimes Hard reset does not clear some of the registers, this sometimes results in firing a bus clash interrupt. Add workaround for this during power up sequence, as suggested by hardware manual. Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 55 ++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 465b2a2ef0d5..74e38c0d651b 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -697,6 +697,26 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id) return ret; } +static bool swrm_wait_for_frame_gen_enabled(struct qcom_swrm_ctrl *swrm) +{ + int retry = SWRM_LINK_STATUS_RETRY_CNT; + int comp_sts; + + do { + swrm->reg_read(swrm, SWRM_COMP_STATUS, &comp_sts); + + if (comp_sts & SWRM_FRM_GEN_ENABLED) + return true; + + usleep_range(500, 510); + } while (retry--); + + dev_err(swrm->dev, "%s: link status %s\n", __func__, + comp_sts & SWRM_FRM_GEN_ENABLED ? "connected" : "disconnected"); + + return false; +} + static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) { u32 val; @@ -741,16 +761,27 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) SWRM_RD_WR_CMD_RETRIES); } + /* COMP Enable */ + ctrl->reg_write(ctrl, SWRM_COMP_CFG_ADDR, SWRM_COMP_CFG_ENABLE_MSK); + /* Set IRQ to PULSE */ ctrl->reg_write(ctrl, SWRM_COMP_CFG_ADDR, - SWRM_COMP_CFG_IRQ_LEVEL_OR_PULSE_MSK | - SWRM_COMP_CFG_ENABLE_MSK); + SWRM_COMP_CFG_IRQ_LEVEL_OR_PULSE_MSK); + + ctrl->reg_write(ctrl, SWRM_INTERRUPT_CLEAR, 0xFFFFFFFF); /* enable CPU IRQs */ if (ctrl->mmio) { ctrl->reg_write(ctrl, SWRM_INTERRUPT_CPU_EN, SWRM_INTERRUPT_STATUS_RMSK); } + + /* Set IRQ to PULSE */ + ctrl->reg_write(ctrl, SWRM_COMP_CFG_ADDR, + SWRM_COMP_CFG_IRQ_LEVEL_OR_PULSE_MSK | + SWRM_COMP_CFG_ENABLE_MSK); + + swrm_wait_for_frame_gen_enabled(ctrl); ctrl->slave_status = 0; ctrl->reg_read(ctrl, SWRM_COMP_PARAMS, &val); ctrl->rd_fifo_depth = FIELD_GET(SWRM_COMP_PARAMS_RD_FIFO_DEPTH, val); @@ -1504,26 +1535,6 @@ static int qcom_swrm_remove(struct platform_device *pdev) return 0; } -static bool swrm_wait_for_frame_gen_enabled(struct qcom_swrm_ctrl *swrm) -{ - int retry = SWRM_LINK_STATUS_RETRY_CNT; - int comp_sts; - - do { - swrm->reg_read(swrm, SWRM_COMP_STATUS, &comp_sts); - - if (comp_sts & SWRM_FRM_GEN_ENABLED) - return true; - - usleep_range(500, 510); - } while (retry--); - - dev_err(swrm->dev, "%s: link status not %s\n", __func__, - comp_sts & SWRM_FRM_GEN_ENABLED ? "connected" : "disconnected"); - - return false; -} - static int __maybe_unused swrm_runtime_resume(struct device *dev) { struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev); From patchwork Thu Feb 9 13:13:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 652117 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 9F6C9C61DA4 for ; Thu, 9 Feb 2023 13:16:44 +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 56E13E72; Thu, 9 Feb 2023 14:15:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 56E13E72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1675948602; bh=QIzgqJo1PbgT8kMvAqhqZSCWFoTb7LfwfgQrbOyf8p8=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DOlJ3qw0vEniAhfuyPjfAs/PV7GEh1F5t2hIg47ZdM9f0NZKblWSNd9qJMu90g5FL 1jJt6rnz4wvE9RE7N3XcJ2Sr597sBHs3IkYIzje4694xuENSPQxUi2M876EUgPU0FS jHdPyHsiTr7Rr3rT1Xl7Hry3MUizU/CkF/NhLUiE= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 22E7AF8055A; Thu, 9 Feb 2023 14:14:51 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 76D41F80553; Thu, 9 Feb 2023 14:14:46 +0100 (CET) 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 1BC40F80086 for ; Thu, 9 Feb 2023 14:13:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1BC40F80086 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=P5/7vAmo Received: by mail-wm1-x336.google.com with SMTP id bg5-20020a05600c3c8500b003e00c739ce4so1472697wmb.5 for ; Thu, 09 Feb 2023 05:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NPMNrqeZWO55o8AuAcgfBuwWh3I0TkN1wM5VoUAdYRc=; b=P5/7vAmoDhtyUlDOFPxWWFRqeYKHw8doDPEZBBNdtIVq/tXEgqP6HDXkgsDHQG75uj BuJV5vmjH4QrQCnfFzzcRmVT3ejoinm3y5GEBKxcEeeD05XKfjCBAClKGnST3B8MQWBn Oc9ahTVyT17Vg+/x06m23nWOiXJ4PHkiIM5dWbGETfG8UKXs8GnE9P+l+9vGNhAOPryv SB4acICvJP0dUJDt6xotz75JpNVjolbpfbeHUVPmCeXC2RzRWI3hzObNL8NU/+9JNPDt 2mOU8jfUcVHMFTisSeQ4GxV8m4O9Zrv8n5ZG1Pox+2DVnyTohSu+1Kuswuhi67g9tHme /3zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=NPMNrqeZWO55o8AuAcgfBuwWh3I0TkN1wM5VoUAdYRc=; b=XvUYrBT4DfQePUWQgC29jsC1KwUI+wPwRSqqrZpfWbuOzYZ1QJjApc2nrSk/tSC5lP oYpM1XuX72IrCDYK85rMiEKHAhzJoBT3qap5C9QvE75oo7rL1HB2R1O2+bAFVIVt6sXH lBMvnKa3aDJWHtVbne/b33tLpRbG/5Gd4M96oU/s0e4/wlmxqQiqy1a2SUH0T8gUXO4r v9vlmAM/jTUwJ0572JCYjh2jyF9xL2OGf0tezXFp+58NNxIJV1Ep8mld9iq5U4y1kw8i j/8ykD5oQfqd3p41PfduHZgCoMqFjRcxQqXWhkYmbPAaBcPqj/+5Qw7p9A84sNt69ONG 9sHA== X-Gm-Message-State: AO0yUKXL2waIYmlMjM9IuU2tOK5/dD3B5vN2I43XWihLmv4u+OT8atUr ZEjm2p/vTEyfvtorqoqEs/HWXg== X-Google-Smtp-Source: AK7set8+KF1qJ63RGYOjxvONT/0dXdAeON0gJzSIfKGxOdbH/Nq2pMAk1kkn/QWQI4j+NQDJQZfcUQ== X-Received: by 2002:a05:600c:4485:b0:3dc:51ad:9dc4 with SMTP id e5-20020a05600c448500b003dc51ad9dc4mr9701331wmo.18.1675948433322; Thu, 09 Feb 2023 05:13:53 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ja13-20020a05600c556d00b003dc4b4dea31sm1789394wmb.27.2023.02.09.05.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 05:13:52 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH 5/5] soundwire: qcom: set clk stop need reset flag at runtime Date: Thu, 9 Feb 2023 13:13:36 +0000 Message-Id: <20230209131336.18252-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> References: <20230209131336.18252-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Message-ID-Hash: B5A5BFUYETU7XAADJZ4D4BSFNPHK4QGC X-Message-ID-Hash: B5A5BFUYETU7XAADJZ4D4BSFNPHK4QGC 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 CC: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, steev@kali.org, johan+linaro@kernel.org, quic_bjorande@quicinc.com, Srinivas Kandagatla X-Mailman-Version: 3.3.8 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: WSA Soundwire controller needs an full reset if clock stop support is not available in slave devices. WSA881x does not support clock stop however WSA883x supports clock stop. Make setting this flag at runtime to address above issue. Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 74e38c0d651b..0224a5a866de 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -536,10 +536,14 @@ static int qcom_swrm_enumerate(struct sdw_bus *bus) sdw_extract_slave_id(bus, addr, &id); found = false; + ctrl->clock_stop_not_supported = false; /* Now compare with entries */ list_for_each_entry_safe(slave, _s, &bus->slaves, node) { if (sdw_compare_devid(slave, id) == 0) { qcom_swrm_set_slave_dev_num(bus, slave, i); + if (!slave->prop.simple_clk_stop_capable) + ctrl->clock_stop_not_supported = true; + found = true; break; } @@ -1500,15 +1504,6 @@ static int qcom_swrm_probe(struct platform_device *pdev) (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff, ctrl->version & 0xffff); - /* Clk stop is not supported on WSA Soundwire masters */ - if (ctrl->version <= 0x01030000) { - ctrl->clock_stop_not_supported = true; - } else { - ctrl->reg_read(ctrl, SWRM_COMP_MASTER_ID, &val); - if (val == MASTER_ID_WSA) - ctrl->clock_stop_not_supported = true; - } - #ifdef CONFIG_DEBUG_FS ctrl->debugfs = debugfs_create_dir("qualcomm-sdw", ctrl->bus.debugfs); debugfs_create_file("qualcomm-registers", 0400, ctrl->debugfs, ctrl,