aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-4.19/950-0064-ASoC-pcm512x-implement-set_tdm_slot-interface.patch
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-02-08 21:58:55 +0100
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-02-14 14:10:51 +0100
commit7d7aa2fd924c27829ec25f825481554dd81bce97 (patch)
tree658b87b89331670266163e522ea5fb52535633cb /target/linux/bcm27xx/patches-4.19/950-0064-ASoC-pcm512x-implement-set_tdm_slot-interface.patch
parente7bfda2c243e66a75ff966ba04c28b1590b5d24c (diff)
downloadupstream-7d7aa2fd924c27829ec25f825481554dd81bce97.tar.gz
upstream-7d7aa2fd924c27829ec25f825481554dd81bce97.tar.bz2
upstream-7d7aa2fd924c27829ec25f825481554dd81bce97.zip
brcm2708: rename target to bcm27xx
This change makes the names of Broadcom targets consistent by using the common notation based on SoC/CPU ID (which is used internally anyway), bcmXXXX instead of brcmXXXX. This is even used for target TITLE in make menuconfig already, only the short target name used brcm so far. Despite, since subtargets range from bcm2708 to bcm2711, it seems appropriate to use bcm27xx instead of bcm2708 (again, as already done for BOARDNAME). This also renames the packages brcm2708-userland and brcm2708-gpu-fw. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-4.19/950-0064-ASoC-pcm512x-implement-set_tdm_slot-interface.patch')
-rw-r--r--target/linux/bcm27xx/patches-4.19/950-0064-ASoC-pcm512x-implement-set_tdm_slot-interface.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-4.19/950-0064-ASoC-pcm512x-implement-set_tdm_slot-interface.patch b/target/linux/bcm27xx/patches-4.19/950-0064-ASoC-pcm512x-implement-set_tdm_slot-interface.patch
new file mode 100644
index 0000000000..e656c05a55
--- /dev/null
+++ b/target/linux/bcm27xx/patches-4.19/950-0064-ASoC-pcm512x-implement-set_tdm_slot-interface.patch
@@ -0,0 +1,80 @@
+From 5fd7bb26ef791a7da1c0573b980ab4fe6b9c2641 Mon Sep 17 00:00:00 2001
+From: Matthias Reichl <hias@horus.com>
+Date: Thu, 22 Feb 2018 11:55:06 +0100
+Subject: [PATCH] ASoC: pcm512x: implement set_tdm_slot interface
+
+PCM512x can accept data padded with additional BCLK cycles
+but the driver currently lacks an interface to configure this.
+
+This leads to the problem that S24_LE format in master mode
+can result in non-integer clock divisors and pcm512x running
+at a rather off rate.
+
+For example 48kHz with 48fs BCLK and SCLK at 24.576MHz uses
+a divisor of 10 (rounded down from 10.6666) and results in a
+51.2kHz LRCLK. With 64fs BCLK a divisor of 8 is used and
+LRCLK runs at exactly 48kHz.
+
+Fix this by providing a minimal set_tdm_slot implementation
+so machine drivers can optionally configure custom BCLK ratios.
+
+Signed-off-by: Matthias Reichl <hias@horus.com>
+---
+ sound/soc/codecs/pcm512x.c | 28 +++++++++++++++++++++++++++-
+ 1 file changed, 27 insertions(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/pcm512x.c
++++ b/sound/soc/codecs/pcm512x.c
+@@ -53,6 +53,7 @@ struct pcm512x_priv {
+ unsigned long overclock_pll;
+ unsigned long overclock_dac;
+ unsigned long overclock_dsp;
++ int lrclk_div;
+ };
+
+ /*
+@@ -851,7 +852,10 @@ static int pcm512x_set_dividers(struct s
+ int fssp;
+ int gpio;
+
+- lrclk_div = snd_soc_params_to_frame_size(params);
++ if (pcm512x->lrclk_div)
++ lrclk_div = pcm512x->lrclk_div;
++ else
++ lrclk_div = snd_soc_params_to_frame_size(params);
+ if (lrclk_div == 0) {
+ dev_err(dev, "No LRCLK?\n");
+ return -EINVAL;
+@@ -1319,10 +1323,32 @@ static int pcm512x_set_fmt(struct snd_so
+ return 0;
+ }
+
++static int pcm512x_set_tdm_slot(struct snd_soc_dai *dai,
++ unsigned int tx_mask, unsigned int rx_mask,
++ int slots, int width)
++{
++ struct snd_soc_component *component = dai->component;
++ struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component);
++
++ switch (slots) {
++ case 0:
++ pcm512x->lrclk_div = 0;
++ return 0;
++ case 2:
++ if (tx_mask != 0x03 || rx_mask != 0x03)
++ return -EINVAL;
++ pcm512x->lrclk_div = slots * width;
++ return 0;
++ default:
++ return -EINVAL;
++ }
++}
++
+ static const struct snd_soc_dai_ops pcm512x_dai_ops = {
+ .startup = pcm512x_dai_startup,
+ .hw_params = pcm512x_hw_params,
+ .set_fmt = pcm512x_set_fmt,
++ .set_tdm_slot = pcm512x_set_tdm_slot,
+ };
+
+ static struct snd_soc_dai_driver pcm512x_dai = {