ASoC: meson: add g12a SoC family support
Subsystems (5)
Jerome Brunet
maintainercover ASoC: meson: add g12a SoC family support
The Amlogic g12a SoC family audio subsystem derives from the one found in the axg SoC family.
To add support for the g12a in the existing elements, this patchset deals with following differences compared to the axg family:
* fifos must set an initial start address within the buffer. The fifo pointer shall be reset to this address on startup.
* frddrs may now play on up to 3 output interfaces simultaneously.
* tdmout formatters need a different signal skew offset.
Jerome Brunet (6):
ASoC: meson: add g12a compatibles
ASoC: meson: axg-fifo: add g12a support
ASoC: meson: axg-toddr: add g12a support
ASoC: meson: axg-frddr: add g12a support
ASoC: meson: axg-tdm-formatter: rework quirks settings
ASoC: meson: axg-tdmout: add g12a support
.../bindings/sound/amlogic,axg-fifo.txt | 4 +- .../bindings/sound/amlogic,axg-pdm.txt | 3 +- .../bindings/sound/amlogic,axg-spdifin.txt | 3 +- .../bindings/sound/amlogic,axg-spdifout.txt | 3 +- .../sound/amlogic,axg-tdm-formatters.txt | 4 +- sound/soc/meson/axg-fifo.c | 34 ++++- sound/soc/meson/axg-fifo.h | 2 + sound/soc/meson/axg-frddr.c | 143 +++++++++++++++++- sound/soc/meson/axg-tdm-formatter.c | 6 +- sound/soc/meson/axg-tdm-formatter.h | 11 +- sound/soc/meson/axg-tdmin.c | 16 +- sound/soc/meson/axg-tdmout.c | 29 +++- sound/soc/meson/axg-toddr.c | 53 +++++++ 13 files changed, 286 insertions(+), 25 deletions(-)
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH 1/6 ASoC: meson: add g12a compatibles
Add new compatible strings for the g12a devices.
Audio wise, the g12a is fairly to close to the axg, yet some differences need to be handled.
--- Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt | 4 +++- Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt | 3 ++- .../devicetree/bindings/sound/amlogic,axg-spdifin.txt | 3 ++- .../devicetree/bindings/sound/amlogic,axg-spdifout.txt | 3 ++- .../devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt | 4 +++- 5 files changed, 12 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt +3 -1
@@ -2,7 +2,9 @@ Required properties: - compatible: 'amlogic,axg-toddr' or - 'amlogic,axg-frddr' + 'amlogic,axg-toddr' or + 'amlogic,g12a-frddr' or + 'amlogic,g12a-toddr' - reg: physical base address of the controller and length of memory mapped region. - interrupts: interrupt specifier for the fifo.
Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt +2 -1
@@ -1,7 +1,8 @@ * Amlogic Audio PDM input Required properties: -- compatible: 'amlogic,axg-pdm' +- compatible: 'amlogic,axg-pdm' or + 'amlogic,g12a-pdm' - reg: physical base address of the controller and length of memory mapped region. - clocks: list of clock phandle, one for each entry clock-names.
Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt +2 -1
@@ -1,7 +1,8 @@ * Amlogic Audio SPDIF Input Required properties: -- compatible: 'amlogic,axg-spdifin' +- compatible: 'amlogic,axg-spdifin' or + 'amlogic,g12a-spdifin' - interrupts: interrupt specifier for the spdif input. - clocks: list of clock phandle, one for each entry clock-names. - clock-names: should contain the following:
Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt +2 -1
@@ -1,7 +1,8 @@ * Amlogic Audio SPDIF Output Required properties: -- compatible: 'amlogic,axg-spdifout' +- compatible: 'amlogic,axg-spdifout' or + 'amlogic,g12a-spdifout' - clocks: list of clock phandle, one for each entry clock-names. - clock-names: should contain the following: * "pclk" : peripheral clock.
Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt +3 -1
@@ -2,7 +2,9 @@ Required properties: - compatible: 'amlogic,axg-tdmin' or - 'amlogic,axg-tdmout' + 'amlogic,axg-tdmout' or + 'amlogic,g12a-tdmin' or + 'amlogic,g12a-tdmout' - reg: physical base address of the controller and length of memory mapped region. - clocks: list of clock phandle, one for each entry clock-names.
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "ASoC: meson: add g12a compatibles" to the asoc tree
The patch
ASoC: meson: add g12a compatibles
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
679f4e6cfd45bcc14bb563576e419ac9e43fad7cMon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Thu, 4 Apr 2019 13:17:28 +0200
Subject: [PATCH] ASoC: meson: add g12a compatibles
Add new compatible strings for the g12a devices.
Audio wise, the g12a is fairly to close to the axg, yet some differences need to be handled.
--- Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt | 4 +++- Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt | 3 ++- .../devicetree/bindings/sound/amlogic,axg-spdifin.txt | 3 ++- .../devicetree/bindings/sound/amlogic,axg-spdifout.txt | 3 ++- .../devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt | 4 +++- 5 files changed, 12 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/sound/amlogic,axg-fifo.txt +3 -1
@@ -2,7 +2,9 @@ Required properties: - compatible: 'amlogic,axg-toddr' or - 'amlogic,axg-frddr' + 'amlogic,axg-toddr' or + 'amlogic,g12a-frddr' or + 'amlogic,g12a-toddr' - reg: physical base address of the controller and length of memory mapped region. - interrupts: interrupt specifier for the fifo.
Documentation/devicetree/bindings/sound/amlogic,axg-pdm.txt +2 -1
@@ -1,7 +1,8 @@ * Amlogic Audio PDM input Required properties: -- compatible: 'amlogic,axg-pdm' +- compatible: 'amlogic,axg-pdm' or + 'amlogic,g12a-pdm' - reg: physical base address of the controller and length of memory mapped region. - clocks: list of clock phandle, one for each entry clock-names.
Documentation/devicetree/bindings/sound/amlogic,axg-spdifin.txt +2 -1
@@ -1,7 +1,8 @@ * Amlogic Audio SPDIF Input Required properties: -- compatible: 'amlogic,axg-spdifin' +- compatible: 'amlogic,axg-spdifin' or + 'amlogic,g12a-spdifin' - interrupts: interrupt specifier for the spdif input. - clocks: list of clock phandle, one for each entry clock-names. - clock-names: should contain the following:
Documentation/devicetree/bindings/sound/amlogic,axg-spdifout.txt +2 -1
@@ -1,7 +1,8 @@ * Amlogic Audio SPDIF Output Required properties: -- compatible: 'amlogic,axg-spdifout' +- compatible: 'amlogic,axg-spdifout' or + 'amlogic,g12a-spdifout' - clocks: list of clock phandle, one for each entry clock-names. - clock-names: should contain the following: * "pclk" : peripheral clock.
Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt +3 -1
@@ -2,7 +2,9 @@ Required properties: - compatible: 'amlogic,axg-tdmin' or - 'amlogic,axg-tdmout' + 'amlogic,axg-tdmout' or + 'amlogic,g12a-tdmin' or + 'amlogic,g12a-tdmout' - reg: physical base address of the controller and length of memory mapped region. - clocks: list of clock phandle, one for each entry clock-names.
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH 2/6 ASoC: meson: axg-fifo: add g12a support
In reply to Jerome BrunetThe g12a fifos gained the ability to set the initial address of the pointer within the buffer, instead of defaulting to the buffer start address.
It is not very useful to us (yet) but we need to put a copy the buffer start address in the related register for the fifo to work properly on the g12a SoC family
--- sound/soc/meson/axg-fifo.c | 34 +++++++++++++++++++++++++++++++--- sound/soc/meson/axg-fifo.h | 2 ++ 2 files changed, 33 insertions(+), 3 deletions(-)
sound/soc/meson/axg-fifo.c +31 -3
@@ -19,7 +19,7 @@* This file implements the platform operations common to the playback and * capture frontend DAI. The logic behind this two types of fifo is very * similar but some difference exist. -* These differences the respective DAI drivers +* These differences are handled in the respective DAI drivers */ static struct snd_pcm_hardware axg_fifo_hw = {
@@ -133,6 +133,23 @@ static int axg_fifo_pcm_hw_params(struct snd_pcm_substream *ss,return 0 ; } +static int g12a_fifo_pcm_hw_params (struct snd_pcm_substream *ss, +struct snd_pcm_hw_params *params) +{ +struct axg_fifo *fifo =axg_fifo_data (ss); +struct snd_pcm_runtime *runtime = ss->runtime; +int ret; + + ret =axg_fifo_pcm_hw_params (ss, params); +if (ret) +return ret; + +/* Set the initial memory address of the DMA */ +regmap_write (fifo->map,FIFO_INIT_ADDR , runtime->dma_addr); + +return 0 ; +} +static int axg_fifo_pcm_hw_free (struct snd_pcm_substream *ss) {struct axg_fifo *fifo =axg_fifo_data (ss);
@@ -262,6 +279,17 @@ const struct snd_pcm_ops axg_fifo_pcm_ops = { };EXPORT_SYMBOL_GPL (axg_fifo_pcm_ops); +const struct snd_pcm_ops g12a_fifo_pcm_ops = { + .open = axg_fifo_pcm_open, + .close = axg_fifo_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = g12a_fifo_pcm_hw_params, + .hw_free = axg_fifo_pcm_hw_free, + .pointer = axg_fifo_pcm_pointer, + .trigger = axg_fifo_pcm_trigger, +}; +EXPORT_SYMBOL_GPL (g12a_fifo_pcm_ops); +int axg_fifo_pcm_new (struct snd_soc_pcm_runtime *rtd,unsigned int type) {struct snd_card *card = rtd->card->snd_card;
@@ -278,7 +306,7 @@ static const struct regmap_config axg_fifo_regmap_cfg = { .reg_bits = 32, .val_bits = 32, .reg_stride = 4, - .max_register = FIFO_STATUS2, + .max_register = FIFO_INIT_ADDR, };int axg_fifo_probe (struct platform_device *pdev)
@@ -339,6 +367,6 @@ int axg_fifo_probe(struct platform_device *pdev) }EXPORT_SYMBOL_GPL (axg_fifo_probe); -MODULE_DESCRIPTION ("Amlogic AXG fifo driver" ); +MODULE_DESCRIPTION ("Amlogic AXG/G12A fifo driver" );MODULE_AUTHOR ("Jerome Brunet <[email protected]>" );MODULE_LICENSE ("GPL v2" );
sound/soc/meson/axg-fifo.h +2 -0
@@ -60,6 +60,7 @@ struct snd_soc_pcm_runtime;#define FIFO_STATUS1 0x14#define STATUS1_INT_STS (x) ((x) << 0)#define FIFO_STATUS2 0x18 +#define FIFO_INIT_ADDR 0x24struct axg_fifo {struct regmap *map;
@@ -74,6 +75,7 @@ struct axg_fifo_match_data { };extern const struct snd_pcm_ops axg_fifo_pcm_ops; +extern const struct snd_pcm_ops g12a_fifo_pcm_ops;int axg_fifo_pcm_new (struct snd_soc_pcm_runtime *rtd,unsigned int type);int axg_fifo_probe (struct platform_device *pdev);
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "ASoC: meson: axg-fifo: add g12a support" to the asoc tree
The patch
ASoC: meson: axg-fifo: add g12a support
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
7c02509a8a9981fb2c16b75904423e7ab2f9f43aMon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Thu, 4 Apr 2019 13:17:29 +0200
Subject: [PATCH] ASoC: meson: axg-fifo: add g12a support
The g12a fifos gained the ability to set the initial address of the pointer within the buffer, instead of defaulting to the buffer start address.
It is not very useful to us (yet) but we need to put a copy the buffer start address in the related register for the fifo to work properly on the g12a SoC family
--- sound/soc/meson/axg-fifo.c | 34 +++++++++++++++++++++++++++++++--- sound/soc/meson/axg-fifo.h | 2 ++ 2 files changed, 33 insertions(+), 3 deletions(-)
sound/soc/meson/axg-fifo.c +31 -3
@@ -19,7 +19,7 @@* This file implements the platform operations common to the playback and * capture frontend DAI. The logic behind this two types of fifo is very * similar but some difference exist. -* These differences the respective DAI drivers +* These differences are handled in the respective DAI drivers */ static struct snd_pcm_hardware axg_fifo_hw = {
@@ -133,6 +133,23 @@ static int axg_fifo_pcm_hw_params(struct snd_pcm_substream *ss,return 0 ; } +static int g12a_fifo_pcm_hw_params (struct snd_pcm_substream *ss, +struct snd_pcm_hw_params *params) +{ +struct axg_fifo *fifo =axg_fifo_data (ss); +struct snd_pcm_runtime *runtime = ss->runtime; +int ret; + + ret =axg_fifo_pcm_hw_params (ss, params); +if (ret) +return ret; + +/* Set the initial memory address of the DMA */ +regmap_write (fifo->map,FIFO_INIT_ADDR , runtime->dma_addr); + +return 0 ; +} +static int axg_fifo_pcm_hw_free (struct snd_pcm_substream *ss) {struct axg_fifo *fifo =axg_fifo_data (ss);
@@ -262,6 +279,17 @@ const struct snd_pcm_ops axg_fifo_pcm_ops = { };EXPORT_SYMBOL_GPL (axg_fifo_pcm_ops); +const struct snd_pcm_ops g12a_fifo_pcm_ops = { + .open = axg_fifo_pcm_open, + .close = axg_fifo_pcm_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = g12a_fifo_pcm_hw_params, + .hw_free = axg_fifo_pcm_hw_free, + .pointer = axg_fifo_pcm_pointer, + .trigger = axg_fifo_pcm_trigger, +}; +EXPORT_SYMBOL_GPL (g12a_fifo_pcm_ops); +int axg_fifo_pcm_new (struct snd_soc_pcm_runtime *rtd,unsigned int type) {struct snd_card *card = rtd->card->snd_card;
@@ -278,7 +306,7 @@ static const struct regmap_config axg_fifo_regmap_cfg = { .reg_bits = 32, .val_bits = 32, .reg_stride = 4, - .max_register = FIFO_STATUS2, + .max_register = FIFO_INIT_ADDR, };int axg_fifo_probe (struct platform_device *pdev)
@@ -339,6 +367,6 @@ int axg_fifo_probe(struct platform_device *pdev) }EXPORT_SYMBOL_GPL (axg_fifo_probe); -MODULE_DESCRIPTION ("Amlogic AXG fifo driver" ); +MODULE_DESCRIPTION ("Amlogic AXG/G12A fifo driver" );MODULE_AUTHOR ("Jerome Brunet <[email protected]>" );MODULE_LICENSE ("GPL v2" );
sound/soc/meson/axg-fifo.h +2 -0
@@ -60,6 +60,7 @@ struct snd_soc_pcm_runtime;#define FIFO_STATUS1 0x14#define STATUS1_INT_STS (x) ((x) << 0)#define FIFO_STATUS2 0x18 +#define FIFO_INIT_ADDR 0x24struct axg_fifo {struct regmap *map;
@@ -74,6 +75,7 @@ struct axg_fifo_match_data { };extern const struct snd_pcm_ops axg_fifo_pcm_ops; +extern const struct snd_pcm_ops g12a_fifo_pcm_ops;int axg_fifo_pcm_new (struct snd_soc_pcm_runtime *rtd,unsigned int type);int axg_fifo_probe (struct platform_device *pdev);
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH 3/6 ASoC: meson: axg-toddr: add g12a support
In reply to Jerome BrunetSince the g12a SoC fifo can set the fifo initial start address, we must make sure to actually reset the write pointer to this address when starting a capture.
--- sound/soc/meson/axg-toddr.c | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
sound/soc/meson/axg-toddr.c +53 -0
@@ -24,6 +24,7 @@#define CTRL0_TODDR_MSB_POS (x) ((x) << 8)#define CTRL0_TODDR_LSB_POS_MASK GENMASK(7, 3)#define CTRL0_TODDR_LSB_POS (x) ((x) << 3) +#define CTRL1_TODDR_FORCE_FINISH BIT(25)#define TODDR_MSB_POS 31
@@ -33,6 +34,22 @@ static int axg_toddr_pcm_new(struct snd_soc_pcm_runtime *rtd,return axg_fifo_pcm_new (rtd,SNDRV_PCM_STREAM_CAPTURE ); } +static int g12a_toddr_dai_prepare (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct axg_fifo *fifo =snd_soc_dai_get_drvdata (dai); + +/* Reset the write pointer to the FIFO_INIT_ADDR */ +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_TODDR_FORCE_FINISH ,0 ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_TODDR_FORCE_FINISH ,CTRL1_TODDR_FORCE_FINISH ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_TODDR_FORCE_FINISH ,0 ); + +return 0 ; +} +static int axg_toddr_dai_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai)
@@ -172,10 +189,46 @@ static const struct axg_fifo_match_data axg_toddr_match_data = { .dai_drv = &axg_toddr_dai_drv }; +static const struct snd_soc_dai_ops g12a_toddr_ops = { + .prepare = g12a_toddr_dai_prepare, + .hw_params = axg_toddr_dai_hw_params, + .startup = axg_toddr_dai_startup, + .shutdown = axg_toddr_dai_shutdown, +}; + +static struct snd_soc_dai_driver g12a_toddr_dai_drv = { + .name ="TODDR" , + .capture = { + .stream_name ="Capture" , + .channels_min =1 , + .channels_max =AXG_FIFO_CH_MAX , + .rates =AXG_FIFO_RATES , + .formats =AXG_FIFO_FORMATS , + }, + .ops = &g12a_toddr_ops, + .pcm_new = axg_toddr_pcm_new, +}; + +static const struct snd_soc_component_driver g12a_toddr_component_drv = { + .dapm_widgets = axg_toddr_dapm_widgets, + .num_dapm_widgets =ARRAY_SIZE (axg_toddr_dapm_widgets), + .dapm_routes = axg_toddr_dapm_routes, + .num_dapm_routes =ARRAY_SIZE (axg_toddr_dapm_routes), + .ops = &g12a_fifo_pcm_ops +}; + +static const struct axg_fifo_match_data g12a_toddr_match_data = { + .component_drv = &g12a_toddr_component_drv, + .dai_drv = &g12a_toddr_dai_drv +}; +static const struct of_device_id axg_toddr_of_match[] = { { .compatible ="amlogic,axg-toddr" , .data = &axg_toddr_match_data, + }, { + .compatible ="amlogic,g12a-toddr" , + .data = &g12a_toddr_match_data, }, {} };MODULE_DEVICE_TABLE (of, axg_toddr_of_match);
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "ASoC: meson: axg-toddr: add g12a support" to the asoc tree
The patch
ASoC: meson: axg-toddr: add g12a support
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
a3c23a8ad4dc07100d916d75ca30c982288b868dMon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Thu, 4 Apr 2019 13:17:30 +0200
Subject: [PATCH] ASoC: meson: axg-toddr: add g12a support
Since the g12a SoC fifo can set the fifo initial start address, we must make sure to actually reset the write pointer to this address when starting a capture.
--- sound/soc/meson/axg-toddr.c | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
sound/soc/meson/axg-toddr.c +53 -0
@@ -24,6 +24,7 @@#define CTRL0_TODDR_MSB_POS (x) ((x) << 8)#define CTRL0_TODDR_LSB_POS_MASK GENMASK(7, 3)#define CTRL0_TODDR_LSB_POS (x) ((x) << 3) +#define CTRL1_TODDR_FORCE_FINISH BIT(25)#define TODDR_MSB_POS 31
@@ -33,6 +34,22 @@ static int axg_toddr_pcm_new(struct snd_soc_pcm_runtime *rtd,return axg_fifo_pcm_new (rtd,SNDRV_PCM_STREAM_CAPTURE ); } +static int g12a_toddr_dai_prepare (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct axg_fifo *fifo =snd_soc_dai_get_drvdata (dai); + +/* Reset the write pointer to the FIFO_INIT_ADDR */ +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_TODDR_FORCE_FINISH ,0 ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_TODDR_FORCE_FINISH ,CTRL1_TODDR_FORCE_FINISH ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_TODDR_FORCE_FINISH ,0 ); + +return 0 ; +} +static int axg_toddr_dai_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai)
@@ -172,10 +189,46 @@ static const struct axg_fifo_match_data axg_toddr_match_data = { .dai_drv = &axg_toddr_dai_drv }; +static const struct snd_soc_dai_ops g12a_toddr_ops = { + .prepare = g12a_toddr_dai_prepare, + .hw_params = axg_toddr_dai_hw_params, + .startup = axg_toddr_dai_startup, + .shutdown = axg_toddr_dai_shutdown, +}; + +static struct snd_soc_dai_driver g12a_toddr_dai_drv = { + .name ="TODDR" , + .capture = { + .stream_name ="Capture" , + .channels_min =1 , + .channels_max =AXG_FIFO_CH_MAX , + .rates =AXG_FIFO_RATES , + .formats =AXG_FIFO_FORMATS , + }, + .ops = &g12a_toddr_ops, + .pcm_new = axg_toddr_pcm_new, +}; + +static const struct snd_soc_component_driver g12a_toddr_component_drv = { + .dapm_widgets = axg_toddr_dapm_widgets, + .num_dapm_widgets =ARRAY_SIZE (axg_toddr_dapm_widgets), + .dapm_routes = axg_toddr_dapm_routes, + .num_dapm_routes =ARRAY_SIZE (axg_toddr_dapm_routes), + .ops = &g12a_fifo_pcm_ops +}; + +static const struct axg_fifo_match_data g12a_toddr_match_data = { + .component_drv = &g12a_toddr_component_drv, + .dai_drv = &g12a_toddr_dai_drv +}; +static const struct of_device_id axg_toddr_of_match[] = { { .compatible ="amlogic,axg-toddr" , .data = &axg_toddr_match_data, + }, { + .compatible ="amlogic,g12a-toddr" , + .data = &g12a_toddr_match_data, }, {} };MODULE_DEVICE_TABLE (of, axg_toddr_of_match);
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH 4/6 ASoC: meson: axg-frddr: add g12a support
In reply to Jerome BrunetOn the axg, frddr could only be connected to 1 downstream element, so the playback was possible on 1 interface only at a time.
On the g12a, the frddr may connect and wait for the request of up to 3 downstream elements. With this, it possible for single playback to be played on several interfaces at the same time.
Like the toddr fifo, the g12a frddr also need to take care of resetting the read pointer to the initial fifo address when preparing a playback.
--- sound/soc/meson/axg-frddr.c | 143 +++++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 3 deletions(-)
sound/soc/meson/axg-frddr.c +140 -3
@@ -3,7 +3,9 @@// Copyright (c) 2018 BayLibre, SAS. // Author: Jerome Brunet <[email protected]> -/* This driver implements the frontend playback DAI of AXG based SoCs */ +/* +* This driver implements the frontend playback DAI of AXG and G12A based SoCs +*/ #include <linux/clk.h> #include <linux/regmap.h>
@@ -14,7 +16,29 @@#include "axg-fifo.h" -#define CTRL0_FRDDR_PP_MODE BIT(30) +#define CTRL0_FRDDR_PP_MODE BIT(30) +#define CTRL0_SEL1_EN_SHIFT 3 +#define CTRL0_SEL2_SHIFT 4 +#define CTRL0_SEL2_EN_SHIFT 7 +#define CTRL0_SEL3_SHIFT 8 +#define CTRL0_SEL3_EN_SHIFT 11 +#define CTRL1_FRDDR_FORCE_FINISH BIT(12) + +static int g12a_frddr_dai_prepare (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct axg_fifo *fifo =snd_soc_dai_get_drvdata (dai); + +/* Reset the read pointer to the FIFO_INIT_ADDR */ +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_FRDDR_FORCE_FINISH ,0 ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_FRDDR_FORCE_FINISH ,CTRL1_FRDDR_FORCE_FINISH ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_FRDDR_FORCE_FINISH ,0 ); + +return 0 ; +}static int axg_frddr_dai_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai)
@@ -119,10 +143,123 @@ static const struct axg_fifo_match_data axg_frddr_match_data = { .dai_drv = &axg_frddr_dai_drv }; +static const struct snd_soc_dai_ops g12a_frddr_ops = { + .prepare = g12a_frddr_dai_prepare, + .startup = axg_frddr_dai_startup, + .shutdown = axg_frddr_dai_shutdown, +}; + +static struct snd_soc_dai_driver g12a_frddr_dai_drv = { + .name ="FRDDR" , + .playback = { + .stream_name ="Playback" , + .channels_min =1 , + .channels_max =AXG_FIFO_CH_MAX , + .rates =AXG_FIFO_RATES , + .formats =AXG_FIFO_FORMATS , + }, + .ops = &g12a_frddr_ops, + .pcm_new = axg_frddr_pcm_new, +}; + +static const char *const g12a_frddr_sel_texts[] = { +"OUT 0" ,"OUT 1" ,"OUT 2" ,"OUT 3" ,"OUT 4" , +}; + +static SOC_ENUM_SINGLE_DECL(g12a_frddr_sel1_enum, FIFO_CTRL0, CTRL0_SEL_SHIFT, + g12a_frddr_sel_texts); +static SOC_ENUM_SINGLE_DECL(g12a_frddr_sel2_enum, FIFO_CTRL0, CTRL0_SEL2_SHIFT, + g12a_frddr_sel_texts); +static SOC_ENUM_SINGLE_DECL(g12a_frddr_sel3_enum, FIFO_CTRL0, CTRL0_SEL3_SHIFT, + g12a_frddr_sel_texts); + +static const struct snd_kcontrol_new g12a_frddr_out1_demux = +SOC_DAPM_ENUM ("Output Src 1" , g12a_frddr_sel1_enum); +static const struct snd_kcontrol_new g12a_frddr_out2_demux = +SOC_DAPM_ENUM ("Output Src 2" , g12a_frddr_sel2_enum); +static const struct snd_kcontrol_new g12a_frddr_out3_demux = +SOC_DAPM_ENUM ("Output Src 3" , g12a_frddr_sel3_enum); + +static const struct snd_kcontrol_new g12a_frddr_out1_enable = +SOC_DAPM_SINGLE_AUTODISABLE ("Switch" ,FIFO_CTRL0 , +CTRL0_SEL1_EN_SHIFT ,1 ,0 ); +static const struct snd_kcontrol_new g12a_frddr_out2_enable = +SOC_DAPM_SINGLE_AUTODISABLE ("Switch" ,FIFO_CTRL0 , +CTRL0_SEL2_EN_SHIFT ,1 ,0 ); +static const struct snd_kcontrol_new g12a_frddr_out3_enable = +SOC_DAPM_SINGLE_AUTODISABLE ("Switch" ,FIFO_CTRL0 , +CTRL0_SEL3_EN_SHIFT ,1 ,0 ); + +static const struct snd_soc_dapm_widget g12a_frddr_dapm_widgets[] = { +SND_SOC_DAPM_AIF_OUT ("SRC 1" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("SRC 2" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("SRC 3" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_SWITCH ("SRC 1 EN" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out1_enable), +SND_SOC_DAPM_SWITCH ("SRC 2 EN" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out2_enable), +SND_SOC_DAPM_SWITCH ("SRC 3 EN" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out3_enable), +SND_SOC_DAPM_DEMUX ("SINK 1 SEL" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out1_demux), +SND_SOC_DAPM_DEMUX ("SINK 2 SEL" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out2_demux), +SND_SOC_DAPM_DEMUX ("SINK 3 SEL" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out3_demux), +SND_SOC_DAPM_AIF_OUT ("OUT 0" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 1" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 2" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 3" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 4" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +}; + +static const struct snd_soc_dapm_route g12a_frddr_dapm_routes[] = { + {"SRC 1" ,NULL ,"Playback" }, + {"SRC 2" ,NULL ,"Playback" }, + {"SRC 3" ,NULL ,"Playback" }, + {"SRC 1 EN" ,"Switch" ,"SRC 1" }, + {"SRC 2 EN" ,"Switch" ,"SRC 2" }, + {"SRC 3 EN" ,"Switch" ,"SRC 3" }, + {"SINK 1 SEL" ,NULL ,"SRC 1 EN" }, + {"SINK 2 SEL" ,NULL ,"SRC 2 EN" }, + {"SINK 3 SEL" ,NULL ,"SRC 3 EN" }, + {"OUT 0" ,"OUT 0" ,"SINK 1 SEL" }, + {"OUT 1" ,"OUT 1" ,"SINK 1 SEL" }, + {"OUT 2" ,"OUT 2" ,"SINK 1 SEL" }, + {"OUT 3" ,"OUT 3" ,"SINK 1 SEL" }, + {"OUT 4" ,"OUT 4" ,"SINK 1 SEL" }, + {"OUT 0" ,"OUT 0" ,"SINK 2 SEL" }, + {"OUT 1" ,"OUT 1" ,"SINK 2 SEL" }, + {"OUT 2" ,"OUT 2" ,"SINK 2 SEL" }, + {"OUT 3" ,"OUT 3" ,"SINK 2 SEL" }, + {"OUT 4" ,"OUT 4" ,"SINK 2 SEL" }, + {"OUT 0" ,"OUT 0" ,"SINK 3 SEL" }, + {"OUT 1" ,"OUT 1" ,"SINK 3 SEL" }, + {"OUT 2" ,"OUT 2" ,"SINK 3 SEL" }, + {"OUT 3" ,"OUT 3" ,"SINK 3 SEL" }, + {"OUT 4" ,"OUT 4" ,"SINK 3 SEL" }, +}; + +static const struct snd_soc_component_driver g12a_frddr_component_drv = { + .dapm_widgets = g12a_frddr_dapm_widgets, + .num_dapm_widgets =ARRAY_SIZE (g12a_frddr_dapm_widgets), + .dapm_routes = g12a_frddr_dapm_routes, + .num_dapm_routes =ARRAY_SIZE (g12a_frddr_dapm_routes), + .ops = &g12a_fifo_pcm_ops +}; + +static const struct axg_fifo_match_data g12a_frddr_match_data = { + .component_drv = &g12a_frddr_component_drv, + .dai_drv = &g12a_frddr_dai_drv +}; +static const struct of_device_id axg_frddr_of_match[] = { { .compatible ="amlogic,axg-frddr" , .data = &axg_frddr_match_data, + }, { + .compatible ="amlogic,g12a-frddr" , + .data = &g12a_frddr_match_data, }, {} };MODULE_DEVICE_TABLE (of, axg_frddr_of_match);
@@ -136,6 +273,6 @@ static struct platform_driver axg_frddr_pdrv = { };module_platform_driver (axg_frddr_pdrv); -MODULE_DESCRIPTION ("Amlogic AXG playback fifo driver" ); +MODULE_DESCRIPTION ("Amlogic AXG/G12A playback fifo driver" );MODULE_AUTHOR ("Jerome Brunet <[email protected]>" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "ASoC: meson: axg-frddr: add g12a support" to the asoc tree
The patch
ASoC: meson: axg-frddr: add g12a support
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
fcced66f208d778aa2dea05910161689503c16bfMon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Thu, 4 Apr 2019 13:17:31 +0200
Subject: [PATCH] ASoC: meson: axg-frddr: add g12a support
On the axg, frddr could only be connected to 1 downstream element, so the playback was possible on 1 interface only at a time.
On the g12a, the frddr may connect and wait for the request of up to 3 downstream elements. With this, it possible for single playback to be played on several interfaces at the same time.
Like the toddr fifo, the g12a frddr also need to take care of resetting the read pointer to the initial fifo address when preparing a playback.
--- sound/soc/meson/axg-frddr.c | 143 +++++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 3 deletions(-)
sound/soc/meson/axg-frddr.c +140 -3
@@ -3,7 +3,9 @@// Copyright (c) 2018 BayLibre, SAS. // Author: Jerome Brunet <[email protected]> -/* This driver implements the frontend playback DAI of AXG based SoCs */ +/* +* This driver implements the frontend playback DAI of AXG and G12A based SoCs +*/ #include <linux/clk.h> #include <linux/regmap.h>
@@ -14,7 +16,29 @@#include "axg-fifo.h" -#define CTRL0_FRDDR_PP_MODE BIT(30) +#define CTRL0_FRDDR_PP_MODE BIT(30) +#define CTRL0_SEL1_EN_SHIFT 3 +#define CTRL0_SEL2_SHIFT 4 +#define CTRL0_SEL2_EN_SHIFT 7 +#define CTRL0_SEL3_SHIFT 8 +#define CTRL0_SEL3_EN_SHIFT 11 +#define CTRL1_FRDDR_FORCE_FINISH BIT(12) + +static int g12a_frddr_dai_prepare (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct axg_fifo *fifo =snd_soc_dai_get_drvdata (dai); + +/* Reset the read pointer to the FIFO_INIT_ADDR */ +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_FRDDR_FORCE_FINISH ,0 ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_FRDDR_FORCE_FINISH ,CTRL1_FRDDR_FORCE_FINISH ); +regmap_update_bits (fifo->map,FIFO_CTRL1 , +CTRL1_FRDDR_FORCE_FINISH ,0 ); + +return 0 ; +}static int axg_frddr_dai_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai)
@@ -119,10 +143,123 @@ static const struct axg_fifo_match_data axg_frddr_match_data = { .dai_drv = &axg_frddr_dai_drv }; +static const struct snd_soc_dai_ops g12a_frddr_ops = { + .prepare = g12a_frddr_dai_prepare, + .startup = axg_frddr_dai_startup, + .shutdown = axg_frddr_dai_shutdown, +}; + +static struct snd_soc_dai_driver g12a_frddr_dai_drv = { + .name ="FRDDR" , + .playback = { + .stream_name ="Playback" , + .channels_min =1 , + .channels_max =AXG_FIFO_CH_MAX , + .rates =AXG_FIFO_RATES , + .formats =AXG_FIFO_FORMATS , + }, + .ops = &g12a_frddr_ops, + .pcm_new = axg_frddr_pcm_new, +}; + +static const char *const g12a_frddr_sel_texts[] = { +"OUT 0" ,"OUT 1" ,"OUT 2" ,"OUT 3" ,"OUT 4" , +}; + +static SOC_ENUM_SINGLE_DECL(g12a_frddr_sel1_enum, FIFO_CTRL0, CTRL0_SEL_SHIFT, + g12a_frddr_sel_texts); +static SOC_ENUM_SINGLE_DECL(g12a_frddr_sel2_enum, FIFO_CTRL0, CTRL0_SEL2_SHIFT, + g12a_frddr_sel_texts); +static SOC_ENUM_SINGLE_DECL(g12a_frddr_sel3_enum, FIFO_CTRL0, CTRL0_SEL3_SHIFT, + g12a_frddr_sel_texts); + +static const struct snd_kcontrol_new g12a_frddr_out1_demux = +SOC_DAPM_ENUM ("Output Src 1" , g12a_frddr_sel1_enum); +static const struct snd_kcontrol_new g12a_frddr_out2_demux = +SOC_DAPM_ENUM ("Output Src 2" , g12a_frddr_sel2_enum); +static const struct snd_kcontrol_new g12a_frddr_out3_demux = +SOC_DAPM_ENUM ("Output Src 3" , g12a_frddr_sel3_enum); + +static const struct snd_kcontrol_new g12a_frddr_out1_enable = +SOC_DAPM_SINGLE_AUTODISABLE ("Switch" ,FIFO_CTRL0 , +CTRL0_SEL1_EN_SHIFT ,1 ,0 ); +static const struct snd_kcontrol_new g12a_frddr_out2_enable = +SOC_DAPM_SINGLE_AUTODISABLE ("Switch" ,FIFO_CTRL0 , +CTRL0_SEL2_EN_SHIFT ,1 ,0 ); +static const struct snd_kcontrol_new g12a_frddr_out3_enable = +SOC_DAPM_SINGLE_AUTODISABLE ("Switch" ,FIFO_CTRL0 , +CTRL0_SEL3_EN_SHIFT ,1 ,0 ); + +static const struct snd_soc_dapm_widget g12a_frddr_dapm_widgets[] = { +SND_SOC_DAPM_AIF_OUT ("SRC 1" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("SRC 2" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("SRC 3" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_SWITCH ("SRC 1 EN" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out1_enable), +SND_SOC_DAPM_SWITCH ("SRC 2 EN" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out2_enable), +SND_SOC_DAPM_SWITCH ("SRC 3 EN" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out3_enable), +SND_SOC_DAPM_DEMUX ("SINK 1 SEL" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out1_demux), +SND_SOC_DAPM_DEMUX ("SINK 2 SEL" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out2_demux), +SND_SOC_DAPM_DEMUX ("SINK 3 SEL" ,SND_SOC_NOPM ,0 ,0 , + &g12a_frddr_out3_demux), +SND_SOC_DAPM_AIF_OUT ("OUT 0" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 1" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 2" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 3" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("OUT 4" ,NULL ,0 ,SND_SOC_NOPM ,0 ,0 ), +}; + +static const struct snd_soc_dapm_route g12a_frddr_dapm_routes[] = { + {"SRC 1" ,NULL ,"Playback" }, + {"SRC 2" ,NULL ,"Playback" }, + {"SRC 3" ,NULL ,"Playback" }, + {"SRC 1 EN" ,"Switch" ,"SRC 1" }, + {"SRC 2 EN" ,"Switch" ,"SRC 2" }, + {"SRC 3 EN" ,"Switch" ,"SRC 3" }, + {"SINK 1 SEL" ,NULL ,"SRC 1 EN" }, + {"SINK 2 SEL" ,NULL ,"SRC 2 EN" }, + {"SINK 3 SEL" ,NULL ,"SRC 3 EN" }, + {"OUT 0" ,"OUT 0" ,"SINK 1 SEL" }, + {"OUT 1" ,"OUT 1" ,"SINK 1 SEL" }, + {"OUT 2" ,"OUT 2" ,"SINK 1 SEL" }, + {"OUT 3" ,"OUT 3" ,"SINK 1 SEL" }, + {"OUT 4" ,"OUT 4" ,"SINK 1 SEL" }, + {"OUT 0" ,"OUT 0" ,"SINK 2 SEL" }, + {"OUT 1" ,"OUT 1" ,"SINK 2 SEL" }, + {"OUT 2" ,"OUT 2" ,"SINK 2 SEL" }, + {"OUT 3" ,"OUT 3" ,"SINK 2 SEL" }, + {"OUT 4" ,"OUT 4" ,"SINK 2 SEL" }, + {"OUT 0" ,"OUT 0" ,"SINK 3 SEL" }, + {"OUT 1" ,"OUT 1" ,"SINK 3 SEL" }, + {"OUT 2" ,"OUT 2" ,"SINK 3 SEL" }, + {"OUT 3" ,"OUT 3" ,"SINK 3 SEL" }, + {"OUT 4" ,"OUT 4" ,"SINK 3 SEL" }, +}; + +static const struct snd_soc_component_driver g12a_frddr_component_drv = { + .dapm_widgets = g12a_frddr_dapm_widgets, + .num_dapm_widgets =ARRAY_SIZE (g12a_frddr_dapm_widgets), + .dapm_routes = g12a_frddr_dapm_routes, + .num_dapm_routes =ARRAY_SIZE (g12a_frddr_dapm_routes), + .ops = &g12a_fifo_pcm_ops +}; + +static const struct axg_fifo_match_data g12a_frddr_match_data = { + .component_drv = &g12a_frddr_component_drv, + .dai_drv = &g12a_frddr_dai_drv +}; +static const struct of_device_id axg_frddr_of_match[] = { { .compatible ="amlogic,axg-frddr" , .data = &axg_frddr_match_data, + }, { + .compatible ="amlogic,g12a-frddr" , + .data = &g12a_frddr_match_data, }, {} };MODULE_DEVICE_TABLE (of, axg_frddr_of_match);
@@ -136,6 +273,6 @@ static struct platform_driver axg_frddr_pdrv = { };module_platform_driver (axg_frddr_pdrv); -MODULE_DESCRIPTION ("Amlogic AXG playback fifo driver" ); +MODULE_DESCRIPTION ("Amlogic AXG/G12A playback fifo driver" );MODULE_AUTHOR ("Jerome Brunet <[email protected]>" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH 5/6 ASoC: meson: axg-tdm-formatter: rework quirks settings
In reply to Jerome BrunetThe g12a tdmout requires a different signal skew offset than the axg. With this change, the skew offset is added as a parameter of the tdm formatters to prepare the addition of the g12a support.
--- sound/soc/meson/axg-tdm-formatter.c | 6 ++++-- sound/soc/meson/axg-tdm-formatter.h | 11 +++++++++-- sound/soc/meson/axg-tdmin.c | 16 +++++++++++----- sound/soc/meson/axg-tdmout.c | 16 +++++++++++----- 4 files changed, 35 insertions(+), 14 deletions(-)
sound/soc/meson/axg-tdm-formatter.c +4 -2
@@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks);static int axg_tdm_formatter_enable (struct axg_tdm_formatter *formatter) {struct axg_tdm_stream *ts = formatter->stream; -bool invert = formatter->drv->invert_sclk; +bool invert = formatter->drv->quirks->invert_sclk;int ret;/* Do nothing if the formatter is already enabled */
@@ -85,7 +85,9 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter)return ret;/* Setup the stream parameter in the formatter */ - ret = formatter->drv->ops->prepare (formatter->map, formatter->stream); + ret = formatter->drv->ops->prepare (formatter->map, + formatter->drv->quirks, + formatter->stream);if (ret)return ret;
sound/soc/meson/axg-tdm-formatter.h +9 -2
@@ -14,18 +14,25 @@ struct regmap;struct snd_soc_dapm_widget ;struct snd_kcontrol ; +struct axg_tdm_formatter_hw { +unsigned int skew_offset; +bool invert_sclk; +}; +struct axg_tdm_formatter_ops {struct axg_tdm_stream *(*get_stream)(struct snd_soc_dapm_widget *w);void (*enable)(struct regmap *map);void (*disable)(struct regmap *map); -int (*prepare)(struct regmap *map,struct axg_tdm_stream *ts); +int (*prepare)(struct regmap *map, +const struct axg_tdm_formatter_hw *quirks, +struct axg_tdm_stream *ts); };struct axg_tdm_formatter_driver {const struct snd_soc_component_driver *component_drv;const struct regmap_config *regmap_cfg;const struct axg_tdm_formatter_ops *ops; -bool invert_sclk; +const struct axg_tdm_formatter_hw *quirks; }; int axg_tdm_formatter_set_channel_masks(struct regmap *map,
sound/soc/meson/axg-tdmin.c +11 -5
@@ -107,21 +107,22 @@ static void axg_tdmin_disable(struct regmap *map)regmap_update_bits (map,TDMIN_CTRL ,TDMIN_CTRL_ENABLE ,0 ); } -static int axg_tdmin_prepare (struct regmap *map,struct axg_tdm_stream *ts) +static int axg_tdmin_prepare (struct regmap *map, +const struct axg_tdm_formatter_hw *quirks, +struct axg_tdm_stream *ts) { -unsigned int val =0 ; +unsigned int val, skew = quirks->skew_offset;/* Set stream skew */ switch (ts->iface->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :case SND_SOC_DAIFMT_DSP_A : - val |=TDMIN_CTRL_IN_BIT_SKEW (3 ); + skew +=1 ;break ;case SND_SOC_DAIFMT_LEFT_J :case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : - val =TDMIN_CTRL_IN_BIT_SKEW (2 );break ;default :
@@ -130,6 +131,8 @@ static int axg_tdmin_prepare(struct regmap *map, struct axg_tdm_stream *ts)return -EINVAL ; } + val =TDMIN_CTRL_IN_BIT_SKEW (skew); +/* Set stream format mode */ switch (ts->iface->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :
@@ -204,7 +207,10 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = { .component_drv = &axg_tdmin_component_drv, .regmap_cfg = &axg_tdmin_regmap_cfg, .ops = &axg_tdmin_ops, - .invert_sclk = false, + .quirks = &(const struct axg_tdm_formatter_hw ) { + .invert_sclk = false, + .skew_offset =2 , + }, };static const struct of_device_id axg_tdmin_of_match[] = {
sound/soc/meson/axg-tdmout.c +11 -5
@@ -124,21 +124,22 @@ static void axg_tdmout_disable(struct regmap *map)regmap_update_bits (map,TDMOUT_CTRL0 ,TDMOUT_CTRL0_ENABLE ,0 ); } -static int axg_tdmout_prepare (struct regmap *map,struct axg_tdm_stream *ts) +static int axg_tdmout_prepare (struct regmap *map, +const struct axg_tdm_formatter_hw *quirks, +struct axg_tdm_stream *ts) { -unsigned int val =0 ; +unsigned int val, skew = quirks->skew_offset;/* Set the stream skew */ switch (ts->iface->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :case SND_SOC_DAIFMT_DSP_A : - val |=TDMOUT_CTRL0_INIT_BITNUM (1 );break ;case SND_SOC_DAIFMT_LEFT_J :case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : - val |=TDMOUT_CTRL0_INIT_BITNUM (2 ); + skew +=1 ;break ;default :
@@ -147,6 +148,8 @@ static int axg_tdmout_prepare(struct regmap *map, struct axg_tdm_stream *ts)return -EINVAL ; } + val =TDMOUT_CTRL0_INIT_BITNUM (skew); +/* Set the slot width */ val |=TDMOUT_CTRL0_BITNUM (ts->iface->slot_width -1 );
@@ -234,7 +237,10 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { .component_drv = &axg_tdmout_component_drv, .regmap_cfg = &axg_tdmout_regmap_cfg, .ops = &axg_tdmout_ops, - .invert_sclk = true, + .quirks = &(const struct axg_tdm_formatter_hw ) { + .invert_sclk = true, + .skew_offset =1 , + }, };static const struct of_device_id axg_tdmout_of_match[] = {
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "ASoC: meson: axg-tdm-formatter: rework quirks settings" to the asoc tree
The patch
ASoC: meson: axg-tdm-formatter: rework quirks settings
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
f01bc67f58fde599b48d2dde5d0f48dccd84c4f1Mon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Thu, 4 Apr 2019 13:17:32 +0200
Subject: [PATCH] ASoC: meson: axg-tdm-formatter: rework quirks settings
The g12a tdmout requires a different signal skew offset than the axg. With this change, the skew offset is added as a parameter of the tdm formatters to prepare the addition of the g12a support.
--- sound/soc/meson/axg-tdm-formatter.c | 6 ++++-- sound/soc/meson/axg-tdm-formatter.h | 11 +++++++++-- sound/soc/meson/axg-tdmin.c | 16 +++++++++++----- sound/soc/meson/axg-tdmout.c | 16 +++++++++++----- 4 files changed, 35 insertions(+), 14 deletions(-)
sound/soc/meson/axg-tdm-formatter.c +4 -2
@@ -68,7 +68,7 @@ EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks);static int axg_tdm_formatter_enable (struct axg_tdm_formatter *formatter) {struct axg_tdm_stream *ts = formatter->stream; -bool invert = formatter->drv->invert_sclk; +bool invert = formatter->drv->quirks->invert_sclk;int ret;/* Do nothing if the formatter is already enabled */
@@ -85,7 +85,9 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter)return ret;/* Setup the stream parameter in the formatter */ - ret = formatter->drv->ops->prepare (formatter->map, formatter->stream); + ret = formatter->drv->ops->prepare (formatter->map, + formatter->drv->quirks, + formatter->stream);if (ret)return ret;
sound/soc/meson/axg-tdm-formatter.h +9 -2
@@ -14,18 +14,25 @@ struct regmap;struct snd_soc_dapm_widget ;struct snd_kcontrol ; +struct axg_tdm_formatter_hw { +unsigned int skew_offset; +bool invert_sclk; +}; +struct axg_tdm_formatter_ops {struct axg_tdm_stream *(*get_stream)(struct snd_soc_dapm_widget *w);void (*enable)(struct regmap *map);void (*disable)(struct regmap *map); -int (*prepare)(struct regmap *map,struct axg_tdm_stream *ts); +int (*prepare)(struct regmap *map, +const struct axg_tdm_formatter_hw *quirks, +struct axg_tdm_stream *ts); };struct axg_tdm_formatter_driver {const struct snd_soc_component_driver *component_drv;const struct regmap_config *regmap_cfg;const struct axg_tdm_formatter_ops *ops; -bool invert_sclk; +const struct axg_tdm_formatter_hw *quirks; }; int axg_tdm_formatter_set_channel_masks(struct regmap *map,
sound/soc/meson/axg-tdmin.c +11 -5
@@ -107,21 +107,22 @@ static void axg_tdmin_disable(struct regmap *map)regmap_update_bits (map,TDMIN_CTRL ,TDMIN_CTRL_ENABLE ,0 ); } -static int axg_tdmin_prepare (struct regmap *map,struct axg_tdm_stream *ts) +static int axg_tdmin_prepare (struct regmap *map, +const struct axg_tdm_formatter_hw *quirks, +struct axg_tdm_stream *ts) { -unsigned int val =0 ; +unsigned int val, skew = quirks->skew_offset;/* Set stream skew */ switch (ts->iface->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :case SND_SOC_DAIFMT_DSP_A : - val |=TDMIN_CTRL_IN_BIT_SKEW (3 ); + skew +=1 ;break ;case SND_SOC_DAIFMT_LEFT_J :case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : - val =TDMIN_CTRL_IN_BIT_SKEW (2 );break ;default :
@@ -130,6 +131,8 @@ static int axg_tdmin_prepare(struct regmap *map, struct axg_tdm_stream *ts)return -EINVAL ; } + val =TDMIN_CTRL_IN_BIT_SKEW (skew); +/* Set stream format mode */ switch (ts->iface->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :
@@ -204,7 +207,10 @@ static const struct axg_tdm_formatter_driver axg_tdmin_drv = { .component_drv = &axg_tdmin_component_drv, .regmap_cfg = &axg_tdmin_regmap_cfg, .ops = &axg_tdmin_ops, - .invert_sclk = false, + .quirks = &(const struct axg_tdm_formatter_hw ) { + .invert_sclk = false, + .skew_offset =2 , + }, };static const struct of_device_id axg_tdmin_of_match[] = {
sound/soc/meson/axg-tdmout.c +11 -5
@@ -124,21 +124,22 @@ static void axg_tdmout_disable(struct regmap *map)regmap_update_bits (map,TDMOUT_CTRL0 ,TDMOUT_CTRL0_ENABLE ,0 ); } -static int axg_tdmout_prepare (struct regmap *map,struct axg_tdm_stream *ts) +static int axg_tdmout_prepare (struct regmap *map, +const struct axg_tdm_formatter_hw *quirks, +struct axg_tdm_stream *ts) { -unsigned int val =0 ; +unsigned int val, skew = quirks->skew_offset;/* Set the stream skew */ switch (ts->iface->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S :case SND_SOC_DAIFMT_DSP_A : - val |=TDMOUT_CTRL0_INIT_BITNUM (1 );break ;case SND_SOC_DAIFMT_LEFT_J :case SND_SOC_DAIFMT_RIGHT_J :case SND_SOC_DAIFMT_DSP_B : - val |=TDMOUT_CTRL0_INIT_BITNUM (2 ); + skew +=1 ;break ;default :
@@ -147,6 +148,8 @@ static int axg_tdmout_prepare(struct regmap *map, struct axg_tdm_stream *ts)return -EINVAL ; } + val =TDMOUT_CTRL0_INIT_BITNUM (skew); +/* Set the slot width */ val |=TDMOUT_CTRL0_BITNUM (ts->iface->slot_width -1 );
@@ -234,7 +237,10 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { .component_drv = &axg_tdmout_component_drv, .regmap_cfg = &axg_tdmout_regmap_cfg, .ops = &axg_tdmout_ops, - .invert_sclk = true, + .quirks = &(const struct axg_tdm_formatter_hw ) { + .invert_sclk = true, + .skew_offset =1 , + }, };static const struct of_device_id axg_tdmout_of_match[] = {
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH 6/6 ASoC: meson: axg-tdmout: add g12a support
In reply to Jerome BrunetThe axg tdmout driver just need a different skew offset to operate correctly on the g12a SoC family.
--- sound/soc/meson/axg-tdmout.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/meson/axg-tdmout.c +13 -0
@@ -243,10 +243,23 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { }, }; +static const struct axg_tdm_formatter_driver g12a_tdmout_drv = { + .component_drv = &axg_tdmout_component_drv, + .regmap_cfg = &axg_tdmout_regmap_cfg, + .ops = &axg_tdmout_ops, + .quirks = &(const struct axg_tdm_formatter_hw ) { + .invert_sclk = true, + .skew_offset =2 , + }, +}; +static const struct of_device_id axg_tdmout_of_match[] = { { .compatible ="amlogic,axg-tdmout" , .data = &axg_tdmout_drv, + }, { + .compatible ="amlogic,g12a-tdmout" , + .data = &g12a_tdmout_drv, }, {} };MODULE_DEVICE_TABLE (of, axg_tdmout_of_match);
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "ASoC: meson: axg-tdmout: add g12a support" to the asoc tree
The patch
ASoC: meson: axg-tdmout: add g12a support
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
aa191a37b801be6c5abebe77e67dcec7c5c0faeeMon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Thu, 4 Apr 2019 13:17:33 +0200
Subject: [PATCH] ASoC: meson: axg-tdmout: add g12a support
The axg tdmout driver just need a different skew offset to operate correctly on the g12a SoC family.
--- sound/soc/meson/axg-tdmout.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/meson/axg-tdmout.c +13 -0
@@ -243,10 +243,23 @@ static const struct axg_tdm_formatter_driver axg_tdmout_drv = { }, }; +static const struct axg_tdm_formatter_driver g12a_tdmout_drv = { + .component_drv = &axg_tdmout_component_drv, + .regmap_cfg = &axg_tdmout_regmap_cfg, + .ops = &axg_tdmout_ops, + .quirks = &(const struct axg_tdm_formatter_hw ) { + .invert_sclk = true, + .skew_offset =2 , + }, +}; +static const struct of_device_id axg_tdmout_of_match[] = { { .compatible ="amlogic,axg-tdmout" , .data = &axg_tdmout_drv, + }, { + .compatible ="amlogic,g12a-tdmout" , + .data = &g12a_tdmout_drv, }, {} };MODULE_DEVICE_TABLE (of, axg_tdmout_of_match);
Signature · 1 line
2.20.1