Commit 3c332639 authored by Johan Hovold's avatar Johan Hovold Committed by Alexandre Belloni

rtc: pm8xxx: clean up comments

Clean up the driver comments somewhat and remove obsolete, incorrect or
redundant ones.
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Reviewed-by: default avatarDavid Collins <quic_collinsd@quicinc.com>
Link: https://lore.kernel.org/r/20230202155448.6715-12-johan+linaro@kernel.orgSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 4727b58f
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
/** /**
* struct pm8xxx_rtc_regs - describe RTC registers per PMIC versions * struct pm8xxx_rtc_regs - describe RTC registers per PMIC versions
* @ctrl: base address of control register * @ctrl: address of control register
* @write: base address of write register * @write: base address of write registers
* @read: base address of read register * @read: base address of read registers
* @alarm_ctrl: base address of alarm control register * @alarm_ctrl: address of alarm control register
* @alarm_ctrl2: base address of alarm control2 register * @alarm_ctrl2: address of alarm control2 register
* @alarm_rw: base address of alarm read-write register * @alarm_rw: base address of alarm read-write registers
* @alarm_en: alarm enable mask * @alarm_en: alarm enable mask
*/ */
struct pm8xxx_rtc_regs { struct pm8xxx_rtc_regs {
unsigned int ctrl; unsigned int ctrl;
...@@ -42,12 +42,12 @@ struct pm8xxx_rtc_regs { ...@@ -42,12 +42,12 @@ struct pm8xxx_rtc_regs {
}; };
/** /**
* struct pm8xxx_rtc - rtc driver internal structure * struct pm8xxx_rtc - RTC driver internal structure
* @rtc: rtc device for this driver. * @rtc: RTC device
* @regmap: regmap used to access RTC registers * @regmap: regmap used to access registers
* @allow_set_time: indicates whether writing to the RTC is allowed * @allow_set_time: whether the time can be set
* @alarm_irq: alarm irq number * @alarm_irq: alarm irq number
* @regs: rtc registers description. * @regs: register description
* @dev: device structure * @dev: device structure
*/ */
struct pm8xxx_rtc { struct pm8xxx_rtc {
...@@ -90,7 +90,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -90,7 +90,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
if (rc) if (rc)
return rc; return rc;
/* Disable RTC H/w before writing on RTC register */ /* Disable RTC */
rc = regmap_update_bits(rtc_dd->regmap, regs->ctrl, PM8xxx_RTC_ENABLE, 0); rc = regmap_update_bits(rtc_dd->regmap, regs->ctrl, PM8xxx_RTC_ENABLE, 0);
if (rc) if (rc)
return rc; return rc;
...@@ -111,7 +111,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -111,7 +111,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
if (rc) if (rc)
return rc; return rc;
/* Enable RTC H/w after writing on RTC register */ /* Enable RTC */
rc = regmap_update_bits(rtc_dd->regmap, regs->ctrl, PM8xxx_RTC_ENABLE, rc = regmap_update_bits(rtc_dd->regmap, regs->ctrl, PM8xxx_RTC_ENABLE,
PM8xxx_RTC_ENABLE); PM8xxx_RTC_ENABLE);
if (rc) if (rc)
...@@ -242,7 +242,7 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) ...@@ -242,7 +242,7 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
if (rc) if (rc)
return rc; return rc;
/* Clear Alarm register */ /* Clear alarm register */
if (!enable) { if (!enable) {
rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value, rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value,
sizeof(value)); sizeof(value));
...@@ -269,13 +269,13 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) ...@@ -269,13 +269,13 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
rtc_update_irq(rtc_dd->rtc, 1, RTC_IRQF | RTC_AF); rtc_update_irq(rtc_dd->rtc, 1, RTC_IRQF | RTC_AF);
/* Clear the alarm enable bit */ /* Disable alarm */
rc = regmap_update_bits(rtc_dd->regmap, regs->alarm_ctrl, rc = regmap_update_bits(rtc_dd->regmap, regs->alarm_ctrl,
regs->alarm_en, 0); regs->alarm_en, 0);
if (rc) if (rc)
return IRQ_NONE; return IRQ_NONE;
/* Clear RTC alarm register */ /* Clear alarm status */
rc = regmap_update_bits(rtc_dd->regmap, regs->alarm_ctrl2, rc = regmap_update_bits(rtc_dd->regmap, regs->alarm_ctrl2,
PM8xxx_RTC_ALARM_CLEAR, 0); PM8xxx_RTC_ALARM_CLEAR, 0);
if (rc) if (rc)
...@@ -332,9 +332,6 @@ static const struct pm8xxx_rtc_regs pmk8350_regs = { ...@@ -332,9 +332,6 @@ static const struct pm8xxx_rtc_regs pmk8350_regs = {
.alarm_en = BIT(7), .alarm_en = BIT(7),
}; };
/*
* Hardcoded RTC bases until IORESOURCE_REG mapping is figured out
*/
static const struct of_device_id pm8xxx_id_table[] = { static const struct of_device_id pm8xxx_id_table[] = {
{ .compatible = "qcom,pm8921-rtc", .data = &pm8921_regs }, { .compatible = "qcom,pm8921-rtc", .data = &pm8921_regs },
{ .compatible = "qcom,pm8058-rtc", .data = &pm8058_regs }, { .compatible = "qcom,pm8058-rtc", .data = &pm8058_regs },
...@@ -382,7 +379,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) ...@@ -382,7 +379,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, 1); device_init_wakeup(&pdev->dev, 1);
/* Register the RTC device */
rtc_dd->rtc = devm_rtc_allocate_device(&pdev->dev); rtc_dd->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc_dd->rtc)) if (IS_ERR(rtc_dd->rtc))
return PTR_ERR(rtc_dd->rtc); return PTR_ERR(rtc_dd->rtc);
...@@ -390,7 +386,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) ...@@ -390,7 +386,6 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
rtc_dd->rtc->ops = &pm8xxx_rtc_ops; rtc_dd->rtc->ops = &pm8xxx_rtc_ops;
rtc_dd->rtc->range_max = U32_MAX; rtc_dd->rtc->range_max = U32_MAX;
/* Request the alarm IRQ */
rc = devm_request_any_context_irq(&pdev->dev, rtc_dd->alarm_irq, rc = devm_request_any_context_irq(&pdev->dev, rtc_dd->alarm_irq,
pm8xxx_alarm_trigger, pm8xxx_alarm_trigger,
IRQF_TRIGGER_RISING, IRQF_TRIGGER_RISING,
......
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