summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/rtl8411.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-02-05 14:06:09 -0800
committerOlof Johansson <olof@lixom.net>2013-02-05 14:06:25 -0800
commit61cfd8736040dd2d620278fb11c6c4acfeb041c9 (patch)
treea3191d768acd36a5aff52eabe0892860dfd96730 /drivers/mfd/rtl8411.c
parent7960ba89ca518ec99d2a937907f445a26b2a1628 (diff)
parent7dc0f27ea43151889ae762d321e4068dd90cd9e2 (diff)
Merge tag 'omap-for-v3.9/board-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/boards
From Tony Lindgren: Minimal updates to OMAP board-*.c files while converting things to device tree based booting. * tag 'omap-for-v3.9/board-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: omap2plus_defconfig: enable omap1 rtc RX-51: Register twl4030-madc device RX-51: Add leds lp5523 names from Maemo 5 2.6.28 kernel ARM: OMAP2+: AM33XX: omap2plus_defconfig: Add support for few drivers ARM: OMAP1: nokia770: enable CBUS/Retu ARM: OMAP2+: omap2plus_defconfig: enable CMA allocator ARM: OMAP2+: omap2plus_defconfig: enable TFP410 chip support ARM: OMAP3: igep0020: simplify GPIO LEDs dependencies ARM: OMAP2+: craneboard: support the TPS65910 PMU ARM: OMAP2+: craneboard: support NAND device ARM: OMAP3: cm-t3517: add MMC support ARM: OMAP2+: Remove apollon board support + Linux 3.8-rc6 Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/mfd/rtl8411.c')
-rw-r--r--drivers/mfd/rtl8411.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c
index 89f046ca9e4..3d3b4addf81 100644
--- a/drivers/mfd/rtl8411.c
+++ b/drivers/mfd/rtl8411.c
@@ -112,6 +112,21 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card)
BPP_LDO_POWB, BPP_LDO_SUSPEND);
}
+static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
+{
+ u8 mask, val;
+
+ mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK;
+ if (voltage == OUTPUT_3V3)
+ val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3;
+ else if (voltage == OUTPUT_1V8)
+ val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8;
+ else
+ return -EINVAL;
+
+ return rtsx_pci_write_register(pcr, LDO_CTL, mask, val);
+}
+
static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
{
unsigned int card_exist;
@@ -163,6 +178,18 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
return card_exist;
}
+static int rtl8411_conv_clk_and_div_n(int input, int dir)
+{
+ int output;
+
+ if (dir == CLK_TO_DIV_N)
+ output = input * 4 / 5 - 2;
+ else
+ output = (input + 2) * 5 / 4;
+
+ return output;
+}
+
static const struct pcr_ops rtl8411_pcr_ops = {
.extra_init_hw = rtl8411_extra_init_hw,
.optimize_phy = NULL,
@@ -172,7 +199,9 @@ static const struct pcr_ops rtl8411_pcr_ops = {
.disable_auto_blink = rtl8411_disable_auto_blink,
.card_power_on = rtl8411_card_power_on,
.card_power_off = rtl8411_card_power_off,
+ .switch_output_voltage = rtl8411_switch_output_voltage,
.cd_deglitch = rtl8411_cd_deglitch,
+ .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n,
};
/* SD Pull Control Enable: