@@ -1982,8 +1982,8 @@ static unsigned long da7219_wclk_recalc_rate(struct clk_hw *hw,
1982
1982
}
1983
1983
}
1984
1984
1985
- static long da7219_wclk_round_rate (struct clk_hw * hw , unsigned long rate ,
1986
- unsigned long * parent_rate )
1985
+ static int da7219_wclk_determine_rate (struct clk_hw * hw ,
1986
+ struct clk_rate_request * req )
1987
1987
{
1988
1988
struct da7219_priv * da7219 =
1989
1989
container_of (hw , struct da7219_priv ,
@@ -1992,28 +1992,30 @@ static long da7219_wclk_round_rate(struct clk_hw *hw, unsigned long rate,
1992
1992
if (!da7219 -> master )
1993
1993
return - EINVAL ;
1994
1994
1995
- if (rate < 11025 )
1996
- return 8000 ;
1997
- else if (rate < 12000 )
1998
- return 11025 ;
1999
- else if (rate < 16000 )
2000
- return 12000 ;
2001
- else if (rate < 22050 )
2002
- return 16000 ;
2003
- else if (rate < 24000 )
2004
- return 22050 ;
2005
- else if (rate < 32000 )
2006
- return 24000 ;
2007
- else if (rate < 44100 )
2008
- return 32000 ;
2009
- else if (rate < 48000 )
2010
- return 44100 ;
2011
- else if (rate < 88200 )
2012
- return 48000 ;
2013
- else if (rate < 96000 )
2014
- return 88200 ;
1995
+ if (req -> rate < 11025 )
1996
+ req -> rate = 8000 ;
1997
+ else if (req -> rate < 12000 )
1998
+ req -> rate = 11025 ;
1999
+ else if (req -> rate < 16000 )
2000
+ req -> rate = 12000 ;
2001
+ else if (req -> rate < 22050 )
2002
+ req -> rate = 16000 ;
2003
+ else if (req -> rate < 24000 )
2004
+ req -> rate = 22050 ;
2005
+ else if (req -> rate < 32000 )
2006
+ req -> rate = 24000 ;
2007
+ else if (req -> rate < 44100 )
2008
+ req -> rate = 32000 ;
2009
+ else if (req -> rate < 48000 )
2010
+ req -> rate = 44100 ;
2011
+ else if (req -> rate < 88200 )
2012
+ req -> rate = 48000 ;
2013
+ else if (req -> rate < 96000 )
2014
+ req -> rate = 88200 ;
2015
2015
else
2016
- return 96000 ;
2016
+ req -> rate = 96000 ;
2017
+
2018
+ return 0 ;
2017
2019
}
2018
2020
2019
2021
static int da7219_wclk_set_rate (struct clk_hw * hw , unsigned long rate ,
@@ -2070,15 +2072,15 @@ static unsigned long da7219_bclk_get_factor(unsigned long rate,
2070
2072
return 256 ;
2071
2073
}
2072
2074
2073
- static long da7219_bclk_round_rate (struct clk_hw * hw , unsigned long rate ,
2074
- unsigned long * parent_rate )
2075
+ static int da7219_bclk_determine_rate (struct clk_hw * hw ,
2076
+ struct clk_rate_request * req )
2075
2077
{
2076
2078
struct da7219_priv * da7219 =
2077
2079
container_of (hw , struct da7219_priv ,
2078
2080
dai_clks_hw [DA7219_DAI_BCLK_IDX ]);
2079
2081
unsigned long factor ;
2080
2082
2081
- if (!* parent_rate || !da7219 -> master )
2083
+ if (!req -> best_parent_rate || !da7219 -> master )
2082
2084
return - EINVAL ;
2083
2085
2084
2086
/*
@@ -2088,9 +2090,11 @@ static long da7219_bclk_round_rate(struct clk_hw *hw, unsigned long rate,
2088
2090
* parent WCLK rate set and find the appropriate multiplier of BCLK to
2089
2091
* get the rounded down BCLK value.
2090
2092
*/
2091
- factor = da7219_bclk_get_factor (rate , * parent_rate );
2093
+ factor = da7219_bclk_get_factor (req -> rate , req -> best_parent_rate );
2094
+
2095
+ req -> rate = req -> best_parent_rate * factor ;
2092
2096
2093
- return * parent_rate * factor ;
2097
+ return 0 ;
2094
2098
}
2095
2099
2096
2100
static int da7219_bclk_set_rate (struct clk_hw * hw , unsigned long rate ,
@@ -2116,12 +2120,12 @@ static const struct clk_ops da7219_dai_clk_ops[DA7219_DAI_NUM_CLKS] = {
2116
2120
.unprepare = da7219_wclk_unprepare ,
2117
2121
.is_prepared = da7219_wclk_is_prepared ,
2118
2122
.recalc_rate = da7219_wclk_recalc_rate ,
2119
- .round_rate = da7219_wclk_round_rate ,
2123
+ .determine_rate = da7219_wclk_determine_rate ,
2120
2124
.set_rate = da7219_wclk_set_rate ,
2121
2125
},
2122
2126
[DA7219_DAI_BCLK_IDX ] = {
2123
2127
.recalc_rate = da7219_bclk_recalc_rate ,
2124
- .round_rate = da7219_bclk_round_rate ,
2128
+ .determine_rate = da7219_bclk_determine_rate ,
2125
2129
.set_rate = da7219_bclk_set_rate ,
2126
2130
},
2127
2131
};
0 commit comments