summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2013-10-23 20:47:53 -0700
committerMax Krummenacher <max.krummenacher@toradex.com>2015-12-26 13:46:19 +0100
commit1e44a4c2db2af9793871ef322455e0596c435968 (patch)
tree75068f861ca9ef5d4bbb9fd392c5a1fa5863be91 /drivers/media
parent7a0e6c99a098a8c3b4ca41631814c5d6675530e7 (diff)
ov5642: add imx6 mipi/parallel selection
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/mxc/capture/ov5642.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/media/platform/mxc/capture/ov5642.c b/drivers/media/platform/mxc/capture/ov5642.c
index be6122205c18..d5ffdcd1c86d 100644
--- a/drivers/media/platform/mxc/capture/ov5642.c
+++ b/drivers/media/platform/mxc/capture/ov5642.c
@@ -27,8 +27,11 @@
#include <linux/clk.h>
#include <linux/of_device.h>
#include <linux/i2c.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
#include <linux/of_gpio.h>
#include <linux/pinctrl/consumer.h>
+#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/fsl_devices.h>
#include <media/v4l2-chip-ident.h>
@@ -4084,6 +4087,8 @@ static int ov5642_probe(struct i2c_client *client,
struct device *dev = &client->dev;
int retval;
u8 chip_id_high, chip_id_low;
+ struct regmap *gpr;
+ struct sensor_data *sensor = &ov5642_data;
/* ov5642 pinctrl */
pinctrl = devm_pinctrl_get_select_default(dev);
@@ -4138,6 +4143,13 @@ static int ov5642_probe(struct i2c_client *client,
return retval;
}
+ retval = of_property_read_u32(dev->of_node, "ipu_id",
+ &sensor->ipu_id);
+ if (retval) {
+ dev_err(dev, "ipu_id missing or invalid\n");
+ return retval;
+ }
+
retval = of_property_read_u32(dev->of_node, "csi_id",
&(ov5642_data.csi));
if (retval) {
@@ -4145,6 +4157,11 @@ static int ov5642_probe(struct i2c_client *client,
return retval;
}
+ if (sensor->csi != sensor->ipu_id) {
+ pr_warning("%s: csi_id != ipu_id\n", __func__);
+ return -ENODEV;
+ }
+
clk_prepare_enable(ov5642_data.sensor_clk);
ov5642_data.io_init = ov5642_reset;
@@ -4177,6 +4194,23 @@ static int ov5642_probe(struct i2c_client *client,
return -ENODEV;
}
+ gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
+ if (!IS_ERR(gpr)) {
+ if (of_machine_is_compatible("fsl,imx6q")) {
+ int mask = ov5642_data.csi ? (1 << 20) : (1 << 19);
+
+ regmap_update_bits(gpr, IOMUXC_GPR1, mask, mask);
+ } else if (of_machine_is_compatible("fsl,imx6dl")) {
+ int mask = ov5642_data.csi ? (7 << 3) : (7 << 0);
+ int val = ov5642_data.csi ? (4 << 3) : (4 << 0);
+
+ regmap_update_bits(gpr, IOMUXC_GPR13, mask, val);
+ }
+ } else {
+ pr_err("%s: failed to find fsl,imx6q-iomux-gpr regmap\n",
+ __func__);
+ }
+
ov5642_standby(1);
ov5642_int_device.priv = &ov5642_data;