Linux RTC
 help / color / mirror / Atom feed
* [PATCH v3 1/5] dt-bindings: rtc: sc2731: Add compatible for SC2730
From: Otto Pflüger @ 2026-03-29  7:27 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger
In-Reply-To: <20260329-sc27xx-mfd-cells-v3-0-9158dee41f74@abscue.de>

The RTC block found in the SC2730 PMIC is compatible with the one found
in the SC2731 PMIC.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
 Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml b/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
index 5756f617df36..1deae2f4f09d 100644
--- a/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
@@ -13,7 +13,12 @@ maintainers:
 
 properties:
   compatible:
-    const: sprd,sc2731-rtc
+    oneOf:
+      - items:
+          - enum:
+              - sprd,sc2730-rtc
+          - const: sprd,sc2731-rtc
+      - const: sprd,sc2731-rtc
 
   reg:
     maxItems: 1

-- 
2.51.0


^ permalink raw reply related

* [PATCH v3 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices()
From: Otto Pflüger @ 2026-03-29  7:27 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger, Sebastian Reichel

These changes resulted from the need to decouple the the Linux device
driver hierarchy from the device tree bindings for two different series
introducing regulator [1] and poweroff [2] support for the SC2730 PMIC.

There are different PMICs in the SC27xx series, including SC2730 and
SC2731. These have a lot of similarities, but some differences too. For
instance, they contain compatible RTC blocks, but completely different
sets of regulators.

On the Linux side, each PMIC block needs its own driver. The MFD driver
currently uses devm_of_platform_populate() to load the drivers for the
components of the PMIC, which only works when each component has its own
sub-node with a "compatible" property that is used to select a driver
for the device.

When viewed from the device tree side, the parent node representing the
PMIC already contains a "compatible" property that distinguishes the
different PMICs. While the device tree bindings currently do require a
separate "compatible" property for each sub-node (ADC, fuel gauge,
regulators, ...), this is essentially redundant since the node name and
the parent compatible uniquely identify the component. Moreover, some
parts of the PMIC such as the poweroff/reboot controller do not even
need a corresponding device tree node.

Change the MFD driver to use MFD cells instead, which allows it to
instantiate sub-devices both with and without device tree nodes.
Devices that do not have a separate device tree node with its own
"compatible" property can be matched by their platform device ID.
Use this to hook up the existing SC2731 poweroff and regulator drivers,
which were previously not loaded at all due to the lack of an ID table.

In the device tree bindings, deprecate the redundant "compatible"
property for the "regulators" node. While it might make sense to do this
for the other components too, there are a few reasons to only change the
regulators at this point:
 - The regulators node is special since it is not as independent as the
   other components. For instance, it is the only child node of the PMIC
   that does not have a "reg" property. The set of regulators also
   differs much more between different PMIC models than the register
   layout of the other components.
 - We already have some other PMICs where only the regulators are
   treated specially like this, such as MediaTek MT6359 and MT6370.
 - It was suggested to remove the "compatible" property for the new
   SC2730 regulator bindings I am preparing in [2]. The bindings for
   the other components do not need any significant changes at the
   moment.
 - Unlike the poweroff and regulator components, the other parts are
   already working with the existing drivers and bindings.

For the other components that still have a "compatible" property used
for matching MFD cells, ensure that an SC2730-specific compatible is
defined in the bindings so that it can be listed in the SC2730-specific
device table in the MFD driver.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>

[1]: https://lore.kernel.org/all/20250926-sc2730-reboot-v1-0-62ebfd3d31bb@abscue.de/
[2]: https://lore.kernel.org/all/20260220-sc2730-regulators-v1-0-3f2bbc9ecf14@abscue.de/

---
Changes in v3:
- Fixed warning about pointer-to-integer cast by using uintptr_t.
- Changed device ID enum to start with 1 so that 0 is invalid.
- Link to v2: https://lore.kernel.org/r/20260325-sc27xx-mfd-cells-v2-0-d0ebb60aa4a7@abscue.de

Changes in v2:
- Changed PMIC type matching in MFD driver to use an identifier like
  other drivers instead of passing pointers through of_device_id.
- Rebased on next-20260324.
- Link to v1: https://lore.kernel.org/r/20260222-sc27xx-mfd-cells-v1-0-69526fe74c77@abscue.de

---
Otto Pflüger (5):
      dt-bindings: rtc: sc2731: Add compatible for SC2730
      regulator: dt-bindings: sc2731: Deprecate compatible property
      mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
      power: reset: sc27xx: Add platform_device_id table
      regulator: sc2731: Add platform_device_id table

 .../devicetree/bindings/mfd/sprd,sc2731.yaml       |  2 -
 .../bindings/regulator/sprd,sc2731-regulator.yaml  |  4 +-
 .../devicetree/bindings/rtc/sprd,sc2731-rtc.yaml   |  7 ++-
 drivers/mfd/sprd-sc27xx-spi.c                      | 62 ++++++++++++++++++----
 drivers/power/reset/sc27xx-poweroff.c              |  8 +++
 drivers/regulator/sc2731-regulator.c               | 10 +++-
 6 files changed, 77 insertions(+), 16 deletions(-)
---
base-commit: 85964cdcad0fac9a0eb7b87a0f9d88cc074b854c
change-id: 20260221-sc27xx-mfd-cells-dab7905f3aae

Best regards,
-- 
Otto Pflüger <otto.pflueger@abscue.de>


^ permalink raw reply

* Re: [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
From: kernel test robot @ 2026-03-29  2:43 UTC (permalink / raw)
  To: Otto Pflüger, Alexandre Belloni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Lee Jones, Pavel Machek, Liam Girdwood, Mark Brown,
	Sebastian Reichel
  Cc: llvm, oe-kbuild-all, linux-rtc, devicetree, linux-kernel,
	linux-leds, linux-pm, Otto Pflüger
In-Reply-To: <20260325-sc27xx-mfd-cells-v2-3-d0ebb60aa4a7@abscue.de>

Hi Otto,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 85964cdcad0fac9a0eb7b87a0f9d88cc074b854c]

url:    https://github.com/intel-lab-lkp/linux/commits/Otto-Pfl-ger/dt-bindings-rtc-sc2731-Add-compatible-for-SC2730/20260327-162827
base:   85964cdcad0fac9a0eb7b87a0f9d88cc074b854c
patch link:    https://lore.kernel.org/r/20260325-sc27xx-mfd-cells-v2-3-d0ebb60aa4a7%40abscue.de
patch subject: [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260329/202603291013.6DnmGjG3-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 054e11d1a17e5ba88bb1a8ef32fad3346e80b186)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260329/202603291013.6DnmGjG3-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603291013.6DnmGjG3-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mfd/sprd-sc27xx-spi.c:188:14: warning: cast to smaller integer type 'enum sprd_pmic_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
     188 |         pmic_type = (enum sprd_pmic_type)of_device_get_match_data(&spi->dev);
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +188 drivers/mfd/sprd-sc27xx-spi.c

   179	
   180	static int sprd_pmic_probe(struct spi_device *spi)
   181	{
   182		struct sprd_pmic *ddata;
   183		enum sprd_pmic_type pmic_type;
   184		const struct sprd_pmic_data *pdata;
   185		const struct mfd_cell *cells;
   186		int ret, i, num_cells;
   187	
 > 188		pmic_type = (enum sprd_pmic_type)of_device_get_match_data(&spi->dev);
   189	
   190		switch (pmic_type) {
   191		case PMIC_TYPE_SC2730:
   192			pdata = &sc2730_data;
   193			cells = sc2730_devices;
   194			num_cells = ARRAY_SIZE(sc2730_devices);
   195			break;
   196		case PMIC_TYPE_SC2731:
   197			pdata = &sc2731_data;
   198			cells = sc2731_devices;
   199			num_cells = ARRAY_SIZE(sc2731_devices);
   200			break;
   201		default:
   202			dev_err(&spi->dev, "Invalid device ID\n");
   203			return -EINVAL;
   204		}
   205	
   206		ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL);
   207		if (!ddata)
   208			return -ENOMEM;
   209	
   210		ddata->regmap = devm_regmap_init(&spi->dev, &sprd_pmic_regmap,
   211						 &spi->dev, &sprd_pmic_config);
   212		if (IS_ERR(ddata->regmap)) {
   213			ret = PTR_ERR(ddata->regmap);
   214			dev_err(&spi->dev, "Failed to allocate register map %d\n", ret);
   215			return ret;
   216		}
   217	
   218		spi_set_drvdata(spi, ddata);
   219		ddata->dev = &spi->dev;
   220		ddata->irq = spi->irq;
   221		ddata->pdata = pdata;
   222	
   223		ddata->irq_chip.name = dev_name(&spi->dev);
   224		ddata->irq_chip.status_base =
   225			pdata->irq_base + SPRD_PMIC_INT_MASK_STATUS;
   226		ddata->irq_chip.unmask_base = pdata->irq_base + SPRD_PMIC_INT_EN;
   227		ddata->irq_chip.ack_base = 0;
   228		ddata->irq_chip.num_regs = 1;
   229		ddata->irq_chip.num_irqs = pdata->num_irqs;
   230	
   231		ddata->irqs = devm_kcalloc(&spi->dev,
   232					   pdata->num_irqs, sizeof(struct regmap_irq),
   233					   GFP_KERNEL);
   234		if (!ddata->irqs)
   235			return -ENOMEM;
   236	
   237		ddata->irq_chip.irqs = ddata->irqs;
   238		for (i = 0; i < pdata->num_irqs; i++)
   239			ddata->irqs[i].mask = BIT(i);
   240	
   241		ret = devm_regmap_add_irq_chip(&spi->dev, ddata->regmap, ddata->irq,
   242					       IRQF_ONESHOT, 0,
   243					       &ddata->irq_chip, &ddata->irq_data);
   244		if (ret) {
   245			dev_err(&spi->dev, "Failed to add PMIC irq chip %d\n", ret);
   246			return ret;
   247		}
   248	
   249		ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_AUTO,
   250					   cells, num_cells, NULL, 0,
   251					   regmap_irq_get_domain(ddata->irq_data));
   252		if (ret) {
   253			dev_err(&spi->dev, "Failed to populate sub-devices %d\n", ret);
   254			return ret;
   255		}
   256	
   257		ret = devm_device_init_wakeup(&spi->dev);
   258		if (ret)
   259			return dev_err_probe(&spi->dev, ret, "Failed to init wakeup\n");
   260	
   261		return 0;
   262	}
   263	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* Re: [PATCH 1/7] dt-bindings: rtc: sun6i: Add Allwinner A733 support
From: Chen-Yu Tsai @ 2026-03-28 12:37 UTC (permalink / raw)
  To: Junhui Liu
  Cc: Michael Turquette, Stephen Boyd, Jernej Skrabec, Samuel Holland,
	Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Ripard, linux-clk, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-rtc, devicetree
In-Reply-To: <20260121-a733-rtc-v1-1-d359437f23a7@pigmoral.tech>

On Wed, Jan 21, 2026 at 7:03 PM Junhui Liu <junhui.liu@pigmoral.tech> wrote:
>
> The RTC module in the Allwinner A733 SoC is functionally compatible with
> the sun6i RTC, but its internal Clock Control Unit (CCU) has significant
> changes.
>
> The A733 supports selecting the oscillator between three frequencies:
> 19.2MHz, 24MHz, and 26MHz. The RTC CCU relies on hardware to detect
> which frequency is actually used on the board. By defining all three
> frequencies as fixed-clocks in the device tree, the driver can identify
> the hardware-detected frequency and expose it to the rest of the system.

No. The board device tree shall have the exact and correct frequency
defined in the external crystal device node. The operating system can
use the hardware-detected frequency to "fix" the in-system representation
if it is off.

> Additionally, the A733 RTC CCU provides several new DCXO gate clocks for
> specific modules, including SerDes, HDMI, and UFS.
>
> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
> ---
>  .../bindings/rtc/allwinner,sun6i-a31-rtc.yaml      | 38 ++++++++++++++++++++--
>  include/dt-bindings/clock/sun60i-a733-rtc.h        | 16 +++++++++
>  2 files changed, 52 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml b/Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml
> index 9df5cdb6f63f..b18431955783 100644
> --- a/Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml
> +++ b/Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml
> @@ -26,6 +26,7 @@ properties:
>            - allwinner,sun50i-h6-rtc
>            - allwinner,sun50i-h616-rtc
>            - allwinner,sun50i-r329-rtc
> +          - allwinner,sun60i-a733-rtc
>        - items:
>            - const: allwinner,sun50i-a64-rtc
>            - const: allwinner,sun8i-h3-rtc
> @@ -46,11 +47,11 @@ properties:
>
>    clocks:
>      minItems: 1
> -    maxItems: 4
> +    maxItems: 6
>
>    clock-names:
>      minItems: 1
> -    maxItems: 4
> +    maxItems: 6
>
>    clock-output-names:
>      minItems: 1
> @@ -156,6 +157,38 @@ allOf:
>          - clocks
>          - clock-names
>
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: allwinner,sun60i-a733-rtc
> +
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 5
> +          items:
> +            - description: Bus clock for register access

> +            - description: 19.2 MHz oscillator
> +            - description: 24 MHz oscillator
> +            - description: 26 MHz oscillator

No. There is only one input. As in there is only one set of pins for the
DCXO. The inputs are the same as on R329 / A523. Just use that list.

> +            - description: AHB parent for internal SPI clock
> +            - description: External 32768 Hz oscillator
> +
> +        clock-names:
> +          minItems: 5
> +          items:
> +            - const: bus
> +            - const: osc19M
> +            - const: osc24M
> +            - const: osc26M
> +            - const: ahb
> +            - const: ext-osc32k
> +
> +      required:
> +        - clocks
> +        - clock-names
> +
>    - if:
>        properties:
>          compatible:
> @@ -164,6 +197,7 @@ allOf:
>                - allwinner,sun8i-r40-rtc
>                - allwinner,sun50i-h616-rtc
>                - allwinner,sun50i-r329-rtc
> +              - allwinner,sun60i-a733-rtc
>
>      then:
>        properties:
> diff --git a/include/dt-bindings/clock/sun60i-a733-rtc.h b/include/dt-bindings/clock/sun60i-a733-rtc.h
> new file mode 100644
> index 000000000000..8a2b5facad73
> --- /dev/null
> +++ b/include/dt-bindings/clock/sun60i-a733-rtc.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
> +
> +#ifndef _DT_BINDINGS_CLK_SUN60I_A733_RTC_H_
> +#define _DT_BINDINGS_CLK_SUN60I_A733_RTC_H_
> +
> +#define CLK_IOSC               0
> +#define CLK_OSC32K             1
> +#define CLK_HOSC               2

The DCXO enable control has been present since at least the H6. We just
never added it, as we would never disable it anyway.

If you compare the RTC clock trees of the A733 and A523, the only addition
besides the new gates seems to be the LOSC auto selection. But even that
is just an illusion, as the A523 has the same registers for that.

One could say the A733 RTC is almost backward compatible to the A523, if
not for the two fastboot registers the A523 has at 0x120 and 0x124.

So I ask that you try to integrate the differences into the existing
driver and bindings. You can tweak and export internal clks if you
need.

> +#define CLK_RTC_32K            3

AFAICT besides being an internal clock, this is also fed to GPIO for
debounce? We probably need to expose this on the A523 as well.


Thanks
ChenYu


> +#define CLK_OSC32K_FANOUT      4
> +#define CLK_HOSC_SERDES1       5
> +#define CLK_HOSC_SERDES0       6
> +#define CLK_HOSC_HDMI          7
> +#define CLK_HOSC_UFS           8
> +
> +#endif /* _DT_BINDINGS_CLK_SUN60I_A733_RTC_H_ */
>
> --
> 2.52.0
>
>

^ permalink raw reply

* Re: [PATCH 6/7] rtc: sun6i: Add support for A733 RTC
From: Chen-Yu Tsai @ 2026-03-28 12:40 UTC (permalink / raw)
  To: Junhui Liu
  Cc: Michael Turquette, Stephen Boyd, Jernej Skrabec, Samuel Holland,
	Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Ripard, linux-clk, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-rtc, devicetree
In-Reply-To: <20260121-a733-rtc-v1-6-d359437f23a7@pigmoral.tech>

On Wed, Jan 21, 2026 at 7:04 PM Junhui Liu <junhui.liu@pigmoral.tech> wrote:
>
> The RTC in the Allwinner A733 SoC is compatible with the H616 in terms
> of its time storage and alarm functionality. However, its internal CCU
> is different, with additional DCXO handling logic.
>
> Add new match data to register a new auxiliary device for its CCU part.

This is probably incorrect, since you aren't actually adding auxiliary
devices. It should just say "add a new compatible and matching data for
the new SoC".

>
> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
> ---
>  drivers/rtc/rtc-sun6i.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
> index b4489e0a09ce..a58d9c6b917c 100644
> --- a/drivers/rtc/rtc-sun6i.c
> +++ b/drivers/rtc/rtc-sun6i.c
> @@ -865,6 +865,11 @@ static const struct sun6i_rtc_match_data sun6i_rtc_match_data = {
>         .flags = RTC_LINEAR_DAY,
>  };
>
> +static const struct sun6i_rtc_match_data sun60i_rtc_match_data = {
> +       .adev_name = "sun60i",
> +       .flags = RTC_LINEAR_DAY,
> +};
> +
>  /*
>   * As far as RTC functionality goes, all models are the same. The
>   * datasheets claim that different models have different number of
> @@ -883,6 +888,8 @@ static const struct of_device_id sun6i_rtc_dt_ids[] = {
>                 .data = &sun6i_rtc_match_data },
>         { .compatible = "allwinner,sun50i-r329-rtc",
>                 .data = &sun6i_rtc_match_data },
> +       { .compatible = "allwinner,sun60i-a733-rtc",
> +               .data = &sun60i_rtc_match_data },
>         { /* sentinel */ },
>  };
>  MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids);
>
> --
> 2.52.0
>
>

^ permalink raw reply

* Re: [PATCH 7/7] clk: sunxi-ng: Add Allwinner A733 RTC CCU support
From: Chen-Yu Tsai @ 2026-03-28 14:41 UTC (permalink / raw)
  To: Junhui Liu
  Cc: Michael Turquette, Stephen Boyd, Jernej Skrabec, Samuel Holland,
	Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Maxime Ripard, linux-clk, linux-arm-kernel, linux-sunxi,
	linux-kernel, linux-rtc, devicetree, André Przywara
In-Reply-To: <20260121-a733-rtc-v1-7-d359437f23a7@pigmoral.tech>

On Wed, Jan 21, 2026 at 7:04 PM Junhui Liu <junhui.liu@pigmoral.tech> wrote:
>
> Add support for the internal CCU found in the RTC module of the Allwinner
> A733 SoC. While the basic 16MHz (IOSC) and 32kHz logic remains compatible
> with older SoCs like the sun6i, the A733 introduces several new features.
>
> The A733 RTC CCU supports choosing one of three external crystal
> frequencies: 19.2MHz, 24MHz, and 26MHz. It features hardware detection
> logic to automatically identify the frequency used on the board and
> exports this DCXO signal as the "hosc" clock.
>
> Furthermore, the driver implements logic to derive a 32kHz reference
> from the HOSC. This is achieved through a muxed clock path using fixed
> pre-dividers to normalize the different crystal frequencies to ~32kHz.

Have you tested whether the actually normalizes the frequency, i.e.
selects a different divider based on the DCXO frequency? Otherwise
we're just lying about the frequency.

> This path reuses the same hardware mux registers as the HOSC clock.
>
> Additionally, this CCU provides several gate clocks for specific
> peripherals, including SerDes, HDMI, and UFS. The driver is implemented
> as an auxiliary driver to be bound to the sun6i-rtc driver.
>
> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
> ---
>  drivers/clk/sunxi-ng/Kconfig               |   5 +
>  drivers/clk/sunxi-ng/Makefile              |   2 +
>  drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.c | 204 +++++++++++++++++++++++++++++
>  drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.h |  18 +++
>  drivers/clk/sunxi-ng/ccu_rtc.h             |   7 +
>  5 files changed, 236 insertions(+)
>
> diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig
> index 6af2d020e03e..16afbf249f26 100644
> --- a/drivers/clk/sunxi-ng/Kconfig
> +++ b/drivers/clk/sunxi-ng/Kconfig
> @@ -67,6 +67,11 @@ config SUN55I_A523_R_CCU
>         default ARCH_SUNXI
>         depends on ARM64 || COMPILE_TEST
>
> +config SUN60I_A733_RTC_CCU
> +       tristate "Support for the Allwinner A733 RTC CCU"
> +       default ARCH_SUNXI
> +       depends on ARM64 || COMPILE_TEST
> +
>  config SUN4I_A10_CCU
>         tristate "Support for the Allwinner A10/A20 CCU"
>         default ARCH_SUNXI
> diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile
> index c3f810a025a8..b0d823440c33 100644
> --- a/drivers/clk/sunxi-ng/Makefile
> +++ b/drivers/clk/sunxi-ng/Makefile
> @@ -39,6 +39,7 @@ obj-$(CONFIG_SUN50I_H616_CCU) += sun50i-h616-ccu.o
>  obj-$(CONFIG_SUN55I_A523_CCU)  += sun55i-a523-ccu.o
>  obj-$(CONFIG_SUN55I_A523_MCU_CCU)      += sun55i-a523-mcu-ccu.o
>  obj-$(CONFIG_SUN55I_A523_R_CCU)        += sun55i-a523-r-ccu.o
> +obj-$(CONFIG_SUN60I_A733_RTC_CCU)      += sun60i-a733-rtc-ccu.o
>  obj-$(CONFIG_SUN4I_A10_CCU)    += sun4i-a10-ccu.o
>  obj-$(CONFIG_SUN5I_CCU)                += sun5i-ccu.o
>  obj-$(CONFIG_SUN6I_A31_CCU)    += sun6i-a31-ccu.o
> @@ -67,6 +68,7 @@ sun50i-h616-ccu-y             += ccu-sun50i-h616.o
>  sun55i-a523-ccu-y              += ccu-sun55i-a523.o
>  sun55i-a523-mcu-ccu-y          += ccu-sun55i-a523-mcu.o
>  sun55i-a523-r-ccu-y            += ccu-sun55i-a523-r.o
> +sun60i-a733-rtc-ccu-y          += ccu-sun60i-a733-rtc.o
>  sun4i-a10-ccu-y                        += ccu-sun4i-a10.o
>  sun5i-ccu-y                    += ccu-sun5i.o
>  sun6i-a31-ccu-y                        += ccu-sun6i-a31.o
> diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.c
> new file mode 100644
> index 000000000000..d17aceffa16e
> --- /dev/null
> +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.c
> @@ -0,0 +1,204 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2026 Junhui Liu <junhui.liu@pigmoral.tech>
> + */
> +
> +#include <linux/array_size.h>
> +#include <linux/auxiliary_bus.h>
> +#include <linux/clk-provider.h>
> +#include <linux/device.h>
> +#include <linux/module.h>
> +
> +#include "ccu_common.h"
> +
> +#include "ccu_gate.h"
> +#include "ccu_mux.h"
> +#include "ccu_rtc.h"
> +
> +#include "ccu-sun60i-a733-rtc.h"
> +
> +static struct ccu_common iosc_clk = {
> +       .reg            = DCXO_CTRL_REG,
> +       .features       = CCU_FEATURE_IOSC_CALIBRATION,
> +       .hw.init        = CLK_HW_INIT_NO_PARENT("iosc", &ccu_iosc_ops,
> +                                               CLK_GET_RATE_NOCACHE),
> +};
> +
> +static struct ccu_common iosc_32k_clk = {
> +       .features       = CCU_FEATURE_IOSC_CALIBRATION,
> +       .hw.init        = CLK_HW_INIT_HW("iosc-32k", &iosc_clk.hw,
> +                                        &ccu_iosc_32k_ops,
> +                                        CLK_GET_RATE_NOCACHE),
> +};
> +
> +static SUNXI_CCU_GATE_FW(ext_osc32k_gate_clk, "ext-osc32k-gate",
> +                        "ext-osc32k", 0x0, BIT(4), 0);
> +
> +static const struct clk_hw *osc32k_parents[] = {
> +       &iosc_32k_clk.hw,
> +       &ext_osc32k_gate_clk.common.hw,
> +};
> +
> +static struct ccu_mux osc32k_clk = {
> +       .mux    = _SUNXI_CCU_MUX(0, 1),
> +       .common = {
> +               .reg            = LOSC_CTRL_REG,
> +               .features       = CCU_FEATURE_KEY_FIELD,
> +               .hw.init        = CLK_HW_INIT_PARENTS_HW("osc32k",
> +                                                        osc32k_parents,
> +                                                        &ccu_mux_ops,
> +                                                        0),
> +       },
> +};
> +
> +static const struct clk_parent_data hosc_parents[] = {
> +       { .fw_name = "osc24M" },
> +       { .fw_name = "osc19M" },
> +       { .fw_name = "osc26M" },
> +       { .fw_name = "osc24M" },
> +};

As mentioned in my reply to the binding, this is wrong. There is only
one input.

The most you can do is check the rate of the parent clock against the
detected one, and _scream_ that the DT is wrong. And maybe override
the reported frequency.

If you want to do the latter, you could add a new fixed rate gated
clock type to our library. You would fill in the rate before the
clocks get registered. I probably wouldn't go that far. We want people
to have correct hardware descriptions.

Funnily enough Allwinner's BSP actually implements a fixed rate gate
for the next 24M-to-32k divider clock.

> +
> +struct ccu_mux hosc_clk = {
> +       .enable = DCXO_CTRL_DCXO_EN,
> +       .mux    = _SUNXI_CCU_MUX(14, 2),
> +       .common = {
> +               .reg            = DCXO_CTRL_REG,
> +               .hw.init        = CLK_HW_INIT_PARENTS_DATA("hosc",
> +                                                          hosc_parents,
> +                                                          &ccu_mux_ro_ops,
> +                                                          0),
> +       },
> +};

So this is wrong.

> +
> +static const struct ccu_mux_fixed_prediv hosc_32k_predivs[] = {
> +       { .index = 0, .div = 732 },

Why is it 732 instead of 750?

> +       { .index = 1, .div = 586 },
> +       { .index = 2, .div = 793 },
> +       { .index = 3, .div = 732 },
> +};
> +
> +static struct ccu_mux hosc_32k_mux_clk = {
> +       .enable         = DCXO_CTRL_DCXO_EN,

No. The parent "hosc" clock owns this.  The enable bit for this clock
is actually bit 16 of LOSC_OUT_GATING_REG, which you model below as
a separate gate.

> +       .mux            = {
> +               .shift          = 14,
> +               .width          = 2,
> +               .fixed_predivs  = hosc_32k_predivs,
> +               .n_predivs      = ARRAY_SIZE(hosc_32k_predivs),
> +       },
> +       .common         = {
> +               .reg            = DCXO_CTRL_REG,
> +               .features       = CCU_FEATURE_FIXED_PREDIV,
> +               .hw.init        = CLK_HW_INIT_PARENTS_DATA("hosc-32k-mux",
> +                                                          hosc_parents,
> +                                                          &ccu_mux_ro_ops,

Again, this is just not the way to do it.

> +                                                          0),
> +       },
> +};

I would test that it actually does switch dividers, Or at the very least,
it has a larger divider for 26M.

Maybe Andre can help? At least on this SoC the fanout pins are much more
accessible.

> +
> +static SUNXI_CCU_GATE_HW(hosc_32k_clk, "hosc-32k", &hosc_32k_mux_clk.common.hw,
> +                        LOSC_OUT_GATING_REG, BIT(16), 0);
> +
> +static const struct clk_hw *rtc_32k_parents[] = {
> +       &osc32k_clk.common.hw,
> +       &hosc_32k_clk.common.hw,
> +};
> +
> +static struct ccu_mux rtc_32k_clk = {
> +       .mux    = _SUNXI_CCU_MUX(1, 1),
> +       .common = {
> +               .reg            = LOSC_CTRL_REG,
> +               .features       = CCU_FEATURE_KEY_FIELD,
> +               .hw.init        = CLK_HW_INIT_PARENTS_HW("rtc-32k",
> +                                                        rtc_32k_parents,
> +                                                        &ccu_mux_ops,
> +                                                        0),
> +       },
> +};
> +
> +static const struct clk_parent_data osc32k_fanout_parents[] = {
> +       { .hw = &osc32k_clk.common.hw },
> +       { .hw = &ext_osc32k_gate_clk.common.hw },
> +       { .hw = &hosc_32k_clk.common.hw },
> +};
> +
> +static SUNXI_CCU_MUX_DATA_WITH_GATE(osc32k_fanout_clk, "osc32k-fanout", osc32k_fanout_parents,
> +                                   LOSC_OUT_GATING_REG,
> +                                   1, 2,       /* mux */
> +                                   BIT(0),     /* gate */
> +                                   0);
> +
> +static SUNXI_CCU_GATE_HW(hosc_serdes1_clk, "hosc-serdes1", &hosc_clk.common.hw,
> +                        DCXO_GATING_REG, DCXO_SERDES1_GATING, 0);

                                            ^
Just use the BIT() expression here. Adding these macros doesn't really help.

> +static SUNXI_CCU_GATE_HW(hosc_serdes0_clk, "hosc-serdes0", &hosc_clk.common.hw,
> +                        DCXO_GATING_REG, DCXO_SERDES0_GATING, 0);
> +static SUNXI_CCU_GATE_HW(hosc_hdmi_clk, "hosc-hdmi", &hosc_clk.common.hw,
> +                        DCXO_GATING_REG, DCXO_HDMI_GATING, 0);
> +static SUNXI_CCU_GATE_HW(hosc_ufs_clk, "hosc-ufs", &hosc_clk.common.hw,
> +                        DCXO_GATING_REG, DCXO_UFS_GATING, 0);
> +
> +static struct ccu_common *sun60i_rtc_ccu_clks[] = {
> +       &iosc_clk,
> +       &iosc_32k_clk,
> +       &ext_osc32k_gate_clk.common,
> +       &osc32k_clk.common,
> +       &hosc_clk.common,
> +       &hosc_32k_mux_clk.common,
> +       &hosc_32k_clk.common,
> +       &rtc_32k_clk.common,
> +       &osc32k_fanout_clk.common,
> +       &hosc_serdes1_clk.common,
> +       &hosc_serdes0_clk.common,
> +       &hosc_hdmi_clk.common,
> +       &hosc_ufs_clk.common,
> +};
> +
> +static struct clk_hw_onecell_data sun60i_rtc_ccu_hw_clks = {
> +       .num = CLK_NUMBER,
> +       .hws = {
> +               [CLK_IOSC]              = &iosc_clk.hw,
> +               [CLK_OSC32K]            = &osc32k_clk.common.hw,
> +               [CLK_HOSC]              = &hosc_clk.common.hw,
> +               [CLK_RTC_32K]           = &rtc_32k_clk.common.hw,
> +               [CLK_OSC32K_FANOUT]     = &osc32k_fanout_clk.common.hw,
> +               [CLK_HOSC_SERDES1]      = &hosc_serdes1_clk.common.hw,
> +               [CLK_HOSC_SERDES0]      = &hosc_serdes0_clk.common.hw,
> +               [CLK_HOSC_HDMI]         = &hosc_hdmi_clk.common.hw,
> +               [CLK_HOSC_UFS]          = &hosc_ufs_clk.common.hw,
> +               [CLK_IOSC_32K]          = &iosc_32k_clk.hw,
> +               [CLK_EXT_OSC32K_GATE]   = &ext_osc32k_gate_clk.common.hw,
> +               [CLK_HOSC_32K_MUX]      = &hosc_32k_mux_clk.common.hw,
> +               [CLK_HOSC_32K]          = &hosc_32k_clk.common.hw,
> +       },
> +};
> +
> +static const struct sunxi_ccu_desc sun60i_rtc_ccu_desc = {
> +       .ccu_clks       = sun60i_rtc_ccu_clks,
> +       .num_ccu_clks   = ARRAY_SIZE(sun60i_rtc_ccu_clks),
> +
> +       .hw_clks        = &sun60i_rtc_ccu_hw_clks,
> +};
> +
> +static int sun60i_rtc_ccu_probe(struct auxiliary_device *adev,
> +                               const struct auxiliary_device_id *id)
> +{
> +       struct device *dev = &adev->dev;
> +       void __iomem *reg = dev->platform_data;
> +
> +       return devm_sunxi_ccu_probe(dev, reg, &sun60i_rtc_ccu_desc);
> +}
> +
> +static const struct auxiliary_device_id sun60i_ccu_rtc_ids[] = {
> +       { .name = SUN6I_RTC_AUX_ID(sun60i) },
> +       { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(auxiliary, sun60i_ccu_rtc_ids);
> +
> +static struct auxiliary_driver sun60i_ccu_rtc_driver = {
> +       .probe = sun60i_rtc_ccu_probe,
> +       .id_table = sun60i_ccu_rtc_ids,
> +};
> +module_auxiliary_driver(sun60i_ccu_rtc_driver);
> +
> +MODULE_IMPORT_NS("SUNXI_CCU");
> +MODULE_DESCRIPTION("Support for the Allwinner A733 RTC CCU");
> +MODULE_LICENSE("GPL");
> diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.h b/drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.h
> new file mode 100644
> index 000000000000..41ec6195b5e7
> --- /dev/null
> +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-rtc.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (C) 2026 Junhui Liu <junhui.liu@pigmoral.tech>
> + */
> +
> +#ifndef _CCU_SUN60I_A733_RTC_H_
> +#define _CCU_SUN60I_A733_RTC_H_
> +
> +#include <dt-bindings/clock/sun60i-a733-rtc.h>
> +
> +#define CLK_IOSC_32K           9
> +#define CLK_EXT_OSC32K_GATE    10
> +#define CLK_HOSC_32K_MUX       11
> +#define CLK_HOSC_32K           12
> +
> +#define CLK_NUMBER             (CLK_HOSC_32K + 1)
> +
> +#endif /* _CCU_SUN60I_A733_RTC_H_ */
> diff --git a/drivers/clk/sunxi-ng/ccu_rtc.h b/drivers/clk/sunxi-ng/ccu_rtc.h
> index 1c44c2206a25..665162723796 100644
> --- a/drivers/clk/sunxi-ng/ccu_rtc.h
> +++ b/drivers/clk/sunxi-ng/ccu_rtc.h
> @@ -27,8 +27,15 @@
>  #define LOSC_OUT_GATING_REG            0x60
>
>  #define DCXO_CTRL_REG                  0x160
> +#define DCXO_CTRL_DCXO_EN              BIT(1)
>  #define DCXO_CTRL_CLK16M_RC_EN         BIT(0)
>
> +#define DCXO_GATING_REG                        0x16c


> +#define DCXO_SERDES1_GATING            BIT(5)
> +#define DCXO_SERDES0_GATING            BIT(4)
> +#define DCXO_HDMI_GATING               BIT(1)
> +#define DCXO_UFS_GATING                        BIT(0)

Adding them to the header is probably even less useful, as the output
could change in future chips.


ChenYu

^ permalink raw reply

* Re: [PATCH v2] dt-bindings: rtc: add olpc,xo1-rtc to trivial-rtc
From: Conor Dooley @ 2026-03-25 17:49 UTC (permalink / raw)
  To: Anushka Badhe
  Cc: alexandre.belloni, conor+dt, devicetree, dsd, krzk+dt,
	linux-kernel, linux-rtc, robh
In-Reply-To: <20260325093003.44051-1-anushkabadhe@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2084 bytes --]

On Wed, Mar 25, 2026 at 03:00:03PM +0530, Anushka Badhe wrote:
> Add the OLPC XO-1 RTC compatible string to the trivial-rtc schema
> instead of creating a standalone binding file, as it only requires
> a compatible property with no additional configuration.
> 
> Signed-off-by: Anushka Badhe <anushkabadhe@gmail.com>
> ---
> 
> Changes in v2:
> - Move binding to trivial-rtc.yaml instead of separate file

Acked-by: Conor Dooley <conor.dooley@microchip.com>

Please don't send new versions in response to old ones.

pw-bot: not-applicable

Cheers,
Conor.

> 
> Note:
> * This patch is part of the GSoC2026 application process for device tree 
> bindings conversions
> * https://github.com/LinuxFoundationGSoC/ProjectIdeas/wiki/GSoC-2026-Device-Tree-Bindings
> 
>  Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt | 5 -----
>  Documentation/devicetree/bindings/rtc/trivial-rtc.yaml | 2 ++
>  2 files changed, 2 insertions(+), 5 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> 
> diff --git a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> deleted file mode 100644
> index a2891ceb6344..000000000000
> --- a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -OLPC XO-1 RTC
> -~~~~~~~~~~~~~
> -
> -Required properties:
> - - compatible : "olpc,xo1-rtc"
> diff --git a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
> index b47822370d6f..722176c831aa 100644
> --- a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
> +++ b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
> @@ -65,6 +65,8 @@ properties:
>        - microcrystal,rv3029
>        # Real Time Clock
>        - microcrystal,rv8523
> +      # OLPC XO-1 RTC
> +      - olpc,xo1-rtc
>        # I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
>        - ricoh,r2025sd
>        # I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
> -- 
> 2.43.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply

* Re: [PATCH v3 09/13] leds: flash: add support for Samsung S2M series PMIC flash LED device
From: Lee Jones @ 2026-03-25 14:58 UTC (permalink / raw)
  To: Kaustabh Chakraborty
  Cc: Pavel Machek, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	MyungJoo Ham, Chanwoo Choi, Sebastian Reichel,
	Krzysztof Kozlowski, André Draszik, Alexandre Belloni,
	Jonathan Corbet, Shuah Khan, Nam Tran, linux-leds, devicetree,
	linux-kernel, linux-pm, linux-samsung-soc, linux-rtc, linux-doc
In-Reply-To: <DH1XVOS6IIOE.HGIH6JQRHNAM@disroot.org>

On Sat, 14 Mar 2026, Kaustabh Chakraborty wrote:

> On 2026-03-10 11:38 +00:00, Lee Jones wrote:
> > On Wed, 25 Feb 2026, Kaustabh Chakraborty wrote:
> >
> >> Add support for flash LEDs found in certain Samsung S2M series PMICs.
> >> The device has two channels for LEDs, typically for the back and front
> >> cameras in mobile devices. Both channels can be independently
> >> controlled, and can be operated in torch or flash modes.
> >> 
> >> The driver includes initial support for the S2MU005 PMIC flash LEDs.
> >> 
> >> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> >> ---
> >>  drivers/leds/flash/Kconfig          |  12 +
> >>  drivers/leds/flash/Makefile         |   1 +
> >>  drivers/leds/flash/leds-s2m-flash.c | 429 ++++++++++++++++++++++++++++++++++++
> >>  3 files changed, 442 insertions(+)
> >> 
> >> diff --git a/drivers/leds/flash/Kconfig b/drivers/leds/flash/Kconfig
> >> index 5e08102a67841..be62e05277429 100644
> >> --- a/drivers/leds/flash/Kconfig
> >> +++ b/drivers/leds/flash/Kconfig
> >> @@ -114,6 +114,18 @@ config LEDS_RT8515
> >>  	  To compile this driver as a module, choose M here: the module
> >>  	  will be called leds-rt8515.
> >>  
> >> +config LEDS_S2M_FLASH
> >> +	tristate "Samsung S2M series PMICs flash/torch LED support"
> >> +	depends on LEDS_CLASS
> >> +	depends on MFD_SEC_CORE
> >> +	depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
> >> +	select REGMAP_IRQ
> >> +	help
> >> +	  This option enables support for the flash/torch LEDs found in
> >> +	  certain Samsung S2M series PMICs, such as the S2MU005. It has
> >> +	  a LED channel dedicated for every physical LED. The LEDs can
> >> +	  be controlled in flash and torch modes.
> >> +
> >>  config LEDS_SGM3140
> >>  	tristate "LED support for the SGM3140"
> >>  	depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
> >> diff --git a/drivers/leds/flash/Makefile b/drivers/leds/flash/Makefile
> >> index 712fb737a428e..44e6c1b4beb37 100644
> >> --- a/drivers/leds/flash/Makefile
> >> +++ b/drivers/leds/flash/Makefile
> >> @@ -10,6 +10,7 @@ obj-$(CONFIG_LEDS_MAX77693)	+= leds-max77693.o
> >>  obj-$(CONFIG_LEDS_QCOM_FLASH)	+= leds-qcom-flash.o
> >>  obj-$(CONFIG_LEDS_RT4505)	+= leds-rt4505.o
> >>  obj-$(CONFIG_LEDS_RT8515)	+= leds-rt8515.o
> >> +obj-$(CONFIG_LEDS_S2M_FLASH)	+= leds-s2m-flash.o
> >>  obj-$(CONFIG_LEDS_SGM3140)	+= leds-sgm3140.o
> >>  obj-$(CONFIG_LEDS_SY7802)	+= leds-sy7802.o
> >>  obj-$(CONFIG_LEDS_TPS6131X)	+= leds-tps6131x.o

[...]

> >> +static int s2mu005_fled_torch_brightness_set(struct led_classdev *cdev,
> >> +					     enum led_brightness value)
> >> +{
> >> +	struct s2m_fled *priv = to_led_priv(to_cdev_flash(cdev));
> >> +	struct regmap *regmap = priv->regmap;
> >> +	int ret;
> >> +
> >> +	mutex_lock(&priv->lock);
> >> +
> >> +	if (value == LED_OFF) {
> >
> > These defines are deprecated.
> >
> > From include/linux/leds.h:
> >
> > /* This is obsolete/useless. We now support variable maximum brightness. */
> > enum led_brightness {
> >         LED_OFF         = 0,
> >         LED_ON          = 1,
> >         LED_HALF        = 127,
> >         LED_FULL        = 255,
> > };
> >
> 
> Let me know what am I supposed to use then. The
> brightness_set_blocking() function is defined as such:
> 
> 	int (*brightness_set_blocking)(struct led_classdev *led_cdev,
> 				       enum led_brightness brightness);
> 
> Which has enum led_brightness as one of its params.
> 
> Do I just ignore the 'obsolete' param for now and replace ` == LED_OFF`
> with a logical NOT?

I'm pretty sure most places just treat this as a u8 these days.

-- 
Lee Jones [李琼斯]

^ permalink raw reply

* [PATCH v2 5/5] regulator: sc2731: Add platform_device_id table
From: Otto Pflüger @ 2026-03-25 13:53 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger
In-Reply-To: <20260325-sc27xx-mfd-cells-v2-0-d0ebb60aa4a7@abscue.de>

Make the regulator driver for the SC2731 PMIC probe automatically. Using
a platform_device_id table instead of DT compatible matching avoids the
need for a separate compatible property in the "regulators" node, which
simplifies the DT bindings and makes the parent MFD device responsible
for selecting the correct regulator driver for the PMIC.

However, this means that the regulator device is not automatically
associated with the "regulators" node. Tell the regulator core to
perform device tree lookups using the parent MFD device instead of
the regulator sub-device and set the .regulators_node member in all
regulator definitions so that the "regulators" sub-node is used.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
 drivers/regulator/sc2731-regulator.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/sc2731-regulator.c b/drivers/regulator/sc2731-regulator.c
index 5447e1a47d15..93c8156c5110 100644
--- a/drivers/regulator/sc2731-regulator.c
+++ b/drivers/regulator/sc2731-regulator.c
@@ -131,6 +131,7 @@ static const struct regulator_ops sc2731_regu_linear_ops = {
 			  vstep, vmin, vmax) {			\
 	.name			= #_id,				\
 	.of_match		= of_match_ptr(#_id),		\
+	.regulators_node	= of_match_ptr("regulators"),	\
 	.ops			= &sc2731_regu_linear_ops,	\
 	.type			= REGULATOR_VOLTAGE,		\
 	.id			= SC2731_##_id,			\
@@ -226,7 +227,7 @@ static int sc2731_regulator_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	config.dev = &pdev->dev;
+	config.dev = pdev->dev.parent;
 	config.regmap = regmap;
 
 	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
@@ -242,12 +243,19 @@ static int sc2731_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct platform_device_id sc2731_regulator_id_table[] = {
+	{ "sc2731-regulator" },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, sc2731_regulator_id_table);
+
 static struct platform_driver sc2731_regulator_driver = {
 	.driver = {
 		.name = "sc27xx-regulator",
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 	.probe = sc2731_regulator_probe,
+	.id_table = sc2731_regulator_id_table,
 };
 
 module_platform_driver(sc2731_regulator_driver);

-- 
2.51.0


^ permalink raw reply related

* [PATCH v2 4/5] power: reset: sc27xx: Add platform_device_id table
From: Otto Pflüger @ 2026-03-25 13:53 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger, Sebastian Reichel
In-Reply-To: <20260325-sc27xx-mfd-cells-v2-0-d0ebb60aa4a7@abscue.de>

Make the poweroff driver for SC27xx-series PMICs probe automatically.
Since the device representing the poweroff functionality of the SC27xx
PMIC is not supposed to have a dedicated device tree node without any
corresponding DT resources [1], an of_device_id table cannot be used
here. Instead, use a platform_device_id table to match the poweroff
sub-device instantiated by the parent MFD driver.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>

[1]: https://lore.kernel.org/all/20251002025344.GA2958334-robh@kernel.org/

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/power/reset/sc27xx-poweroff.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/power/reset/sc27xx-poweroff.c b/drivers/power/reset/sc27xx-poweroff.c
index 393bd1c33b73..6376706bf561 100644
--- a/drivers/power/reset/sc27xx-poweroff.c
+++ b/drivers/power/reset/sc27xx-poweroff.c
@@ -6,6 +6,7 @@
 
 #include <linux/cpu.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
@@ -70,11 +71,18 @@ static int sc27xx_poweroff_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct platform_device_id sc27xx_poweroff_id_table[] = {
+	{ "sc2731-poweroff" },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, sc27xx_poweroff_id_table);
+
 static struct platform_driver sc27xx_poweroff_driver = {
 	.probe = sc27xx_poweroff_probe,
 	.driver = {
 		.name = "sc27xx-poweroff",
 	},
+	.id_table = sc27xx_poweroff_id_table,
 };
 module_platform_driver(sc27xx_poweroff_driver);
 

-- 
2.51.0


^ permalink raw reply related

* [PATCH v2 2/5] regulator: dt-bindings: sc2731: Deprecate compatible property
From: Otto Pflüger @ 2026-03-25 13:53 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger
In-Reply-To: <20260325-sc27xx-mfd-cells-v2-0-d0ebb60aa4a7@abscue.de>

The node containing the regulators is always a child of the main PMIC
node, which already has a compatible property identifying the type of
PMIC. This makes the compatible in the child node redundant. Mark it
as deprecated and remove it from the required property list and the
examples.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
 Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml                | 2 --
 .../devicetree/bindings/regulator/sprd,sc2731-regulator.yaml          | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml b/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml
index b023e1ef8d3c..12b3258daef5 100644
--- a/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml
+++ b/Documentation/devicetree/bindings/mfd/sprd,sc2731.yaml
@@ -222,8 +222,6 @@ examples:
         };
 
         regulators {
-          compatible = "sprd,sc2731-regulator";
-
           BUCK_CPU0 {
             regulator-name = "vddarm0";
             regulator-min-microvolt = <400000>;
diff --git a/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml b/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml
index 9bd752bab68e..7af20a4781b7 100644
--- a/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/sprd,sc2731-regulator.yaml
@@ -26,6 +26,7 @@ description: |
 
 properties:
   compatible:
+    deprecated: true
     const: sprd,sc2731-regulator
 
 patternProperties:
@@ -39,8 +40,5 @@ patternProperties:
     $ref: regulator.yaml#
     unevaluatedProperties: false
 
-required:
-  - compatible
-
 additionalProperties: false
 ...

-- 
2.51.0


^ permalink raw reply related

* [PATCH v2 3/5] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
From: Otto Pflüger @ 2026-03-25 13:53 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger
In-Reply-To: <20260325-sc27xx-mfd-cells-v2-0-d0ebb60aa4a7@abscue.de>

To allow instantiating subdevices such as the regulator and poweroff
devices that do not have corresponding device tree nodes with a
"compatible" property, use devm_mfd_add_devices() with MFD cells instead
of devm_of_platform_populate(). Since different PMICs in the SC27xx
series contain different components, use separate MFD cell tables for
each PMIC model. Define cells for all components that have upstream
drivers at this point.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
 drivers/mfd/sprd-sc27xx-spi.c | 62 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 53 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
index d6b4350779e6..eb57023fdc3c 100644
--- a/drivers/mfd/sprd-sc27xx-spi.c
+++ b/drivers/mfd/sprd-sc27xx-spi.c
@@ -14,6 +14,11 @@
 #include <linux/spi/spi.h>
 #include <uapi/linux/usb/charger.h>
 
+enum sprd_pmic_type {
+	PMIC_TYPE_SC2730,
+	PMIC_TYPE_SC2731,
+};
+
 #define SPRD_PMIC_INT_MASK_STATUS	0x0
 #define SPRD_PMIC_INT_RAW_STATUS	0x4
 #define SPRD_PMIC_INT_EN		0x8
@@ -50,6 +55,29 @@ struct sprd_pmic_data {
 	u32 charger_det;
 };
 
+static const struct mfd_cell sc2730_devices[] = {
+	MFD_CELL_OF("sc2730-adc", NULL, NULL, 0, 0, "sprd,sc2730-adc"),
+	MFD_CELL_OF("sc2730-bltc", NULL, NULL, 0, 0, "sprd,sc2730-bltc"),
+	MFD_CELL_OF("sc2730-efuse", NULL, NULL, 0, 0, "sprd,sc2730-efuse"),
+	MFD_CELL_OF("sc2730-eic", NULL, NULL, 0, 0, "sprd,sc2730-eic"),
+	MFD_CELL_OF("sc2730-fgu", NULL, NULL, 0, 0, "sprd,sc2730-fgu"),
+	MFD_CELL_OF("sc2730-rtc", NULL, NULL, 0, 0, "sprd,sc2730-rtc"),
+	MFD_CELL_OF("sc2730-vibrator", NULL, NULL, 0, 0, "sprd,sc2730-vibrator"),
+};
+
+static const struct mfd_cell sc2731_devices[] = {
+	MFD_CELL_OF("sc2731-adc", NULL, NULL, 0, 0, "sprd,sc2731-adc"),
+	MFD_CELL_OF("sc2731-bltc", NULL, NULL, 0, 0, "sprd,sc2731-bltc"),
+	MFD_CELL_OF("sc2731-charger", NULL, NULL, 0, 0, "sprd,sc2731-charger"),
+	MFD_CELL_OF("sc2731-efuse", NULL, NULL, 0, 0, "sprd,sc2731-efuse"),
+	MFD_CELL_OF("sc2731-eic", NULL, NULL, 0, 0, "sprd,sc2731-eic"),
+	MFD_CELL_OF("sc2731-fgu", NULL, NULL, 0, 0, "sprd,sc2731-fgu"),
+	MFD_CELL_NAME("sc2731-poweroff"),
+	MFD_CELL_NAME("sc2731-regulator"),
+	MFD_CELL_OF("sc2731-rtc", NULL, NULL, 0, 0, "sprd,sc2731-rtc"),
+	MFD_CELL_OF("sc2731-vibrator", NULL, NULL, 0, 0, "sprd,sc2731-vibrator"),
+};
+
 /*
  * Since different PMICs of SC27xx series can have different interrupt
  * base address and irq number, we should save irq number and irq base
@@ -152,12 +180,26 @@ static const struct regmap_config sprd_pmic_config = {
 static int sprd_pmic_probe(struct spi_device *spi)
 {
 	struct sprd_pmic *ddata;
+	enum sprd_pmic_type pmic_type;
 	const struct sprd_pmic_data *pdata;
-	int ret, i;
+	const struct mfd_cell *cells;
+	int ret, i, num_cells;
+
+	pmic_type = (enum sprd_pmic_type)of_device_get_match_data(&spi->dev);
 
-	pdata = of_device_get_match_data(&spi->dev);
-	if (!pdata) {
-		dev_err(&spi->dev, "No matching driver data found\n");
+	switch (pmic_type) {
+	case PMIC_TYPE_SC2730:
+		pdata = &sc2730_data;
+		cells = sc2730_devices;
+		num_cells = ARRAY_SIZE(sc2730_devices);
+		break;
+	case PMIC_TYPE_SC2731:
+		pdata = &sc2731_data;
+		cells = sc2731_devices;
+		num_cells = ARRAY_SIZE(sc2731_devices);
+		break;
+	default:
+		dev_err(&spi->dev, "Invalid device ID\n");
 		return -EINVAL;
 	}
 
@@ -204,7 +246,9 @@ static int sprd_pmic_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	ret = devm_of_platform_populate(&spi->dev);
+	ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_AUTO,
+				   cells, num_cells, NULL, 0,
+				   regmap_irq_get_domain(ddata->irq_data));
 	if (ret) {
 		dev_err(&spi->dev, "Failed to populate sub-devices %d\n", ret);
 		return ret;
@@ -241,15 +285,15 @@ static DEFINE_SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops,
 				sprd_pmic_suspend, sprd_pmic_resume);
 
 static const struct of_device_id sprd_pmic_match[] = {
-	{ .compatible = "sprd,sc2730", .data = &sc2730_data },
-	{ .compatible = "sprd,sc2731", .data = &sc2731_data },
+	{ .compatible = "sprd,sc2730", .data = (void *)PMIC_TYPE_SC2730 },
+	{ .compatible = "sprd,sc2731", .data = (void *)PMIC_TYPE_SC2731 },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sprd_pmic_match);
 
 static const struct spi_device_id sprd_pmic_spi_ids[] = {
-	{ .name = "sc2730", .driver_data = (unsigned long)&sc2730_data },
-	{ .name = "sc2731", .driver_data = (unsigned long)&sc2731_data },
+	{ .name = "sc2730", .driver_data = PMIC_TYPE_SC2730 },
+	{ .name = "sc2731", .driver_data = PMIC_TYPE_SC2731 },
 	{},
 };
 MODULE_DEVICE_TABLE(spi, sprd_pmic_spi_ids);

-- 
2.51.0


^ permalink raw reply related

* [PATCH v2 0/5] mfd: sc27xx: Use MFD cells and devm_mfd_add_devices()
From: Otto Pflüger @ 2026-03-25 13:53 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger, Sebastian Reichel

These changes resulted from the need to decouple the the Linux device
driver hierarchy from the device tree bindings for two different series
introducing regulator [1] and poweroff [2] support for the SC2730 PMIC.

There are different PMICs in the SC27xx series, including SC2730 and
SC2731. These have a lot of similarities, but some differences too. For
instance, they contain compatible RTC blocks, but completely different
sets of regulators.

On the Linux side, each PMIC block needs its own driver. The MFD driver
currently uses devm_of_platform_populate() to load the drivers for the
components of the PMIC, which only works when each component has its own
sub-node with a "compatible" property that is used to select a driver
for the device.

When viewed from the device tree side, the parent node representing the
PMIC already contains a "compatible" property that distinguishes the
different PMICs. While the device tree bindings currently do require a
separate "compatible" property for each sub-node (ADC, fuel gauge,
regulators, ...), this is essentially redundant since the node name and
the parent compatible uniquely identify the component. Moreover, some
parts of the PMIC such as the poweroff/reboot controller do not even
need a corresponding device tree node.

Change the MFD driver to use MFD cells instead, which allows it to
instantiate sub-devices both with and without device tree nodes.
Devices that do not have a separate device tree node with its own
"compatible" property can be matched by their platform device ID.
Use this to hook up the existing SC2731 poweroff and regulator drivers,
which were previously not loaded at all due to the lack of an ID table.

In the device tree bindings, deprecate the redundant "compatible"
property for the "regulators" node. While it might make sense to do this
for the other components too, there are a few reasons to only change the
regulators at this point:
 - The regulators node is special since it is not as independent as the
   other components. For instance, it is the only child node of the PMIC
   that does not have a "reg" property. The set of regulators also
   differs much more between different PMIC models than the register
   layout of the other components.
 - We already have some other PMICs where only the regulators are
   treated specially like this, such as MediaTek MT6359 and MT6370.
 - It was suggested to remove the "compatible" property for the new
   SC2730 regulator bindings I am preparing in [2]. The bindings for
   the other components do not need any significant changes at the
   moment.
 - Unlike the poweroff and regulator components, the other parts are
   already working with the existing drivers and bindings.

For the other components that still have a "compatible" property used
for matching MFD cells, ensure that an SC2730-specific compatible is
defined in the bindings so that it can be listed in the SC2730-specific
device table in the MFD driver.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>

[1]: https://lore.kernel.org/all/20250926-sc2730-reboot-v1-0-62ebfd3d31bb@abscue.de/
[2]: https://lore.kernel.org/all/20260220-sc2730-regulators-v1-0-3f2bbc9ecf14@abscue.de/

---
Changes in v2:
- Changed PMIC type matching in MFD driver to use an identifier like
  other drivers instead of passing pointers through of_device_id.
- Rebased on next-20260324.
- Link to v1: https://lore.kernel.org/r/20260222-sc27xx-mfd-cells-v1-0-69526fe74c77@abscue.de

---
Otto Pflüger (5):
      dt-bindings: rtc: sc2731: Add compatible for SC2730
      regulator: dt-bindings: sc2731: Deprecate compatible property
      mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
      power: reset: sc27xx: Add platform_device_id table
      regulator: sc2731: Add platform_device_id table

 .../devicetree/bindings/mfd/sprd,sc2731.yaml       |  2 -
 .../bindings/regulator/sprd,sc2731-regulator.yaml  |  4 +-
 .../devicetree/bindings/rtc/sprd,sc2731-rtc.yaml   |  7 ++-
 drivers/mfd/sprd-sc27xx-spi.c                      | 62 ++++++++++++++++++----
 drivers/power/reset/sc27xx-poweroff.c              |  8 +++
 drivers/regulator/sc2731-regulator.c               | 10 +++-
 6 files changed, 77 insertions(+), 16 deletions(-)
---
base-commit: 85964cdcad0fac9a0eb7b87a0f9d88cc074b854c
change-id: 20260221-sc27xx-mfd-cells-dab7905f3aae

Best regards,
-- 
Otto Pflüger <otto.pflueger@abscue.de>


^ permalink raw reply

* [PATCH v2 1/5] dt-bindings: rtc: sc2731: Add compatible for SC2730
From: Otto Pflüger @ 2026-03-25 13:53 UTC (permalink / raw)
  To: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Lee Jones, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel
  Cc: linux-rtc, devicetree, linux-kernel, linux-leds, linux-pm,
	Otto Pflüger
In-Reply-To: <20260325-sc27xx-mfd-cells-v2-0-d0ebb60aa4a7@abscue.de>

The RTC block found in the SC2730 PMIC is compatible with the one found
in the SC2731 PMIC.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
 Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml b/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
index 5756f617df36..1deae2f4f09d 100644
--- a/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/sprd,sc2731-rtc.yaml
@@ -13,7 +13,12 @@ maintainers:
 
 properties:
   compatible:
-    const: sprd,sc2731-rtc
+    oneOf:
+      - items:
+          - enum:
+              - sprd,sc2730-rtc
+          - const: sprd,sc2731-rtc
+      - const: sprd,sc2731-rtc
 
   reg:
     maxItems: 1

-- 
2.51.0


^ permalink raw reply related

* Re: [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
From: Lee Jones @ 2026-03-25 11:22 UTC (permalink / raw)
  To: Otto Pflüger
  Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel, linux-rtc,
	devicetree, linux-kernel, linux-leds, linux-pm
In-Reply-To: <ab2i6i2D5q0t0xZ5@abscue.de>

> Could you clarify what should be changed?

Sure.

> On Mon, Mar 09, 2026 at 06:58:56PM +0000, Lee Jones wrote:
> > On Sun, 22 Feb 2026, Otto Pflüger wrote:
> > 
> > > To allow instantiating subdevices such as the regulator and poweroff
> > > devices that do not have corresponding device tree nodes with a
> > > "compatible" property, use devm_mfd_add_devices() with MFD cells instead
> > > of devm_of_platform_populate(). Since different PMICs in the SC27xx
> > > series contain different components, use separate MFD cell tables for
> > > each PMIC model. Define cells for all components that have upstream
> > > drivers at this point.
> > 
> > We're not passing one device registration API's data (MFD)
> > through another (Device Tree).
> > 
> > Pass an identifier through and match on that instead.
> > 
> > Look at how all of the other drivers in MFD do it.
> >
> > [...]
> > > +static const struct mfd_cell sc2730_devices[] = {
> > > +	MFD_CELL_OF("sc2730-adc", NULL, NULL, 0, 0, "sprd,sc2730-adc"),
> > > +	MFD_CELL_OF("sc2730-bltc", NULL, NULL, 0, 0, "sprd,sc2730-bltc"),
> > > +	MFD_CELL_OF("sc2730-efuse", NULL, NULL, 0, 0, "sprd,sc2730-efuse"),
> > > +	MFD_CELL_OF("sc2730-eic", NULL, NULL, 0, 0, "sprd,sc2730-eic"),
> > > +	MFD_CELL_OF("sc2730-fgu", NULL, NULL, 0, 0, "sprd,sc2730-fgu"),
> > > +	MFD_CELL_OF("sc2730-rtc", NULL, NULL, 0, 0, "sprd,sc2730-rtc"),
> > > +	MFD_CELL_OF("sc2730-vibrator", NULL, NULL, 0, 0, "sprd,sc2730-vibrator"),
> > > +};
> > > +
> > > +static const struct mfd_cell sc2731_devices[] = {
> > > +	MFD_CELL_OF("sc2731-adc", NULL, NULL, 0, 0, "sprd,sc2731-adc"),
> > > +	MFD_CELL_OF("sc2731-bltc", NULL, NULL, 0, 0, "sprd,sc2731-bltc"),
> > > +	MFD_CELL_OF("sc2731-charger", NULL, NULL, 0, 0, "sprd,sc2731-charger"),
> > > +	MFD_CELL_OF("sc2731-efuse", NULL, NULL, 0, 0, "sprd,sc2731-efuse"),
> > > +	MFD_CELL_OF("sc2731-eic", NULL, NULL, 0, 0, "sprd,sc2731-eic"),
> > > +	MFD_CELL_OF("sc2731-fgu", NULL, NULL, 0, 0, "sprd,sc2731-fgu"),
> > > +	MFD_CELL_NAME("sc2731-poweroff"),
> > > +	MFD_CELL_NAME("sc2731-regulator"),
> > > +	MFD_CELL_OF("sc2731-rtc", NULL, NULL, 0, 0, "sprd,sc2731-rtc"),
> > > +	MFD_CELL_OF("sc2731-vibrator", NULL, NULL, 0, 0, "sprd,sc2731-vibrator"),
> > >  };
> 
> Assuming that these tables are the "registration API's data", I don't
> see where it is being passed through the device tree. The device tree
> contains nodes for some of these MFD components, and I've listed their
> compatibles here so that the MFD core finds these nodes and registers
> them with the corresponding devices (which was previously done
> automatically by devm_of_platform_populate).
> 
> > >  
> > >  /*
> > > @@ -59,12 +84,16 @@ static const struct sprd_pmic_data sc2730_data = {
> > >  	.irq_base = SPRD_SC2730_IRQ_BASE,
> > >  	.num_irqs = SPRD_SC2730_IRQ_NUMS,
> > >  	.charger_det = SPRD_SC2730_CHG_DET,
> > > +	.cells = sc2730_devices,
> > > +	.num_cells = ARRAY_SIZE(sc2730_devices),

Remove these from here.

Either replace them with an ID that you can match on or stop passing
'sc2730_data' through .data and pass an ID through there instead.  Then
choose 'sc2730_data' and 'sc2730_devices' in an switch() statement
instead, just like the vast majority of existing MFD drivers do.

> > >  };
> > >  
> > >  static const struct sprd_pmic_data sc2731_data = {
> > >  	.irq_base = SPRD_SC2731_IRQ_BASE,
> > >  	.num_irqs = SPRD_SC2731_IRQ_NUMS,
> > >  	.charger_det = SPRD_SC2731_CHG_DET,
> > > +	.cells = sc2731_devices,
> > > +	.num_cells = ARRAY_SIZE(sc2731_devices),
> > >  };
> 
> Here I am simply referencing the tables above in the device-specific
> MFD data. These structs containing device-specific data already exist,
> they are private to the MFD driver, and I wouldn't consider them part
> of the device tree.
> 
> I've looked at mt6397-core.c and it seems to be doing the exact same
> thing with its "struct chip_data".

That was a momentary oversight.  It's also passing a driver-level
call-back which I despise.  However, past mistakes are not good
justifications for new ones.

> Some other drivers use a numeric ID
> for this purpose, but how would that be different from a pointer as long
> as it identifies the same data within the MFD driver?

The point is that sc2731_data->cells would be passed through the Device
Tree's .data attribute, which is not allowed.

-- 
Lee Jones [李琼斯]

^ permalink raw reply

* [PATCH v2] dt-bindings: rtc: add olpc,xo1-rtc to trivial-rtc
From: Anushka Badhe @ 2026-03-25  9:30 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: anushkabadhe, conor+dt, devicetree, dsd, krzk+dt, linux-kernel,
	linux-rtc, robh
In-Reply-To: <202603250854523a8809af@mail.local>

Add the OLPC XO-1 RTC compatible string to the trivial-rtc schema
instead of creating a standalone binding file, as it only requires
a compatible property with no additional configuration.

Signed-off-by: Anushka Badhe <anushkabadhe@gmail.com>
---

Changes in v2:
- Move binding to trivial-rtc.yaml instead of separate file

Note:
* This patch is part of the GSoC2026 application process for device tree 
bindings conversions
* https://github.com/LinuxFoundationGSoC/ProjectIdeas/wiki/GSoC-2026-Device-Tree-Bindings

 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt | 5 -----
 Documentation/devicetree/bindings/rtc/trivial-rtc.yaml | 2 ++
 2 files changed, 2 insertions(+), 5 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt

diff --git a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
deleted file mode 100644
index a2891ceb6344..000000000000
--- a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-OLPC XO-1 RTC
-~~~~~~~~~~~~~
-
-Required properties:
- - compatible : "olpc,xo1-rtc"
diff --git a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
index b47822370d6f..722176c831aa 100644
--- a/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
+++ b/Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
@@ -65,6 +65,8 @@ properties:
       - microcrystal,rv3029
       # Real Time Clock
       - microcrystal,rv8523
+      # OLPC XO-1 RTC
+      - olpc,xo1-rtc
       # I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
       - ricoh,r2025sd
       # I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
-- 
2.43.0


^ permalink raw reply related

* Re: [PATCH] dt-bindings: rtc: Convert olpc,xo1-rtc to DT schema
From: Alexandre Belloni @ 2026-03-25  8:54 UTC (permalink / raw)
  To: Anushka Badhe
  Cc: robh, krzk+dt, conor+dt, dsd, linux-rtc, devicetree, linux-kernel
In-Reply-To: <20260325084708.40629-1-anushkabadhe@gmail.com>

On 25/03/2026 14:17:08+0530, Anushka Badhe wrote:
> Convert the OLPC XO-1 RTC device tree binding to DT schema format.
> 
> Signed-off-by: Anushka Badhe <anushkabadhe@gmail.com>
> ---
> 
> Note:
> * This patch is part of the GSoC2026 application process for device tree 
> bindings conversions
> * https://github.com/LinuxFoundationGSoC/ProjectIdeas/wiki/GSoC-2026-Device-Tree-Bindings
> 
>  .../devicetree/bindings/rtc/olpc-xo1-rtc.txt  |  5 ----
>  .../devicetree/bindings/rtc/olpc-xo1-rtc.yaml | 26 +++++++++++++++++++
>  2 files changed, 26 insertions(+), 5 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
>  create mode 100644 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml
> 
> diff --git a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> deleted file mode 100644
> index a2891ceb6344..000000000000
> --- a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -OLPC XO-1 RTC
> -~~~~~~~~~~~~~
> -
> -Required properties:
> - - compatible : "olpc,xo1-rtc"


I guess this should be move to trivial-rtc

> diff --git a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml
> new file mode 100644
> index 000000000000..a5f029a4de92
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml
> @@ -0,0 +1,26 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rtc/olpc-xo1-rtc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: OLPC XO-1 RTC
> +
> +maintainers:
> +  - Alexandre Belloni <alexandre.belloni@bootlin.com>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - olpc,xo1-rtc
> +
> +required:
> +  - compatible
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    rtc {
> +       compatible = "olpc,xo1-rtc";
> +    };
> -- 
> 2.43.0
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply

* [PATCH] dt-bindings: rtc: Convert olpc,xo1-rtc to DT schema
From: Anushka Badhe @ 2026-03-25  8:47 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: robh, krzk+dt, conor+dt, dsd, linux-rtc, devicetree, linux-kernel,
	Anushka Badhe

Convert the OLPC XO-1 RTC device tree binding to DT schema format.

Signed-off-by: Anushka Badhe <anushkabadhe@gmail.com>
---

Note:
* This patch is part of the GSoC2026 application process for device tree 
bindings conversions
* https://github.com/LinuxFoundationGSoC/ProjectIdeas/wiki/GSoC-2026-Device-Tree-Bindings

 .../devicetree/bindings/rtc/olpc-xo1-rtc.txt  |  5 ----
 .../devicetree/bindings/rtc/olpc-xo1-rtc.yaml | 26 +++++++++++++++++++
 2 files changed, 26 insertions(+), 5 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
 create mode 100644 Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml

diff --git a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
deleted file mode 100644
index a2891ceb6344..000000000000
--- a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-OLPC XO-1 RTC
-~~~~~~~~~~~~~
-
-Required properties:
- - compatible : "olpc,xo1-rtc"
diff --git a/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml
new file mode 100644
index 000000000000..a5f029a4de92
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/olpc-xo1-rtc.yaml
@@ -0,0 +1,26 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rtc/olpc-xo1-rtc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: OLPC XO-1 RTC
+
+maintainers:
+  - Alexandre Belloni <alexandre.belloni@bootlin.com>
+
+properties:
+  compatible:
+    enum:
+      - olpc,xo1-rtc
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    rtc {
+       compatible = "olpc,xo1-rtc";
+    };
-- 
2.43.0


^ permalink raw reply related

* RE: [PATCH v4 1/5] dt-bindings: rtc: nxp,pcf85363: add timestamp mode config
From: Lakshay Piplani @ 2026-03-24 15:26 UTC (permalink / raw)
  To: alexandre.belloni@bootlin.com, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, devicetree@vger.kernel.org,
	wim@linux-watchdog.org, linux@roeck-us.net,
	linux-watchdog@vger.kernel.org
  Cc: Vikash Bansal, Priyanka Jain
In-Reply-To: <20251121121137.3043764-1-lakshay.piplani@nxp.com>

> +    #include <dt-bindings/rtc/pcf85363-tsr.h>
>      i2c {
>          #address-cells = <1>;
>          #size-cells = <0>;
> @@ -56,5 +75,7 @@ examples:
>              reg = <0x51>;
>              #clock-cells = <0>;
>              quartz-load-femtofarads = <12500>;
> +            wakeup-source;
> +            nxp,timestamp-mode = <PCF85363_TSR1_FE PCF85363_TSR2_LB
> + PCF85363_TSR3_LV>;
>          };
>      };
> diff --git a/include/dt-bindings/rtc/pcf85363-tsr.h b/include/dt-
> bindings/rtc/pcf85363-tsr.h
> new file mode 100644
> index 000000000000..1fb5b9b3601e
> --- /dev/null
> +++ b/include/dt-bindings/rtc/pcf85363-tsr.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */
> +/*
> + * Copyright 2025 NXP
> + */
> +
> +#ifndef _DT_BINDINGS_RTC_PCF85363_TSR_H #define
> +_DT_BINDINGS_RTC_PCF85363_TSR_H
> +
> +/* TSR1 modes */
> +#define PCF85363_TSR1_NONE 0x00
> +#define PCF85363_TSR1_FE 0x01
> +#define PCF85363_TSR1_LE 0x02
> +
> +/* TSR2 modes */
> +#define PCF85363_TSR2_NONE 0x00
> +#define PCF85363_TSR2_FB 0x01
> +#define PCF85363_TSR2_LB 0x02
> +#define PCF85363_TSR2_LV 0x03
> +#define PCF85363_TSR2_FE 0x04
> +#define PCF85363_TSR2_LE 0x05
> +
> +/* TSR3 modes */
> +#define PCF85363_TSR3_NONE 0x00
> +#define PCF85363_TSR3_FB 0x01
> +#define PCF85363_TSR3_LB 0x02
> +#define PCF85363_TSR3_LV 0x03
> +
> +#endif /* _DT_BINDINGS_RTC_PCF85363_TSR_H */
> --
> 2.25.1


Hi,

This is a gentle reminder regarding the patches I submitted in November. 
I haven't seen any review feedback yet, so I'd appreciate it if you could take a 
look whenever time permits.

Best regards,
Lakshay

^ permalink raw reply

* RE: [PATCH v7 1/2] dt-bindings: rtc: Add pcf85053 support
From: Lakshay Piplani @ 2026-03-24 15:21 UTC (permalink / raw)
  To: alexandre.belloni@bootlin.com, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, devicetree@vger.kernel.org, Conor Dooley
  Cc: Vikash Bansal, Priyanka Jain, Pankit Garg
In-Reply-To: <20251127120456.1849177-1-lakshay.piplani@nxp.com>

> +examples:
> +  # Single host example.
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    i2c {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      rtc@6f {
> +        compatible = "nxp,pcf85053";
> +        reg = <0x6f>;
> +        nxp,interface = "primary";
> +        nxp,write-access;
> +        interrupt-parent = <&gpio2>;
> +        interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
> +      };
> +    };
> +
> +  # Dual-host example: one primary that claims writes; one secondary that
> never claims writes.
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    i2c0 {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      rtc@6f {
> +        compatible = "nxp,pcf85053";
> +        reg = <0x6f>;
> +        nxp,interface = "primary";
> +        nxp,write-access;
> +        interrupt-parent = <&gpio2>;
> +        interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
> +      };
> +    };
> +
> +    i2c1 {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      rtc@6f {
> +        compatible = "nxp,pcf85053";
> +        reg = <0x6f>;
> +        nxp,interface = "secondary";
> +      };
> +    };
> --
> 2.25.1


Hi,

This is a gentle reminder regarding the patches I submitted in November. 
I haven't seen any review feedback yet, so I'd appreciate it if you could take a 
look whenever time permits.

Best regards,
Lakshay Piplani

^ permalink raw reply

* RE: [PATCH 01/15] dt-bindings: power: power-controller: Convert to yaml format
From: Peng Fan @ 2026-03-24  6:31 UTC (permalink / raw)
  To: Peng Fan (OSS), Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Rafael J. Wysocki, Ulf Hansson, Krzysztof Kozlowski,
	Romain Perier
  Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
In-Reply-To: <20260316-power-controller-v1-1-92c80e5e1744@nxp.com>

Hi Romain,

> Subject: [PATCH 01/15] dt-bindings: power: power-controller: Convert
> to yaml format

Not sure about you github ID, so ask here.

Are you ok for changing this to BSD-2.0 License?

https://github.com/devicetree-org/dt-schema/pull/187

Thanks,
Peng.

> 
> From: Peng Fan <peng.fan@nxp.com>
> 
> Convert power-controller.txt to yaml format. Drop the example
> because there is already one in regulator/active-semi,act8846.yaml.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  .../devicetree/bindings/power/power-controller.txt | 17 ------------
>  .../bindings/power/power-controller.yaml           | 30
> ++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 17 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/power-
> controller.txt b/Documentation/devicetree/bindings/power/power-
> controller.txt
> deleted file mode 100644
> index
> e45affea80781292316c75ed387ba38402501c5b..0000000000000000
> 000000000000000000000000
> --- a/Documentation/devicetree/bindings/power/power-controller.txt
> +++ /dev/null
> @@ -1,17 +0,0 @@
> -* Generic system power control capability
> -
> -Power-management integrated circuits or miscellaneous hardware
> components are -sometimes able to control the system power. The
> device driver associated with these -components might need to define
> this capability, which tells the kernel that -it can be used to switch off
> the system. The corresponding device must have the -standard
> property "system-power-controller" in its device node. This property -
> marks the device as able to control the system power. In order to test if
> this -property is found programmatically, use the helper function -
> "of_device_is_system_power_controller" from of.h .
> -
> -Example:
> -
> -act8846: act8846@5 {
> -	 compatible = "active-semi,act8846";
> -	 system-power-controller;
> -}
> diff --git a/Documentation/devicetree/bindings/power/power-
> controller.yaml b/Documentation/devicetree/bindings/power/power-
> controller.yaml
> new file mode 100644
> index
> 0000000000000000000000000000000000000000..ff698365d778446
> c08ceeb5f3ef144d5e97d2f79
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/power-
> controller.yaml
> @@ -0,0 +1,30 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/power-controller.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Generic System Power Control Capability
> +
> +maintainers:
> +  - Rafael J. Wysocki <rafael@kernel.org>
> +  - Ulf Hansson <ulf.hansson@linaro.org>
> +
> +description: |
> +  Power-management integrated circuits or miscellaneous hardware
> +components
> +  are sometimes able to control the system power. The device driver
> +associated
> +  with these components might need to define this capability, which
> +tells the
> +  kernel that it can be used to switch off the system. The
> +corresponding device
> +  must have the standard property "system-power-controller" in its
> +device node. This
> +  property marks the device as able to control the system power.
> +
> +  In order to test if this property is found programmatically, use the
> + helper  function "of_device_is_system_power_controller" from of.h.
> +
> +properties:
> +  system-power-controller:
> +    type: boolean
> +    description:
> +      Indicates that this device can be used to control the system power.
> +
> +additionalProperties: true
> 
> --
> 2.37.1


^ permalink raw reply

* Re: (subset) [PATCH v3 0/2] Kontron i.MX8MP OSM Devicetree Fixups
From: Frank Li @ 2026-03-23 23:18 UTC (permalink / raw)
  To: Alexandre Belloni, Conor Dooley, devicetree, Frieder Schrempf,
	imx, Krzysztof Kozlowski, linux-arm-kernel, linux-kernel,
	linux-rtc, Rob Herring, Sascha Hauer, Shawn Guo, Frieder Schrempf
  Cc: Frank Li, Annette Kobou, Fabio Estevam, Pengutronix Kernel Team
In-Reply-To: <20260309085749.25747-1-frieder@fris.de>


On Mon, 09 Mar 2026 09:57:41 +0100, Frieder Schrempf wrote:
> From: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> This contains three fixes and one cosmetic change for
> the Kontron i.MX8MP OSM devices.
>
> Changes for v3:
> * Drop applied patches
> * Add missing bindings patch for RV3028 RTC
>
> [...]

Applied, thanks!

[2/2] arm64: dts: imx8mp-kontron: Fix boot order for PMIC and RTC
      commit: 0f02852af55591d6a8609347890cc348f86fdac9

Update commit messsage, adjust wrap at 75 char. Change "this fixes" to
avoid.  Remove "We can ..."

Best regards,
--
Frank Li <Frank.Li@nxp.com>

^ permalink raw reply

* Re: [PATCH 4/6] mfd: sprd-sc27xx: Switch to devm_mfd_add_devices()
From: Otto Pflüger @ 2026-03-20 19:41 UTC (permalink / raw)
  To: Lee Jones
  Cc: Alexandre Belloni, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Pavel Machek,
	Liam Girdwood, Mark Brown, Sebastian Reichel, linux-rtc,
	devicetree, linux-kernel, linux-leds, linux-pm
In-Reply-To: <20260309185856.GZ183676@google.com>

On Mon, Mar 09, 2026 at 06:58:56PM +0000, Lee Jones wrote:
> On Sun, 22 Feb 2026, Otto Pflüger wrote:
> 
> > To allow instantiating subdevices such as the regulator and poweroff
> > devices that do not have corresponding device tree nodes with a
> > "compatible" property, use devm_mfd_add_devices() with MFD cells instead
> > of devm_of_platform_populate(). Since different PMICs in the SC27xx
> > series contain different components, use separate MFD cell tables for
> > each PMIC model. Define cells for all components that have upstream
> > drivers at this point.
> 
> We're not passing one device registration API's data (MFD)
> through another (Device Tree).
> 
> Pass an identifier through and match on that instead.
> 
> Look at how all of the other drivers in MFD do it.
>
> [...]
> > +static const struct mfd_cell sc2730_devices[] = {
> > +	MFD_CELL_OF("sc2730-adc", NULL, NULL, 0, 0, "sprd,sc2730-adc"),
> > +	MFD_CELL_OF("sc2730-bltc", NULL, NULL, 0, 0, "sprd,sc2730-bltc"),
> > +	MFD_CELL_OF("sc2730-efuse", NULL, NULL, 0, 0, "sprd,sc2730-efuse"),
> > +	MFD_CELL_OF("sc2730-eic", NULL, NULL, 0, 0, "sprd,sc2730-eic"),
> > +	MFD_CELL_OF("sc2730-fgu", NULL, NULL, 0, 0, "sprd,sc2730-fgu"),
> > +	MFD_CELL_OF("sc2730-rtc", NULL, NULL, 0, 0, "sprd,sc2730-rtc"),
> > +	MFD_CELL_OF("sc2730-vibrator", NULL, NULL, 0, 0, "sprd,sc2730-vibrator"),
> > +};
> > +
> > +static const struct mfd_cell sc2731_devices[] = {
> > +	MFD_CELL_OF("sc2731-adc", NULL, NULL, 0, 0, "sprd,sc2731-adc"),
> > +	MFD_CELL_OF("sc2731-bltc", NULL, NULL, 0, 0, "sprd,sc2731-bltc"),
> > +	MFD_CELL_OF("sc2731-charger", NULL, NULL, 0, 0, "sprd,sc2731-charger"),
> > +	MFD_CELL_OF("sc2731-efuse", NULL, NULL, 0, 0, "sprd,sc2731-efuse"),
> > +	MFD_CELL_OF("sc2731-eic", NULL, NULL, 0, 0, "sprd,sc2731-eic"),
> > +	MFD_CELL_OF("sc2731-fgu", NULL, NULL, 0, 0, "sprd,sc2731-fgu"),
> > +	MFD_CELL_NAME("sc2731-poweroff"),
> > +	MFD_CELL_NAME("sc2731-regulator"),
> > +	MFD_CELL_OF("sc2731-rtc", NULL, NULL, 0, 0, "sprd,sc2731-rtc"),
> > +	MFD_CELL_OF("sc2731-vibrator", NULL, NULL, 0, 0, "sprd,sc2731-vibrator"),
> >  };

Assuming that these tables are the "registration API's data", I don't
see where it is being passed through the device tree. The device tree
contains nodes for some of these MFD components, and I've listed their
compatibles here so that the MFD core finds these nodes and registers
them with the corresponding devices (which was previously done
automatically by devm_of_platform_populate).

> >  
> >  /*
> > @@ -59,12 +84,16 @@ static const struct sprd_pmic_data sc2730_data = {
> >  	.irq_base = SPRD_SC2730_IRQ_BASE,
> >  	.num_irqs = SPRD_SC2730_IRQ_NUMS,
> >  	.charger_det = SPRD_SC2730_CHG_DET,
> > +	.cells = sc2730_devices,
> > +	.num_cells = ARRAY_SIZE(sc2730_devices),
> >  };
> >  
> >  static const struct sprd_pmic_data sc2731_data = {
> >  	.irq_base = SPRD_SC2731_IRQ_BASE,
> >  	.num_irqs = SPRD_SC2731_IRQ_NUMS,
> >  	.charger_det = SPRD_SC2731_CHG_DET,
> > +	.cells = sc2731_devices,
> > +	.num_cells = ARRAY_SIZE(sc2731_devices),
> >  };

Here I am simply referencing the tables above in the device-specific
MFD data. These structs containing device-specific data already exist,
they are private to the MFD driver, and I wouldn't consider them part
of the device tree.

I've looked at mt6397-core.c and it seems to be doing the exact same
thing with its "struct chip_data". Some other drivers use a numeric ID
for this purpose, but how would that be different from a pointer as long
as it identifies the same data within the MFD driver?

Could you clarify what should be changed?

^ permalink raw reply

* Re: [PATCH v1 2/2] rtc: cmos: Do not require IRQ if ACPI alarm is used
From: Mario Limonciello (AMD) (kernel.org) @ 2026-03-20 19:27 UTC (permalink / raw)
  To: Alexandre Belloni, Rafael J. Wysocki; +Cc: linux-rtc, LKML, Linux ACPI
In-Reply-To: <20260320180031928c3da5@mail.local>



On 3/20/2026 1:00 PM, Alexandre Belloni wrote:
> On 14/03/2026 13:12:44+0100, Rafael J. Wysocki wrote:
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> If the ACPI RTC fixed event is used, a dedicated IRQ is not required
>> for the CMOS RTC alarm to work, so allow the driver to use the alarm
>> without a valid IRQ in that case.
>>
>> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

> 
>> ---
>>   drivers/rtc/rtc-cmos.c |   15 ++++++++++-----
>>   1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> --- a/drivers/rtc/rtc-cmos.c
>> +++ b/drivers/rtc/rtc-cmos.c
>> @@ -216,6 +216,11 @@ static inline void cmos_write_bank2(unsi
>>   
>>   /*----------------------------------------------------------------*/
>>   
>> +static bool cmos_no_alarm(struct cmos_rtc *cmos)
>> +{
>> +	return !is_valid_irq(cmos->irq) && !cmos_use_acpi_alarm();
>> +}
>> +
>>   static int cmos_read_time(struct device *dev, struct rtc_time *t)
>>   {
>>   	int ret;
>> @@ -287,7 +292,7 @@ static int cmos_read_alarm(struct device
>>   	};
>>   
>>   	/* This not only a rtc_op, but also called directly */
>> -	if (!is_valid_irq(cmos->irq))
>> +	if (cmos_no_alarm(cmos))
>>   		return -ETIMEDOUT;
>>   
>>   	/* Basic alarms only support hour, minute, and seconds fields.
>> @@ -520,7 +525,7 @@ static int cmos_set_alarm(struct device
>>   	int ret;
>>   
>>   	/* This not only a rtc_op, but also called directly */
>> -	if (!is_valid_irq(cmos->irq))
>> +	if (cmos_no_alarm(cmos))
>>   		return -EIO;
>>   
>>   	ret = cmos_validate_alarm(dev, t);
>> @@ -1096,7 +1101,7 @@ cmos_do_probe(struct device *dev, struct
>>   			dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq);
>>   			goto cleanup1;
>>   		}
>> -	} else {
>> +	} else if (!cmos_use_acpi_alarm()) {
>>   		clear_bit(RTC_FEATURE_ALARM, cmos_rtc.rtc->features);
>>   	}
>>   
>> @@ -1121,7 +1126,7 @@ cmos_do_probe(struct device *dev, struct
>>   		acpi_rtc_event_setup(dev);
>>   
>>   	dev_info(dev, "%s%s, %d bytes nvram%s\n",
>> -		 !is_valid_irq(rtc_irq) ? "no alarms" :
>> +		 cmos_no_alarm(&cmos_rtc) ? "no alarms" :
>>   		 cmos_rtc.mon_alrm ? "alarms up to one year" :
>>   		 cmos_rtc.day_alrm ? "alarms up to one month" :
>>   		 "alarms up to one day",
>> @@ -1147,7 +1152,7 @@ cleanup0:
>>   static void cmos_do_shutdown(int rtc_irq)
>>   {
>>   	spin_lock_irq(&rtc_lock);
>> -	if (is_valid_irq(rtc_irq))
>> +	if (!cmos_no_alarm(&cmos_rtc))
>>   		cmos_irq_disable(&cmos_rtc, RTC_IRQMASK);
>>   	spin_unlock_irq(&rtc_lock);
>>   }
>>
>>
>>
> 


^ permalink raw reply

* Re: [PATCH v1 1/2] rtc: cmos: Enable ACPI alarm if advertised in ACPI FADT
From: Mario Limonciello (AMD) (kernel.org) @ 2026-03-20 19:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, linux-rtc; +Cc: LKML, Linux ACPI, Alexandre Belloni
In-Reply-To: <9618535.CDJkKcVGEf@rafael.j.wysocki>



On 3/14/2026 7:11 AM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> If the ACPI_FADT_FIXED_RTC flag is unset, the platform is declaring that
> it supports the ACPI RTC fixed event which should be used instead of a
> dedicated CMOS RTC IRQ.  However, the driver only enables it when
> is_hpet_enabled() returns true, which is questionable because there is
> no clear connection between enabled HPET and signaling wakeup via the
> ACPI RTC fixed event (for instance, the latter can be expected to work
> on systems that don't include a functional HPET).
> 
> Moreover, since use_hpet_alarm() returns false if use_acpi_alarm is set,
> the ACPI RTC fixed event is effectively used instead of the HPET alarm
> if the latter is functional, but there is no particular reason why it
> could not be used otherwise.
> 
> Accordingly, on x86 systems with ACPI, set use_acpi_alarm if
> ACPI_FADT_FIXED_RTC is unset without looking at whether or not HPET is
> enabled.
> 
> Also, do the ACPI FADT check in use_acpi_alarm_quirks() before the DMI
> BIOS year checks which are more expensive and it's better to skip them
> if ACPI_FADT_FIXED_RTC is set.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

This makes sense to me.

Sorry for my delay, I kept on meaning to check a few machines and then 
more things came up and it fell lower.

I did check 3 generations of AMD machines and I don't expect any 
problems from this change.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

> ---
>   drivers/rtc/rtc-cmos.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -817,6 +817,9 @@ static void rtc_wake_off(struct device *
>   #ifdef CONFIG_X86
>   static void use_acpi_alarm_quirks(void)
>   {
> +	if (acpi_gbl_FADT.flags & ACPI_FADT_FIXED_RTC)
> +		return;
> +
>   	switch (boot_cpu_data.x86_vendor) {
>   	case X86_VENDOR_INTEL:
>   		if (dmi_get_bios_year() < 2015)
> @@ -830,8 +833,6 @@ static void use_acpi_alarm_quirks(void)
>   	default:
>   		return;
>   	}
> -	if (!is_hpet_enabled())
> -		return;
>   
>   	use_acpi_alarm = true;
>   }
> 
> 
> 


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox