2024-02-16 19:00:22

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v3 0/4] Add support for AF8133J magnetometer

From: Ondrej Jirman <[email protected]>

This series adds support for AF8133J magnetometer sensor. It's a simple
3-axis sensor with two sensitivity options and not much else to it.

This sensor is used on both Pinephone and Pinephone Pro. DT patches
adding it will come later, once this driver is merged.

Please take a look. :)

Thank you very much,
Ondřej Jirman

v3:
- collect more tags
- if (ret < 0) -> (ret) where appropriate
- scoped guard move to af8133j_set_scale()
- remove pm_runtime_disable/enable guard from af8133j_power_down_action()
- pretty much just this:
https://megous.com/dl/tmp/0001-if-ret-0-ret-where-appropriate.patch
https://megous.com/dl/tmp/0002-scoped-guard-move-to-af8133j_set_scale.patch
https://megous.com/dl/tmp/0003-remove-pm_runtime_disable-enable-guard-from-af8133j_.patch

v2:
- move maintainers patch to the end of series
- bindings:
- fix compatible definition in bindings file
- require power supplies
- fix descriptions
- driver:
- sort includes
- rework RPM, the driver should now work with RPM disabled
among other improvements
- I've tested RPM left and right doing device bind/unbind under
various conditions, system suspend under various conditions,
etc.
- use scoped_guard for mutexes
- use devm for power down and handle power down correctly with both
RPM enabled/disabled without tracking power state in data->powered
- fix issue with changing scale while RPM suspended
- various code formatting issues resolved
- as for sign-offs, I've added co-developed-by for people I know for
sure worked on the driver, and left other tags as they were when
I picked up the patch 2 years ago to my Linux branch

Icenowy Zheng (3):
dt-bindings: vendor-prefix: Add prefix for Voltafield
dt-bindings: iio: magnetometer: Add Voltafield AF8133J
iio: magnetometer: add a driver for Voltafield AF8133J magnetometer

Ondrej Jirman (1):
MAINTAINERS: Add an entry for AF8133J driver

.../iio/magnetometer/voltafield,af8133j.yaml | 60 ++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
MAINTAINERS | 6 +
drivers/iio/magnetometer/Kconfig | 12 +
drivers/iio/magnetometer/Makefile | 1 +
drivers/iio/magnetometer/af8133j.c | 524 ++++++++++++++++++
6 files changed, 605 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml
create mode 100644 drivers/iio/magnetometer/af8133j.c

--
2.43.0



2024-02-16 19:01:25

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v3 2/4] dt-bindings: iio: magnetometer: Add Voltafield AF8133J

From: Icenowy Zheng <[email protected]>

Voltafield AF8133J is a simple magnetometer sensor produced by Voltafield
Technology Corp, with dual power supplies (one for core and one for I/O)
and active-low reset pin.

The sensor has configurable range 1.2 - 2.2 mT and a software controlled
standby mode.

Add a device tree binding for it.

Signed-off-by: Icenowy Zheng <[email protected]>
Signed-off-by: Ondřej Jirman <[email protected]>
Reviewed-by: Conor Dooley <[email protected]>
---
.../iio/magnetometer/voltafield,af8133j.yaml | 60 +++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml

diff --git a/Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml b/Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml
new file mode 100644
index 000000000000..b6ab01a6914a
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/magnetometer/voltafield,af8133j.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Voltafield AF8133J magnetometer sensor
+
+maintainers:
+ - Ondřej Jirman <[email protected]>
+
+properties:
+ compatible:
+ const: voltafield,af8133j
+
+ reg:
+ maxItems: 1
+
+ reset-gpios:
+ description:
+ A signal for active low reset input of the sensor. (optional; if not
+ used, software reset over I2C will be used instead)
+
+ avdd-supply:
+ description:
+ A regulator that provides AVDD power (Working power, usually 3.3V) to
+ the sensor.
+
+ dvdd-supply:
+ description:
+ A regulator that provides DVDD power (Digital IO power, 1.8V - AVDD)
+ to the sensor.
+
+ mount-matrix:
+ description: An optional 3x3 mounting rotation matrix.
+
+required:
+ - compatible
+ - reg
+ - avdd-supply
+ - dvdd-supply
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/gpio/gpio.h>
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ magnetometer@1c {
+ compatible = "voltafield,af8133j";
+ reg = <0x1c>;
+ avdd-supply = <&reg_dldo1>;
+ dvdd-supply = <&reg_dldo1>;
+ reset-gpios = <&pio 1 1 GPIO_ACTIVE_LOW>;
+ };
+ };
--
2.43.0


2024-02-16 19:01:28

by Ondřej Jirman

[permalink] [raw]
Subject: [PATCH v3 4/4] MAINTAINERS: Add an entry for AF8133J driver

From: Ondrej Jirman <[email protected]>

As I am submitting the driver and have the device to test. I'll maintain
the driver.

Signed-off-by: Ondrej Jirman <[email protected]>
---
MAINTAINERS | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 73d898383e51..67f4974ac803 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -579,6 +579,12 @@ F: drivers/iio/accel/adxl372.c
F: drivers/iio/accel/adxl372_i2c.c
F: drivers/iio/accel/adxl372_spi.c

+AF8133J THREE-AXIS MAGNETOMETER DRIVER
+M: Ondřej Jirman <[email protected]>
+S: Maintained
+F: Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml
+F: drivers/iio/magnetometer/af8133j.c
+
AF9013 MEDIA DRIVER
L: [email protected]
S: Orphan
--
2.43.0