pm8xxx_hard_reset_config implements the required functionality,
replace the pm8058 specific call with this.
Remove ssbi_read/ssbi_write functions used in pm8058_hard_reset_config.
Remove unused variable(pm_lock) and enum(pon_config, pm8058_smpl_delay).
Change-Id: I3c5982ebab9277dc088bd3abd5621eb9acf3add9
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
pm8xxx_stay_on implements the required functionality internally.
Modify other occurrences of pm8058_stay_on to pm8xxx_stay_on.
Change-Id: I1c4d932789c6b5592bcbc6fc718d037f188d0e56
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
These APIs are implemented as a part of pm8xxx_reset_power_off,
pm8xxx_smpl_*, pm8xxx_watchdog_reset_control APIs in the pm8xxx-misc
driver.
Change-Id: I8eaf83e0c4d3551d16ecc7fc94c62514711b9a7d
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Facilitate the driver to support PMICs (such as PM8901)
with different IRQ base address.
Change-Id: I285a9b859b795508620ea6dfd7b5ef6953e7aeb3
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Move the following subdevices to use the pm8xxx interface -
mpp, irq, gpio, keypad, power-key, leds, othc, vibrator,
rtc, batt-alarm, thermal, upl, nfc, pwm, xoadc, regulators,
xo-buffers, charger.
This allows usage of a common driver for modules which are same
across multiple PM8XXX PMICs. It also provides flexibility
to add/remove subdevices for multiple board configurations.
Change-Id: Id9795552fc9f4a2c920c070babfaef1f4cd6ca61
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Free the debug device allocated before an
unsuccessful exit, both in pmic8058 and
pmic8901.
CRs-fixed: 308192
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
There could be a case where
- ADC interrupt is handled and a next request is queued up
- The interrupt thread gets scheduled out just before acking the interrupt
- ADC hardware completes the queued request and raises the next interrupt
- The interrupt thread now gets a chance to run and acks the adc interrupt.
Note this acks the next interrupt.
The above sequence of events leads to lost interrupts. Ack the interrupt
before calling the handle_nested_irq. If next interrupt is raised while the
current one's handler is still running, it will cause another invocation of
the interrupt handler to run.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
When the pmic initiates shutdown (probably because the temperature
went to high or resin_n line to pmic was lowered), the default action
is to restart the device.
Override this default configuration which means do not restart
the device when pmic hard reset happens.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Conflicts:
drivers/mfd/pmic8058.c
Currently the pmic interrupt thread handles all the interrupts
and later clears all those interrupts at once.
A problem was observed with this approach. The adc interrupt handler
could start another conversion and if the conversion finishes before
the pmic interrupt thread clears them, it ends up clearing the new
interrupt too.
Fix it by clearing the interrupt as soon as the handler is called.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
If an interrupt was already unmasked previously, don't unmask it
unnecessarily. This will avoid loosing the interrupt if it were
pending.
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
PMIC stay-on feature allows PMIC to ignore MSM PS_HOLD=low
signal so that some special functions like debugging could be
performed.
This feature should not be used in any product release.
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
An issue of missing interrupt was observed while resuming the device.
The msm_charger resume called adc conversion to get the battery
voltage. The adc conversion function enables the interrupt and
starts the conversion. Then pmic8058_resume gets called now which
re-enables the adc interrupt causing the pending bit to drop. With
the ADC EOC interrupt missed, the msm_charger does not receive a
completion event, causing a watchdog timeout.
The pmic8058 irq module has a hardware bug where writing to the config
bits clears the pending status of the interrupt.
Fix it using a sysdev where the pmic interrupts are switched before
any of the subdevices resume and use nonwakeup interrupts. Since
in sysdev resume we only enable non wakeup interrupts the status of
wakeup interrupts remains intact.
CRs-Fixed: 295261
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
When shutting down or restarting, PMIC 8058 regulator S0, S1, S3 and
L21 need to be managed manually. Since the master enable bits for these
regulators are kept set, the local enable bits should be unset and the
active pull-down must be enabled. Any regulators in advanced mode
should be disabled as well. This regulator state ensures that
these regulators drops as expected when PS_HOLD is dropped.
CRs-Fixed: 295731
Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
Remove mutex_lock and mutex_unlock from pm8058_masked_write. This
will allow pm8058_reset_pwr_off to call pm8058_mask_write while in
atomic context.
Signed-off-by: David Collins <collinsd@codeaurora.org>