linux icon indicating copy to clipboard operation
linux copied to clipboard

ASoC/SoundWire: add SDCA helper library

Open plbossart opened this issue 1 year ago • 13 comments

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.

plbossart avatar Jul 30 '24 14:07 plbossart

@bardliao I think the jack is no longer detected even without the last commit, checking with topic/sof-dev.

plbossart avatar Jul 30 '24 16:07 plbossart

@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 avatar Aug 09 '24 09:08 plbossart

@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

shumingfan avatar Aug 12 '24 11:08 shumingfan

@plbossart I tested rt712_vb on LNL RVP and the jack detection and button detection work.

bardliao avatar Aug 12 '24 13:08 bardliao

@bardliao did you get any warning about a non-registered source as discussed earlier?

plbossart avatar Aug 12 '24 13:08 plbossart

@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

bardliao avatar Aug 13 '24 02:08 bardliao

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.

plbossart avatar Aug 13 '24 07:08 plbossart

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.

bardliao avatar Aug 13 '24 09:08 bardliao

There's still no way we can have registered sources 0x101 by using BIT(0) and BIT(8). We must do something wrong.

plbossart avatar Aug 13 '24 09:08 plbossart

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?

bardliao avatar Aug 13 '24 09:08 bardliao

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 avatar Aug 13 '24 10:08 plbossart

@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?

shumingfan avatar Aug 13 '24 10:08 shumingfan

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

bardliao avatar Aug 14 '24 01:08 bardliao

Let's continue with https://github.com/thesofproject/linux/pull/5199 and focus on SDCA functions and version lookup first.

bardliao avatar Oct 07 '24 07:10 bardliao