@@ -2675,8 +2675,8 @@ static unsigned long rt5682_wclk_recalc_rate(struct clk_hw *hw,
2675
2675
return rt5682 -> lrck [RT5682_AIF1 ];
2676
2676
}
2677
2677
2678
- static long rt5682_wclk_round_rate (struct clk_hw * hw , unsigned long rate ,
2679
- unsigned long * parent_rate )
2678
+ static int rt5682_wclk_determine_rate (struct clk_hw * hw ,
2679
+ struct clk_rate_request * req )
2680
2680
{
2681
2681
struct rt5682_priv * rt5682 =
2682
2682
container_of (hw , struct rt5682_priv ,
@@ -2689,13 +2689,13 @@ static long rt5682_wclk_round_rate(struct clk_hw *hw, unsigned long rate,
2689
2689
* Only accept to set wclk rate to 44.1k or 48kHz.
2690
2690
* It will force to 48kHz if not both.
2691
2691
*/
2692
- if (rate != CLK_48 && rate != CLK_44 ) {
2692
+ if (req -> rate != CLK_48 && req -> rate != CLK_44 ) {
2693
2693
dev_warn (rt5682 -> i2c_dev , "%s: clk %s only support %d or %d Hz output\n" ,
2694
2694
__func__ , clk_name , CLK_44 , CLK_48 );
2695
- rate = CLK_48 ;
2695
+ req -> rate = CLK_48 ;
2696
2696
}
2697
2697
2698
- return rate ;
2698
+ return 0 ;
2699
2699
}
2700
2700
2701
2701
static int rt5682_wclk_set_rate (struct clk_hw * hw , unsigned long rate ,
@@ -2795,15 +2795,15 @@ static unsigned long rt5682_bclk_get_factor(unsigned long rate,
2795
2795
return 256 ;
2796
2796
}
2797
2797
2798
- static long rt5682_bclk_round_rate (struct clk_hw * hw , unsigned long rate ,
2799
- unsigned long * parent_rate )
2798
+ static int rt5682_bclk_determine_rate (struct clk_hw * hw ,
2799
+ struct clk_rate_request * req )
2800
2800
{
2801
2801
struct rt5682_priv * rt5682 =
2802
2802
container_of (hw , struct rt5682_priv ,
2803
2803
dai_clks_hw [RT5682_DAI_BCLK_IDX ]);
2804
2804
unsigned long factor ;
2805
2805
2806
- if (!* parent_rate || !rt5682_clk_check (rt5682 ))
2806
+ if (!req -> best_parent_rate || !rt5682_clk_check (rt5682 ))
2807
2807
return - EINVAL ;
2808
2808
2809
2809
/*
@@ -2813,9 +2813,11 @@ static long rt5682_bclk_round_rate(struct clk_hw *hw, unsigned long rate,
2813
2813
* and find the appropriate multiplier of BCLK to
2814
2814
* get the rounded down BCLK value.
2815
2815
*/
2816
- factor = rt5682_bclk_get_factor (rate , * parent_rate );
2816
+ factor = rt5682_bclk_get_factor (req -> rate , req -> best_parent_rate );
2817
+
2818
+ req -> rate = req -> best_parent_rate * factor ;
2817
2819
2818
- return * parent_rate * factor ;
2820
+ return 0 ;
2819
2821
}
2820
2822
2821
2823
static int rt5682_bclk_set_rate (struct clk_hw * hw , unsigned long rate ,
@@ -2849,12 +2851,12 @@ static const struct clk_ops rt5682_dai_clk_ops[RT5682_DAI_NUM_CLKS] = {
2849
2851
.prepare = rt5682_wclk_prepare ,
2850
2852
.unprepare = rt5682_wclk_unprepare ,
2851
2853
.recalc_rate = rt5682_wclk_recalc_rate ,
2852
- .round_rate = rt5682_wclk_round_rate ,
2854
+ .determine_rate = rt5682_wclk_determine_rate ,
2853
2855
.set_rate = rt5682_wclk_set_rate ,
2854
2856
},
2855
2857
[RT5682_DAI_BCLK_IDX ] = {
2856
2858
.recalc_rate = rt5682_bclk_recalc_rate ,
2857
- .round_rate = rt5682_bclk_round_rate ,
2859
+ .determine_rate = rt5682_bclk_determine_rate ,
2858
2860
.set_rate = rt5682_bclk_set_rate ,
2859
2861
},
2860
2862
};
0 commit comments