RE: [PATCH v9 1/4] arm64: dts: renesas: r9a08g046: Enable TSU
From: Biju Das
Date: Thu Nov 26 2026 - 08:17:58 EST
Hi Geert,
> -----Original Message-----
> From: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> Sent: 26 November 2026 12:28
> Subject: Re: [PATCH v9 1/4] arm64: dts: renesas: r9a08g046: Enable TSU
>
> Hi Biju,
>
> On Thu, Nov 26, 2026, at 12:53, Biju Das wrote:
> >> From: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> On Wed, Nov 25,
> >> 2026, at 12:05, Biju Das wrote:
> >> > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> >> >
> >> > Add #cooling-cells to the CPU nodes, and describe the ADC1 (used
> >> > exclusively by the TSU) and TSU nodes along with a CPU thermal zone
> >> > using passive and critical trip points, with CPU frequency cooling
> >> > maps for thermal mitigation.
> >> >
> >> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> >>
> >> Thanks for your patch!
> >>
> >> > --- a/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
> >> > +++ b/arch/arm64/boot/dts/renesas/r9a08g046.dtsi
> >>
> >> > @@ -381,6 +385,37 @@ scif5: serial@1004e000 {
> >> > status = "disabled";
> >> > };
> >> >
> >> > + adc1: adc@108c0000 {
> >> > + compatible = "renesas,r9a08g046-adc1";
> >> > + reg = <0 0x108c0000 0 0x10000>;
> >> > + interrupts = <GIC_SPI 378 IRQ_TYPE_EDGE_RISING>;
> >> > + clocks = <&cpg CPG_MOD R9A08G046_ADC1_ADCLK>,
> >> > + <&cpg CPG_MOD R9A08G046_ADC1_PCLK>;
> >> > + clock-names = "adclk", "pclk";
> >> > + resets = <&cpg R9A08G046_ADC1_PRESETN>,
> >> > + <&cpg R9A08G046_ADC1_ADRST_N>;
> >> > + reset-names = "presetn", "adrst-n";
> >> > + power-domains = <&cpg>;
> >> > + #address-cells = <1>;
> >> > + #size-cells = <0>;
> >> > + #io-channel-cells = <1>;
> >> > +
> >> > + channel@8 {
> >> > + reg = <8>;
> >> > + };
> >> > + };
> >> > +
> >> > + tsu: thermal@108d0000 {
> >> > + compatible = "renesas,r9a08g046-tsu";
> >> > + reg = <0 0x108d0000 0 0x10000>;
> >> > + clocks = <&cpg CPG_MOD R9A08G046_TSU_PCLK>;
> >> > + resets = <&cpg R9A08G046_TSU_PRESETN>;
> >> > + power-domains = <&cpg>;
> >> > + #thermal-sensor-cells = <0>;
> >> > + io-channels = <&adc1 0>;
> >>
> >> <&adc1 8>
> >
> > With the above entries, I get below error as adc1 has a single channel
> >
> > https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/iio/inkern.c#
> > L135
> >
> > [ 15.067383] iio iio:device0: invalid channel index 8
>
> I am not surprised ;-)
>
> >> You cannot have "channel@8" in the ADC node and magically assume
> >> consumers should refer to this using
> >> "<&adc1 0>".
> >
> > ADC1 has single channel and HW manual says it is ADCR8(A/D conversion
> > result register 8) That is the reason for channel@8.
> >
> > You mean I should use channel@0 instead to avoid the above error as a
> > single channel registered by iio??
> > channel@0 {
> > reg = <8>;
> > }
>
> No, DT describes hardware, and the hardware manual says it is channel 8 (and FWIW, the "reg" property
> must match the unit address). If you want to deviate from this (I think you don't), you would need a
> DT bindings header file.
>
> >> I don't buy your rationale in [1]:
> >>
> >> "There is a mapping between internal Linux array index (0) and the actual hardware channel ID
> (8).
> >>
> >> See the code
> >> https://elixir.bootlin.com/linux/v7.3-rc3/source/drivers/iio/adc/rzg2l_adc.c#L354"
> >>
> >> This mapping is in the driver, and there is no mention of it in the DT bindings.
> >> This means the driver must be fixed first, too.
> >
> > OK. You mean I should add custom of_xlate in driver?
> >
> > Please let me know if you prefer adding .of_xlate to the ADC driver so
> > we can use <&adc1 8> in the DTS, or keeping <&adc1 0> with the default
> > simple xlate.
>
> Please add an .of_xlate() function, so (possibly sparse) hardware channel numbers are mapped properly
> to software channels.
OK will add .fwnode_xlate with
+static int rzg2l_adc_fwnode_xlate(struct iio_dev *indio_dev,
+ const struct fwnode_reference_args *iiospec)
+{
+ if (iiospec->nargs != 1)
+ return -EINVAL;
+
+ for (unsigned int i = 0; i < indio_dev->num_channels; i++)
+ if (indio_dev->channels[i].channel == iiospec->args[0])
+ return i;
+
+ return -EINVAL;
+}
Cheers,
Biju