Skip to contentSkip to conversation

nokia N9: Add support for magnetometer and touchscreen

PATCH Superseded Pavel Machek 4 participants 7 messages Jan 2, 2018 – Feb 14, 2018 Device tree bindings

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nokia N9: Add support for magnetometer and touchscreen

This adds dts support for magnetometer and touchscreen on Nokia N9.

arch/arm/boot/dts/omap3-n9.dts +16 -0
index 39e35f8..57a6679 100644
@@ -36,6 +57,22 @@
 			};
 		};
 	};
+
+	touch at 4b {
+		compatible = "atmel,maxtouch";
+		reg = <0x4b>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <29 2>; /* gpio_61, IRQF_TRIGGER_FALLING*/
+		vdd-supply = <&vio>;
+		avdd-supply = <&vaux1>;
+	};
+};
+
+&i2c3 {
+	ak8975 at 0f {
+		compatible = "asahi-kasei,ak8975";
+		reg = <0x0f>;
+	};
 };
 
 &isp {
Signature · 9 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180102/73e80119/attachment.sig>
#1 lore raw

Hi,

Quoted 1 line · Pavel Machek

This adds dts support for magnetometer and touchscreen on Nokia N9.

I think it makes sense to have this splitted.

arch/arm/boot/dts/omap3-n9.dts line 61

Quoted 12 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
index 39e35f8..57a6679 100644
@@ -36,6 +57,22 @@
 			};
 		};
 	};
+
+	touch at 4b {

touchscreen@

arch/arm/boot/dts/omap3-n9.dts line 65

Quoted 4 lines
arch/arm/boot/dts/omap3-n9.dts +4 -0
+		compatible = "atmel,maxtouch";
+		reg = <0x4b>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <29 2>; /* gpio_61, IRQF_TRIGGER_FALLING*/

reset-gpios = <&gpio3 17 GPIO_ACTIVE_SOMETHING>;

arch/arm/boot/dts/omap3-n9.dts line 67

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
+		vdd-supply = <&vio>;
+		avdd-supply = <&vaux1>;

Those two are not mentioned in the binding and not supported by the driver as far as I can see?

arch/arm/boot/dts/omap3-n9.dts line 69

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
+	};
+};

Touchscreen with the same settings is required for n950, so it should be in the shared n950 + n9 file.

arch/arm/boot/dts/omap3-n9.dts line 76

Quoted 6 lines
arch/arm/boot/dts/omap3-n9.dts +5 -0
+&i2c3 {
+	ak8975 at 0f {
+		compatible = "asahi-kasei,ak8975";
+		reg = <0x0f>;
+	};
 };

Looking at the N9 board file this is missing a rotation matrix. This is supported by the binding:

Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt

arch/arm/boot/dts/omap3-n9.dts line 76

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +0 -0
 &isp {

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180102/5da4ddb9/attachment.sig>

#2 lore raw

Hi,

Quoted 22 lines · Sebastian Reichel

Hi,

Quoted 1 line · Pavel Machek

This adds dts support for magnetometer and touchscreen on Nokia N9.

I think it makes sense to have this splitted.

arch/arm/boot/dts/omap3-n9.dts line 61

Quoted 12 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
index 39e35f8..57a6679 100644
@@ -36,6 +57,22 @@
 			};
 		};
 	};
+
+	touch at 4b {

touchscreen@

Quoted 7 lines

arch/arm/boot/dts/omap3-n9.dts line 65

Quoted 4 lines
arch/arm/boot/dts/omap3-n9.dts +4 -0
+		compatible = "atmel,maxtouch";
+		reg = <0x4b>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <29 2>; /* gpio_61, IRQF_TRIGGER_FALLING*/

reset-gpios = <&gpio3 17 GPIO_ACTIVE_SOMETHING>;

I'm using reset-gpios = <&gpio3 17 0>;

Quoted 6 lines

arch/arm/boot/dts/omap3-n9.dts line 67

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
+		vdd-supply = <&vio>;
+		avdd-supply = <&vaux1>;

Those two are not mentioned in the binding and not supported by the driver as far as I can see?

Right, but vio and vaux1 need to be on - the reason why it's working at all is because lis302 uses the same regulators and turns them on. IMHO either we add the support for regulators to maxtouch driver or we add regulator-always-on to vio and vaux1.

Quoted 6 lines

arch/arm/boot/dts/omap3-n9.dts line 69

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
+	};
+};

Touchscreen with the same settings is required for n950, so it should be in the shared n950 + n9 file.

As a side-note, there is no pinmux mentioned and usually I'd use OMAP3_CORE1_IOPAD(0x20c8, PIN_INPUT | MUX_MODE4) /* gpio_61*/ OMAP3_CORE1_IOPAD(0x20f2, PIN_OUTPUT | MUX_MODE4) /* gpio_81*/

For reasons that I can't explain, first line (gpmc_nbe1->gpio_61) breaks it for me, so I've commented it out. Still, if anyone has an idea what is wrong with that please let me know.

Quoted 10 lines

arch/arm/boot/dts/omap3-n9.dts line 76

Quoted 6 lines
arch/arm/boot/dts/omap3-n9.dts +5 -0
+&i2c3 {
+	ak8975 at 0f {
+		compatible = "asahi-kasei,ak8975";
+		reg = <0x0f>;
+	};
 };

Looking at the N9 board file this is missing a rotation matrix. This is supported by the binding:

Quoted 7 lines

Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt

arch/arm/boot/dts/omap3-n9.dts line 76

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +0 -0
 &isp {

-- Sebastian

Best regards,
Filip

#3 lore raw
In reply to Sebastian Reichel
Quoted 6 lines · Sebastian Reichel

Hi,

Quoted 1 line · Pavel Machek

This adds dts support for magnetometer and touchscreen on Nokia N9.

I think it makes sense to have this splitted.

Creating more work for everyone for little gain? Meh.

Quoted 4 lines
Quoted 4 lines
arch/arm/boot/dts/omap3-n9.dts +0 -0
index 39e35f8..57a6679 100644
Quoted 8 lines

arch/arm/boot/dts/omap3-n9.dts line 61

Quoted 6 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
@@ -36,6 +57,22 @@
 			};
 		};
 	};
+
+	touch at 4b {

touchscreen@

Ok.

Quoted 7 lines

arch/arm/boot/dts/omap3-n9.dts line 65

Quoted 4 lines
arch/arm/boot/dts/omap3-n9.dts +4 -0
+		compatible = "atmel,maxtouch";
+		reg = <0x4b>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <29 2>; /* gpio_61, IRQF_TRIGGER_FALLING*/

reset-gpios = <&gpio3 17 GPIO_ACTIVE_SOMETHING>;

Quoted 5 lines

arch/arm/boot/dts/omap3-n9.dts line 67

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
+		vdd-supply = <&vio>;
+		avdd-supply = <&vaux1>;

Those two are not mentioned in the binding and not supported by the driver as far as I can see?

Driver will need to be fixed, AFAICT :-(.

Quoted 2 lines

Touchscreen with the same settings is required for n950, so it should be in the shared n950 + n9 file.

In future, settings will be different for n9/n950: calibration matrix is different as panel is rotated in different way. Still it probably makes sense to share. Ok.

Quoted 11 lines

arch/arm/boot/dts/omap3-n9.dts line 76

Quoted 6 lines
arch/arm/boot/dts/omap3-n9.dts +5 -0
+&i2c3 {
+	ak8975 at 0f {
+		compatible = "asahi-kasei,ak8975";
+		reg = <0x0f>;
+	};
 };

Looking at the N9 board file this is missing a rotation matrix. This is supported by the binding:

Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt

Do you have an idea how the rotation matrix should look like? I don't currently have an userland software that could calibrate and test the sensor, so I'd prefer to merge basic binding now and do calibration later.

Best regards,
Pavel

Signature · 9 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180103/f2e1f8bd/attachment.sig>
#4 lore raw

Hi,

Quoted 9 lines · Pavel Machek
Quoted 6 lines · Sebastian Reichel

Hi,

Quoted 1 line · Pavel Machek

This adds dts support for magnetometer and touchscreen on Nokia N9.

I think it makes sense to have this splitted.

Creating more work for everyone for little gain? Meh.

More work for everyone? Could you please read Documentation/process and actually follow it? It has a section about patches containing a single logical change and you add two completly unrelated devices to the device tree.

Also I suggest, that you rework your git workflow if this makes more work than writing two sentences.

Quoted 22 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/boot/dts/omap3-n9.dts +0 -0
index 39e35f8..57a6679 100644
Quoted 8 lines

arch/arm/boot/dts/omap3-n9.dts line 61

Quoted 6 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
@@ -36,6 +57,22 @@
 			};
 		};
 	};
+
+	touch at 4b {

touchscreen@

Ok.

Quoted 7 lines

arch/arm/boot/dts/omap3-n9.dts line 65

Quoted 4 lines
arch/arm/boot/dts/omap3-n9.dts +4 -0
+		compatible = "atmel,maxtouch";
+		reg = <0x4b>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <29 2>; /* gpio_61, IRQF_TRIGGER_FALLING*/

reset-gpios = <&gpio3 17 GPIO_ACTIVE_SOMETHING>;

Quoted 7 lines
Quoted 5 lines

arch/arm/boot/dts/omap3-n9.dts line 67

Quoted 2 lines
arch/arm/boot/dts/omap3-n9.dts +2 -0
+		vdd-supply = <&vio>;
+		avdd-supply = <&vaux1>;

Those two are not mentioned in the binding and not supported by the driver as far as I can see?

Driver will need to be fixed, AFAICT :-(.

Obviously. DTS is only updated when binding has been acknowledged, though. To get this working ASAP you can add "always-enabled;" to the regulator and remove it once the driver gained support for enabling the regulators itself.

Quoted 6 lines
Quoted 2 lines

Touchscreen with the same settings is required for n950, so it should be in the shared n950 + n9 file.

In future, settings will be different for n9/n950: calibration matrix is different as panel is rotated in different way. Still it probably makes sense to share. Ok.

The differences can be specified in the specific files by doing something like the following:

n9-n950.dtsi:

ts: touchscreen {
    shared-properties;
};

n9.dts:

&ts {
    only-for-n9;
};

n950.dts:

&ts {
    only-for-n950;
};
Quoted 10 lines
Quoted 10 lines

arch/arm/boot/dts/omap3-n9.dts line 76

Quoted 6 lines
arch/arm/boot/dts/omap3-n9.dts +5 -0
+&i2c3 {
+	ak8975 at 0f {
+		compatible = "asahi-kasei,ak8975";
+		reg = <0x0f>;
+	};
 };

Looking at the N9 board file this is missing a rotation matrix. This is supported by the binding:

Quoted 6 lines
Quoted 1 line

Documentation/devicetree/bindings/iio/magnetometer/ak8975.txt

Do you have an idea how the rotation matrix should look like? I don't currently have an userland software that could calibrate and test the sensor, so I'd prefer to merge basic binding now and do calibration later.

Well you take the values from sysfs, multiply it with the rotation matrix and check if the values look ok. No special userspace tools required except mount (for sysfs), ls & cat.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180103/3cc73e3f/attachment.sig>

#5 lore raw

PATCH v2 1/1 nokia N9: Add support for magnetometer

In reply to Sebastian Reichel

This adds dts support for magnetometer on Nokia N9.

arch/arm/boot/dts/omap3-n9.dts +6 -0
index 39e35f8..af321d8 100644
@@ -36,6 +57,12 @@
 			};
 		};
 	};
+
+&i2c3 {
+	ak8975 at 0f {
+		compatible = "asahi-kasei,ak8975";
+		reg = <0x0f>;
+	};
 };
 
 &isp {
Signature · 9 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180103/657d091d/attachment.sig>
#6 lore raw

Re: [PATCHv2] nokia N9: Add support for magnetometer

Quoted 2 lines · Pavel Machek

This adds dts support for magnetometer on Nokia N9.

Applying into omap-for-v4.17/dt thanks.

Tony