RE: [PATCH v6 33/35] ALSA: hda/realtek: Migrate to aggregate driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Stephen Boyd <swboyd@xxxxxxxxxxxx>
> Sent: 27 January 2022 20:02
> To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; Douglas Anderson
> <dianders@xxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-arm-msm@xxxxxxxxxxxxxxx; dri-
> devel@xxxxxxxxxxxxxxxxxxxxx; freedreno@xxxxxxxxxxxxxxxxxxxxx; Stefan
> Binding <sbinding@xxxxxxxxxxxxxxxxxxxxx>; Lucas Tanure
> <tanureal@xxxxxxxxxxxxxxxxxxxxx>; Takashi Iwai <tiwai@xxxxxxx>; Daniel
> Vetter <daniel.vetter@xxxxxxxx>; Rafael J. Wysocki <rafael@xxxxxxxxxx>;
Rob
> Clark <robdclark@xxxxxxxxx>; Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>;
> Saravana Kannan <saravanak@xxxxxxxxxx>
> 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@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

Tested locally, and no issues found.
Tested-by: Stefan Binding <sbinding@xxxxxxxxxxxxxxxxxxxxx>

Thanks,
Stefan





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux