[PATCH 09/17] ASoC: Intel: bdw_rt286: Reword prefixes of all driver members

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Fri Jun 10 18:34:23 CEST 2022



On 6/10/22 07:36, Cezary Rojewski wrote:
> Replace ambiguous 'broadwell_rt286_' prefixes in favour of 'card_',
> 'link_' and other similar strings to clearly state which object given
> member implements behavior for.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski at intel.com>
> Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski at linux.intel.com>

This doesn't apply or assumes something else was applied already?

> ---
>  sound/soc/intel/boards/bdw_rt286.c | 96 +++++++++++++++---------------
>  1 file changed, 48 insertions(+), 48 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/bdw_rt286.c b/sound/soc/intel/boards/bdw_rt286.c
> index b29d77dfb281..092bc9a45548 100644
> --- a/sound/soc/intel/boards/bdw_rt286.c
> +++ b/sound/soc/intel/boards/bdw_rt286.c
> @@ -16,9 +16,9 @@
>  
>  #include "../../codecs/rt286.h"
>  
> -static struct snd_soc_jack broadwell_headset;
> +static struct snd_soc_jack card_headset;
>  /* Headset jack detection DAPM pins */
> -static struct snd_soc_jack_pin broadwell_headset_pins[] = {
> +static struct snd_soc_jack_pin card_headset_pins[] = {
>  	{
>  		.pin = "Mic Jack",
>  		.mask = SND_JACK_MICROPHONE,
> @@ -29,12 +29,12 @@ static struct snd_soc_jack_pin broadwell_headset_pins[] = {
>  	},
>  };
>  
> -static const struct snd_kcontrol_new broadwell_controls[] = {
> +static const struct snd_kcontrol_new card_controls[] = {
>  	SOC_DAPM_PIN_SWITCH("Speaker"),
>  	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
>  };
>  
> -static const struct snd_soc_dapm_widget broadwell_widgets[] = {
> +static const struct snd_soc_dapm_widget card_widgets[] = {
>  	SND_SOC_DAPM_HP("Headphone Jack", NULL),
>  	SND_SOC_DAPM_SPK("Speaker", NULL),
>  	SND_SOC_DAPM_MIC("Mic Jack", NULL),
> @@ -43,7 +43,7 @@ static const struct snd_soc_dapm_widget broadwell_widgets[] = {
>  	SND_SOC_DAPM_LINE("Line Jack", NULL),
>  };
>  
> -static const struct snd_soc_dapm_route broadwell_rt286_map[] = {
> +static const struct snd_soc_dapm_route card_routes[] = {
>  
>  	/* speaker */
>  	{"Speaker", NULL, "SPOR"},
> @@ -65,22 +65,22 @@ static const struct snd_soc_dapm_route broadwell_rt286_map[] = {
>  	{"AIF1 Playback", NULL, "SSP0 CODEC OUT"},
>  };
>  
> -static int broadwell_rt286_codec_init(struct snd_soc_pcm_runtime *rtd)
> +static int codec_link_init(struct snd_soc_pcm_runtime *rtd)
>  {
>  	struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
>  	int ret = 0;
>  	ret = snd_soc_card_jack_new_pins(rtd->card, "Headset",
> -		SND_JACK_HEADSET | SND_JACK_BTN_0, &broadwell_headset,
> -		broadwell_headset_pins, ARRAY_SIZE(broadwell_headset_pins));
> +		SND_JACK_HEADSET | SND_JACK_BTN_0, &card_headset,
> +		card_headset_pins, ARRAY_SIZE(card_headset_pins));
>  	if (ret)
>  		return ret;
>  
> -	rt286_mic_detect(component, &broadwell_headset);
> +	rt286_mic_detect(component, &card_headset);
>  	return 0;
>  }
>  
>  
> -static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
> +static int codec_link_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
>  			struct snd_pcm_hw_params *params)
>  {
>  	struct snd_interval *rate = hw_param_interval(params,
> @@ -97,7 +97,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
>  	return 0;
>  }
>  
> -static int broadwell_rt286_hw_params(struct snd_pcm_substream *substream,
> +static int codec_link_hw_params(struct snd_pcm_substream *substream,
>  	struct snd_pcm_hw_params *params)
>  {
>  	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
> @@ -115,8 +115,8 @@ static int broadwell_rt286_hw_params(struct snd_pcm_substream *substream,
>  	return ret;
>  }
>  
> -static const struct snd_soc_ops broadwell_rt286_ops = {
> -	.hw_params = broadwell_rt286_hw_params,
> +static const struct snd_soc_ops codec_link_ops = {
> +	.hw_params = codec_link_hw_params,
>  };
>  
>  static const unsigned int channels[] = {
> @@ -129,7 +129,7 @@ static const struct snd_pcm_hw_constraint_list constraints_channels = {
>  	.mask = 0,
>  };
>  
> -static int broadwell_fe_startup(struct snd_pcm_substream *substream)
> +static int bdw_rt286_fe_startup(struct snd_pcm_substream *substream)
>  {
>  	struct snd_pcm_runtime *runtime = substream->runtime;
>  
> @@ -140,8 +140,8 @@ static int broadwell_fe_startup(struct snd_pcm_substream *substream)
>  					  &constraints_channels);
>  }
>  
> -static const struct snd_soc_ops broadwell_fe_ops = {
> -	.startup = broadwell_fe_startup,
> +static const struct snd_soc_ops bdw_rt286_fe_ops = {
> +	.startup = bdw_rt286_fe_startup,
>  };
>  
>  SND_SOC_DAILINK_DEF(system,
> @@ -169,7 +169,7 @@ SND_SOC_DAILINK_DEF(ssp0_port,
>  	    DAILINK_COMP_ARRAY(COMP_CPU("ssp0-port")));
>  
>  /* broadwell digital audio interface glue - connects codec <--> CPU */
> -static struct snd_soc_dai_link broadwell_rt286_dais[] = {
> +static struct snd_soc_dai_link card_dai_links[] = {
>  	/* Front End DAI links */
>  	{
>  		.name = "System PCM",
> @@ -177,7 +177,7 @@ static struct snd_soc_dai_link broadwell_rt286_dais[] = {
>  		.nonatomic = 1,
>  		.dynamic = 1,
>  		.trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
> -		.ops = &broadwell_fe_ops,
> +		.ops = &bdw_rt286_fe_ops,
>  		.dpcm_playback = 1,
>  		.dpcm_capture = 1,
>  		SND_SOC_DAILINK_REG(system, dummy, platform),
> @@ -215,12 +215,12 @@ static struct snd_soc_dai_link broadwell_rt286_dais[] = {
>  		.name = "Codec",
>  		.id = 0,
>  		.no_pcm = 1,
> -		.init = broadwell_rt286_codec_init,
> +		.init = codec_link_init,
>  		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
>  			SND_SOC_DAIFMT_CBC_CFC,
>  		.ignore_pmdown_time = 1,
> -		.be_hw_params_fixup = broadwell_ssp0_fixup,
> -		.ops = &broadwell_rt286_ops,
> +		.be_hw_params_fixup = codec_link_hw_params_fixup,
> +		.ops = &codec_link_ops,
>  		.dpcm_playback = 1,
>  		.dpcm_capture = 1,
>  		SND_SOC_DAILINK_REG(ssp0_port, codec, platform),
> @@ -241,21 +241,21 @@ static void broadwell_disable_jack(struct snd_soc_card *card)
>  	}
>  }
>  
> -static int broadwell_suspend(struct snd_soc_card *card)
> +static int card_suspend_pre(struct snd_soc_card *card)
>  {
>  	broadwell_disable_jack(card);
>  
>  	return 0;
>  }
>  
> -static int broadwell_resume(struct snd_soc_card *card){
> +static int card_resume_post(struct snd_soc_card *card){
>  	struct snd_soc_component *component;
>  
>  	for_each_card_components(card, component) {
>  		if (!strcmp(component->name, "i2c-INT343A:00")) {
>  
>  			dev_dbg(component->dev, "enabling jack detect for resume.\n");
> -			rt286_mic_detect(component, &broadwell_headset);
> +			rt286_mic_detect(component, &card_headset);
>  			break;
>  		}
>  	}
> @@ -270,48 +270,48 @@ static int broadwell_resume(struct snd_soc_card *card){
>  #define DRIVER_NAME NULL /* card name will be used for driver name */
>  
>  /* broadwell audio machine driver for WPT + RT286S */
> -static struct snd_soc_card broadwell_rt286 = {
> +static struct snd_soc_card bdw_rt286_card = {
>  	.owner = THIS_MODULE,
> -	.dai_link = broadwell_rt286_dais,
> -	.num_links = ARRAY_SIZE(broadwell_rt286_dais),
> -	.controls = broadwell_controls,
> -	.num_controls = ARRAY_SIZE(broadwell_controls),
> -	.dapm_widgets = broadwell_widgets,
> -	.num_dapm_widgets = ARRAY_SIZE(broadwell_widgets),
> -	.dapm_routes = broadwell_rt286_map,
> -	.num_dapm_routes = ARRAY_SIZE(broadwell_rt286_map),
> +	.dai_link = card_dai_links,
> +	.num_links = ARRAY_SIZE(card_dai_links),
> +	.controls = card_controls,
> +	.num_controls = ARRAY_SIZE(card_controls),
> +	.dapm_widgets = card_widgets,
> +	.num_dapm_widgets = ARRAY_SIZE(card_widgets),
> +	.dapm_routes = card_routes,
> +	.num_dapm_routes = ARRAY_SIZE(card_routes),
>  	.fully_routed = true,
> -	.suspend_pre = broadwell_suspend,
> -	.resume_post = broadwell_resume,
> +	.suspend_pre = card_suspend_pre,
> +	.resume_post = card_resume_post,
>  };
>  
> -static int broadwell_audio_probe(struct platform_device *pdev)
> +static int bdw_rt286_probe(struct platform_device *pdev)
>  {
>  	struct snd_soc_acpi_mach *mach;
>  	int ret;
>  
> -	broadwell_rt286.dev = &pdev->dev;
> +	bdw_rt286_card.dev = &pdev->dev;
>  
>  	/* override platform name, if required */
>  	mach = pdev->dev.platform_data;
> -	ret = snd_soc_fixup_dai_links_platform_name(&broadwell_rt286,
> +	ret = snd_soc_fixup_dai_links_platform_name(&bdw_rt286_card,
>  						    mach->mach_params.platform);
>  	if (ret)
>  		return ret;
>  
>  	/* set card and driver name */
>  	if (snd_soc_acpi_sof_parent(&pdev->dev)) {
> -		broadwell_rt286.name = SOF_CARD_NAME;
> -		broadwell_rt286.driver_name = SOF_DRIVER_NAME;
> +		bdw_rt286_card.name = SOF_CARD_NAME;
> +		bdw_rt286_card.driver_name = SOF_DRIVER_NAME;
>  	} else {
> -		broadwell_rt286.name = CARD_NAME;
> -		broadwell_rt286.driver_name = DRIVER_NAME;
> +		bdw_rt286_card.name = CARD_NAME;
> +		bdw_rt286_card.driver_name = DRIVER_NAME;
>  	}
>  
> -	return devm_snd_soc_register_card(&pdev->dev, &broadwell_rt286);
> +	return devm_snd_soc_register_card(&pdev->dev, &bdw_rt286_card);
>  }
>  
> -static int broadwell_audio_remove(struct platform_device *pdev)
> +static int bdw_rt286_remove(struct platform_device *pdev)
>  {
>  	struct snd_soc_card *card = platform_get_drvdata(pdev);
>  
> @@ -320,16 +320,16 @@ static int broadwell_audio_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static struct platform_driver broadwell_audio = {
> -	.probe = broadwell_audio_probe,
> -	.remove = broadwell_audio_remove,
> +static struct platform_driver bdw_rt286_driver = {
> +	.probe = bdw_rt286_probe,
> +	.remove = bdw_rt286_remove,
>  	.driver = {
>  		.name = "broadwell-audio",
>  		.pm = &snd_soc_pm_ops
>  	},
>  };
>  
> -module_platform_driver(broadwell_audio)
> +module_platform_driver(bdw_rt286_driver)
>  
>  /* Module information */
>  MODULE_AUTHOR("Liam Girdwood, Xingchao Wang");


More information about the Alsa-devel mailing list