From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Sudeep Holla <sudeep.holla@arm.com>,
Cristian Marussi <cristian.marussi@arm.com>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
imx@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-rtc@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 1/4] firmware: arm_scmi: imx: Support more event sources
Date: Mon, 20 Jan 2025 10:25:33 +0800 [thread overview]
Message-ID: <20250120-rtc-v1-1-08c50830bac9@nxp.com> (raw)
In-Reply-To: <20250120-rtc-v1-0-08c50830bac9@nxp.com>
From: Peng Fan <peng.fan@nxp.com>
The i.MX System Manager BBM protocol has the capability to support
more than one RTCs. Add scmi_imx_bbm_get_num_sources to replace
num_sources which was fixed to 1. Then the 2nd RTC event could be
configured.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c
index aa176c1a5eefe4220e54e366cf3a267de639fa9b..86fadfe8e3560b1cab5876a1029e38d91d938e2f 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-bbm.c
@@ -128,7 +128,7 @@ static int scmi_imx_bbm_notify(const struct scmi_protocol_handle *ph,
return ret;
rtc_notify = t->tx.buf;
- rtc_notify->rtc_id = cpu_to_le32(0);
+ rtc_notify->rtc_id = cpu_to_le32(src_id);
rtc_notify->flags =
cpu_to_le32(enable ? SCMI_IMX_BBM_NOTIFY_RTC_FLAG : 0);
} else if (message_id == IMX_BBM_BUTTON_NOTIFY) {
@@ -156,6 +156,20 @@ static enum scmi_imx_bbm_protocol_cmd evt_2_cmd[] = {
IMX_BBM_BUTTON_NOTIFY
};
+static int scmi_imx_bbm_get_num_sources(const struct scmi_protocol_handle *ph)
+{
+ struct scmi_imx_bbm_info *pi = ph->get_priv(ph);
+
+ if (!pi)
+ return -EINVAL;
+
+ /*
+ * There is RTC and Button, but there is only one BBM button, and
+ * at least one RTC, so use nr_rtc as sources number
+ */
+ return pi->nr_rtc;
+}
+
static int scmi_imx_bbm_set_notify_enabled(const struct scmi_protocol_handle *ph,
u8 evt_id, u32 src_id, bool enable)
{
@@ -220,6 +234,7 @@ static const struct scmi_event scmi_imx_bbm_events[] = {
};
static const struct scmi_event_ops scmi_imx_bbm_event_ops = {
+ .get_num_sources = scmi_imx_bbm_get_num_sources,
.set_notify_enabled = scmi_imx_bbm_set_notify_enabled,
.fill_custom_report = scmi_imx_bbm_fill_custom_report,
};
@@ -229,7 +244,6 @@ static const struct scmi_protocol_events scmi_imx_bbm_protocol_events = {
.ops = &scmi_imx_bbm_event_ops,
.evts = scmi_imx_bbm_events,
.num_events = ARRAY_SIZE(scmi_imx_bbm_events),
- .num_sources = 1,
};
static int scmi_imx_bbm_rtc_time_set(const struct scmi_protocol_handle *ph,
--
2.37.1
next prev parent reply other threads:[~2025-01-20 2:26 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 2:25 [PATCH 0/4] rtc/scmi: Support multiple RTCs Peng Fan (OSS)
2025-01-20 2:25 ` Peng Fan (OSS) [this message]
2025-01-20 2:25 ` [PATCH 2/4] firmware: arm_scmi: imx: Introduce bbm_info hook Peng Fan (OSS)
2025-01-20 2:25 ` [PATCH 3/4] rtc: Introduce devm_rtc_allocate_device_priv Peng Fan (OSS)
2025-01-20 10:57 ` Dan Carpenter
2025-01-21 14:35 ` Peng Fan
2025-01-21 15:15 ` Dan Carpenter
2025-01-20 2:25 ` [PATCH 4/4] rtc: imx-sm-bbm: Support multiple RTCs Peng Fan (OSS)
2025-02-11 17:01 ` Sudeep Holla
2025-02-12 6:41 ` Peng Fan
2025-02-12 10:44 ` Sudeep Holla
2025-01-20 10:21 ` [PATCH 0/4] rtc/scmi: " Alexandre Belloni
2025-01-21 14:31 ` Peng Fan
2025-02-03 11:50 ` Peng Fan
2025-02-11 16:59 ` Sudeep Holla
2025-02-12 6:35 ` Peng Fan
2025-02-12 10:43 ` Sudeep Holla
2025-02-12 17:01 ` Alexandre Belloni
2025-02-13 3:30 ` Peng Fan
2025-02-13 8:20 ` Alexandre Belloni
2025-02-13 10:52 ` Peng Fan
2025-02-13 11:26 ` Alexandre Belloni
2025-02-13 13:35 ` Peng Fan
2025-02-13 12:54 ` Alexandre Belloni
2025-02-14 3:55 ` Peng Fan
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=20250120-rtc-v1-1-08c50830bac9@nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=sudeep.holla@arm.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