From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Lucas Tanure <tanureal@opensource.cirrus.com>,
Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
alsa-devel@alsa-project.org, patches@opensource.cirrus.com
Subject: [PATCH AUTOSEL 4.19 08/20] ASoC: cs42l42: Fix channel width support
Date: Thu, 25 Mar 2021 07:27:12 -0400 [thread overview]
Message-ID: <20210325112724.1928174-8-sashal@kernel.org> (raw)
In-Reply-To: <20210325112724.1928174-1-sashal@kernel.org>
From: Lucas Tanure <tanureal@opensource.cirrus.com>
[ Upstream commit 2bdc4f5c6838f7c3feb4fe68e4edbeea158ec0a2 ]
Remove the hard coded 32 bits width and replace with the correct width
calculated by params_width.
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210305173442.195740-3-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/cs42l42.c | 47 ++++++++++++++++++--------------------
sound/soc/codecs/cs42l42.h | 1 -
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index c7baa19bf317..a5bd9cff7085 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -695,24 +695,6 @@ static int cs42l42_pll_config(struct snd_soc_component *component)
CS42L42_CLK_OASRC_SEL_MASK,
CS42L42_CLK_OASRC_SEL_12 <<
CS42L42_CLK_OASRC_SEL_SHIFT);
- /* channel 1 on low LRCLK, 32 bit */
- snd_soc_component_update_bits(component,
- CS42L42_ASP_RX_DAI0_CH1_AP_RES,
- CS42L42_ASP_RX_CH_AP_MASK |
- CS42L42_ASP_RX_CH_RES_MASK,
- (CS42L42_ASP_RX_CH_AP_LOW <<
- CS42L42_ASP_RX_CH_AP_SHIFT) |
- (CS42L42_ASP_RX_CH_RES_32 <<
- CS42L42_ASP_RX_CH_RES_SHIFT));
- /* Channel 2 on high LRCLK, 32 bit */
- snd_soc_component_update_bits(component,
- CS42L42_ASP_RX_DAI0_CH2_AP_RES,
- CS42L42_ASP_RX_CH_AP_MASK |
- CS42L42_ASP_RX_CH_RES_MASK,
- (CS42L42_ASP_RX_CH_AP_HI <<
- CS42L42_ASP_RX_CH_AP_SHIFT) |
- (CS42L42_ASP_RX_CH_RES_32 <<
- CS42L42_ASP_RX_CH_RES_SHIFT));
if (pll_ratio_table[i].mclk_src_sel == 0) {
/* Pass the clock straight through */
snd_soc_component_update_bits(component,
@@ -828,14 +810,29 @@ static int cs42l42_pcm_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_component *component = dai->component;
struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
- int retval;
+ unsigned int width = (params_width(params) / 8) - 1;
+ unsigned int val = 0;
cs42l42->srate = params_rate(params);
- cs42l42->swidth = params_width(params);
- retval = cs42l42_pll_config(component);
+ switch(substream->stream) {
+ case SNDRV_PCM_STREAM_PLAYBACK:
+ val |= width << CS42L42_ASP_RX_CH_RES_SHIFT;
+ /* channel 1 on low LRCLK */
+ snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH1_AP_RES,
+ CS42L42_ASP_RX_CH_AP_MASK |
+ CS42L42_ASP_RX_CH_RES_MASK, val);
+ /* Channel 2 on high LRCLK */
+ val |= CS42L42_ASP_RX_CH_AP_HI << CS42L42_ASP_RX_CH_AP_SHIFT;
+ snd_soc_component_update_bits(component, CS42L42_ASP_RX_DAI0_CH2_AP_RES,
+ CS42L42_ASP_RX_CH_AP_MASK |
+ CS42L42_ASP_RX_CH_RES_MASK, val);
+ break;
+ default:
+ break;
+ }
- return retval;
+ return cs42l42_pll_config(component);
}
static int cs42l42_set_sysclk(struct snd_soc_dai *dai,
@@ -900,9 +897,9 @@ static int cs42l42_digital_mute(struct snd_soc_dai *dai, int mute)
return 0;
}
-#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S18_3LE | \
- SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE | \
- SNDRV_PCM_FMTBIT_S32_LE)
+#define CS42L42_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
+ SNDRV_PCM_FMTBIT_S24_LE |\
+ SNDRV_PCM_FMTBIT_S32_LE )
static const struct snd_soc_dai_ops cs42l42_ops = {
diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h
index 9d04ed75e5c8..23b1a63315ca 100644
--- a/sound/soc/codecs/cs42l42.h
+++ b/sound/soc/codecs/cs42l42.h
@@ -761,7 +761,6 @@ struct cs42l42_private {
struct completion pdn_done;
u32 sclk;
u32 srate;
- u32 swidth;
u8 plug_state;
u8 hs_type;
u8 ts_inv;
--
2.30.1
next prev parent reply other threads:[~2021-03-25 11:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 11:27 [PATCH AUTOSEL 4.19 01/20] ext4: fix bh ref count on error paths Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 02/20] rpc: fix NULL dereference on kmalloc failure Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 03/20] ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10 Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 04/20] ASoC: rt5651: " Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 05/20] ASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on probe Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 06/20] ASoC: es8316: Simplify adc_pga_gain_tlv table Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 07/20] ASoC: cs42l42: Fix Bitclock polarity inversion Sasha Levin
2021-03-25 11:27 ` Sasha Levin [this message]
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 09/20] ASoC: cs42l42: Fix mixer volume control Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 10/20] ASoC: cs42l42: Always wait at least 3ms after reset Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 11/20] powerpc: Force inlining of cpu_has_feature() to avoid build failure Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 12/20] vhost: Fix vhost_vq_reset() Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 13/20] scsi: st: Fix a use after free in st_open() Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 14/20] scsi: qla2xxx: Fix broken #endif placement Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 15/20] staging: comedi: cb_pcidas: fix request_irq() warn Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 16/20] staging: comedi: cb_pcidas64: " Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 17/20] ASoC: rt5659: Update MCLK rate in set_sysclk() Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 18/20] thermal/core: Add NULL pointer check before using cooling device stats Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 19/20] locking/ww_mutex: Simplify use_ww_ctx & ww_ctx handling Sasha Levin
2021-03-25 11:27 ` [PATCH AUTOSEL 4.19 20/20] ext4: do not iput inode under running transaction in ext4_rename() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210325112724.1928174-8-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=stable@vger.kernel.org \
--cc=tanureal@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox