pmaports/device/archived/linux-oneplus-msm8998-downstream/0005-update-msm8998-qpnp-rtc-driver-src-with-sm8150.patch

90 lines
3 KiB
Diff
Raw Normal View History

--- a/drivers/rtc/qpnp-rtc.c
+++ b/drivers/rtc/qpnp-rtc.c
@@ -21,6 +21,8 @@
#include <linux/of_irq.h>
#include <linux/spmi.h>
#include <linux/platform_device.h>
+#include <linux/spinlock.h>
+#include <linux/alarmtimer.h>
/* RTC/ALARM Register offsets */
#define REG_OFFSET_ALARM_RW 0x40
@@ -85,11 +87,10 @@ static int qpnp_write_wrapper(struct qpnp_rtc *rtc_dd, u8 *rtc_val,
u16 base, int count)
{
int rc;
+
if (base == (rtc_dd->alarm_base + REG_OFFSET_ALARM_CTRL1)) {
- dev_err(rtc_dd->rtc_dev, "write ALARM_CTRL1=0x%x\n", *rtc_val);
- if (!(*rtc_val & BIT_RTC_ALARM_ENABLE))
- dump_stack();
- }
+ dev_info(rtc_dd->rtc_dev, "write ALARM_CTRL1=0x%x\n", *rtc_val);
+ }
rc = regmap_bulk_write(rtc_dd->regmap, base, rtc_val, count);
if (rc) {
@@ -116,7 +117,7 @@ qpnp_rtc_set_time(struct device *dev, struct rtc_time *tm)
value[2] = (secs >> 16) & 0xFF;
value[3] = (secs >> 24) & 0xFF;
- dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs);
+ dev_err(dev, "Seconds value to be written to RTC = %lu\n", secs);
spin_lock_irqsave(&rtc_dd->alarm_ctrl_lock, irq_flags);
ctrl_reg = rtc_dd->alarm_ctrl_reg1;
@@ -275,7 +276,6 @@ qpnp_rtc_read_time(struct device *dev, struct rtc_time *tm)
dev_err(dev, "Invalid time read from RTC\n");
return rc;
}
-
dev_dbg(dev, "secs = %lu, h:m:s == %d:%d:%d, d/m/y = %d/%d/%d\n",
secs, tm->tm_hour, tm->tm_min, tm->tm_sec,
tm->tm_mday, tm->tm_mon, tm->tm_year);
@@ -314,6 +314,8 @@ qpnp_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
value[1] = (secs >> 8) & 0xFF;
value[2] = (secs >> 16) & 0xFF;
value[3] = (secs >> 24) & 0xFF;
+ dev_info(dev, "val[0] = 0x%x, val[1] = 0x%x, val[2] = 0x%x, val[3] = 0x%x\n",
+ value[0], value[1], value[2], value[3]);
spin_lock_irqsave(&rtc_dd->alarm_ctrl_lock, irq_flags);
@@ -338,7 +340,7 @@ qpnp_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
rtc_dd->alarm_ctrl_reg1 = ctrl_reg;
- dev_err(dev, "Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n",
+ dev_dbg(dev, "Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n",
alarm->time.tm_hour, alarm->time.tm_min,
alarm->time.tm_sec, alarm->time.tm_mday,
alarm->time.tm_mon, alarm->time.tm_year);
@@ -657,16 +659,15 @@ static void qpnp_rtc_shutdown(struct platform_device *pdev)
bool rtc_alarm_powerup;
struct rtc_wkalrm alarm;
+ if (!pdev) {
+ pr_err("qpnp-rtc: spmi device not found\n");
+ return;
+ }
qpnp_rtc_read_alarm(&pdev->dev, &alarm);
dev_err(&pdev->dev, "Alarm set for - h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n",
alarm.time.tm_hour, alarm.time.tm_min,
alarm.time.tm_sec, alarm.time.tm_mday,
alarm.time.tm_mon, alarm.time.tm_year);
-
- if (!pdev) {
- pr_err("qpnp-rtc: spmi device not found\n");
- return;
- }
rtc_dd = dev_get_drvdata(&pdev->dev);
if (!rtc_dd) {
pr_err("qpnp-rtc: rtc driver data not found\n");
@@ -729,5 +730,5 @@ static void __exit qpnp_rtc_exit(void)
}
module_exit(qpnp_rtc_exit);
-MODULE_DESCRIPTION("SMPI PMIC RTC driver");
+MODULE_DESCRIPTION("SPMI PMIC RTC driver");
MODULE_LICENSE("GPL v2");