linux-postmarketos-allwinner: add patch to define PinePhone camera orientations and rotations. (MR 5096)
libcamera etc need them. Ref: https://gitlab.com/postmarketOS/pmaports/-/issues/2787 Co-authored-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
parent
c0b5f13420
commit
d52346cf1f
2 changed files with 95 additions and 1 deletions
|
@ -0,0 +1,92 @@
|
|||
From 86a6b358ce743c851a15ec9f3ae00a01adb585db Mon Sep 17 00:00:00 2001
|
||||
From: Arnav Singh <me@arnavion.dev>
|
||||
Date: Mon, 6 May 2024 13:41:05 -0700
|
||||
Subject: [PATCH] Define orientation and rotation for PinePhone cameras.
|
||||
|
||||
libcamera etc need them.
|
||||
|
||||
---
|
||||
|
||||
arm64: dts: sun50i: Define orientation and rotation for PinePhone rear camera.
|
||||
|
||||
This enables libcamera to detect the correct orientation from
|
||||
the device tree and propagate it further to e.g. Pipewire.
|
||||
|
||||
Signed-off-by: Arnav Singh <me@arnavion.dev>
|
||||
|
||||
---
|
||||
|
||||
media: i2c: gc2145: Parse and register properties
|
||||
|
||||
In order to propagate V4L2_CID_CAMERA_SENSOR_ROTATION and
|
||||
V4L2_CID_CAMERA_ORIENTATION values from the DT to userspace.
|
||||
|
||||
Signed-off-by: Robert Mader <robert.mader@collabora.com>
|
||||
|
||||
---
|
||||
|
||||
arm64: dts: sun50i: Define orientation and rotation for PinePhone front camera.
|
||||
|
||||
This enables libcamera to detect the correct orientation from
|
||||
the device tree and propagate it further to e.g. Pipewire.
|
||||
|
||||
Signed-off-by: Arnav Singh <me@arnavion.dev>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 6 ++++++
|
||||
drivers/media/i2c/gc2145.c | 9 +++++++++
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
||||
index 5b0b5a5f97ff..b75880345fbb 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
||||
@@ -597,6 +597,9 @@ gc2145: front-camera@3c {
|
||||
reset-gpios = <&pio 4 16 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; /* PE16 */
|
||||
enable-gpios = <&pio 4 17 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; /* PE17 */
|
||||
|
||||
+ orientation = <0>;
|
||||
+ rotation = <90>;
|
||||
+
|
||||
port {
|
||||
gc2145_ep: endpoint {
|
||||
remote-endpoint = <&csi_gc2145_ep>;
|
||||
@@ -621,6 +624,9 @@ ov5640: rear-camera@4c {
|
||||
reset-gpios = <&pio 3 3 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; /* PD3 */
|
||||
powerdown-gpios = <&pio 2 0 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; /* PC0 */
|
||||
|
||||
+ orientation = <1>;
|
||||
+ rotation = <270>;
|
||||
+
|
||||
port {
|
||||
ov5640_ep: endpoint {
|
||||
remote-endpoint = <&csi_ov5640_ep>;
|
||||
diff --git a/drivers/media/i2c/gc2145.c b/drivers/media/i2c/gc2145.c
|
||||
index 507734b9de7d..8b12d60e38c2 100644
|
||||
--- a/drivers/media/i2c/gc2145.c
|
||||
+++ b/drivers/media/i2c/gc2145.c
|
||||
@@ -1272,6 +1272,7 @@ static int gc2145_init_controls(struct gc2145_dev *sensor)
|
||||
const struct v4l2_ctrl_ops *ops = &gc2145_ctrl_ops;
|
||||
struct gc2145_ctrls *ctrls = &sensor->ctrls;
|
||||
struct v4l2_ctrl_handler *hdl = &ctrls->handler;
|
||||
+ struct v4l2_fwnode_device_properties props;
|
||||
//u8 wb_max = 0;
|
||||
//u64 wb_mask = 0;
|
||||
//unsigned int i;
|
||||
@@ -1324,6 +1325,14 @@ static int gc2145_init_controls(struct gc2145_dev *sensor)
|
||||
ctrls->vflip = v4l2_ctrl_new_std(hdl, ops,
|
||||
V4L2_CID_VFLIP, 0, 1, 1, 0);
|
||||
|
||||
+ ret = v4l2_fwnode_device_parse(&sensor->i2c_client->dev, &props);
|
||||
+ if (ret)
|
||||
+ goto free_ctrls;
|
||||
+
|
||||
+ ret = v4l2_ctrl_new_fwnode_properties(hdl, &gc2145_ctrl_ops,
|
||||
+ &props);
|
||||
+ if (ret)
|
||||
+ goto free_ctrls;
|
||||
|
||||
/* Test patterns */
|
||||
ctrls->test_pattern =
|
||||
--
|
||||
2.44.0
|
||||
|
|
@ -4,7 +4,7 @@ _flavor=postmarketos-allwinner
|
|||
_config="config-$_flavor.$CARCH"
|
||||
pkgname=linux-$_flavor
|
||||
pkgver=6.7.9_git20240306
|
||||
pkgrel=2
|
||||
pkgrel=3
|
||||
_tag="orange-pi-6.7-20240306-2359"
|
||||
pkgdesc="Kernel fork with Pine64 patches (megi's tree, slightly patched)"
|
||||
arch="aarch64 armv7"
|
||||
|
@ -47,6 +47,7 @@ source="$pkgname-$_tag.tar.gz::https://codeberg.org/megi/linux/archive/$_tag.tar
|
|||
0013-Revert-usb-quirks-Add-USB_QUIRK_RESET-for-Quectel-EG25G-Modem.patch
|
||||
0014-usb-serial-option-add-reset-resume-callback-for-WWAN.patch
|
||||
0015-ARM-dts-allwinner-sun5i-a13-pocketbook-614-plus-Add-.patch
|
||||
0016-Define-orientation-and-rotation-for-PinePhone-camera.patch
|
||||
"
|
||||
builddir="$srcdir/linux"
|
||||
|
||||
|
@ -102,4 +103,5 @@ b7c084bb32cfc18defcec77966f1944fd3b33bb48769a4c0e257709d0f3898c5e0ca2a50c39a5d45
|
|||
c766911f76d36b997582533707d7d7a089ed1272e49a79dbe75f7c1eafef0ba3f1417d6c66f25e12e56124e0cd4bb9f443d400236e252ef1c43d53def9392a87 0013-Revert-usb-quirks-Add-USB_QUIRK_RESET-for-Quectel-EG25G-Modem.patch
|
||||
382e6e8785235788101459ae47c940ec85831007c61e3f14c4e3a43abfa21b95cdaa6bdd1b7fdd6fd26944f4c629d41b9ab776e89d9a18778fbc9f6a7785444b 0014-usb-serial-option-add-reset-resume-callback-for-WWAN.patch
|
||||
81801c25733299fe4a45154ce27ab70a80f19a00dcb7c6c67d0e6ba6bd369dbfa1b43e09b066ddaec9144e0e3f956baf2fed26d1c52f23faad33101662728e53 0015-ARM-dts-allwinner-sun5i-a13-pocketbook-614-plus-Add-.patch
|
||||
203bcca90a3b7aa061c90dc222618d0fde4a45f4d194660c96f20794e11f85dd738d27a586ac53c08715e3a029fe11dd74f121dbbca9a63a78c9ebe3a01e06db 0016-Define-orientation-and-rotation-for-PinePhone-camera.patch
|
||||
"
|
||||
|
|
Loading…
Reference in a new issue