summaryrefslogtreecommitdiff
path: root/sound/soc/fsl
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl-asoc-card.c4
-rw-r--r--sound/soc/fsl/fsl_aud2htx.h3
-rw-r--r--sound/soc/fsl/fsl_micfil.c140
-rw-r--r--sound/soc/fsl/fsl_sai.c11
-rw-r--r--sound/soc/fsl/fsl_spdif.c16
-rw-r--r--sound/soc/fsl/fsl_xcvr.c88
-rw-r--r--sound/soc/fsl/imx-rpmsg.c2
7 files changed, 166 insertions, 98 deletions
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 71113886e494..2c7eb0baa0f3 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -536,7 +536,7 @@ static int hp_jack_event(struct notifier_block *nb, unsigned long event,
void *data)
{
struct snd_soc_jack *jack = (struct snd_soc_jack *)data;
- struct snd_soc_dapm_context *dapm = &jack->card->dapm;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(jack->card);
if (event & SND_JACK_HEADPHONE)
/* Disable speaker if headphone is plugged in */
@@ -553,7 +553,7 @@ static int mic_jack_event(struct notifier_block *nb, unsigned long event,
void *data)
{
struct snd_soc_jack *jack = (struct snd_soc_jack *)data;
- struct snd_soc_dapm_context *dapm = &jack->card->dapm;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(jack->card);
if (event & SND_JACK_MICROPHONE)
/* Disable dmic if microphone is plugged in */
diff --git a/sound/soc/fsl/fsl_aud2htx.h b/sound/soc/fsl/fsl_aud2htx.h
index ad70d6a7694c..cf292e3ccc02 100644
--- a/sound/soc/fsl/fsl_aud2htx.h
+++ b/sound/soc/fsl/fsl_aud2htx.h
@@ -7,7 +7,8 @@
#define _FSL_AUD2HTX_H
#define FSL_AUD2HTX_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | \
- SNDRV_PCM_FMTBIT_S32_LE)
+ SNDRV_PCM_FMTBIT_S32_LE | \
+ SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
/* AUD2HTX Register Map */
#define AUD2HTX_CTRL 0x0 /* AUD2HTX Control Register */
diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index aabd90a8b3ec..d6cde2757c6d 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -17,6 +17,7 @@
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/dma/imx-dma.h>
+#include <linux/log2.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -92,6 +93,9 @@ struct fsl_micfil_soc_data {
bool volume_sx;
u64 formats;
int fifo_offset;
+ enum quality default_quality;
+ /* stores const value in formula to calculate range */
+ int rangeadj_const[3][2];
};
static struct fsl_micfil_soc_data fsl_micfil_imx8mm = {
@@ -102,6 +106,7 @@ static struct fsl_micfil_soc_data fsl_micfil_imx8mm = {
.formats = SNDRV_PCM_FMTBIT_S16_LE,
.volume_sx = true,
.fifo_offset = 0,
+ .default_quality = QUALITY_VLOW0,
};
static struct fsl_micfil_soc_data fsl_micfil_imx8mp = {
@@ -112,6 +117,8 @@ static struct fsl_micfil_soc_data fsl_micfil_imx8mp = {
.formats = SNDRV_PCM_FMTBIT_S32_LE,
.volume_sx = false,
.fifo_offset = 0,
+ .default_quality = QUALITY_MEDIUM,
+ .rangeadj_const = {{27, 7}, {27, 7}, {26, 7}},
};
static struct fsl_micfil_soc_data fsl_micfil_imx93 = {
@@ -124,6 +131,8 @@ static struct fsl_micfil_soc_data fsl_micfil_imx93 = {
.use_verid = true,
.volume_sx = false,
.fifo_offset = 0,
+ .default_quality = QUALITY_MEDIUM,
+ .rangeadj_const = {{30, 6}, {30, 6}, {29, 6}},
};
static struct fsl_micfil_soc_data fsl_micfil_imx943 = {
@@ -131,11 +140,13 @@ static struct fsl_micfil_soc_data fsl_micfil_imx943 = {
.fifos = 8,
.fifo_depth = 32,
.dataline = 0xf,
- .formats = SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_DSD_U32_BE,
+ .formats = SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_DSD_U32_LE,
.use_edma = true,
.use_verid = true,
.volume_sx = false,
.fifo_offset = -4,
+ .default_quality = QUALITY_MEDIUM,
+ .rangeadj_const = {{34, 6}, {34, 6}, {33, 6}},
};
static const struct of_device_id fsl_micfil_dt_ids[] = {
@@ -162,9 +173,69 @@ static const struct soc_enum fsl_micfil_quality_enum =
static DECLARE_TLV_DB_SCALE(gain_tlv, 0, 100, 0);
+static int micfil_get_max_range(struct fsl_micfil *micfil)
+{
+ int max_range;
+
+ switch (micfil->quality) {
+ case QUALITY_HIGH:
+ case QUALITY_VLOW0:
+ max_range = micfil->soc->rangeadj_const[0][0] - micfil->soc->rangeadj_const[0][1] *
+ ilog2(2 * MICFIL_OSR_DEFAULT);
+ break;
+ case QUALITY_MEDIUM:
+ case QUALITY_VLOW1:
+ max_range = micfil->soc->rangeadj_const[1][0] - micfil->soc->rangeadj_const[1][1] *
+ ilog2(MICFIL_OSR_DEFAULT);
+ break;
+ case QUALITY_LOW:
+ case QUALITY_VLOW2:
+ max_range = micfil->soc->rangeadj_const[2][0] - micfil->soc->rangeadj_const[2][1] *
+ ilog2(MICFIL_OSR_DEFAULT);
+ break;
+ default:
+ return 0;
+ }
+ max_range = max_range < 0 ? 0 : max_range;
+
+ return max_range;
+}
+
+static int micfil_range_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
+ struct fsl_micfil *micfil = snd_soc_component_get_drvdata(cmpnt);
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+ unsigned int shift = mc->shift;
+ int max_range, new_range;
+
+ new_range = ucontrol->value.integer.value[0];
+ max_range = micfil_get_max_range(micfil);
+ if (new_range > max_range)
+ dev_warn(&micfil->pdev->dev, "range makes channel %d data unreliable\n", shift / 4);
+
+ regmap_update_bits(micfil->regmap, REG_MICFIL_OUT_CTRL, 0xF << shift, new_range << shift);
+
+ return 0;
+}
+
static int micfil_set_quality(struct fsl_micfil *micfil)
{
- u32 qsel;
+ int range, max_range;
+ u32 qsel, val;
+ int i;
+
+ if (!micfil->soc->volume_sx) {
+ regmap_read(micfil->regmap, REG_MICFIL_OUT_CTRL, &val);
+ max_range = micfil_get_max_range(micfil);
+ for (i = 0; i < micfil->soc->fifos; i++) {
+ range = (val >> MICFIL_OUTGAIN_CHX_SHIFT(i)) & 0xF;
+ if (range > max_range)
+ dev_warn(&micfil->pdev->dev, "please reset channel %d range\n", i);
+ }
+ }
switch (micfil->quality) {
case QUALITY_HIGH:
@@ -197,7 +268,7 @@ static int micfil_set_quality(struct fsl_micfil *micfil)
static int micfil_quality_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(cmpnt);
ucontrol->value.integer.value[0] = micfil->quality;
@@ -208,7 +279,7 @@ static int micfil_quality_get(struct snd_kcontrol *kcontrol,
static int micfil_quality_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
struct fsl_micfil *micfil = snd_soc_component_get_drvdata(cmpnt);
micfil->quality = ucontrol->value.integer.value[0];
@@ -362,23 +433,31 @@ static int hwvad_detected(struct snd_kcontrol *kcontrol,
return 0;
}
-static const struct snd_kcontrol_new fsl_micfil_volume_controls[] = {
- SOC_SINGLE_TLV("CH0 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(0), 0xF, 0, gain_tlv),
- SOC_SINGLE_TLV("CH1 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(1), 0xF, 0, gain_tlv),
- SOC_SINGLE_TLV("CH2 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(2), 0xF, 0, gain_tlv),
- SOC_SINGLE_TLV("CH3 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(3), 0xF, 0, gain_tlv),
- SOC_SINGLE_TLV("CH4 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(4), 0xF, 0, gain_tlv),
- SOC_SINGLE_TLV("CH5 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(5), 0xF, 0, gain_tlv),
- SOC_SINGLE_TLV("CH6 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(6), 0xF, 0, gain_tlv),
- SOC_SINGLE_TLV("CH7 Volume", REG_MICFIL_OUT_CTRL,
- MICFIL_OUTGAIN_CHX_SHIFT(7), 0xF, 0, gain_tlv),
+static const struct snd_kcontrol_new fsl_micfil_range_controls[] = {
+ SOC_SINGLE_EXT("CH0 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(0), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
+ SOC_SINGLE_EXT("CH1 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(1), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
+ SOC_SINGLE_EXT("CH2 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(2), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
+ SOC_SINGLE_EXT("CH3 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(3), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
+ SOC_SINGLE_EXT("CH4 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(4), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
+ SOC_SINGLE_EXT("CH5 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(5), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
+ SOC_SINGLE_EXT("CH6 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(6), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
+ SOC_SINGLE_EXT("CH7 Range", REG_MICFIL_OUT_CTRL,
+ MICFIL_OUTGAIN_CHX_SHIFT(7), 0xF, 0,
+ snd_soc_get_volsw, micfil_range_set),
};
static const struct snd_kcontrol_new fsl_micfil_volume_sx_controls[] = {
@@ -823,7 +902,7 @@ static int fsl_micfil_hw_params(struct snd_pcm_substream *substream,
break;
}
- if (format == SNDRV_PCM_FORMAT_DSD_U32_BE) {
+ if (format == SNDRV_PCM_FORMAT_DSD_U32_LE) {
micfil->dec_bypass = true;
/*
* According to equation 29 in RM:
@@ -890,13 +969,20 @@ static int fsl_micfil_dai_probe(struct snd_soc_dai *cpu_dai)
struct fsl_micfil *micfil = dev_get_drvdata(cpu_dai->dev);
struct device *dev = cpu_dai->dev;
unsigned int val = 0;
- int ret, i;
+ int ret, i, max_range;
- micfil->quality = QUALITY_VLOW0;
+ micfil->quality = micfil->soc->default_quality;
micfil->card = cpu_dai->component->card;
/* set default gain to 2 */
- regmap_write(micfil->regmap, REG_MICFIL_OUT_CTRL, 0x22222222);
+ if (micfil->soc->volume_sx) {
+ regmap_write(micfil->regmap, REG_MICFIL_OUT_CTRL, 0x22222222);
+ } else {
+ max_range = micfil_get_max_range(micfil);
+ for (i = 1; i < micfil->soc->fifos; i++)
+ max_range |= max_range << 4;
+ regmap_write(micfil->regmap, REG_MICFIL_OUT_CTRL, max_range);
+ }
/* set DC Remover in bypass mode*/
for (i = 0; i < MICFIL_OUTPUT_CHANNELS; i++)
@@ -930,8 +1016,8 @@ static int fsl_micfil_component_probe(struct snd_soc_component *component)
snd_soc_add_component_controls(component, fsl_micfil_volume_sx_controls,
ARRAY_SIZE(fsl_micfil_volume_sx_controls));
else
- snd_soc_add_component_controls(component, fsl_micfil_volume_controls,
- ARRAY_SIZE(fsl_micfil_volume_controls));
+ snd_soc_add_component_controls(component, fsl_micfil_range_controls,
+ ARRAY_SIZE(fsl_micfil_range_controls));
return 0;
}
diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 757e7868e322..72bfc91e21b9 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -353,7 +353,6 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
break;
case SND_SOC_DAIFMT_PDM:
val_cr2 |= FSL_SAI_CR2_BCP;
- val_cr4 &= ~FSL_SAI_CR4_MF;
sai->is_pdm_mode = true;
break;
case SND_SOC_DAIFMT_RIGHT_J:
@@ -638,7 +637,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
val_cr5 |= FSL_SAI_CR5_WNW(slot_width);
val_cr5 |= FSL_SAI_CR5_W0W(slot_width);
- if (sai->is_lsb_first || sai->is_pdm_mode)
+ if (sai->is_lsb_first)
val_cr5 |= FSL_SAI_CR5_FBT(0);
else
val_cr5 |= FSL_SAI_CR5_FBT(word_width - 1);
@@ -653,12 +652,12 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
val_cr4 |= FSL_SAI_CR4_CHMOD;
/*
- * For SAI provider mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will
- * generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4),
- * RCR5(TCR5) for playback(capture), or there will be sync error.
+ * When Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will provide bclk and
+ * frame clock for Tx(Rx). We should set RCR4(TCR4), RCR5(TCR5)
+ * for playback(capture), or there will be sync error.
*/
- if (!sai->is_consumer_mode[tx] && fsl_sai_dir_is_synced(sai, adir)) {
+ if (fsl_sai_dir_is_synced(sai, adir)) {
regmap_update_bits(sai->regmap, FSL_SAI_xCR4(!tx, ofs),
FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK |
FSL_SAI_CR4_CHMOD_MASK,
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index ee946e0d3f49..1b9be85b34c2 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -148,7 +148,7 @@ struct fsl_spdif_priv {
struct clk *pll11k_clk;
};
-static struct fsl_spdif_soc_data fsl_spdif_vf610 = {
+static const struct fsl_spdif_soc_data fsl_spdif_vf610 = {
.imx = false,
.shared_root_clock = false,
.raw_capture_mode = false,
@@ -158,7 +158,7 @@ static struct fsl_spdif_soc_data fsl_spdif_vf610 = {
.tx_formats = FSL_SPDIF_FORMATS_PLAYBACK,
};
-static struct fsl_spdif_soc_data fsl_spdif_imx35 = {
+static const struct fsl_spdif_soc_data fsl_spdif_imx35 = {
.imx = true,
.shared_root_clock = false,
.raw_capture_mode = false,
@@ -168,7 +168,7 @@ static struct fsl_spdif_soc_data fsl_spdif_imx35 = {
.tx_formats = FSL_SPDIF_FORMATS_PLAYBACK,
};
-static struct fsl_spdif_soc_data fsl_spdif_imx6sx = {
+static const struct fsl_spdif_soc_data fsl_spdif_imx6sx = {
.imx = true,
.shared_root_clock = true,
.raw_capture_mode = false,
@@ -179,7 +179,7 @@ static struct fsl_spdif_soc_data fsl_spdif_imx6sx = {
};
-static struct fsl_spdif_soc_data fsl_spdif_imx8qm = {
+static const struct fsl_spdif_soc_data fsl_spdif_imx8qm = {
.imx = true,
.shared_root_clock = true,
.raw_capture_mode = false,
@@ -189,7 +189,7 @@ static struct fsl_spdif_soc_data fsl_spdif_imx8qm = {
.tx_formats = SNDRV_PCM_FMTBIT_S24_LE, /* Applied for EDMA */
};
-static struct fsl_spdif_soc_data fsl_spdif_imx8mm = {
+static const struct fsl_spdif_soc_data fsl_spdif_imx8mm = {
.imx = true,
.shared_root_clock = false,
.raw_capture_mode = true,
@@ -199,7 +199,7 @@ static struct fsl_spdif_soc_data fsl_spdif_imx8mm = {
.tx_formats = FSL_SPDIF_FORMATS_PLAYBACK,
};
-static struct fsl_spdif_soc_data fsl_spdif_imx8ulp = {
+static const struct fsl_spdif_soc_data fsl_spdif_imx8ulp = {
.imx = true,
.shared_root_clock = true,
.raw_capture_mode = false,
@@ -1146,7 +1146,7 @@ static int fsl_spdif_usync_put(struct snd_kcontrol *kcontrol,
}
/* FSL SPDIF IEC958 controller defines */
-static struct snd_kcontrol_new fsl_spdif_ctrls[] = {
+static const struct snd_kcontrol_new fsl_spdif_ctrls[] = {
/* Status cchanel controller */
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1233,7 +1233,7 @@ static struct snd_kcontrol_new fsl_spdif_ctrls[] = {
},
};
-static struct snd_kcontrol_new fsl_spdif_ctrls_rcm[] = {
+static const struct snd_kcontrol_new fsl_spdif_ctrls_rcm[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = "IEC958 Raw Capture Mode",
diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
index 5d804860f7d8..06434b2c9a0f 100644
--- a/sound/soc/fsl/fsl_xcvr.c
+++ b/sound/soc/fsl/fsl_xcvr.c
@@ -1421,7 +1421,7 @@ static irqreturn_t irq0_isr(int irq, void *devid)
bitrev32(val);
}
/* clear CS control register */
- memset_io(reg_ctrl, 0, sizeof(val));
+ writel_relaxed(0, reg_ctrl);
}
} else {
regmap_read(xcvr->regmap, FSL_XCVR_RX_CS_DATA_0,
@@ -1548,28 +1548,24 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
xcvr->soc_data = of_device_get_match_data(&pdev->dev);
xcvr->ipg_clk = devm_clk_get(dev, "ipg");
- if (IS_ERR(xcvr->ipg_clk)) {
- dev_err(dev, "failed to get ipg clock\n");
- return PTR_ERR(xcvr->ipg_clk);
- }
+ if (IS_ERR(xcvr->ipg_clk))
+ return dev_err_probe(dev, PTR_ERR(xcvr->ipg_clk),
+ "failed to get ipg clock\n");
xcvr->phy_clk = devm_clk_get(dev, "phy");
- if (IS_ERR(xcvr->phy_clk)) {
- dev_err(dev, "failed to get phy clock\n");
- return PTR_ERR(xcvr->phy_clk);
- }
+ if (IS_ERR(xcvr->phy_clk))
+ return dev_err_probe(dev, PTR_ERR(xcvr->phy_clk),
+ "failed to get phy clock\n");
xcvr->spba_clk = devm_clk_get(dev, "spba");
- if (IS_ERR(xcvr->spba_clk)) {
- dev_err(dev, "failed to get spba clock\n");
- return PTR_ERR(xcvr->spba_clk);
- }
+ if (IS_ERR(xcvr->spba_clk))
+ return dev_err_probe(dev, PTR_ERR(xcvr->spba_clk),
+ "failed to get spba clock\n");
xcvr->pll_ipg_clk = devm_clk_get(dev, "pll_ipg");
- if (IS_ERR(xcvr->pll_ipg_clk)) {
- dev_err(dev, "failed to get pll_ipg clock\n");
- return PTR_ERR(xcvr->pll_ipg_clk);
- }
+ if (IS_ERR(xcvr->pll_ipg_clk))
+ return dev_err_probe(dev, PTR_ERR(xcvr->pll_ipg_clk),
+ "failed to get pll_ipg clock\n");
fsl_asoc_get_pll_clocks(dev, &xcvr->pll8k_clk,
&xcvr->pll11k_clk);
@@ -1593,51 +1589,42 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
xcvr->regmap = devm_regmap_init_mmio_clk(dev, NULL, regs,
&fsl_xcvr_regmap_cfg);
- if (IS_ERR(xcvr->regmap)) {
- dev_err(dev, "failed to init XCVR regmap: %ld\n",
- PTR_ERR(xcvr->regmap));
- return PTR_ERR(xcvr->regmap);
- }
+ if (IS_ERR(xcvr->regmap))
+ return dev_err_probe(dev, PTR_ERR(xcvr->regmap), "failed to init XCVR regmap\n");
if (xcvr->soc_data->use_phy) {
xcvr->regmap_phy = devm_regmap_init(dev, NULL, xcvr,
&fsl_xcvr_regmap_phy_cfg);
- if (IS_ERR(xcvr->regmap_phy)) {
- dev_err(dev, "failed to init XCVR PHY regmap: %ld\n",
- PTR_ERR(xcvr->regmap_phy));
- return PTR_ERR(xcvr->regmap_phy);
- }
+ if (IS_ERR(xcvr->regmap_phy))
+ return dev_err_probe(dev, PTR_ERR(xcvr->regmap_phy),
+ "failed to init XCVR PHY regmap\n");
switch (xcvr->soc_data->pll_ver) {
case PLL_MX8MP:
xcvr->regmap_pll = devm_regmap_init(dev, NULL, xcvr,
&fsl_xcvr_regmap_pllv0_cfg);
- if (IS_ERR(xcvr->regmap_pll)) {
- dev_err(dev, "failed to init XCVR PLL regmap: %ld\n",
- PTR_ERR(xcvr->regmap_pll));
- return PTR_ERR(xcvr->regmap_pll);
- }
+ if (IS_ERR(xcvr->regmap_pll))
+ return dev_err_probe(dev, PTR_ERR(xcvr->regmap_pll),
+ "failed to init XCVR PLL regmap\n");
break;
case PLL_MX95:
xcvr->regmap_pll = devm_regmap_init(dev, NULL, xcvr,
&fsl_xcvr_regmap_pllv1_cfg);
- if (IS_ERR(xcvr->regmap_pll)) {
- dev_err(dev, "failed to init XCVR PLL regmap: %ld\n",
- PTR_ERR(xcvr->regmap_pll));
- return PTR_ERR(xcvr->regmap_pll);
- }
+ if (IS_ERR(xcvr->regmap_pll))
+ return dev_err_probe(dev, PTR_ERR(xcvr->regmap_pll),
+ "failed to init XCVR PLL regmap\n");
break;
default:
- dev_err(dev, "Error for PLL version %d\n", xcvr->soc_data->pll_ver);
- return -EINVAL;
+ return dev_err_probe(dev, -EINVAL,
+ "Error for PLL version %d\n",
+ xcvr->soc_data->pll_ver);
}
}
xcvr->reset = devm_reset_control_get_optional_exclusive(dev, NULL);
- if (IS_ERR(xcvr->reset)) {
- dev_err(dev, "failed to get XCVR reset control\n");
- return PTR_ERR(xcvr->reset);
- }
+ if (IS_ERR(xcvr->reset))
+ return dev_err_probe(dev, PTR_ERR(xcvr->reset),
+ "failed to get XCVR reset control\n");
/* get IRQs */
irq = platform_get_irq(pdev, 0);
@@ -1645,17 +1632,13 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
return irq;
ret = devm_request_irq(dev, irq, irq0_isr, 0, pdev->name, xcvr);
- if (ret) {
- dev_err(dev, "failed to claim IRQ0: %i\n", ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to claim IRQ0\n");
rx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rxfifo");
tx_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "txfifo");
- if (!rx_res || !tx_res) {
- dev_err(dev, "could not find rxfifo or txfifo resource\n");
- return -EINVAL;
- }
+ if (!rx_res || !tx_res)
+ return dev_err_probe(dev, -EINVAL, "could not find rxfifo or txfifo resource\n");
xcvr->dma_prms_rx.chan_name = "rx";
xcvr->dma_prms_tx.chan_name = "tx";
xcvr->dma_prms_rx.addr = rx_res->start;
@@ -1678,8 +1661,7 @@ static int fsl_xcvr_probe(struct platform_device *pdev)
ret = devm_snd_dmaengine_pcm_register(dev, NULL, 0);
if (ret) {
pm_runtime_disable(dev);
- dev_err(dev, "failed to pcm register\n");
- return ret;
+ return dev_err_probe(dev, ret, "failed to pcm register\n");
}
ret = devm_snd_soc_register_component(dev, &fsl_xcvr_comp,
diff --git a/sound/soc/fsl/imx-rpmsg.c b/sound/soc/fsl/imx-rpmsg.c
index 7cd3aa4c8706..53f04d1f3280 100644
--- a/sound/soc/fsl/imx-rpmsg.c
+++ b/sound/soc/fsl/imx-rpmsg.c
@@ -72,7 +72,7 @@ static int imx_rpmsg_late_probe(struct snd_soc_card *card)
of_property_read_string_index(data->card.dev->of_node,
"ignore-suspend-widgets",
i, &widgets);
- dapm = snd_soc_component_get_dapm(codec_comp);
+ dapm = snd_soc_component_to_dapm(codec_comp);
snd_soc_dapm_ignore_suspend(dapm, widgets);
}
}