diff options
| author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-05-02 09:07:32 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-05-02 09:07:32 -0700 |
| commit | 9b50e3d6bae52a2c1be2a69b558ebb7a32921061 (patch) | |
| tree | 895df957007a00270190acf18e4df17a291d64d9 | |
| parent | e9ee15387edb0bbca75a7c243b2fecb7d82ff6b3 (diff) | |
| parent | 383f0f89d0e44d05d5ea906c37cdb09a5fca891b (diff) | |
Merge "esoc: mdm-4x: Separate out callback function for 9x45"
| -rw-r--r-- | drivers/esoc/esoc-mdm-pon.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/drivers/esoc/esoc-mdm-pon.c b/drivers/esoc/esoc-mdm-pon.c index d9b16b23839b..4ae3b7520f77 100644 --- a/drivers/esoc/esoc-mdm-pon.c +++ b/drivers/esoc/esoc-mdm-pon.c @@ -60,6 +60,29 @@ static int mdm9x55_toggle_soft_reset(struct mdm_ctrl *mdm, bool atomic) return 0; } +/* This function can be called from atomic context. */ +static int mdm9x45_toggle_soft_reset(struct mdm_ctrl *mdm, bool atomic) +{ + int soft_reset_direction_assert = 0, + soft_reset_direction_de_assert = 1; + + if (mdm->soft_reset_inverted) { + soft_reset_direction_assert = 1; + soft_reset_direction_de_assert = 0; + } + gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET), + soft_reset_direction_assert); + /* + * Allow PS hold assert to be detected + */ + if (!atomic) + usleep_range(1000000, 1005000); + else + mdelay(1000); + gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET), + soft_reset_direction_de_assert); + return 0; +} static int mdm4x_do_first_power_on(struct mdm_ctrl *mdm) { @@ -135,6 +158,26 @@ static int mdm9x55_power_down(struct mdm_ctrl *mdm) return 0; } +static int mdm9x45_power_down(struct mdm_ctrl *mdm) +{ + int soft_reset_direction_assert = 0, + soft_reset_direction_de_assert = 1; + + if (mdm->soft_reset_inverted) { + soft_reset_direction_assert = 1; + soft_reset_direction_de_assert = 0; + } + gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET), + soft_reset_direction_assert); + /* + * Allow PS hold assert to be detected + */ + msleep(3003); + gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET), + soft_reset_direction_de_assert); + return 0; +} + static void mdm4x_cold_reset(struct mdm_ctrl *mdm) { if (!gpio_is_valid(MDM_GPIO(mdm, AP2MDM_SOFT_RESET))) @@ -229,8 +272,8 @@ struct mdm_pon_ops mdm9x35_pon_ops = { struct mdm_pon_ops mdm9x45_pon_ops = { .pon = mdm4x_do_first_power_on, - .soft_reset = mdm4x_toggle_soft_reset, - .poff_force = mdm4x_power_down, + .soft_reset = mdm9x45_toggle_soft_reset, + .poff_force = mdm9x45_power_down, .cold_reset = mdm4x_cold_reset, .dt_init = mdm4x_pon_dt_init, .setup = mdm4x_pon_setup, |
