Commit 50763576 authored by Fabio Falzoi's avatar Fabio Falzoi Committed by Greg Kroah-Hartman

Staging: rts5208: helper function to manage power off

Use a helper function to check if power off is needed.
Signed-off-by: default avatarFabio Falzoi <fabio.falzoi84@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cb547643
...@@ -1143,6 +1143,25 @@ static void rtsx_monitor_aspm_config(struct rtsx_chip *chip) ...@@ -1143,6 +1143,25 @@ static void rtsx_monitor_aspm_config(struct rtsx_chip *chip)
} }
} }
static void rtsx_manage_ocp(struct rtsx_chip *chip)
{
#ifdef SUPPORT_OCP
if (!chip->ocp_int)
return;
rtsx_read_register(chip, OCPSTAT, &chip->ocp_stat);
if (chip->card_exist & SD_CARD)
sd_power_off_card3v3(chip);
else if (chip->card_exist & MS_CARD)
ms_power_off_card3v3(chip);
else if (chip->card_exist & XD_CARD)
xd_power_off_card3v3(chip);
chip->ocp_int = 0;
#endif
}
static void rtsx_manage_sd_lock(struct rtsx_chip *chip) static void rtsx_manage_sd_lock(struct rtsx_chip *chip)
{ {
#ifdef SUPPORT_SD_LOCK #ifdef SUPPORT_SD_LOCK
...@@ -1184,20 +1203,7 @@ void rtsx_polling_func(struct rtsx_chip *chip) ...@@ -1184,20 +1203,7 @@ void rtsx_polling_func(struct rtsx_chip *chip)
if (rtsx_chk_stat(chip, RTSX_STAT_SS)) if (rtsx_chk_stat(chip, RTSX_STAT_SS))
return; return;
#ifdef SUPPORT_OCP rtsx_manage_ocp(chip);
if (chip->ocp_int) {
rtsx_read_register(chip, OCPSTAT, &chip->ocp_stat);
if (chip->card_exist & SD_CARD)
sd_power_off_card3v3(chip);
else if (chip->card_exist & MS_CARD)
ms_power_off_card3v3(chip);
else if (chip->card_exist & XD_CARD)
xd_power_off_card3v3(chip);
chip->ocp_int = 0;
}
#endif
rtsx_manage_sd_lock(chip); rtsx_manage_sd_lock(chip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment