ASoC: Intel: use platform_data for machine drivers
For some reason we have different mechanisms for passing data to machine drivers. Use the solution used by Atom/SST and SOF instead of using drv_data as done by Skylake. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
b92826fa8c
commit
5a619b9e88
|
@ -984,7 +984,7 @@ static int kabylake_audio_probe(struct platform_device *pdev)
|
|||
kabylake_audio_card->dev = &pdev->dev;
|
||||
snd_soc_card_set_drvdata(kabylake_audio_card, ctx);
|
||||
|
||||
mach = dev_get_drvdata(&pdev->dev);
|
||||
mach = (&pdev->dev)->platform_data;
|
||||
if (mach)
|
||||
dmic_constraints = mach->mach_params.dmic_num == 2 ?
|
||||
&constraints_dmic_2ch : &constraints_dmic_channels;
|
||||
|
|
|
@ -659,7 +659,7 @@ static int kabylake_audio_probe(struct platform_device *pdev)
|
|||
kabylake_audio_card.dev = &pdev->dev;
|
||||
snd_soc_card_set_drvdata(&kabylake_audio_card, ctx);
|
||||
|
||||
mach = dev_get_drvdata(&pdev->dev);
|
||||
mach = (&pdev->dev)->platform_data;
|
||||
if (mach)
|
||||
dmic_constraints = mach->mach_params.dmic_num == 2 ?
|
||||
&constraints_dmic_2ch : &constraints_dmic_channels;
|
||||
|
|
|
@ -146,7 +146,7 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
|
|||
|
||||
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
|
||||
|
||||
mach = dev_get_drvdata(&pdev->dev);
|
||||
mach = (&pdev->dev)->platform_data;
|
||||
if (!mach)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
@ -652,7 +652,7 @@ static int skylake_audio_probe(struct platform_device *pdev)
|
|||
skylake_audio_card.dev = &pdev->dev;
|
||||
snd_soc_card_set_drvdata(&skylake_audio_card, ctx);
|
||||
|
||||
mach = dev_get_drvdata(&pdev->dev);
|
||||
mach = (&pdev->dev)->platform_data;
|
||||
if (mach)
|
||||
dmic_constraints = mach->mach_params.dmic_num == 2 ?
|
||||
&constraints_dmic_2ch : &constraints_dmic_channels;
|
||||
|
|
|
@ -705,7 +705,7 @@ static int skylake_audio_probe(struct platform_device *pdev)
|
|||
skylake_audio_card.dev = &pdev->dev;
|
||||
snd_soc_card_set_drvdata(&skylake_audio_card, ctx);
|
||||
|
||||
mach = dev_get_drvdata(&pdev->dev);
|
||||
mach = (&pdev->dev)->platform_data;
|
||||
if (mach)
|
||||
dmic_constraints = mach->mach_params.dmic_num == 2 ?
|
||||
&constraints_dmic_2ch : &constraints_dmic_channels;
|
||||
|
|
|
@ -534,6 +534,16 @@ static int skl_machine_device_register(struct skl *skl)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
mach->mach_params.platform = dev_name(bus->dev);
|
||||
mach->mach_params.codec_mask = bus->codec_mask;
|
||||
|
||||
ret = platform_device_add_data(pdev, (const void *)mach, sizeof(*mach));
|
||||
if (ret) {
|
||||
dev_err(bus->dev, "failed to add machine device platform data\n");
|
||||
platform_device_put(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = platform_device_add(pdev);
|
||||
if (ret) {
|
||||
dev_err(bus->dev, "failed to add machine device\n");
|
||||
|
@ -541,9 +551,6 @@ static int skl_machine_device_register(struct skl *skl)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
mach->mach_params.platform = dev_name(bus->dev);
|
||||
mach->mach_params.codec_mask = bus->codec_mask;
|
||||
dev_set_drvdata(&pdev->dev, mach);
|
||||
|
||||
skl->i2s_dev = pdev;
|
||||
|
||||
|
|
Loading…
Reference in New Issue