ASoC/soundwire: log actual PING status on resume issues
Subsystems (4)
Bard Liao
maintainercover ASoC/soundwire: log actual PING status on resume issues
we've been stuck with problems in the dual-amplifier configurations where one of the two devices seems to become UNATTACHED and never regains sync, see https://github.com/thesofproject/linux/issues/3638.
This is a rather infrequent issue that may happen once or twice per month, but still it remains a concern.
One possibility is that the device does lose sync but somehow our hardware detection fails to see it resync.
This series just adds a basic read directly from the PING frames to help confirm if yes/no the device regain sync.
The change is mainly on soundwire. @Mark, Could you ack the ASoC patch if it looks good to you?
Pierre-Louis Bossart (4):
soundwire: add read_ping_status helper definition in manager ops
soundwire: intel/cadence: expose PING status in manager ops
soundwire: add sdw_show_ping_status() helper
ASoC: codecs: show PING status on resume failures
drivers/soundwire/bus.c | 32 ++++++++++++++++++++++++++++++ drivers/soundwire/cadence_master.c | 8 ++++++++ drivers/soundwire/cadence_master.h | 2 ++ drivers/soundwire/intel.c | 1 + include/linux/soundwire/sdw.h | 5 +++++ sound/soc/codecs/max98373-sdw.c | 2 ++ sound/soc/codecs/rt1308-sdw.c | 2 ++ sound/soc/codecs/rt1316-sdw.c | 2 ++ sound/soc/codecs/rt5682-sdw.c | 2 ++ sound/soc/codecs/rt700-sdw.c | 2 ++ sound/soc/codecs/rt711-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdw.c | 2 ++ 13 files changed, 64 insertions(+)
Signature · 1 line
2.25.1
Bard Liao
maintainerPATCH 1/4 soundwire: add read_ping_status helper definition in manager ops
From: Pierre-Louis Bossart <[email protected]>
The existing manager ops provide callbacks to transfer read/write commands, but don't allow for direct access to PING status register. This is accessible in all existing IP, and would help diagnose timeouts or resume issues by reporting the 'true' status instead of the internal status reported by the IP.
--- include/linux/soundwire/sdw.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/soundwire/sdw.h +3 -0
@@ -839,6 +839,8 @@ struct sdw_defer {* @set_bus_conf: Set the bus configuration * @pre_bank_switch: Callback for pre bank switch * @post_bank_switch: Callback for post bank switch +* @read_ping_status: Read status from PING frames, reported with two bits per Device. +* Bits 31:24 are reserved. */ struct sdw_master_ops {int (*read_prop)(struct sdw_bus *bus);
@@ -855,6 +857,7 @@ struct sdw_master_ops { struct sdw_bus_params *params);int (*pre_bank_switch)(struct sdw_bus *bus);int (*post_bank_switch)(struct sdw_bus *bus); +u32 (*read_ping_status)(struct sdw_bus *bus); };
Signature · 1 line
2.25.1
Bard Liao
maintainerPATCH 2/4 soundwire: intel/cadence: expose PING status in manager ops
In reply to Bard LiaoFrom: Pierre-Louis Bossart <[email protected]>
Simple indirection to existing register.
--- drivers/soundwire/cadence_master.c | 8 ++++++++ drivers/soundwire/cadence_master.h | 2 ++ drivers/soundwire/intel.c | 1 + 3 files changed, 11 insertions(+)
drivers/soundwire/cadence_master.c +8 -0
@@ -756,6 +756,14 @@ cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num) }EXPORT_SYMBOL (cdns_reset_page_addr); +u32 cdns_read_ping_status (struct sdw_bus *bus) +{ +struct sdw_cdns *cdns =bus_to_cdns (bus); + +return cdns_readl (cdns,CDNS_MCP_SLAVE_STAT ); +} +EXPORT_SYMBOL (cdns_read_ping_status); +/* * IRQ handling */
drivers/soundwire/cadence_master.h +2 -0
@@ -177,6 +177,8 @@ enum sdw_command_response cdns_xfer_msg_defer(struct sdw_bus *bus, struct sdw_msg *msg, struct sdw_defer *defer); +u32 cdns_read_ping_status (struct sdw_bus *bus); +int cdns_bus_conf (struct sdw_bus *bus,struct sdw_bus_params *params); int cdns_set_sdw_stream(struct snd_soc_dai *dai,
drivers/soundwire/intel.c +1 -0
@@ -1255,6 +1255,7 @@ static struct sdw_master_ops sdw_intel_ops = { .set_bus_conf = cdns_bus_conf, .pre_bank_switch = intel_pre_bank_switch, .post_bank_switch = intel_post_bank_switch, + .read_ping_status = cdns_read_ping_status, };static int intel_init (struct sdw_intel *sdw)
Signature · 1 line
2.25.1
Bard Liao
maintainerPATCH 3/4 soundwire: add sdw_show_ping_status() helper
In reply to Bard LiaoFrom: Pierre-Louis Bossart <[email protected]>
This helper provides an optional delay parameter to wait for devices to resync in case of errors, and checks that devices are indeed attached on the bus.
--- drivers/soundwire/bus.c | 32 ++++++++++++++++++++++++++++++++ include/linux/soundwire/sdw.h | 2 ++ 2 files changed, 34 insertions(+)
drivers/soundwire/bus.c +32 -0
@@ -300,6 +300,38 @@ int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg)return ret; } +/** +* sdw_show_ping_status() - Direct report of PING status, to be used by Peripheral drivers +* @bus: SDW bus +* @sync_delay: Delay before reading status +*/ +void sdw_show_ping_status (struct sdw_bus *bus,bool sync_delay) +{ +u32 status; + +if (!bus->ops->read_ping_status) +return ; + +/* +* wait for peripheral to sync if desired. 10-15ms should be more than +* enough in most cases. +*/ +if (sync_delay) +usleep_range (10000 ,15000 ); + +mutex_lock (&bus->msg_lock); + + status = bus->ops->read_ping_status (bus); + +mutex_unlock (&bus->msg_lock); + +if (!status) +dev_warn (bus->dev,"%s: no peripherals attached\n" , __func__); +else +dev_dbg (bus->dev,"PING status: %#x\n" , status); +} +EXPORT_SYMBOL (sdw_show_ping_status); +/** * sdw_transfer_defer() - Asynchronously transfer message to a SDW Slave device * @bus: SDW bus
include/linux/soundwire/sdw.h +2 -0
@@ -926,6 +926,8 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, struct fwnode_handle *fwnode);void sdw_bus_master_delete (struct sdw_bus *bus); +void sdw_show_ping_status (struct sdw_bus *bus,bool sync_delay); +/** * sdw_port_config: Master or Slave Port configuration *
Signature · 1 line
2.25.1
Bard Liao
maintainerPATCH 4/4 ASoC: codecs: show PING status on resume failures
In reply to Bard LiaoFrom: Pierre-Louis Bossart <[email protected]>
This helper should help identify cases where devices fall off the bus and don't resync.
--- sound/soc/codecs/max98373-sdw.c | 2 ++ sound/soc/codecs/rt1308-sdw.c | 2 ++ sound/soc/codecs/rt1316-sdw.c | 2 ++ sound/soc/codecs/rt5682-sdw.c | 2 ++ sound/soc/codecs/rt700-sdw.c | 2 ++ sound/soc/codecs/rt711-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdw.c | 2 ++ 8 files changed, 16 insertions(+)
sound/soc/codecs/max98373-sdw.c +2 -0
@@ -281,6 +281,8 @@ static __maybe_unused int max98373_resume(struct device *dev) msecs_to_jiffies(MAX98373_PROBE_TIMEOUT));if (!time) {dev_err (dev,"Initialization not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
sound/soc/codecs/rt1308-sdw.c +2 -0
@@ -727,6 +727,8 @@ static int __maybe_unused rt1308_dev_resume(struct device *dev) msecs_to_jiffies(RT1308_PROBE_TIMEOUT));if (!time) {dev_err (&slave->dev,"Initialization not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
sound/soc/codecs/rt1316-sdw.c +2 -0
@@ -712,6 +712,8 @@ static int __maybe_unused rt1316_dev_resume(struct device *dev) msecs_to_jiffies(RT1316_PROBE_TIMEOUT));if (!time) {dev_err (&slave->dev,"Initialization not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
sound/soc/codecs/rt5682-sdw.c +2 -0
@@ -790,6 +790,8 @@ static int __maybe_unused rt5682_dev_resume(struct device *dev) msecs_to_jiffies(RT5682_PROBE_TIMEOUT));if (!time) {dev_err (&slave->dev,"Initialization not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
sound/soc/codecs/rt700-sdw.c +2 -0
@@ -538,6 +538,8 @@ static int __maybe_unused rt700_dev_resume(struct device *dev) msecs_to_jiffies(RT700_PROBE_TIMEOUT));if (!time) {dev_err (&slave->dev,"Initialization not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
sound/soc/codecs/rt711-sdca-sdw.c +2 -0
@@ -442,6 +442,8 @@ static int __maybe_unused rt711_sdca_dev_resume(struct device *dev) msecs_to_jiffies(RT711_PROBE_TIMEOUT));if (!time) {dev_err (&slave->dev,"Initialization not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
sound/soc/codecs/rt715-sdca-sdw.c +2 -0
@@ -233,6 +233,8 @@ static int __maybe_unused rt715_dev_resume(struct device *dev) msecs_to_jiffies(RT715_PROBE_TIMEOUT));if (!time) {dev_err (&slave->dev,"Enumeration not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
sound/soc/codecs/rt715-sdw.c +2 -0
@@ -551,6 +551,8 @@ static int __maybe_unused rt715_dev_resume(struct device *dev) msecs_to_jiffies(RT715_PROBE_TIMEOUT));if (!time) {dev_err (&slave->dev,"Initialization not complete, timed out\n" ); +sdw_show_ping_status (slave->bus, true); +return -ETIMEDOUT ; }
Signature · 1 line
2.25.1
Re: [PATCH 4/4] ASoC: codecs: show PING status on resume failures
Quoted 4 lines · Bard Liao
From: Pierre-Louis Bossart <[email protected]>
This helper should help identify cases where devices fall off the bus and don't resync.
If this is applied to the Soundwire tree it might be good to get a pull request in case of conflicts, though I guess they are relatively unlikely here.
Vinod Koul
maintainerRe: [PATCH 4/4] ASoC: codecs: show PING status on resume failures
Hey Mark,
Quoted 11 lines · Mark Brown
Quoted 4 lines · Bard Liao
From: Pierre-Louis Bossart <[email protected]>
This helper should help identify cases where devices fall off the bus and don't resync.
Acked-by Mark Brown <[email protected]>If this is applied to the Soundwire tree it might be good to get a pull request in case of conflicts, though I guess they are relatively unlikely here.
It is bit late for sdw tree (we are closed for this cycle now), if you are okay, pls feel free to take thru ASoC tree:
You may use:git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git tags/soundwire-5.20-rc1
Signature · 1 line
~Vinod
Quoted 7 lines · Bard Liao
we've been stuck with problems in the dual-amplifier configurations where one of the two devices seems to become UNATTACHED and never regains sync, see https://github.com/thesofproject/linux/issues/3638.
This is a rather infrequent issue that may happen once or twice per month, but still it remains a concern.
Quoted 8 lines
One possibility is that the device does lose sync but somehow our hardware detection fails to see it resync.
This series just adds a basic read directly from the PING frames to help confirm if yes/no the device regain sync.
The change is mainly on soundwire. @Mark, Could you ack the ASoC patch if it looks good to you?
Mark,
The series lgtm, feel free to merge thru ASoC tree with:
Quoted 24 lines
Pierre-Louis Bossart (4):
soundwire: addread_ping_statushelper definition in manager ops
soundwire: intel/cadence: expose PING status in manager ops
soundwire: addsdw_show_ping_status()helper
ASoC: codecs: show PING status on resume failuresdrivers/soundwire/bus.c | 32 ++++++++++++++++++++++++++++++ drivers/soundwire/cadence_master.c | 8 ++++++++ drivers/soundwire/cadence_master.h | 2 ++ drivers/soundwire/intel.c | 1 + include/linux/soundwire/sdw.h | 5 +++++ sound/soc/codecs/max98373-sdw.c | 2 ++ sound/soc/codecs/rt1308-sdw.c | 2 ++ sound/soc/codecs/rt1316-sdw.c | 2 ++ sound/soc/codecs/rt5682-sdw.c | 2 ++ sound/soc/codecs/rt700-sdw.c | 2 ++ sound/soc/codecs/rt711-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdw.c | 2 ++ 13 files changed, 64 insertions(+)Signature · 1 line
2.25.1
Signature · 1 line
~Vinod
Quoted 28 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Monday, July 18, 2022 1:45 PM
To: Bard Liao <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Liao, Bard <[email protected]>
Subject: Re: [PATCH 0/4] ASoC/soundwire: log actual PING status on resume issuesQuoted 2 lines · Bard Liao
we've been stuck with problems in the dual-amplifier configurations where one of the two devices seems to become UNATTACHED and never regains
sync,
Quoted 6 lines
see https://github.com/thesofproject/linux/issues/3638.
This is a rather infrequent issue that may happen once or twice per month, but still it remains a concern.
One possibility is that the device does lose sync but somehow our
hardware
Quoted 5 lines
detection fails to see it resync.
This series just adds a basic read directly from the PING frames to help confirm if yes/no the device regain sync.
Quoted 8 lines
Quoted 2 lines
The change is mainly on soundwire. @Mark, Could you ack the ASoC patch if it looks good to you?
Mark,
The series lgtm, feel free to merge thru ASoC tree with:
Acked-by Vinod Koul <[email protected]>
Hi Mark/Vinod,
Both of you are acked.
Can this series be merged now?
Thanks.
Quoted 28 lines
Quoted 23 lines
Pierre-Louis Bossart (4):
soundwire: addread_ping_statushelper definition in manager ops
soundwire: intel/cadence: expose PING status in manager ops
soundwire: addsdw_show_ping_status()helper
ASoC: codecs: show PING status on resume failuresdrivers/soundwire/bus.c | 32 ++++++++++++++++++++++++++++++ drivers/soundwire/cadence_master.c | 8 ++++++++ drivers/soundwire/cadence_master.h | 2 ++ drivers/soundwire/intel.c | 1 + include/linux/soundwire/sdw.h | 5 +++++ sound/soc/codecs/max98373-sdw.c | 2 ++ sound/soc/codecs/rt1308-sdw.c | 2 ++ sound/soc/codecs/rt1316-sdw.c | 2 ++ sound/soc/codecs/rt5682-sdw.c | 2 ++ sound/soc/codecs/rt700-sdw.c | 2 ++ sound/soc/codecs/rt711-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdca-sdw.c | 2 ++ sound/soc/codecs/rt715-sdw.c | 2 ++ 13 files changed, 64 insertions(+)Quoted 2 lines
--
2.25.1--
~Vinod
Mark Brown
maintainerQuoted 6 lines · Bard
Quoted 5 lines
Quoted 5 lines
This series just adds a basic read directly from the PING frames to help confirm if yes/no the device regain sync.
The change is mainly on soundwire. @Mark, Could you ack the ASoC patch if it looks good to you?
Quoted 6 lines
Quoted 3 lines
The series lgtm, feel free to merge thru ASoC tree with:
Acked-by Vinod Koul <[email protected]>Both of you are acked.
Can this series be merged now?
I guess I'll apply it - given that it's mainly a Soundwire change I would have expected it to go via Soundwire as you'd suggested.
Mark Brown
maintainerQuoted 8 lines · Bard Liao
we've been stuck with problems in the dual-amplifier configurations where one of the two devices seems to become UNATTACHED and never regains sync, see https://github.com/thesofproject/linux/issues/3638.
This is a rather infrequent issue that may happen once or twice per month, but still it remains a concern.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] soundwire: add read_ping_status helper definition in manager ops
commit: 874de459488b8741afc0e9888d39f2e15a962b3d
[2/4] soundwire: intel/cadence: expose PING status in manager ops
commit: 133547a1ef16cbdadb5c0023e5917924ae326dcc
[3/4] soundwire: add sdw_show_ping_status() helper
commit: 79fe02cb7547fcc09e83b850cfd32896d7dc6289
[4/4] ASoC: codecs: show PING status on resume failures
commit: 917df025e1db1286afb6e46914ae3e8b40241568All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark