Message ID | 20200311113545.23773-2-srinivas.kandagatla@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Commit | a9107de4b03604ce0d279315c91b31b8065ee4ea |
Headers | show |
Series | soundwire: add read_only_wordlength flag | expand |
On 11-03-20, 11:35, 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 read_only_wordlength > flag in struct sdw_dpn_prop Applied, thanks I will send a tag, so that mark can apply the second patch for asoc Thanks
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; };
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 <srinivas.kandagatla@linaro.org> --- drivers/soundwire/stream.c | 16 +++++++++------- include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-)