* [PATCH 0/5] ASoC: es7134: driver updates
@ 2018-06-29 15:09 Jerome Brunet
2018-06-29 15:09 ` [PATCH 1/5] ASoC: es7134: remove 64kHz rate from the supported rates Jerome Brunet
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Jerome Brunet @ 2018-06-29 15:09 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: Jerome Brunet, alsa-devel, linux-kernel
This patchset provides several updates for the es7134 driver
It removes unsupported sample rates, add runtime check of the mclk-fs
ratio as documented in the datasheet and adds the component power
supplies.
Finally support for the es7154 is added.
Jerome Brunet (5):
ASoC: es7134: remove 64kHz rate from the supported rates
ASoC: es7134: check if mclk rate is valid
ASoC: es7134: update DT binding with new compatible and supplies
ASoC: es7134: Add VDD and AVDD power supplies
ASoC: es7134: add support for the es7154
.../devicetree/bindings/sound/everest,es7134.txt | 8 +-
sound/soc/codecs/es7134.c | 176 ++++++++++++++++++++-
2 files changed, 179 insertions(+), 5 deletions(-)
--
2.14.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/5] ASoC: es7134: remove 64kHz rate from the supported rates
2018-06-29 15:09 [PATCH 0/5] ASoC: es7134: driver updates Jerome Brunet
@ 2018-06-29 15:09 ` Jerome Brunet
2018-07-02 10:09 ` Applied "ASoC: es7134: remove 64kHz rate from the supported rates" to the asoc tree Mark Brown
2018-06-29 15:09 ` [PATCH 2/5] ASoC: es7134: check if mclk rate is valid Jerome Brunet
` (3 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Jerome Brunet @ 2018-06-29 15:09 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: Jerome Brunet, alsa-devel, linux-kernel
64Khz is actually not supported by the es7134 according to the datasheet
Fixes: 9000b59d7a12 ("ASoC: es7134: add es7134 DAC driver")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
sound/soc/codecs/es7134.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c
index 58515bb1a303..2fbb49f5b278 100644
--- a/sound/soc/codecs/es7134.c
+++ b/sound/soc/codecs/es7134.c
@@ -48,7 +48,11 @@ static struct snd_soc_dai_driver es7134_dai = {
.stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_192000,
+ .rates = (SNDRV_PCM_RATE_8000_48000 |
+ SNDRV_PCM_RATE_88200 |
+ SNDRV_PCM_RATE_96000 |
+ SNDRV_PCM_RATE_176400 |
+ SNDRV_PCM_RATE_192000),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S18_3LE |
SNDRV_PCM_FMTBIT_S20_3LE |
--
2.14.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/5] ASoC: es7134: check if mclk rate is valid
2018-06-29 15:09 [PATCH 0/5] ASoC: es7134: driver updates Jerome Brunet
2018-06-29 15:09 ` [PATCH 1/5] ASoC: es7134: remove 64kHz rate from the supported rates Jerome Brunet
@ 2018-06-29 15:09 ` Jerome Brunet
2018-07-02 10:09 ` Applied "ASoC: es7134: check if mclk rate is valid" to the asoc tree Mark Brown
2018-06-29 15:09 ` [PATCH 3/5] ASoC: es7134: update DT binding with new compatible and supplies Jerome Brunet
` (2 subsequent siblings)
4 siblings, 1 reply; 14+ messages in thread
From: Jerome Brunet @ 2018-06-29 15:09 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: Jerome Brunet, alsa-devel, linux-kernel
For each supported sample rate, the es7134 can work with several
mclk / sample rate ratio. Check if ratio we get is actually OK.
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
sound/soc/codecs/es7134.c | 119 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 117 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c
index 2fbb49f5b278..698289dc3e22 100644
--- a/sound/soc/codecs/es7134.c
+++ b/sound/soc/codecs/es7134.c
@@ -17,6 +17,7 @@
* in the file called COPYING.
*/
+#include <linux/of_platform.h>
#include <linux/module.h>
#include <sound/soc.h>
@@ -24,6 +25,77 @@
* The everest 7134 is a very simple DA converter with no register
*/
+struct es7134_clock_mode {
+ unsigned int rate_min;
+ unsigned int rate_max;
+ unsigned int *mclk_fs;
+ unsigned int mclk_fs_num;
+};
+
+struct es7134_chip {
+ const struct es7134_clock_mode *modes;
+ unsigned int mode_num;
+};
+
+struct es7134_data {
+ unsigned int mclk;
+ const struct es7134_chip *chip;
+};
+
+static int es7134_check_mclk(struct snd_soc_dai *dai,
+ struct es7134_data *priv,
+ unsigned int rate)
+{
+ unsigned int mfs = priv->mclk / rate;
+ int i, j;
+
+ for (i = 0; i < priv->chip->mode_num; i++) {
+ const struct es7134_clock_mode *mode = &priv->chip->modes[i];
+
+ if (rate < mode->rate_min || rate > mode->rate_max)
+ continue;
+
+ for (j = 0; j < mode->mclk_fs_num; j++) {
+ if (mode->mclk_fs[j] == mfs)
+ return 0;
+ }
+
+ dev_err(dai->dev, "unsupported mclk_fs %u for rate %u\n",
+ mfs, rate);
+ return -EINVAL;
+ }
+
+ /* should not happen */
+ dev_err(dai->dev, "unsupported rate: %u\n", rate);
+ return -EINVAL;
+}
+
+static int es7134_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct es7134_data *priv = snd_soc_dai_get_drvdata(dai);
+
+ /* mclk has not been provided, assume it is OK */
+ if (!priv->mclk)
+ return 0;
+
+ return es7134_check_mclk(dai, priv, params_rate(params));
+}
+
+static int es7134_set_sysclk(struct snd_soc_dai *dai, int clk_id,
+ unsigned int freq, int dir)
+{
+ struct es7134_data *priv = snd_soc_dai_get_drvdata(dai);
+
+ if (dir == SND_SOC_CLOCK_IN && clk_id == 0) {
+ priv->mclk = freq;
+ return 0;
+ }
+
+ return -ENOTSUPP;
+}
+
static int es7134_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{
fmt &= (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK |
@@ -40,6 +112,8 @@ static int es7134_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
static const struct snd_soc_dai_ops es7134_dai_ops = {
.set_fmt = es7134_set_fmt,
+ .hw_params = es7134_hw_params,
+ .set_sysclk = es7134_set_sysclk,
};
static struct snd_soc_dai_driver es7134_dai = {
@@ -62,6 +136,33 @@ static struct snd_soc_dai_driver es7134_dai = {
.ops = &es7134_dai_ops,
};
+static const struct es7134_clock_mode es7134_modes[] = {
+ {
+ /* Single speed mode */
+ .rate_min = 8000,
+ .rate_max = 50000,
+ .mclk_fs = (unsigned int[]) { 256, 384, 512, 768, 1024 },
+ .mclk_fs_num = 5,
+ }, {
+ /* Double speed mode */
+ .rate_min = 84000,
+ .rate_max = 100000,
+ .mclk_fs = (unsigned int[]) { 128, 192, 256, 384, 512 },
+ .mclk_fs_num = 5,
+ }, {
+ /* Quad speed mode */
+ .rate_min = 167000,
+ .rate_max = 192000,
+ .mclk_fs = (unsigned int[]) { 128, 192, 256 },
+ .mclk_fs_num = 3,
+ },
+};
+
+static const struct es7134_chip es7134_chip = {
+ .modes = es7134_modes,
+ .mode_num = ARRAY_SIZE(es7134_modes),
+};
+
static const struct snd_soc_dapm_widget es7134_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("AOUTL"),
SND_SOC_DAPM_OUTPUT("AOUTR"),
@@ -86,6 +187,20 @@ static const struct snd_soc_component_driver es7134_component_driver = {
static int es7134_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
+ struct es7134_data *priv;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+ platform_set_drvdata(pdev, priv);
+
+ priv->chip = of_device_get_match_data(dev);
+ if (!priv->chip) {
+ dev_err(dev, "failed to match device\n");
+ return -ENODEV;
+ }
+
return devm_snd_soc_register_component(&pdev->dev,
&es7134_component_driver,
&es7134_dai, 1);
@@ -93,8 +208,8 @@ static int es7134_probe(struct platform_device *pdev)
#ifdef CONFIG_OF
static const struct of_device_id es7134_ids[] = {
- { .compatible = "everest,es7134", },
- { .compatible = "everest,es7144", },
+ { .compatible = "everest,es7134", .data = &es7134_chip },
+ { .compatible = "everest,es7144", .data = &es7134_chip },
{ }
};
MODULE_DEVICE_TABLE(of, es7134_ids);
--
2.14.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/5] ASoC: es7134: update DT binding with new compatible and supplies
2018-06-29 15:09 [PATCH 0/5] ASoC: es7134: driver updates Jerome Brunet
2018-06-29 15:09 ` [PATCH 1/5] ASoC: es7134: remove 64kHz rate from the supported rates Jerome Brunet
2018-06-29 15:09 ` [PATCH 2/5] ASoC: es7134: check if mclk rate is valid Jerome Brunet
@ 2018-06-29 15:09 ` Jerome Brunet
2018-07-02 10:04 ` Mark Brown
2018-06-29 15:09 ` [PATCH 4/5] ASoC: es7134: Add VDD and AVDD power supplies Jerome Brunet
2018-06-29 15:09 ` [PATCH 5/5] ASoC: es7134: add support for the es7154 Jerome Brunet
4 siblings, 1 reply; 14+ messages in thread
From: Jerome Brunet @ 2018-06-29 15:09 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: Jerome Brunet, alsa-devel, linux-kernel
Update the documentation to add support for the es7154 and
optional power supplies phandles.
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
Documentation/devicetree/bindings/sound/everest,es7134.txt | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/everest,es7134.txt b/Documentation/devicetree/bindings/sound/everest,es7134.txt
index 5495a3cb8b7b..c6bcdc5bded8 100644
--- a/Documentation/devicetree/bindings/sound/everest,es7134.txt
+++ b/Documentation/devicetree/bindings/sound/everest,es7134.txt
@@ -1,7 +1,13 @@
ES7134 i2s DA converter
Required properties:
-- compatible : "everest,es7134" or "everest,es7144"
+- compatible : "everest,es7134" or
+ "everest,es7144" or
+ "everest,es7154"
+
+Optional properties:
+- VDD-supply: regulator phandle for the VDD supply
+- AVDD-supply: regulator phandle for the AVDD supply
Example:
--
2.14.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/5] ASoC: es7134: Add VDD and AVDD power supplies
2018-06-29 15:09 [PATCH 0/5] ASoC: es7134: driver updates Jerome Brunet
` (2 preceding siblings ...)
2018-06-29 15:09 ` [PATCH 3/5] ASoC: es7134: update DT binding with new compatible and supplies Jerome Brunet
@ 2018-06-29 15:09 ` Jerome Brunet
2018-07-02 10:09 ` Applied "ASoC: es7134: Add VDD and AVDD power supplies" to the asoc tree Mark Brown
2018-06-29 15:09 ` [PATCH 5/5] ASoC: es7134: add support for the es7154 Jerome Brunet
4 siblings, 1 reply; 14+ messages in thread
From: Jerome Brunet @ 2018-06-29 15:09 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: Jerome Brunet, alsa-devel, linux-kernel
Add the VDD and AVDD power supplies to the DAPM graph as some board may
need to enable a regulator to turn them on.
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
sound/soc/codecs/es7134.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c
index 698289dc3e22..5ad59c38fed1 100644
--- a/sound/soc/codecs/es7134.c
+++ b/sound/soc/codecs/es7134.c
@@ -167,11 +167,15 @@ static const struct snd_soc_dapm_widget es7134_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("AOUTL"),
SND_SOC_DAPM_OUTPUT("AOUTR"),
SND_SOC_DAPM_DAC("DAC", "Playback", SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_REGULATOR_SUPPLY("VDD", 0, 0),
+ SND_SOC_DAPM_REGULATOR_SUPPLY("AVDD", 0, 0),
};
static const struct snd_soc_dapm_route es7134_dapm_routes[] = {
{ "AOUTL", NULL, "DAC" },
{ "AOUTR", NULL, "DAC" },
+ { "Playback", NULL, "VDD" },
+ { "DAC", NULL, "AVDD" },
};
static const struct snd_soc_component_driver es7134_component_driver = {
--
2.14.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/5] ASoC: es7134: add support for the es7154
2018-06-29 15:09 [PATCH 0/5] ASoC: es7134: driver updates Jerome Brunet
` (3 preceding siblings ...)
2018-06-29 15:09 ` [PATCH 4/5] ASoC: es7134: Add VDD and AVDD power supplies Jerome Brunet
@ 2018-06-29 15:09 ` Jerome Brunet
2018-07-02 10:05 ` Mark Brown
4 siblings, 1 reply; 14+ messages in thread
From: Jerome Brunet @ 2018-06-29 15:09 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: Jerome Brunet, alsa-devel, linux-kernel
Add support for the es7154 which is basically an es7134 with an
embedded power amplifier and lower maximum sample rate
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
sound/soc/codecs/es7134.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c
index 5ad59c38fed1..935bed820ba5 100644
--- a/sound/soc/codecs/es7134.c
+++ b/sound/soc/codecs/es7134.c
@@ -33,6 +33,7 @@ struct es7134_clock_mode {
};
struct es7134_chip {
+ struct snd_soc_dai_driver *dai_drv;
const struct es7134_clock_mode *modes;
unsigned int mode_num;
};
@@ -159,6 +160,7 @@ static const struct es7134_clock_mode es7134_modes[] = {
};
static const struct es7134_chip es7134_chip = {
+ .dai_drv = &es7134_dai,
.modes = es7134_modes,
.mode_num = ARRAY_SIZE(es7134_modes),
};
@@ -189,6 +191,48 @@ static const struct snd_soc_component_driver es7134_component_driver = {
.non_legacy_dai_naming = 1,
};
+static struct snd_soc_dai_driver es7154_dai = {
+ .name = "es7154-hifi",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 2,
+ .channels_max = 2,
+ .rates = (SNDRV_PCM_RATE_8000_48000 |
+ SNDRV_PCM_RATE_88200 |
+ SNDRV_PCM_RATE_96000),
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE |
+ SNDRV_PCM_FMTBIT_S18_3LE |
+ SNDRV_PCM_FMTBIT_S20_3LE |
+ SNDRV_PCM_FMTBIT_S24_3LE |
+ SNDRV_PCM_FMTBIT_S24_LE),
+ },
+ .ops = &es7134_dai_ops,
+};
+
+static const struct es7134_clock_mode es7154_modes[] = {
+ {
+ /* Single speed mode */
+ .rate_min = 8000,
+ .rate_max = 50000,
+ .mclk_fs = (unsigned int[]) { 32, 64, 128, 192, 256,
+ 384, 512, 768, 1024 },
+ .mclk_fs_num = 9,
+ }, {
+ /* Double speed mode */
+ .rate_min = 84000,
+ .rate_max = 100000,
+ .mclk_fs = (unsigned int[]) { 128, 192, 256, 384, 512,
+ 768, 1024},
+ .mclk_fs_num = 7,
+ }
+};
+
+static const struct es7134_chip es7154_chip = {
+ .dai_drv = &es7154_dai,
+ .modes = es7154_modes,
+ .mode_num = ARRAY_SIZE(es7154_modes),
+};
+
static int es7134_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -207,13 +251,14 @@ static int es7134_probe(struct platform_device *pdev)
return devm_snd_soc_register_component(&pdev->dev,
&es7134_component_driver,
- &es7134_dai, 1);
+ priv->chip->dai_drv, 1);
}
#ifdef CONFIG_OF
static const struct of_device_id es7134_ids[] = {
{ .compatible = "everest,es7134", .data = &es7134_chip },
{ .compatible = "everest,es7144", .data = &es7134_chip },
+ { .compatible = "everest,es7154", .data = &es7154_chip },
{ }
};
MODULE_DEVICE_TABLE(of, es7134_ids);
--
2.14.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 3/5] ASoC: es7134: update DT binding with new compatible and supplies
2018-06-29 15:09 ` [PATCH 3/5] ASoC: es7134: update DT binding with new compatible and supplies Jerome Brunet
@ 2018-07-02 10:04 ` Mark Brown
2018-07-02 10:11 ` Jerome Brunet
0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2018-07-02 10:04 UTC (permalink / raw)
To: Jerome Brunet; +Cc: Liam Girdwood, alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 441 bytes --]
On Fri, Jun 29, 2018 at 05:09:22PM +0200, Jerome Brunet wrote:
> Update the documentation to add support for the es7154 and
> optional power supplies phandles.
> +Optional properties:
> +- VDD-supply: regulator phandle for the VDD supply
> +- AVDD-supply: regulator phandle for the AVDD supply
Unless the device is able to work with a power supply missing (which
doesn't seem entirely credible) supply properties should never be
optional.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/5] ASoC: es7134: add support for the es7154
2018-06-29 15:09 ` [PATCH 5/5] ASoC: es7134: add support for the es7154 Jerome Brunet
@ 2018-07-02 10:05 ` Mark Brown
2018-07-02 10:15 ` Jerome Brunet
0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2018-07-02 10:05 UTC (permalink / raw)
To: Jerome Brunet; +Cc: Liam Girdwood, alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 307 bytes --]
On Fri, Jun 29, 2018 at 05:09:24PM +0200, Jerome Brunet wrote:
> { .compatible = "everest,es7134", .data = &es7134_chip },
> { .compatible = "everest,es7144", .data = &es7134_chip },
> + { .compatible = "everest,es7154", .data = &es7154_chip },
> { }
This needs to be added to the DT documentation.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Applied "ASoC: es7134: Add VDD and AVDD power supplies" to the asoc tree
2018-06-29 15:09 ` [PATCH 4/5] ASoC: es7134: Add VDD and AVDD power supplies Jerome Brunet
@ 2018-07-02 10:09 ` Mark Brown
0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2018-07-02 10:09 UTC (permalink / raw)
To: Jerome Brunet
Cc: Mark Brown, Liam Girdwood, Mark Brown, alsa-devel, linux-kernel,
alsa-devel
The patch
ASoC: es7134: Add VDD and AVDD power supplies
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From 424e2b4b3521334812d833eef27df77671428698 Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Fri, 29 Jun 2018 17:09:23 +0200
Subject: [PATCH] ASoC: es7134: Add VDD and AVDD power supplies
Add the VDD and AVDD power supplies to the DAPM graph as some board may
need to enable a regulator to turn them on.
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/es7134.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c
index 698289dc3e22..5ad59c38fed1 100644
--- a/sound/soc/codecs/es7134.c
+++ b/sound/soc/codecs/es7134.c
@@ -167,11 +167,15 @@ static const struct snd_soc_dapm_widget es7134_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("AOUTL"),
SND_SOC_DAPM_OUTPUT("AOUTR"),
SND_SOC_DAPM_DAC("DAC", "Playback", SND_SOC_NOPM, 0, 0),
+ SND_SOC_DAPM_REGULATOR_SUPPLY("VDD", 0, 0),
+ SND_SOC_DAPM_REGULATOR_SUPPLY("AVDD", 0, 0),
};
static const struct snd_soc_dapm_route es7134_dapm_routes[] = {
{ "AOUTL", NULL, "DAC" },
{ "AOUTR", NULL, "DAC" },
+ { "Playback", NULL, "VDD" },
+ { "DAC", NULL, "AVDD" },
};
static const struct snd_soc_component_driver es7134_component_driver = {
--
2.18.0.rc2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Applied "ASoC: es7134: check if mclk rate is valid" to the asoc tree
2018-06-29 15:09 ` [PATCH 2/5] ASoC: es7134: check if mclk rate is valid Jerome Brunet
@ 2018-07-02 10:09 ` Mark Brown
0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2018-07-02 10:09 UTC (permalink / raw)
To: Jerome Brunet
Cc: Mark Brown, Liam Girdwood, Mark Brown, alsa-devel, linux-kernel,
alsa-devel
The patch
ASoC: es7134: check if mclk rate is valid
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From a016b11cc41df06b79c0c226e719d0d88373919c Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Fri, 29 Jun 2018 17:09:21 +0200
Subject: [PATCH] ASoC: es7134: check if mclk rate is valid
For each supported sample rate, the es7134 can work with several
mclk / sample rate ratio. Check if ratio we get is actually OK.
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/es7134.c | 119 +++++++++++++++++++++++++++++++++++++-
1 file changed, 117 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c
index 2fbb49f5b278..698289dc3e22 100644
--- a/sound/soc/codecs/es7134.c
+++ b/sound/soc/codecs/es7134.c
@@ -17,6 +17,7 @@
* in the file called COPYING.
*/
+#include <linux/of_platform.h>
#include <linux/module.h>
#include <sound/soc.h>
@@ -24,6 +25,77 @@
* The everest 7134 is a very simple DA converter with no register
*/
+struct es7134_clock_mode {
+ unsigned int rate_min;
+ unsigned int rate_max;
+ unsigned int *mclk_fs;
+ unsigned int mclk_fs_num;
+};
+
+struct es7134_chip {
+ const struct es7134_clock_mode *modes;
+ unsigned int mode_num;
+};
+
+struct es7134_data {
+ unsigned int mclk;
+ const struct es7134_chip *chip;
+};
+
+static int es7134_check_mclk(struct snd_soc_dai *dai,
+ struct es7134_data *priv,
+ unsigned int rate)
+{
+ unsigned int mfs = priv->mclk / rate;
+ int i, j;
+
+ for (i = 0; i < priv->chip->mode_num; i++) {
+ const struct es7134_clock_mode *mode = &priv->chip->modes[i];
+
+ if (rate < mode->rate_min || rate > mode->rate_max)
+ continue;
+
+ for (j = 0; j < mode->mclk_fs_num; j++) {
+ if (mode->mclk_fs[j] == mfs)
+ return 0;
+ }
+
+ dev_err(dai->dev, "unsupported mclk_fs %u for rate %u\n",
+ mfs, rate);
+ return -EINVAL;
+ }
+
+ /* should not happen */
+ dev_err(dai->dev, "unsupported rate: %u\n", rate);
+ return -EINVAL;
+}
+
+static int es7134_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct es7134_data *priv = snd_soc_dai_get_drvdata(dai);
+
+ /* mclk has not been provided, assume it is OK */
+ if (!priv->mclk)
+ return 0;
+
+ return es7134_check_mclk(dai, priv, params_rate(params));
+}
+
+static int es7134_set_sysclk(struct snd_soc_dai *dai, int clk_id,
+ unsigned int freq, int dir)
+{
+ struct es7134_data *priv = snd_soc_dai_get_drvdata(dai);
+
+ if (dir == SND_SOC_CLOCK_IN && clk_id == 0) {
+ priv->mclk = freq;
+ return 0;
+ }
+
+ return -ENOTSUPP;
+}
+
static int es7134_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
{
fmt &= (SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK |
@@ -40,6 +112,8 @@ static int es7134_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
static const struct snd_soc_dai_ops es7134_dai_ops = {
.set_fmt = es7134_set_fmt,
+ .hw_params = es7134_hw_params,
+ .set_sysclk = es7134_set_sysclk,
};
static struct snd_soc_dai_driver es7134_dai = {
@@ -62,6 +136,33 @@ static struct snd_soc_dai_driver es7134_dai = {
.ops = &es7134_dai_ops,
};
+static const struct es7134_clock_mode es7134_modes[] = {
+ {
+ /* Single speed mode */
+ .rate_min = 8000,
+ .rate_max = 50000,
+ .mclk_fs = (unsigned int[]) { 256, 384, 512, 768, 1024 },
+ .mclk_fs_num = 5,
+ }, {
+ /* Double speed mode */
+ .rate_min = 84000,
+ .rate_max = 100000,
+ .mclk_fs = (unsigned int[]) { 128, 192, 256, 384, 512 },
+ .mclk_fs_num = 5,
+ }, {
+ /* Quad speed mode */
+ .rate_min = 167000,
+ .rate_max = 192000,
+ .mclk_fs = (unsigned int[]) { 128, 192, 256 },
+ .mclk_fs_num = 3,
+ },
+};
+
+static const struct es7134_chip es7134_chip = {
+ .modes = es7134_modes,
+ .mode_num = ARRAY_SIZE(es7134_modes),
+};
+
static const struct snd_soc_dapm_widget es7134_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("AOUTL"),
SND_SOC_DAPM_OUTPUT("AOUTR"),
@@ -86,6 +187,20 @@ static const struct snd_soc_component_driver es7134_component_driver = {
static int es7134_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
+ struct es7134_data *priv;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+ platform_set_drvdata(pdev, priv);
+
+ priv->chip = of_device_get_match_data(dev);
+ if (!priv->chip) {
+ dev_err(dev, "failed to match device\n");
+ return -ENODEV;
+ }
+
return devm_snd_soc_register_component(&pdev->dev,
&es7134_component_driver,
&es7134_dai, 1);
@@ -93,8 +208,8 @@ static int es7134_probe(struct platform_device *pdev)
#ifdef CONFIG_OF
static const struct of_device_id es7134_ids[] = {
- { .compatible = "everest,es7134", },
- { .compatible = "everest,es7144", },
+ { .compatible = "everest,es7134", .data = &es7134_chip },
+ { .compatible = "everest,es7144", .data = &es7134_chip },
{ }
};
MODULE_DEVICE_TABLE(of, es7134_ids);
--
2.18.0.rc2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Applied "ASoC: es7134: remove 64kHz rate from the supported rates" to the asoc tree
2018-06-29 15:09 ` [PATCH 1/5] ASoC: es7134: remove 64kHz rate from the supported rates Jerome Brunet
@ 2018-07-02 10:09 ` Mark Brown
0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2018-07-02 10:09 UTC (permalink / raw)
To: Jerome Brunet
Cc: Mark Brown, Liam Girdwood, Mark Brown, alsa-devel, linux-kernel,
alsa-devel
The patch
ASoC: es7134: remove 64kHz rate from the supported rates
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
From 5650729f9a1bbf65b57139d855dabe0a7e6cb494 Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Fri, 29 Jun 2018 17:09:20 +0200
Subject: [PATCH] ASoC: es7134: remove 64kHz rate from the supported rates
64Khz is actually not supported by the es7134 according to the datasheet
Fixes: 9000b59d7a12 ("ASoC: es7134: add es7134 DAC driver")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/es7134.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/es7134.c b/sound/soc/codecs/es7134.c
index 58515bb1a303..2fbb49f5b278 100644
--- a/sound/soc/codecs/es7134.c
+++ b/sound/soc/codecs/es7134.c
@@ -48,7 +48,11 @@ static struct snd_soc_dai_driver es7134_dai = {
.stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_192000,
+ .rates = (SNDRV_PCM_RATE_8000_48000 |
+ SNDRV_PCM_RATE_88200 |
+ SNDRV_PCM_RATE_96000 |
+ SNDRV_PCM_RATE_176400 |
+ SNDRV_PCM_RATE_192000),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S18_3LE |
SNDRV_PCM_FMTBIT_S20_3LE |
--
2.18.0.rc2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 3/5] ASoC: es7134: update DT binding with new compatible and supplies
2018-07-02 10:04 ` Mark Brown
@ 2018-07-02 10:11 ` Jerome Brunet
0 siblings, 0 replies; 14+ messages in thread
From: Jerome Brunet @ 2018-07-02 10:11 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, linux-kernel
On Mon, 2018-07-02 at 11:04 +0100, Mark Brown wrote:
> On Fri, Jun 29, 2018 at 05:09:22PM +0200, Jerome Brunet wrote:
> > Update the documentation to add support for the es7154 and
> > optional power supplies phandles.
> > +Optional properties:
> > +- VDD-supply: regulator phandle for the VDD supply
> > +- AVDD-supply: regulator phandle for the AVDD supply
>
> Unless the device is able to work with a power supply missing (which
> doesn't seem entirely credible) supply properties should never be
> optional.
Sure the device cannot work without its physical supplies.
I'll resubmit
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/5] ASoC: es7134: add support for the es7154
2018-07-02 10:05 ` Mark Brown
@ 2018-07-02 10:15 ` Jerome Brunet
2018-07-02 10:21 ` Mark Brown
0 siblings, 1 reply; 14+ messages in thread
From: Jerome Brunet @ 2018-07-02 10:15 UTC (permalink / raw)
To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, linux-kernel
On Mon, 2018-07-02 at 11:05 +0100, Mark Brown wrote:
> On Fri, Jun 29, 2018 at 05:09:24PM +0200, Jerome Brunet wrote:
>
> > { .compatible = "everest,es7134", .data = &es7134_chip },
> > { .compatible = "everest,es7144", .data = &es7134_chip },
> > + { .compatible = "everest,es7154", .data = &es7154_chip },
> > { }
>
> This needs to be added to the DT documentation.
I believe I added this in patch 3 of this serie, which I'll resubmit.
Shall I resubmit this patch along with it ?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 5/5] ASoC: es7134: add support for the es7154
2018-07-02 10:15 ` Jerome Brunet
@ 2018-07-02 10:21 ` Mark Brown
0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2018-07-02 10:21 UTC (permalink / raw)
To: Jerome Brunet; +Cc: Liam Girdwood, alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 582 bytes --]
On Mon, Jul 02, 2018 at 12:15:28PM +0200, Jerome Brunet wrote:
> On Mon, 2018-07-02 at 11:05 +0100, Mark Brown wrote:
> > On Fri, Jun 29, 2018 at 05:09:24PM +0200, Jerome Brunet wrote:
> > > { .compatible = "everest,es7134", .data = &es7134_chip },
> > > { .compatible = "everest,es7144", .data = &es7134_chip },
> > > + { .compatible = "everest,es7154", .data = &es7154_chip },
> > > { }
> > This needs to be added to the DT documentation.
> I believe I added this in patch 3 of this serie, which I'll resubmit.
> Shall I resubmit this patch along with it ?
Yes, please.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2018-07-02 10:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-29 15:09 [PATCH 0/5] ASoC: es7134: driver updates Jerome Brunet
2018-06-29 15:09 ` [PATCH 1/5] ASoC: es7134: remove 64kHz rate from the supported rates Jerome Brunet
2018-07-02 10:09 ` Applied "ASoC: es7134: remove 64kHz rate from the supported rates" to the asoc tree Mark Brown
2018-06-29 15:09 ` [PATCH 2/5] ASoC: es7134: check if mclk rate is valid Jerome Brunet
2018-07-02 10:09 ` Applied "ASoC: es7134: check if mclk rate is valid" to the asoc tree Mark Brown
2018-06-29 15:09 ` [PATCH 3/5] ASoC: es7134: update DT binding with new compatible and supplies Jerome Brunet
2018-07-02 10:04 ` Mark Brown
2018-07-02 10:11 ` Jerome Brunet
2018-06-29 15:09 ` [PATCH 4/5] ASoC: es7134: Add VDD and AVDD power supplies Jerome Brunet
2018-07-02 10:09 ` Applied "ASoC: es7134: Add VDD and AVDD power supplies" to the asoc tree Mark Brown
2018-06-29 15:09 ` [PATCH 5/5] ASoC: es7134: add support for the es7154 Jerome Brunet
2018-07-02 10:05 ` Mark Brown
2018-07-02 10:15 ` Jerome Brunet
2018-07-02 10:21 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox