summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_component.c
AgeCommit message (Collapse)Author
2024-08-29ALSA: hda/realtek: Autodetect Cirrus Logic companion amplifier bindingsSimon 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. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://patch.msgid.link/20240829161114.140938-1-simont@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-08-26ALSA: hda: hda_component: Fix mutex crash if nothing ever bindsRichard Fitzgerald
Move the initialization of parent->mutex into hda_component_manager_init() so that it is always valid. In hda_component_manager_bind() do not clear the parent information. Only zero-fill the per-component data ready for it to be filled in by the components as they bind. Previously parent->mutex was being initialized only in hda_component_manager_bind(). This meant that it was only initialized if all components appeared and there was a bind callback. If there wasn't a bind the mutex object was not valid when the Realtek driver called any of the other functions. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: 047b9cbbaa8e ("ALSA: hda: hda_component: Protect shared data with a mutex") Link: https://patch.msgid.link/20240826094940.45563-1-rf@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-06-18ALSA: hda: hda_component: Protect shared data with a mutexSimon Trimmer
The hda_component contains information shared from the amp drivers to the codec that can be altered (for example as the driver unloads). Guard the update and use of these to prevent use of stale data. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/20240617154105.108635-5-simont@opensource.cirrus.com
2024-06-18ALSA: hda: hda_component: Move codec field into the parentSimon Trimmer
There is one codec shared across all of the bound HDA components and a copy is usually stashed in the amp driver so it doesn't need to be in every hda_component. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/20240617154105.108635-4-simont@opensource.cirrus.com
2024-06-18ALSA: hda: hda_component: Change codecs to use component parent structureSimon Trimmer
Change the hda_component binding APIs to pass the hds_component_parent as the parameter so the array of components can be abstracted. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/20240617154105.108635-3-simont@opensource.cirrus.com
2024-06-18ALSA: hda: hda_component: Introduce component parent structureSimon Trimmer
In preparation for moving duplicated members from the hda_component structure introduce a parent structure that wraps the array of components. This also allows us to confine the knowledge of the maximum number of entries to the hda_component files and eliminate passing that redundant information around and making direct accesses to the array. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/20240617154105.108635-2-simont@opensource.cirrus.com
2024-05-08ALSA: hda: hda_component: Initialize shared data during bind callbackRichard Fitzgerald
Move the initialization of the shared struct hda_component array into hda_component_manager_bind(). The purpose of the manager bind() callback is to allow it to perform initialization before binding in the component drivers. This is the correct place to initialize the shared data. The original implementation initialized the shared data in hda_component_manager_init(). This is only done once during probe() of the manager driver. So if the component binding was unbound and then rebound, the shared data would not be re-initialized. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: fd895a74dc1d ("ALSA: hda: realtek: Move hda_component implementation to module") Link: https://lore.kernel.org/r/20240508100347.47283-1-rf@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-25ALSA: hda: realtek: Move hda_component implementation to moduleRichard Fitzgerald
Move the generic parts of the hda_component implementation into a new hda_component module. This will allow other HDA codecs to add support for the component binding API without duplicating all the code. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Tested-by: Gergo Koteles <soyer@irl.hu> Link: https://lore.kernel.org/r/20240124112607.77614-3-rf@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>