Commit 2186fe21 authored by Simon Trimmer's avatar Simon Trimmer Committed by Takashi Iwai

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.
Signed-off-by: default avatarSimon Trimmer <simont@opensource.cirrus.com>
Link: https://patch.msgid.link/20240829161114.140938-1-simont@opensource.cirrus.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent dfe5b1fe
......@@ -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);
......
......@@ -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);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment