linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Support rotation property for smia sensors
@ 2018-06-14 12:29 Sakari Ailus
  2018-06-14 12:29 ` [PATCH v3 1/2] dt-bindings: smia: Add "rotation" property Sakari Ailus
  2018-06-14 12:29 ` [PATCH v3 2/2] smiapp: Support the " Sakari Ailus
  0 siblings, 2 replies; 3+ messages in thread
From: Sakari Ailus @ 2018-06-14 12:29 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree

Hi folks,

This is an earlier patch "smiapp: Support the "upside-down" property"
split into two -- the DT binding change and a driver change.

The only change is in DT bindings --- an added reference to
video-interfaces.txt in rotation property documentation.

Sakari Ailus (2):
  dt-bindings: smia: Add "rotation" property
  smiapp: Support the "rotation" property

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

-- 
2.11.0

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

* [PATCH v3 1/2] dt-bindings: smia: Add "rotation" property
  2018-06-14 12:29 [PATCH v3 0/2] Support rotation property for smia sensors Sakari Ailus
@ 2018-06-14 12:29 ` Sakari Ailus
  2018-06-14 12:29 ` [PATCH v3 2/2] smiapp: Support the " Sakari Ailus
  1 sibling, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2018-06-14 12:29 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree

Add the rotation property to list of optional properties for the smia
sensors.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/media/i2c/nokia,smia.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
index 33f10a94c381..8ee7c7972ac7 100644
--- a/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
+++ b/Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
@@ -29,6 +29,9 @@ 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). See
+	    ../video-interfaces.txt .
 
 
 Endpoint node mandatory properties
-- 
2.11.0

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

* [PATCH v3 2/2] smiapp: Support the "rotation" property
  2018-06-14 12:29 [PATCH v3 0/2] Support rotation property for smia sensors Sakari Ailus
  2018-06-14 12:29 ` [PATCH v3 1/2] dt-bindings: smia: Add "rotation" property Sakari Ailus
@ 2018-06-14 12:29 ` Sakari Ailus
  1 sibling, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2018-06-14 12:29 UTC (permalink / raw)
  To: linux-media; +Cc: devicetree

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>
---
 drivers/media/i2c/smiapp/smiapp-core.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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] 3+ messages in thread

end of thread, other threads:[~2018-06-14 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 12:29 [PATCH v3 0/2] Support rotation property for smia sensors Sakari Ailus
2018-06-14 12:29 ` [PATCH v3 1/2] dt-bindings: smia: Add "rotation" property Sakari Ailus
2018-06-14 12:29 ` [PATCH v3 2/2] smiapp: Support the " Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).