ALSA: hda/realtek: Autodetect Cirrus Logic companion amplifier bindings
PATCH 1/1 ALSA: hda/realtek: Autodetect Cirrus Logic companion amplifier bindings
We do not need model specific HDA quirks to construct the component binding details of Cirrus Logic companion amplifiers as this information is already present in the ACPI.
Quirks are then only required for special workarounds not described in the ACPI such as internal configuration of the Realtek codecs.
The codec pointer is now initialized in hda_component_manager_init() so that we can detect when companion amplifiers are found in the ACPI but the SSID invokes a quirk that also attempts to create the component binding.
---
v1 - This patch applies to for-next with this additional patch:
b1faff28a2bd ("ALSA: hda: hda_component: Fix mutex crash if nothing ever binds") which is currently only in the for-linus.
We're looking to do the same for the CS35L41 devices, but that will come later because there are many more quirks to work through.
sound/pci/hda/hda_component.c | 19 +++- sound/pci/hda/hda_component.h | 2 +- sound/pci/hda/patch_realtek.c | 158 ++++++++++++++-------------------- 3 files changed, 82 insertions(+), 97 deletions(-)
sound/pci/hda/hda_component.c +16 -3
@@ -142,7 +142,6 @@ int hda_component_manager_bind(struct hda_codec *cdc,/* Init shared and component specific data */ memset (parent->comps,0 ,sizeof (parent->comps)); - parent->codec = cdc;mutex_lock (&parent->mutex); ret =component_bind_all (hda_codec_dev (cdc), parent);
@@ -163,6 +162,13 @@ int hda_component_manager_init(struct hda_codec *cdc,struct hda_scodec_match *sm;int ret, i; +if (parent->codec) { +codec_err (cdc,"Component binding already created (SSID: %x)\n" , + cdc->core.subsystem_id); +return -EINVAL ; + } + parent->codec = cdc; +mutex_init (&parent->mutex);for (i =0 ; i < count; i++) {
@@ -185,12 +191,19 @@ int hda_component_manager_init(struct hda_codec *cdc, }EXPORT_SYMBOL_NS_GPL (hda_component_manager_init,SND_HDA_SCODEC_COMPONENT ); -void hda_component_manager_free (struct hda_codec *cdc, +void hda_component_manager_free (struct hda_component_parent *parent,const struct component_master_ops *ops) { -struct device *dev =hda_codec_dev (cdc); +struct device *dev; + +if (!parent->codec) +return ; + + dev =hda_codec_dev (parent->codec);component_master_del (dev, ops); + + parent->codec =NULL ; }EXPORT_SYMBOL_NS_GPL (hda_component_manager_free,SND_HDA_SCODEC_COMPONENT );
sound/pci/hda/hda_component.h +1 -1
@@ -75,7 +75,7 @@ int hda_component_manager_init(struct hda_codec *cdc,const char *match_str, const struct component_master_ops *ops); -void hda_component_manager_free (struct hda_codec *cdc, +void hda_component_manager_free (struct hda_component_parent *parent,const struct component_master_ops *ops);int hda_component_manager_bind (struct hda_codec *cdc,struct hda_component_parent *parent);
sound/pci/hda/patch_realtek.c +65 -93
251 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 13 lines · Simon Trimmer
We do not need model specific HDA quirks to construct the component binding details of Cirrus Logic companion amplifiers as this information is already present in the ACPI.
Quirks are then only required for special workarounds not described in the ACPI such as internal configuration of the Realtek codecs.
The codec pointer is now initialized in
hda_component_manager_init()so that we can detect when companion amplifiers are found in the ACPI but the SSID invokes a quirk that also attempts to create the component binding.
Quoted 5 lines
Signed-off-by Simon Trimmer <[email protected]>---
v1 - This patch applies to for-next with this additional patch:
b1faff28a2bd("ALSA: hda:hda_component: Fix mutex crash if nothing ever binds") which is currently only in the for-linus.
OK, I now merged for-linus to for-next, and applied yours.
Quoted 2 lines
We're looking to do the same for the CS35L41 devices, but that will come later because there are many more quirks to work through.
That's understandable. Thanks!
Takashi