thesofproject / linux

Linux kernel source tree
Other
91 stars 133 forks source link

SoundWire/SDCA: introduce interrupt handler functions #5032

Closed plbossart closed 4 months ago

plbossart commented 6 months ago

POC branch to show how we can replace custom interrupt handling in different drivers with a helper library.

Nothing new under the sun, interrupt capabilities need to be enumerated, interrupt sources registered with a callback and context, and the helper takes care of clearing interrupt status after invoking callback.

Tested on MTL w/ RT712 codec for jack detection only (buttons not tested). The changes in RT711/RT712 are rather invasive and should be preceded by a cleanup prior to changes.

@bardliao @shumingfan @charleskeepax @ujfalusi comments welcome on the last 3 commits (the rest is just same as https://github.com/thesofproject/linux/pull/5010)

plbossart commented 5 months ago

Two problems:

plbossart commented 5 months ago

one more issue:

Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: soundwire_cadence:cdns_update_slave_status_work: soundwire_intel soundwire_intel.link.0: Slave status change: 0x4000000
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: snd_soc_rt711_sdca:rt711_sdca_interrupt_callback: rt711-sdca sdw:0:0:025d:0711:01: rt711_sdca_interrupt_callback control_port_stat=4, sdca_cascade=1
Jun 04 08:46:51 ba-mtlp-sdw-aioc-03 kernel: rt711-sdca sdw:0:0:025d:0711:01: Reached MAX_RETRY on alert read

This is due to bad code in an 'optimization', only the first register was handled.

plbossart commented 4 months ago

closing, will re-add a new branch