Re: [PATCH 1/2] arm64: dts: sun50i-a64-pinephone: Add AF8133J to PinePhone
From: Chen-Yu Tsai
Date: Mon Sep 09 2024 - 04:11:21 EST
On Mon, Sep 9, 2024 at 5:48 AM Andrey Skvortsov
<andrej.skvortzov@xxxxxxxxx> wrote:
>
> From: Icenowy Zheng <icenowy@xxxxxxx>
>
> New batches of PinePhones switched the magnetometer to AF8133J from
> LIS3MDL because lack of ST components.
>
> Both chips use the same PB1 pin, but in different modes.
> LIS3MDL uses it as an gpio input to handle interrupt.
> AF8133J uses it as an gpio output as a reset signal.
>
> It wasn't possible at runtime to enable both device tree nodes and
> detect supported sensor at probe time, because both drivers try to
> acquire the same gpio in different modes.
>
> Device tree fixup will be done in firmware without introducing new board
> revision and new dts.
FYI I've been working on an in-kernel prober [1] for such alternative
components. This does not require firmware support.
[1] https://lore.kernel.org/all/20240904090016.2841572-1-wenst@xxxxxxxxxxxx/
> Signed-off-by: Icenowy Zheng <icenowy@xxxxxxx>
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@xxxxxxxxx>
> Link: https://patchwork.ozlabs.org/project/uboot/patch/20240211092824.395155-1-andrej.skvortzov@xxxxxxxxx/
>
> ---
> .../boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> index 6eab61a12cd8f..66fbb35a7fae9 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
> @@ -188,6 +188,18 @@ touchscreen@5d {
> &i2c1 {
> status = "okay";
>
> + /* Alternative magnetometer */
> + af8133j: magnetometer@1c {
> + compatible = "voltafield,af8133j";
> + reg = <0x1c>;
> + reset-gpios = <&pio 1 1 GPIO_ACTIVE_LOW>;
> + avdd-supply = <®_dldo1>;
> + dvdd-supply = <®_dldo1>;
> +
> + /* status will be fixed up in firmware */
> + status = "disabled";
> + };
> +
> /* Magnetometer */
> lis3mdl: magnetometer@1e {
> compatible = "st,lis3mdl-magn";
> --
> 2.45.2
>