diff options
author | Wei WANG <wei_wang@realsil.com.cn> | 2013-01-22 20:51:06 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-26 19:30:20 -0500 |
commit | ab4e8f8b7bdfeff0c961fdbbdacb262d68f094c0 (patch) | |
tree | 543440d2656343141c14e565e795a655378a0f72 /drivers/mfd/rtl8411.c | |
parent | ef85e736b1052d8c1e56990f0d08b6fce7cdbe41 (diff) |
mfd: rtsx: Add clock divider hook
Add callback function conv_clk_and_div_n to convert between SSC clock
and its divider N.
For rtl8411, the formula to calculate SSC clock divider N is different
with the other card reader models.
Signed-off-by: Wei WANG <wei_wang@realsil.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/rtl8411.c')
-rw-r--r-- | drivers/mfd/rtl8411.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c index 5058ba8dec3b..3d3b4addf81a 100644 --- a/drivers/mfd/rtl8411.c +++ b/drivers/mfd/rtl8411.c | |||
@@ -178,6 +178,18 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) | |||
178 | return card_exist; | 178 | return card_exist; |
179 | } | 179 | } |
180 | 180 | ||
181 | static int rtl8411_conv_clk_and_div_n(int input, int dir) | ||
182 | { | ||
183 | int output; | ||
184 | |||
185 | if (dir == CLK_TO_DIV_N) | ||
186 | output = input * 4 / 5 - 2; | ||
187 | else | ||
188 | output = (input + 2) * 5 / 4; | ||
189 | |||
190 | return output; | ||
191 | } | ||
192 | |||
181 | static const struct pcr_ops rtl8411_pcr_ops = { | 193 | static const struct pcr_ops rtl8411_pcr_ops = { |
182 | .extra_init_hw = rtl8411_extra_init_hw, | 194 | .extra_init_hw = rtl8411_extra_init_hw, |
183 | .optimize_phy = NULL, | 195 | .optimize_phy = NULL, |
@@ -189,6 +201,7 @@ static const struct pcr_ops rtl8411_pcr_ops = { | |||
189 | .card_power_off = rtl8411_card_power_off, | 201 | .card_power_off = rtl8411_card_power_off, |
190 | .switch_output_voltage = rtl8411_switch_output_voltage, | 202 | .switch_output_voltage = rtl8411_switch_output_voltage, |
191 | .cd_deglitch = rtl8411_cd_deglitch, | 203 | .cd_deglitch = rtl8411_cd_deglitch, |
204 | .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, | ||
192 | }; | 205 | }; |
193 | 206 | ||
194 | /* SD Pull Control Enable: | 207 | /* SD Pull Control Enable: |