Skip to contentSkip to conversation

Add a property to tell camera sensor orientation, support it in smiapp

PATCH In review Sakari Ailus 2 participants 5 messages May 2, 2018 – May 3, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add a property to tell camera sensor orientation, support it in smiapp

Hi,

The two patches add an "upside-down" property to the video bindings and support for the property in the smiapp driver.

Sakari Ailus (2):
dt-bindings: media: Add "upside-down" property to tell sensor
orientation
smiapp: Support the "upside-down" property

 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt   | 2 ++
 Documentation/devicetree/bindings/media/video-interfaces.txt | 3 +++
 drivers/media/i2c/smiapp/smiapp-core.c                       | 3 +++
 3 files changed, 8 insertions(+)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 dt-bindings: media: Add "upside-down" property to tell sensor orientation

Camera sensors are occasionally mounted upside down. In order to use such a sensor without having to turn every image upside down separately, most camera sensors support reversing the readout order by setting both horizontal and vertical flipping.

This patch adds a boolean property to tell a sensor is mounted upside down.

---
 Documentation/devicetree/bindings/media/video-interfaces.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/media/video-interfaces.txt +3 -0
index 258b8dfddf48..2a3e4ec4ea27 100644
@@ -85,6 +85,9 @@ Optional properties
 
 - lens-focus: A phandle to the node of the focus lens controller.
 
+- upside-down: The device, typically an image sensor, is mounted upside
+  down in the system.
+
 
 Optional endpoint properties
 ----------------------------
Signature · 1 line
2.11.0
#4 lore raw

PATCH 2/2 smiapp: Support the "upside-down" property

In reply to Sakari Ailus

Use the "upside-down" property to tell that the sensor is mounted upside down. This reverses the behaviour of the VFLIP and HFLIP controls as well as the pixel order.

---
 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt | 2 ++
 drivers/media/i2c/smiapp/smiapp-core.c                     | 3 +++
 2 files changed, 5 insertions(+)
Documentation/devicetree/bindings/media/i2c/nokia,smia.txt +2 -0
index 33f10a94c381..c824cd7025b3 100644
@@ -29,6 +29,8 @@ Optional properties
 - reset-gpios: XSHUTDOWN GPIO
 - flash-leds: See ../video-interfaces.txt
 - lens-focus: See ../video-interfaces.txt
+- upside-down: A boolean property. Tells that the sensor is mounted upside
+  down.
 
 
 Endpoint node mandatory properties
drivers/media/i2c/smiapp/smiapp-core.c +3 -0
index 3b7ace395ee6..5bc91b5a5998 100644
@@ -2801,6 +2801,9 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 
 	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
 
+	if (fwnode_property_read_bool(fwnode, "upside-down"))
+		hwcfg->module_board_orient = SMIAPP_MODULE_BOARD_ORIENT_180;
+
 	/* NVM size is not mandatory */
 	fwnode_property_read_u32(fwnode, "nokia,nvm-size", &hwcfg->nvm_size);
 
Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH 1/2] dt-bindings: media: Add "upside-down" property to tell sensor orientation

In reply to Sakari Ailus

Hi,

Quoted 9 lines · Sakari Ailus

Camera sensors are occasionally mounted upside down. In order to use such a sensor without having to turn every image upside down separately, most camera sensors support reversing the readout order by setting both horizontal and vertical flipping.

This patch adds a boolean property to tell a sensor is mounted upside down.

I think the DT binding should use a rotation property instead, similar to the panel bindings:

Documentation/devicetree/bindings/display/panel/panel.txt

-- Sebastian

Quoted 21 lines
---
 Documentation/devicetree/bindings/media/video-interfaces.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/media/video-interfaces.txt +3 -0
index 258b8dfddf48..2a3e4ec4ea27 100644
@@ -85,6 +85,9 @@ Optional properties
 
 - lens-focus: A phandle to the node of the focus lens controller.
 
+- upside-down: The device, typically an image sensor, is mounted upside
+  down in the system.
+
 
 Optional endpoint properties
 ----------------------------
Signature · 1 line
2.11.0
#3 lore raw

Re: [PATCH 1/2] dt-bindings: media: Add "upside-down" property to tell sensor orientation

Hi Sebastian,

Quoted 11 lines · Sebastian Reichel

Hi,

Quoted 8 lines · Sakari Ailus

Camera sensors are occasionally mounted upside down. In order to use such a sensor without having to turn every image upside down separately, most camera sensors support reversing the readout order by setting both horizontal and vertical flipping.

This patch adds a boolean property to tell a sensor is mounted upside down.

Quoted 6 lines
Quoted 1 line

I think the DT binding should use a rotation property instead, similar to the panel bindings:

Documentation/devicetree/bindings/display/panel/panel.txt

Good point. I was trying to find something relevant relating to e.g. orientation but this one escaped me.

So... I'll abandon this patch, and use the "rotation" property instead. I'll send v2 of the smiapp patch. I think I'll actually split that into two, DT and driver changes.

Signature · 4 lines
Kind regards,

Sakari Ailus
[email protected]