]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mfd: sec: Add rtc alarm IRQ as platform device resource
authorAndré Draszik <andre.draszik@linaro.org>
Tue, 13 Jan 2026 14:03:11 +0000 (14:03 +0000)
committerLee Jones <lee@kernel.org>
Tue, 20 Jan 2026 15:36:52 +0000 (15:36 +0000)
By adding the RTC alarm IRQ to the MFD cell as a resource, the child
driver (rtc) can simply query that IRQ, instead of having a lookup
table itself.

This change therefore allows the child driver to be simplified with
regards to determining the alarm IRQ.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260113-s5m-alarm-v3-1-855a19db1277@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/sec-common.c

index 42d55e70e34c8d7cd68cddaecc88017e259365b4..77370db52a7ba81234136b29f85892f4b197f429 100644 (file)
 #include <linux/regmap.h>
 #include "sec-core.h"
 
+static const struct resource s5m8767_rtc_resources[] = {
+       DEFINE_RES_IRQ_NAMED(S5M8767_IRQ_RTCA1, "alarm"),
+};
+
 static const struct mfd_cell s5m8767_devs[] = {
        MFD_CELL_NAME("s5m8767-pmic"),
-       MFD_CELL_NAME("s5m-rtc"),
+       MFD_CELL_RES("s5m-rtc", s5m8767_rtc_resources),
        MFD_CELL_OF("s5m8767-clk", NULL, NULL, 0, 0, "samsung,s5m8767-clk"),
 };
 
@@ -33,50 +37,66 @@ static const struct mfd_cell s2dos05_devs[] = {
        MFD_CELL_NAME("s2dos05-regulator"),
 };
 
+static const struct resource s2mpg10_rtc_resources[] = {
+       DEFINE_RES_IRQ_NAMED(S2MPG10_IRQ_RTCA0, "alarm"),
+};
+
 static const struct mfd_cell s2mpg10_devs[] = {
        MFD_CELL_NAME("s2mpg10-meter"),
        MFD_CELL_NAME("s2mpg10-regulator"),
-       MFD_CELL_NAME("s2mpg10-rtc"),
+       MFD_CELL_RES("s2mpg10-rtc", s2mpg10_rtc_resources),
        MFD_CELL_OF("s2mpg10-clk", NULL, NULL, 0, 0, "samsung,s2mpg10-clk"),
        MFD_CELL_OF("s2mpg10-gpio", NULL, NULL, 0, 0, "samsung,s2mpg10-gpio"),
 };
 
+static const struct resource s2mps11_rtc_resources[] = {
+       DEFINE_RES_IRQ_NAMED(S2MPS11_IRQ_RTCA0, "alarm"),
+};
+
 static const struct mfd_cell s2mps11_devs[] = {
        MFD_CELL_NAME("s2mps11-regulator"),
-       MFD_CELL_NAME("s2mps14-rtc"),
+       MFD_CELL_RES("s2mps14-rtc", s2mps11_rtc_resources),
        MFD_CELL_OF("s2mps11-clk", NULL, NULL, 0, 0, "samsung,s2mps11-clk"),
 };
 
+static const struct resource s2mps14_rtc_resources[] = {
+       DEFINE_RES_IRQ_NAMED(S2MPS14_IRQ_RTCA0, "alarm"),
+};
+
 static const struct mfd_cell s2mps13_devs[] = {
        MFD_CELL_NAME("s2mps13-regulator"),
-       MFD_CELL_NAME("s2mps13-rtc"),
+       MFD_CELL_RES("s2mps13-rtc", s2mps14_rtc_resources),
        MFD_CELL_OF("s2mps13-clk", NULL, NULL, 0, 0, "samsung,s2mps13-clk"),
 };
 
 static const struct mfd_cell s2mps14_devs[] = {
        MFD_CELL_NAME("s2mps14-regulator"),
-       MFD_CELL_NAME("s2mps14-rtc"),
+       MFD_CELL_RES("s2mps14-rtc", s2mps14_rtc_resources),
        MFD_CELL_OF("s2mps14-clk", NULL, NULL, 0, 0, "samsung,s2mps14-clk"),
 };
 
 static const struct mfd_cell s2mps15_devs[] = {
        MFD_CELL_NAME("s2mps15-regulator"),
-       MFD_CELL_NAME("s2mps15-rtc"),
+       MFD_CELL_RES("s2mps15-rtc", s2mps14_rtc_resources),
        MFD_CELL_OF("s2mps13-clk", NULL, NULL, 0, 0, "samsung,s2mps13-clk"),
 };
 
 static const struct mfd_cell s2mpa01_devs[] = {
        MFD_CELL_NAME("s2mpa01-pmic"),
-       MFD_CELL_NAME("s2mps14-rtc"),
+       MFD_CELL_RES("s2mps14-rtc", s2mps14_rtc_resources),
 };
 
 static const struct mfd_cell s2mpu02_devs[] = {
        MFD_CELL_NAME("s2mpu02-regulator"),
 };
 
+static const struct resource s2mpu05_rtc_resources[] = {
+       DEFINE_RES_IRQ_NAMED(S2MPU05_IRQ_RTCA0, "alarm"),
+};
+
 static const struct mfd_cell s2mpu05_devs[] = {
        MFD_CELL_NAME("s2mpu05-regulator"),
-       MFD_CELL_NAME("s2mps15-rtc"),
+       MFD_CELL_RES("s2mps15-rtc", s2mpu05_rtc_resources),
 };
 
 static void sec_pmic_dump_rev(struct sec_pmic_dev *sec_pmic)
@@ -220,7 +240,7 @@ int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq,
                                     sec_pmic->device_type);
        }
        ret = devm_mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs,
-                                  NULL, 0, NULL);
+                                  NULL, 0, regmap_irq_get_domain(sec_pmic->irq_data));
        if (ret)
                return ret;