Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Cc: Stefan Binding <sbinding@xxxxxxxxxxxxxxxxxxxxx> Cc: Lucas Tanure <tanureal@xxxxxxxxxxxxxxxxxxxxx> Cc: Takashi Iwai <tiwai@xxxxxxx> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx> Cc: Rob Clark <robdclark@xxxxxxxxx> Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> Cc: Saravana Kannan <saravanak@xxxxxxxxxx> Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx> --- sound/pci/hda/patch_realtek.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 668274e52674..80a2164c99b6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6547,25 +6547,31 @@ static int find_comp_by_dev_name(struct alc_spec *spec, const char *name) return -ENODEV; } -static int comp_bind(struct device *dev) +static int realtek_aggregate_probe(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct hda_codec *cdc = dev_to_hda_codec(dev); struct alc_spec *spec = cdc->spec; return component_bind_all(dev, spec->comps); } -static void comp_unbind(struct device *dev) +static void realtek_aggregate_remove(struct aggregate_device *adev) { + struct device *dev = aggregate_device_parent(adev); struct hda_codec *cdc = dev_to_hda_codec(dev); struct alc_spec *spec = cdc->spec; component_unbind_all(dev, spec->comps); } -static const struct component_master_ops comp_master_ops = { - .bind = comp_bind, - .unbind = comp_unbind, +static struct aggregate_driver realtek_aggregate_driver = { + .probe = realtek_aggregate_probe, + .remove = realtek_aggregate_remove, + .driver = { + .name = "realtek_aggregate", + .owner = THIS_MODULE, + }, }; static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc, @@ -6597,7 +6603,7 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char return; component_match_add(dev, &spec->match, comp_match_dev_name, name); } - ret = component_master_add_with_match(dev, &comp_master_ops, spec->match); + ret = component_aggregate_register(dev, &realtek_aggregate_driver, spec->match); if (ret) codec_err(cdc, "Fail to register component aggregator %d\n", ret); else @@ -6648,7 +6654,7 @@ static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const st "i2c-CLSA0100:00-cs35l41-hda.0"); component_match_add(dev, &spec->match, comp_match_dev_name, "i2c-CLSA0100:00-cs35l41-hda.1"); - ret = component_master_add_with_match(dev, &comp_master_ops, spec->match); + ret = component_aggregate_register(dev, &realtek_aggregate_driver, spec->match); if (ret) codec_err(cdc, "Fail to register component aggregator %d\n", ret); else -- https://chromeos.dev