Commit 4720c2fe authored by Jaechul Lee's avatar Jaechul Lee Committed by Mark Brown

ASoC: samsung: i2s: Support more resolution rates

This driver can support more frequencies over 96KHz. There are no reasons
to limit the frequency range below 96KHz. If codecs/amps or something else
can't support higher resolution rates, the constraints would be set rates
properly because each drivers have its own limits.

I added the 'pcm_rates' field to the dai_data to be set rates by the
compatibilities. As a result, rates will be set each devices respectively.
For example of exynos5433, rates will be set from 8KHz to 192KHz.
Signed-off-by: default avatarJaechul Lee <jcsing.lee@samsung.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5771a8c0
...@@ -50,6 +50,7 @@ struct samsung_i2s_variant_regs { ...@@ -50,6 +50,7 @@ struct samsung_i2s_variant_regs {
struct samsung_i2s_dai_data { struct samsung_i2s_dai_data {
u32 quirks; u32 quirks;
unsigned int pcm_rates;
const struct samsung_i2s_variant_regs *i2s_variant_regs; const struct samsung_i2s_variant_regs *i2s_variant_regs;
}; };
...@@ -1076,13 +1077,13 @@ static const struct snd_soc_component_driver samsung_i2s_component = { ...@@ -1076,13 +1077,13 @@ static const struct snd_soc_component_driver samsung_i2s_component = {
.name = "samsung-i2s", .name = "samsung-i2s",
}; };
#define SAMSUNG_I2S_RATES SNDRV_PCM_RATE_8000_96000
#define SAMSUNG_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \ #define SAMSUNG_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \
SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_S24_LE) SNDRV_PCM_FMTBIT_S24_LE)
static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev,
const struct samsung_i2s_dai_data *i2s_dai_data,
bool sec)
{ {
struct i2s_dai *i2s; struct i2s_dai *i2s;
...@@ -1101,13 +1102,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) ...@@ -1101,13 +1102,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
i2s->i2s_dai_drv.resume = i2s_resume; i2s->i2s_dai_drv.resume = i2s_resume;
i2s->i2s_dai_drv.playback.channels_min = 1; i2s->i2s_dai_drv.playback.channels_min = 1;
i2s->i2s_dai_drv.playback.channels_max = 2; i2s->i2s_dai_drv.playback.channels_max = 2;
i2s->i2s_dai_drv.playback.rates = SAMSUNG_I2S_RATES; i2s->i2s_dai_drv.playback.rates = i2s_dai_data->pcm_rates;
i2s->i2s_dai_drv.playback.formats = SAMSUNG_I2S_FMTS; i2s->i2s_dai_drv.playback.formats = SAMSUNG_I2S_FMTS;
if (!sec) { if (!sec) {
i2s->i2s_dai_drv.capture.channels_min = 1; i2s->i2s_dai_drv.capture.channels_min = 1;
i2s->i2s_dai_drv.capture.channels_max = 2; i2s->i2s_dai_drv.capture.channels_max = 2;
i2s->i2s_dai_drv.capture.rates = SAMSUNG_I2S_RATES; i2s->i2s_dai_drv.capture.rates = i2s_dai_data->pcm_rates;
i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS; i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS;
} }
return i2s; return i2s;
...@@ -1242,7 +1243,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1242,7 +1243,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
i2s_dai_data = (struct samsung_i2s_dai_data *) i2s_dai_data = (struct samsung_i2s_dai_data *)
platform_get_device_id(pdev)->driver_data; platform_get_device_id(pdev)->driver_data;
pri_dai = i2s_alloc_dai(pdev, false); pri_dai = i2s_alloc_dai(pdev, i2s_dai_data, false);
if (!pri_dai) { if (!pri_dai) {
dev_err(&pdev->dev, "Unable to alloc I2S_pri\n"); dev_err(&pdev->dev, "Unable to alloc I2S_pri\n");
return -ENOMEM; return -ENOMEM;
...@@ -1316,7 +1317,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) ...@@ -1316,7 +1317,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
goto err_disable_clk; goto err_disable_clk;
if (quirks & QUIRK_SEC_DAI) { if (quirks & QUIRK_SEC_DAI) {
sec_dai = i2s_alloc_dai(pdev, true); sec_dai = i2s_alloc_dai(pdev, i2s_dai_data, true);
if (!sec_dai) { if (!sec_dai) {
dev_err(&pdev->dev, "Unable to alloc I2S_sec\n"); dev_err(&pdev->dev, "Unable to alloc I2S_sec\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -1452,29 +1453,34 @@ static const struct samsung_i2s_variant_regs i2sv5_i2s1_regs = { ...@@ -1452,29 +1453,34 @@ static const struct samsung_i2s_variant_regs i2sv5_i2s1_regs = {
static const struct samsung_i2s_dai_data i2sv3_dai_type = { static const struct samsung_i2s_dai_data i2sv3_dai_type = {
.quirks = QUIRK_NO_MUXPSR, .quirks = QUIRK_NO_MUXPSR,
.pcm_rates = SNDRV_PCM_RATE_8000_96000,
.i2s_variant_regs = &i2sv3_regs, .i2s_variant_regs = &i2sv3_regs,
}; };
static const struct samsung_i2s_dai_data i2sv5_dai_type = { static const struct samsung_i2s_dai_data i2sv5_dai_type = {
.quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR |
QUIRK_SUPPORTS_IDMA, QUIRK_SUPPORTS_IDMA,
.pcm_rates = SNDRV_PCM_RATE_8000_96000,
.i2s_variant_regs = &i2sv3_regs, .i2s_variant_regs = &i2sv3_regs,
}; };
static const struct samsung_i2s_dai_data i2sv6_dai_type = { static const struct samsung_i2s_dai_data i2sv6_dai_type = {
.quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR |
QUIRK_SUPPORTS_TDM | QUIRK_SUPPORTS_IDMA, QUIRK_SUPPORTS_TDM | QUIRK_SUPPORTS_IDMA,
.pcm_rates = SNDRV_PCM_RATE_8000_96000,
.i2s_variant_regs = &i2sv6_regs, .i2s_variant_regs = &i2sv6_regs,
}; };
static const struct samsung_i2s_dai_data i2sv7_dai_type = { static const struct samsung_i2s_dai_data i2sv7_dai_type = {
.quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR |
QUIRK_SUPPORTS_TDM, QUIRK_SUPPORTS_TDM,
.pcm_rates = SNDRV_PCM_RATE_8000_192000,
.i2s_variant_regs = &i2sv7_regs, .i2s_variant_regs = &i2sv7_regs,
}; };
static const struct samsung_i2s_dai_data i2sv5_dai_type_i2s1 = { static const struct samsung_i2s_dai_data i2sv5_dai_type_i2s1 = {
.quirks = QUIRK_PRI_6CHAN | QUIRK_NEED_RSTCLR, .quirks = QUIRK_PRI_6CHAN | QUIRK_NEED_RSTCLR,
.pcm_rates = SNDRV_PCM_RATE_8000_96000,
.i2s_variant_regs = &i2sv5_i2s1_regs, .i2s_variant_regs = &i2sv5_i2s1_regs,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment