Repository navigation
SoundWire: disable Realtek spurious parity errors - #1984
Conversation
|
@shumingfan @bardliao @RanderWang the point of this PR is to show that there is a problem with the initialization of the codec, even when we explicitly disable the PARITY interrupt we still get a parity interrupt... |
@plbossart This PR makes effect on tgl & cml u & h. Parity error disappears with it. @bardliao what is your status ? |
I can still see Parity error after the PR is applied. But the frequency is lower than before. I.e. Parity error appears in almost every boot before the PR is applied, but it is about 20% that I can see Parity error after the PR is applied. Besides, I can only see Parity error reported by rt711 with the PR. Parity error is reported by rt1308 and/or rt711 and/or rt715 randomly without this PR. |
@bardliao Indeed I managed to make the parity error go away completely by re-reading the INT1_MASK register after updating it. So there's something odd here. I had one theory that we should not be changing the interrupt masks while we are dealing with an interrupt, but pushing this setting to a work-queue didn't seem to help. |
|
@plbossart According to spec, Parity error can only be detected when Master is not a bus owner. When master is a bus owner than parity is calculated based on sampled bus state so detection of the error is not possible. In normal usage, the master owns the bus and the generation of SoundWire Control Word. Is the interrupt unreliable and why we enable it always ? |
|
@plbossart sorry, the parity error is caused by slave, not master. The SCP_INTStat1 is already 1 (parity error) after slave number is assigned and before enabling INT1_PARITY, so parity error will generated immediately when enabling parity interrupt. |
That's a problem. when a Slave become attached, it cannot raise an interrupt before the master explicitly programs the relevant masks. See the spec, after a Hard Reset (Severe Reset in 1.2) all masks are cleared. |
|
@bardliao can you look into this with our Realtek friends? |
Sure, I will co-work with @shumingfan |
@plbossart re-reading INT1_MASK doesn't work on my side but clearing SDW_SCP_INT1 before setting INT1_MASK does. Discussed with @shumingfan, we think it is possible that the parity error happens in the synchronization stage.
Yes, the SDW_SCP_INT1 is already 1, but it is only a flag say hey there is a party error happens and I will raise an interrupt when you set the mask. In fact, it didn't raise an interrupt before we set the mask. Another issue is that we have a share irq, and we will always check the interrupt status. So, we can still see parity error log when the irq is triggered by other interrupts with the parity error bit is set. In my opinion, clear SDW_SCP_INT1 before setting INT1_MASK could be an valid solution as we don't care about the interrupts happens before INT1_MASK is set. |
|
@bardliao how do you explain that we still get the Parity error then the PARITY mask is not set, as in this PR? |
We handle all Slave interrupts in sdw_handle_slave_alerts(). So when sdw_handle_slave_alerts() is triggered by Slave impl defined interrupt, it will also show Parity error if SDW_SCP_INT1_PARITY bit is set. In other words, you won't see Parity error if there is no other Slave interrupts happens. |
ok, so now that makes sense, thanks @bardliao. I was confused by the 'mask' definition. It does not enable a specific interrupt, it gates the propagation of the interrupt to the PING frame status. So I guess what we need to do is check if the parity mask is set and discard the interrupt if it isn't, that way the initial condition will not show up. |
a15b339 to
e260b29
Compare
|
@shumingfan @bardliao can you please take a look. Also I still have spurious messages now related to jack calibration - when I don't have a headphone/headset plugged-in. Can this be demoted to a debug message? |
c39cca9 to
1c44b22
Compare
1c44b22 to
83ecdf5
Compare
lyakh
left a comment
There was a problem hiding this comment.
a very minor comment, looks good to me otherwise.
kv2019i
left a comment
There was a problem hiding this comment.
Looks good. One commit msg typo and a few minor style issues, but nothing really to gate sending upstream (but good to fix if you refresh the series for other reasons).
83ecdf5 to
fe35d95
Compare
Add a slave-level property and program the SCP_INT1_MASK as desired by the codec driver. Since there is no DisCo property this has to be an implementation-specific firmware property or hard-coded in the driver. The only functionality change is that implementation-defined interrupts are no longer set for amplifiers - those interrupts are typically for jack detection or acoustic event detection/hotwording. Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Unlike the traditional usage, in the SoundWire specification the interrupt masks only gate the propagation of an interrupt condition to the PING frame status. They do not gate the changes of the INT_STAT registers, which will happen regardless of the mask settings. See Figure 116 of the SoundWire 1.2 specification for an in-depth description of the interrupt model. When the bus driver reads the SCP_INT1_STAT register, it will retrieve all the interrupt status, including for the mask fields that were not explicitly set. For example, even if the PARITY mask is not set, the PARITY error status will be reported if an implementation-defined interrupt for jack detection is enabled and occurs. Filtering undesired interrupt reports and handling has to be implemented in software. This patch enables this filtering for the INT1_IMPL_DEF, PARITY and BUS_CLASH interrupt sources. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Some Slaves report incorrect information in their interrupt status registers after a master/bus reset, track the initial interrupt handling so that quirks can be introduced to filter out incorrect information while keeping interrupts enabled in steady state. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
If a Slave device reports with a quirk that its initial parity check may be incorrect, filter it but keep the parity checks active in steady state. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The parity calculation is not reset on a Severe Reset, which leads to misleading/harmless errors reported on startup. The addition of a quirk helps filter out such errors while leaving the error checks on in steady-state. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Provide prototype and export symbol to enable tests. The bus lock is handled externally to avoid conflicts e.g. between kernel-generated traffic and test traffic. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The Cadence IP can inject errors, let's make use of this capability to test Slave parity error checks. See e.g. example log where both the master and slave detect the parity error injected on a dummy read command. cd /sys/kernel/debug/soundwire/master-1/intel-sdw/ echo 1 > cdns-parity-error-injection [ 44.756249] intel-master sdw-master-1: Parity error [ 44.756313] intel-master sdw-master-1: Msg NACK received [ 44.756366] intel-master sdw-master-1: Msg NACKed for Slave 15 [ 44.756375] intel-master sdw-master-1: trf on Slave 15 failed:-5 [ 44.756382] intel-master sdw-master-1: parity error injection, read: -5 [ 44.756649] rt1308 sdw:1:25d:1308:0: Parity error detected The code makes sure the Master device is resumed, hence the clock restarted, before sending a parity error. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
fe35d95 to
d85b1c9
Compare
|
@plbossart @bardliao This seems ready to go, but I didn't merge yet. You two probably know better whether we need more review from SDW codec folks on this or not. |
Let's wait for @bardliao to review and merge next week. |
|
BDW_WSB_RT286 pr-device-test fails at several PRs and I think it is not caused by this PR. So merge it now. |
split from PR #1980 and refocused on parity errors reported by Realtek devices even when the PARITY mask is not set.
@shumingfan FYI