[PATCH 01/11] button: qcom-pmic: introduce exported setup method

Sam Day via B4 Relay devnull+me.samcday.com at kernel.org
Sat Jun 6 10:47:32 CEST 2026


From: Sam Day <me at samcday.com>

The qcom_pwrkey driver is currently binding to both the individual
pwrkey/resin nodes, as well as the parent pon node.

In the next commit, a new glue driver will be introduced for pm8916_pon,
which will continue binding these buttons, as well as additional
drivers.

button_qcom_pmic_bind was renamed to button_qcom_pmic_setup and exported
in a shared header, which the new pm8916_pon driver will call.

Signed-off-by: Sam Day <me at samcday.com>
---
 drivers/button/button-qcom-pmic.c |  6 +++---
 include/button/qcom-pmic.h        | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/button/button-qcom-pmic.c b/drivers/button/button-qcom-pmic.c
index b823490d6d5..d9ac6a51df5 100644
--- a/drivers/button/button-qcom-pmic.c
+++ b/drivers/button/button-qcom-pmic.c
@@ -13,9 +13,9 @@
 #include <dm/lists.h>
 #include <log.h>
 #include <power/pmic.h>
-#include <spmi/spmi.h>
 #include <linux/bitops.h>
 #include <time.h>
+#include "button/qcom-pmic.h"
 
 #define REG_TYPE		0x4
 #define REG_SUBTYPE		0x5
@@ -174,7 +174,7 @@ static int qcom_pwrkey_probe(struct udevice *dev)
 	return 0;
 }
 
-static int button_qcom_pmic_bind(struct udevice *parent)
+int button_qcom_pmic_setup(struct udevice *parent)
 {
 	struct udevice *dev;
 	ofnode node;
@@ -227,7 +227,7 @@ U_BOOT_DRIVER(qcom_pwrkey) = {
 	.name = "qcom_pwrkey",
 	.id = UCLASS_BUTTON,
 	.of_match = qcom_pwrkey_ids,
-	.bind = button_qcom_pmic_bind,
+	.bind = button_qcom_pmic_setup,
 	.probe = qcom_pwrkey_probe,
 	.ops = &button_qcom_pmic_ops,
 	.priv_auto = sizeof(struct qcom_pmic_btn_priv),
diff --git a/include/button/qcom-pmic.h b/include/button/qcom-pmic.h
new file mode 100644
index 00000000000..d321bbab460
--- /dev/null
+++ b/include/button/qcom-pmic.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#include <dm/device.h>
+#include <linux/errno.h>
+
+#if CONFIG_IS_ENABLED(BUTTON_QCOM_PMIC)
+/**
+ * Binds the qcom_pwrkey driver to compatible pwrkey/resin child nodes
+ * belonging to @parent
+ */
+int button_qcom_pmic_setup(struct udevice *parent);
+#else
+static int button_qcom_pmic_setup(struct udevice *parent)
+{
+	return -ENOSYS;
+}
+#endif

-- 
2.54.0




More information about the U-Boot mailing list