openwrt/target/linux/layerscape/patches-5.4/801-audio-0071-MLK-21957-2-ASoC-fsl_sai-read-SAI-version-and-params.patch
John Audia b4c02c9998 kernel: bump 5.4 to 5.4.73
Removed upstreamed patches:
 generic/pending-5.4
   445-mtd-spinand-gigadevice-Only-one-dummy-byte-in-QUA.patch
   446-mtd-spinand-gigadevice-Add-QE-Bit.patch
 pistachio/patches-5.4
   150-pwm-img-Fix-null-pointer-access-in-probe.patch

Manually rebased:
 layerscape/patches-5.4
   801-audio-0011-Revert-ASoC-fsl_sai-add-of_match-data.patch
   801-audio-0039-MLK-16224-6-ASoC-fsl_sai-fix-DSD-suspend-resume.patch
   801-audio-0073-MLK-21957-3-ASoC-fsl_sai-add-bitcount-and-timestamp-.patch
   820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch

All modifications made by update_kernel.sh

Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711,
              mvebu (mamba, rango), x86_64, ramips/mt7621
Run-tested: ipq806x/R7800, mvebu (mamba, rango), x86_64, ramips (RT-AC57U)

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
[alter 820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-01 14:44:06 +01:00

93 lines
2.6 KiB
Diff

From 34a1cd97a2ef6f68a12ff2f2fd813548e867f72f Mon Sep 17 00:00:00 2001
From: Viorel Suman <viorel.suman@nxp.com>
Date: Thu, 20 Jun 2019 13:25:15 +0300
Subject: [PATCH] MLK-21957-2: ASoC: fsl_sai: read SAI version and params in
probe
Read SAI IP version and parameters in probe function.
Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
---
sound/soc/fsl/fsl_sai.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -465,11 +465,12 @@ static int fsl_sai_set_dai_fmt(struct sn
return ret;
}
-static int fsl_sai_check_ver(struct snd_soc_dai *cpu_dai)
+static int fsl_sai_check_ver(struct device *dev)
{
- struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
+ struct fsl_sai *sai = dev_get_drvdata(dev);
unsigned char offset = sai->soc->reg_offset;
unsigned int val;
+ int ret;
if (FSL_SAI_TCSR(offset) == FSL_SAI_VERID)
return 0;
@@ -477,16 +478,21 @@ static int fsl_sai_check_ver(struct snd_
if (sai->verid.loaded)
return 0;
- sai->verid.loaded = true;
- regmap_read(sai->regmap, FSL_SAI_VERID, &val);
- dev_dbg(cpu_dai->dev, "VERID: 0x%016X\n", val);
+ ret = regmap_read(sai->regmap, FSL_SAI_VERID, &val);
+ if (ret < 0)
+ return ret;
+
+ dev_dbg(dev, "VERID: 0x%016X\n", val);
sai->verid.id = (val & FSL_SAI_VER_ID_MASK) >> FSL_SAI_VER_ID_SHIFT;
sai->verid.extfifo_en = (val & FSL_SAI_VER_EFIFO_EN);
sai->verid.timestamp_en = (val & FSL_SAI_VER_TSTMP_EN);
- regmap_read(sai->regmap, FSL_SAI_PARAM, &val);
- dev_dbg(cpu_dai->dev, "PARAM: 0x%016X\n", val);
+ ret = regmap_read(sai->regmap, FSL_SAI_PARAM, &val);
+ if (ret < 0)
+ return ret;
+
+ dev_dbg(dev, "PARAM: 0x%016X\n", val);
/* max slots per frame, power of 2 */
sai->param.spf = 1 <<
@@ -499,11 +505,13 @@ static int fsl_sai_check_ver(struct snd_
/* number of datalines implemented */
sai->param.dln = val & FSL_SAI_PAR_DLN_MASK;
- dev_dbg(cpu_dai->dev,
+ dev_dbg(dev,
"Version: 0x%08X, SPF: %u, WPF: %u, DLN: %u\n",
sai->verid.id, sai->param.spf, sai->param.wpf, sai->param.dln
);
+ sai->verid.loaded = true;
+
return 0;
}
@@ -521,8 +529,6 @@ static int fsl_sai_set_bclk(struct snd_s
if (sai->slave_mode[tx])
return 0;
- fsl_sai_check_ver(dai);
-
for (id = 0; id < FSL_SAI_MCLK_MAX; id++) {
clk_rate = clk_get_rate(sai->mclk_clk[id]);
if (!clk_rate)
@@ -1520,6 +1526,10 @@ static int fsl_sai_probe(struct platform
platform_set_drvdata(pdev, sai);
+ ret = fsl_sai_check_ver(&pdev->dev);
+ if (ret < 0)
+ dev_warn(&pdev->dev, "Error reading SAI version: %d\n", ret);
+
pm_runtime_enable(&pdev->dev);
regcache_cache_only(sai->regmap, true);