Hi,
Dependencies ============ 1. ASoC codec: changes are independent, however they should rather come the same cycle as Soundwire changes, to avoid new warning and small delay.
2. Soundwire: changes (context) depend on: https://lore.kernel.org/r/20230209131336.18252-3-srinivas.kandagatla@linaro.... https://lore.kernel.org/all/20230418095447.577001-1-krzysztof.kozlowski@lina...
Problems solved =============== Soundwire devices are supposed to be kept in reset state (powered off) till their probe() or component bind() callbacks. However if they are already powered on, then they might enumerate before the master initializes bus in qcom_swrm_init() leading to occasional errors like:
qcom-soundwire 6d30000.soundwire-controller: Qualcomm Soundwire controller v2.0.0 Registered wcd938x_codec audio-codec: bound sdw:0:0217:010d:00:4 (ops wcd938x_sdw_component_ops) wcd938x_codec audio-codec: bound sdw:0:0217:010d:00:3 (ops wcd938x_sdw_component_ops) qcom-soundwire 6ad0000.soundwire-controller: swrm_wait_for_wr_fifo_avail err write overflow
The problem primarily lies in Qualcomm Soundwire controller probe() sequence: 1. request_threaded_irq() 2. sdw_bus_master_add() - which will cause probe() and component bind() of Soundwire devices, e.g. WCD938x codec drivers. Device drivers might already start accessing their registers. 3. qcom_swrm_init() - which initializes the link/bus and enables interrupts.
Any access to device registers at (2) above, will fail because link/bus is not yet initialized.
Cc: Patrick Lai quic_plai@quicinc.com
Best regards, Krzysztof
Dmitry Torokhov (1): ASoC: wcd938x: switch to using gpiod API
Krzysztof Kozlowski (5): ASoC: codecs: wcd938x: Keep device in reset till bind ASoC: codecs: wcd938x: Check for enumeration before using TX device soundwire: qcom: drop unused struct qcom_swrm_ctrl members soudnwire: master: protect concurrecnt check for bus->md soundwire: qcom: do not probe devices before bus/link init
drivers/soundwire/master.c | 7 ++- drivers/soundwire/qcom.c | 92 +++++++++++++++++++++++++++++--------- sound/soc/codecs/wcd938x.c | 44 +++++++++++------- 3 files changed, 107 insertions(+), 36 deletions(-)