From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
To: jbrunet@baylibre.com, broonie@kernel.org, robh+dt@kernel.org,
mark.rutland@arm.com, alsa-devel@alsa-project.org,
devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org
Cc: lgirdwood@gmail.com,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
linux-kernel@vger.kernel.org, tiwai@suse.com, perex@perex.cz,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] ASoC: meson: aiu: introduce a struct for platform specific information
Date: Thu, 20 Feb 2020 21:57:10 +0100 [thread overview]
Message-ID: <20200220205711.77953-3-martin.blumenstingl@googlemail.com> (raw)
In-Reply-To: <20200220205711.77953-1-martin.blumenstingl@googlemail.com>
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>
---
sound/soc/meson/aiu.c | 19 ++++++++++++++++---
sound/soc/meson/aiu.h | 5 +++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
index d3e2d40e9562..38209312a8c3 100644
--- a/sound/soc/meson/aiu.c
+++ b/sound/soc/meson/aiu.c
@@ -273,6 +273,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);
@@ -322,7 +327,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,
@@ -344,9 +349,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);
diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h
index 06a968c55728..ab003638d5e5 100644
--- a/sound/soc/meson/aiu.h
+++ b/sound/soc/meson/aiu.h
@@ -27,11 +27,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 | \
--
2.25.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2020-02-20 20:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 20:57 [PATCH 0/3] ASoC: meson: aiu: add Meson8 SoC family support Martin Blumenstingl
2020-02-20 20:57 ` [PATCH 1/3] ASoC: meson: aiu: Document Meson8 and Meson8b support in the dt-bindings Martin Blumenstingl
2020-02-21 10:41 ` Jerome Brunet
2020-02-20 20:57 ` Martin Blumenstingl [this message]
2020-02-21 10:41 ` [PATCH 2/3] ASoC: meson: aiu: introduce a struct for platform specific information Jerome Brunet
2020-02-20 20:57 ` [PATCH 3/3] ASoC: meson: aiu: add support for the Meson8 and Meson8b SoC families Martin Blumenstingl
2020-02-21 10:43 ` Jerome Brunet
2020-02-21 15:22 ` Jerome Brunet
2020-04-16 16:08 ` [PATCH 0/3] ASoC: meson: aiu: add Meson8 SoC family support patchwork-bot+linux-amlogic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200220205711.77953-3-martin.blumenstingl@googlemail.com \
--to=martin.blumenstingl@googlemail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jbrunet@baylibre.com \
--cc=lgirdwood@gmail.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®