Re: [RFC PATCH] soundwire: bus: Add flag to mark DPN_BlockCtrl1 as readonly

From: Vinod Koul
Date: Wed Mar 11 2020 - 02:42:59 EST


On 09-03-20, 17:37, Srinivas Kandagatla wrote:
> 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 ro_blockctrl1_reg
> flag in struct sdw_port_runtime.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
> ---
>
> I will send patch for WSA881x to include this change once this patch
> is accepted.
>
> drivers/soundwire/bus.h | 2 ++
> drivers/soundwire/stream.c | 17 ++++++++++-------
> 2 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h
> index 204204a26db8..791e8d14093e 100644
> --- a/drivers/soundwire/bus.h
> +++ b/drivers/soundwire/bus.h
> @@ -79,6 +79,7 @@ int sdw_find_col_index(int col);
> * @num: Port number. For audio streams, valid port number ranges from
> * [1,14]
> * @ch_mask: Channel mask
> + * @ro_blockctrl1_reg: Read Only flag for DPN_BlockCtrl1 register
> * @transport_params: Transport parameters
> * @port_params: Port parameters
> * @port_node: List node for Master or Slave port_list
> @@ -89,6 +90,7 @@ int sdw_find_col_index(int col);
> struct sdw_port_runtime {
> int num;
> int ch_mask;
> + bool ro_blockctrl1_reg;

Let us use properties for this so it should be added in struct
sdw_dpn_prop or struct sdw_slave_prop (I dont think that we would have
different properties for each DPn when we are dealing with these simple
codecs)

Also the property should not have mipi tag as this is not in DiSCo spec
(yet), so I would suggest sdw_ro_wordlen for this.

Thanks
--
~Vinod