From patchwork Wed Mar 11 11:35:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 193343 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 1E01EC10F27 for ; Wed, 11 Mar 2020 11:37:17 +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 9DA1320848 for ; Wed, 11 Mar 2020 11:37:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="gmuLIJpE"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kXQ0EZxj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DA1320848 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 EFBD583A; Wed, 11 Mar 2020 12:36:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EFBD583A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1583926635; bh=G3WmUAkxNovs+YpqRXwkc9PPSNdZlhhKZ642BMMxaQs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gmuLIJpENXb+9cuHRMaEPNliEUrnleDdHiSaVnEnSDmYZSI5sCYmW/VNkbEqKMeKh o/Gl7YtpqQPhUITtJvFVD+rD7zaNlIB/oEFK2MZ6cAFqR2U0ye5VL6KD/NZ6CrHa7i oxsQZ3e+0P4BM3Kq9Kjh631fiQ7pfDwpWGxVCMC8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 54D5BF80141; Wed, 11 Mar 2020 12:36:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 54C41F801F8; Wed, 11 Mar 2020 12:36:23 +0100 (CET) Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (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 5AF66F80141 for ; Wed, 11 Mar 2020 12:36:19 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5AF66F80141 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kXQ0EZxj" Received: by mail-wr1-x444.google.com with SMTP id 6so2158207wre.4 for ; Wed, 11 Mar 2020 04:36:19 -0700 (PDT) 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=EGydLBv1yG6IqmA1HcLLSymIojwkdOWZ9F3nvVgVBJA=; b=kXQ0EZxjxLgnJQdW6QvzzlgWATLi+m5mPF47WL1MzqQDFw1EiWlnkdIz2pS9VOCc3T FDNd8RL3IcXK0Qeckd0aBJUweELOu6IbjOxdxDg+WZMByjrpme7fUed+9tK9TBW4rn9m BG/YpsOZanwjplJgTJbZzQbVq87G7lQ8mr8v/HOv41h4BSqMV1s1wkBYsaf5zdPDqbaU qioaRRbjEAXWbiUC8bJYgxPXadgqnNe1jLKu98xQxN8HZCfWDJr8lOhaVidMh9D0bcoA evF9I+vktMAWp51nt/4HWlIN3luFQEPc2HcdtfH009FF0O5DlbYODKVJ2NvH1yD2VpKp DM8Q== 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=EGydLBv1yG6IqmA1HcLLSymIojwkdOWZ9F3nvVgVBJA=; b=nkRsUm69qYuc8h7dXOsudLnmZfTwTQdl7fo+ZkwuWMmaPp1wtYXQVIcu1+ZCJR2zRJ zcMgaaJaNLP/op+q0vdA+3/xBHokjkQPMoJLWvvcThEIb3Lp+2JENezTNsukm1pKMMbg N6IkFd0s6DGrult54cXxa3r0kcyO+P08wagxm3QAm5w+4W5+SBp1Mg44076lt6F331ZE xqr/4o/x+WjxifbNc+P3fzAIYCYA4f5dAKf+IK974Ks/fkMl5bFJypO73JmghrejWsEB r0pnLzv34nMyTMgFEv7ASZeubL8w0hQGQi93ghOuIKb48SNhEMt32ZaBWDWWu7uXEOyJ Fzdw== X-Gm-Message-State: ANhLgQ3HC1UgS/tEFZYad5SZc2gHSbfvin/ggDlNpJ3ImVIdx8j7Z56r FzQnkCnauPNW7XeEDrW8f63ifw== X-Google-Smtp-Source: ADFU+vuMbN/M6IXL7D0YfyYOzkTFBH0srYm2N5bFT/tMeKkFzGIGsUvO/H40SDljefCGwEFTZmWzbg== X-Received: by 2002:adf:e506:: with SMTP id j6mr3976144wrm.309.1583926579504; Wed, 11 Mar 2020 04:36:19 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id c8sm61650537wru.7.2020.03.11.04.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 04:36:18 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, vkoul@kernel.org Subject: [PATCH 1/2] soundwire: stream: Add read_only_wordlength flag to port properties Date: Wed, 11 Mar 2020 11:35:44 +0000 Message-Id: <20200311113545.23773-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200311113545.23773-1-srinivas.kandagatla@linaro.org> References: <20200311113545.23773-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Srinivas Kandagatla , pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org 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" According to SoundWire Specification Version 1.2. "A Data Port number X (in the range 0-14) which supports only one value of WordLength may implement the WordLength field in the DPX_BlockCtrl1 Register as Read-Only, returning the fixed value of WordLength in response to reads." As WSA881x interfaces in PDM mode making the only field "WordLength" in DPX_BlockCtrl1" fixed and read-only. Behaviour of writing to this register on WSA881x soundwire slave with Qualcomm Soundwire Controller is throwing up an error. Not sure how other controllers deal with writing to readonly registers, but this patch provides a way to avoid writes to DPN_BlockCtrl1 register by providing a read_only_wordlength flag in struct sdw_dpn_prop Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/stream.c | 16 +++++++++------- include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 178ae92b8cc1..7fb89a94d9c0 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -167,13 +167,15 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, return ret; } - /* Program DPN_BlockCtrl1 register */ - ret = sdw_write(s_rt->slave, addr2, (p_params->bps - 1)); - if (ret < 0) { - dev_err(&s_rt->slave->dev, - "DPN_BlockCtrl1 register write failed for port %d\n", - t_params->port_num); - return ret; + if (!dpn_prop->read_only_wordlength) { + /* Program DPN_BlockCtrl1 register */ + ret = sdw_write(s_rt->slave, addr2, (p_params->bps - 1)); + if (ret < 0) { + dev_err(&s_rt->slave->dev, + "DPN_BlockCtrl1 register write failed for port %d\n", + t_params->port_num); + return ret; + } } /* Program DPN_SampleCtrl1 register */ diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index b451bb622335..2dfe14ed3bb0 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -284,6 +284,7 @@ struct sdw_dpn_audio_mode { * @max_async_buffer: Number of samples that this port can buffer in * asynchronous modes * @block_pack_mode: Type of block port mode supported + * @read_only_wordlength: Read Only wordlength field in DPN_BlockCtrl1 register * @port_encoding: Payload Channel Sample encoding schemes supported * @audio_modes: Audio modes supported */ @@ -307,6 +308,7 @@ struct sdw_dpn_prop { u32 modes; u32 max_async_buffer; bool block_pack_mode; + bool read_only_wordlength; u32 port_encoding; struct sdw_dpn_audio_mode *audio_modes; }; From patchwork Wed Mar 11 11:35:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 193342 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 38F29C10F27 for ; Wed, 11 Mar 2020 11:38: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 B5D6F20848 for ; Wed, 11 Mar 2020 11:38:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="VcrmgSjW"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MjzLEDmF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5D6F20848 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 013DD1607; Wed, 11 Mar 2020 12:38:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 013DD1607 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1583926736; bh=7OhOMQVG+beKcyExVg3KAzMHHf/bi3VdOdz1J+KUbEQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VcrmgSjW7JNOPm2a077N1tbO1L4iM2nfa/C8pQrBp+O4XnhjDj3viYag7UtIBefFQ ZshTWxIYxIah+k+1eNsMX1dsRGfkQ0YSJ2vs4oF0RhHxm50sOFFFzaFKsy0PQmtw2l C3PPo3wl5JOiu+HWSwSgaaWWul3USBSPgqf/HGWI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B6B3DF8028B; Wed, 11 Mar 2020 12:36:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2944DF8021D; Wed, 11 Mar 2020 12:36:25 +0100 (CET) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (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 776BCF801A3 for ; Wed, 11 Mar 2020 12:36:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 776BCF801A3 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MjzLEDmF" Received: by mail-wm1-x344.google.com with SMTP id a141so1720453wme.2 for ; Wed, 11 Mar 2020 04:36:20 -0700 (PDT) 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=4dSjMYJm/Ra5sgQShi2pf7+T6koKZ++HOxR0wa0eN84=; b=MjzLEDmFJ/aZXSENFbjIyt0KVvyajh+YnB/ueDBs1bz0YgVO03hmugfnPZdvU3vt/6 BBGbHwfSuITh/mzCoIh3L9H5Xm7GhvVopaYxlbzYHEaFpzzGBm5bpH1E14+QPAQj+/Zi oz0hJV8Uo0RnjvYx3X/NcoKRTSUE0mxzyaIKrecwFNg9w6OfLfFVZZFSS3L63oEAv3NN M85rjg8MG6w/3q6GdZ3z8lcHkRCHWQCV7MT+N8waXX1F6iOwXpQFA9n/FzKQ98EPl1ZW LenVwfClcI7m9C49N7ZiYFpAR+wdIAWAcAfIClt6Na8GpVqOHnsERF9aA/UbB7Dslj4m DcyQ== 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=4dSjMYJm/Ra5sgQShi2pf7+T6koKZ++HOxR0wa0eN84=; b=FxBlhULMAEZnbiB+VEbt3jBX0bYaBF9Gldwoz2RxzsIYyxKWhf4DxUIUP/3i69izEJ 9ixkaNgFBN9OSrlQTBaGGZraPt7zPlhFNvmoFdopiAbfLElqtthukLgR0cszeFRSABgT cIsMFgM9tGGgkC8XmGDcF4aLcUkhvJXQur//qZISf18WqwCxVRkMc5bxcyBNDIcPPVi1 ImMU1P1PdcORxDqF83FHyzMuo2evny5Ab5s/EkKXGlMONqoN0XrqiYztAcBIeEwAZxYW opYG1JqAyKmpi0FJGCaHdM/z/MmkBhGEZq1XREso9avfug7+P1Zbij3GEPY646+MF2Uf izHg== X-Gm-Message-State: ANhLgQ1fqSCP9Jgu0QM1kklCsSeWnfZduVDUP/O/khbA+e6msZWztbzr IbqApWMVjbParHluzA/rflZ8TGOe8es= X-Google-Smtp-Source: ADFU+vt+eNgeMdW8z+nYMrd8Bxe7xSf0Y8oplVFQFkTzkOPeN1bEt3y5GLgzl+F32+wHlT+zM65jyA== X-Received: by 2002:a1c:1d88:: with SMTP id d130mr3473216wmd.138.1583926580522; Wed, 11 Mar 2020 04:36:20 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id c8sm61650537wru.7.2020.03.11.04.36.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 04:36:19 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, vkoul@kernel.org Subject: [PATCH 2/2] ASoC: wsa881x: mark read_only_wordlength flag Date: Wed, 11 Mar 2020 11:35:45 +0000 Message-Id: <20200311113545.23773-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200311113545.23773-1-srinivas.kandagatla@linaro.org> References: <20200311113545.23773-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Srinivas Kandagatla , pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org 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" WSA881x works in PDM mode so the wordlength is fixed, which also makes the only field "WordLength" in DPN_BlockCtrl1 register a read-only. Writing to this register will throw up errors with Qualcomm Controller. So use ro_blockctrl1_reg flag to mark this field as read-only so that core will not write to this register. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wsa881x.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c index b59f1d0e7f84..35b44b297f9e 100644 --- a/sound/soc/codecs/wsa881x.c +++ b/sound/soc/codecs/wsa881x.c @@ -394,6 +394,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = { .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, + .read_only_wordlength = true, }, { /* COMP */ .num = 2, @@ -401,6 +402,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = { .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, + .read_only_wordlength = true, }, { /* BOOST */ .num = 3, @@ -408,6 +410,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = { .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, + .read_only_wordlength = true, }, { /* VISENSE */ .num = 4, @@ -415,6 +418,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = { .min_ch = 1, .max_ch = 1, .simple_ch_prep_sm = true, + .read_only_wordlength = true, } };