[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251122-expressatt_nfc_accel_magn_light-v3-0-78d198632360@gmail.com>
Date: Sat, 22 Nov 2025 22:44:41 -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>
Cc: linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Rudraksha Gupta <guptarud@...il.com>,
Konrad Dybcio <konrad.dybcio@....qualcomm.com>
Subject: [PATCH v3 0/5] 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
/sys/bus/iio/devices/iio:device2 # cat in_intensity0_raw && cat \
in_intensity1_raw
0
0
// external light shining on sensor
samsung-expressatt:/sys/bus/iio/devices/iio:device2$ cat \
in_intensity0_raw in_intensity1_raw
915
163
=================
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
=================
I believe it follows the mount matrix guide located in the kernel:
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/iio/mount-matrix.txt
// phone is vertical with charger port closest to the ground and the
// camera closest to the sky. result: +y
samsung-expressatt:/sys/bus/iio/devices/iio:device0$ cat in_accel_x_raw \
in_accel_y_raw in_accel_z_raw
4
488
-47
// phone is flat on the ground with the back of the phone closest to the
// ground and the screen closest to the sky. result: +z
samsung-expressatt:/sys/bus/iio/devices/iio:device0$ cat in_accel_x_raw \
in_accel_y_raw in_accel_z_raw
-4
2
496
// start with phone flat on the ground and the back of the phone
// closest to the ground and the screen closest to the sky. then rotate the
// phone so the charger is closest to you
// next, tilt the phone onto it's left edge. in this case, it would be
// the side with the volume buttons. result: +x
samsung-expressatt:/sys/bus/iio/devices/iio:device0$ cat in_accel_x_raw \
in_accel_y_raw in_accel_z_raw
499
-5
8
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 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 (5):
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
ARM: dts: qcom: msm8960: expressatt: Add Accelerometer
.../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 105 +++++++++++++++++++++
arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 96 +++++++++++++++++++
2 files changed, 201 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