From patchwork Mon Mar 8 13:49:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 395526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69A46C433DB for ; Mon, 8 Mar 2021 13:51:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A8065651D1 for ; Mon, 8 Mar 2021 13:51:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8065651D1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 91D2018AA; Mon, 8 Mar 2021 14:51:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 91D2018AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615211515; bh=6ITnr6YV1EJivEskxNPgBOT9I7p10oDELFPOmR/XixI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=s7R+Aqth2cPpPdy1YcaV86v8CZ2cwoFccNjB11N4mcwprQ3epI7wQ4gVg92ZnCbET 5CTsKlySAt4isx4NAaSPUpZIqhFH7HlFit8j1TIvoyP49EhBvUqFxP3Ybz3VJGGlRI J68KyKH0JAnxwe07Il+rw8a/ukzPPd0Ogp+l9uEk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 598F5F8032B; Mon, 8 Mar 2021 14:50:17 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 45112F8032D; Mon, 8 Mar 2021 14:50:15 +0100 (CET) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BE21EF800D0 for ; Mon, 8 Mar 2021 14:50:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BE21EF800D0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RYab5a71" Received: by mail-wm1-x32b.google.com with SMTP id e23so6091135wmh.3 for ; Mon, 08 Mar 2021 05:50:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j1DVrtDjiNfpMvwpqyQlbpz2bqVmuofXtsZIJDWEwa0=; b=RYab5a71Aq6bwqxnTmrg3I0vGwZITNivUMqDaIJfU+p5cvdl2uRpCEsFve9izIWYrs zk5Ulp1MvG7z7dAYMl+DFNuFQPRkDOs3GNdBEJrd/03TgTJplpzMbnpyaK9GzHlnLCZZ TPxVY6FqxytbRIR+pkyGlWBSq+CcegiIhC3pgDNCangKY7etNU/XaOG5wo0PAxI0S5jI 7UuZyAqmG4ZcYs70TFysV3H1FQZ2qSBKZhbcmCoAa38VVa3wFFrnnA09aQYBhb7wYzI6 +aahQUP1l+fCYNJGDW/9apnKC1VBqAcCV+CvLjqXt1Kn0XeFUHN9C3P9mDwOeJH3mXa6 F6JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j1DVrtDjiNfpMvwpqyQlbpz2bqVmuofXtsZIJDWEwa0=; b=DBr6vkf3+bHJARFxK3MFuNkUHYnQbw9ouTTLTHHHT8ed29Yex04dI3jD534if/eE80 dJ6LZ1ESvqpqRpjyUYYQoBZCsqEnBr+2/lKo8ae5v3C0pjytY8zMSy7JB7mF9za40ti/ N8NVaGjc1RJelh79WjYdYs9O9zdp+z1uu09mdzLgsjFDrKjA+mBU+aKVRCpYjSn6w2eW wcukrgQhXpTj6Xm8PNLAEOXPn1M2J/1TYeQSuImJJN06i6BFbX8coArmdxlAlXfYdtGB 1tsMNauoVAG2cF7i6+Qn7p2gRgUNcq9pmtAPwghyMohd/sd4VbUruQrYtLL2a66DIpe9 QLHA== X-Gm-Message-State: AOAM530ZKmwwE4QSdw6AdRZR7cP+q9POI7z9edKtAvfvJT/o98e4SnrJ scdcGkmam+fVn3G47rmkQ3cauA== X-Google-Smtp-Source: ABdhPJzDps4JWmt/hmgvgb3hPxdabViCKNxq4v0LwAzhrghff9HNEF8VhTSlc9waAbydCawSD4J9fg== X-Received: by 2002:a05:600c:190a:: with SMTP id j10mr22153142wmq.140.1615211407055; Mon, 08 Mar 2021 05:50:07 -0800 (PST) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id h22sm19490589wmb.36.2021.03.08.05.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 05:50:06 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH v3 1/9] dt-bindings: soundwire: qcom: clarify data port bus parameters Date: Mon, 8 Mar 2021 13:49:49 +0000 Message-Id: <20210308134957.16024-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> References: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla , sanyog.r.kale@intel.com, yung-chuan.liao@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Some of the parameters for data ports are not applicable or not implemented in IP. So mark them as invalid/not applicable in DT so that controller is aware of this. Add comment to these bindings to provide more clarity on the values! Signed-off-by: Srinivas Kandagatla --- .../bindings/soundwire/qcom,sdw.txt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt index b104be131235..b93a2b3e029d 100644 --- a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt +++ b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt @@ -54,6 +54,8 @@ board specific bus parameters. Value type: Definition: should specify payload transport window offset1 of each data port. Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-offset2: @@ -61,6 +63,8 @@ board specific bus parameters. Value type: Definition: should specify payload transport window offset2 of each data port. Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-sinterval-low: @@ -69,12 +73,16 @@ board specific bus parameters. Definition: should be sample interval low of each data port. Out ports followed by In ports. Used for Sample Interval calculation. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-word-length: Usage: optional Value type: Definition: should be size of payload channel sample. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-block-pack-mode: @@ -84,6 +92,8 @@ board specific bus parameters. 0 to indicate Blocks are per Channel 1 to indicate Blocks are per Port. Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-block-group-count: @@ -92,6 +102,8 @@ board specific bus parameters. Definition: should be in range 1 to 4 to indicate how many sample intervals are combined into a payload. Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-lane-control: @@ -100,6 +112,8 @@ board specific bus parameters. Definition: should be in range 0 to 7 to identify which data lane the data port uses. Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-hstart: @@ -109,6 +123,8 @@ board specific bus parameters. SoundWire Frame, i.e. left edge of the Transport sub-frame for each port. Values between 0 and 15 are valid. Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,ports-hstop: @@ -118,6 +134,8 @@ board specific bus parameters. SoundWire Frame, i.e. the right edge of the Transport sub-frame for each port. Values between 0 and 15 are valid. Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. - qcom,dports-type: @@ -128,6 +146,8 @@ board specific bus parameters. 1 for simple ports 2 for full port Out ports followed by In ports. + Value of 0xFF indicates that this option is not implemented + or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. Note: From patchwork Mon Mar 8 13:49:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 395525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9799AC433E0 for ; Mon, 8 Mar 2021 13:52:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 16768651D3 for ; Mon, 8 Mar 2021 13:52:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16768651D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A070A1897; Mon, 8 Mar 2021 14:51:49 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A070A1897 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615211559; bh=dgMNG27AgYfQyvjVcIqIlwROBPij1X62wPuwLzhZ+qA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IDHBUMjxglAhm9YZsFO1T7TPI2qHC2g/2NjqEa603Gw8lv98seP02O+OOwB6n52ad ODN/zzxgMxGBO/ahT3zJOTgFN/JbDlV+49FXSOV/k5XU0ZStXle/w4ZVFTBYRYnLtE Rl1om2LB+iEG/hbZRq4/tQ9W4xYGekQNzsbzROW4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 50D58F80425; Mon, 8 Mar 2021 14:50:22 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DD583F80425; Mon, 8 Mar 2021 14:50:18 +0100 (CET) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 66616F8016C for ; Mon, 8 Mar 2021 14:50:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 66616F8016C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R6N/KE4s" Received: by mail-wr1-x42c.google.com with SMTP id 7so11562420wrz.0 for ; Mon, 08 Mar 2021 05:50:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z5gULezL58sP0wsRShFvX5Wql1j67V0uYQzISlfsBbw=; b=R6N/KE4sh9d+LpUIxGfmSJSCiVnd+ls3H11acC3Uqdv1Yt/y1r9P/fKqdUiCYDeIFv KpaXSnrThQbxtiBuObpV8cljnguNK04m1hGgTNnhiONZ7pBuaGvSUkLdZwnTWCebSn9F cnmaFsvOxzj9Er2Gt35/kQ23rceD4yxwe1wPOw3XCMWJ6RC7VIOYM8Y0vkrF55U9sowo 07bTFBpB0bDjabPPFyi78YVn0xAvdx2YuKo2aR6ne7SOl/niSWqumM/wTmdOtcbGQVbh gXmo7Ur5u8TXrk2x9DfQvRfUSZvPQfIszB3iW2NtAI1BaNZGJzivw5b7Ve4vTuBQZj4b 1dWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z5gULezL58sP0wsRShFvX5Wql1j67V0uYQzISlfsBbw=; b=baTaSa1AgWgA3eZPCGVz5cBV0jfc9xC1Xw6kUtSZWdU9V7wuzrzpohQmDiJAZLVJZK EHu+7iBj5FZpa8b0/JgrrfzCC6M6UkX9C7j8fi9ecuElGyspCFI3b/Tf3A2+4YABbCbi tpDE3VAJZsytUIMTYH0nZ+EMHXscR4vpLQIVlrqLjd4CQzBxMbcTna5P/2VZyUB+iX1G 4Sze0vA+X4TMsuy4bGSpbPTqrqsm7MoLM0VCrFnVaU0WB12pXAt0qehFyFoiFiDuSowj VS20I0OLXbiUA66w3QgUgDxX/3D050NDGJBrdV7+LRCvezVtqMraXa/VKwfVKe9qdS6u TuvA== X-Gm-Message-State: AOAM532YSUh3oibql+6G2vO9HrTM4b4GkAB0JsOot53QR0JevmkgS13W YBdt80sf1/81iw7Ot+5CaMX+kg== X-Google-Smtp-Source: ABdhPJxCYCFRCOeIXxgmkBLAGHMI9EYpuvPj8tRs65vq3csayzLrTcykzQ1nC022pXly02zoG+Iadw== X-Received: by 2002:adf:9261:: with SMTP id 88mr22485091wrj.270.1615211409057; Mon, 08 Mar 2021 05:50:09 -0800 (PST) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id h22sm19490589wmb.36.2021.03.08.05.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 05:50:08 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH v3 3/9] soundwire: qcom: set continue execution flag for ignored commands Date: Mon, 8 Mar 2021 13:49:51 +0000 Message-Id: <20210308134957.16024-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> References: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla , sanyog.r.kale@intel.com, yung-chuan.liao@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" version 1.5.1 and higher IPs of this controller required to set continue execution on ignored command flag. This patch sets this flag. Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 6c7b811eea94..076a2b1b6d6d 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -40,6 +40,7 @@ #define SWRM_CMD_FIFO_CMD 0x308 #define SWRM_CMD_FIFO_STATUS 0x30C #define SWRM_CMD_FIFO_CFG_ADDR 0x314 +#define SWRM_CONTINUE_EXEC_ON_CMD_IGNORE BIT(31) #define SWRM_RD_WR_CMD_RETRIES 0x7 #define SWRM_CMD_FIFO_RD_FIFO_ADDR 0x318 #define SWRM_ENUMERATOR_CFG_ADDR 0x500 @@ -343,7 +344,15 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) ctrl->reg_write(ctrl, SWRM_MCP_CFG_ADDR, val); /* Configure number of retries of a read/write cmd */ - ctrl->reg_write(ctrl, SWRM_CMD_FIFO_CFG_ADDR, SWRM_RD_WR_CMD_RETRIES); + if (ctrl->version > 0x01050001) { + /* Only for versions >= 1.5.1 */ + ctrl->reg_write(ctrl, SWRM_CMD_FIFO_CFG_ADDR, + SWRM_RD_WR_CMD_RETRIES | + SWRM_CONTINUE_EXEC_ON_CMD_IGNORE); + } else { + ctrl->reg_write(ctrl, SWRM_CMD_FIFO_CFG_ADDR, + SWRM_RD_WR_CMD_RETRIES); + } /* Set IRQ to PULSE */ ctrl->reg_write(ctrl, SWRM_COMP_CFG_ADDR, From patchwork Mon Mar 8 13:49:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 395524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0579C433E0 for ; Mon, 8 Mar 2021 13:53:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BA924651CD for ; Mon, 8 Mar 2021 13:53:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA924651CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 36C5A18D5; Mon, 8 Mar 2021 14:52:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 36C5A18D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615211609; bh=kZCUJ/1FcwfhNgfqoA1jG3zHPjjj+UXOBhk0Hj/IYs0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QhNHszIpJvgGXk1qM3FszAgzluYTjDfolP1E9MWFYTc3PZGWJxks7IrTq70L+eMCv sdYwbeMzbzPQ0sc0kS6DDcaUS8WLSibWX6rxwjNke/9WuvstrH6UN7aeDz0Bmr9CBn F9stZ6kmfufOeVejZgqG4603WpXoYXIzZuawFWXM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7E38DF804AD; Mon, 8 Mar 2021 14:50:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F3BC1F802E7; Mon, 8 Mar 2021 14:50:22 +0100 (CET) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 35023F800ED for ; Mon, 8 Mar 2021 14:50:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 35023F800ED Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kE+OM2aB" Received: by mail-wm1-x32e.google.com with SMTP id r15-20020a05600c35cfb029010e639ca09eso3844761wmq.1 for ; Mon, 08 Mar 2021 05:50:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9XrbiDhvP0gxPijEAUSSoalvOl5K//POj60zxztmUAs=; b=kE+OM2aBjpltfWtltwjlP+6iR+/LPf5s0WhqnXFlZ35c1q7cwW0SWIAtN3aknukLu+ EB4XCMYwcQWbNAN6VlWw1iMG3GNAw+RFh7xzYJlg2tlwuNNh6nMmp5xMDhCZ8qndZCt+ fN911dWcm/3aiLpFAM/9zXIp4ltH4u+NKxc1KC0LgydXEbzJq+dnn/UrGzdH+uEl6NfV Ox+PqDSnXL0omJDXNjRhxJFBAVwPF3J+s8gnclto/AXKyBAIB+OGBT4AhzbyiYZFD0kq nBcvPkobdN74K2CDdMTcfuCBte/dJ1zrVi7p0VX7IyWJK8izHN4o3stR1GdUslnnI5Tr UN+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9XrbiDhvP0gxPijEAUSSoalvOl5K//POj60zxztmUAs=; b=Zqe3FaMXxLQN5YgBWjDS25rSaY+MjZue8U3MK6DdfLau8Wlim8yQ4XOFQDqRmuzfMN snfAWkTtFpfXsglsCuObokxCsXWgwdWuYFYbdSX5XAefRdD3G+YrbfNJ68fvhYq4ChvF RPEvBaDEzQ8AJycmfoRyOVxXuu27294ePCwoPl4yuKDWxNcjd0OzgH6uwEBGvExurrsn 8XSQSWekn1JGqqOGpwPBO0sC89B/9TkJom58XwqZ2hHcTzlOax/c5oFJ3GWNO8K0EzDQ JjyPKJHgwXfbWDkc+Em+hkg9KKCSUvyBx3hKlitXDbTC+pyerpb+ONBA9AFu1Ia3QWf+ gMbQ== X-Gm-Message-State: AOAM5329tmvkYklmEUHrBjdDHhWYoOXa8J3by0wRNWLq+mfqvl70zL1C J1SlZh+hy8Vl96rRZOLMV4N2yQ== X-Google-Smtp-Source: ABdhPJxR3Rp7cA8Clm97GPcGoTTceotc9jg1rSAdJAiMJxxE/KWYenduMGDrgX2kqrvx7yTS8EiyPA== X-Received: by 2002:a05:600c:284:: with SMTP id 4mr22672574wmk.24.1615211410097; Mon, 08 Mar 2021 05:50:10 -0800 (PST) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id h22sm19490589wmb.36.2021.03.08.05.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 05:50:09 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH v3 4/9] soundwire: qcom: start the clock during initialization Date: Mon, 8 Mar 2021 13:49:52 +0000 Message-Id: <20210308134957.16024-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> References: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla , sanyog.r.kale@intel.com, yung-chuan.liao@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Start the clock during initialization, doing this explicitly will add more clarity when we are adding clock stop feature. Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 076a2b1b6d6d..071d05d3a971 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -47,6 +47,8 @@ #define SWRM_MCP_FRAME_CTRL_BANK_ADDR(m) (0x101C + 0x40 * (m)) #define SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK GENMASK(2, 0) #define SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK GENMASK(7, 3) +#define SWRM_MCP_BUS_CTRL 0x1044 +#define SWRM_MCP_BUS_CLK_START BIT(1) #define SWRM_MCP_CFG_ADDR 0x1048 #define SWRM_MCP_CFG_MAX_NUM_OF_CMD_NO_PINGS_BMSK GENMASK(21, 17) #define SWRM_DEF_CMD_NO_PINGS 0x1f @@ -343,6 +345,7 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) u32p_replace_bits(&val, SWRM_DEF_CMD_NO_PINGS, SWRM_MCP_CFG_MAX_NUM_OF_CMD_NO_PINGS_BMSK); ctrl->reg_write(ctrl, SWRM_MCP_CFG_ADDR, val); + ctrl->reg_write(ctrl, SWRM_MCP_BUS_CTRL, SWRM_MCP_BUS_CLK_START); /* Configure number of retries of a read/write cmd */ if (ctrl->version > 0x01050001) { /* Only for versions >= 1.5.1 */ From patchwork Mon Mar 8 13:49:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 395522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0AB4C433DB for ; Mon, 8 Mar 2021 13:54:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2B28265100 for ; Mon, 8 Mar 2021 13:54:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B28265100 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7F02D18CD; Mon, 8 Mar 2021 14:54:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7F02D18CD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615211697; bh=/F3YN6PaFRpB7kV+9oiEPJe/tMM8VZwcbT5STpHjO80=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=C0QYm6wDwmC6MGad6lY9DVIB+q7yC0GEL69GxBzyfwDLLBbckZ3hoWgoJIAxKPvUv X8U73gGTLR6iF5mcMZ8JgvG80ARL8owQSffmWOa29rtA81rBU8Y5YBrqJN1sUKxawT 1ankWzuo4/DfRxgBcxwdfkvs736tsIH9Xj8UZQJ4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 49786F804DF; Mon, 8 Mar 2021 14:50:34 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C835BF80424; Mon, 8 Mar 2021 14:50:26 +0100 (CET) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 11BB5F802CA for ; Mon, 8 Mar 2021 14:50:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 11BB5F802CA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Oo3P+Hp6" Received: by mail-wm1-x32c.google.com with SMTP id n22so6091683wmc.2 for ; Mon, 08 Mar 2021 05:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hw0l9gPz+tN23oDHxuibjWq7IppcbR1TA4q1XJqNFak=; b=Oo3P+Hp6h6pgNeyzANZsSKTpnDUom9KW7Jn3DVYffVP5lQVHIJEGMtggu2dXugQG2V 2RQCvATZvyHxiY/NmiUTxAyNuIcRY2Kut583q2EAWZScOOqQg8utyJqe7uke8XINjb5a Av8okeFVG1yse61MNBBY6UJ9x85UIoQFavyBGMpa7OiHMDikJAXiprsRGnKU9AhkioPA 9pf1WPmkYcKW8X2cPsdDCbfxoY4Lx+LkpmOhCfM4uFjG97JK2RzunWKcj486WFHfO+jc rhUpnjfFcNgE2rb9LSPIOOPOsUYEG5O+8inci/BnkQVu2var7meQeiW/MlIdjsIgYzZ9 T7Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hw0l9gPz+tN23oDHxuibjWq7IppcbR1TA4q1XJqNFak=; b=ayUF9o3EVuKjI2Yjznmeb7HMQCjf6BEcxljymI81CHW0PjTo/7PWdQXuC8fk5FyjV3 rQHRKGp3zNi0dAnfVDe/xdhXlcReKTomAvB0RJpsjeOuVFyYEo6NZac9T0Y0vub6XFw9 j7CXnrPfqfOlhnDPEvQhOYII+voNd1Q5t5np9YcLq9GtQOzo1hJBBZF3CI4YHEwXCiWb UPCQyZUcrMp+WJQB/4NZV2XhGWSVER81yU4JXZiffU+B2z6l7s8DHdkCJIcLMTDlc7xN c146cSmV3b+oEaeNW6v8rVePcpbTluiRNzX6MWXtPFAQG5xOT9iihx32E13toP1nKQFj sChg== X-Gm-Message-State: AOAM533znQdW2koENxuIbEoiXlA21Mv/GftYb5OsgtxeAA2WGEH6IznW XuN8JvYdtXG8Dhe+aRk5UUCAs2ZvY/KLiQ== X-Google-Smtp-Source: ABdhPJz1Icy2SwvgNCoyUlsPFCCiOigJxp3ypLwsZtEexflpytUQxr3G4kvuZ8HR/QZwwW6C/20oqg== X-Received: by 2002:a05:600c:287:: with SMTP id 7mr23191564wmk.23.1615211412064; Mon, 08 Mar 2021 05:50:12 -0800 (PST) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id h22sm19490589wmb.36.2021.03.08.05.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 05:50:11 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH v3 6/9] soundwire: qcom: add support to new interrupts Date: Mon, 8 Mar 2021 13:49:54 +0000 Message-Id: <20210308134957.16024-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> References: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla , sanyog.r.kale@intel.com, yung-chuan.liao@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add support to new interrupts which includes reporting some of the error interrupts and adding support to SLAVE pending interrupt! This patch also changes the interrupt handler behaviour on handling any pending interrupts by checking it before returning out of irq handler. Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 161 ++++++++++++++++++++++++++++++++------- 1 file changed, 135 insertions(+), 26 deletions(-) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 7762ff237636..2a53da521626 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -28,10 +28,21 @@ #define SWRM_COMP_PARAMS_DIN_PORTS_MASK GENMASK(9, 5) #define SWRM_INTERRUPT_STATUS 0x200 #define SWRM_INTERRUPT_STATUS_RMSK GENMASK(16, 0) +#define SWRM_INTERRUPT_STATUS_SLAVE_PEND_IRQ BIT(0) #define SWRM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED BIT(1) #define SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS BIT(2) +#define SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET BIT(3) +#define SWRM_INTERRUPT_STATUS_RD_FIFO_OVERFLOW BIT(4) +#define SWRM_INTERRUPT_STATUS_RD_FIFO_UNDERFLOW BIT(5) +#define SWRM_INTERRUPT_STATUS_WR_CMD_FIFO_OVERFLOW BIT(6) #define SWRM_INTERRUPT_STATUS_CMD_ERROR BIT(7) +#define SWRM_INTERRUPT_STATUS_DOUT_PORT_COLLISION BIT(8) +#define SWRM_INTERRUPT_STATUS_READ_EN_RD_VALID_MISMATCH BIT(9) #define SWRM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED BIT(10) +#define SWRM_INTERRUPT_STATUS_BUS_RESET_FINISHED_V2 BIT(13) +#define SWRM_INTERRUPT_STATUS_CLK_STOP_FINISHED_V2 BIT(14) +#define SWRM_INTERRUPT_STATUS_EXT_CLK_STOP_WAKEUP BIT(16) +#define SWRM_INTERRUPT_MAX 17 #define SWRM_INTERRUPT_MASK_ADDR 0x204 #define SWRM_INTERRUPT_CLEAR 0x208 #define SWRM_INTERRUPT_CPU_EN 0x210 @@ -58,6 +69,7 @@ #define SWRM_MCP_STATUS_BANK_NUM_MASK BIT(0) #define SWRM_MCP_SLV_STATUS 0x1090 #define SWRM_MCP_SLV_STATUS_MASK GENMASK(1, 0) +#define SWRM_MCP_SLV_STATUS_SZ 2 #define SWRM_DP_PORT_CTRL_BANK(n, m) (0x1124 + 0x100 * (n - 1) + 0x40 * m) #define SWRM_DP_PORT_CTRL_2_BANK(n, m) (0x1128 + 0x100 * (n - 1) + 0x40 * m) #define SWRM_DP_BLOCK_CTRL_1(n) (0x112C + 0x100 * (n - 1)) @@ -123,6 +135,7 @@ struct qcom_swrm_ctrl { int rows_index; unsigned long dout_port_mask; unsigned long din_port_mask; + u32 intr_mask; u8 rcmd_id; u8 wcmd_id; struct qcom_swrm_port_config pconfig[QCOM_SDW_MAX_PORTS]; @@ -304,6 +317,25 @@ static int qcom_swrm_cmd_fifo_rd_cmd(struct qcom_swrm_ctrl *swrm, return SDW_CMD_IGNORED; } +static int qcom_swrm_get_alert_slave_dev_num(struct qcom_swrm_ctrl *ctrl) +{ + u32 val, status; + int dev_num; + + ctrl->reg_read(ctrl, SWRM_MCP_SLV_STATUS, &val); + + for (dev_num = 0; dev_num < SDW_MAX_DEVICES; dev_num++) { + status = (val >> (dev_num * SWRM_MCP_SLV_STATUS_SZ)); + + if ((status & SWRM_MCP_SLV_STATUS_MASK) == SDW_SLAVE_ALERT) { + ctrl->status[dev_num] = status; + return dev_num; + } + } + + return -EINVAL; +} + static void qcom_swrm_get_device_status(struct qcom_swrm_ctrl *ctrl) { u32 val; @@ -322,36 +354,112 @@ static void qcom_swrm_get_device_status(struct qcom_swrm_ctrl *ctrl) static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id) { - struct qcom_swrm_ctrl *ctrl = dev_id; - u32 sts, value; + struct qcom_swrm_ctrl *swrm = dev_id; + u32 value, intr_sts, intr_sts_masked; + u32 i; + u8 devnum = 0; + int ret = IRQ_HANDLED; - ctrl->reg_read(ctrl, SWRM_INTERRUPT_STATUS, &sts); + swrm->reg_read(swrm, SWRM_INTERRUPT_STATUS, &intr_sts); + intr_sts_masked = intr_sts & swrm->intr_mask; - if (sts & SWRM_INTERRUPT_STATUS_CMD_ERROR) { - ctrl->reg_read(ctrl, SWRM_CMD_FIFO_STATUS, &value); - dev_err_ratelimited(ctrl->dev, - "CMD error, fifo status 0x%x\n", - value); - ctrl->reg_write(ctrl, SWRM_CMD_FIFO_CMD, 0x1); - } - - if ((sts & SWRM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED) || - sts & SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS) { - qcom_swrm_get_device_status(ctrl); - sdw_handle_slave_status(&ctrl->bus, ctrl->status); - } - - /** - * clear the interrupt before complete() is called, as complete can - * schedule new read/writes which require interrupts, clearing the - * interrupt would avoid missing interrupts in such cases. - */ - ctrl->reg_write(ctrl, SWRM_INTERRUPT_CLEAR, sts); + do { + for (i = 0; i < SWRM_INTERRUPT_MAX; i++) { + value = intr_sts_masked & (1 << i); + if (!value) + continue; + + switch (value) { + case SWRM_INTERRUPT_STATUS_SLAVE_PEND_IRQ: + devnum = qcom_swrm_get_alert_slave_dev_num(swrm); + if (devnum < 0) { + dev_err_ratelimited(swrm->dev, + "no slave alert found.spurious interrupt\n"); + } else { + sdw_handle_slave_status(&swrm->bus, swrm->status); + } - if (sts & SWRM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED) - complete(&ctrl->broadcast); + break; + case SWRM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED: + case SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS: + dev_err_ratelimited(swrm->dev, "%s: SWR new slave attached\n", + __func__); + qcom_swrm_get_device_status(swrm); + sdw_handle_slave_status(&swrm->bus, swrm->status); + break; + case SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET: + dev_err_ratelimited(swrm->dev, + "%s: SWR bus clsh detected\n", + __func__); + swrm->intr_mask &= ~SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET; + swrm->reg_write(swrm, SWRM_INTERRUPT_CPU_EN, swrm->intr_mask); + break; + case SWRM_INTERRUPT_STATUS_RD_FIFO_OVERFLOW: + swrm->reg_read(swrm, SWRM_CMD_FIFO_STATUS, &value); + dev_err_ratelimited(swrm->dev, + "%s: SWR read FIFO overflow fifo status 0x%x\n", + __func__, value); + break; + case SWRM_INTERRUPT_STATUS_RD_FIFO_UNDERFLOW: + swrm->reg_read(swrm, SWRM_CMD_FIFO_STATUS, &value); + dev_err_ratelimited(swrm->dev, + "%s: SWR read FIFO underflow fifo status 0x%x\n", + __func__, value); + break; + case SWRM_INTERRUPT_STATUS_WR_CMD_FIFO_OVERFLOW: + swrm->reg_read(swrm, SWRM_CMD_FIFO_STATUS, &value); + dev_err(swrm->dev, + "%s: SWR write FIFO overflow fifo status %x\n", + __func__, value); + swrm->reg_write(swrm, SWRM_CMD_FIFO_CMD, 0x1); + break; + case SWRM_INTERRUPT_STATUS_CMD_ERROR: + swrm->reg_read(swrm, SWRM_CMD_FIFO_STATUS, &value); + dev_err_ratelimited(swrm->dev, + "%s: SWR CMD error, fifo status 0x%x, flushing fifo\n", + __func__, value); + swrm->reg_write(swrm, SWRM_CMD_FIFO_CMD, 0x1); + break; + case SWRM_INTERRUPT_STATUS_DOUT_PORT_COLLISION: + dev_err_ratelimited(swrm->dev, + "%s: SWR Port collision detected\n", + __func__); + swrm->intr_mask &= ~SWRM_INTERRUPT_STATUS_DOUT_PORT_COLLISION; + swrm->reg_write(swrm, + SWRM_INTERRUPT_CPU_EN, swrm->intr_mask); + break; + case SWRM_INTERRUPT_STATUS_READ_EN_RD_VALID_MISMATCH: + dev_err_ratelimited(swrm->dev, + "%s: SWR read enable valid mismatch\n", + __func__); + swrm->intr_mask &= + ~SWRM_INTERRUPT_STATUS_READ_EN_RD_VALID_MISMATCH; + swrm->reg_write(swrm, + SWRM_INTERRUPT_CPU_EN, swrm->intr_mask); + break; + case SWRM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED: + complete(&swrm->broadcast); + break; + case SWRM_INTERRUPT_STATUS_BUS_RESET_FINISHED_V2: + break; + case SWRM_INTERRUPT_STATUS_CLK_STOP_FINISHED_V2: + break; + case SWRM_INTERRUPT_STATUS_EXT_CLK_STOP_WAKEUP: + break; + default: + dev_err_ratelimited(swrm->dev, + "%s: SWR unknown interrupt value: %d\n", + __func__, value); + ret = IRQ_NONE; + break; + } + } + swrm->reg_write(swrm, SWRM_INTERRUPT_CLEAR, intr_sts); + swrm->reg_read(swrm, SWRM_INTERRUPT_STATUS, &intr_sts); + intr_sts_masked = intr_sts & swrm->intr_mask; + } while (intr_sts_masked); - return IRQ_HANDLED; + return ret; } static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) @@ -367,6 +475,7 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl) /* Disable Auto enumeration */ ctrl->reg_write(ctrl, SWRM_ENUMERATOR_CFG_ADDR, 0); + ctrl->intr_mask = SWRM_INTERRUPT_STATUS_RMSK; /* Mask soundwire interrupts */ ctrl->reg_write(ctrl, SWRM_INTERRUPT_MASK_ADDR, SWRM_INTERRUPT_STATUS_RMSK); From patchwork Mon Mar 8 13:49:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 395523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A034C433DB for ; Mon, 8 Mar 2021 13:54:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A32B065100 for ; Mon, 8 Mar 2021 13:54:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A32B065100 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C7910189D; Mon, 8 Mar 2021 14:53:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C7910189D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1615211652; bh=tde7FK0e/Q7zB/pCiB65Dd6ODA2qsIVS6rczw/wdSAM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DEA0QAwWjhXV038jvF+EzlOTI43pmdvqY1Cu8JblAaxXfF47CdarrprDrTAXQZ0Eo 77NJ+r5Bi7Ceij7COhjqaH72yiyg24afEpmoTiXZJqBQDkMXe6tIy7QKW8nFQ51gxM bgaFKtOy7SVEYuygbY3zjQA53GPVyys4J9NJoCw4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F03BBF804C1; Mon, 8 Mar 2021 14:50:31 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9285CF804AE; Mon, 8 Mar 2021 14:50:27 +0100 (CET) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5CE89F80424 for ; Mon, 8 Mar 2021 14:50:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5CE89F80424 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Rd1zk2w9" Received: by mail-wr1-x434.google.com with SMTP id v15so11532019wrx.4 for ; Mon, 08 Mar 2021 05:50:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bXsQNCXUapXF20IWHIenhBSQ480XBxLPcOx8iPsHvUs=; b=Rd1zk2w9YzhMPxyi8nCdwEy1T1l1/k/MW2duY8f0HkMU7dz3vG0wu0amZs4x3SEoRp pwVBGeiWabU00t9Dvj0Z0KW6O2tBKwPGPLfuadP0p7Mg/taqWOj9P3Xu2s+j93lwnvcw KrkDTOL5Cv3litLwdv+MM4uJ8YR9dknPGefO7GJyq5lvC4VLtexdT2qS8fkt7w0+9IEj kWNWAkgNOglXIAlLc34LjRsfThYx4bX27bM8xVLghL3k3UCvs0lAnOdQvy7pc3Ow6Kgc eWDnJr5MTcmLVAp1pD/0y4EZoyU2mBDCRd1rm1gQS2L9ptOTt0iw4Jk4E0X60KhoreFQ OmkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bXsQNCXUapXF20IWHIenhBSQ480XBxLPcOx8iPsHvUs=; b=KGemtlYZW77J3GamQjWGWGWBHVlie8SFZAQ9IMehB+P2LYEU5CbsQK8wrpd9KM3vXX d31aff5Cm+/ST2v//uEMve247QxTHuDEnoo7aMW2+QG0tq1d+J7rCk5sAV9OFMSj9+fP P+ETXWzVZY7chJ1gCBm6pjO+O+x4SytfZDb4QLtmKoIjsxCdT582nOymWW0pdX+Exnv/ zYOKv0fIFNsxnyhBW7hTG/DrzMZ9ohRWrtobiUymwYiFtwRfS5frC+n72MJZoKl7Wkn3 tgoBa3Vw9zTHWzHSxUcdssO56jh+ocIIO2SLpeMCWxkXvJtP7Tv3ozTd/JLd2Qh29sJR t6iw== X-Gm-Message-State: AOAM531T9XglhJTYCYdeEjruU0vKiKuAELuK18vSIjHQOCyTOjeUNnV5 /3Hw1TPwiYOMcN7tRC7v0tei7A== X-Google-Smtp-Source: ABdhPJyGmakQk7A4faicPCFfSQQku7sOUvCrhMttiO6Hw9GvFWY6gs6QEikQEs2SdWNTke9zcRKQhw== X-Received: by 2002:a5d:4d09:: with SMTP id z9mr22312853wrt.426.1615211415041; Mon, 08 Mar 2021 05:50:15 -0800 (PST) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id h22sm19490589wmb.36.2021.03.08.05.50.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 05:50:14 -0800 (PST) From: Srinivas Kandagatla To: vkoul@kernel.org Subject: [PATCH v3 9/9] soundwire: qcom: wait for enumeration to be complete in probe Date: Mon, 8 Mar 2021 13:49:57 +0000 Message-Id: <20210308134957.16024-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> References: <20210308134957.16024-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla , sanyog.r.kale@intel.com, yung-chuan.liao@linux.intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/qcom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 3109ec6c33ac..578a392bfbee 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -123,6 +123,7 @@ struct qcom_swrm_ctrl { struct regmap *regmap; void __iomem *mmio; struct completion broadcast; + struct completion enumeration; struct work_struct slave_work; /* Port alloc/free lock */ struct mutex port_lock; @@ -415,6 +416,7 @@ static int qcom_swrm_enumerate(struct sdw_bus *bus) sdw_slave_add(bus, &id, NULL); } + complete(&ctrl->enumeration); return 0; } @@ -1134,6 +1136,7 @@ static int qcom_swrm_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, ctrl); mutex_init(&ctrl->port_lock); init_completion(&ctrl->broadcast); + init_completion(&ctrl->enumeration); ctrl->bus.ops = &qcom_swrm_ops; ctrl->bus.port_ops = &qcom_swrm_port_ops; @@ -1180,6 +1183,8 @@ static int qcom_swrm_probe(struct platform_device *pdev) } qcom_swrm_init(ctrl); + wait_for_completion_timeout(&ctrl->enumeration, + msecs_to_jiffies(TIMEOUT_MS)); ret = qcom_swrm_register_dais(ctrl); if (ret) goto err_master_add;