Let Atmel use simple-audio-card
Subsystems (5)
cover Let Atmel use simple-audio-card
Alexandre,
following patchset is sent as a bare minimum I need to use MAX9867 codec in master mode on AT91SAM9G20 based board.
Codec's MCLK is driven by PCK0 and SSC is wired as follows:
RK0 <-- BCLK
RF0 <-- LRCLK
TD0 --> SDIN
RD0 <-- SDOUT
Following DT framgment was used:
i2c-gpio-0 {
codec: max9867@18 {
compatible = "maxim,max9867";
reg = <0x18>;
#sound-dai-cells = <0>;
};
};
sound {
compatible = "simple-audio-card";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pck0_as_mck>;
simple-audio-card,name = "simear4-max9867";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&codec_dai>;
simple-audio-card,frame-master = <&codec_dai>;
simple-audio-card,routing =
"LINE_IN", "Line In Jack",
"Speaker", "HPOUT";
simple-audio-card,widgets =
"Line", "Line In Jack",
"Speaker", "Speaker";
cpu_dai: simple-audio-card,cpu {
sound-dai = <&ssc0>;
};
codec_dai: simple-audio-card,codec {
sound-dai = <&codec>;
clocks = <&pck0>;
clock-frequency = <12384000>;
};
};&ssc0 {
status = "okay";
pinctrl-0 = <&pinctrl_board_ssc0_tx &pinctrl_ssc0_rx>;
atmel,clk-from-rk-pin;
#sound-dai-cells = <0>;
};Codec code itself seems to be unused since it was merged and I'm wondering whenever it worked at all. A comment from codec author would help a lot, just to be sure I did not break anything.
By no means this code is ready to be merged (only except those patches with commit log and after carefull consideration :)), I'm posting it as a base for discussion.
Thank you,
ladis
Ladislav Michl (7):
ASoC: atmel: Remove redundant dev_err() call in probe function
ASoC: atmel_ssc_dai: Fix TCMR settings in I2S slave mode
ASoC: simple_card_utils: Set clock frequency
ASoC: max9867: Show Kconfig entry
ASoC: max9867: Calculate LRCLK divider
ASoC: max9867: Fix BSEL value in master mode.
ASoC: max9867: Take chip out of shutdown
sound/soc/atmel/atmel-classd.c | 7 +-- sound/soc/atmel/atmel-pdmic.c | 7 +-- sound/soc/atmel/atmel_ssc_dai.c | 2 +- sound/soc/codecs/Kconfig | 3 +- sound/soc/codecs/max9867.c | 110 +++------------------------------- sound/soc/generic/simple-card-utils.c | 4 ++ 6 files changed, 19 insertions(+), 114 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/7 ASoC: atmel: Remove redundant dev_err() call in probe function
There is an error message within devm_ioremap_resource already, so remove the redundant dev_err() call.
--- sound/soc/atmel/atmel-classd.c | 7 ++----- sound/soc/atmel/atmel-pdmic.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-)
sound/soc/atmel/atmel-classd.c +2 -5
@@ -580,11 +580,8 @@ static int atmel_classd_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;
sound/soc/atmel/atmel-pdmic.c +2 -5
@@ -629,11 +629,8 @@ static int atmel_pdmic_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;
Signature · 1 line
2.15.1
Re: [PATCH 1/7] ASoC: atmel: Remove redundant dev_err() call in probe function
Hi,
Quoted 3 lines · Ladislav Michl
There is an error message within
devm_ioremap_resourcealready, so remove the redundantdev_err()call.
That one can be sent as-is, don't forget to send to Mark Brown as he is the asoc maintainer.
Quoted 45 lines
Signed-off-by Ladislav Michl <[email protected]>--- sound/soc/atmel/atmel-classd.c | 7 ++----- sound/soc/atmel/atmel-pdmic.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-)sound/soc/atmel/atmel-classd.c +2
-5@@ -580,11 +580,8 @@ static int atmel_classd_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;sound/soc/atmel/atmel-pdmic.c +2
-5@@ -629,11 +629,8 @@ static int atmel_pdmic_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;Signature · 1 line
2.15.1
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 1/7] ASoC: atmel: Remove redundant dev_err() call in probe function
Quoted 9 lines · Alexandre Belloni
Hi,
Quoted 3 lines · Ladislav Michl
There is an error message within
devm_ioremap_resourcealready, so remove the redundantdev_err()call.That one can be sent as-is, don't forget to send to Mark Brown as he is the asoc maintainer.
Good, you can add my:
Quoted 46 lines
Quoted 45 lines
Signed-off-by Ladislav Michl <[email protected]>--- sound/soc/atmel/atmel-classd.c | 7 ++----- sound/soc/atmel/atmel-pdmic.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-)sound/soc/atmel/atmel-classd.c +2
-5@@ -580,11 +580,8 @@ static int atmel_classd_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;sound/soc/atmel/atmel-pdmic.c +2
-5@@ -629,11 +629,8 @@ static int atmel_pdmic_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;Signature · 1 line
2.15.1
Signature · 1 line
Nicolas Ferre
Mark Brown
maintainerApplied "ASoC: atmel: Remove redundant dev_err() call in probe function" to the asoc tree
In reply to Ladislav MichlThe patch
ASoC: atmel: Remove redundant dev_err() call in probe function
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
1f598e6861ab1d3cc46d6eff155c0a0a6736de38Mon Sep 17 00:00:00 2001
From: Ladislav Michl <[email protected]>
Date: Thu, 1 Mar 2018 14:37:31 +0100
Subject: [PATCH] ASoC: atmel: Remove redundant dev_err() call in probe
function
There is an error message within devm_ioremap_resource already, so remove the redundant dev_err() call.
--- sound/soc/atmel/atmel-classd.c | 7 ++----- sound/soc/atmel/atmel-pdmic.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-)
sound/soc/atmel/atmel-classd.c +2 -5
@@ -582,11 +582,8 @@ static int atmel_classd_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;
sound/soc/atmel/atmel-pdmic.c +2 -5
@@ -631,11 +631,8 @@ static int atmel_pdmic_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); io_base =devm_ioremap_resource (dev, res); -if (IS_ERR (io_base)) { - ret =PTR_ERR (io_base); -dev_err (dev,"failed to remap register memory: %d\n" , ret); -return ret; - } +if (IS_ERR (io_base)) +return PTR_ERR (io_base); dd->phy_base = res->start;
Signature · 1 line
2.16.2
PATCH 2/7 ASoC: atmel_ssc_dai: Fix TCMR settings in I2S slave mode
In reply to Ladislav Michl--- sound/soc/atmel/atmel_ssc_dai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/atmel/atmel_ssc_dai.c +1 -1
@@ -647,7 +647,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, tcmr =SSC_BF (TCMR_PERIOD ,0 ) |SSC_BF (TCMR_STTDLY ,START_DELAY ) - |SSC_BF (TCMR_START ,SSC_START_FALLING_RF ) + |SSC_BF (TCMR_START ,SSC_START_TX_RX ) |SSC_BF (TCMR_CKI ,SSC_CKI_FALLING ) |SSC_BF (TCMR_CKO ,SSC_CKO_NONE ) | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
Signature · 1 line
2.15.1
Re: [PATCH 2/7] ASoC: atmel_ssc_dai: Fix TCMR settings in I2S slave mode
This one needs a proper git message because it is not obvious what this is fixing.
Also, this doesn't exactly fix salve mode. Instead it is enabled synchronous mode. Maybe we need a new DT property to handle sychronous RX/TX. Probably something like what is done here:
But our default would be asynchronous.
Quoted 21 lines · Ladislav Michl
Signed-off-by Ladislav Michl <[email protected]>--- sound/soc/atmel/atmel_ssc_dai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/atmel/atmel_ssc_dai.c +1
-1@@ -647,7 +647,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, tcmr =SSC_BF (TCMR_PERIOD ,0 ) |SSC_BF (TCMR_STTDLY ,START_DELAY ) - |SSC_BF (TCMR_START ,SSC_START_FALLING_RF ) + |SSC_BF (TCMR_START ,SSC_START_TX_RX ) |SSC_BF (TCMR_CKI ,SSC_CKI_FALLING ) |SSC_BF (TCMR_CKO ,SSC_CKO_NONE ) | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?Signature · 1 line
2.15.1
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 2/7] ASoC: atmel_ssc_dai: Fix TCMR settings in I2S slave mode
Quoted 2 lines · Alexandre Belloni
This one needs a proper git message because it is not obvious what this is fixing.
And is also incomplete, as all synchronous slave modes need fixing :)
Quoted 5 lines
Also, this doesn't exactly fix salve mode. Instead it is enabled synchronous mode. Maybe we need a new DT property to handle sychronous RX/TX. Probably something like what is done here:
Thank you for usefull pointer, will send v2.
Quoted 29 lines
But our default would be asynchronous.
Quoted 21 lines · Ladislav Michl
Signed-off-by Ladislav Michl <[email protected]>--- sound/soc/atmel/atmel_ssc_dai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sound/soc/atmel/atmel_ssc_dai.c +1
-1@@ -647,7 +647,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, tcmr =SSC_BF (TCMR_PERIOD ,0 ) |SSC_BF (TCMR_STTDLY ,START_DELAY ) - |SSC_BF (TCMR_START ,SSC_START_FALLING_RF ) + |SSC_BF (TCMR_START ,SSC_START_TX_RX ) |SSC_BF (TCMR_CKI ,SSC_CKI_FALLING ) |SSC_BF (TCMR_CKO ,SSC_CKO_NONE ) | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?Signature · 1 line
2.15.1Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 3/7 ASoC: simple_card_utils: Set clock frequency
In reply to Ladislav Michl--- sound/soc/generic/simple-card-utils.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/generic/simple-card-utils.c +4 -0
@@ -185,6 +185,10 @@ int asoc_simple_card_parse_clk(struct device *dev,*/ clk =devm_get_clk_from_child (dev, node,NULL );if (!IS_ERR (clk)) { +if (!of_property_read_u32 (node,"clock-frequency" , &val)) { +if (clk_set_rate (clk, val)) +dev_err (dev,"failed to set frequency %d\n" , val); + } simple_dai->sysclk =clk_get_rate (clk);asoc_simple_card_clk_register (simple_dai, clk);
Signature · 1 line
2.15.1
Re: [PATCH 3/7] ASoC: simple_card_utils: Set clock frequency
Quoted 10 lines · Ladislav Michl
Signed-off-by Ladislav Michl <[email protected]>--- sound/soc/generic/simple-card-utils.c | 4 ++++ 1 file changed, 4 insertions(+)sound/soc/generic/simple-card-utils.c +0
-0
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_clk(struct device *dev, · line 191
Quoted 7 lines
sound/soc/generic/simple-card-utils.c +4
-0@@ -185,6 +185,10 @@ int asoc_simple_card_parse_clk(struct device *dev,*/ clk =devm_get_clk_from_child (dev, node,NULL );if (!IS_ERR (clk)) { +if (!of_property_read_u32 (node,"clock-frequency" , &val)) { +if (clk_set_rate (clk, val)) +dev_err (dev,"failed to set frequency %d\n" , val); + }
This would need to be documented in the simple card bindings but I think you may instead use: assigned-clocks and assigned-clock-rates.
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 4/7 ASoC: max9867: Show Kconfig entry
In reply to Ladislav MichlAllow codec to be selected.
--- sound/soc/codecs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/codecs/Kconfig +2 -1
@@ -615,7 +615,8 @@ config SND_SOC_MAX98504 depends on I2C config SND_SOC_MAX9867 - tristate + tristate "Maxim MAX9867 CODEC" + depends on I2C config SND_SOC_MAX98925 tristate
Signature · 1 line
2.15.1
Mark Brown
maintainerApplied "ASoC: max9867: Show Kconfig entry" to the asoc tree
The patch
ASoC: max9867: Show Kconfig entry
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
3ac9ce8858ae3c6fef308692dc4580c164adc96bMon Sep 17 00:00:00 2001
From: Ladislav Michl <[email protected]>
Date: Thu, 1 Mar 2018 15:19:23 +0100
Subject: [PATCH] ASoC: max9867: Show Kconfig entry
Allow codec to be selected.
--- sound/soc/codecs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/codecs/Kconfig +2 -1
@@ -615,7 +615,8 @@ config SND_SOC_MAX98504 depends on I2C config SND_SOC_MAX9867 - tristate + tristate "Maxim MAX9867 CODEC" + depends on I2C config SND_SOC_MAX98925 tristate
Signature · 1 line
2.16.2
PATCH 5/7 ASoC: max9867: Calculate LRCLK divider
In reply to Ladislav MichlDo not limit sample rate to a few precalculated frequencies based on "Common NI Values Table" and put the same equation used to create that table directly in code.
--- sound/soc/codecs/max9867.c | 64 +++------------------------------------------- 1 file changed, 4 insertions(+), 60 deletions(-)
sound/soc/codecs/max9867.c +4 -60
@@ -126,75 +126,19 @@ static const struct snd_soc_dapm_route max9867_audio_map[] = { {"LINE_IN", NULL, "Right Line"}, }; -enum rates { - pcm_rate_8, pcm_rate_16, pcm_rate_24, - pcm_rate_32, pcm_rate_44, - pcm_rate_48, max_pcm_rate, -}; - -static const struct ni_div_rates { -u32 mclk; -u16 ni[max_pcm_rate]; -} ni_div[] = { - {11289600 , {0x116A ,0x22D4 ,0x343F ,0x45A9 ,0x6000 ,0x687D } }, - {12000000 , {0x1062 ,0x20C5 ,0x3127 ,0x4189 ,0x5A51 ,0x624E } }, - {12288000 , {0x1000 ,0x2000 ,0x3000 ,0x4000 ,0x5833 ,0x6000 } }, - {13000000 , {0x0F20 ,0x1E3F ,0x2D5F ,0x3C7F ,0x535F ,0x5ABE } }, - {19200000 , {0x0A3D ,0x147B ,0x1EB8 ,0x28F6 ,0x3873 ,0x3D71 } }, - {24000000 , {0x1062 ,0x20C5 ,0x1893 ,0x4189 ,0x5A51 ,0x624E } }, - {26000000 , {0x0F20 ,0x1E3F ,0x16AF ,0x3C7F ,0x535F ,0x5ABE } }, - {27000000 , {0x0E90 ,0x1D21 ,0x15D8 ,0x3A41 ,0x5048 ,0x5762 } }, -}; - -static inline int get_ni_value (int mclk,int rate) -{ -int i, ret =0 ; - -/* find the closest rate index*/ -for (i =0 ; i <ARRAY_SIZE (ni_div); i++) { -if (ni_div[i].mclk >= mclk) -break ; - } -if (i ==ARRAY_SIZE (ni_div)) -return -EINVAL ; - -switch (rate) { -case 8000 : -return ni_div[i].ni[pcm_rate_8]; -case 16000 : -return ni_div[i].ni[pcm_rate_16]; -case 32000 : -return ni_div[i].ni[pcm_rate_32]; -case 44100 : -return ni_div[i].ni[pcm_rate_44]; -case 48000 : -return ni_div[i].ni[pcm_rate_48]; -default : -pr_err ("%s wrong rate %d\n" , __func__, rate); - ret = -EINVAL ; - } -return ret; -} -static int max9867_dai_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai) {struct snd_soc_codec *codec = dai->codec;struct max9867_priv *max9867 =snd_soc_codec_get_drvdata (codec); -unsigned int ni_h, ni_l; -int value; - - value =get_ni_value (max9867->sysclk,params_rate (params)); -if (value <0 ) -return value; +unsigned int ni =DIV_ROUND_CLOSEST_ULL (96 *0x10000 * + (unsigned long long )params_rate (params), max9867->sysclk); - ni_h = (0xFF00 & value) >>8 ; - ni_l =0x00FF & value;/* set up the ni value */ regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKHIGH , -MAX9867_NI_HIGH_MASK , ni_h); +MAX9867_NI_HIGH_MASK , (0xFF00 & ni) >>8 );regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKLOW , -MAX9867_NI_LOW_MASK , ni_l); +MAX9867_NI_LOW_MASK ,0x00FF & ni);if (!max9867->master) {/* * digital pll locks on to any externally supplied LRCLK signal
Signature · 1 line
2.15.1
PATCH 6/7 ASoC: max9867: Fix BSEL value in master mode.
In reply to Ladislav Michl---
Note: It should be reconsidered where BSEL should be set.
sound/soc/codecs/max9867.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-)
sound/soc/codecs/max9867.c +3 -40
@@ -148,46 +148,6 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream, MAX9867_RAPID_LOCK, MAX9867_RAPID_LOCK);regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKHIGH ,MAX9867_PLL ,MAX9867_PLL ); - }else { -unsigned long int bclk_rate, pclk_bclk_ratio; -int bclk_value; - - bclk_rate =params_rate (params) *2 *params_width (params); - pclk_bclk_ratio = max9867->pclk/bclk_rate; -switch (params_width (params)) { -case 8 : -case 16 : -switch (pclk_bclk_ratio) { -case 2 : - bclk_value =MAX9867_IFC1B_PCLK_2 ; -break ; -case 4 : - bclk_value =MAX9867_IFC1B_PCLK_4 ; -break ; -case 8 : - bclk_value =MAX9867_IFC1B_PCLK_8 ; -break ; -case 16 : - bclk_value =MAX9867_IFC1B_PCLK_16 ; -break ; -default : -dev_err (codec->dev, -"unsupported sampling rate\n" ); -return -EINVAL ; - } -break ; -case 24 : - bclk_value =MAX9867_IFC1B_24BIT ; -break ; -case 32 : - bclk_value =MAX9867_IFC1B_32BIT ; -break ; -default : -dev_err (codec->dev,"unsupported sampling rate\n" ); -return -EINVAL ; - } -regmap_update_bits (max9867->regmap,MAX9867_IFC1B , -MAX9867_IFC1B_BCLK_MASK , bclk_value); }return 0 ; }
@@ -244,6 +204,9 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, value &= ~MAX9867_FREQ_MASK ;regmap_update_bits (max9867->regmap,MAX9867_SYSCLK ,MAX9867_PSCLK_MASK , value); +regmap_update_bits (max9867->regmap,MAX9867_IFC1B , +MAX9867_IFC1B_BCLK_MASK ,0x010 ); +return 0 ; }
Signature · 1 line
2.15.1
Re: [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode.
This also needs a proper commit message.
Quoted 59 lines · Ladislav Michl
Signed-off-by Ladislav Michl <[email protected]>---
Note: It should be reconsidered where BSEL should be set.sound/soc/codecs/max9867.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-)sound/soc/codecs/max9867.c +0
-40@@ -148,46 +148,6 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream, MAX9867_RAPID_LOCK, MAX9867_RAPID_LOCK);regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKHIGH ,MAX9867_PLL ,MAX9867_PLL ); - }else { -unsigned long int bclk_rate, pclk_bclk_ratio; -int bclk_value; - - bclk_rate =params_rate (params) *2 *params_width (params); - pclk_bclk_ratio = max9867->pclk/bclk_rate; -switch (params_width (params)) { -case 8 : -case 16 : -switch (pclk_bclk_ratio) { -case 2 : - bclk_value =MAX9867_IFC1B_PCLK_2 ; -break ; -case 4 : - bclk_value =MAX9867_IFC1B_PCLK_4 ; -break ; -case 8 : - bclk_value =MAX9867_IFC1B_PCLK_8 ; -break ; -case 16 : - bclk_value =MAX9867_IFC1B_PCLK_16 ; -break ; -default : -dev_err (codec->dev, -"unsupported sampling rate\n" ); -return -EINVAL ; - } -break ; -case 24 : - bclk_value =MAX9867_IFC1B_24BIT ; -break ; -case 32 : - bclk_value =MAX9867_IFC1B_32BIT ; -break ; -default : -dev_err (codec->dev,"unsupported sampling rate\n" ); -return -EINVAL ; - } -regmap_update_bits (max9867->regmap,MAX9867_IFC1B , -MAX9867_IFC1B_BCLK_MASK , bclk_value); }return 0 ; }
sound/soc/codecs/max9867.c static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, · line 208
Quoted 5 lines
sound/soc/codecs/max9867.c +2
-0@@ -244,6 +204,9 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, value &= ~MAX9867_FREQ_MASK ;regmap_update_bits (max9867->regmap,MAX9867_SYSCLK ,MAX9867_PSCLK_MASK , value); +regmap_update_bits (max9867->regmap,MAX9867_IFC1B , +MAX9867_IFC1B_BCLK_MASK ,0x010 );
This magic value has to be defined somewhere.
Quoted 7 lines
sound/soc/codecs/max9867.c +1
-0+return 0 ; }Signature · 1 line
2.15.1
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode.
Quoted 1 line · Alexandre Belloni
This also needs a proper commit message.
Meanwhile more patches for this driver accumulated, so I'll send simple ones first and those I'm uncertain of later.
Now few questions:
- should hw_params emit any error message when asked to set for example unsupported sample rate? Many drivers do so, but it seems strange.
- table used in this driver is overkill, frequencies can be calculated directly (patch ready), but that brings question about
SNDRV_PCM_RATE_CONTINUOUS: what does it exactly mean? What if codec is able to set "any" rate, but there are rounding errors?
Quoted 80 lines · Ladislav Michl
Quoted 59 lines
Signed-off-by Ladislav Michl <[email protected]>---
Note: It should be reconsidered where BSEL should be set.sound/soc/codecs/max9867.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-)sound/soc/codecs/max9867.c +0
-40@@ -148,46 +148,6 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream, MAX9867_RAPID_LOCK, MAX9867_RAPID_LOCK);regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKHIGH ,MAX9867_PLL ,MAX9867_PLL ); - }else { -unsigned long int bclk_rate, pclk_bclk_ratio; -int bclk_value; - - bclk_rate =params_rate (params) *2 *params_width (params); - pclk_bclk_ratio = max9867->pclk/bclk_rate; -switch (params_width (params)) { -case 8 : -case 16 : -switch (pclk_bclk_ratio) { -case 2 : - bclk_value =MAX9867_IFC1B_PCLK_2 ; -break ; -case 4 : - bclk_value =MAX9867_IFC1B_PCLK_4 ; -break ; -case 8 : - bclk_value =MAX9867_IFC1B_PCLK_8 ; -break ; -case 16 : - bclk_value =MAX9867_IFC1B_PCLK_16 ; -break ; -default : -dev_err (codec->dev, -"unsupported sampling rate\n" ); -return -EINVAL ; - } -break ; -case 24 : - bclk_value =MAX9867_IFC1B_24BIT ; -break ; -case 32 : - bclk_value =MAX9867_IFC1B_32BIT ; -break ; -default : -dev_err (codec->dev,"unsupported sampling rate\n" ); -return -EINVAL ; - } -regmap_update_bits (max9867->regmap,MAX9867_IFC1B , -MAX9867_IFC1B_BCLK_MASK , bclk_value); }return 0 ; }sound/soc/codecs/max9867.c static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, · line 208
Quoted 5 lines
sound/soc/codecs/max9867.c +2
-0@@ -244,6 +204,9 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, value &= ~MAX9867_FREQ_MASK ;regmap_update_bits (max9867->regmap,MAX9867_SYSCLK ,MAX9867_PSCLK_MASK , value); +regmap_update_bits (max9867->regmap,MAX9867_IFC1B , +MAX9867_IFC1B_BCLK_MASK ,0x010 );This magic value has to be defined somewhere.
Quoted 7 lines
sound/soc/codecs/max9867.c +1
-0+return 0 ; }Signature · 1 line
2.15.1Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode.
Quoted 9 lines · Ladislav Michl
Quoted 1 line · Alexandre Belloni
This also needs a proper commit message.
Meanwhile more patches for this driver accumulated, so I'll send simple ones first and those I'm uncertain of later.
Now few questions:
- shouldhw_paramsemit any error message when asked to set for example unsupported sample rate? Many drivers do so, but it seems strange.
I would thin that is correct because then the eror goes up to userspace and it knows it has to resample.
Quoted 5 lines
- table used in this driver is overkill, frequencies can be calculated directly (patch ready), but that brings question about
SNDRV_PCM_RATE_CONTINUOUS: what does it exactly mean? What if codec is able to set "any" rate, but there are rounding errors?
That is a good question I can't answer.
Quoted 80 lines
Quoted 80 lines · Ladislav Michl
Quoted 59 lines
Signed-off-by Ladislav Michl <[email protected]>---
Note: It should be reconsidered where BSEL should be set.sound/soc/codecs/max9867.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-)sound/soc/codecs/max9867.c +0
-40@@ -148,46 +148,6 @@ static int max9867_dai_hw_params(struct snd_pcm_substream *substream, MAX9867_RAPID_LOCK, MAX9867_RAPID_LOCK);regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKHIGH ,MAX9867_PLL ,MAX9867_PLL ); - }else { -unsigned long int bclk_rate, pclk_bclk_ratio; -int bclk_value; - - bclk_rate =params_rate (params) *2 *params_width (params); - pclk_bclk_ratio = max9867->pclk/bclk_rate; -switch (params_width (params)) { -case 8 : -case 16 : -switch (pclk_bclk_ratio) { -case 2 : - bclk_value =MAX9867_IFC1B_PCLK_2 ; -break ; -case 4 : - bclk_value =MAX9867_IFC1B_PCLK_4 ; -break ; -case 8 : - bclk_value =MAX9867_IFC1B_PCLK_8 ; -break ; -case 16 : - bclk_value =MAX9867_IFC1B_PCLK_16 ; -break ; -default : -dev_err (codec->dev, -"unsupported sampling rate\n" ); -return -EINVAL ; - } -break ; -case 24 : - bclk_value =MAX9867_IFC1B_24BIT ; -break ; -case 32 : - bclk_value =MAX9867_IFC1B_32BIT ; -break ; -default : -dev_err (codec->dev,"unsupported sampling rate\n" ); -return -EINVAL ; - } -regmap_update_bits (max9867->regmap,MAX9867_IFC1B , -MAX9867_IFC1B_BCLK_MASK , bclk_value); }return 0 ; }sound/soc/codecs/max9867.c static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, · line 208
Quoted 5 lines
sound/soc/codecs/max9867.c +2
-0@@ -244,6 +204,9 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai, value &= ~MAX9867_FREQ_MASK ;regmap_update_bits (max9867->regmap,MAX9867_SYSCLK ,MAX9867_PSCLK_MASK , value); +regmap_update_bits (max9867->regmap,MAX9867_IFC1B , +MAX9867_IFC1B_BCLK_MASK ,0x010 );This magic value has to be defined somewhere.
Quoted 7 lines
sound/soc/codecs/max9867.c +1
-0+return 0 ; }Signature · 1 line
2.15.1Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode.
Quoted 7 lines · Alexandre Belloni
Quoted 6 lines · Ladislav Michl
Quoted 1 line · Alexandre Belloni
This also needs a proper commit message.
Meanwhile more patches for this driver accumulated, so I'll send simple ones first and those I'm uncertain of later.
Quoted 6 lines
Quoted 3 lines
Now few questions:
- shouldhw_paramsemit any error message when asked to set for example unsupported sample rate? Many drivers do so, but it seems strange.I would thin that is correct because then the eror goes up to userspace and it knows it has to resample.
Perhaps I didn't express it clearly enough. I mean all those dev_err(dev, "sunsupported rate\n");
Here only human sitting in realspace is able to react somehow, but I'd say he's only annoyed.
I would expect driver is able to set any rate it is advertising, so returned -EINVAL is considered to be a programming error (which shouldn't clutter kernel log).
Quoted 6 lines
Quoted 4 lines
- table used in this driver is overkill, frequencies can be calculated directly (patch ready), but that brings question about
SNDRV_PCM_RATE_CONTINUOUS: what does it exactly mean? What if codec is able to set "any" rate, but there are rounding errors?That is a good question I can't answer.
Thank you anyway, hopefully someone else would be able to answer.
Consider patch bellow - with introduced change codec is able to set any rate in master mode (it is an example only, it needs more work), but not any rate will be matched exactly. Of course, for each master clock rate it is possible to compute exact supported rates and advertise them. Is that way forward or is there any trick with SNDRV_PCM_RATE_CONTINUOUS?
Subject: ASoC: max9867: Use continuous sample rate
Drop "Common NI Values Table" and calculate LRCLK divider.
sound/soc/codecs/max9867.c +15 -71
@@ -126,75 +126,19 @@ static const struct snd_soc_dapm_route max9867_audio_map[] = { {"LINE_IN", NULL, "Right Line"}, }; -enum rates { - pcm_rate_8, pcm_rate_16, pcm_rate_24, - pcm_rate_32, pcm_rate_44, - pcm_rate_48, max_pcm_rate, -}; - -static const struct ni_div_rates { -u32 mclk; -u16 ni[max_pcm_rate]; -} ni_div[] = { - {11289600 , {0x116A ,0x22D4 ,0x343F ,0x45A9 ,0x6000 ,0x687D } }, - {12000000 , {0x1062 ,0x20C5 ,0x3127 ,0x4189 ,0x5A51 ,0x624E } }, - {12288000 , {0x1000 ,0x2000 ,0x3000 ,0x4000 ,0x5833 ,0x6000 } }, - {13000000 , {0x0F20 ,0x1E3F ,0x2D5F ,0x3C7F ,0x535F ,0x5ABE } }, - {19200000 , {0x0A3D ,0x147B ,0x1EB8 ,0x28F6 ,0x3873 ,0x3D71 } }, - {24000000 , {0x1062 ,0x20C5 ,0x1893 ,0x4189 ,0x5A51 ,0x624E } }, - {26000000 , {0x0F20 ,0x1E3F ,0x16AF ,0x3C7F ,0x535F ,0x5ABE } }, - {27000000 , {0x0E90 ,0x1D21 ,0x15D8 ,0x3A41 ,0x5048 ,0x5762 } }, -}; - -static inline int get_ni_value (int mclk,int rate) -{ -int i, ret =0 ; - -/* find the closest rate index*/ -for (i =0 ; i <ARRAY_SIZE (ni_div); i++) { -if (ni_div[i].mclk >= mclk) -break ; - } -if (i ==ARRAY_SIZE (ni_div)) -return -EINVAL ; - -switch (rate) { -case 8000 : -return ni_div[i].ni[pcm_rate_8]; -case 16000 : -return ni_div[i].ni[pcm_rate_16]; -case 32000 : -return ni_div[i].ni[pcm_rate_32]; -case 44100 : -return ni_div[i].ni[pcm_rate_44]; -case 48000 : -return ni_div[i].ni[pcm_rate_48]; -default : -pr_err ("%s wrong rate %d\n" , __func__, rate); - ret = -EINVAL ; - } -return ret; -} -static int max9867_dai_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai) {struct snd_soc_component *component = dai->component;struct max9867_priv *max9867 =snd_soc_component_get_drvdata (component); -unsigned int ni_h, ni_l; -int value; +unsigned int ni =DIV_ROUND_CLOSEST_ULL (96ULL *0x10000 *params_rate (params), + max9867->pclk); - value =get_ni_value (max9867->sysclk,params_rate (params)); -if (value <0 ) -return value; - - ni_h = (0xFF00 & value) >>8 ; - ni_l =0x00FF & value;/* set up the ni value */ regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKHIGH , -MAX9867_NI_HIGH_MASK , ni_h); +MAX9867_NI_HIGH_MASK , (0xFF00 & ni) >>8 );regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKLOW , -MAX9867_NI_LOW_MASK , ni_l); +MAX9867_NI_LOW_MASK ,0x00FF & ni);if (!max9867->master) {/* * digital pll locks on to any externally supplied LRCLK signal
@@ -241,13 +185,13 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai,/* Set the prescaler based on the master clock frequency*/ if (freq >=10000000 && freq <=20000000 ) { value |=MAX9867_PSCLK_10_20 ; - max9867->pclk = freq; + max9867->pclk = freq; }else if (freq >=20000000 && freq <=40000000 ) { value |=MAX9867_PSCLK_20_40 ; - max9867->pclk = freq/2 ; + max9867->pclk = freq /2 ; }else if (freq >=40000000 && freq <=60000000 ) { value |=MAX9867_PSCLK_40_60 ; - max9867->pclk = freq/4 ; + max9867->pclk = freq /4 ; }else { dev_err(component->dev, "Invalid clock frequency %uHz (required 10-60MHz)\n",
@@ -322,10 +266,6 @@ static const struct snd_soc_dai_ops max9867_dai_ops = { .hw_params = max9867_dai_hw_params, }; -#define MAX9867_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ - SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) -#define MAX9867_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) -static struct snd_soc_dai_driver max9867_dai[] = { { .name ="max9867-aif1" ,
@@ -333,15 +273,19 @@ static struct snd_soc_dai_driver max9867_dai[] = { .stream_name = "HiFi Playback", .channels_min = 1, .channels_max = 2, - .rates = MAX9867_RATES, - .formats = MAX9867_FORMATS, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 8000, + .rate_max = 48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "HiFi Capture", .channels_min = 1, .channels_max = 2, - .rates = MAX9867_RATES, - .formats = MAX9867_FORMATS, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 8000, + .rate_max = 48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &max9867_dai_ops, }
Re: [PATCH 6/7] ASoC: max9867: Fix BSEL value in master mode.
Quoted 15 lines · Ladislav Michl
Quoted 7 lines · Alexandre Belloni
Quoted 6 lines · Ladislav Michl
Quoted 1 line · Alexandre Belloni
This also needs a proper commit message.
Meanwhile more patches for this driver accumulated, so I'll send simple ones first and those I'm uncertain of later.
Quoted 6 lines
Quoted 3 lines
Now few questions:
- shouldhw_paramsemit any error message when asked to set for example unsupported sample rate? Many drivers do so, but it seems strange.I would thin that is correct because then the eror goes up to userspace and it knows it has to resample.
Quoted 9 lines
Perhaps I didn't express it clearly enough. I mean all those
dev_err(dev, "sunsupported rate\n");
Here only human sitting in realspace is able to react somehow, but I'd say he's only annoyed.I would expect driver is able to set any rate it is advertising, so returned
-EINVALis considered to be a programming error (which shouldn't clutter kernel log).
Ah yes, please feel free to remove the dev_err messages. I also find that they clutter the kernel output needlessly.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
- table used in this driver is overkill, frequencies can be calculated directly (patch ready), but that brings question about
SNDRV_PCM_RATE_CONTINUOUS: what does it exactly mean? What if codec is able to set "any" rate, but there are rounding errors?That is a good question I can't answer.
Thank you anyway, hopefully someone else would be able to answer.
Well, Mark is not Cced, you'd have to get his attention somehow ;)
Quoted 148 lines
Consider patch bellow - with introduced change codec is able to set any rate in master mode (it is an example only, it needs more work), but not any rate will be matched exactly. Of course, for each master clock rate it is possible to compute exact supported rates and advertise them. Is that way forward or is there any trick with
SNDRV_PCM_RATE_CONTINUOUS?Subject: ASoC: max9867: Use continuous sample rate
Drop "Common NI Values Table" and calculate LRCLK divider.
Signed-off-by Ladislav Michl <[email protected]>sound/soc/codecs/max9867.c +15
-71@@ -126,75 +126,19 @@ static const struct snd_soc_dapm_route max9867_audio_map[] = { {"LINE_IN", NULL, "Right Line"}, }; -enum rates { - pcm_rate_8, pcm_rate_16, pcm_rate_24, - pcm_rate_32, pcm_rate_44, - pcm_rate_48, max_pcm_rate, -}; - -static const struct ni_div_rates { -u32 mclk; -u16 ni[max_pcm_rate]; -} ni_div[] = { - {11289600 , {0x116A ,0x22D4 ,0x343F ,0x45A9 ,0x6000 ,0x687D } }, - {12000000 , {0x1062 ,0x20C5 ,0x3127 ,0x4189 ,0x5A51 ,0x624E } }, - {12288000 , {0x1000 ,0x2000 ,0x3000 ,0x4000 ,0x5833 ,0x6000 } }, - {13000000 , {0x0F20 ,0x1E3F ,0x2D5F ,0x3C7F ,0x535F ,0x5ABE } }, - {19200000 , {0x0A3D ,0x147B ,0x1EB8 ,0x28F6 ,0x3873 ,0x3D71 } }, - {24000000 , {0x1062 ,0x20C5 ,0x1893 ,0x4189 ,0x5A51 ,0x624E } }, - {26000000 , {0x0F20 ,0x1E3F ,0x16AF ,0x3C7F ,0x535F ,0x5ABE } }, - {27000000 , {0x0E90 ,0x1D21 ,0x15D8 ,0x3A41 ,0x5048 ,0x5762 } }, -}; - -static inline int get_ni_value (int mclk,int rate) -{ -int i, ret =0 ; - -/* find the closest rate index*/ -for (i =0 ; i <ARRAY_SIZE (ni_div); i++) { -if (ni_div[i].mclk >= mclk) -break ; - } -if (i ==ARRAY_SIZE (ni_div)) -return -EINVAL ; - -switch (rate) { -case 8000 : -return ni_div[i].ni[pcm_rate_8]; -case 16000 : -return ni_div[i].ni[pcm_rate_16]; -case 32000 : -return ni_div[i].ni[pcm_rate_32]; -case 44100 : -return ni_div[i].ni[pcm_rate_44]; -case 48000 : -return ni_div[i].ni[pcm_rate_48]; -default : -pr_err ("%s wrong rate %d\n" , __func__, rate); - ret = -EINVAL ; - } -return ret; -} -static int max9867_dai_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai) {struct snd_soc_component *component = dai->component;struct max9867_priv *max9867 =snd_soc_component_get_drvdata (component); -unsigned int ni_h, ni_l; -int value; +unsigned int ni =DIV_ROUND_CLOSEST_ULL (96ULL *0x10000 *params_rate (params), + max9867->pclk); - value =get_ni_value (max9867->sysclk,params_rate (params)); -if (value <0 ) -return value; - - ni_h = (0xFF00 & value) >>8 ; - ni_l =0x00FF & value;/* set up the ni value */ regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKHIGH , -MAX9867_NI_HIGH_MASK , ni_h); +MAX9867_NI_HIGH_MASK , (0xFF00 & ni) >>8 );regmap_update_bits (max9867->regmap,MAX9867_AUDIOCLKLOW , -MAX9867_NI_LOW_MASK , ni_l); +MAX9867_NI_LOW_MASK ,0x00FF & ni);if (!max9867->master) {/* * digital pll locks on to any externally supplied LRCLK signal @@ -241,13 +185,13 @@ static int max9867_set_dai_sysclk(struct snd_soc_dai *codec_dai,/* Set the prescaler based on the master clock frequency*/ if (freq >=10000000 && freq <=20000000 ) { value |=MAX9867_PSCLK_10_20 ; - max9867->pclk = freq; + max9867->pclk = freq; }else if (freq >=20000000 && freq <=40000000 ) { value |=MAX9867_PSCLK_20_40 ; - max9867->pclk = freq/2 ; + max9867->pclk = freq /2 ; }else if (freq >=40000000 && freq <=60000000 ) { value |=MAX9867_PSCLK_40_60 ; - max9867->pclk = freq/4 ; + max9867->pclk = freq /4 ; }else { dev_err(component->dev, "Invalid clock frequency %uHz (required 10-60MHz)\n",@@ -322,10 +266,6 @@ static const struct snd_soc_dai_ops max9867_dai_ops = { .hw_params = max9867_dai_hw_params, }; -#define MAX9867_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ - SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) -#define MAX9867_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) -static struct snd_soc_dai_driver max9867_dai[] = { { .name ="max9867-aif1" ,@@ -333,15 +273,19 @@ static struct snd_soc_dai_driver max9867_dai[] = { .stream_name = "HiFi Playback", .channels_min = 1, .channels_max = 2, - .rates = MAX9867_RATES, - .formats = MAX9867_FORMATS, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 8000, + .rate_max = 48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "HiFi Capture", .channels_min = 1, .channels_max = 2, - .rates = MAX9867_RATES, - .formats = MAX9867_FORMATS, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 8000, + .rate_max = 48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &max9867_dai_ops, }
Signature · 3 lines
Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 7/7 ASoC: max9867: Take chip out of shutdown
In reply to Ladislav Michl---
Note: It would be great to take only used parts of
codec out of shutdown and put them to sleep again once unused.
sound/soc/codecs/max9867.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/max9867.c +1 -2
@@ -158,8 +158,7 @@ static int max9867_prepare(struct snd_pcm_substream *substream,struct snd_soc_codec *codec = dai->codec;struct max9867_priv *max9867 =snd_soc_codec_get_drvdata (codec); -regmap_update_bits (max9867->regmap,MAX9867_PWRMAN , -MAX9867_SHTDOWN_MASK ,MAX9867_SHTDOWN_MASK ); +regmap_write (max9867->regmap,MAX9867_PWRMAN ,0xff );return 0 ; }
Signature · 1 line
2.15.1