-
Notifications
You must be signed in to change notification settings - Fork 140
[TEST] soundwire: bus: clear bus clash interrupt after attached #2582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TEST] soundwire: bus: clear bus clash interrupt after attached #2582
Conversation
|
CI test 849 shows positive result. |
RanderWang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b0ff63f to
c1c8289
Compare
plbossart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this @bardliao, see comments below.
Also not sure if this improves anything?
drivers/soundwire/bus.c
Outdated
| SDW_SCP_INT1_BUS_CLASH, SDW_SCP_INT1_BUS_CLASH); | ||
| if (ret < 0) | ||
| dev_err(&slave->dev, | ||
| "Clear SDW_SCP_INT1_BUS_CLASH failed:%d\n", ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about doing the opposite, first clear the status and then enable the interrupt?
That would remove any memory of the initial bus clash, but allow for programming errors or persistent electrical errors to be detected.
I also think this should be an optional bus behavior, e.g. for Intel devices this behavior would be the default but we don't force all implementations to behave the same.
The commit message is also questionable, a bus clash is not a harmless error!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about doing the opposite, first clear the status and then enable the interrupt?
That would remove any memory of the initial bus clash, but allow for programming errors or persistent electrical errors to be detected.
I tested it, but clearing before enabling doesn't help. I can still see bus clash on my side. On the other hand, clearing right after enabling fixes the clash issue on my side.
I also think this should be an optional bus behavior, e.g. for Intel devices this behavior would be the default but we don't force all implementations to behave the same.
The commit message is also questionable, a bus clash is not a harmless error!
Agree.
I will make it optional and revise the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about doing the opposite, first clear the status and then enable the interrupt?
That would remove any memory of the initial bus clash, but allow for programming errors or persistent electrical errors to be detected.I tested it, but clearing before enabling doesn't help. I can still see bus clash on my side. On the other hand, clearing right after enabling fixes the clash issue on my side.
Sorry, I tested it with a wrong way. I tested it with sdw_write_no_pm. i.e. without reading operation. That's why bus clash wasn't cleared. The test result is good if I tested it with the updated version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear register is not the key step, read register is. It is very trick. @bardliao do you plan to disclose this idea ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clear register is not the key step, read register is. It is very trick. @bardliao do you plan to disclose this idea ?
mipi_SoundWire_specification_v1-2 session 11.1.2 "Interrupt Model" says successful read from DPN_IntStat register is a necessary process of clearing an interrupt.
c1c8289 to
b1ea2e0
Compare
drivers/soundwire/bus.c
Outdated
| status = sdw_read_no_pm(slave, SDW_SCP_INT1); | ||
| if (status & SDW_SCP_INT1_BUS_CLASH) { | ||
| dev_warn(&slave->dev, "Bus clash detected before enabling\n"); | ||
| sdw_write_no_pm(slave, SDW_SCP_INT1, SDW_SCP_INT1_BUS_CLASH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdw_update_no_pm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdw_update_no_pm ?
I got it . update can't work for it will compare clash bit. But how about other bits in SCP_INT1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sdw_update_no_pm ?
I got it . update can't work for it will compare clash bit. But how about other bits in SCP_INT1?
We only want to clear the bus clash bit, so set 0 to all other bits.
c483d14 to
90c26e9
Compare
plbossart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's what I had in mind @bardliao, but it's a master quirk, not a slave one. see comments below.
drivers/soundwire/intel.c
Outdated
| if (quirk_mask & SDW_INTEL_QUIRK_MASK_BUS_DISABLE) | ||
| prop->hw_disabled = true; | ||
|
|
||
| prop->quirks = SDW_SLAVE_QUIRKS_CLEAR_INITIAL_CLASH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that should be SDW_MASTER_...
include/linux/soundwire/sdw.h
Outdated
| * command | ||
| * @mclk_freq: clock reference passed to SoundWire Master, in Hz. | ||
| * @hw_disabled: if true, the Master is not functional, typically due to pin-mux | ||
| * @quirks: bitmask identifying deltas from the MIPI specification |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's more 'bitmask identifying optional behavior beyond the scope of the MIPI specification'
include/linux/soundwire/sdw.h
Outdated
| }; | ||
|
|
||
| #define SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY BIT(0) | ||
| #define SDW_SLAVE_QUIRKS_CLEAR_INITIAL_CLASH BIT(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's s new set for SDW_MASTER_QUIRKS_CLEAR_INITIAL_CLASH
| static int sdw_initialize_slave(struct sdw_slave *slave) | ||
| { | ||
| struct sdw_slave_prop *prop = &slave->prop; | ||
| int status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit message:
The SoundWire specification allows a Slave device to report a bus clash with the in-band interrupt mechanism when it detects a conflict while driving a bitSlot it owns. This can be a symptom of an electrical conflict or a programming error, and it's vital to detect reliably.
Unfortunately, on some platforms, bus clashes are randomly reported by Slave devices after a bus reset, with an interrupt status set even before the bus clash interrupt is enabled. These initial spurious interrupts are not relevant and should optionally be filtered out, while leaving the interrupt mechanism enabled to detect 'true' issues.
This patch suggests the addition of a Master level quirk to discard such interrupts. The quirk should in theory have been added at the Slave level, but since the problem was detected with different generations of Slave devices it's hard to point to a specific IP. The problem might also be board-dependent and hence dealing with a Master quirk is simpler.
The SoundWire specification allows a Slave device to report a bus clash with the in-band interrupt mechanism when it detects a conflict while driving a bitSlot it owns. This can be a symptom of an electrical conflict or a programming error, and it's vital to detect reliably. Unfortunately, on some platforms, bus clashes are randomly reported by Slave devices after a bus reset, with an interrupt status set even before the bus clash interrupt is enabled. These initial spurious interrupts are not relevant and should optionally be filtered out, while leaving the interrupt mechanism enabled to detect 'true' issues. This patch suggests the addition of a Master level quirk to discard such interrupts. The quirk should in theory have been added at the Slave level, but since the problem was detected with different generations of Slave devices it's hard to point to a specific IP. The problem might also be board-dependent and hence dealing with a Master quirk is simpler. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
There is nothing we can do to handle the bus clash interrupt before interrupt mask is enabled. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
90c26e9 to
7a2abd8
Compare
|
SOFCI TEST |
plbossart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @bardliao
We may get bus clash during the attach process, and the SDW_SCP_INT1_
BUS_CLASH bit will be set once we set the corresponding bit on the
SDW_SCP_INTMASK1 register. But it is harmless after codec is attached.
Clear it right after seting SDW_SCP_INTMASK1 register can reduce the
noise of harmless error.
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com
Fixes #2578