All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Define rotation property for camera sensors
@ 2018-05-25 12:27 Sakari Ailus
  2018-05-25 12:27 ` [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors Sakari Ailus
  2018-05-25 12:27 ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sakari Ailus
  0 siblings, 2 replies; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 12:27 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree, andy.yeh, sebastian.reichel

Hi,

Here's an update on my previous patchset adding an "upside-down" property.
Instead of dropping the first patch entirely as I first thought, I decided
to add documentation for the rotation property for sensors as well. The
updates to the patches are related to that.

Sakari Ailus (2):
  dt-bindings: media: Define "rotation" property for sensors
  smiapp: Support the "upside-down" property

 .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++
 .../devicetree/bindings/media/video-interfaces.txt       |  4 ++++
 drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
 3 files changed, 22 insertions(+)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors
  2018-05-25 12:27 [PATCH v2 0/2] Define rotation property for camera sensors Sakari Ailus
@ 2018-05-25 12:27 ` Sakari Ailus
  2018-05-25 14:05   ` Sebastian Reichel
  2018-05-31  3:33   ` Rob Herring
  2018-05-25 12:27 ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sakari Ailus
  1 sibling, 2 replies; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 12:27 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree, andy.yeh, sebastian.reichel

Sensors are occasionally mounted upside down to systems such as mobile
phones or tablets. In order to use such a sensor without having to turn
every image upside down, most camera sensors support reversing the readout
order by setting both horizontal and vertical flipping.

This patch documents the "rotation" property for camera sensors, mirroring
what is defined for displays in
Documentation/devicetree/bindings/display/panel/panel.txt .

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 Documentation/devicetree/bindings/media/video-interfaces.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt
index 258b8dfddf48..52b7c7b57842 100644
--- a/Documentation/devicetree/bindings/media/video-interfaces.txt
+++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
@@ -85,6 +85,10 @@ Optional properties
 
 - lens-focus: A phandle to the node of the focus lens controller.
 
+- rotation: The device, typically an image sensor, is not mounted upright,
+  but a number of degrees counter clockwise. Typical values are 0 and 180
+  (upside down).
+
 
 Optional endpoint properties
 ----------------------------
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/2] smiapp: Support the "upside-down" property
  2018-05-25 12:27 [PATCH v2 0/2] Define rotation property for camera sensors Sakari Ailus
  2018-05-25 12:27 ` [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors Sakari Ailus
@ 2018-05-25 12:27 ` Sakari Ailus
  2018-05-25 13:40   ` [PATCH v2.1 2/2] smiapp: Support the "rotation" property Sakari Ailus
  2018-05-25 13:41   ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sebastian Reichel
  1 sibling, 2 replies; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 12:27 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree, andy.yeh, sebastian.reichel

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.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++
 drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
index 33f10a94c381..6f509657470e 100644
--- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
+++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
@@ -29,6 +29,8 @@ Optional properties
 - reset-gpios: XSHUTDOWN GPIO
 - flash-leds: See ../video-interfaces.txt
 - lens-focus: See ../video-interfaces.txt
+- rotation: Integer property; valid values are 0 (sensor mounted upright)
+	    and 180 (sensor mounted upside down).
 
 
 Endpoint node mandatory properties
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index e1f8208581aa..32286df6ab43 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2764,6 +2764,7 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 	struct v4l2_fwnode_endpoint *bus_cfg;
 	struct fwnode_handle *ep;
 	struct fwnode_handle *fwnode = dev_fwnode(dev);
+	u32 rotation;
 	int i;
 	int rval;
 
@@ -2800,6 +2801,21 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 
 	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
 
+	rval = fwnode_property_read_u32(fwnode, "upside-down", &rotation);
+	if (!rval) {
+		switch (rotation) {
+		case 180:
+			hwcfg->module_board_orient =
+				SMIAPP_MODULE_BOARD_ORIENT_180;
+			/* Fall through */
+		case 0:
+			break;
+		default:
+			dev_err(dev, "invalid rotation %u\n", rotation);
+			goto out_err;
+		}
+	}
+
 	/* NVM size is not mandatory */
 	fwnode_property_read_u32(fwnode, "nokia,nvm-size", &hwcfg->nvm_size);
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2.1 2/2] smiapp: Support the "rotation" property
  2018-05-25 12:27 ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sakari Ailus
@ 2018-05-25 13:40   ` Sakari Ailus
  2018-05-25 13:52     ` [PATCH v2.2 " Sakari Ailus
  2018-05-25 13:41   ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sebastian Reichel
  1 sibling, 1 reply; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 13:40 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree, andy.yeh, sebastian.reichel

Use the "rotation" 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.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
since v2:

- Fix the property name in the commit message

 .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++
 drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
index 33f10a94c381..6f509657470e 100644
--- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
+++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
@@ -29,6 +29,8 @@ Optional properties
 - reset-gpios: XSHUTDOWN GPIO
 - flash-leds: See ../video-interfaces.txt
 - lens-focus: See ../video-interfaces.txt
+- rotation: Integer property; valid values are 0 (sensor mounted upright)
+	    and 180 (sensor mounted upside down).
 
 
 Endpoint node mandatory properties
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index e1f8208581aa..32286df6ab43 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2764,6 +2764,7 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 	struct v4l2_fwnode_endpoint *bus_cfg;
 	struct fwnode_handle *ep;
 	struct fwnode_handle *fwnode = dev_fwnode(dev);
+	u32 rotation;
 	int i;
 	int rval;
 
@@ -2800,6 +2801,21 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 
 	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
 
+	rval = fwnode_property_read_u32(fwnode, "upside-down", &rotation);
+	if (!rval) {
+		switch (rotation) {
+		case 180:
+			hwcfg->module_board_orient =
+				SMIAPP_MODULE_BOARD_ORIENT_180;
+			/* Fall through */
+		case 0:
+			break;
+		default:
+			dev_err(dev, "invalid rotation %u\n", rotation);
+			goto out_err;
+		}
+	}
+
 	/* NVM size is not mandatory */
 	fwnode_property_read_u32(fwnode, "nokia,nvm-size", &hwcfg->nvm_size);
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] smiapp: Support the "upside-down" property
  2018-05-25 12:27 ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sakari Ailus
  2018-05-25 13:40   ` [PATCH v2.1 2/2] smiapp: Support the "rotation" property Sakari Ailus
@ 2018-05-25 13:41   ` Sebastian Reichel
  2018-05-25 13:52     ` Sakari Ailus
  1 sibling, 1 reply; 13+ messages in thread
From: Sebastian Reichel @ 2018-05-25 13:41 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, devicetree, andy.yeh

[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]

Hi,

On Fri, May 25, 2018 at 03:27:26PM +0300, Sakari Ailus wrote:
> 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.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---

Patch subject and description should be s/"upside-down"/"rotation"/g ?

>  .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++
>  drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> index 33f10a94c381..6f509657470e 100644
> --- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> @@ -29,6 +29,8 @@ Optional properties
>  - reset-gpios: XSHUTDOWN GPIO
>  - flash-leds: See ../video-interfaces.txt
>  - lens-focus: See ../video-interfaces.txt
> +- rotation: Integer property; valid values are 0 (sensor mounted upright)
> +	    and 180 (sensor mounted upside down).
>  
>  
>  Endpoint node mandatory properties
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> index e1f8208581aa..32286df6ab43 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -2764,6 +2764,7 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
>  	struct v4l2_fwnode_endpoint *bus_cfg;
>  	struct fwnode_handle *ep;
>  	struct fwnode_handle *fwnode = dev_fwnode(dev);
> +	u32 rotation;
>  	int i;
>  	int rval;
>  
> @@ -2800,6 +2801,21 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
>  
>  	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
>  
> +	rval = fwnode_property_read_u32(fwnode, "upside-down", &rotation);

"rotation"

> +	if (!rval) {
> +		switch (rotation) {
> +		case 180:
> +			hwcfg->module_board_orient =
> +				SMIAPP_MODULE_BOARD_ORIENT_180;
> +			/* Fall through */
> +		case 0:
> +			break;
> +		default:
> +			dev_err(dev, "invalid rotation %u\n", rotation);
> +			goto out_err;
> +		}
> +	}
> +
>  	/* NVM size is not mandatory */
>  	fwnode_property_read_u32(fwnode, "nokia,nvm-size", &hwcfg->nvm_size);

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2.2 2/2] smiapp: Support the "rotation" property
  2018-05-25 13:40   ` [PATCH v2.1 2/2] smiapp: Support the "rotation" property Sakari Ailus
@ 2018-05-25 13:52     ` Sakari Ailus
  2018-05-25 14:09       ` Sebastian Reichel
  2018-05-31  3:35       ` Rob Herring
  0 siblings, 2 replies; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 13:52 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree, andy.yeh, sebastian.reichel

Use the "rotation" 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.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
since v2.2:

- Fix property name in code.

 .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++
 drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
index 33f10a94c381..6f509657470e 100644
--- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
+++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
@@ -29,6 +29,8 @@ Optional properties
 - reset-gpios: XSHUTDOWN GPIO
 - flash-leds: See ../video-interfaces.txt
 - lens-focus: See ../video-interfaces.txt
+- rotation: Integer property; valid values are 0 (sensor mounted upright)
+	    and 180 (sensor mounted upside down).
 
 
 Endpoint node mandatory properties
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index e1f8208581aa..e9e0f21efc2a 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2764,6 +2764,7 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 	struct v4l2_fwnode_endpoint *bus_cfg;
 	struct fwnode_handle *ep;
 	struct fwnode_handle *fwnode = dev_fwnode(dev);
+	u32 rotation;
 	int i;
 	int rval;
 
@@ -2800,6 +2801,21 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 
 	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
 
+	rval = fwnode_property_read_u32(fwnode, "rotation", &rotation);
+	if (!rval) {
+		switch (rotation) {
+		case 180:
+			hwcfg->module_board_orient =
+				SMIAPP_MODULE_BOARD_ORIENT_180;
+			/* Fall through */
+		case 0:
+			break;
+		default:
+			dev_err(dev, "invalid rotation %u\n", rotation);
+			goto out_err;
+		}
+	}
+
 	/* NVM size is not mandatory */
 	fwnode_property_read_u32(fwnode, "nokia,nvm-size", &hwcfg->nvm_size);
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] smiapp: Support the "upside-down" property
  2018-05-25 13:41   ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sebastian Reichel
@ 2018-05-25 13:52     ` Sakari Ailus
  0 siblings, 0 replies; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 13:52 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: Sakari Ailus, linux-media, devicetree, andy.yeh

On Fri, May 25, 2018 at 03:41:59PM +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Fri, May 25, 2018 at 03:27:26PM +0300, Sakari Ailus wrote:
> > 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.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> 
> Patch subject and description should be s/"upside-down"/"rotation"/g ?
> 
> >  .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++
> >  drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
> >  2 files changed, 18 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> > index 33f10a94c381..6f509657470e 100644
> > --- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> > +++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> > @@ -29,6 +29,8 @@ Optional properties
> >  - reset-gpios: XSHUTDOWN GPIO
> >  - flash-leds: See ../video-interfaces.txt
> >  - lens-focus: See ../video-interfaces.txt
> > +- rotation: Integer property; valid values are 0 (sensor mounted upright)
> > +	    and 180 (sensor mounted upside down).
> >  
> >  
> >  Endpoint node mandatory properties
> > diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> > index e1f8208581aa..32286df6ab43 100644
> > --- a/drivers/media/i2c/smiapp/smiapp-core.c
> > +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> > @@ -2764,6 +2764,7 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
> >  	struct v4l2_fwnode_endpoint *bus_cfg;
> >  	struct fwnode_handle *ep;
> >  	struct fwnode_handle *fwnode = dev_fwnode(dev);
> > +	u32 rotation;
> >  	int i;
> >  	int rval;
> >  
> > @@ -2800,6 +2801,21 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
> >  
> >  	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
> >  
> > +	rval = fwnode_property_read_u32(fwnode, "upside-down", &rotation);
> 
> "rotation"

Thanks. Both fixed in v2.2.

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors
  2018-05-25 12:27 ` [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors Sakari Ailus
@ 2018-05-25 14:05   ` Sebastian Reichel
  2018-05-31  3:33   ` Rob Herring
  1 sibling, 0 replies; 13+ messages in thread
From: Sebastian Reichel @ 2018-05-25 14:05 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, devicetree, andy.yeh

[-- Attachment #1: Type: text/plain, Size: 1531 bytes --]

Hi,

On Fri, May 25, 2018 at 03:27:25PM +0300, Sakari Ailus wrote:
> Sensors are occasionally mounted upside down to systems such as mobile
> phones or tablets. In order to use such a sensor without having to turn
> every image upside down, most camera sensors support reversing the readout
> order by setting both horizontal and vertical flipping.
> 
> This patch documents the "rotation" property for camera sensors, mirroring
> what is defined for displays in
> Documentation/devicetree/bindings/display/panel/panel.txt .
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

>  Documentation/devicetree/bindings/media/video-interfaces.txt | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt
> index 258b8dfddf48..52b7c7b57842 100644
> --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
> +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> @@ -85,6 +85,10 @@ Optional properties
>  
>  - lens-focus: A phandle to the node of the focus lens controller.
>  
> +- rotation: The device, typically an image sensor, is not mounted upright,
> +  but a number of degrees counter clockwise. Typical values are 0 and 180
> +  (upside down).
> +
>  
>  Optional endpoint properties
>  ----------------------------
> -- 
> 2.11.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2.2 2/2] smiapp: Support the "rotation" property
  2018-05-25 13:52     ` [PATCH v2.2 " Sakari Ailus
@ 2018-05-25 14:09       ` Sebastian Reichel
  2018-05-25 14:17           ` Sakari Ailus
  2018-05-31  3:35       ` Rob Herring
  1 sibling, 1 reply; 13+ messages in thread
From: Sebastian Reichel @ 2018-05-25 14:09 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, devicetree, andy.yeh

[-- Attachment #1: Type: text/plain, Size: 2481 bytes --]

Hi,

On Fri, May 25, 2018 at 04:52:35PM +0300, Sakari Ailus wrote:
> Use the "rotation" 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.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> since v2.2:
> 
> - Fix property name in code.
> 
>  .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++
>  drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> index 33f10a94c381..6f509657470e 100644
> --- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
> @@ -29,6 +29,8 @@ Optional properties
>  - reset-gpios: XSHUTDOWN GPIO
>  - flash-leds: See ../video-interfaces.txt
>  - lens-focus: See ../video-interfaces.txt
> +- rotation: Integer property; valid values are 0 (sensor mounted upright)
> +	    and 180 (sensor mounted upside down).
>  
>  
>  Endpoint node mandatory properties
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> index e1f8208581aa..e9e0f21efc2a 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -2764,6 +2764,7 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
>  	struct v4l2_fwnode_endpoint *bus_cfg;
>  	struct fwnode_handle *ep;
>  	struct fwnode_handle *fwnode = dev_fwnode(dev);
> +	u32 rotation;
>  	int i;
>  	int rval;
>  
> @@ -2800,6 +2801,21 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
>  
>  	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
>  
> +	rval = fwnode_property_read_u32(fwnode, "rotation", &rotation);
> +	if (!rval) {
> +		switch (rotation) {
> +		case 180:
> +			hwcfg->module_board_orient =
> +				SMIAPP_MODULE_BOARD_ORIENT_180;
> +			/* Fall through */
> +		case 0:
> +			break;
> +		default:
> +			dev_err(dev, "invalid rotation %u\n", rotation);
> +			goto out_err;
> +		}
> +	}
> +
>  	/* NVM size is not mandatory */
>  	fwnode_property_read_u32(fwnode, "nokia,nvm-size", &hwcfg->nvm_size);
>  
> -- 
> 2.11.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2.2 2/2] smiapp: Support the "rotation" property
  2018-05-25 14:09       ` Sebastian Reichel
@ 2018-05-25 14:17           ` Sakari Ailus
  0 siblings, 0 replies; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 14:17 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-media, devicetree, andy.yeh

On Fri, May 25, 2018 at 04:09:55PM +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Fri, May 25, 2018 at 04:52:35PM +0300, Sakari Ailus wrote:
> > Use the "rotation" 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.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

Danke sch�n!

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2.2 2/2] smiapp: Support the "rotation" property
@ 2018-05-25 14:17           ` Sakari Ailus
  0 siblings, 0 replies; 13+ messages in thread
From: Sakari Ailus @ 2018-05-25 14:17 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-media, devicetree, andy.yeh

On Fri, May 25, 2018 at 04:09:55PM +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Fri, May 25, 2018 at 04:52:35PM +0300, Sakari Ailus wrote:
> > Use the "rotation" 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.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> 
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

Danke schön!

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors
  2018-05-25 12:27 ` [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors Sakari Ailus
  2018-05-25 14:05   ` Sebastian Reichel
@ 2018-05-31  3:33   ` Rob Herring
  1 sibling, 0 replies; 13+ messages in thread
From: Rob Herring @ 2018-05-31  3:33 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, devicetree, andy.yeh, sebastian.reichel

On Fri, May 25, 2018 at 03:27:25PM +0300, Sakari Ailus wrote:
> Sensors are occasionally mounted upside down to systems such as mobile
> phones or tablets. In order to use such a sensor without having to turn
> every image upside down, most camera sensors support reversing the readout
> order by setting both horizontal and vertical flipping.
> 
> This patch documents the "rotation" property for camera sensors, mirroring
> what is defined for displays in
> Documentation/devicetree/bindings/display/panel/panel.txt .
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  Documentation/devicetree/bindings/media/video-interfaces.txt | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2.2 2/2] smiapp: Support the "rotation" property
  2018-05-25 13:52     ` [PATCH v2.2 " Sakari Ailus
  2018-05-25 14:09       ` Sebastian Reichel
@ 2018-05-31  3:35       ` Rob Herring
  1 sibling, 0 replies; 13+ messages in thread
From: Rob Herring @ 2018-05-31  3:35 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, devicetree, andy.yeh, sebastian.reichel

On Fri, May 25, 2018 at 04:52:35PM +0300, Sakari Ailus wrote:
> Use the "rotation" 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.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> since v2.2:
> 
> - Fix property name in code.
> 
>  .../devicetree/bindings/media/i2c/nokia,smia.txt         |  2 ++

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/media/i2c/smiapp/smiapp-core.c                   | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-05-31  3:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 12:27 [PATCH v2 0/2] Define rotation property for camera sensors Sakari Ailus
2018-05-25 12:27 ` [PATCH v2 1/2] dt-bindings: media: Define "rotation" property for sensors Sakari Ailus
2018-05-25 14:05   ` Sebastian Reichel
2018-05-31  3:33   ` Rob Herring
2018-05-25 12:27 ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sakari Ailus
2018-05-25 13:40   ` [PATCH v2.1 2/2] smiapp: Support the "rotation" property Sakari Ailus
2018-05-25 13:52     ` [PATCH v2.2 " Sakari Ailus
2018-05-25 14:09       ` Sebastian Reichel
2018-05-25 14:17         ` Sakari Ailus
2018-05-25 14:17           ` Sakari Ailus
2018-05-31  3:35       ` Rob Herring
2018-05-25 13:41   ` [PATCH v2 2/2] smiapp: Support the "upside-down" property Sebastian Reichel
2018-05-25 13:52     ` Sakari Ailus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.