Skip to content

Commit

Permalink
ASoC: fsl_spdif: Add support for 22.05 kHz sample rate
Browse files Browse the repository at this point in the history
Add support for 22.05 kHz sample rate for TX.

Signed-off-by: Matus Gajdos <matuszpd@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20230719163154.19492-1-matuszpd@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Matus Gajdos authored and Mark Brown committed Jul 19, 2023
1 parent 82e7c8b commit 65bc25b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions sound/soc/fsl/fsl_spdif.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream,
int ret;

switch (sample_rate) {
case 22050:
rate = SPDIF_TXRATE_22050;
csfs = IEC958_AES3_CON_FS_22050;
break;
case 32000:
rate = SPDIF_TXRATE_32000;
csfs = IEC958_AES3_CON_FS_32000;
Expand Down Expand Up @@ -1422,7 +1426,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
struct clk *clk, u64 savesub,
enum spdif_txrate index, bool round)
{
static const u32 rate[] = { 32000, 44100, 48000, 88200, 96000, 176400,
static const u32 rate[] = { 22050, 32000, 44100, 48000, 88200, 96000, 176400,
192000, };
bool is_sysclk = clk_is_match(clk, spdif_priv->sysclk);
u64 rate_ideal, rate_actual, sub;
Expand Down Expand Up @@ -1483,7 +1487,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv,
static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv,
enum spdif_txrate index)
{
static const u32 rate[] = { 32000, 44100, 48000, 88200, 96000, 176400,
static const u32 rate[] = { 22050, 32000, 44100, 48000, 88200, 96000, 176400,
192000, };
struct platform_device *pdev = spdif_priv->pdev;
struct device *dev = &pdev->dev;
Expand Down
6 changes: 4 additions & 2 deletions sound/soc/fsl/fsl_spdif.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ enum spdif_gainsel {

/* SPDIF tx rate */
enum spdif_txrate {
SPDIF_TXRATE_32000 = 0,
SPDIF_TXRATE_22050 = 0,
SPDIF_TXRATE_32000,
SPDIF_TXRATE_44100,
SPDIF_TXRATE_48000,
SPDIF_TXRATE_88200,
Expand All @@ -191,7 +192,8 @@ enum spdif_txrate {
#define SPDIF_QSUB_SIZE (SPDIF_UBITS_SIZE / 8)


#define FSL_SPDIF_RATES_PLAYBACK (SNDRV_PCM_RATE_32000 | \
#define FSL_SPDIF_RATES_PLAYBACK (SNDRV_PCM_RATE_22050 | \
SNDRV_PCM_RATE_32000 | \
SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000 | \
SNDRV_PCM_RATE_88200 | \
Expand Down

0 comments on commit 65bc25b

Please sign in to comment.