aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/media/i2c/smiapp
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2018-05-02 16:59:00 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-06-28 08:44:00 -0400
commit5f9e711b75a51b96c05f61a93b3f7c0d79dc20e2 (patch)
tree25da355b6fc78f3f704ba211adda104be6e72bae /drivers/media/i2c/smiapp
parentmedia: dt-bindings: smia: Add "rotation" property (diff)
downloadwireguard-linux-5f9e711b75a51b96c05f61a93b3f7c0d79dc20e2.tar.xz
wireguard-linux-5f9e711b75a51b96c05f61a93b3f7c0d79dc20e2.zip
media: smiapp: Support the "rotation" property
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> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/i2c/smiapp')
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c16
1 files changed, 16 insertions, 0 deletions
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);