Skip to content

Commit

Permalink
ASoC: meson: aiu: introduce a struct for platform specific information
Browse files Browse the repository at this point in the history
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: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
  • Loading branch information
xdarklight committed Feb 16, 2020
1 parent 4262364 commit bdac178
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 16 additions & 3 deletions sound/soc/meson/aiu.c
Expand Up @@ -293,6 +293,11 @@ static int aiu_probe(struct platform_device *pdev)
aiu = devm_kzalloc(dev, sizeof(*aiu), GFP_KERNEL);
if (!aiu)
return -ENOMEM;

aiu->platform = device_get_match_data(dev);
if (!aiu->platform)
return -ENODEV;

platform_set_drvdata(pdev, aiu);

ret = device_reset(dev);
Expand Down Expand Up @@ -342,7 +347,7 @@ static int aiu_probe(struct platform_device *pdev)
}

/* 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);
if (ret) {
dev_err(dev,
Expand All @@ -364,9 +369,17 @@ static int aiu_remove(struct platform_device *pdev)
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[] = {
{ .compatible = "amlogic,aiu-gxbb", },
{ .compatible = "amlogic,aiu-gxl", },
{ .compatible = "amlogic,aiu-gxbb", .data = &aiu_gxbb_pdata },
{ .compatible = "amlogic,aiu-gxl", .data = &aiu_gxl_pdata },
{}
};
MODULE_DEVICE_TABLE(of, aiu_of_match);
Expand Down
5 changes: 5 additions & 0 deletions sound/soc/meson/aiu.h
Expand Up @@ -29,11 +29,16 @@ struct aiu_interface {
int irq;
};

struct aiu_platform_data {
bool has_acodec;
};

struct aiu {
struct clk *pclk;
struct clk *spdif_mclk;
struct aiu_interface i2s;
struct aiu_interface spdif;
const struct aiu_platform_data *platform;
};

#define AIU_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
Expand Down

1 comment on commit bdac178

@jeromebrunet
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.