[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251124-expressatt_nfc_accel_magn_light-v4-0-9c5686ad67e2@gmail.com>
Date: Mon, 24 Nov 2025 15:35:21 -0800
From: Rudraksha Gupta via B4 Relay <devnull+guptarud.gmail.com@...nel.org>
To: Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>
Cc: linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
Rudraksha Gupta <guptarud@...il.com>,
Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Subject: [PATCH v4 0/6] ARM: dts: qcom: msm8960: expressatt: Add more
peripherals
Intro:
=================
The following is now working on the Samsung Galaxy Express SGH-I437, an
old 2012 Android phone:
- Light Sensor
- Proximity is currently floating, even though it matches downstream
GPIO pin
- Magnetometer
- Regardless of orientation:
- X axis seems to always be negative
- Y and Z axis seems to always be positive
- NFC
- Accelerometer
Tests:
=================
Light Sensor
=================
// no external light on sensor
samsung-expressatt:~$ doas monitor-sensor --light
doas (user@...sung-expressatt) password:
Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has ambient light sensor (value: 0.000000, unit: lux)
Light changed: 7.000000 (lux)
// external light shining on sensor
samsung-expressatt:~$ doas monitor-sensor --light
doas (user@...sung-expressatt) password:
Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has ambient light sensor (value: 0.000000, unit: lux)
Light changed: 318.000000 (lux)
Light changed: 390.000000 (lux)
Light changed: 421.000000 (lux)
=================
NFC
=================
samsung-expressatt:~$ sudo nfctool -d nfc0 -1 -p
doas (user@...sung-expressatt) password:
nfc0:
Tags: [ ]
Devices: [ ]
Protocols: [ Felica MIFARE Jewel ISO-DEP NFC-DEP ]
Powered: Yes
RF Mode: None
lto: 150
rw: 15
miux: 2047
Start polling on nfc0 as initiator
Targets found for nfc0
Tags: [ tag0 ]
Devices: [ ]
=================
Magnetometer
=================
// no matter the orientation x is always negative and y and z are always
// positive. The values seem to be changing during rotation, but for some
// reason the magnitude is extremely large
/sys/bus/iio/devices/iio:device1 # cat in_magn_x_raw && cat \
in_magn_y_raw && cat in_magn_z_raw
-441672
1223706
3275580
=================
Accelerometer
=================
// Rotating the device with `monitor-sensor --accel` running yields the
// correct output:
https://gitlab.freedesktop.org/hadess/iio-sensor-proxy
More Information:
=================
- Device page:
https://wiki.postmarketos.org/wiki/Samsung_Galaxy_Express_SGH-I437_(samsung-expressatt)
- Downstream kernel (uses board files):
https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-express.c
Note: These patches were assisted with AI (specifically Claude) as it
was easily able to translate the old board file into a DTS format that
mainline understands.
Signed-off-by: Rudraksha Gupta <guptarud@...il.com>
---
Changes in v4:
- corrected accelerometer's mount matrix
- fix a nullptr issue in the accelerometer's driver code
- Link to v3: https://lore.kernel.org/r/20251122-expressatt_nfc_accel_magn_light-v3-0-78d198632360@gmail.com
Changes in v3:
- More formatting changes
- Remove output-low on nfc_enable
- Resolved TODO mount matrix for accelerometer. My tests are above.
- Will try to eventually solve the following problems:
- Couldn't figure out the mount matrix for magnetometer
- Proximity is a floating value even though the downstream kernel
matches the GPIO pin
- Link to v2: https://lore.kernel.org/r/20251121-expressatt_nfc_accel_magn_light-v2-0-54ce493cc6cf@gmail.com
Changes in v2:
- Fixed formatting issues
- Use GSBI instead of i2c-gpio
- Remove regulator-always-on
- Link to v1: https://lore.kernel.org/r/20251119-expressatt_nfc_accel_magn_light-v1-0-636f16f05cf4@gmail.com
---
Rudraksha Gupta (6):
ARM: dts: qcom: msm8960: Add GSBI2 & GSBI7
ARM: dts: qcom: msm8960: expressatt: Add Light/Proximity Sensor
ARM: dts: qcom: msm8960: expressatt: Add NFC
ARM: dts: qcom: msm8960: expressatt: Add Magnetometer
iio: accel: Prevent NULL pointer dereference in interrupt setup
ARM: dts: qcom: msm8960: expressatt: Add Accelerometer
.../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 109 +++++++++++++++++++++
arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 96 ++++++++++++++++++
drivers/iio/accel/bmc150-accel-core.c | 3 +
3 files changed, 208 insertions(+)
---
base-commit: a771210bab42017434c91411e16694ac4fd7afc2
change-id: 20251119-expressatt_nfc_accel_magn_light-f78e02897186
prerequisite-message-id: <176210698639.937813.643585209118839199.b4-ty@...nel.org>
prerequisite-patch-id: befdfe1948c2fbfb867597a6de917c8067fd57be
prerequisite-patch-id: 70a2b0837b9846d8a775f464295da73ca8ff26b4
prerequisite-patch-id: 20e005aa4312c3525e1b90f33a398189b9e2b3b7
prerequisite-patch-id: 970e0eb8af1736e4565fc37830576a67bf7b3227
prerequisite-patch-id: babd3b55d9ff28f19dbc3f7978742c58ef436aee
Best regards,
--
Rudraksha Gupta <guptarud@...il.com>
Powered by blists - more mailing lists