@@ -753,6 +753,9 @@ static struct clk_regmap toddr_d =
753753 AUD_PCLK_GATE (toddr_d , AUDIO_CLK_GATE_EN1 , 1 );
754754static struct clk_regmap loopback_b =
755755 AUD_PCLK_GATE (loopback_b , AUDIO_CLK_GATE_EN1 , 2 );
756+ static struct clk_regmap earcrx =
757+ AUD_PCLK_GATE (earcrx , AUDIO_CLK_GATE_EN1 , 6 );
758+
756759
757760static struct clk_regmap sm1_mst_a_mclk_sel =
758761 AUD_MST_MCLK_MUX (mst_a_mclk , AUDIO_SM1_MCLK_A_CTRL );
@@ -766,6 +769,10 @@ static struct clk_regmap sm1_mst_e_mclk_sel =
766769 AUD_MST_MCLK_MUX (mst_e_mclk , AUDIO_SM1_MCLK_E_CTRL );
767770static struct clk_regmap sm1_mst_f_mclk_sel =
768771 AUD_MST_MCLK_MUX (mst_f_mclk , AUDIO_SM1_MCLK_F_CTRL );
772+ static struct clk_regmap sm1_earcrx_cmdc_clk_sel =
773+ AUD_MST_MCLK_MUX (earcrx_cmdc_clk , AUDIO_EARCRX_CMDC_CLK_CTRL );
774+ static struct clk_regmap sm1_earcrx_dmac_clk_sel =
775+ AUD_MST_MCLK_MUX (earcrx_dmac_clk , AUDIO_EARCRX_DMAC_CLK_CTRL );
769776
770777static struct clk_regmap sm1_mst_a_mclk_div =
771778 AUD_MST_MCLK_DIV (mst_a_mclk , AUDIO_SM1_MCLK_A_CTRL );
@@ -779,6 +786,11 @@ static struct clk_regmap sm1_mst_e_mclk_div =
779786 AUD_MST_MCLK_DIV (mst_e_mclk , AUDIO_SM1_MCLK_E_CTRL );
780787static struct clk_regmap sm1_mst_f_mclk_div =
781788 AUD_MST_MCLK_DIV (mst_f_mclk , AUDIO_SM1_MCLK_F_CTRL );
789+ static struct clk_regmap sm1_earcrx_cmdc_clk_div =
790+ AUD_MST_MCLK_DIV (earcrx_cmdc_clk , AUDIO_EARCRX_CMDC_CLK_CTRL );
791+ static struct clk_regmap sm1_earcrx_dmac_clk_div =
792+ AUD_MST_MCLK_DIV (earcrx_dmac_clk , AUDIO_EARCRX_DMAC_CLK_CTRL );
793+
782794
783795static struct clk_regmap sm1_mst_a_mclk =
784796 AUD_MST_MCLK_GATE (mst_a_mclk , AUDIO_SM1_MCLK_A_CTRL );
@@ -792,6 +804,10 @@ static struct clk_regmap sm1_mst_e_mclk =
792804 AUD_MST_MCLK_GATE (mst_e_mclk , AUDIO_SM1_MCLK_E_CTRL );
793805static struct clk_regmap sm1_mst_f_mclk =
794806 AUD_MST_MCLK_GATE (mst_f_mclk , AUDIO_SM1_MCLK_F_CTRL );
807+ static struct clk_regmap sm1_earcrx_cmdc_clk =
808+ AUD_MST_MCLK_GATE (earcrx_cmdc_clk , AUDIO_EARCRX_CMDC_CLK_CTRL );
809+ static struct clk_regmap sm1_earcrx_dmac_clk =
810+ AUD_MST_MCLK_GATE (earcrx_dmac_clk , AUDIO_EARCRX_DMAC_CLK_CTRL );
795811
796812static struct clk_regmap sm1_tdm_mclk_pad_0 = AUD_TDM_PAD_CTRL (
797813 tdm_mclk_pad_0 , AUDIO_SM1_MST_PAD_CTRL0 , 0 , mclk_pad_ctrl_parent_data );
@@ -1232,6 +1248,13 @@ static struct clk_hw *sm1_audio_hw_clks[] = {
12321248 [AUD_CLKID_SYSCLK_A_EN ] = & sm1_sysclk_a_en .hw ,
12331249 [AUD_CLKID_SYSCLK_B_DIV ] = & sm1_sysclk_b_div .hw ,
12341250 [AUD_CLKID_SYSCLK_B_EN ] = & sm1_sysclk_b_en .hw ,
1251+ [AUD_CLKID_EARCRX ] = & earcrx .hw ,
1252+ [AUD_CLKID_EARCRX_CMDC_SEL ] = & sm1_earcrx_cmdc_clk_sel .hw ,
1253+ [AUD_CLKID_EARCRX_CMDC_DIV ] = & sm1_earcrx_cmdc_clk_div .hw ,
1254+ [AUD_CLKID_EARCRX_CMDC ] = & sm1_earcrx_cmdc_clk .hw ,
1255+ [AUD_CLKID_EARCRX_DMAC_SEL ] = & sm1_earcrx_dmac_clk_sel .hw ,
1256+ [AUD_CLKID_EARCRX_DMAC_DIV ] = & sm1_earcrx_dmac_clk_div .hw ,
1257+ [AUD_CLKID_EARCRX_DMAC ] = & sm1_earcrx_dmac_clk .hw ,
12351258};
12361259
12371260
@@ -1646,6 +1669,13 @@ static struct clk_regmap *const sm1_clk_regmaps[] = {
16461669 & sm1_sysclk_a_en ,
16471670 & sm1_sysclk_b_div ,
16481671 & sm1_sysclk_b_en ,
1672+ & earcrx ,
1673+ & sm1_earcrx_cmdc_clk_sel ,
1674+ & sm1_earcrx_cmdc_clk_div ,
1675+ & sm1_earcrx_cmdc_clk ,
1676+ & sm1_earcrx_dmac_clk_sel ,
1677+ & sm1_earcrx_dmac_clk_div ,
1678+ & sm1_earcrx_dmac_clk ,
16491679};
16501680
16511681struct axg_audio_reset_data {
@@ -1726,11 +1756,10 @@ static const struct reset_control_ops axg_audio_rstc_ops = {
17261756 .status = axg_audio_reset_status ,
17271757};
17281758
1729- static const struct regmap_config axg_audio_regmap_cfg = {
1759+ static struct regmap_config axg_audio_regmap_cfg = {
17301760 .reg_bits = 32 ,
17311761 .val_bits = 32 ,
17321762 .reg_stride = 4 ,
1733- .max_register = AUDIO_CLK_SPDIFOUT_B_CTRL ,
17341763};
17351764
17361765struct audioclk_data {
@@ -1739,6 +1768,7 @@ struct audioclk_data {
17391768 struct meson_clk_hw_data hw_clks ;
17401769 unsigned int reset_offset ;
17411770 unsigned int reset_num ;
1771+ unsigned int max_register ;
17421772};
17431773
17441774static int axg_audio_clkc_probe (struct platform_device * pdev )
@@ -1760,6 +1790,7 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
17601790 if (IS_ERR (regs ))
17611791 return PTR_ERR (regs );
17621792
1793+ axg_audio_regmap_cfg .max_register = data -> max_register ;
17631794 map = devm_regmap_init_mmio (dev , regs , & axg_audio_regmap_cfg );
17641795 if (IS_ERR (map )) {
17651796 dev_err (dev , "failed to init regmap: %ld\n" , PTR_ERR (map ));
@@ -1828,6 +1859,7 @@ static const struct audioclk_data axg_audioclk_data = {
18281859 .hws = axg_audio_hw_clks ,
18291860 .num = ARRAY_SIZE (axg_audio_hw_clks ),
18301861 },
1862+ .max_register = AUDIO_CLK_PDMIN_CTRL1 ,
18311863};
18321864
18331865static const struct audioclk_data g12a_audioclk_data = {
@@ -1839,6 +1871,7 @@ static const struct audioclk_data g12a_audioclk_data = {
18391871 },
18401872 .reset_offset = AUDIO_SW_RESET ,
18411873 .reset_num = 26 ,
1874+ .max_register = AUDIO_CLK_SPDIFOUT_B_CTRL ,
18421875};
18431876
18441877static const struct audioclk_data sm1_audioclk_data = {
@@ -1850,6 +1883,7 @@ static const struct audioclk_data sm1_audioclk_data = {
18501883 },
18511884 .reset_offset = AUDIO_SM1_SW_RESET0 ,
18521885 .reset_num = 39 ,
1886+ .max_register = AUDIO_EARCRX_DMAC_CLK_CTRL ,
18531887};
18541888
18551889static const struct of_device_id clkc_match_table [] = {
@@ -1878,3 +1912,4 @@ module_platform_driver(axg_audio_driver);
18781912MODULE_DESCRIPTION ("Amlogic AXG/G12A/SM1 Audio Clock driver" );
18791913MODULE_AUTHOR (
"Jerome Brunet <[email protected] >" );
18801914MODULE_LICENSE ("GPL" );
1915+ MODULE_IMPORT_NS (CLK_MESON );
0 commit comments