* [PATCH v5 1/2] Documentation: leds: standardise keyboard backlight led names
From: Orlando Chamberlain @ 2023-02-20 11:52 UTC (permalink / raw)
To: linux-doc, linux-input
Cc: Jonathan Corbet, Jiri Kosina, Benjamin Tissoires, linux-kernel,
Pavel Machek, Aditya Garg, Aun-Ali Zaidi, Kerem Karabay,
Andy Shevchenko, Thomas Weißschuh, Orlando Chamberlain
In-Reply-To: <20230220115203.76154-1-orlandoch.dev@gmail.com>
Advice use of either "input*:*:kbd_backlight" or ":*:kbd_backlight". We
don't want people using vendor or product name (e.g. "smc", "apple",
"asus") as this information is available from sysfs anyway, and it made the
folder names inconsistent.
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
---
Documentation/leds/well-known-leds.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/leds/well-known-leds.txt b/Documentation/leds/well-known-leds.txt
index 2160382c86be..4e5429fce4d8 100644
--- a/Documentation/leds/well-known-leds.txt
+++ b/Documentation/leds/well-known-leds.txt
@@ -44,6 +44,14 @@ Legacy: "lp5523:kb{1,2,3,4,5,6}" (Nokia N900)
Frontlight/backlight of main keyboard.
+Good: ":*:kbd_backlight"
+Good: "input*:*:kbd_backlight"
+Legacy: "*:*:kbd_backlight"
+
+Many drivers have the vendor or product name as the first field of the led name,
+this makes names inconsistent and is redundant as that information is already in
+sysfs.
+
Legacy: "button-backlight" (Motorola Droid 4)
Some phones have touch buttons below screen; it is different from main
--
2.39.2
^ permalink raw reply related
* [PATCH v5 0/2] Apple Magic Keyboard Backlight
From: Orlando Chamberlain @ 2023-02-20 11:52 UTC (permalink / raw)
To: linux-doc, linux-input
Cc: Jonathan Corbet, Jiri Kosina, Benjamin Tissoires, linux-kernel,
Pavel Machek, Aditya Garg, Aun-Ali Zaidi, Kerem Karabay,
Andy Shevchenko, Thomas Weißschuh, Orlando Chamberlain
This patchseries adds support for the internal keyboard backlight of
Macs with Apple's "Magic" keyboard (MacBookPro16,* and MacBookAir9,1),
and also documents what names should be used for keyboard backlight
leds in Documentation/leds/well-known-leds.txt.
v4->v5:
- use <tab><space><space> for help in Kconfig
- prepend "hid-" to filename in MAINTAINERS
v3->v4:
- collect reviews from Andy and Thomas
- remove now unused hdev member of apple_magic_backlight
v2->v3:
- remove unneeded header inclusion
- use s32 for report value type
- remove unneeded null check
- don't set drvdata as its never used
- prepend "hid-" to module name
v1->v2:
- drop unneeded remove function
- combine set functions
- add missing header inclusions
- avoid char as argument in favour of u8
- handful of style/formatting fixes
- use standard led name ":white:kbd_backlight"
- rename USAGE_MAGIC_BL to HID_USAGE_MAGIC_BL
- New patch documenting preferred keyboard backlight names
v1: https://lore.kernel.org/linux-input/7D70F1FE-7F54-4D0A-8922-5466AA2AD364@live.com/
v2: https://lore.kernel.org/linux-input/20230216041224.4731-1-orlandoch.dev@gmail.com/
v3: https://lore.kernel.org/linux-input/20230217102319.3419-1-orlandoch.dev@gmail.com/
v4: https://lore.kernel.org/linux-input/20230218090709.7467-1-orlandoch.dev@gmail.com/
Orlando Chamberlain (2):
Documentation: leds: standardise keyboard backlight led names
HID: hid-apple-magic-backlight: Add driver for keyboard backlight on
internal Magic Keyboards
Documentation/leds/well-known-leds.txt | 8 ++
MAINTAINERS | 6 ++
drivers/hid/Kconfig | 13 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-apple-magic-backlight.c | 120 ++++++++++++++++++++++++
5 files changed, 148 insertions(+)
create mode 100644 drivers/hid/hid-apple-magic-backlight.c
--
2.39.2
^ permalink raw reply
* Re: [PATCH v4 2/2] HID: hid-apple-magic-backlight: Add driver for keyboard backlight on internal Magic Keyboards
From: Orlando Chamberlain @ 2023-02-20 11:45 UTC (permalink / raw)
To: Aditya Garg
Cc: linux-doc@vger.kernel.org, linux-input@vger.kernel.org,
Jonathan Corbet, Jiri Kosina, Benjamin Tissoires,
linux-kernel@vger.kernel.org, Pavel Machek, Aun-Ali Zaidi,
Kerem Karabay, Andy Shevchenko, Thomas Weißschuh,
Andy Shevchenko, Thomas Weißschuh
In-Reply-To: <BM1PR01MB0931BEDFA262CB1BF9B768A4B8A49@BM1PR01MB0931.INDPRD01.PROD.OUTLOOK.COM>
On Mon, 20 Feb 2023 08:33:10 +0000
Aditya Garg <gargaditya08@live.com> wrote:
> > On 18-Feb-2023, at 2:38 PM, Orlando Chamberlain
> > <orlandoch.dev@gmail.com> wrote:
> >
> > This driver adds support for the keyboard backlight on Intel T2
> > Macs with internal Magic Keyboards (MacBookPro16,x and
> > MacBookAir9,1)
> >
> > Co-developed-by: Kerem Karabay <kekrby@gmail.com>
> > Signed-off-by: Kerem Karabay <kekrby@gmail.com>
> > Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> > v3->v4:
> > - collect reviews from Andy and Thomas
> > - remove now unused hdev member of apple_magic_backlight
> > v2->v3:
> > - remove unneeded inclusion
> > - use s32 for report value type
> > - remove unneeded null check
> > - don't set drvdata as its never used
> > - prepend "hid-" to module name
> > v1->v2:
> > - drop unneeded remove function
> > - combine set functions
> > - add missing header inclusions
> > - avoid char as argument in favour of u8
> > - handful of style/formatting fixes
> > - use standard led name ":white:kbd_backlight"
> > - rename USAGE_MAGIC_BL to HID_USAGE_MAGIC_BL
> >
> > MAINTAINERS | 6 ++
> > drivers/hid/Kconfig | 13 +++
> > drivers/hid/Makefile | 1 +
> > drivers/hid/hid-apple-magic-backlight.c | 120
> > ++++++++++++++++++++++++ 4 files changed, 140 insertions(+)
> > create mode 100644 drivers/hid/hid-apple-magic-backlight.c
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index fb1471cb5ed3..3319f0c3ed1e 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -9201,6 +9201,12 @@ F: include/linux/pm.h
> > F: include/linux/suspend.h
> > F: kernel/power/
> >
> > +HID APPLE MAGIC BACKLIGHT DRIVER
> > +M: Orlando Chamberlain <orlandoch.dev@gmail.com>
> > +L: linux-input@vger.kernel.org
> > +S: Maintained
> > +F: drivers/hid/apple-magic-backlight.c
>
> drivers/hid/hid-apple-magic-backlight.c
>
> Looks like you forgot to change that.
Yes I did, thanks for catching that. I'll fix it in v5.
>
> > +
> > HID CORE LAYER
> > M: Jiri Kosina <jikos@kernel.org>
> > M: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> > diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
> > index e2a5d30c8895..fe489632bfd9 100644
> > --- a/drivers/hid/Kconfig
> > +++ b/drivers/hid/Kconfig
> > @@ -130,6 +130,19 @@ config HID_APPLE
> > Say Y here if you want support for keyboards of Apple iBooks,
> > PowerBooks, MacBooks, MacBook Pros and Apple Aluminum.
> >
> > +config HID_APPLE_MAGIC_BACKLIGHT
> > + tristate "Apple Magic Keyboard Backlight"
> > + depends on USB_HID
> > + depends on LEDS_CLASS
> > + depends on NEW_LEDS
> > + help
> > + Say Y here if you want support for the keyboard backlight on
> > Macs with
> > + the magic keyboard (MacBookPro16,x and MacBookAir9,1). Note
> > that this
> > + driver is not for external magic keyboards.
> > +
> > + To compile this driver as a module, choose M here: the
> > + module will be called hid-apple-magic-backlight.
> > +
> > config HID_APPLEIR
> > tristate "Apple infrared receiver"
> > depends on (USB_HID)
> > diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
> > index e8014c1a2f8b..dc8df002bc86 100644
> > --- a/drivers/hid/Makefile
> > +++ b/drivers/hid/Makefile
> > @@ -26,6 +26,7 @@ obj-$(CONFIG_HID_ACCUTOUCH) += hid-accutouch.o
> > obj-$(CONFIG_HID_ALPS) += hid-alps.o
> > obj-$(CONFIG_HID_ACRUX) += hid-axff.o
> > obj-$(CONFIG_HID_APPLE) += hid-apple.o
> > +obj-$(CONFIG_HID_APPLE_MAGIC_BACKLIGHT) +=
> > hid-apple-magic-backlight.o obj-$(CONFIG_HID_APPLEIR) +=
> > hid-appleir.o obj-$(CONFIG_HID_CREATIVE_SB0540) +=
> > hid-creative-sb0540.o obj-$(CONFIG_HID_ASUS) += hid-asus.o
> > diff --git a/drivers/hid/hid-apple-magic-backlight.c
> > b/drivers/hid/hid-apple-magic-backlight.c new file mode 100644
> > index 000000000000..f0fc02ff3b2d
> > --- /dev/null
> > +++ b/drivers/hid/hid-apple-magic-backlight.c
> > @@ -0,0 +1,120 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Apple Magic Keyboard Backlight Driver
> > + *
> > + * For Intel Macs with internal Magic Keyboard (MacBookPro16,1-4
> > and MacBookAir9,1)
> > + *
> > + * Copyright (c) 2022 Kerem Karabay <kekrby@gmail.com>
> > + * Copyright (c) 2023 Orlando Chamberlain <orlandoch.dev@gmail.com>
> > + */
> > +
> > +#include <linux/hid.h>
> > +#include <linux/leds.h>
> > +#include <linux/device.h>
> > +#include <linux/errno.h>
> > +#include <dt-bindings/leds/common.h>
> > +
> > +#include "hid-ids.h"
> > +
> > +#define HID_USAGE_MAGIC_BL 0xff00000f
> > +
> > +#define APPLE_MAGIC_REPORT_ID_POWER 3
> > +#define APPLE_MAGIC_REPORT_ID_BRIGHTNESS 1
> > +
> > +struct apple_magic_backlight {
> > + struct led_classdev cdev;
> > + struct hid_report *brightness;
> > + struct hid_report *power;
> > +};
> > +
> > +static void apple_magic_backlight_report_set(struct hid_report
> > *rep, s32 value, u8 rate) +{
> > + rep->field[0]->value[0] = value;
> > + rep->field[1]->value[0] = 0x5e; /* Mimic Windows */
> > + rep->field[1]->value[0] |= rate << 8;
> > +
> > + hid_hw_request(rep->device, rep, HID_REQ_SET_REPORT);
> > +}
> > +
> > +static void apple_magic_backlight_set(struct apple_magic_backlight
> > *backlight,
> > + int brightness, char rate)
> > +{
> > + apple_magic_backlight_report_set(backlight->power, brightness
> > ? 1 : 0, rate);
> > + if (brightness)
> > + apple_magic_backlight_report_set(backlight->brightness,
> > brightness, rate); +}
> > +
> > +static int apple_magic_backlight_led_set(struct led_classdev
> > *led_cdev,
> > + enum led_brightness brightness)
> > +{
> > + struct apple_magic_backlight *backlight =
> > container_of(led_cdev,
> > + struct apple_magic_backlight, cdev);
> > +
> > + apple_magic_backlight_set(backlight, brightness, 1);
> > + return 0;
> > +}
> > +
> > +static int apple_magic_backlight_probe(struct hid_device *hdev,
> > + const struct hid_device_id *id)
> > +{
> > + struct apple_magic_backlight *backlight;
> > + int rc;
> > +
> > + rc = hid_parse(hdev);
> > + if (rc)
> > + return rc;
> > +
> > + /*
> > + * Ensure this usb endpoint is for the keyboard backlight, not
> > touchbar
> > + * backlight.
> > + */
> > + if (hdev->collection[0].usage != HID_USAGE_MAGIC_BL)
> > + return -ENODEV;
> > +
> > + backlight = devm_kzalloc(&hdev->dev, sizeof(*backlight),
> > GFP_KERNEL);
> > + if (!backlight)
> > + return -ENOMEM;
> > +
> > + rc = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> > + if (rc)
> > + return rc;
> > +
> > + backlight->brightness = hid_register_report(hdev,
> > HID_FEATURE_REPORT,
> > + APPLE_MAGIC_REPORT_ID_BRIGHTNESS, 0);
> > + backlight->power = hid_register_report(hdev,
> > HID_FEATURE_REPORT,
> > + APPLE_MAGIC_REPORT_ID_POWER, 0);
> > +
> > + if (!backlight->brightness || !backlight->power) {
> > + rc = -ENODEV;
> > + goto hw_stop;
> > + }
> > +
> > + backlight->cdev.name = ":white:" LED_FUNCTION_KBD_BACKLIGHT;
> > + backlight->cdev.max_brightness =
> > backlight->brightness->field[0]->logical_maximum;
> > + backlight->cdev.brightness_set_blocking =
> > apple_magic_backlight_led_set; +
> > + apple_magic_backlight_set(backlight, 0, 0);
> > +
> > + return devm_led_classdev_register(&hdev->dev,
> > &backlight->cdev); +
> > +hw_stop:
> > + hid_hw_stop(hdev);
> > + return rc;
> > +}
> > +
> > +static const struct hid_device_id apple_magic_backlight_hid_ids[]
> > = {
> > + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE,
> > USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT) },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(hid, apple_magic_backlight_hid_ids);
> > +
> > +static struct hid_driver apple_magic_backlight_hid_driver = {
> > + .name = "hid-apple-magic-backlight",
> > + .id_table = apple_magic_backlight_hid_ids,
> > + .probe = apple_magic_backlight_probe,
> > +};
> > +module_hid_driver(apple_magic_backlight_hid_driver);
> > +
> > +MODULE_DESCRIPTION("MacBook Magic Keyboard Backlight");
> > +MODULE_AUTHOR("Orlando Chamberlain <orlandoch.dev@gmail.com>");
> > +MODULE_LICENSE("GPL");
> > --
> > 2.39.1
> >
^ permalink raw reply
* Re: [PATCH v4 2/2] HID: hid-apple-magic-backlight: Add driver for keyboard backlight on internal Magic Keyboards
From: Orlando Chamberlain @ 2023-02-20 11:45 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-doc, linux-input, Jonathan Corbet, Jiri Kosina,
Benjamin Tissoires, linux-kernel, Pavel Machek, Aditya Garg,
Aun-Ali Zaidi, Kerem Karabay, Thomas Weißschuh,
Thomas Weißschuh
In-Reply-To: <Y/NZm22JQKeF1+6R@smile.fi.intel.com>
On Mon, 20 Feb 2023 13:29:31 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Mon, Feb 20, 2023 at 06:09:32PM +1100, Orlando Chamberlain wrote:
> > On Sun, 19 Feb 2023 16:09:26 +0200
> > Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > > On Sat, Feb 18, 2023 at 11:08 AM Orlando Chamberlain
> > > <orlandoch.dev@gmail.com> wrote:
>
> ...
>
> > > > + help
> > > > + Say Y here if you want support for the keyboard
> > > > backlight on Macs with
> > > > + the magic keyboard (MacBookPro16,x and MacBookAir9,1).
> > > > Note that this
> > > > + driver is not for external magic keyboards.
> > > > +
> > > > + To compile this driver as a module, choose M here: the
> > > > + module will be called hid-apple-magic-backlight.
> > >
> > > Is it my email client or is the indentation of the help text
> > > incorrect?
> > >
> > > Hint: the text of the help should be <TAB><SPACE><SPACE> indented.
> > >
> > > I believe checkpatch.pl at least in --strict mode should complain
> > > about this.
> >
> > Looking at the hid Kconfig, it seems like some have it as you've
> > described, and some just have tab (and a few have just tab for the
> > first line, and tab space space for the rest of the lines).
>
> Okay, I have checked in the other MUA I'm using for patch reviews and
> indeed your Kconfig indentation is broken.
>
> > checkpatch.pl --strict didn't complain about the indentation so
> > hopefully it's alright as is.
>
> No, it's not. Must be fixed.
>
> https://www.kernel.org/doc/html/latest/process/coding-style.html#kconfig-configuration-files
>
No worries, I'll fix that in v5.
^ permalink raw reply
* Re: [PATCH v4 2/2] HID: hid-apple-magic-backlight: Add driver for keyboard backlight on internal Magic Keyboards
From: Andy Shevchenko @ 2023-02-20 11:29 UTC (permalink / raw)
To: Orlando Chamberlain
Cc: linux-doc, linux-input, Jonathan Corbet, Jiri Kosina,
Benjamin Tissoires, linux-kernel, Pavel Machek, Aditya Garg,
Aun-Ali Zaidi, Kerem Karabay, Thomas Weißschuh,
Thomas Weißschuh
In-Reply-To: <20230220180932.2a7aa6b1@redecorated-mbp>
On Mon, Feb 20, 2023 at 06:09:32PM +1100, Orlando Chamberlain wrote:
> On Sun, 19 Feb 2023 16:09:26 +0200
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > On Sat, Feb 18, 2023 at 11:08 AM Orlando Chamberlain
> > <orlandoch.dev@gmail.com> wrote:
...
> > > + help
> > > + Say Y here if you want support for the keyboard backlight
> > > on Macs with
> > > + the magic keyboard (MacBookPro16,x and MacBookAir9,1). Note
> > > that this
> > > + driver is not for external magic keyboards.
> > > +
> > > + To compile this driver as a module, choose M here: the
> > > + module will be called hid-apple-magic-backlight.
> >
> > Is it my email client or is the indentation of the help text
> > incorrect?
> >
> > Hint: the text of the help should be <TAB><SPACE><SPACE> indented.
> >
> > I believe checkpatch.pl at least in --strict mode should complain
> > about this.
>
> Looking at the hid Kconfig, it seems like some have it as you've
> described, and some just have tab (and a few have just tab for the
> first line, and tab space space for the rest of the lines).
Okay, I have checked in the other MUA I'm using for patch reviews and indeed
your Kconfig indentation is broken.
> checkpatch.pl --strict didn't complain about the indentation so
> hopefully it's alright as is.
No, it's not. Must be fixed.
https://www.kernel.org/doc/html/latest/process/coding-style.html#kconfig-configuration-files
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Baolin Wang @ 2023-02-20 11:13 UTC (permalink / raw)
To: Daniel Lezcano, rafael
Cc: linux-pm, linux-kernel, Zhang Rui, Len Brown, Damien Le Moal,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Jean Delvare, Guenter Roeck, Jonathan Cameron,
Lars-Peter Clausen, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Dmitry Torokhov, Raju Rangoju, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Ido Schimmel, Petr Machata,
Gregory Greenman, Kalle Valo, Sebastian Reichel, Liam Girdwood,
Mark Brown, Miquel Raynal, Amit Kucheria, Florian Fainelli,
Broadcom internal kernel review list, Ray Jui, Scott Branden,
Markus Mayer, Support Opensource, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Thara Gopinath, Niklas Söderlund,
Heiko Stuebner, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
Alim Akhtar, Orson Zhai, Chunyan Zhang, Vasily Khoruzhick,
Yangtao Li, Thierry Reding, Jonathan Hunter, Talel Shenhar,
Eduardo Valentin, Keerthy, Kunihiko Hayashi, Masami Hiramatsu,
Matthias Brugger, AngeloGioacchino Del Regno, Stefan Wahren,
Neil Armstrong, ye xingchen, Zheng Yongjun, Tim Zimmermann,
Yang Li, Srinivas Pandruvada, Ricardo Neri, Jiang Jian,
Daniel Golle, Balsam CHIHI, Randy Dunlap, Mikko Perttunen,
open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org>
On 2/19/2023 10:36 PM, Daniel Lezcano wrote:
> The thermal zone device structure is exposed to the different drivers
> and obviously they access the internals while that should be
> restricted to the core thermal code.
>
> In order to self-encapsulate the thermal core code, we need to prevent
> the drivers accessing directly the thermal zone structure and provide
> accessor functions to deal with.
>
> Provide an accessor to the 'devdata' structure and make use of it in
> the different drivers.
>
> No functional changes intended.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
[...]
> drivers/thermal/sprd_thermal.c | 2 +-
For sprd:
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
^ permalink raw reply
* RE: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: DLG Adam Ward @ 2023-02-20 11:03 UTC (permalink / raw)
To: Daniel Lezcano, rafael@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui,
Len Brown, Damien Le Moal, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Jean Delvare, Guenter Roeck, Jonathan Cameron, Lars-Peter Clausen,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Dmitry Torokhov,
Raju Rangoju, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Ido Schimmel, Petr Machata, Gregory Greenman,
Kalle Valo, Sebastian Reichel, Liam Girdwood, Mark Brown,
Miquel Raynal, Amit Kucheria, Florian Fainelli,
Broadcom internal kernel review list, Ray Jui, Scott Branden,
Markus Mayer, Support Opensource, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Thara Gopinath, Niklas Söderlund,
Heiko Stuebner, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
Alim Akhtar, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vasily Khoruzhick, Yangtao Li, Thierry Reding, Jonathan Hunter,
Talel Shenhar, Eduardo Valentin, Keerthy, Kunihiko Hayashi,
Masami Hiramatsu, Matthias Brugger, AngeloGioacchino Del Regno,
Stefan Wahren, Neil Armstrong, ye xingchen, Zheng Yongjun,
Tim Zimmermann, Yang Li, Srinivas Pandruvada, Ricardo Neri,
Jiang Jian, Daniel Golle, Balsam CHIHI, Randy Dunlap,
Mikko Perttunen, open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org>
On 19/02/23 14:37, Daniel Lezcano wrote:
>The thermal zone device structure is exposed to the different drivers and obviously they access the internals while that should be restricted to the core thermal code.
>
>In order to self-encapsulate the thermal core code, we need to prevent the drivers accessing directly the thermal zone structure and provide accessor functions to deal with.
>
>Provide an accessor to the 'devdata' structure and make use of it in the different drivers.
>No functional changes intended.
>
>Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>---
>drivers/thermal/da9062-thermal.c | 2 +-
For da9062:
Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com>
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Greenman, Gregory @ 2023-02-20 10:37 UTC (permalink / raw)
To: rafael@kernel.org, daniel.lezcano@linaro.org
Cc: bzolnier@gmail.com, linux-hwmon@vger.kernel.org,
alim.akhtar@samsung.com, orsonzhai@gmail.com, idosch@nvidia.com,
linux-imx@nxp.com, mperttunen@nvidia.com, jdelvare@suse.com,
yang.lee@linux.alibaba.com, jernej.skrabec@gmail.com,
niklas.soderlund@ragnatech.se, netdev@vger.kernel.org,
rdunlap@infradead.org, lenb@kernel.org, lars@metafoo.de,
bcm-kernel-feedback-list@broadcom.com, anarsoul@gmail.com,
linux-sunxi@lists.linux.dev, sbranden@broadcom.com,
linux-kernel@vger.kernel.org, heiko@sntech.de, wens@csie.org,
mmayer@broadcom.com, Zhang, Rui, bchihi@baylibre.com,
sre@kernel.org, linux-omap@vger.kernel.org,
linux-acpi@vger.kernel.org, thierry.reding@gmail.com,
linux-pm@vger.kernel.org, mhiramat@kernel.org,
linux-rpi-kernel@lists.infradead.org,
linux-renesas-soc@vger.kernel.org, linux-iio@vger.kernel.org,
zhang.lyra@gmail.com, linux-ide@vger.kernel.org,
shawnguo@kernel.org, broonie@kernel.org, konrad.dybcio@linaro.org,
j-keerthy@ti.com, matthias.bgg@gmail.com, edumazet@google.com,
lgirdwood@gmail.com, support.opensource@diasemi.com,
agross@kernel.org, zhengyongjun3@huawei.com,
krzysztof.kozlowski@linaro.org, edubezval@gmail.com,
f.fainelli@gmail.com, kuba@kernel.org, andersson@kernel.org,
neil.armstrong@linaro.org, jic23@kernel.org,
angelogioacchino.delregno@collabora.com, tim@linux4.de,
amitk@kernel.org, hayashi.kunihiko@socionext.com,
thara.gopinath@gmail.com, dmitry.torokhov@gmail.com,
linux-mediatek@lists.infradead.org, petrm@nvidia.com,
ye.xingchen@zte.com.cn, linux-rockchip@lists.infradead.org,
linux-arm-msm@vger.kernel.org, s.hauer@pengutronix.de,
jonathanh@nvidia.com, samuel@sholland.org, daniel@makrotopia.org,
kernel@pengutronix.de, srinivas.pandruvada@linux.intel.com,
linux-samsung-soc@vger.kernel.org, linux@roeck-us.net,
festevam@gmail.com, miquel.raynal@bootlin.com, talel@amazon.com,
tiny.windzz@gmail.com, rjui@broadcom.com,
linux-input@vger.kernel.org, damien.lemoal@opensource.wdc.com,
kvalo@kernel.org, linux-arm-kernel@lists.infradead.org,
baolin.wang@linux.alibaba.com, pabeni@redhat.com,
jiangjian@cdjrlc.com, linux-tegra@vger.kernel.org,
ricardo.neri-calderon@linux.intel.com,
linux-wireless@vger.kernel.org, stefan.wahren@i2se.com,
rajur@chelsio.com, davem@davemloft.net
In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org>
On Sun, 2023-02-19 at 15:36 +0100, Daniel Lezcano wrote:
> The thermal zone device structure is exposed to the different drivers
> and obviously they access the internals while that should be
> restricted to the core thermal code.
>
> In order to self-encapsulate the thermal core code, we need to prevent
> the drivers accessing directly the thermal zone structure and provide
> accessor functions to deal with.
>
> Provide an accessor to the 'devdata' structure and make use of it in
> the different drivers.
>
> No functional changes intended.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/acpi/thermal.c | 16 ++++++++--------
> drivers/ata/ahci_imx.c | 2 +-
> drivers/hwmon/hwmon.c | 4 ++--
> drivers/hwmon/pmbus/pmbus_core.c | 2 +-
> drivers/hwmon/scmi-hwmon.c | 2 +-
> drivers/hwmon/scpi-hwmon.c | 2 +-
> drivers/iio/adc/sun4i-gpadc-iio.c | 2 +-
> drivers/input/touchscreen/sun4i-ts.c | 2 +-
> .../net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 2 +-
> .../net/ethernet/mellanox/mlxsw/core_thermal.c | 14 +++++++-------
> drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 4 ++--
> drivers/power/supply/power_supply_core.c | 2 +-
> drivers/regulator/max8973-regulator.c | 2 +-
> drivers/thermal/armada_thermal.c | 4 ++--
> drivers/thermal/broadcom/bcm2711_thermal.c | 2 +-
> drivers/thermal/broadcom/bcm2835_thermal.c | 2 +-
> drivers/thermal/broadcom/brcmstb_thermal.c | 4 ++--
> drivers/thermal/broadcom/ns-thermal.c | 2 +-
> drivers/thermal/broadcom/sr-thermal.c | 2 +-
> drivers/thermal/da9062-thermal.c | 2 +-
> drivers/thermal/dove_thermal.c | 2 +-
> drivers/thermal/hisi_thermal.c | 2 +-
> drivers/thermal/imx8mm_thermal.c | 2 +-
> drivers/thermal/imx_sc_thermal.c | 2 +-
> drivers/thermal/imx_thermal.c | 6 +++---
> drivers/thermal/intel/intel_pch_thermal.c | 2 +-
> drivers/thermal/intel/intel_soc_dts_iosf.c | 13 +++++--------
> drivers/thermal/intel/x86_pkg_temp_thermal.c | 4 ++--
> drivers/thermal/k3_bandgap.c | 2 +-
> drivers/thermal/k3_j72xx_bandgap.c | 2 +-
> drivers/thermal/kirkwood_thermal.c | 2 +-
> drivers/thermal/max77620_thermal.c | 2 +-
> drivers/thermal/mediatek/auxadc_thermal.c | 2 +-
> drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
> drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 4 ++--
> drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 4 ++--
> drivers/thermal/qoriq_thermal.c | 2 +-
> drivers/thermal/rcar_gen3_thermal.c | 4 ++--
> drivers/thermal/rcar_thermal.c | 3 +--
> drivers/thermal/rockchip_thermal.c | 4 ++--
> drivers/thermal/rzg2l_thermal.c | 2 +-
> drivers/thermal/samsung/exynos_tmu.c | 4 ++--
> drivers/thermal/spear_thermal.c | 8 ++++----
> drivers/thermal/sprd_thermal.c | 2 +-
> drivers/thermal/sun8i_thermal.c | 2 +-
> drivers/thermal/tegra/tegra-bpmp-thermal.c | 6 ++++--
> drivers/thermal/tegra/tegra30-tsensor.c | 4 ++--
> drivers/thermal/thermal-generic-adc.c | 2 +-
> drivers/thermal/thermal_core.c | 6 ++++++
> drivers/thermal/thermal_mmio.c | 2 +-
> .../thermal/ti-soc-thermal/ti-thermal-common.c | 4 ++--
> drivers/thermal/uniphier_thermal.c | 2 +-
> include/linux/thermal.h | 2 ++
> 53 files changed, 97 insertions(+), 91 deletions(-)
>
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 0b4b844f9d4c..69d0da6456d5 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -498,7 +498,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
>
> static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
> {
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
> int result;
>
> if (!tz)
> @@ -516,7 +516,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp)
> static int thermal_get_trip_type(struct thermal_zone_device *thermal,
> int trip, enum thermal_trip_type *type)
> {
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
> int i;
>
> if (!tz || trip < 0)
> @@ -560,7 +560,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
> static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
> int trip, int *temp)
> {
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
> int i;
>
> if (!tz || trip < 0)
> @@ -613,7 +613,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
> static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
> int *temperature)
> {
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
>
> if (tz->trips.critical.flags.valid) {
> *temperature = deci_kelvin_to_millicelsius_with_offset(
> @@ -628,7 +628,7 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
> static int thermal_get_trend(struct thermal_zone_device *thermal,
> int trip, enum thermal_trend *trend)
> {
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
> enum thermal_trip_type type;
> int i;
>
> @@ -670,7 +670,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
>
> static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
> {
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
>
> acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
> dev_name(&tz->device->dev),
> @@ -679,7 +679,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
>
> static void acpi_thermal_zone_device_critical(struct thermal_zone_device *thermal)
> {
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
>
> acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
> dev_name(&tz->device->dev),
> @@ -693,7 +693,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
> bool bind)
> {
> struct acpi_device *device = cdev->devdata;
> - struct acpi_thermal *tz = thermal->devdata;
> + struct acpi_thermal *tz = thermal_zone_device_get_data(thermal);
> struct acpi_device *dev;
> acpi_handle handle;
> int i;
> diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
> index a950767f7948..0ef928528aec 100644
> --- a/drivers/ata/ahci_imx.c
> +++ b/drivers/ata/ahci_imx.c
> @@ -418,7 +418,7 @@ static int __sata_ahci_read_temperature(void *dev, int *temp)
>
> static int sata_ahci_read_temperature(struct thermal_zone_device *tz, int *temp)
> {
> - return __sata_ahci_read_temperature(tz->devdata, temp);
> + return __sata_ahci_read_temperature(thermal_zone_device_get_data(tz), temp);
> }
>
> static ssize_t sata_ahci_show_temp(struct device *dev,
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 33edb5c02f7d..b33477d04c2b 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -154,7 +154,7 @@ static DEFINE_IDA(hwmon_ida);
> #ifdef CONFIG_THERMAL_OF
> static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct hwmon_thermal_data *tdata = tz->devdata;
> + struct hwmon_thermal_data *tdata = thermal_zone_device_get_data(tz);
> struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
> int ret;
> long t;
> @@ -171,7 +171,7 @@ static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
>
> static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct hwmon_thermal_data *tdata = tz->devdata;
> + struct hwmon_thermal_data *tdata = thermal_zone_device_get_data(tz);
> struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
> const struct hwmon_chip_info *chip = hwdev->chip;
> const struct hwmon_channel_info **info = chip->info;
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 95e95783972a..159a88af6277 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -1272,7 +1272,7 @@ struct pmbus_thermal_data {
>
> static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct pmbus_thermal_data *tdata = tz->devdata;
> + struct pmbus_thermal_data *tdata = thermal_zone_device_get_data(tz);
> struct pmbus_sensor *sensor = tdata->sensor;
> struct pmbus_data *pmbus_data = tdata->pmbus_data;
> struct i2c_client *client = to_i2c_client(pmbus_data->dev);
> diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
> index e192f0c67146..7951b6026f48 100644
> --- a/drivers/hwmon/scmi-hwmon.c
> +++ b/drivers/hwmon/scmi-hwmon.c
> @@ -141,7 +141,7 @@ static int scmi_hwmon_thermal_get_temp(struct thermal_zone_device *tz,
> {
> int ret;
> long value;
> - struct scmi_thermal_sensor *th_sensor = tz->devdata;
> + struct scmi_thermal_sensor *th_sensor = thermal_zone_device_get_data(tz);
>
> ret = scmi_hwmon_read_scaled_value(th_sensor->ph, th_sensor->info,
> &value);
> diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> index 4d75385f7d5e..efe0ddbc5293 100644
> --- a/drivers/hwmon/scpi-hwmon.c
> +++ b/drivers/hwmon/scpi-hwmon.c
> @@ -64,7 +64,7 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor)
>
> static int scpi_read_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct scpi_thermal_zone *zone = tz->devdata;
> + struct scpi_thermal_zone *zone = thermal_zone_device_get_data(tz);
> struct scpi_sensors *scpi_sensors = zone->scpi_sensors;
> struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops;
> struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id];
> diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
> index a6ade70dedf8..e24ac3ee8a35 100644
> --- a/drivers/iio/adc/sun4i-gpadc-iio.c
> +++ b/drivers/iio/adc/sun4i-gpadc-iio.c
> @@ -414,7 +414,7 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
>
> static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct sun4i_gpadc_iio *info = tz->devdata;
> + struct sun4i_gpadc_iio *info = thermal_zone_device_get_data(tz);
> int val, scale, offset;
>
> if (sun4i_gpadc_temp_read(info->indio_dev, &val))
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index 73eb8f80be6e..5e5434ffe397 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -194,7 +194,7 @@ static int sun4i_get_temp(const struct sun4i_ts_data *ts, int *temp)
>
> static int sun4i_get_tz_temp(struct thermal_zone_device *tz, int *temp)
> {
> - return sun4i_get_temp(tz->devdata, temp);
> + return sun4i_get_temp(thermal_zone_device_get_data(tz), temp);
> }
>
> static const struct thermal_zone_device_ops sun4i_ts_tz_ops = {
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
> index 95e1b415ba13..8b0d318feef4 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
> @@ -12,7 +12,7 @@
> static int cxgb4_thermal_get_temp(struct thermal_zone_device *tzdev,
> int *temp)
> {
> - struct adapter *adap = tzdev->devdata;
> + struct adapter *adap = thermal_zone_device_get_data(tzdev);
> u32 param, val;
> int ret;
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> index c5240d38c9db..228b6ffaef98 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> @@ -201,7 +201,7 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
> static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
> struct thermal_cooling_device *cdev)
> {
> - struct mlxsw_thermal *thermal = tzdev->devdata;
> + struct mlxsw_thermal *thermal = thermal_zone_device_get_data(tzdev);
> struct device *dev = thermal->bus_info->dev;
> int i, err;
>
> @@ -227,7 +227,7 @@ static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
> static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev,
> struct thermal_cooling_device *cdev)
> {
> - struct mlxsw_thermal *thermal = tzdev->devdata;
> + struct mlxsw_thermal *thermal = thermal_zone_device_get_data(tzdev);
> struct device *dev = thermal->bus_info->dev;
> int i;
> int err;
> @@ -249,7 +249,7 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev,
> static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
> int *p_temp)
> {
> - struct mlxsw_thermal *thermal = tzdev->devdata;
> + struct mlxsw_thermal *thermal = thermal_zone_device_get_data(tzdev);
> struct device *dev = thermal->bus_info->dev;
> char mtmp_pl[MLXSW_REG_MTMP_LEN];
> int temp;
> @@ -281,7 +281,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
> static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
> struct thermal_cooling_device *cdev)
> {
> - struct mlxsw_thermal_module *tz = tzdev->devdata;
> + struct mlxsw_thermal_module *tz = thermal_zone_device_get_data(tzdev);
> struct mlxsw_thermal *thermal = tz->parent;
> int i, j, err;
>
> @@ -310,7 +310,7 @@ static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
> static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev,
> struct thermal_cooling_device *cdev)
> {
> - struct mlxsw_thermal_module *tz = tzdev->devdata;
> + struct mlxsw_thermal_module *tz = thermal_zone_device_get_data(tzdev);
> struct mlxsw_thermal *thermal = tz->parent;
> int i;
> int err;
> @@ -356,7 +356,7 @@ mlxsw_thermal_module_temp_and_thresholds_get(struct mlxsw_core *core,
> static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
> int *p_temp)
> {
> - struct mlxsw_thermal_module *tz = tzdev->devdata;
> + struct mlxsw_thermal_module *tz = thermal_zone_device_get_data(tzdev);
> struct mlxsw_thermal *thermal = tz->parent;
> int temp, crit_temp, emerg_temp;
> struct device *dev;
> @@ -391,7 +391,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
> static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
> int *p_temp)
> {
> - struct mlxsw_thermal_module *tz = tzdev->devdata;
> + struct mlxsw_thermal_module *tz = thermal_zone_device_get_data(tzdev);
> struct mlxsw_thermal *thermal = tz->parent;
> char mtmp_pl[MLXSW_REG_MTMP_LEN];
> u16 index;
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> index 232c200af38f..ee8fee29107f 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
> @@ -615,7 +615,7 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
> static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
> int *temperature)
> {
> - struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata;
> + struct iwl_mvm *mvm = thermal_zone_device_get_data(device);
> int ret;
> int temp;
>
> @@ -641,7 +641,7 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
> static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
> int trip, int temp)
> {
> - struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata;
> + struct iwl_mvm *mvm = thermal_zone_device_get_data(device);
> struct iwl_mvm_thermal_device *tzone;
> int ret;
>
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 7c790c41e2fe..166f0aacc797 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -1142,7 +1142,7 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd,
> int ret;
>
> WARN_ON(tzd == NULL);
> - psy = tzd->devdata;
> + psy = thermal_zone_device_get_data(tzd);
> ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val);
> if (ret)
> return ret;
> diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c
> index 7e00a45db26a..ccacba66d367 100644
> --- a/drivers/regulator/max8973-regulator.c
> +++ b/drivers/regulator/max8973-regulator.c
> @@ -436,7 +436,7 @@ static int max8973_init_dcdc(struct max8973_chip *max,
>
> static int max8973_thermal_read_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct max8973_chip *mchip = tz->devdata;
> + struct max8973_chip *mchip = thermal_zone_device_get_data(tz);
> unsigned int val;
> int ret;
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 2efc222a379b..82d3e15d51f6 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -398,7 +398,7 @@ static int armada_read_sensor(struct armada_thermal_priv *priv, int *temp)
> static int armada_get_temp_legacy(struct thermal_zone_device *thermal,
> int *temp)
> {
> - struct armada_thermal_priv *priv = thermal->devdata;
> + struct armada_thermal_priv *priv = thermal_zone_device_get_data(thermal);
> int ret;
>
> /* Valid check */
> @@ -420,7 +420,7 @@ static struct thermal_zone_device_ops legacy_ops = {
>
> static int armada_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct armada_thermal_sensor *sensor = tz->devdata;
> + struct armada_thermal_sensor *sensor = thermal_zone_device_get_data(tz);
> struct armada_thermal_priv *priv = sensor->priv;
> int ret;
>
> diff --git a/drivers/thermal/broadcom/bcm2711_thermal.c b/drivers/thermal/broadcom/bcm2711_thermal.c
> index 1f8651d15160..18b1a4d9ecc7 100644
> --- a/drivers/thermal/broadcom/bcm2711_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2711_thermal.c
> @@ -33,7 +33,7 @@ struct bcm2711_thermal_priv {
>
> static int bcm2711_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct bcm2711_thermal_priv *priv = tz->devdata;
> + struct bcm2711_thermal_priv *priv = thermal_zone_device_get_data(tz);
> int slope = thermal_zone_get_slope(tz);
> int offset = thermal_zone_get_offset(tz);
> u32 val;
> diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
> index 23918bb76ae6..de2f573863da 100644
> --- a/drivers/thermal/broadcom/bcm2835_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2835_thermal.c
> @@ -90,7 +90,7 @@ static int bcm2835_thermal_temp2adc(int temp, int offset, int slope)
>
> static int bcm2835_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct bcm2835_thermal_data *data = tz->devdata;
> + struct bcm2835_thermal_data *data = thermal_zone_device_get_data(tz);
> u32 val = readl(data->regs + BCM2835_TS_TSENSSTAT);
>
> if (!(val & BCM2835_TS_TSENSSTAT_VALID))
> diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
> index 4d02c28331e3..668cdc16b108 100644
> --- a/drivers/thermal/broadcom/brcmstb_thermal.c
> +++ b/drivers/thermal/broadcom/brcmstb_thermal.c
> @@ -152,7 +152,7 @@ static inline u32 avs_tmon_temp_to_code(struct brcmstb_thermal_priv *priv,
>
> static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct brcmstb_thermal_priv *priv = tz->devdata;
> + struct brcmstb_thermal_priv *priv = thermal_zone_device_get_data(tz);
> u32 val;
> long t;
>
> @@ -262,7 +262,7 @@ static irqreturn_t brcmstb_tmon_irq_thread(int irq, void *data)
>
> static int brcmstb_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct brcmstb_thermal_priv *priv = tz->devdata;
> + struct brcmstb_thermal_priv *priv = thermal_zone_device_get_data(tz);
>
> dev_dbg(priv->dev, "set trips %d <--> %d\n", low, high);
>
> diff --git a/drivers/thermal/broadcom/ns-thermal.c b/drivers/thermal/broadcom/ns-thermal.c
> index 07a8a3f49bd0..98296019ad4c 100644
> --- a/drivers/thermal/broadcom/ns-thermal.c
> +++ b/drivers/thermal/broadcom/ns-thermal.c
> @@ -16,7 +16,7 @@
>
> static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - void __iomem *pvtmon = tz->devdata;
> + void __iomem *pvtmon = thermal_zone_device_get_data(tz);
> int offset = thermal_zone_get_offset(tz);
> int slope = thermal_zone_get_slope(tz);
> u32 val;
> diff --git a/drivers/thermal/broadcom/sr-thermal.c b/drivers/thermal/broadcom/sr-thermal.c
> index 2b93502543ff..42b46125f409 100644
> --- a/drivers/thermal/broadcom/sr-thermal.c
> +++ b/drivers/thermal/broadcom/sr-thermal.c
> @@ -32,7 +32,7 @@ struct sr_thermal {
>
> static int sr_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct sr_tmon *tmon = tz->devdata;
> + struct sr_tmon *tmon = thermal_zone_device_get_data(tz);
> struct sr_thermal *sr_thermal = tmon->priv;
>
> *temp = readl(sr_thermal->regs + SR_TMON_TEMP_BASE(tmon->tmon_id));
> diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c
> index a805a6666c44..3d937f701e0b 100644
> --- a/drivers/thermal/da9062-thermal.c
> +++ b/drivers/thermal/da9062-thermal.c
> @@ -123,7 +123,7 @@ static irqreturn_t da9062_thermal_irq_handler(int irq, void *data)
> static int da9062_thermal_get_temp(struct thermal_zone_device *z,
> int *temp)
> {
> - struct da9062_thermal *thermal = z->devdata;
> + struct da9062_thermal *thermal = thermal_zone_device_get_data(z);
>
> mutex_lock(&thermal->lock);
> *temp = thermal->temperature;
> diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
> index 056622a58d00..ed7d1173d9fd 100644
> --- a/drivers/thermal/dove_thermal.c
> +++ b/drivers/thermal/dove_thermal.c
> @@ -87,7 +87,7 @@ static int dove_get_temp(struct thermal_zone_device *thermal,
> int *temp)
> {
> unsigned long reg;
> - struct dove_thermal_priv *priv = thermal->devdata;
> + struct dove_thermal_priv *priv = thermal_zone_device_get_data(thermal);
>
> /* Valid check */
> reg = readl_relaxed(priv->control + PMU_TEMP_DIOD_CTRL1_REG);
> diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
> index 32a7c3cf073d..043751e6a31d 100644
> --- a/drivers/thermal/hisi_thermal.c
> +++ b/drivers/thermal/hisi_thermal.c
> @@ -431,7 +431,7 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data)
>
> static int hisi_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct hisi_thermal_sensor *sensor = tz->devdata;
> + struct hisi_thermal_sensor *sensor = thermal_zone_device_get_data(tz);
> struct hisi_thermal_data *data = sensor->data;
>
> *temp = data->ops->get_temp(sensor);
> diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
> index 72b5d6f319c1..750240f4fa32 100644
> --- a/drivers/thermal/imx8mm_thermal.c
> +++ b/drivers/thermal/imx8mm_thermal.c
> @@ -141,7 +141,7 @@ static int imx8mp_tmu_get_temp(void *data, int *temp)
>
> static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct tmu_sensor *sensor = tz->devdata;
> + struct tmu_sensor *sensor = thermal_zone_device_get_data(tz);
> struct imx8mm_tmu *tmu = sensor->priv;
>
> return tmu->socdata->get_temp(sensor, temp);
> diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c
> index f32e59e74623..ca10d6a68f0f 100644
> --- a/drivers/thermal/imx_sc_thermal.c
> +++ b/drivers/thermal/imx_sc_thermal.c
> @@ -46,7 +46,7 @@ static int imx_sc_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> struct imx_sc_msg_misc_get_temp msg;
> struct imx_sc_rpc_msg *hdr = &msg.hdr;
> - struct imx_sc_sensor *sensor = tz->devdata;
> + struct imx_sc_sensor *sensor = thermal_zone_device_get_data(tz);
> int ret;
>
> msg.data.req.resource_id = sensor->resource_id;
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
> index fb0d5cab70af..c3c14cd26aee 100644
> --- a/drivers/thermal/imx_thermal.c
> +++ b/drivers/thermal/imx_thermal.c
> @@ -252,7 +252,7 @@ static void imx_set_alarm_temp(struct imx_thermal_data *data,
>
> static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct imx_thermal_data *data = tz->devdata;
> + struct imx_thermal_data *data = thermal_zone_device_get_data(tz);
> const struct thermal_soc_data *soc_data = data->socdata;
> struct regmap *map = data->tempmon;
> unsigned int n_meas;
> @@ -311,7 +311,7 @@ static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
> static int imx_change_mode(struct thermal_zone_device *tz,
> enum thermal_device_mode mode)
> {
> - struct imx_thermal_data *data = tz->devdata;
> + struct imx_thermal_data *data = thermal_zone_device_get_data(tz);
>
> if (mode == THERMAL_DEVICE_ENABLED) {
> pm_runtime_get(data->dev);
> @@ -342,7 +342,7 @@ static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp)
> static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
> int temp)
> {
> - struct imx_thermal_data *data = tz->devdata;
> + struct imx_thermal_data *data = thermal_zone_device_get_data(tz);
> int ret;
>
> ret = pm_runtime_resume_and_get(data->dev);
> diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c
> index b855d031a855..e53f8a8c06e5 100644
> --- a/drivers/thermal/intel/intel_pch_thermal.c
> +++ b/drivers/thermal/intel/intel_pch_thermal.c
> @@ -119,7 +119,7 @@ static int pch_wpt_add_acpi_psv_trip(struct pch_thermal_device *ptd, int trip)
>
> static int pch_thermal_get_temp(struct thermal_zone_device *tzd, int *temp)
> {
> - struct pch_thermal_device *ptd = tzd->devdata;
> + struct pch_thermal_device *ptd = thermal_zone_device_get_data(tzd);
>
> *temp = GET_WPT_TEMP(WPT_TEMP_TSR & readw(ptd->hw_base + WPT_TEMP));
> return 0;
> diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c
> index 8c26f7b2316b..f7d995722e04 100644
> --- a/drivers/thermal/intel/intel_soc_dts_iosf.c
> +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
> @@ -54,7 +54,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, int trip,
> struct intel_soc_dts_sensor_entry *dts;
> struct intel_soc_dts_sensors *sensors;
>
> - dts = tzd->devdata;
> + dts = thermal_zone_device_get_data(tzd);
> sensors = dts->sensors;
> mutex_lock(&sensors->dts_update_lock);
> status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ,
> @@ -168,7 +168,7 @@ static int update_trip_temp(struct intel_soc_dts_sensor_entry *dts,
> static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
> int temp)
> {
> - struct intel_soc_dts_sensor_entry *dts = tzd->devdata;
> + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_get_data(tzd);
> struct intel_soc_dts_sensors *sensors = dts->sensors;
> int status;
>
> @@ -176,7 +176,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
> return -EINVAL;
>
> mutex_lock(&sensors->dts_update_lock);
> - status = update_trip_temp(tzd->devdata, trip, temp,
> + status = update_trip_temp(dts, trip, temp,
> dts->trip_types[trip]);
> mutex_unlock(&sensors->dts_update_lock);
>
> @@ -186,9 +186,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
> static int sys_get_trip_type(struct thermal_zone_device *tzd,
> int trip, enum thermal_trip_type *type)
> {
> - struct intel_soc_dts_sensor_entry *dts;
> -
> - dts = tzd->devdata;
> + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_get_data(tzd);
>
> *type = dts->trip_types[trip];
>
> @@ -200,11 +198,10 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd,
> {
> int status;
> u32 out;
> - struct intel_soc_dts_sensor_entry *dts;
> + struct intel_soc_dts_sensor_entry *dts = thermal_zone_device_get_data(tzd);
> struct intel_soc_dts_sensors *sensors;
> unsigned long raw;
>
> - dts = tzd->devdata;
> sensors = dts->sensors;
> status = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ,
> SOC_DTS_OFFSET_TEMP, &out);
> diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c
> index 1c2de84742df..22f0f206d8f2 100644
> --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c
> +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c
> @@ -107,7 +107,7 @@ static struct zone_device *pkg_temp_thermal_get_dev(unsigned int cpu)
>
> static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
> {
> - struct zone_device *zonedev = tzd->devdata;
> + struct zone_device *zonedev = thermal_zone_device_get_data(tzd);
> int val;
>
> val = intel_tcc_get_temp(zonedev->cpu, true);
> @@ -122,7 +122,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
> static int
> sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp)
> {
> - struct zone_device *zonedev = tzd->devdata;
> + struct zone_device *zonedev = thermal_zone_device_get_data(tzd);
> u32 l, h, mask, shift, intr;
> int tj_max, ret;
>
> diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c
> index 22c9bcb899c3..8cbd7361b492 100644
> --- a/drivers/thermal/k3_bandgap.c
> +++ b/drivers/thermal/k3_bandgap.c
> @@ -141,7 +141,7 @@ static int k3_bgp_read_temp(struct k3_thermal_data *devdata,
>
> static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct k3_thermal_data *data = tz->devdata;
> + struct k3_thermal_data *data = thermal_zone_device_get_data(tz);
> int ret = 0;
>
> ret = k3_bgp_read_temp(data, temp);
> diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
> index 031ea1091909..300a3f985776 100644
> --- a/drivers/thermal/k3_j72xx_bandgap.c
> +++ b/drivers/thermal/k3_j72xx_bandgap.c
> @@ -248,7 +248,7 @@ static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata,
> /* Get temperature callback function for thermal zone */
> static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - return k3_bgp_read_temp(tz->devdata, temp);
> + return k3_bgp_read_temp(thermal_zone_device_get_data(tz), temp);
> }
>
> static const struct thermal_zone_device_ops k3_of_thermal_ops = {
> diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c
> index bec7ec20e79d..8e39c875ba58 100644
> --- a/drivers/thermal/kirkwood_thermal.c
> +++ b/drivers/thermal/kirkwood_thermal.c
> @@ -27,7 +27,7 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal,
> int *temp)
> {
> unsigned long reg;
> - struct kirkwood_thermal_priv *priv = thermal->devdata;
> + struct kirkwood_thermal_priv *priv = thermal_zone_device_get_data(thermal);
>
> reg = readl_relaxed(priv->sensor);
>
> diff --git a/drivers/thermal/max77620_thermal.c b/drivers/thermal/max77620_thermal.c
> index 6451a55eb582..05b6e9a2a283 100644
> --- a/drivers/thermal/max77620_thermal.c
> +++ b/drivers/thermal/max77620_thermal.c
> @@ -46,7 +46,7 @@ struct max77620_therm_info {
>
> static int max77620_thermal_read_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct max77620_therm_info *mtherm = tz->devdata;
> + struct max77620_therm_info *mtherm = thermal_zone_device_get_data(tz);
> unsigned int val;
> int ret;
>
> diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> index ab730f9552d0..d7bf725d224b 100644
> --- a/drivers/thermal/mediatek/auxadc_thermal.c
> +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> @@ -763,7 +763,7 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
>
> static int mtk_read_temp(struct thermal_zone_device *tz, int *temperature)
> {
> - struct mtk_thermal *mt = tz->devdata;
> + struct mtk_thermal *mt = thermal_zone_device_get_data(tz);
> int i;
> int tempmax = INT_MIN;
>
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index 84ba65a27acf..86d280187c83 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperature)
>
> static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct lvts_sensor *lvts_sensor = tz->devdata;
> + struct lvts_sensor *lvts_sensor = thermal_zone_device_get_data(tz);
> void __iomem *msr = lvts_sensor->msr;
> u32 value;
>
> @@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
>
> static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct lvts_sensor *lvts_sensor = tz->devdata;
> + struct lvts_sensor *lvts_sensor = thermal_zone_device_get_data(tz);
> void __iomem *base = lvts_sensor->base;
> u32 raw_low = lvts_temp_to_raw(low);
> u32 raw_high = lvts_temp_to_raw(high);
> diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> index 31164ade2dd1..b0269daf128a 100644
> --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> @@ -360,7 +360,7 @@ static irqreturn_t adc_tm5_gen2_isr(int irq, void *data)
>
> static int adc_tm5_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct adc_tm5_channel *channel = tz->devdata;
> + struct adc_tm5_channel *channel = thermal_zone_device_get_data(tz);
> int ret;
>
> if (!channel || !channel->iio)
> @@ -642,7 +642,7 @@ static int adc_tm5_gen2_configure(struct adc_tm5_channel *channel, int low, int
>
> static int adc_tm5_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct adc_tm5_channel *channel = tz->devdata;
> + struct adc_tm5_channel *channel = thermal_zone_device_get_data(tz);
> struct adc_tm5_chip *chip;
> int ret;
>
> diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> index 101c75d0e13f..c817b03deb00 100644
> --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> @@ -187,7 +187,7 @@ static int qpnp_tm_update_temp_no_adc(struct qpnp_tm_chip *chip)
>
> static int qpnp_tm_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct qpnp_tm_chip *chip = tz->devdata;
> + struct qpnp_tm_chip *chip = thermal_zone_device_get_data(tz);
> int ret, mili_celsius;
>
> if (!temp)
> @@ -265,7 +265,7 @@ static int qpnp_tm_update_critical_trip_temp(struct qpnp_tm_chip *chip,
>
> static int qpnp_tm_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp)
> {
> - struct qpnp_tm_chip *chip = tz->devdata;
> + struct qpnp_tm_chip *chip = thermal_zone_device_get_data(tz);
> struct thermal_trip trip;
> int ret;
>
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index 431c29c0898a..8b6fe0c9ade2 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -83,7 +83,7 @@ static struct qoriq_tmu_data *qoriq_sensor_to_data(struct qoriq_sensor *s)
>
> static int tmu_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct qoriq_sensor *qsensor = tz->devdata;
> + struct qoriq_sensor *qsensor = thermal_zone_device_get_data(tz);
> struct qoriq_tmu_data *qdata = qoriq_sensor_to_data(qsensor);
> u32 val;
> /*
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index d6b5b59c5c53..8ad713cb4bf7 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -167,7 +167,7 @@ static int rcar_gen3_thermal_round(int temp)
>
> static int rcar_gen3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct rcar_gen3_thermal_tsc *tsc = tz->devdata;
> + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_get_data(tz);
> int mcelsius, val;
> int reg;
>
> @@ -206,7 +206,7 @@ static int rcar_gen3_thermal_mcelsius_to_temp(struct rcar_gen3_thermal_tsc *tsc,
>
> static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct rcar_gen3_thermal_tsc *tsc = tz->devdata;
> + struct rcar_gen3_thermal_tsc *tsc = thermal_zone_device_get_data(tz);
> u32 irqmsk = 0;
>
> if (low != -INT_MAX) {
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 436f5f9cf729..538ed6731589 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -101,7 +101,6 @@ struct rcar_thermal_priv {
> list_for_each_entry(pos, &common->head, list)
>
> #define MCELSIUS(temp) ((temp) * 1000)
> -#define rcar_zone_to_priv(zone) ((zone)->devdata)
> #define rcar_priv_to_dev(priv) ((priv)->common->dev)
> #define rcar_has_irq_support(priv) ((priv)->common->base)
> #define rcar_id_to_shift(priv) ((priv)->id * 8)
> @@ -273,7 +272,7 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
>
> static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> {
> - struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> + struct rcar_thermal_priv *priv = thermal_zone_device_get_data(zone);
>
> return rcar_thermal_get_current_temp(priv, temp);
> }
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index 4b7c43f34d1a..dafbdbb7c0c0 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -1213,7 +1213,7 @@ static irqreturn_t rockchip_thermal_alarm_irq_thread(int irq, void *dev)
>
> static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct rockchip_thermal_sensor *sensor = tz->devdata;
> + struct rockchip_thermal_sensor *sensor = thermal_zone_device_get_data(tz);
> struct rockchip_thermal_data *thermal = sensor->thermal;
> const struct rockchip_tsadc_chip *tsadc = thermal->chip;
>
> @@ -1226,7 +1226,7 @@ static int rockchip_thermal_set_trips(struct thermal_zone_device *tz, int low, i
>
> static int rockchip_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp)
> {
> - struct rockchip_thermal_sensor *sensor = tz->devdata;
> + struct rockchip_thermal_sensor *sensor = thermal_zone_device_get_data(tz);
> struct rockchip_thermal_data *thermal = sensor->thermal;
> const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip;
> int retval;
> diff --git a/drivers/thermal/rzg2l_thermal.c b/drivers/thermal/rzg2l_thermal.c
> index 2e0649f38506..d3ba2a74e42d 100644
> --- a/drivers/thermal/rzg2l_thermal.c
> +++ b/drivers/thermal/rzg2l_thermal.c
> @@ -75,7 +75,7 @@ static inline void rzg2l_thermal_write(struct rzg2l_thermal_priv *priv, u32 reg,
>
> static int rzg2l_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct rzg2l_thermal_priv *priv = tz->devdata;
> + struct rzg2l_thermal_priv *priv = thermal_zone_device_get_data(tz);
> u32 result = 0, dsensor, ts_code_ave;
> int val, i;
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 527d1eb0663a..a2301e235a2b 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -645,7 +645,7 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)
>
> static int exynos_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct exynos_tmu_data *data = tz->devdata;
> + struct exynos_tmu_data *data = thermal_zone_device_get_data(tz);
> int value, ret = 0;
>
> if (!data || !data->tmu_read)
> @@ -723,7 +723,7 @@ static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
>
> static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp)
> {
> - struct exynos_tmu_data *data = tz->devdata;
> + struct exynos_tmu_data *data = thermal_zone_device_get_data(tz);
> int ret = -EINVAL;
>
> if (data->soc == SOC_ARCH_EXYNOS4210)
> diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c
> index 6a722b10d738..62cd9305eb9c 100644
> --- a/drivers/thermal/spear_thermal.c
> +++ b/drivers/thermal/spear_thermal.c
> @@ -31,7 +31,7 @@ struct spear_thermal_dev {
> static inline int thermal_get_temp(struct thermal_zone_device *thermal,
> int *temp)
> {
> - struct spear_thermal_dev *stdev = thermal->devdata;
> + struct spear_thermal_dev *stdev = thermal_zone_device_get_data(thermal);
>
> /*
> * Data are ready to be read after 628 usec from POWERDOWN signal
> @@ -48,7 +48,7 @@ static struct thermal_zone_device_ops ops = {
> static int __maybe_unused spear_thermal_suspend(struct device *dev)
> {
> struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
> - struct spear_thermal_dev *stdev = spear_thermal->devdata;
> + struct spear_thermal_dev *stdev = thermal_zone_device_get_data(spear_thermal);
> unsigned int actual_mask = 0;
>
> /* Disable SPEAr Thermal Sensor */
> @@ -64,7 +64,7 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev)
> static int __maybe_unused spear_thermal_resume(struct device *dev)
> {
> struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
> - struct spear_thermal_dev *stdev = spear_thermal->devdata;
> + struct spear_thermal_dev *stdev = thermal_zone_device_get_data(spear_thermal);
> unsigned int actual_mask = 0;
> int ret = 0;
>
> @@ -154,7 +154,7 @@ static int spear_thermal_exit(struct platform_device *pdev)
> {
> unsigned int actual_mask = 0;
> struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
> - struct spear_thermal_dev *stdev = spear_thermal->devdata;
> + struct spear_thermal_dev *stdev = thermal_zone_device_get_data(spear_thermal);
>
> thermal_zone_device_unregister(spear_thermal);
>
> diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c
> index ac884514f116..69078a55dc0c 100644
> --- a/drivers/thermal/sprd_thermal.c
> +++ b/drivers/thermal/sprd_thermal.c
> @@ -206,7 +206,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen)
>
> static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct sprd_thermal_sensor *sen = tz->devdata;
> + struct sprd_thermal_sensor *sen = thermal_zone_device_get_data(tz);
> u32 data;
>
> data = readl(sen->data->base + SPRD_THM_TEMP(sen->id)) &
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 497beac63e5d..085b7b0b7c72 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -110,7 +110,7 @@ static int sun50i_h5_calc_temp(struct ths_device *tmdev,
>
> static int sun8i_ths_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct tsensor *s = tz->devdata;
> + struct tsensor *s = thermal_zone_device_get_data(tz);
> struct ths_device *tmdev = s->tmdev;
> int val = 0;
>
> diff --git a/drivers/thermal/tegra/tegra-bpmp-thermal.c b/drivers/thermal/tegra/tegra-bpmp-thermal.c
> index 0b7a1a1948cb..31a660b009fc 100644
> --- a/drivers/thermal/tegra/tegra-bpmp-thermal.c
> +++ b/drivers/thermal/tegra/tegra-bpmp-thermal.c
> @@ -62,12 +62,14 @@ static int __tegra_bpmp_thermal_get_temp(struct tegra_bpmp_thermal_zone *zone,
>
> static int tegra_bpmp_thermal_get_temp(struct thermal_zone_device *tz, int *out_temp)
> {
> - return __tegra_bpmp_thermal_get_temp(tz->devdata, out_temp);
> + struct tegra_bpmp_thermal_zone *zone = thermal_zone_device_get_data(tz);
> +
> + return __tegra_bpmp_thermal_get_temp(zone, out_temp);
> }
>
> static int tegra_bpmp_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct tegra_bpmp_thermal_zone *zone = tz->devdata;
> + struct tegra_bpmp_thermal_zone *zone = thermal_zone_device_get_data(tz);
> struct mrq_thermal_host_to_bpmp_request req;
> struct tegra_bpmp_message msg;
> int err;
> diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c
> index b3218b71b6d9..537413acc6d2 100644
> --- a/drivers/thermal/tegra/tegra30-tsensor.c
> +++ b/drivers/thermal/tegra/tegra30-tsensor.c
> @@ -160,7 +160,7 @@ static void devm_tegra_tsensor_hw_disable(void *data)
>
> static int tegra_tsensor_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - const struct tegra_tsensor_channel *tsc = tz->devdata;
> + const struct tegra_tsensor_channel *tsc = thermal_zone_device_get_data(tz);
> const struct tegra_tsensor *ts = tsc->ts;
> int err, c1, c2, c3, c4, counter;
> u32 val;
> @@ -218,7 +218,7 @@ static int tegra_tsensor_temp_to_counter(const struct tegra_tsensor *ts, int tem
>
> static int tegra_tsensor_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - const struct tegra_tsensor_channel *tsc = tz->devdata;
> + const struct tegra_tsensor_channel *tsc = thermal_zone_device_get_data(tz);
> const struct tegra_tsensor *ts = tsc->ts;
> u32 val;
>
> diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c
> index 323e273e3298..8e2ff0df7e64 100644
> --- a/drivers/thermal/thermal-generic-adc.c
> +++ b/drivers/thermal/thermal-generic-adc.c
> @@ -54,7 +54,7 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
>
> static int gadc_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct gadc_thermal_info *gti = tz->devdata;
> + struct gadc_thermal_info *gti = thermal_zone_device_get_data(tz);
> int val;
> int ret;
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 0675df54c8e6..05e5a6bda695 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1378,6 +1378,12 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, int n
> }
> EXPORT_SYMBOL_GPL(thermal_zone_device_register);
>
> +void *thermal_zone_device_get_data(struct thermal_zone_device *tzd)
> +{
> + return tzd->devdata;
> +}
> +EXPORT_SYMBOL_GPL(thermal_zone_device_get_data);
> +
> /**
> * thermal_zone_device_unregister - removes the registered thermal zone device
> * @tz: the thermal zone device to remove
> diff --git a/drivers/thermal/thermal_mmio.c b/drivers/thermal/thermal_mmio.c
> index ea616731066c..05a70205f86f 100644
> --- a/drivers/thermal/thermal_mmio.c
> +++ b/drivers/thermal/thermal_mmio.c
> @@ -23,7 +23,7 @@ static u32 thermal_mmio_readb(void __iomem *mmio_base)
> static int thermal_mmio_get_temperature(struct thermal_zone_device *tz, int *temp)
> {
> int t;
> - struct thermal_mmio *sensor = tz->devdata;
> + struct thermal_mmio *sensor = thermal_zone_device_get_data(tz);
>
> t = sensor->read_mmio(sensor->mmio_base) & sensor->mask;
> t *= sensor->factor;
> diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> index 8a9055bd376e..7f6b71d11eed 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> @@ -68,7 +68,7 @@ static inline int ti_thermal_hotspot_temperature(int t, int s, int c)
> static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> struct thermal_zone_device *pcb_tz = NULL;
> - struct ti_thermal_data *data = tz->devdata;
> + struct ti_thermal_data *data = thermal_zone_device_get_data(tz);
> struct ti_bandgap *bgp;
> const struct ti_temp_sensor *s;
> int ret, tmp, slope, constant;
> @@ -109,7 +109,7 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem
>
> static int __ti_thermal_get_trend(struct thermal_zone_device *tz, int trip, enum thermal_trend *trend)
> {
> - struct ti_thermal_data *data = tz->devdata;
> + struct ti_thermal_data *data = thermal_zone_device_get_data(tz);
> struct ti_bandgap *bgp;
> int id, tr, ret = 0;
>
> diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
> index 47801841b3f5..25247de7780c 100644
> --- a/drivers/thermal/uniphier_thermal.c
> +++ b/drivers/thermal/uniphier_thermal.c
> @@ -187,7 +187,7 @@ static void uniphier_tm_disable_sensor(struct uniphier_tm_dev *tdev)
>
> static int uniphier_tm_get_temp(struct thermal_zone_device *tz, int *out_temp)
> {
> - struct uniphier_tm_dev *tdev = tz->devdata;
> + struct uniphier_tm_dev *tdev = thermal_zone_device_get_data(tz);
> struct regmap *map = tdev->regmap;
> int ret;
> u32 temp;
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 2bb4bf33f4f3..724b95662da9 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -365,6 +365,8 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int
> void *, struct thermal_zone_device_ops *,
> struct thermal_zone_params *, int, int);
>
> +void *thermal_zone_device_get_data(struct thermal_zone_device *tzd);
> +
> int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
> struct thermal_cooling_device *,
> unsigned long, unsigned long,
For iwlwifi:
Acked-by: Gregory Greenman <gregory.greenman@intel.com>
Gregory
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Balsam CHIHI @ 2023-02-20 10:34 UTC (permalink / raw)
To: Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Zhang Rui, Len Brown,
Damien Le Moal, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Jean Delvare, Guenter Roeck,
Jonathan Cameron, Lars-Peter Clausen, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Dmitry Torokhov, Raju Rangoju,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ido Schimmel, Petr Machata, Gregory Greenman, Kalle Valo,
Sebastian Reichel, Liam Girdwood, Mark Brown, Miquel Raynal,
Amit Kucheria, Florian Fainelli,
Broadcom internal kernel review list, Ray Jui, Scott Branden,
Markus Mayer, Support Opensource, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Thara Gopinath, Niklas Söderlund,
Heiko Stuebner, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
Alim Akhtar, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vasily Khoruzhick, Yangtao Li, Thierry Reding, Jonathan Hunter,
Talel Shenhar, Eduardo Valentin, Keerthy, Kunihiko Hayashi,
Masami Hiramatsu, Matthias Brugger, AngeloGioacchino Del Regno,
Stefan Wahren, Neil Armstrong, ye xingchen, Zheng Yongjun,
Tim Zimmermann, Yang Li, Srinivas Pandruvada, Ricardo Neri,
Jiang Jian, Daniel Golle, Randy Dunlap, Mikko Perttunen,
open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org>
On Sun, Feb 19, 2023 at 3:37 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> The thermal zone device structure is exposed to the different drivers
> and obviously they access the internals while that should be
> restricted to the core thermal code.
>
> In order to self-encapsulate the thermal core code, we need to prevent
> the drivers accessing directly the thermal zone structure and provide
> accessor functions to deal with.
>
> Provide an accessor to the 'devdata' structure and make use of it in
> the different drivers.
>
> No functional changes intended.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
[...]
> drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
[...]
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index 84ba65a27acf..86d280187c83 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -252,7 +252,7 @@ static u32 lvts_temp_to_raw(int temperature)
>
> static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct lvts_sensor *lvts_sensor = tz->devdata;
> + struct lvts_sensor *lvts_sensor = thermal_zone_device_get_data(tz);
> void __iomem *msr = lvts_sensor->msr;
> u32 value;
>
> @@ -290,7 +290,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
>
> static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
> {
> - struct lvts_sensor *lvts_sensor = tz->devdata;
> + struct lvts_sensor *lvts_sensor = thermal_zone_device_get_data(tz);
> void __iomem *base = lvts_sensor->base;
> u32 raw_low = lvts_temp_to_raw(low);
> u32 raw_high = lvts_temp_to_raw(high);
for MediaTek LVTS :
Reviewed-by: Balsam CHIHI <bchihi@baylibre.com>
^ permalink raw reply
* Re: [PATCH v3 3/3] arm64: dts: qcom: sdm845-oneplus: add alert-slider
From: Konrad Dybcio @ 2023-02-20 10:17 UTC (permalink / raw)
To: Gergo Koteles, Dmitry Torokhov, Jonathan Corbet, Andy Gross,
Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly
In-Reply-To: <16e6c00389bf0ee881a055f81a3dbfd5bfc9c469.1676850819.git.soyer@irl.hu>
On 20.02.2023 01:13, Gergo Koteles wrote:
> The alert-slider is a tri-state sound profile switch found on the OnePlus 6,
> Android maps the states to "silent", "vibrate" and "ring". Expose them as
> ABS_SND_PROFILE events.
> The previous GPIO numbers were wrong. Update them to the correct
> ones.
>
> Co-developed-by: Caleb Connolly <caleb@connolly.tech>
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> Signed-off-by: Gergo Koteles <soyer@irl.hu>
> ---
> .../boot/dts/qcom/sdm845-oneplus-common.dtsi | 43 ++++++++++++++++++-
> 1 file changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> index 64638ea94db7..ff982dd853a9 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> @@ -52,6 +52,45 @@ key-vol-up {
> };
> };
>
> + alert-slider {
This is out of order, alphabetically.
> + compatible = "gpio-keys";
> + label = "Alert slider";
> +
> + pinctrl-0 = <&alert_slider_default>;
> + pinctrl-names = "default";
> +
> + switch-top {
> + label = "Silent";
> + linux,input-type = <EV_ABS>;
> + linux,code = <ABS_SND_PROFILE>;
> + linux,input-value = <SND_PROFILE_SILENT>;
> + gpios = <&tlmm 126 GPIO_ACTIVE_LOW>;
> + debounce-interval = <50>;
Is there a reason it can't be the default 5ms, since it should
more or less be a simple input ping to the userspace?
Other than that:
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
> + linux,can-disable;
> + };
> +
> + switch-middle {
> + label = "Vibrate";
> + linux,input-type = <EV_ABS>;
> + linux,code = <ABS_SND_PROFILE>;
> + linux,input-value = <SND_PROFILE_VIBRATE>;
> + gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
> + debounce-interval = <50>;
> + linux,can-disable;
> +
> + };
> +
> + switch-bottom {
> + label = "Ring";
> + linux,input-type = <EV_ABS>;
> + linux,code = <ABS_SND_PROFILE>;
> + linux,input-value = <SND_PROFILE_RING>;
> + gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;
> + debounce-interval = <50>;
> + linux,can-disable;
> + };
> + };
> +
> reserved-memory {
> /*
> * The rmtfs_mem needs to be guarded due to "XPU limitations"
> @@ -753,8 +792,8 @@ &usb_1_hsphy {
> &tlmm {
> gpio-reserved-ranges = <0 4>, <81 4>;
>
> - tri_state_key_default: tri-state-key-default-state {
> - pins = "gpio40", "gpio42", "gpio26";
> + alert_slider_default: alert-slider-default-state {
> + pins = "gpio126", "gpio52", "gpio24";
> function = "gpio";
> drive-strength = <2>;
> bias-disable;
^ permalink raw reply
* Re: [PATCH v2] HID: mcp-2221: prevent UAF in delayed work
From: Benjamin Tissoires @ 2023-02-20 9:43 UTC (permalink / raw)
To: Rishi Gupta, Jiri Kosina, Pietro Borrello, Benjamin Tissoires
Cc: linux-input, linux-kernel
In-Reply-To: <20230215-wip-mcp2221-v2-1-109f71fd036e@redhat.com>
On Thu, 16 Feb 2023 11:22:58 +0100, Benjamin Tissoires wrote:
> If the device is plugged/unplugged without giving time for mcp_init_work()
> to complete, we might kick in the devm free code path and thus have
> unavailable struct mcp_2221 while in delayed work.
>
> Canceling the delayed_work item is enough to solve the issue, because
> cancel_delayed_work_sync will prevent the work item to requeue itself.
>
> [...]
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git (for-6.3/mcp2221), thanks!
[1/1] HID: mcp-2221: prevent UAF in delayed work
https://git.kernel.org/hid/hid/c/47e91fdfa511
Cheers,
--
Benjamin Tissoires <benjamin.tissoires@redhat.com>
^ permalink raw reply
* Re: [PATCH v2] HID: mcp-2221: prevent UAF in delayed work
From: Benjamin Tissoires @ 2023-02-20 9:31 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Rishi Gupta, Pietro Borrello, linux-input, linux-kernel
In-Reply-To: <nycvar.YFH.7.76.2302201009430.1142@cbobk.fhfr.pm>
On Mon, Feb 20, 2023 at 10:10 AM Jiri Kosina <jikos@kernel.org> wrote:
>
> On Thu, 16 Feb 2023, Benjamin Tissoires wrote:
>
> > If the device is plugged/unplugged without giving time for mcp_init_work()
> > to complete, we might kick in the devm free code path and thus have
> > unavailable struct mcp_2221 while in delayed work.
> >
> > Canceling the delayed_work item is enough to solve the issue, because
> > cancel_delayed_work_sync will prevent the work item to requeue itself.
> >
> > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>
> Acked-by: Jiri Kosina <jkosina@suse.cz>
Thanks a lot.
I realized I was missing the Fixes 960f9df7c620 and Cc: stable tags.
I am adding those right now and will push it as soon as the minimum CI
reports back that it's OK.
Cheers,
Benjamin
>
> Thanks Benjamin.
>
> --
> Jiri Kosina
> SUSE Labs
>
^ permalink raw reply
* Re: [PATCH v2] HID: mcp-2221: prevent UAF in delayed work
From: Jiri Kosina @ 2023-02-20 9:09 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Rishi Gupta, Pietro Borrello, linux-input, linux-kernel
In-Reply-To: <20230215-wip-mcp2221-v2-1-109f71fd036e@redhat.com>
On Thu, 16 Feb 2023, Benjamin Tissoires wrote:
> If the device is plugged/unplugged without giving time for mcp_init_work()
> to complete, we might kick in the devm free code path and thus have
> unavailable struct mcp_2221 while in delayed work.
>
> Canceling the delayed_work item is enough to solve the issue, because
> cancel_delayed_work_sync will prevent the work item to requeue itself.
>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Thanks Benjamin.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: AngeloGioacchino Del Regno @ 2023-02-20 9:09 UTC (permalink / raw)
To: Daniel Lezcano, rafael
Cc: linux-pm, linux-kernel, Zhang Rui, Len Brown, Damien Le Moal,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Jean Delvare, Guenter Roeck, Jonathan Cameron,
Lars-Peter Clausen, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Dmitry Torokhov, Raju Rangoju, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Ido Schimmel, Petr Machata,
Gregory Greenman, Kalle Valo, Sebastian Reichel, Liam Girdwood,
Mark Brown, Miquel Raynal, Amit Kucheria, Florian Fainelli,
Broadcom internal kernel review list, Ray Jui, Scott Branden,
Markus Mayer, Support Opensource, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Thara Gopinath, Niklas Söderlund,
Heiko Stuebner, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
Alim Akhtar, Orson Zhai, Baolin Wang, Chunyan Zhang,
Vasily Khoruzhick, Yangtao Li, Thierry Reding, Jonathan Hunter,
Talel Shenhar, Eduardo Valentin, Keerthy, Kunihiko Hayashi,
Masami Hiramatsu, Matthias Brugger, Stefan Wahren, Neil Armstrong,
ye xingchen, Zheng Yongjun, Tim Zimmermann, Yang Li,
Srinivas Pandruvada, Ricardo Neri, Jiang Jian, Daniel Golle,
Balsam CHIHI, Randy Dunlap, Mikko Perttunen,
open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org>
Il 19/02/23 15:36, Daniel Lezcano ha scritto:
> The thermal zone device structure is exposed to the different drivers
> and obviously they access the internals while that should be
> restricted to the core thermal code.
>
> In order to self-encapsulate the thermal core code, we need to prevent
> the drivers accessing directly the thermal zone structure and provide
> accessor functions to deal with.
>
> Provide an accessor to the 'devdata' structure and make use of it in
> the different drivers.
>
> No functional changes intended.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/thermal/mediatek/auxadc_thermal.c | 2 +-
> drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
For MediaTek auxadc and lvts:
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply
* Re: [PATCH v4 2/2] HID: hid-apple-magic-backlight: Add driver for keyboard backlight on internal Magic Keyboards
From: Aditya Garg @ 2023-02-20 8:33 UTC (permalink / raw)
To: Orlando Chamberlain
Cc: linux-doc@vger.kernel.org, linux-input@vger.kernel.org,
Jonathan Corbet, Jiri Kosina, Benjamin Tissoires,
linux-kernel@vger.kernel.org, Pavel Machek, Aun-Ali Zaidi,
Kerem Karabay, Andy Shevchenko, Thomas Weißschuh,
Andy Shevchenko, Thomas Weißschuh
In-Reply-To: <20230218090709.7467-3-orlandoch.dev@gmail.com>
> On 18-Feb-2023, at 2:38 PM, Orlando Chamberlain <orlandoch.dev@gmail.com> wrote:
>
> This driver adds support for the keyboard backlight on Intel T2 Macs
> with internal Magic Keyboards (MacBookPro16,x and MacBookAir9,1)
>
> Co-developed-by: Kerem Karabay <kekrby@gmail.com>
> Signed-off-by: Kerem Karabay <kekrby@gmail.com>
> Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> v3->v4:
> - collect reviews from Andy and Thomas
> - remove now unused hdev member of apple_magic_backlight
> v2->v3:
> - remove unneeded inclusion
> - use s32 for report value type
> - remove unneeded null check
> - don't set drvdata as its never used
> - prepend "hid-" to module name
> v1->v2:
> - drop unneeded remove function
> - combine set functions
> - add missing header inclusions
> - avoid char as argument in favour of u8
> - handful of style/formatting fixes
> - use standard led name ":white:kbd_backlight"
> - rename USAGE_MAGIC_BL to HID_USAGE_MAGIC_BL
>
> MAINTAINERS | 6 ++
> drivers/hid/Kconfig | 13 +++
> drivers/hid/Makefile | 1 +
> drivers/hid/hid-apple-magic-backlight.c | 120 ++++++++++++++++++++++++
> 4 files changed, 140 insertions(+)
> create mode 100644 drivers/hid/hid-apple-magic-backlight.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index fb1471cb5ed3..3319f0c3ed1e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9201,6 +9201,12 @@ F: include/linux/pm.h
> F: include/linux/suspend.h
> F: kernel/power/
>
> +HID APPLE MAGIC BACKLIGHT DRIVER
> +M: Orlando Chamberlain <orlandoch.dev@gmail.com>
> +L: linux-input@vger.kernel.org
> +S: Maintained
> +F: drivers/hid/apple-magic-backlight.c
drivers/hid/hid-apple-magic-backlight.c
Looks like you forgot to change that.
> +
> HID CORE LAYER
> M: Jiri Kosina <jikos@kernel.org>
> M: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
> index e2a5d30c8895..fe489632bfd9 100644
> --- a/drivers/hid/Kconfig
> +++ b/drivers/hid/Kconfig
> @@ -130,6 +130,19 @@ config HID_APPLE
> Say Y here if you want support for keyboards of Apple iBooks, PowerBooks,
> MacBooks, MacBook Pros and Apple Aluminum.
>
> +config HID_APPLE_MAGIC_BACKLIGHT
> + tristate "Apple Magic Keyboard Backlight"
> + depends on USB_HID
> + depends on LEDS_CLASS
> + depends on NEW_LEDS
> + help
> + Say Y here if you want support for the keyboard backlight on Macs with
> + the magic keyboard (MacBookPro16,x and MacBookAir9,1). Note that this
> + driver is not for external magic keyboards.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called hid-apple-magic-backlight.
> +
> config HID_APPLEIR
> tristate "Apple infrared receiver"
> depends on (USB_HID)
> diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
> index e8014c1a2f8b..dc8df002bc86 100644
> --- a/drivers/hid/Makefile
> +++ b/drivers/hid/Makefile
> @@ -26,6 +26,7 @@ obj-$(CONFIG_HID_ACCUTOUCH) += hid-accutouch.o
> obj-$(CONFIG_HID_ALPS) += hid-alps.o
> obj-$(CONFIG_HID_ACRUX) += hid-axff.o
> obj-$(CONFIG_HID_APPLE) += hid-apple.o
> +obj-$(CONFIG_HID_APPLE_MAGIC_BACKLIGHT) += hid-apple-magic-backlight.o
> obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
> obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o
> obj-$(CONFIG_HID_ASUS) += hid-asus.o
> diff --git a/drivers/hid/hid-apple-magic-backlight.c b/drivers/hid/hid-apple-magic-backlight.c
> new file mode 100644
> index 000000000000..f0fc02ff3b2d
> --- /dev/null
> +++ b/drivers/hid/hid-apple-magic-backlight.c
> @@ -0,0 +1,120 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Apple Magic Keyboard Backlight Driver
> + *
> + * For Intel Macs with internal Magic Keyboard (MacBookPro16,1-4 and MacBookAir9,1)
> + *
> + * Copyright (c) 2022 Kerem Karabay <kekrby@gmail.com>
> + * Copyright (c) 2023 Orlando Chamberlain <orlandoch.dev@gmail.com>
> + */
> +
> +#include <linux/hid.h>
> +#include <linux/leds.h>
> +#include <linux/device.h>
> +#include <linux/errno.h>
> +#include <dt-bindings/leds/common.h>
> +
> +#include "hid-ids.h"
> +
> +#define HID_USAGE_MAGIC_BL 0xff00000f
> +
> +#define APPLE_MAGIC_REPORT_ID_POWER 3
> +#define APPLE_MAGIC_REPORT_ID_BRIGHTNESS 1
> +
> +struct apple_magic_backlight {
> + struct led_classdev cdev;
> + struct hid_report *brightness;
> + struct hid_report *power;
> +};
> +
> +static void apple_magic_backlight_report_set(struct hid_report *rep, s32 value, u8 rate)
> +{
> + rep->field[0]->value[0] = value;
> + rep->field[1]->value[0] = 0x5e; /* Mimic Windows */
> + rep->field[1]->value[0] |= rate << 8;
> +
> + hid_hw_request(rep->device, rep, HID_REQ_SET_REPORT);
> +}
> +
> +static void apple_magic_backlight_set(struct apple_magic_backlight *backlight,
> + int brightness, char rate)
> +{
> + apple_magic_backlight_report_set(backlight->power, brightness ? 1 : 0, rate);
> + if (brightness)
> + apple_magic_backlight_report_set(backlight->brightness, brightness, rate);
> +}
> +
> +static int apple_magic_backlight_led_set(struct led_classdev *led_cdev,
> + enum led_brightness brightness)
> +{
> + struct apple_magic_backlight *backlight = container_of(led_cdev,
> + struct apple_magic_backlight, cdev);
> +
> + apple_magic_backlight_set(backlight, brightness, 1);
> + return 0;
> +}
> +
> +static int apple_magic_backlight_probe(struct hid_device *hdev,
> + const struct hid_device_id *id)
> +{
> + struct apple_magic_backlight *backlight;
> + int rc;
> +
> + rc = hid_parse(hdev);
> + if (rc)
> + return rc;
> +
> + /*
> + * Ensure this usb endpoint is for the keyboard backlight, not touchbar
> + * backlight.
> + */
> + if (hdev->collection[0].usage != HID_USAGE_MAGIC_BL)
> + return -ENODEV;
> +
> + backlight = devm_kzalloc(&hdev->dev, sizeof(*backlight), GFP_KERNEL);
> + if (!backlight)
> + return -ENOMEM;
> +
> + rc = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> + if (rc)
> + return rc;
> +
> + backlight->brightness = hid_register_report(hdev, HID_FEATURE_REPORT,
> + APPLE_MAGIC_REPORT_ID_BRIGHTNESS, 0);
> + backlight->power = hid_register_report(hdev, HID_FEATURE_REPORT,
> + APPLE_MAGIC_REPORT_ID_POWER, 0);
> +
> + if (!backlight->brightness || !backlight->power) {
> + rc = -ENODEV;
> + goto hw_stop;
> + }
> +
> + backlight->cdev.name = ":white:" LED_FUNCTION_KBD_BACKLIGHT;
> + backlight->cdev.max_brightness = backlight->brightness->field[0]->logical_maximum;
> + backlight->cdev.brightness_set_blocking = apple_magic_backlight_led_set;
> +
> + apple_magic_backlight_set(backlight, 0, 0);
> +
> + return devm_led_classdev_register(&hdev->dev, &backlight->cdev);
> +
> +hw_stop:
> + hid_hw_stop(hdev);
> + return rc;
> +}
> +
> +static const struct hid_device_id apple_magic_backlight_hid_ids[] = {
> + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT) },
> + { }
> +};
> +MODULE_DEVICE_TABLE(hid, apple_magic_backlight_hid_ids);
> +
> +static struct hid_driver apple_magic_backlight_hid_driver = {
> + .name = "hid-apple-magic-backlight",
> + .id_table = apple_magic_backlight_hid_ids,
> + .probe = apple_magic_backlight_probe,
> +};
> +module_hid_driver(apple_magic_backlight_hid_driver);
> +
> +MODULE_DESCRIPTION("MacBook Magic Keyboard Backlight");
> +MODULE_AUTHOR("Orlando Chamberlain <orlandoch.dev@gmail.com>");
> +MODULE_LICENSE("GPL");
> --
> 2.39.1
>
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Ido Schimmel @ 2023-02-20 8:20 UTC (permalink / raw)
To: Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Zhang Rui, Len Brown,
Damien Le Moal, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Jean Delvare, Guenter Roeck,
Jonathan Cameron, Lars-Peter Clausen, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Dmitry Torokhov, Raju Rangoju,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Petr Machata, Gregory Greenman, Kalle Valo, Sebastian Reichel,
Liam Girdwood, Mark Brown, Miquel Raynal, Amit Kucheria,
Florian Fainelli, Broadcom internal kernel review list, Ray Jui,
Scott Branden, Markus Mayer, Support Opensource, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Thara Gopinath,
Niklas Söderlund, Heiko Stuebner, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Alim Akhtar, Orson Zhai, Baolin Wang,
Chunyan Zhang, Vasily Khoruzhick, Yangtao Li, Thierry Reding,
Jonathan Hunter, Talel Shenhar, Eduardo Valentin, Keerthy,
Kunihiko Hayashi, Masami Hiramatsu, Matthias Brugger,
AngeloGioacchino Del Regno, Stefan Wahren, Neil Armstrong,
ye xingchen, Zheng Yongjun, Tim Zimmermann, Yang Li,
Srinivas Pandruvada, Ricardo Neri, Jiang Jian, Daniel Golle,
Balsam CHIHI, Randy Dunlap, Mikko Perttunen,
open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org>
On Sun, Feb 19, 2023 at 03:36:41PM +0100, Daniel Lezcano wrote:
> The thermal zone device structure is exposed to the different drivers
> and obviously they access the internals while that should be
> restricted to the core thermal code.
>
> In order to self-encapsulate the thermal core code, we need to prevent
> the drivers accessing directly the thermal zone structure and provide
> accessor functions to deal with.
>
> Provide an accessor to the 'devdata' structure and make use of it in
> the different drivers.
>
> No functional changes intended.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
For mlxsw:
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply
* Re: [PATCH v4 2/2] HID: hid-apple-magic-backlight: Add driver for keyboard backlight on internal Magic Keyboards
From: Orlando Chamberlain @ 2023-02-20 7:09 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-doc, linux-input, Jonathan Corbet, Jiri Kosina,
Benjamin Tissoires, linux-kernel, Pavel Machek, Aditya Garg,
Aun-Ali Zaidi, Kerem Karabay, Andy Shevchenko,
Thomas Weißschuh, Thomas Weißschuh
In-Reply-To: <CAHp75VeF6ypA7mSYZrMsNr777f6zjEJ6nkygEc_NQe-nMhjRFQ@mail.gmail.com>
On Sun, 19 Feb 2023 16:09:26 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Sat, Feb 18, 2023 at 11:08 AM Orlando Chamberlain
> <orlandoch.dev@gmail.com> wrote:
> >
> > This driver adds support for the keyboard backlight on Intel T2 Macs
> > with internal Magic Keyboards (MacBookPro16,x and MacBookAir9,1)
>
> ...
>
> > + help
> > + Say Y here if you want support for the keyboard backlight
> > on Macs with
> > + the magic keyboard (MacBookPro16,x and MacBookAir9,1). Note
> > that this
> > + driver is not for external magic keyboards.
> > +
> > + To compile this driver as a module, choose M here: the
> > + module will be called hid-apple-magic-backlight.
>
> Is it my email client or is the indentation of the help text
> incorrect?
>
> Hint: the text of the help should be <TAB><SPACE><SPACE> indented.
>
> I believe checkpatch.pl at least in --strict mode should complain
> about this.
Looking at the hid Kconfig, it seems like some have it as you've
described, and some just have tab (and a few have just tab for the
first line, and tab space space for the rest of the lines).
checkpatch.pl --strict didn't complain about the indentation so
hopefully it's alright as is.
^ permalink raw reply
* [PATCH v3 3/3] arm64: dts: qcom: sdm845-oneplus: add alert-slider
From: Gergo Koteles @ 2023-02-20 0:13 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
In-Reply-To: <cover.1676850819.git.soyer@irl.hu>
The alert-slider is a tri-state sound profile switch found on the OnePlus 6,
Android maps the states to "silent", "vibrate" and "ring". Expose them as
ABS_SND_PROFILE events.
The previous GPIO numbers were wrong. Update them to the correct
ones.
Co-developed-by: Caleb Connolly <caleb@connolly.tech>
Signed-off-by: Caleb Connolly <caleb@connolly.tech>
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
.../boot/dts/qcom/sdm845-oneplus-common.dtsi | 43 ++++++++++++++++++-
1 file changed, 41 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 64638ea94db7..ff982dd853a9 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -52,6 +52,45 @@ key-vol-up {
};
};
+ alert-slider {
+ compatible = "gpio-keys";
+ label = "Alert slider";
+
+ pinctrl-0 = <&alert_slider_default>;
+ pinctrl-names = "default";
+
+ switch-top {
+ label = "Silent";
+ linux,input-type = <EV_ABS>;
+ linux,code = <ABS_SND_PROFILE>;
+ linux,input-value = <SND_PROFILE_SILENT>;
+ gpios = <&tlmm 126 GPIO_ACTIVE_LOW>;
+ debounce-interval = <50>;
+ linux,can-disable;
+ };
+
+ switch-middle {
+ label = "Vibrate";
+ linux,input-type = <EV_ABS>;
+ linux,code = <ABS_SND_PROFILE>;
+ linux,input-value = <SND_PROFILE_VIBRATE>;
+ gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
+ debounce-interval = <50>;
+ linux,can-disable;
+
+ };
+
+ switch-bottom {
+ label = "Ring";
+ linux,input-type = <EV_ABS>;
+ linux,code = <ABS_SND_PROFILE>;
+ linux,input-value = <SND_PROFILE_RING>;
+ gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;
+ debounce-interval = <50>;
+ linux,can-disable;
+ };
+ };
+
reserved-memory {
/*
* The rmtfs_mem needs to be guarded due to "XPU limitations"
@@ -753,8 +792,8 @@ &usb_1_hsphy {
&tlmm {
gpio-reserved-ranges = <0 4>, <81 4>;
- tri_state_key_default: tri-state-key-default-state {
- pins = "gpio40", "gpio42", "gpio26";
+ alert_slider_default: alert-slider-default-state {
+ pins = "gpio126", "gpio52", "gpio24";
function = "gpio";
drive-strength = <2>;
bias-disable;
--
2.39.2
^ permalink raw reply related
* [PATCH v3 2/3] Input: add ABS_SND_PROFILE
From: Gergo Koteles @ 2023-02-20 0:13 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
In-Reply-To: <cover.1676850819.git.soyer@irl.hu>
ABS_SND_PROFILE used to describe the state of a multi-value sound profile
switch. This will be used for the alert-slider on OnePlus phones or other
phones.
Profile values added as SND_PROFLE_(SILENT|VIBRATE|RING) identifiers
to input-event-codes.h so they can be used from DTS.
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
Documentation/input/event-codes.rst | 6 ++++++
drivers/hid/hid-debug.c | 1 +
include/uapi/linux/input-event-codes.h | 9 +++++++++
3 files changed, 16 insertions(+)
diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst
index b4557462edd7..d43336e64d6a 100644
--- a/Documentation/input/event-codes.rst
+++ b/Documentation/input/event-codes.rst
@@ -241,6 +241,12 @@ A few EV_ABS codes have special meanings:
emitted only when the selected profile changes, indicating the newly
selected profile value.
+* ABS_SND_PROFILE:
+
+ - Used to describe the state of a multi-value sound profile switch.
+ An event is emitted only when the selected profile changes,
+ indicating the newly selected profile value.
+
* ABS_MT_<name>:
- Used to describe multitouch input events. Please see
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index e213bdde543a..76fb2ecbbc51 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -1018,6 +1018,7 @@ static const char *absolutes[ABS_CNT] = {
[ABS_DISTANCE] = "Distance", [ABS_TILT_X] = "XTilt",
[ABS_TILT_Y] = "YTilt", [ABS_TOOL_WIDTH] = "ToolWidth",
[ABS_VOLUME] = "Volume", [ABS_PROFILE] = "Profile",
+ [ABS_SND_PROFILE] = "SoundProfile",
[ABS_MISC] = "Misc",
[ABS_MT_TOUCH_MAJOR] = "MTMajor",
[ABS_MT_TOUCH_MINOR] = "MTMinor",
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 022a520e31fc..e8d5ee027b40 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -866,6 +866,7 @@
#define ABS_VOLUME 0x20
#define ABS_PROFILE 0x21
+#define ABS_SND_PROFILE 0x22
#define ABS_MISC 0x28
@@ -974,4 +975,12 @@
#define SND_MAX 0x07
#define SND_CNT (SND_MAX+1)
+/*
+ * ABS_SND_PROFILE values
+ */
+
+#define SND_PROFILE_SILENT 0x00
+#define SND_PROFILE_VIBRATE 0x01
+#define SND_PROFILE_RING 0x02
+
#endif
--
2.39.2
^ permalink raw reply related
* [PATCH v3 1/3] Input: gpio-keys - add support for linux,input-value DTS property
From: Gergo Koteles @ 2023-02-20 0:13 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
In-Reply-To: <cover.1676850819.git.soyer@irl.hu>
Allows setting the value of EV_ABS events from DTS.
This property is included in the gpio-keys.yaml scheme, but was only
implemented for gpio-keys-polled.
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
drivers/input/keyboard/gpio_keys.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 5496482a38c1..c42f86ad0766 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -770,6 +770,9 @@ gpio_keys_get_devtree_pdata(struct device *dev)
&button->type))
button->type = EV_KEY;
+ fwnode_property_read_u32(child, "linux,input-value",
+ (u32 *)&button->value);
+
button->wakeup =
fwnode_property_read_bool(child, "wakeup-source") ||
/* legacy name */
--
2.39.2
^ permalink raw reply related
* [PATCH v3 0/3] Add alert-slider for OnePlus6
From: Gergo Koteles @ 2023-02-20 0:13 UTC (permalink / raw)
To: Dmitry Torokhov, Jonathan Corbet, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Jiri Kosina,
Benjamin Tissoires
Cc: linux-input, linux-kernel, linux-arm-msm, devicetree,
Caleb Connolly, Gergo Koteles
V1 -> V2: rebase to qcom/for-next
V2 -> V3: rename tri-state-key to alert-slider, fix DTS warnings,
add SND_PROFILE_* identifiers to input-event-codes.h
Gergo Koteles (3):
Input: gpio-keys - add support for linux,input-value DTS property
Input: add ABS_SND_PROFILE
arm64: dts: qcom: sdm845-oneplus: add alert-slider
Documentation/input/event-codes.rst | 6 +++
.../boot/dts/qcom/sdm845-oneplus-common.dtsi | 43 ++++++++++++++++++-
drivers/hid/hid-debug.c | 1 +
drivers/input/keyboard/gpio_keys.c | 3 ++
include/uapi/linux/input-event-codes.h | 9 ++++
5 files changed, 60 insertions(+), 2 deletions(-)
base-commit: 02ac8d2a011b630481d959298a1cc76ca0717f3e
--
2.39.2
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Mark Brown @ 2023-02-19 22:34 UTC (permalink / raw)
To: Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Zhang Rui, Len Brown,
Damien Le Moal, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Jean Delvare, Guenter Roeck,
Jonathan Cameron, Lars-Peter Clausen, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Dmitry Torokhov, Raju Rangoju,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ido Schimmel, Petr Machata, Gregory Greenman, Kalle Valo,
Sebastian Reichel, Liam Girdwood, Miquel Raynal, Amit Kucheria,
Florian Fainelli, Broadcom internal kernel review list, Ray Jui,
Scott Branden, Markus Mayer, Support Opensource, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Thara Gopinath,
Niklas Söderlund, Heiko Stuebner, Bartlomiej Zolnierkiewicz,
Krzysztof Kozlowski, Alim Akhtar, Orson Zhai, Baolin Wang,
Chunyan Zhang, Vasily Khoruzhick, Yangtao Li, Thierry Reding,
Jonathan Hunter, Talel Shenhar, Eduardo Valentin, Keerthy,
Kunihiko Hayashi, Masami Hiramatsu, Matthias Brugger,
AngeloGioacchino Del Regno, Stefan Wahren, Neil Armstrong,
ye xingchen, Zheng Yongjun, Tim Zimmermann, Yang Li,
Srinivas Pandruvada, Ricardo Neri, Jiang Jian, Daniel Golle,
Balsam CHIHI, Randy Dunlap, Mikko Perttunen,
open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <20230219143657.241542-2-daniel.lezcano@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
On Sun, Feb 19, 2023 at 03:36:41PM +0100, Daniel Lezcano wrote:
> The thermal zone device structure is exposed to the different drivers
> and obviously they access the internals while that should be
> restricted to the core thermal code.
>
> In order to self-encapsulate the thermal core code, we need to prevent
> the drivers accessing directly the thermal zone structure and provide
> accessor functions to deal with.
>
> Provide an accessor to the 'devdata' structure and make use of it in
> the different drivers.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Niklas Söderlund @ 2023-02-19 18:23 UTC (permalink / raw)
To: Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Zhang Rui, Len Brown,
Damien Le Moal, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Jean Delvare, Guenter Roeck,
Jonathan Cameron, Lars-Peter Clausen, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Dmitry Torokhov, Raju Rangoju,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ido Schimmel, Petr Machata, Gregory Greenman, Kalle Valo,
Sebastian Reichel, Liam Girdwood, Mark Brown, Miquel Raynal,
Amit Kucheria, Florian Fainelli,
Broadcom internal kernel review list, Ray Jui, Scott Branden,
Markus Mayer, Support Opensource, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Thara Gopinath, Heiko Stuebner,
Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Alim Akhtar,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vasily Khoruzhick,
Yangtao Li, Thierry Reding, Jonathan Hunter, Talel Shenhar,
Eduardo Valentin, Keerthy, Kunihiko Hayashi, Masami Hiramatsu,
Matthias Brugger, AngeloGioacchino Del Regno, Stefan Wahren,
Neil Armstrong, ye xingchen, Zheng Yongjun, Tim Zimmermann,
Yang Li, Srinivas Pandruvada, Ricardo Neri, Jiang Jian,
Daniel Golle, Balsam CHIHI, Randy Dunlap, Mikko Perttunen,
open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <4d8f1e68-8d2c-b70f-69c7-a1137ac4b05f@linaro.org>
On 2023-02-19 18:07:36 +0100, Daniel Lezcano wrote:
> On 19/02/2023 16:07, Niklas Söderlund wrote:
> > Hi Daniel,
> >
> > Thanks for your work.
> >
> > On 2023-02-19 15:36:41 +0100, Daniel Lezcano wrote:
> > > The thermal zone device structure is exposed to the different drivers
> > > and obviously they access the internals while that should be
> > > restricted to the core thermal code.
> > >
> > > In order to self-encapsulate the thermal core code, we need to prevent
> > > the drivers accessing directly the thermal zone structure and provide
> > > accessor functions to deal with.
> > >
> > > Provide an accessor to the 'devdata' structure and make use of it in
> > > the different drivers.
> > >
> > > No functional changes intended.
> > >
> > > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> > > ---
> >
> > ...
> >
> > > drivers/thermal/rcar_gen3_thermal.c | 4 ++--
> > > drivers/thermal/rcar_thermal.c | 3 +--
> >
> > For R-Car,
> >
> > Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> >
> > ...
> >
> >
> > > diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> > > index 2bb4bf33f4f3..724b95662da9 100644
> > > --- a/include/linux/thermal.h
> > > +++ b/include/linux/thermal.h
> > > @@ -365,6 +365,8 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int
> > > void *, struct thermal_zone_device_ops *,
> > > struct thermal_zone_params *, int, int);
> > > +void *thermal_zone_device_get_data(struct thermal_zone_device *tzd);
> > > +
> >
> > bikeshedding:
> >
> > Would it make sens to name this thermal_zone_device_get_priv_data(),
> > thermal_zone_device_get_priv() or something like that? To make it more
> > explicitly when reading the driver code this fetches the drivers private
> > data, and not some data belonging to the zone itself.
>
> In the headers files, there are more occurrences with _name_priv():
>
> # _name_priv()
> git grep priv include/linux/ | grep "priv(" | grep -v get | wc -l
> 52
>
> # _name_private()
> git grep priv include/linux/ | grep "private(" | grep -v get | wc -l
> 33
>
> # _name_get_private()
> git grep priv include/linux/ | grep "private(" | grep get | wc -l
> 12
>
> # _name_get_priv()
> git grep priv include/linux/ | grep "priv(" | grep get | wc -l
> 4
>
>
> What about thermal_zone_device_priv() ?
Looks good to me.
>
>
>
>
>
>
> --
> <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog
>
--
Kind Regards,
Niklas Söderlund
^ permalink raw reply
* Re: [PATCH v1 01/17] thermal/core: Add a thermal zone 'devdata' accessor
From: Daniel Lezcano @ 2023-02-19 17:07 UTC (permalink / raw)
To: Niklas Söderlund
Cc: rafael, linux-pm, linux-kernel, Zhang Rui, Len Brown,
Damien Le Moal, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Jean Delvare, Guenter Roeck,
Jonathan Cameron, Lars-Peter Clausen, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland, Dmitry Torokhov, Raju Rangoju,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Ido Schimmel, Petr Machata, Gregory Greenman, Kalle Valo,
Sebastian Reichel, Liam Girdwood, Mark Brown, Miquel Raynal,
Amit Kucheria, Florian Fainelli,
Broadcom internal kernel review list, Ray Jui, Scott Branden,
Markus Mayer, Support Opensource, Andy Gross, Bjorn Andersson,
Konrad Dybcio, Thara Gopinath, Heiko Stuebner,
Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Alim Akhtar,
Orson Zhai, Baolin Wang, Chunyan Zhang, Vasily Khoruzhick,
Yangtao Li, Thierry Reding, Jonathan Hunter, Talel Shenhar,
Eduardo Valentin, Keerthy, Kunihiko Hayashi, Masami Hiramatsu,
Matthias Brugger, AngeloGioacchino Del Regno, Stefan Wahren,
Neil Armstrong, ye xingchen, Zheng Yongjun, Tim Zimmermann,
Yang Li, Srinivas Pandruvada, Ricardo Neri, Jiang Jian,
Daniel Golle, Balsam CHIHI, Randy Dunlap, Mikko Perttunen,
open list:ACPI THERMAL DRIVER,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list:HARDWARE MONITORING,
open list:IIO SUBSYSTEM AND DRIVERS,
open list:ARM/Allwinner sunXi SoC support,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:CXGB4 ETHERNET DRIVER (CXGB4),
open list:INTEL WIRELESS WIFI LINK (iwlwifi),
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:ARM/QUALCOMM SUPPORT,
open list:RENESAS R-CAR THERMAL DRIVERS,
open list:ARM/Rockchip SoC support,
open list:SAMSUNG THERMAL DRIVER,
open list:TEGRA ARCHITECTURE SUPPORT,
open list:TI BANDGAP AND THERMAL DRIVER,
moderated list:ARM/Mediatek SoC support
In-Reply-To: <Y/I7KA2Uqqk7ib6L@oden.dyn.berto.se>
On 19/02/2023 16:07, Niklas Söderlund wrote:
> Hi Daniel,
>
> Thanks for your work.
>
> On 2023-02-19 15:36:41 +0100, Daniel Lezcano wrote:
>> The thermal zone device structure is exposed to the different drivers
>> and obviously they access the internals while that should be
>> restricted to the core thermal code.
>>
>> In order to self-encapsulate the thermal core code, we need to prevent
>> the drivers accessing directly the thermal zone structure and provide
>> accessor functions to deal with.
>>
>> Provide an accessor to the 'devdata' structure and make use of it in
>> the different drivers.
>>
>> No functional changes intended.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>
> ...
>
>> drivers/thermal/rcar_gen3_thermal.c | 4 ++--
>> drivers/thermal/rcar_thermal.c | 3 +--
>
> For R-Car,
>
> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
>
> ...
>
>
>> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
>> index 2bb4bf33f4f3..724b95662da9 100644
>> --- a/include/linux/thermal.h
>> +++ b/include/linux/thermal.h
>> @@ -365,6 +365,8 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int
>> void *, struct thermal_zone_device_ops *,
>> struct thermal_zone_params *, int, int);
>>
>> +void *thermal_zone_device_get_data(struct thermal_zone_device *tzd);
>> +
>
> bikeshedding:
>
> Would it make sens to name this thermal_zone_device_get_priv_data(),
> thermal_zone_device_get_priv() or something like that? To make it more
> explicitly when reading the driver code this fetches the drivers private
> data, and not some data belonging to the zone itself.
In the headers files, there are more occurrences with _name_priv():
# _name_priv()
git grep priv include/linux/ | grep "priv(" | grep -v get | wc -l
52
# _name_private()
git grep priv include/linux/ | grep "private(" | grep -v get | wc -l
33
# _name_get_private()
git grep priv include/linux/ | grep "private(" | grep get | wc -l
12
# _name_get_priv()
git grep priv include/linux/ | grep "priv(" | grep get | wc -l
4
What about thermal_zone_device_priv() ?
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply
* Re: [PATCH v2 3/3] arm64: dts: qcom: sdm845-oneplus: add tri-state-key
From: Caleb Connolly @ 2023-02-19 15:30 UTC (permalink / raw)
To: Gergo Koteles, Pavel Machek
Cc: Dmitry Torokhov, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Rob Herring, Krzysztof Kozlowski, Jiri Kosina, Benjamin Tissoires,
linux-input, linux-kernel, linux-arm-msm, devicetree
In-Reply-To: <007239f0-1b13-77b9-0d9c-d68747e20331@irl.hu>
On 16/02/2023 03:32, Gergo Koteles wrote:
> Hi,
>
>>
>>
>> On 11/02/2023 16:40, Pavel Machek wrote:
>>> Hi!
>>>
>>>> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
>>>> @@ -52,6 +52,43 @@ key-vol-up {
>>>> };
>>>> };
>>>>
>>>> + tri-state-key {
>>>> + compatible = "gpio-keys";
>>>> + label = "Tri-state key";
>>>> + pinctrl-names = "default";
>>>> + pinctrl-0 = <&tri_state_key_default>;
>>>> + state-top {
>>>> + label = "Tri-state key top";
>>>
>>> "top/middle" is not too useful. Do we need the label at all? If so,
>>> should it say "loud/vibrations only/mute"?
>>
>> "mute", "vibrate" and "ring" sound good to me.
>>
>
> OnePlus uses the silent/vibrate/ring, iPhone the silent/ring names.
> Maybe silent/vibrate/ring are more familiar.
>
> Adding labels can document these modes here.
> Should we also document these in input-event-codes.h?
Maybe it would be best to define macros for these rather than leave them
as magic numbers
> #define ABS_SND_PROFILE 0x22 /* 0 = silent; 1 = vibrate; 2 = ring */
#define ABS_SND_PROFILE_SILENT 0
#define ABS_SND_PROFILE_VIBRATE 1
#define ABS_SND_PROFILE_RING 2
>
>
> Thanks,
> Gergo
>
>> Although it would be nice if users can easily map the physical key
>> position to the action when viewing the input device or remapping the
>> key in userspace.
>>
>> Do you have any ideas or recommendations on how to do this?
>>>
>>> BR,
>>> Pavel
>>
>> --
>> Kind Regards,
>> Caleb
>>
>
--
Kind Regards,
Caleb
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox