openwrt/target/linux/layerscape/patches-5.4/801-audio-0071-MLK-21957-2-ASoC-fsl_sai-read-SAI-version-and-params.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02: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)
@@ -1517,6 +1523,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);