mbox series

[0/4] ARM: Enable thermal support for Raspberry Pi 4

Message ID 1572615749-9524-1-git-send-email-wahrenst@gmx.net (mailing list archive)
Headers show
Series ARM: Enable thermal support for Raspberry Pi 4 | expand

Message

Stefan Wahren Nov. 1, 2019, 1:42 p.m. UTC
This series enables thermal support for the Raspberry Pi 4. Neither the
bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
So add a new thermal driver to read out the SoC temperature from the
AVS RO block of the BCM2711.

Stefan Wahren (4):
  dt-bindings: Add BCM2711 thermal
  thermal: Add BCM2711 thermal driver
  ARM: dts: bcm2711: Enable thermal
  ARM: configs: Build BCM2711 thermal as module

 .../bindings/thermal/brcm,bcm2711-thermal.txt      |  39 ++++++
 arch/arm/boot/dts/bcm2711.dtsi                     |   9 ++
 arch/arm/configs/multi_v7_defconfig                |   1 +
 arch/arm64/configs/defconfig                       |   1 +
 drivers/thermal/broadcom/Kconfig                   |   8 ++
 drivers/thermal/broadcom/Makefile                  |   1 +
 drivers/thermal/broadcom/bcm2711_thermal.c         | 146 +++++++++++++++++++++
 7 files changed, 205 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/brcm,bcm2711-thermal.txt
 create mode 100644 drivers/thermal/broadcom/bcm2711_thermal.c

--
2.7.4

Comments

Florian Fainelli Nov. 2, 2019, 8:08 p.m. UTC | #1
On 11/1/2019 6:42 AM, Stefan Wahren wrote:
> This series enables thermal support for the Raspberry Pi 4. Neither the
> bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
> So add a new thermal driver to read out the SoC temperature from the
> AVS RO block of the BCM2711.

It seems to me that with minor tweaks you could use the brcmstb_thermal
driver, since the two key differences are essentially:

- lack of interrupt, which is also the case on the latest STB SoCs
- different way to determine that data is valid, by checking both bit 16
and bit 10, as opposed to bit 11, and a reduced ADC code from 11 bits
down to 10.

This seems like a simple enough set of changes to build on top of this
patch series:

https://lore.kernel.org/linux-arm-kernel/20191030182132.25763-1-f.fainelli@gmail.com/

My concern is that we went down that road before with other drivers like
bcm2835-rng and bcm63xx-rng, when really there were little to no
differences other than some integrations bits (different clock,
compatible, and more important people having worked separately on those
things).

Your call, the patch series looks good to me otherwise:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Stefan Wahren Nov. 3, 2019, 8:43 a.m. UTC | #2
Hi Florian,

Am 02.11.19 um 21:08 schrieb Florian Fainelli:
> On 11/1/2019 6:42 AM, Stefan Wahren wrote:
>> This series enables thermal support for the Raspberry Pi 4. Neither the
>> bcm2835_thermal nor the brcmstb_thermal are suitable for the BCM2711.
>> So add a new thermal driver to read out the SoC temperature from the
>> AVS RO block of the BCM2711.
> It seems to me that with minor tweaks you could use the brcmstb_thermal
> driver, since the two key differences are essentially:
>
> - lack of interrupt, which is also the case on the latest STB SoCs
> - different way to determine that data is valid, by checking both bit 16
> and bit 10, as opposed to bit 11, and a reduced ADC code from 11 bits
> down to 10.
>
> This seems like a simple enough set of changes to build on top of this
> patch series:
>
> https://lore.kernel.org/linux-arm-kernel/20191030182132.25763-1-f.fainelli@gmail.com/
this was the downstream approach until i was informed that the thermal
part of the RO block is used. I don't have a good feeling about misusing
the wrong binding. I still hope that the RPI folks release some kind of
memory map for the BCM2711 and maybe extend this driver. So i prefer to
start with a separate binding.