diff mbox series

[2/2] ASoC: wsa881x: mark read_only_wordlength flag

Message ID 20200311113545.23773-3-srinivas.kandagatla@linaro.org (mailing list archive)
State New, archived
Headers show
Series soundwire: add read_only_wordlength flag | expand

Commit Message

Srinivas Kandagatla March 11, 2020, 11:35 a.m. UTC
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 <srinivas.kandagatla@linaro.org>
---
 sound/soc/codecs/wsa881x.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Pierre-Louis Bossart March 11, 2020, 6:58 p.m. UTC | #1
On 3/11/20 6:35 AM, Srinivas Kandagatla wrote:
> 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.

it'd be good to clarify the nature of these errors, i.e.

a) is this the Slave device responding with a NAK?
b) is this the Slave device responding with COMMAND_IGNORED, and those 
responses not handled by the controller?
c) something else?

Thanks!

> 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 <srinivas.kandagatla@linaro.org>
> ---
>   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,
>   	}
>   };
>   
>
Srinivas Kandagatla March 12, 2020, 9:54 a.m. UTC | #2
On 11/03/2020 18:58, Pierre-Louis Bossart wrote:
> 
> On 3/11/20 6:35 AM, Srinivas Kandagatla wrote:
>> 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.
> 
> it'd be good to clarify the nature of these errors, i.e.
> 
> a) is this the Slave device responding with a NAK?
> b) is this the Slave device responding with COMMAND_IGNORED, and those 
> responses not handled by the controller?
> c) something else?


With the current version of Qcom SoundWire controller driver, it can 
only know if the write succeeded or not based on completion interrupt. 
There are no details of the actual error code visible to the driver. But 
the new version of the same controller is expected to return better 
error codes.

thanks,
srini

> 
> Thanks!
Vinod Koul March 20, 2020, 2:02 p.m. UTC | #3
Hi Mark,

On 11-03-20, 11:35, Srinivas Kandagatla wrote:
> 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.

I have applied the sdw patch. Since this depends on sdw patch, feel free
to pull the below tag before you apply this

The following changes since commit bb6d3fb354c5ee8d6bde2d576eb7220ea09862b9:

  Linux 5.6-rc1 (2020-02-09 16:08:48 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git topic/ro_wordlength

for you to fetch changes up to a9107de4b03604ce0d279315c91b31b8065ee4ea:

  soundwire: stream: Add read_only_wordlength flag to port properties (2020-03-20 19:24:59 +0530)

----------------------------------------------------------------
Srinivas Kandagatla (1):
      soundwire: stream: Add read_only_wordlength flag to port properties

 drivers/soundwire/stream.c    | 16 +++++++++-------
 include/linux/soundwire/sdw.h |  2 ++
 2 files changed, 11 insertions(+), 7 deletions(-)

> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  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,
>  	}
>  };
>  
> -- 
> 2.21.0
diff mbox series

Patch

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,
 	}
 };