Commit edc76180 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Mark Brown

ASoC: meson: aiu: introduce a struct for platform specific information

Introduce a struct aiu_platform_data to make the driver aware of
platform specific information. Convert the existing check for the
internal stereo audio codec (only available on GXL) to this new struct.
Support for the 32-bit SoCs will need this as well because the
AIU_CLK_CTRL_MORE register doesn't have the I2S divider bits (and we
need to use the I2S divider from AIU_CLK_CTRL instead).
Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20200220205711.77953-3-martin.blumenstingl@googlemail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 62209c9a
...@@ -273,6 +273,11 @@ static int aiu_probe(struct platform_device *pdev) ...@@ -273,6 +273,11 @@ static int aiu_probe(struct platform_device *pdev)
aiu = devm_kzalloc(dev, sizeof(*aiu), GFP_KERNEL); aiu = devm_kzalloc(dev, sizeof(*aiu), GFP_KERNEL);
if (!aiu) if (!aiu)
return -ENOMEM; return -ENOMEM;
aiu->platform = device_get_match_data(dev);
if (!aiu->platform)
return -ENODEV;
platform_set_drvdata(pdev, aiu); platform_set_drvdata(pdev, aiu);
ret = device_reset(dev); ret = device_reset(dev);
...@@ -322,7 +327,7 @@ static int aiu_probe(struct platform_device *pdev) ...@@ -322,7 +327,7 @@ static int aiu_probe(struct platform_device *pdev)
} }
/* Register the internal dac control component on gxl */ /* Register the internal dac control component on gxl */
if (of_device_is_compatible(dev->of_node, "amlogic,aiu-gxl")) { if (aiu->platform->has_acodec) {
ret = aiu_acodec_ctrl_register_component(dev); ret = aiu_acodec_ctrl_register_component(dev);
if (ret) { if (ret) {
dev_err(dev, dev_err(dev,
...@@ -344,9 +349,17 @@ static int aiu_remove(struct platform_device *pdev) ...@@ -344,9 +349,17 @@ static int aiu_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct aiu_platform_data aiu_gxbb_pdata = {
.has_acodec = false,
};
static const struct aiu_platform_data aiu_gxl_pdata = {
.has_acodec = true,
};
static const struct of_device_id aiu_of_match[] = { static const struct of_device_id aiu_of_match[] = {
{ .compatible = "amlogic,aiu-gxbb", }, { .compatible = "amlogic,aiu-gxbb", .data = &aiu_gxbb_pdata },
{ .compatible = "amlogic,aiu-gxl", }, { .compatible = "amlogic,aiu-gxl", .data = &aiu_gxl_pdata },
{} {}
}; };
MODULE_DEVICE_TABLE(of, aiu_of_match); MODULE_DEVICE_TABLE(of, aiu_of_match);
......
...@@ -27,11 +27,16 @@ struct aiu_interface { ...@@ -27,11 +27,16 @@ struct aiu_interface {
int irq; int irq;
}; };
struct aiu_platform_data {
bool has_acodec;
};
struct aiu { struct aiu {
struct clk *pclk; struct clk *pclk;
struct clk *spdif_mclk; struct clk *spdif_mclk;
struct aiu_interface i2s; struct aiu_interface i2s;
struct aiu_interface spdif; struct aiu_interface spdif;
const struct aiu_platform_data *platform;
}; };
#define AIU_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ #define AIU_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment