Add new module driver for new ASRC
Subsystems (4)
v2 cover Add new module driver for new ASRC
Add new module driver for new ASRC in i.MX8MN.
Shengjiu Wang (3):
ASoC: fsl_asrc: Move common definition to fsl_asrc_common
ASoC: dt-bindings: fsl_easrc: Add document for EASRC
ASoC: fsl_easrc: Add EASRC ASoC CPU DAI and platform drivers
changes in v2
- change i.MX815 to i.MX8MN
- Add changes in Kconfig and Makefile
.../devicetree/bindings/sound/fsl,easrc.txt | 57 + sound/soc/fsl/Kconfig | 10 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc.h | 11 +- sound/soc/fsl/fsl_asrc_common.h | 22 + sound/soc/fsl/fsl_easrc.c | 2265 +++++++++++++++++ sound/soc/fsl/fsl_easrc.h | 668 +++++ sound/soc/fsl/fsl_easrc_dma.c | 440 ++++ 8 files changed, 3465 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt create mode 100644 sound/soc/fsl/fsl_asrc_common.h create mode 100644 sound/soc/fsl/fsl_easrc.c create mode 100644 sound/soc/fsl/fsl_easrc.h create mode 100644 sound/soc/fsl/fsl_easrc_dma.c
Signature · 1 line
2.21.0
PATCH v2 1/3 ASoC: fsl_asrc: Move common definition to fsl_asrc_common
There is a new ASRC included in i.MX serial platform, there are some common definition can be shared with each other. So move the common definition to a separate header file.
--- sound/soc/fsl/fsl_asrc.h | 11 +---------- sound/soc/fsl/fsl_asrc_common.h | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 sound/soc/fsl/fsl_asrc_common.h
sound/soc/fsl/fsl_asrc.h +1 -10
@@ -10,8 +10,7 @@#ifndef _FSL_ASRC_H#define _FSL_ASRC_H -#define IN 0 -#define OUT 1 +#include "fsl_asrc_common.h" #define ASRC_DMA_BUFFER_NUM 2#define ASRC_INPUTFIFO_THRESHOLD 32
@@ -283,14 +282,6 @@#define ASRMCR1i_OW16_MASK (1 << ASRMCR1i_OW16_SHIFT)#define ASRMCR1i_OW16 (v) ((v) << ASRMCR1i_OW16_SHIFT) - -enum asrc_pair_index { -ASRC_INVALID_PAIR =-1 , -ASRC_PAIR_A =0 , -ASRC_PAIR_B =1 , -ASRC_PAIR_C =2 , -}; -#define ASRC_PAIR_MAX_NUM (ASRC_PAIR_C + 1)enum asrc_inclk {
sound/soc/fsl/fsl_asrc_common.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright 2019 NXP +* +*/ + +#ifndef _FSL_ASRC_COMMON_H +#define _FSL_ASRC_COMMON_H + +/* directions */ +#define IN 0 +#define OUT 1 + +enum asrc_pair_index { +ASRC_INVALID_PAIR =-1 , +ASRC_PAIR_A =0 , +ASRC_PAIR_B =1 , +ASRC_PAIR_C =2 , +}; + +#endif /* _FSL_ASRC_COMMON_H */
Signature · 1 line
2.21.0
PATCH v2 2/3 ASoC: dt-bindings: fsl_easrc: Add document for EASRC
In reply to Shengjiu WangEASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX8MN.
--- .../devicetree/bindings/sound/fsl,easrc.txt | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt
Documentation/devicetree/bindings/sound/fsl,easrc.txt new file +57 -0
@@ -0,0 +1,57 @@ +NXP Asynchronous Sample Rate Converter (ASRC) Controller + +The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a +signal associated with an input clock into a signal associated with a different +output clock. The driver currently works as a Front End of DPCM with other Back +Ends Audio controller such as ESAI, SSI and SAI. It has four context to support +four substreams within totally 32 channels. + +Required properties: +- compatible: Contains "fsl,imx8mn-easrc". + +- reg: Offset and length of the register set for the + device. + +- interrupts: Contains the asrc interrupt. + +- dmas: Generic dma devicetree binding as described in + Documentation/devicetree/bindings/dma/dma.txt. + +- dma-names: Contains "ctx0_rx", "ctx0_tx", + "ctx1_rx", "ctx1_tx", + "ctx2_rx", "ctx2_tx", + "ctx3_rx", "ctx3_tx". + +- clocks: Contains an entry for each entry in clock-names. + +- clock-names: "mem" - Peripheral clock to driver module. + +- fsl,easrc-ram-script-name: The coefficient table for the filters + +- fsl,asrc-rate: Defines a mutual sample rate used by DPCM Back + Ends. + +- fsl,asrc-width: Defines a mutual sample width used by DPCM Back + Ends. + +Example: + +easrc: easrc@300C0000 { + compatible = "fsl,imx8mn-easrc"; + reg = <0x0 0x300C0000 0x0 0x10000>; + interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX8MN_CLK_ASRC_ROOT>; + clock-names = "mem"; + dmas = <&sdma2 16 23 0> , <&sdma2 17 23 0>, + <&sdma2 18 23 0> , <&sdma2 19 23 0>, + <&sdma2 20 23 0> , <&sdma2 21 23 0>, + <&sdma2 22 23 0> , <&sdma2 23 23 0>; + dma-names = "ctx0_rx", "ctx0_tx", + "ctx1_rx", "ctx1_tx", + "ctx2_rx", "ctx2_tx", + "ctx3_rx", "ctx3_tx"; + fsl,easrc-ram-script-name = "imx/easrc/easrc-imx8mn.bin"; + fsl,asrc-rate = <8000>; + fsl,asrc-width = <16>; + status = "disabled"; +};
Signature · 1 line
2.21.0
PATCH v2 3/3 ASoC: fsl_easrc: Add EASRC ASoC CPU DAI and platform drivers
In reply to Shengjiu WangEASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX8MN. It is different with old ASRC module.
The primary features for the EASRC are as follows:
- 4 Contexts - groups of channels with an independent time base
- Fully independent and concurrent context control
- Simultaneous processing of up to 32 audio channels
- Programmable filter charachteristics for each context
- 32, 24, 20, and 16-bit fixed point audio sample support
- 32-bit floating point audio sample support
- 8kHz to 384kHz sample rate
- 1/16 to 8x sample rate conversion ratio
--- sound/soc/fsl/Kconfig | 10 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc_common.h | 1 + sound/soc/fsl/fsl_easrc.c | 2265 +++++++++++++++++++++++++++++++ sound/soc/fsl/fsl_easrc.h | 668 +++++++++ sound/soc/fsl/fsl_easrc_dma.c | 440 ++++++ 6 files changed, 3386 insertions(+) create mode 100644 sound/soc/fsl/fsl_easrc.c create mode 100644 sound/soc/fsl/fsl_easrc.h create mode 100644 sound/soc/fsl/fsl_easrc_dma.c
sound/soc/fsl/Kconfig +10 -0
@@ -84,6 +84,16 @@ config SND_SOC_FSL_MICFIL Say Y if you want to add Pulse Density Modulation microphone interface (MICFIL) support for NXP. +config SND_SOC_FSL_EASRC + tristate "Enhanced Asynchronous Sample Rate Converter (EASRC) module support" + select REGMAP_MMIO + select SND_SOC_GENERIC_DMAENGINE_PCM + help + Say Y if you want to add Enhanced ASRC support for NXP. The ASRC is + a digital module that converts audio from a source sample rate to a + destination sample rate. It is a new design module compare with the + old ASRC. + config SND_SOC_FSL_UTILS tristate
sound/soc/fsl/Makefile +2 -0
@@ -24,6 +24,7 @@ snd-soc-fsl-micfil-objs := fsl_micfil.o snd-soc-fsl-utils-objs := fsl_utils.o snd-soc-fsl-dma-objs := fsl_dma.o snd-soc-fsl-mqs-objs := fsl_mqs.o +snd-soc-fsl-easrc-objs := fsl_easrc.o fsl_easrc_dma.o obj-$(CONFIG_SND_SOC_FSL_AUDMIX) += snd-soc-fsl-audmix.o obj-$(CONFIG_SND_SOC_FSL_ASOC_CARD) += snd-soc-fsl-asoc-card.o
@@ -35,6 +36,7 @@ obj-$(CONFIG_SND_SOC_FSL_ESAI) += snd-soc-fsl-esai.o obj-$(CONFIG_SND_SOC_FSL_MICFIL) += snd-soc-fsl-micfil.o obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o obj-$(CONFIG_SND_SOC_FSL_MQS) += snd-soc-fsl-mqs.o +obj-$(CONFIG_SND_SOC_FSL_EASRC) += snd-soc-fsl-easrc.o obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o # MPC5200 Platform Support
sound/soc/fsl/fsl_asrc_common.h +1 -0
@@ -16,6 +16,7 @@ enum asrc_pair_index {ASRC_PAIR_A =0 ,ASRC_PAIR_B =1 ,ASRC_PAIR_C =2 , + ASRC_PAIR_D = 3, };#endif /* _FSL_ASRC_COMMON_H */
sound/soc/fsl/fsl_easrc.c new file +2265 -0
2,265 lines not on this page · raw message
sound/soc/fsl/fsl_easrc.h new file +668 -0
668 lines not on this page · raw message
sound/soc/fsl/fsl_easrc_dma.c new file +440 -0
30 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.0
Part of the diff is not shown here. View the raw message.
Nicolin Chen
reviewerRe: [PATCH v2 2/3] ASoC: dt-bindings: fsl_easrc: Add document for EASRC
In reply to Shengjiu WangQuoted 15 lines · Shengjiu Wang
EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX8MN.
Signed-off-by Shengjiu Wang <[email protected]>--- .../devicetree/bindings/sound/fsl,easrc.txt | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txtDocumentation/devicetree/bindings/sound/fsl,easrc.txt new file +0
-0
Documentation/devicetree/bindings/sound/fsl,easrc.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/sound/fsl,easrc.txt new file +1
-0@@ -0,0 +1,57 @@ +NXP Asynchronous Sample Rate Converter (ASRC) Controller
Missing "Enhanced", I guess.
And "ASRC" => "EASRC"
Documentation/devicetree/bindings/sound/fsl,easrc.txt line 3
Quoted 1 line
Documentation/devicetree/bindings/sound/fsl,easrc.txt new file +1
-0+The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a
Ditto
Documentation/devicetree/bindings/sound/fsl,easrc.txt line 6
Quoted 3 lines
Documentation/devicetree/bindings/sound/fsl,easrc.txt new file +3
-0+signal associated with an input clock into a signal associated with a different +output clock. The driver currently works as a Front End of DPCM with other Back +Ends Audio controller such as ESAI, SSI and SAI. It has four context to support
"context" => "contexts"
Btw, what's the definition of this "context"?
And, is SSI still available on imx8mn?
Nicolin Chen
reviewerRe: [PATCH v2 3/3] ASoC: fsl_easrc: Add EASRC ASoC CPU DAI and platform drivers
In reply to Shengjiu WangQuoted 13 lines · Shengjiu Wang
EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX8MN. It is different with old ASRC module.
The primary features for the EASRC are as follows:
- 4 Contexts - groups of channels with an independent time base
- Fully independent and concurrent context control
- Simultaneous processing of up to 32 audio channels
- Programmable filter charachteristics for each context
- 32, 24, 20, and 16-bit fixed point audio sample support
- 32-bit floating point audio sample support
- 8kHz to 384kHz sample rate
- 1/16 to 8x sample rate conversion ratio
Quoted 8 lines
Signed-off-by Shengjiu Wang <[email protected]>--- sound/soc/fsl/Kconfig | 10 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/fsl_asrc_common.h | 1 + sound/soc/fsl/fsl_easrc.c | 2265 +++++++++++++++++++++++++++++++ sound/soc/fsl/fsl_easrc.h | 668 +++++++++ sound/soc/fsl/fsl_easrc_dma.c | 440 ++++++
I see a 90% similarity between fsl_asrc_dma and fsl_easrc_dma files. Would it be possible reuse the existing code? Could share structures from my point of view, just like it reuses "enum asrc_pair_index", I know differentiating "pair" and "context" is a big point here though.
A possible quick solution for that, off the top of my head, could be:
1) in fsl_asrc_common.h
struct fsl_asrc {
....
};
struct fsl_asrc_pair {
....
};2) in fsl_easrc.h
/* Renaming shared structures */ #define fsl_easrc fsl_asrc #define fsl_easrc_context fsl_asrc_pair
May be a good idea to see if others have some opinion too.
sound/soc/fsl/fsl_easrc.c line 171
Quoted 11 lines
sound/soc/fsl/fsl_easrc.c new file +6
-0+ +/* set_rs_ratio +* +* According to the resample taps, calculate the resample ratio +*/ +static int set_rs_ratio (struct fsl_easrc_context *ctx)
"fsl_easrc_" prefix? Would be nice to have a formula in the comments.
sound/soc/fsl/fsl_easrc.c line 265
Quoted 8 lines
sound/soc/fsl/fsl_easrc.c new file +8
-0+/* resets the pointer of the coeff memory pointers */ +static int fsl_coeff_mem_ptr_reset (struct fsl_easrc *easrc, +unsigned int ctx_id,int mem_type) +{ +/* To reset the write pointer back to zero, the register field +* ASRC_CTX_CTRL_EXT1x[PF_COEFF_MEM_RST] can be toggled from +* 0x0 to 0x1 to 0x0. +*/
Please use the style:
/* * xxx */
sound/soc/fsl/fsl_easrc.c line 306
Quoted 5 lines
sound/soc/fsl/fsl_easrc.c new file +5
-0+static int fsl_easrc_resampler_config (struct fsl_easrc *easrc) +{ +for (i =0 ; i < hdr->interp_scen; i++) { +if ((interp[i].num_taps -1 ) == +bits_taps_to_val (easrc->rs_num_taps)) {
Could do below to save some indentations from the rest of the routine:
+ if ((interp[i].num_taps - 1) !=
+ bits_taps_to_val(easrc->rs_num_taps))
+ continue;
Quoted 14 lines
sound/soc/fsl/fsl_easrc.c new file +13
-0+ arr = interp[i].coeff; + selected_interp = &interp[i]; +dev_dbg (dev,"Selected interp_filter: %u taps - %u phases\n" , + selected_interp->num_taps, + selected_interp->num_phases); +break ; +/***************************************************************************** +* Scale filter coefficients (64 bits float) +* For input float32 normalized range (1.0,-1.0) -> output int[16,24,32]: +* scale it by multiplying filter coefficients by 2^31 +* For input int[16, 24, 32] -> output float32 +* scale it by multiplying filter coefficients by 2^-15, 2^-23, 2^-31 +* input:
sound/soc/fsl/fsl_easrc.c line 382
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +10
-0+* easrc: Structure pointer of fsl_easrc +* infilter : Pointer to non-scaled input filter +* shift: The multiply factor +* output: +* outfilter: scaled filter +*****************************************************************************/ +static int NormalizedFilterForFloat32InIntOut (struct fsl_easrc *easrc, +u64 *infilter, +u64 *outfilter, +int shift)
Coding style looks very different, at comments and function naming.
Quoted 22 lines
sound/soc/fsl/fsl_easrc.c new file +22
-0+{ +struct device *dev = &easrc->pdev->dev; +u64 coef = *infilter; +s64 exp = (coef &0x7ff0000000000000ll ) >>52 ; +u64 outcoef; + +/* +* If exponent is zero (value == 0), or 7ff (value == NaNs) +* dont touch the content +*/ +if (((coef &0x7ff0000000000000ll ) ==0 ) || + ((coef &0x7ff0000000000000ll ) == ((u64 )0x7ff <<52 ))) { + *outfilter = coef; + }else { +if ((shift >0 && (shift + exp) >=2047 ) || + (shift <0 && (exp + shift) <=0 )) { +dev_err (dev,"coef error\n" ); +return -EINVAL ; + } + +/* coefficient * 2^shift ==> coefficient_exp + shift */ + exp += shift;
sound/soc/fsl/fsl_easrc.c line 414
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +10
-0+ outcoef = (u64)(coef &0x800FFFFFFFFFFFFFll ) + + ((u64 )exp <<52 ); + *outfilter = outcoef; + } + +return 0 ; +} + +static int write_pf_coeff_mem (struct fsl_easrc *easrc,int ctx_id, +u64 *arr,int n_taps,int shift)
Function naming.
Quoted 6 lines
sound/soc/fsl/fsl_easrc.c new file +6
-0+static int fsl_easrc_prefilter_config (struct fsl_easrc *easrc, +unsigned int ctx_id) +{ +struct fsl_easrc_context *ctx; +struct asrc_firmware_hdr *hdr; +struct prefil_params *prefil, *selected_prefil =NULL ;
sound/soc/fsl/fsl_easrc.c line 469
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +10
-0+struct device *dev; +u32 inrate, outrate, offset =0 ; +int ret, i; + +/* to modify prefilter coeficients, the user must perform +* a write in ASRC_PRE_COEFF_FIFO[COEFF_DATA] while the +* RUN_EN for that context is set to 0 +*/ +if (!easrc) +return -ENODEV ;
Hmm..I don't see the relationship between the comments and the code.
Quoted 16 lines
sound/soc/fsl/fsl_easrc.c new file +16
-0+if (ctx->out_params.sample_rate >= ctx->in_params.sample_rate) { +if (ctx->out_params.sample_rate == ctx->in_params.sample_rate) +regmap_update_bits (easrc->regmap, +REG_EASRC_CCE1 (ctx_id), +EASRC_CCE1_RS_BYPASS_MASK , +EASRC_CCE1_RS_BYPASS ); + +if (ctx->in_params.sample_format ==SNDRV_PCM_FORMAT_FLOAT_LE && + ctx->out_params.sample_format !=SNDRV_PCM_FORMAT_FLOAT_LE ) { + ctx->st1_num_taps =1 ; + ctx->st1_coeff = &easrc->const_coeff; + ctx->st1_num_exp =1 ; + ctx->st2_num_taps =0 ; + ctx->st1_addexp =31 ; + }else if (ctx->in_params.sample_format !=SNDRV_PCM_FORMAT_FLOAT_LE && + ctx->out_params.sample_format ==SNDRV_PCM_FORMAT_FLOAT_LE ) {
sound/soc/fsl/fsl_easrc.c line 519
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +10
-0+ ctx->st1_num_taps =1 ; + ctx->st1_coeff = &easrc->const_coeff; + ctx->st1_num_exp =1 ; + ctx->st2_num_taps =0 ; + ctx->st1_addexp -= ctx->in_params.fmt.addexp; + }else { + ctx->st1_num_taps =1 ; + ctx->st1_coeff = &easrc->const_coeff; + ctx->st1_num_exp =1 ; + ctx->st2_num_taps =0 ;
The first four lines of each path are completely duplicated. Probably only needs to diff st1_addexp?
sound/soc/fsl/fsl_easrc.c line 529
Quoted 9 lines
sound/soc/fsl/fsl_easrc.c new file +9
-0+ }else { + inrate = ctx->in_params.norm_rate; + outrate = ctx->out_params.norm_rate; + + hdr = easrc->firmware_hdr; + prefil = easrc->prefil; + +for (i =0 ; i < hdr->prefil_scen; i++) { +if (inrate == prefil[i].insr && outrate == prefil[i].outsr) {
Could do below to save indentations:
+ if (inrate != prefil[i].insr ||
+ outrate != prefil[i].outsr)
+ continue;
sound/soc/fsl/fsl_easrc.c line 544
Quoted 5 lines
sound/soc/fsl/fsl_easrc.c new file +5
-0+if (!selected_prefil) { +dev_err (dev,"Conversion from in ratio %u(%u) to out ratio %u(%u) is not supported\n" , + ctx->in_params.sample_rate, + inrate, + ctx->out_params.sample_rate, outrate);
Could fit into single lines:
+ ctx->in_params.sample_rate, inrate,
+ ctx->out_params.sample_rate, outrate);
sound/soc/fsl/fsl_easrc.c line 704
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +10
-0+static int fsl_easrc_config_one_slot (struct fsl_easrc_context *ctx, +struct fsl_easrc_slot *slot, +unsigned int slot_idx, +unsigned int reg0, +unsigned int reg1, +unsigned int reg2, +unsigned int reg3, +unsigned int *req_channels, +unsigned int *start_channel, +unsigned int *avail_channel)
There could be some simplification for the parameters here:
1) slot_idx could be a part of struct fsl_easrc_slot?
2) reg0->reg3 could be a part of struct too, or use some macro calculating from slot_idx?
Quoted 12 lines
sound/soc/fsl/fsl_easrc.c new file +12
-0+{ +struct fsl_easrc *easrc = ctx->easrc; +int st1_chanxexp, st1_mem_alloc =0 , st2_mem_alloc =0 ; +unsigned int addr; + +if (*req_channels <= *avail_channel) { + slot->num_channel = *req_channels; + slot->min_channel = *start_channel; + slot->max_channel = *start_channel + *req_channels -1 ; + slot->ctx_index = ctx->index; + slot->busy = true; + *start_channel += *req_channels;
sound/soc/fsl/fsl_easrc.c line 726
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +10
-0+ *req_channels =0 ; + }else { + slot->num_channel = *avail_channel; + slot->min_channel = *start_channel; + slot->max_channel = *start_channel + *avail_channel -1 ; + slot->ctx_index = ctx->index; + slot->busy = true; + *start_channel += *avail_channel; + *req_channels -= *avail_channel; + }
Could merge duplicated parts:
+ if (*req_channels <= *avail_channel) {
+ slot->num_channel = *req_channels;
+ *req_channels = 0;
+ } else {
+ slot->num_channel = *req_channels;
+ *req_channels -= *avail_channel;
+ };
+
+ slot->min_channel = *start_channel;
+ slot->max_channel = *start_channel + slot->num_channel - 1;
+ slot->ctx_index = ctx->index;
+ slot->busy = true;
+ *start_channel += slot->num_channel;
Quoted 5 lines
sound/soc/fsl/fsl_easrc.c new file +5
-0+if (ctx->st1_num_taps >0 ) { +if (ctx->st2_num_taps >0 ) + st1_mem_alloc = + (ctx->st1_num_taps -1 ) * slot->num_channel * + ctx->st1_num_exp + slot->num_channel;
sound/soc/fsl/fsl_easrc.c line 758
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +10
-0+else + st1_mem_alloc = ctx->st1_num_taps * slot->num_channel; + + slot->pf_mem_used = st1_mem_alloc; +regmap_update_bits (easrc->regmap, reg2, +EASRC_DPCS0R2_ST1_MA_MASK , +EASRC_DPCS0R2_ST1_MA (st1_mem_alloc)); + +if (slot_idx ==1 ) + addr =0x1800 - st1_mem_alloc;
Where is this 0x1800 coming from?
sound/soc/fsl/fsl_easrc.c line 1274
Quoted 10 lines
sound/soc/fsl/fsl_easrc.c new file +8
-0+int fsl_easrc_start_context (struct fsl_easrc_context *ctx) +{ +EASRC_CC_FWMDE_MASK , + EASRC_CC_FWMDE); +EASRC_COC_FWMDE_MASK , + EASRC_COC_FWMDE); +EASRC_CC_EN_MASK , + EASRC_CC_EN);
They could fit into single lines.
sound/soc/fsl/fsl_easrc.c line 1926
Quoted 4 lines
sound/soc/fsl/fsl_easrc.c new file +4
-0+static const struct regmap_config fsl_easrc_regmap_config = { + .readable_reg = fsl_easrc_readable_reg, + .volatile_reg = fsl_easrc_volatile_reg, + .writeable_reg = fsl_easrc_writeable_reg,
Can we use regmap_range and regmap_access_table?
Quoted 1 line
+void
easrc_dump_firmware(struct fsl_easrc *easrc)
fsl_easrc_dump_firmware?
sound/soc/fsl/fsl_easrc.c line 1946
Quoted 5 lines
sound/soc/fsl/fsl_easrc.c new file +5
-0+{ +dev_dbg (dev,"Firmware v%u dump:\n" , firm->firmware_version); +pr_debug ("Num prefitler scenarios: %u\n" , firm->prefil_scen); +pr_debug ("Num interpolation scenarios: %u\n" , firm->interp_scen); +pr_debug ("\nInterpolation scenarios:\n" );
dev_dbg vs. pr_debug?
Quoted 1 line
+int
easrc_get_firmware(struct fsl_easrc *easrc)
fsl_easrc_get_firmware?
sound/soc/fsl/fsl_easrc.c line 2081
Quoted 3 lines
sound/soc/fsl/fsl_easrc.c new file +3
-0+static int fsl_easrc_probe (struct platform_device *pdev) +{ +/*Set default value*/
White space in the comments
sound/soc/fsl/fsl_easrc.c line 2087
Quoted 2 lines
sound/soc/fsl/fsl_easrc.c new file +2
-0+ ret =of_property_read_u32 (np,"fsl,asrc-rate" , + &easrc->easrc_rate);
Could fit into one line.
sound/soc/fsl/fsl_easrc.c line 2094
Quoted 2 lines
sound/soc/fsl/fsl_easrc.c new file +2
-0+ ret =of_property_read_u32 (np,"fsl,asrc-width" , + &width);
Ditto
sound/soc/fsl/fsl_easrc.c line 2243
Quoted 4 lines
sound/soc/fsl/fsl_easrc.c new file +4
-0+static int fsl_easrc_runtime_resume (struct device *dev) +{ +} +#endif /*CONFIG_PM*/
White space in the comments
Quoted 6 lines
sound/soc/fsl/fsl_easrc.h new file +0
-0
sound/soc/fsl/fsl_easrc.h line 10
Quoted 10 lines
sound/soc/fsl/fsl_easrc.h new file +10
-0@@ -0,0 +1,668 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2019 NXP +*/ + +#ifndef _FSL_EASRC_H +#define _FSL_EASRC_H + +#include <sound/asound.h> +#include <linux/miscdevice.h>
For miscdevice...
Quoted 18 lines
sound/soc/fsl/fsl_easrc.h new file +18
-0+/** +* fsl_easrc: EASRC private data +* +* @pdev: platform device pointer +* @regmap: regmap handler +* @dma_params_rx: DMA parameters for receive channel +* @dma_params_tx: DMA parameters for transmit channel +* @ctx: context pointer +* @slot: slot setting +* @mem_clk: clock source to access register +* @firmware_hdr: the header of firmware +* @interp: pointer to interpolation filter coeff +* @prefil: pointer to prefilter coeff +* @fw: firmware of coeff table +* @fw_name: firmware name +* @paddr: physical address to the base address of registers +* @rs_num_taps: resample filter taps, 32, 64, or 128 +* @bps_i2c958: bits per sample of iec958
sound/soc/fsl/fsl_easrc.h line 637
Quoted 10 lines
sound/soc/fsl/fsl_easrc.h new file +10
-0+* @chn_avail: available channels, maximum 32 +* @lock: spin lock for resource protection +* @easrc_rate: default sample rate for ASoC Back-Ends +* @easrc_format: default sample format for ASoC Back-Ends +*/ + +struct fsl_easrc { +struct platform_device *pdev; +struct regmap *regmap; +struct miscdevice easrc_miscdev;
This is not being described in the comments area nor used in the driver. Should probably stay downstream, or be added later when the downstream feature gets upstream.
Rob Herring
maintainerRe: [PATCH v2 2/3] ASoC: dt-bindings: fsl_easrc: Add document for EASRC
In reply to Shengjiu WangQuoted 8 lines · Shengjiu Wang
EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX8MN.
Signed-off-by Shengjiu Wang <[email protected]>--- .../devicetree/bindings/sound/fsl,easrc.txt | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txt
Bindings are now in DT schema format. SeeDocumentation/devicetree/writing-schema.rst.
Shengjiu Wang
maintainerRe: [PATCH v2 2/3] ASoC: dt-bindings: fsl_easrc: Add document for EASRC
Hi
Quoted 5 lines · Rob Herring
Quoted 3 lines · Shengjiu Wang
EASRC (Enhanced Asynchronous Sample Rate Converter) is a new IP module found on i.MX8MN.
Quoted 9 lines
Quoted 5 lines
Signed-off-by Shengjiu Wang <[email protected]>--- .../devicetree/bindings/sound/fsl,easrc.txt | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/fsl,easrc.txtBindings are now in DT schema format. See
Documentation/devicetree/writing-schema.rst.
Thanks, will switch to .yaml format.
best regards
wang shengjiu