From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Fenglin Wu <fenglin.wu@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Abel Vesa <abelvesa@kernel.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: David Collins <david.collins@oss.qualcomm.com>,
Subbaraman Narayanamurthy
<subbaraman.narayanamurthy@oss.qualcomm.com>,
Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>,
linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org
Subject: Re: [PATCH v3 3/3] rtc: Add Qualcomm GIO RTC driver
Date: Thu, 3 Dec 2026 14:07:01 +0100 [thread overview]
Message-ID: <e4466c82-a2eb-41b2-9330-0003a4acc677@oss.qualcomm.com> (raw)
In-Reply-To: <20261118-gio-framework-rtc-driver-2026-10-12-v3-3-52d78a8f43ee@oss.qualcomm.com>
On 11/19/26 7:55 AM, Fenglin Wu wrote:
> On the Glymur platform, the GIO (General I/O) interface communicates
> with the SoCCP battery-management firmware and provides a set of TAD
> (Time-Alarm-Device) registers for reading and writing RTC time. The
> platform also includes registers for configuring an alarm timer and
> initiating device boot-up into different power stages, such as:
> charging only or fully powered-on system, based on the applied power
> source (AC/DC). However, repurposing this alarm timer has very limited
> value for an RTC driver because it does not expose an interrupt when
> the timer expires.
>
> Add an auxiliary RTC driver that corresponds to the auxiliary device
> created by the GIO driver, "pmic_gio.rtc", which manages the RTC timer
> by accessing to the TAD real-time register block through the regmap
> interface exposed by the GIO device.
>
> Tested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> # Zenbook A16
> Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
> ---
> drivers/rtc/Kconfig | 11 +++
> drivers/rtc/Makefile | 1 +
> drivers/rtc/rtc-qcom-gio.c | 153 ++++++++++++++++++++++++++++++++++++++
> drivers/soc/qcom/pmic_glink_gio.c | 14 ++++
> 4 files changed, 179 insertions(+)
>
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 73ec9230edfd..a298f7ae68f9 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1863,6 +1863,17 @@ config RTC_DRV_PM8XXX
> To compile this driver as a module, choose M here: the
> module will be called rtc-pm8xxx.
>
> +config RTC_DRV_QCOM_GIO
> + tristate "Qualcomm GIO RTC driver"
> + depends on QCOM_PMIC_GLINK_GIO
LLM suggests we can depend on QCOM_PMIC_GIO instead, which will allow
compile-testing with less dependencies
> +static int rtc_qcom_gio_probe(struct auxiliary_device *adev,
> + const struct auxiliary_device_id *id)
> +{
> + struct device *dev = &adev->dev;
> + struct rtc_qcom_gio *rtc;
> + int ret;
> +
> + rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL);
> + if (!rtc)
> + return -ENOMEM;
> +
> + rtc->regmap = dev_get_regmap(dev->parent, NULL);
> + if (!rtc->regmap)
> + return -ENODEV;
> +
> + dev_set_drvdata(dev, rtc);
> +
> + rtc->rtc = devm_rtc_allocate_device(dev);
> + if (IS_ERR(rtc->rtc))
> + return PTR_ERR(rtc->rtc);
> +
> + rtc->rtc->ops = &rtc_qcom_gio_ops;
> + rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
> + rtc->rtc->range_max = RTC_TIMESTAMP_END_2099;
> +
> + ret = devm_rtc_register_device(rtc->rtc);
> + if (ret)
> + return ret;
> +
> + return 0;
return devm_rtc_....
[...]
> @@ -338,6 +340,18 @@ static void pmic_glink_gio_init_work(struct work_struct *work)
>
> pmic_gio_set_state(pgio->gio, PMIC_GIO_STATE_UP);
> }
> +
> + /*
> + * Create GIO consumers after PDR to ensure the transport
> + * is up before consumers use the GIO regmap device.
> + */
> + if (!pgio->rtc_aux) {
> + pgio->rtc_aux = devm_pmic_gio_add_consumer(pgio->gio, "rtc");
> + if (!pgio->rtc_aux) {
> + dev_err(pgio->dev, "failed to add RTC consumer\n");
> + return;
> + }
> + }
LLM:
There is a teardown race with pmic_glink_gio_remove(): if remove()
runs right after init_work releases pgio->lock, remove() sets
pgio->removing = true, transitions GIO to PMIC_GIO_STATE_DOWN, and
blocks on cancel_work_sync(&pgio->init_work), while init_work
proceeds to create and probe pmic_gio.rtc during parent removal
with the transport already down.
Konrad
prev parent reply other threads:[~2026-12-03 13:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 6:55 [PATCH v3 0/3] soc: qcom: Add Qualcomm PMIC GIO framework and RTC driver using it Fenglin Wu
2026-11-19 6:55 ` [PATCH v3 1/3] soc: qcom: Add pmic-gio GIO framework driver Fenglin Wu
2026-12-03 12:54 ` Konrad Dybcio
2026-12-03 12:56 ` Konrad Dybcio
2026-12-03 12:57 ` Konrad Dybcio
2026-11-19 6:55 ` [PATCH v3 2/3] soc: qcom: pmic_glink: Add GIO pmic_glink instance Fenglin Wu
2026-12-03 12:59 ` Konrad Dybcio
2026-12-03 13:01 ` Konrad Dybcio
2026-11-19 6:55 ` [PATCH v3 3/3] rtc: Add Qualcomm GIO RTC driver Fenglin Wu
2026-12-03 13:07 ` Konrad Dybcio [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e4466c82-a2eb-41b2-9330-0003a4acc677@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=andersson@kernel.org \
--cc=david.collins@oss.qualcomm.com \
--cc=fenglin.wu@oss.qualcomm.com \
--cc=kamal.wadhwa@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=subbaraman.narayanamurthy@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®