lkml.org 
[lkml]   [2022]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v6 33/35] ALSA: hda/realtek: Migrate to aggregate driver
Date


> -----Original Message-----
> From: Stephen Boyd <swboyd@chromium.org>
> Sent: 27 January 2022 20:02
> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Douglas Anderson
> <dianders@chromium.org>
> Cc: linux-kernel@vger.kernel.org; linux-arm-msm@vger.kernel.org; dri-
> devel@lists.freedesktop.org; freedreno@lists.freedesktop.org; Stefan
> Binding <sbinding@opensource.cirrus.com>; Lucas Tanure
> <tanureal@opensource.cirrus.com>; Takashi Iwai <tiwai@suse.de>; Daniel
> Vetter <daniel.vetter@ffwll.ch>; Rafael J. Wysocki <rafael@kernel.org>;
Rob
> Clark <robdclark@gmail.com>; Russell King <rmk+kernel@arm.linux.org.uk>;
> Saravana Kannan <saravanak@google.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@opensource.cirrus.com>
> Cc: Lucas Tanure <tanureal@opensource.cirrus.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> Cc: Saravana Kannan <saravanak@google.com>
> Signed-off-by: Stephen Boyd <swboyd@chromium.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@opensource.cirrus.com>

Thanks,
Stefan


\
 
 \ /
  Last update: 2022-01-28 16:32    [W:0.154 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site