ASoC/SoundWire: add SDCA helper library
Updated versions of code last touched in 3 months ago.
@ujfalusi can I ask you to test the TGL RT711-sdca part to see if there's any change.
@bardliao if you can try with the MTL RT712 that would appreciated, my test device doesn't seem to detect the jacks - or maybe the code is just wrong haha.
For now this library only deals with detection of Functions and adds a generic SDCA interrupt handler.
@bardliao I think the jack is no longer detected even without the last commit, checking with topic/sof-dev.
@bardliao @shumingfan can you try this on RT712-VB? I don't have hardware available so not sure if the detection works ... Thanks!
TODO: add the missing registered_source reported early and make sure all the actions are consistent. Need your feedback on the interrupt handling as well.
@plbossart I use the rt712-vb-l0-disco-table-test.asl with this PR to test it. It works to detect RT712VB. rt712-vb-l0-disco-table-test.asl.txt
@plbossart I tested rt712_vb on LNL RVP and the jack detection and button detection work.
@bardliao did you get any warning about a non-registered source as discussed earlier?
@bardliao did you get any warning about a non-registered source as discussed earlier?
Yes,
[ 169.988327] rt712-sdca sdw:0:0:025d:0712:01: sdca_interrupt_register_handler: interrupt 0x49, registered sources 0x101, unregistered sources will be ignored
[ 169.988635] rt712-sdca sdw:0:0:025d:0712:01: sdca_interrupt_register_handler: interrupt 0x4, registered sources 0x1, unregistered sources will be ignored
Humm, this is confusing @bardliao, the 'registered_sources' are not supposed to change. Maybe the log is incorrect?
that also means BIT(0), BIT(3) and BIT(6) are reported as interrupts, in the code I registered BIT(0) and BIT(8). No idea what BIT(3) and BIT(6) might be.
Odd.
Humm, this is confusing @bardliao, the 'registered_sources' are not supposed to change. Maybe the log is incorrect?
There are 2 interrupt sources sdca_int_0 and sdca_int_8. So, the 'registered_sources' are not changed, but for different interrupt sources.
that also means BIT(0), BIT(3) and BIT(6) are reported as interrupts, in the code I registered BIT(0) and BIT(8). No idea what BIT(3) and BIT(6) might be.
It seems to be the codec behavior. The registers will be raised no matter they are registered or not. But the interrupt will only be triggered when the registered bits are raised. Need @shumingfan 's comment.
Odd.
There's still no way we can have registered sources 0x101 by using BIT(0) and BIT(8). We must do something wrong.
There's still no way we can have registered sources 0x101 by using BIT(0) and BIT(8). We must do something wrong.
Sorry, I didn't get the point. BIT(0) | BIT(8) is 0x101, right?
sorry, I confused binary and hex haha. I added a 0xff mask to only look at the 8 bits per register, that should make things clearer in the log message. Still not sure how BIT(3) and BIT(6) can be shown with an active interrupt?
@plbossart @bardliao BIT(3) is for the function_status of UAJ and BIT(6) is for XU_UAJ. Some conditions should trigger these flags. However, the codec driver doesn't handle all situations. Could you ignore these flags?
sorry, I confused binary and hex haha. I added a 0xff mask to only look at the 8 bits per register, that should make things clearer in the log message. Still not sure how BIT(3) and BIT(6) can be shown with an active interrupt?
With the updated change,
[ 111.469955] rt712-sdca sdw:0:0:025d:0712:01: sdca_interrupt_register_handler: SDW_SCP_SDCA_INT1 interrupt status 0x9, registered sources 0x1, unregistered sources will be ignored
[ 111.470236] rt712-sdca sdw:0:0:025d:0712:01: sdca_interrupt_register_handler: SDW_SCP_SDCA_INT2 interrupt status 0x4, registered sources 0x1, unregistered sources will be ignored
Let's continue with https://github.com/thesofproject/linux/pull/5199 and focus on SDCA functions and version lookup first.