Re: [PATCH] Add common hall sensor drivers
From: Dmitry Torokhov
Date: Wed Jan 21 2026 - 12:28:01 EST
On Wed, Jan 21, 2026 at 12:43:01PM +0100, Linus Walleij wrote:
> Hi Xuchen,
>
> thanks for your patch!
>
> On Wed, Jan 21, 2026 at 9:59 AM <756271518@xxxxxx> wrote:
>
> > From: xuchen <756271518@xxxxxx>
> >
> > This patch adds support for common hall sensor ICs used in Qualcomm
> > reference designs. The driver handles both rising and falling edges
> > to detect magnetic field changes.
> >
> > Signed-off-by: xuchen <756271518@xxxxxx>
>
> Why are you going to such lengths to create this driver?
>
> What people do is usually just create a GPIO "key" input
> for the hall sensor, for example:
>
> gpio_keys {
> compatible = "gpio-keys";
> #address-cells = <1>;
> #size-cells = <0>;
> vdd-supply = <&ab8500_ldo_aux1_reg>;
> pinctrl-names = "default";
> pinctrl-0 = <&hall_tvk_mode>;
>
> button@145 {
> /* Hall sensor */
> gpios = <&gpio4 17 GPIO_ACTIVE_HIGH>;
> linux,code = <0>; /* SW_LID */
> label = "HED54XXU11 Hall Effect Sensor";
> };
> };
>
> This turns the GPIO line into a "lid switch" which is what you want,
> and already supports regulators and pin control out of the box if
> you need them too. (The VDD and pin control properties are optional.)
Right, we do not need a custom driver for that (especially one using
legacy APIs and custom event codes and defining special classes).
Thanks.
--
Dmitry