* [PATCH] Patch for sun4i-i2s driver to allow 24-bit audio
@ 2018-08-30 0:32 Jonathan Fether
2018-08-30 0:32 ` [PATCH] ASoC: sun4i-i2s: Add 24-bit sample width support Jonathan Fether
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Fether @ 2018-08-30 0:32 UTC (permalink / raw)
To: patch; +Cc: alsa-devel, Jonathan Fether
This patch adds 24-bit sample width support for the sun4i-i2s driver.
Jonathan Fether (1):
ASoC: sun4i-i2s: Add 24-bit sample width support
sound/soc/sunxi/sun4i-i2s.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] ASoC: sun4i-i2s: Add 24-bit sample width support
2018-08-30 0:32 [PATCH] Patch for sun4i-i2s driver to allow 24-bit audio Jonathan Fether
@ 2018-08-30 0:32 ` Jonathan Fether
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Fether @ 2018-08-30 0:32 UTC (permalink / raw)
To: patch; +Cc: alsa-devel, Jonathan Fether
Add additional clock divider ratios for BCLK and MCLK, per the A20 datasheet.
Add support for 32-bit physical sample width.
Add support for 24-bit actual sample width.
Change third parameter of call to sun4i_i2s_set_clk_rate() from sun4i_i2s_hw_params() to use physical sample width, which is appropriate here.
Signed-off-by: Jonathan Fether <jonf@mds.com>
---
sound/soc/sunxi/sun4i-i2s.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c
index a4aa931..ba1cfae 100644
--- a/sound/soc/sunxi/sun4i-i2s.c
+++ b/sound/soc/sunxi/sun4i-i2s.c
@@ -207,6 +207,8 @@ struct sun4i_i2s_clk_div {
{ .div = 8, .val = 3 },
{ .div = 12, .val = 4 },
{ .div = 16, .val = 5 },
+ { .div = 32, .val = 6 },
+ { .div = 64, .val = 7 },
/* TODO - extend divide ratio supported by newer SoCs */
};
@@ -219,6 +221,9 @@ struct sun4i_i2s_clk_div {
{ .div = 12, .val = 5 },
{ .div = 16, .val = 6 },
{ .div = 24, .val = 7 },
+ { .div = 32, .val = 8 },
+ { .div = 48, .val = 9 },
+ { .div = 64, .val = 10 },
/* TODO - extend divide ratio supported by newer SoCs */
};
@@ -393,6 +398,9 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream,
case 16:
width = DMA_SLAVE_BUSWIDTH_2_BYTES;
break;
+ case 32:
+ width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+ break;
default:
dev_err(dai->dev, "Unsupported physical sample width: %d\n",
params_physical_width(params));
@@ -405,6 +413,10 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream,
sr = 0;
wss = 0;
break;
+ case 24:
+ sr = 2;
+ wss = 3;
+ break;
default:
dev_err(dai->dev, "Unsupported sample width: %d\n",
@@ -418,7 +430,7 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream,
sr + i2s->variant->fmt_offset);
return sun4i_i2s_set_clk_rate(dai, params_rate(params),
- params_width(params));
+ params_physical_width(params));
}
static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
@@ -720,14 +732,14 @@ static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai)
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
},
.playback = {
.stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
},
.ops = &sun4i_i2s_dai_ops,
.symmetric_rates = 1,
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-30 0:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-30 0:32 [PATCH] Patch for sun4i-i2s driver to allow 24-bit audio Jonathan Fether
2018-08-30 0:32 ` [PATCH] ASoC: sun4i-i2s: Add 24-bit sample width support Jonathan Fether
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.