[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <003d01d8145c$1bfc83b0$53f58b10$@opensource.cirrus.com>
Date: Fri, 28 Jan 2022 15:31:24 +0000
From: Stefan Binding <sbinding@...nsource.cirrus.com>
To: 'Stephen Boyd' <swboyd@...omium.org>,
'Greg Kroah-Hartman' <gregkh@...uxfoundation.org>,
'Douglas Anderson' <dianders@...omium.org>
CC: <linux-kernel@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<dri-devel@...ts.freedesktop.org>,
<freedreno@...ts.freedesktop.org>,
'Lucas Tanure' <tanureal@...nsource.cirrus.com>,
'Takashi Iwai' <tiwai@...e.de>,
'Daniel Vetter' <daniel.vetter@...ll.ch>,
"'Rafael J. Wysocki'" <rafael@...nel.org>,
'Rob Clark' <robdclark@...il.com>,
'Russell King' <rmk+kernel@....linux.org.uk>,
'Saravana Kannan' <saravanak@...gle.com>
Subject: RE: [PATCH v6 33/35] ALSA: hda/realtek: Migrate to aggregate driver
> -----Original Message-----
> From: Stephen Boyd <swboyd@...omium.org>
> Sent: 27 January 2022 20:02
> To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>; Douglas Anderson
> <dianders@...omium.org>
> Cc: linux-kernel@...r.kernel.org; linux-arm-msm@...r.kernel.org; dri-
> devel@...ts.freedesktop.org; freedreno@...ts.freedesktop.org; Stefan
> Binding <sbinding@...nsource.cirrus.com>; Lucas Tanure
> <tanureal@...nsource.cirrus.com>; Takashi Iwai <tiwai@...e.de>; Daniel
> Vetter <daniel.vetter@...ll.ch>; Rafael J. Wysocki <rafael@...nel.org>;
Rob
> Clark <robdclark@...il.com>; Russell King <rmk+kernel@....linux.org.uk>;
> Saravana Kannan <saravanak@...gle.com>
> Subject: [PATCH v6 33/35] ALSA: hda/realtek: Migrate to aggregate driver
>
> 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@...nsource.cirrus.com>
> Cc: Lucas Tanure <tanureal@...nsource.cirrus.com>
> Cc: Takashi Iwai <tiwai@...e.de>
> Cc: Daniel Vetter <daniel.vetter@...ll.ch>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Cc: Rob Clark <robdclark@...il.com>
> Cc: Russell King <rmk+kernel@....linux.org.uk>
> Cc: Saravana Kannan <saravanak@...gle.com>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> ---
> 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
Tested locally, and no issues found.
Tested-by: Stefan Binding <sbinding@...nsource.cirrus.com>
Thanks,
Stefan
Powered by blists - more mailing lists