aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0034-arm64-dts-r8a7795-es1-h3ulcb-kf-add-ADAS-board.patch129
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0037-arm64-dts-r8a7796-m3ulcb-kf-add-ADAS-board.patch102
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0041-arm64-dts-r8a7795-h3ulcb-kf-add-ADAS-board.patch46
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch952
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/h3ulcb.cfg2
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/m3ulcb.cfg2
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend1
7 files changed, 1212 insertions, 22 deletions
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0034-arm64-dts-r8a7795-es1-h3ulcb-kf-add-ADAS-board.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0034-arm64-dts-r8a7795-es1-h3ulcb-kf-add-ADAS-board.patch
index f9df329..85dd18e 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0034-arm64-dts-r8a7795-es1-h3ulcb-kf-add-ADAS-board.patch
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0034-arm64-dts-r8a7795-es1-h3ulcb-kf-add-ADAS-board.patch
@@ -8,11 +8,13 @@ Kingfisher board on R8A7795 ES1.x SoC
Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
arch/arm64/boot/dts/renesas/Makefile | 1 +
- .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts | 429 ++++++
- .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts | 1627 ++++++++++++++++++++
- 3 files changed, 2057 insertions(+)
+ .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts | 443 ++++++
+ .../boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts | 1645 ++++++++++++++++++++
+ .../boot/dts/renesas/r8a7795-h3ulcb-kf-rpi.dtsi | 75 +
+ 4 files changed, 2164 insertions(+)
create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts
create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts
+ create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-rpi.dtsi
diff --git a/arch/arm64/boot/dts/renesas/Makefile b/arch/arm64/boot/dts/renesas/Makefile
index 51a4ac9..24f8036 100644
@@ -28,10 +30,10 @@ index 51a4ac9..24f8036 100644
clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts
new file mode 100644
-index 0000000..680a231
+index 0000000..d245bbe
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf-v1.dts
-@@ -0,0 +1,429 @@
+@@ -0,0 +1,443 @@
+/*
+ * Device Tree Source for the H3ULCB Kingfisher V1 board on r8a7795 ES1.x
+ *
@@ -408,6 +410,20 @@ index 0000000..680a231
+ output-high;
+ line-name = "Video-A A1";
+ };
++ /* pin 12 - CAM_CLK */
++ rpi_cam_io_1 {
++ gpio-hog;
++ gpios = <10 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO1";
++ };
++ /* pin 11 - CAM_GPIO - assume pwdn */
++ rpi_cam_io_0 {
++ gpio-hog;
++ gpios = <11 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO0";
++ };
+ /* 0 - FPDLink output, 1 - LVDS output */
+ lvds_vs_fpdl {
+ gpio-hog;
@@ -463,10 +479,10 @@ index 0000000..680a231
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts
new file mode 100644
-index 0000000..e3ccb2d
+index 0000000..9d04ec4
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7795-es1-h3ulcb-kf.dts
-@@ -0,0 +1,1627 @@
+@@ -0,0 +1,1645 @@
+/*
+ * Device Tree Source for the H3ULCB Kingfisher board on r8a7795 ES1.x
+ *
@@ -973,6 +989,21 @@ index 0000000..e3ccb2d
+ interrupt-controller;
+ interrupt-parent = <&gpio7>;
+ interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
++
++ /* pin 12 - CAM_CLK */
++ rpi_cam_io_1 {
++ gpio-hog;
++ gpios = <10 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO1";
++ };
++ /* pin 11 - CAM_GPIO - assume pwdn */
++ rpi_cam_io_0 {
++ gpio-hog;
++ gpios = <11 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO0";
++ };
+ };
+
+ i2cswitch4: pca9548@74 {
@@ -2094,6 +2125,90 @@ index 0000000..e3ccb2d
+ status = "okay";
+ };
+};
++
++/* uncomment to enable CN48 on VIN4 */
++//#include "r8a7795-h3ulcb-kf-rpi.dtsi"
+diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-rpi.dtsi b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-rpi.dtsi
+new file mode 100644
+index 0000000..d3b4ece
+--- /dev/null
++++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-rpi.dtsi
+@@ -0,0 +1,75 @@
++/*
++ * Device Tree Source for the H3ULCB Kingfisher board:
++ * this adding conflicting resource on VIN4 for Raspberry Pi camera
++ *
++ * Copyright (C) 2017 Renesas Electronics Corp.
++ * Copyright (C) 2017 Cogent Embedded, Inc.
++ *
++ * This file is licensed under the terms of the GNU General Public License
++ * version 2. This program is licensed "as is" without any warranty of any
++ * kind, whether express or implied.
++ */
++
++&i2cswitch4 {
++ i2c@4 {
++ #address-cells = <1>;
++ #size-cells = <0>;
++ reg = <4>;
++
++ rpi_camera: ov5647@36 {
++ compatible = "ovti,ov5647";
++ reg = <0x36>;
++
++ port@0 {
++ rpi_camera_in: endpoint {
++ clock-lanes = <0>;
++ data-lanes = <1 2>;
++ remote-endpoint = <&vin4ep0>;
++ };
++ };
++ };
++ };
++};
++
++&vin4 {
++ ports {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ port@0 {
++ vin4ep0: endpoint {
++ csi,select = "csi20";
++ virtual,channel = <0>;
++ remote-endpoint = <&rpi_camera_in>;
++ data-lanes = <1 2>;
++ };
++ };
++ port@1 {
++ csi2ep0: endpoint {
++ remote-endpoint = <&csi2_20_ep>;
++ };
++ };
++ };
++};
++
++&csi2_20 {
++ status = "okay";
++
++ virtual,channel {
++ csi2_vc0 {
++ data,type = "raw8";
++ receive,vc = <0>;
++ };
++ };
++
++ port {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ csi2_20_ep: endpoint {
++ clock-lanes = <0>;
++ data-lanes = <1 2>;
++ csi-rate = <280>;
++ };
++ };
++};
--
1.9.1
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0037-arm64-dts-r8a7796-m3ulcb-kf-add-ADAS-board.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0037-arm64-dts-r8a7796-m3ulcb-kf-add-ADAS-board.patch
index 23b242c..2012a69 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0037-arm64-dts-r8a7796-m3ulcb-kf-add-ADAS-board.patch
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0037-arm64-dts-r8a7796-m3ulcb-kf-add-ADAS-board.patch
@@ -8,9 +8,9 @@ Kingfisher board on R8A7796
Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
arch/arm64/boot/dts/renesas/Makefile | 1 +
- .../boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts | 429 ++++++++
- arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts | 1155 ++++++++++++++++++++
- 3 files changed, 1585 insertions(+)
+ .../boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts | 443 +++++++
+ arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts | 1227 ++++++++++++++++++++
+ 3 files changed, 1671 insertions(+)
create mode 100644 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts
create mode 100644 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts
@@ -28,10 +28,10 @@ index 5d99267..e41b5b3 100644
clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts
new file mode 100644
-index 0000000..b205e3f
+index 0000000..ff0ec0f
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf-v1.dts
-@@ -0,0 +1,429 @@
+@@ -0,0 +1,443 @@
+/*
+ * Device Tree Source for the M3ULCB Kingfisher V1 board
+ *
@@ -408,6 +408,20 @@ index 0000000..b205e3f
+ output-high;
+ line-name = "Video-A A1";
+ };
++ /* pin 12 - CAM_CLK */
++ rpi_cam_io_1 {
++ gpio-hog;
++ gpios = <10 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO1";
++ };
++ /* pin 11 - CAM_GPIO - assume pwdn */
++ rpi_cam_io_0 {
++ gpio-hog;
++ gpios = <11 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO0";
++ };
+ /* 0 - FPDLink output, 1 - LVDS output */
+ lvds_vs_fpdl {
+ gpio-hog;
@@ -463,10 +477,10 @@ index 0000000..b205e3f
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts
new file mode 100644
-index 0000000..1e11768
+index 0000000..4228dec
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7796-m3ulcb-kf.dts
-@@ -0,0 +1,1155 @@
+@@ -0,0 +1,1227 @@
+/*
+ * Device Tree Source for the M3ULCB Kingfisher board on r8a7796
+ *
@@ -973,6 +987,21 @@ index 0000000..1e11768
+ interrupt-controller;
+ interrupt-parent = <&gpio7>;
+ interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
++
++ /* pin 12 - CAM_CLK */
++ rpi_cam_io_1 {
++ gpio-hog;
++ gpios = <10 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO1";
++ };
++ /* pin 11 - CAM_GPIO - assume pwdn */
++ rpi_cam_io_0 {
++ gpio-hog;
++ gpios = <11 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO0";
++ };
+ };
+
+ i2cswitch4: pca9548@74 {
@@ -1210,7 +1239,19 @@ index 0000000..1e11768
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <4>;
-+ /* CSI camera node(s) */
++
++ rpi_camera: ov5647@36 {
++ compatible = "ovti,ov5647";
++ reg = <0x36>;
++
++ port@0 {
++ rpi_camera_in: endpoint {
++ clock-lanes = <0>;
++ data-lanes = <1 2>;
++ remote-endpoint = <&vin4ep0>;
++ };
++ };
++ };
+ };
+
+ i2c@5 {
@@ -1484,6 +1525,29 @@ index 0000000..1e11768
+ };
+};
+
++&vin4 {
++ status = "okay";
++
++ ports {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ port@0 {
++ vin4ep0: endpoint {
++ csi,select = "csi20";
++ virtual,channel = <0>;
++ remote-endpoint = <&rpi_camera_in>;
++ data-lanes = <1 2>;
++ };
++ };
++ port@1 {
++ csi2ep0: endpoint {
++ remote-endpoint = <&csi2_20_ep>;
++ };
++ };
++ };
++};
++
+&csi2_40 {
+ status = "okay";
+
@@ -1518,6 +1582,28 @@ index 0000000..1e11768
+ };
+};
+
++&csi2_20 {
++ status = "okay";
++
++ virtual,channel {
++ csi2_vc0 {
++ data,type = "raw8";
++ receive,vc = <0>;
++ };
++ };
++
++ port {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ csi2_20_ep: endpoint {
++ clock-lanes = <0>;
++ data-lanes = <1 2>;
++ csi-rate = <280>;
++ };
++ };
++};
++
+&rcar_sound {
+ pinctrl-0 = <&sound_clk_pins>;
+
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0041-arm64-dts-r8a7795-h3ulcb-kf-add-ADAS-board.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0041-arm64-dts-r8a7795-h3ulcb-kf-add-ADAS-board.patch
index cd3c5ee..33214cf 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0041-arm64-dts-r8a7795-h3ulcb-kf-add-ADAS-board.patch
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0041-arm64-dts-r8a7795-h3ulcb-kf-add-ADAS-board.patch
@@ -8,9 +8,9 @@ Kingfisher board on R8A7795 SoC
Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
arch/arm64/boot/dts/renesas/Makefile | 1 +
- .../boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts | 429 ++++++
- arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts | 1623 ++++++++++++++++++++
- 3 files changed, 2053 insertions(+)
+ .../boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts | 443 ++++++
+ arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts | 1641 ++++++++++++++++++++
+ 3 files changed, 2085 insertions(+)
create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts
create mode 100644 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts
@@ -28,10 +28,10 @@ index d163df7..86a08db 100644
clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts
new file mode 100644
-index 0000000..1d64e6c
+index 0000000..4b10d31
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf-v1.dts
-@@ -0,0 +1,429 @@
+@@ -0,0 +1,443 @@
+/*
+ * Device Tree Source for the H3ULCB Kingfisher V1 board
+ *
@@ -408,6 +408,20 @@ index 0000000..1d64e6c
+ output-high;
+ line-name = "Video-A A1";
+ };
++ /* pin 12 - CAM_CLK */
++ rpi_cam_io_1 {
++ gpio-hog;
++ gpios = <10 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO1";
++ };
++ /* pin 11 - CAM_GPIO - assume pwdn */
++ rpi_cam_io_0 {
++ gpio-hog;
++ gpios = <11 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO0";
++ };
+ /* 0 - FPDLink output, 1 - LVDS output */
+ lvds_vs_fpdl {
+ gpio-hog;
@@ -463,10 +477,10 @@ index 0000000..1d64e6c
+};
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts
new file mode 100644
-index 0000000..7b6c9bc
+index 0000000..472b375
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb-kf.dts
-@@ -0,0 +1,1623 @@
+@@ -0,0 +1,1641 @@
+/*
+ * Device Tree Source for the H3ULCB Kingfisher board on r8a7795
+ *
@@ -973,6 +987,21 @@ index 0000000..7b6c9bc
+ interrupt-controller;
+ interrupt-parent = <&gpio7>;
+ interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
++
++ /* pin 12 - CAM_CLK */
++ rpi_cam_io_1 {
++ gpio-hog;
++ gpios = <10 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO1";
++ };
++ /* pin 11 - CAM_GPIO - assume pwdn */
++ rpi_cam_io_0 {
++ gpio-hog;
++ gpios = <11 GPIO_ACTIVE_HIGH>;
++ output-high;
++ line-name = "RaspB_IO0";
++ };
+ };
+
+ i2cswitch4: pca9548@74 {
@@ -2090,6 +2119,9 @@ index 0000000..7b6c9bc
+ status = "okay";
+ };
+};
++
++/* uncomment to enable CN48 on VIN4 */
++//#include "r8a7795-h3ulcb-kf-rpi.dtsi"
--
1.9.1
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch
new file mode 100644
index 0000000..1cd366c
--- /dev/null
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0060-media-i2c-Add-ov5647-sensor.patch
@@ -0,0 +1,952 @@
+From 8b97232e3ecbb4ee38bda454915e62914ef52fcc Mon Sep 17 00:00:00 2001
+From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+Date: Thu, 1 Jun 2017 19:59:56 +0300
+Subject: [PATCH] media: i2c: Add ov5647 sensor
+
+Add ov5647 camera sensor driver
+
+Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
+---
+ drivers/media/i2c/soc_camera/Kconfig | 6 +
+ drivers/media/i2c/soc_camera/Makefile | 1 +
+ drivers/media/i2c/soc_camera/ov5647.c | 649 ++++++++++++++++++++++++++++++++++
+ drivers/media/i2c/soc_camera/ov5647.h | 242 +++++++++++++
+ 4 files changed, 898 insertions(+)
+ create mode 100644 drivers/media/i2c/soc_camera/ov5647.c
+ create mode 100644 drivers/media/i2c/soc_camera/ov5647.h
+
+diff --git a/drivers/media/i2c/soc_camera/Kconfig b/drivers/media/i2c/soc_camera/Kconfig
+index e1c65ca..c272aeb 100644
+--- a/drivers/media/i2c/soc_camera/Kconfig
++++ b/drivers/media/i2c/soc_camera/Kconfig
+@@ -97,6 +97,12 @@ config SOC_CAMERA_OV5642
+ help
+ This is a V4L2 camera driver for the OmniVision OV5642 sensor
+
++config SOC_CAMERA_OV5647
++ tristate "ov5647 camera support"
++ depends on SOC_CAMERA && I2C
++ help
++ This is a V4L2 camera driver for the OmniVision OV5647 sensor
++
+ config SOC_CAMERA_OV6650
+ tristate "ov6650 sensor support"
+ depends on SOC_CAMERA && I2C
+diff --git a/drivers/media/i2c/soc_camera/Makefile b/drivers/media/i2c/soc_camera/Makefile
+index 8e24d5d..a67fff8 100644
+--- a/drivers/media/i2c/soc_camera/Makefile
++++ b/drivers/media/i2c/soc_camera/Makefile
+@@ -13,6 +13,7 @@ obj-$(CONFIG_SOC_CAMERA_OV495_OV2775) += ov495_ov2775.o
+ obj-$(CONFIG_SOC_CAMERA_OV106XX) += ov106xx.o
+ obj-$(CONFIG_SOC_CAMERA_OV2640) += ov2640.o
+ obj-$(CONFIG_SOC_CAMERA_OV5642) += ov5642.o
++obj-$(CONFIG_SOC_CAMERA_OV5647) += ov5647.o
+ obj-$(CONFIG_SOC_CAMERA_OV6650) += ov6650.o
+ obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o
+ obj-$(CONFIG_SOC_CAMERA_OV9640) += ov9640.o
+diff --git a/drivers/media/i2c/soc_camera/ov5647.c b/drivers/media/i2c/soc_camera/ov5647.c
+new file mode 100644
+index 0000000..caccf39
+--- /dev/null
++++ b/drivers/media/i2c/soc_camera/ov5647.c
+@@ -0,0 +1,649 @@
++/*
++ * V4L2 driver for OmniVision OV5647 cameras.
++ *
++ * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver
++ * Copyright (C) 2011 Sylwester Nawrocki <s.nawrocki@samsung.com>
++ *
++ * Based on Omnivision OV7670 Camera Driver
++ * Copyright (C) 2006-7 Jonathan Corbet <corbet@lwn.net>
++ *
++ * Copyright (C) 2016, Synopsys, Inc.
++ *
++ * Copyright (C) 2017 Cogent Embedded, Inc
++ */
++
++#include <linux/init.h>
++#include <linux/module.h>
++#include <linux/slab.h>
++#include <linux/i2c.h>
++#include <linux/delay.h>
++#include <linux/videodev2.h>
++#include <media/v4l2-device.h>
++#include <media/v4l2-ctrls.h>
++#include <media/v4l2-mediabus.h>
++#include <media/v4l2-image-sizes.h>
++#include <media/v4l2-of.h>
++#include <linux/io.h>
++
++#include "ov5647.h"
++
++static bool debug = true;
++module_param(debug, bool, 0644);
++MODULE_PARM_DESC(debug, "Debug level (0-1)");
++
++#define OV5647_I2C_ADDR 0x6c
++#define SENSOR_NAME "ov5647"
++
++#define OV5647_REG_CHIPID_H 0x300A
++#define OV5647_REG_CHIPID_L 0x300B
++
++#define REG_TERM 0xfffe
++#define VAL_TERM 0xfe
++#define REG_DLY 0xffff
++
++/*define the voltage level of control signal*/
++#define CSI_STBY_ON 1
++#define CSI_STBY_OFF 0
++#define CSI_RST_ON 0
++#define CSI_RST_OFF 1
++#define CSI_PWR_ON 1
++#define CSI_PWR_OFF 0
++#define CSI_AF_PWR_ON 1
++#define CSI_AF_PWR_OFF 0
++
++#define OV5647_ROW_START 0x01
++#define OV5647_ROW_START_MIN 0
++#define OV5647_ROW_START_MAX 2004
++#define OV5647_ROW_START_DEF 54
++
++#define OV5647_COLUMN_START 0x02
++#define OV5647_COLUMN_START_MIN 0
++#define OV5647_COLUMN_START_MAX 2750
++#define OV5647_COLUMN_START_DEF 16
++
++#define OV5647_WINDOW_HEIGHT 0x03
++#define OV5647_WINDOW_HEIGHT_MIN 2
++#define OV5647_WINDOW_HEIGHT_MAX 2006
++#define OV5647_WINDOW_HEIGHT_DEF 1944
++
++#define OV5647_WINDOW_WIDTH 0x04
++#define OV5647_WINDOW_WIDTH_MIN 2
++#define OV5647_WINDOW_WIDTH_MAX 2752
++#define OV5647_WINDOW_WIDTH_DEF 2592
++
++enum power_seq_cmd {
++ CSI_SUBDEV_PWR_OFF = 0x00,
++ CSI_SUBDEV_PWR_ON = 0x01,
++};
++
++struct sensor_format_struct {
++ __u8 *desc;
++ u32 mbus_code;
++ enum v4l2_colorspace colorspace;
++ struct regval_list *regs;
++ int regs_size;
++ int bpp;
++};
++
++struct cfg_array {
++ struct regval_list *regs;
++ int size;
++};
++
++struct sensor_win_size {
++ int width;
++ int height;
++ unsigned int hoffset;
++ unsigned int voffset;
++ unsigned int hts;
++ unsigned int vts;
++ unsigned int pclk;
++ unsigned int mipi_bps;
++ unsigned int fps_fixed;
++ unsigned int bin_factor;
++ unsigned int intg_min;
++ unsigned int intg_max;
++ void *regs;
++ int regs_size;
++ int (*set_size)(struct v4l2_subdev *subdev);
++};
++
++struct ov5647 {
++ struct device *dev;
++ struct v4l2_subdev subdev;
++ struct media_pad pad;
++ struct mutex lock;
++ struct v4l2_mbus_framefmt format;
++ struct sensor_format_struct *fmt;
++ unsigned int width;
++ unsigned int height;
++ unsigned int capture_mode;
++ int hue;
++ struct v4l2_fract tpf;
++ struct sensor_win_size *current_wins;
++};
++
++static inline struct ov5647 *to_state(struct v4l2_subdev *subdev)
++{
++ return container_of(subdev, struct ov5647, subdev);
++}
++
++static struct sensor_format_struct sensor_formats[] = {
++ {
++ .mbus_code = OV5647_CODE,
++ .colorspace = V4L2_COLORSPACE_JPEG,
++ },
++};
++#define N_FMTS ARRAY_SIZE(sensor_formats)
++
++static int ov5647_write(struct v4l2_subdev *sd, uint16_t reg, uint8_t val)
++{
++ int ret;
++ unsigned char data[3] = { reg >> 8, reg & 0xff, val};
++ struct i2c_client *client = v4l2_get_subdevdata(sd);
++
++ ret = i2c_master_send(client, data, 3);
++ if (ret < 3) {
++ printk( "%s: i2c write error, reg: %x, %d\n",
++ __func__, reg, ret);
++ return ret < 0 ? ret : -EIO;
++ }
++
++ return 0;
++}
++
++static int ov5647_read(struct v4l2_subdev *sd, uint16_t reg, uint8_t *val)
++{
++ int ret;
++ unsigned char data_w[2] = { reg >> 8, reg & 0xff };
++ struct i2c_client *client = v4l2_get_subdevdata(sd);
++
++
++ ret = i2c_master_send(client, data_w, 2);
++
++ if (ret < 2) {
++ printk("%s: i2c read error, reg: %x\n",
++ __func__, reg);
++ return ret < 0 ? ret : -EIO;
++ }
++
++ ret = i2c_master_recv(client, val, 1);
++
++ if (ret < 1) {
++ printk("%s: i2c read error, reg: %x\n",
++ __func__, reg);
++ return ret < 0 ? ret : -EIO;
++ }
++
++ return 0;
++}
++
++static int ov5647_write_array(struct v4l2_subdev *subdev,
++ struct regval_list *regs, int array_size)
++{
++ int i = 0;
++ int ret = 0;
++
++ if (!regs)
++ return -EINVAL;
++
++ while (i < array_size) {
++ if (regs->addr == REG_DLY)
++ mdelay(regs->data);
++ else
++ ret = ov5647_write(subdev, regs->addr, regs->data);
++
++ if (ret == -EIO)
++ return ret;
++
++ i++;
++ regs++;
++ }
++ return 0;
++}
++
++static void ov5647_set_virtual_channel(struct v4l2_subdev *subdev, int channel)
++{
++#if 0
++ u8 channel_id;
++
++ ov5647_read(subdev, 0x4814, &channel_id);
++// channel_id = 0x1e; //override
++
++ channel_id &= ~(3 << 6);
++ channel_id |= (channel << 6);
++ printk("0x4814 = 0x%02x\n", channel_id);
++ ov5647_write(subdev, 0x4814, channel_id);
++ ov5647_write(subdev, 0x4801, 0x8f);
++#endif
++}
++
++void ov5647_stream_on(struct v4l2_subdev *subdev)
++{
++ ov5647_write(subdev, 0x4202, 0x00);
++ ov5647_write(subdev, 0x300D, 0x00);
++}
++
++void ov5647_stream_off(struct v4l2_subdev *subdev)
++{
++ ov5647_write(subdev, 0x4202, 0x0f);
++ ov5647_write(subdev, 0x300D, 0x01);
++}
++
++static int sensor_s_sw_stby(struct v4l2_subdev *subdev, int on_off)
++{
++ int ret;
++ unsigned char rdval;
++
++ ret = ov5647_read(subdev, 0x0100, &rdval);
++ if (ret != 0)
++ return ret;
++
++ if (on_off == CSI_STBY_ON)
++ ret = ov5647_write(subdev, 0x0100, rdval&0xfe);
++ else
++ ret = ov5647_write(subdev, 0x0100, rdval|0x01);
++
++ return ret;
++}
++
++static int __sensor_init(struct v4l2_subdev *subdev)
++{
++ int ret;
++ unsigned char rdval;
++
++ ret = ov5647_read(subdev, 0x0100, &rdval);
++ if (ret != 0)
++ return ret;
++
++ ov5647_write(subdev, 0x4800, 0x25);
++ ov5647_stream_off(subdev);
++
++ ov5647_write(subdev, 0x100, 0);
++ /* reset */
++ ov5647_write(subdev, 0x103, 1);
++ ov5647_write(subdev, 0x103, 1);
++ ov5647_write(subdev, 0x103, 1);
++ mdelay(10);
++
++ ret = ov5647_write_array(subdev, ov5647_recommend_settings,
++ ARRAY_SIZE(ov5647_recommend_settings));
++#if 1
++ ret = ov5647_write_array(subdev, ov5647_snap_settings,
++ ARRAY_SIZE(ov5647_snap_settings));
++#else
++ ret = ov5647_write_array(subdev, ov5647_prev_settings,
++ ARRAY_SIZE(ov5647_prev_settings));
++#endif
++ ov5647_set_virtual_channel(subdev, 0);
++
++ ov5647_write(subdev, 0x0100, 0x01);
++
++ ov5647_write(subdev, 0x04800, 0x04);
++ ov5647_stream_on(subdev);
++ msleep(30);
++
++ return 0;
++}
++
++static int sensor_power(struct v4l2_subdev *subdev, int on)
++{
++ int ret = 0;
++ struct ov5647 *ov5647 = to_state(subdev);
++
++ mutex_lock(&ov5647->lock);
++
++ switch (on) {
++ case CSI_SUBDEV_PWR_OFF:
++ ret = sensor_s_sw_stby(subdev, CSI_STBY_ON);
++ if (ret < 0)
++ printk("soft stby failed!\n");
++ break;
++ case CSI_SUBDEV_PWR_ON:
++ ret = __sensor_init(subdev);
++ if (ret < 0) {
++ v4l2_err(subdev, "Camera not available, check power\n");
++ break;
++ }
++ break;
++ default:
++ return -EINVAL;
++ }
++
++ mutex_unlock(&ov5647->lock);
++
++ return 0;
++}
++
++#ifdef CONFIG_VIDEO_ADV_DEBUG
++static int sensor_get_register(struct v4l2_subdev *subdev,
++ struct v4l2_dbg_register *reg)
++{
++ u8 val = 0;
++ int ret;
++
++ ret = ov5647_read(subdev, (u16)reg->reg, &val);
++ if (ret < 0)
++ return ret;
++
++ reg->val = val;
++ reg->size = sizeof(u8);
++
++ return ret;
++}
++
++static int sensor_set_register(struct v4l2_subdev *subdev,
++ const struct v4l2_dbg_register *reg)
++{
++ ov5647_write(subdev, (u16)reg->reg, (u8)reg->val);
++
++ return 0;
++}
++#endif
++
++static const struct v4l2_subdev_core_ops sensor_core_ops = {
++ .s_power = sensor_power,
++#ifdef CONFIG_VIDEO_ADV_DEBUG
++ .g_register = sensor_get_register,
++ .s_register = sensor_set_register,
++#endif
++};
++
++static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
++{
++ if (enable)
++ ov5647_stream_on(sd);
++ else
++ ov5647_stream_off(sd);
++
++ return 0;
++}
++
++static int sensor_enum_fmt(struct v4l2_subdev *sd,
++ struct v4l2_subdev_pad_config *cfg,
++ struct v4l2_subdev_mbus_code_enum *code)
++{
++ if (code->pad || code->index >= N_FMTS)
++ return -EINVAL;
++
++ code->code = OV5647_CODE;
++
++ return 0;
++}
++
++static int sensor_try_fmt_internal(struct v4l2_subdev *subdev,
++ struct v4l2_mbus_framefmt *fmt,
++ struct sensor_format_struct **ret_fmt,
++ struct sensor_win_size **ret_wsize)
++{
++ int index;
++
++ for (index = 0; index < N_FMTS; index++)
++ if (sensor_formats[index].mbus_code == fmt->code)
++ break;
++
++ if (index >= N_FMTS)
++ return -EINVAL;
++
++ if (ret_fmt != NULL)
++ *ret_fmt = sensor_formats + index;
++
++ fmt->field = V4L2_FIELD_NONE;
++
++ return 0;
++}
++
++static int sensor_s_fmt(struct v4l2_subdev *subdev,
++ struct v4l2_subdev_pad_config *cfg,
++ struct v4l2_subdev_format *fmt)
++{
++ int ret;
++ struct sensor_format_struct *sensor_fmt;
++ struct sensor_win_size *wsize = NULL;
++ struct ov5647 *info = to_state(subdev);
++
++ ret = sensor_try_fmt_internal(subdev, &fmt->format,
++ &sensor_fmt, &wsize);
++ if (ret)
++ return ret;
++
++ info->fmt = sensor_fmt;
++ info->width = OV5647_WIDTH;
++ info->height = OV5647_HEIGHT;
++
++ return 0;
++}
++
++static int sensor_g_fmt(struct v4l2_subdev *sd,
++ struct v4l2_subdev_pad_config *cfg,
++ struct v4l2_subdev_format *format)
++{
++ struct ov5647 *info = to_state(sd);
++ struct v4l2_mbus_framefmt *mf = &format->format;
++
++ if (format->pad != 0)
++ return -EINVAL;
++
++ mf->width = OV5647_WIDTH;
++ mf->height = OV5647_HEIGHT;
++ mf->code = OV5647_CODE;
++ mf->colorspace = info->fmt->colorspace;
++ mf->field = V4L2_FIELD_NONE;
++
++ return 0;
++}
++
++static int sensor_s_parm(struct v4l2_subdev *subdev,
++ struct v4l2_streamparm *parms)
++{
++ struct v4l2_captureparm *cp = &parms->parm.capture;
++ struct ov5647 *info = to_state(subdev);
++
++ if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
++ return -EINVAL;
++
++ if (info->tpf.numerator == 0)
++ return -EINVAL;
++
++ info->capture_mode = cp->capturemode;
++
++ return 0;
++}
++
++static int sensor_g_parm(struct v4l2_subdev *subdev,
++ struct v4l2_streamparm *parms)
++{
++ struct v4l2_captureparm *cp = &parms->parm.capture;
++ struct ov5647 *info = to_state(subdev);
++
++ if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
++ return -EINVAL;
++
++ memset(cp, 0, sizeof(struct v4l2_captureparm));
++ cp->capability = V4L2_CAP_TIMEPERFRAME;
++ cp->capturemode = info->capture_mode;
++
++ return 0;
++}
++
++static int sensor_g_mbus_config(struct v4l2_subdev *sd,
++ struct v4l2_mbus_config *cfg)
++{
++ cfg->flags = V4L2_MBUS_CSI2_1_LANE | V4L2_MBUS_CSI2_CHANNEL_0 |
++ V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
++ cfg->type = V4L2_MBUS_CSI2;
++
++ return 0;
++}
++
++static const struct v4l2_subdev_pad_ops sensor_pad_ops = {
++ .enum_mbus_code = sensor_enum_fmt,
++ .set_fmt = sensor_s_fmt,
++ .get_fmt = sensor_g_fmt,
++};
++
++static const struct v4l2_subdev_video_ops sensor_video_ops = {
++ .s_stream = sensor_s_stream,
++ .s_parm = sensor_s_parm,
++ .g_parm = sensor_g_parm,
++ .g_mbus_config = sensor_g_mbus_config,
++};
++
++static const struct v4l2_subdev_ops subdev_ops = {
++ .core = &sensor_core_ops,
++ .video = &sensor_video_ops,
++ .pad = &sensor_pad_ops,
++};
++
++static int ov5647_detect(struct v4l2_subdev *sd)
++{
++ struct i2c_client *client = v4l2_get_subdevdata(sd);
++ unsigned char id_h, id_l;
++ int ret;
++
++ ret = sensor_power(sd, 1);
++ if (ret < 0)
++ return ret;
++
++ ret = ov5647_read(sd, OV5647_REG_CHIPID_H, &id_h);
++ if (ret < 0)
++ return ret;
++ ret = ov5647_read(sd, OV5647_REG_CHIPID_L, &id_l);
++ if (ret < 0)
++ return ret;
++
++ if ((id_h != 0x56) || (id_l != 0x47)) {
++ v4l2_info(sd, "Invalid device ID: %02x%02x\n", id_h, id_l);
++ return -ENODEV;
++ }
++
++ v4l2_info(sd, "OV5647 detected at address 0x%02x\n", client->addr);
++
++ ret = sensor_power(sd, 0);
++ if (ret < 0)
++ return ret;
++
++ return 0;
++}
++
++static int ov5647_registered(struct v4l2_subdev *subdev)
++{
++ return 0;
++}
++
++static int ov5647_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
++{
++ struct v4l2_mbus_framefmt *format =
++ v4l2_subdev_get_try_format(subdev, fh->pad, 0);
++ struct v4l2_rect *crop =
++ v4l2_subdev_get_try_crop(subdev, fh->pad, 0);
++
++ crop->left = 0;
++ crop->top = 0;
++ crop->width = OV5647_WIDTH;
++ crop->height = OV5647_HEIGHT;
++
++ format->code = OV5647_CODE;
++
++ format->width = OV5647_WIDTH;
++ format->height = OV5647_HEIGHT;
++ format->field = V4L2_FIELD_NONE;
++ format->colorspace = sensor_formats[0].colorspace;
++
++ return sensor_power(subdev, 1);
++}
++
++static int ov5647_close(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
++{
++ return sensor_power(subdev, 0);
++}
++
++static const struct v4l2_subdev_internal_ops ov5647_subdev_internal_ops = {
++ .registered = ov5647_registered,
++ .open = ov5647_open,
++ .close = ov5647_close,
++};
++
++static int ov5647_probe(struct i2c_client *client,
++ const struct i2c_device_id *id)
++{
++ struct device *dev = &client->dev;
++ struct ov5647 *sensor;
++ int ret = 0;
++ struct v4l2_subdev *sd;
++
++ sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
++ if (sensor == NULL)
++ return -ENOMEM;
++
++ mutex_init(&sensor->lock);
++ sensor->dev = dev;
++ sensor->fmt = &sensor_formats[0];
++ sensor->width = OV5647_WIDTH;
++ sensor->height = OV5647_HEIGHT;
++
++ sd = &sensor->subdev;
++ v4l2_i2c_subdev_init(sd, client, &subdev_ops);
++ sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
++
++ ret = ov5647_detect(sd);
++ if (ret < 0) {
++ v4l2_err(sd, "OV5647 not found!\n");
++ goto out;
++ }
++
++ sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
++ sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
++ ret = media_entity_pads_init(&sd->entity, 1, &sensor->pad);
++ if (ret < 0)
++ return ret;
++
++ ret = v4l2_async_register_subdev(sd);
++ if (ret < 0)
++ media_entity_cleanup(&sd->entity);
++
++out:
++ return ret;
++}
++
++static int ov5647_remove(struct i2c_client *client)
++{
++ struct v4l2_subdev *subdev = i2c_get_clientdata(client);
++ struct ov5647 *ov5647 = to_state(subdev);
++
++ v4l2_async_unregister_subdev(&ov5647->subdev);
++ media_entity_cleanup(&ov5647->subdev.entity);
++ v4l2_device_unregister_subdev(subdev);
++
++ return 0;
++}
++
++static const struct i2c_device_id ov5647_id[] = {
++ { "ov5647", 0 },
++ { }
++};
++MODULE_DEVICE_TABLE(i2c, ov5647_id);
++
++#if IS_ENABLED(CONFIG_OF)
++static const struct of_device_id ov5647_of_match[] = {
++ { .compatible = "ovti,ov5647" },
++ { /* sentinel */ },
++};
++MODULE_DEVICE_TABLE(of, ov5647_of_match);
++#endif
++
++static struct i2c_driver ov5647_driver = {
++ .driver = {
++ .of_match_table = of_match_ptr(ov5647_of_match),
++ .owner = THIS_MODULE,
++ .name = "ov5647",
++ },
++ .probe = ov5647_probe,
++ .remove = ov5647_remove,
++ .id_table = ov5647_id,
++};
++module_i2c_driver(ov5647_driver);
++
++MODULE_AUTHOR("Ramiro Oliveira <roliveir@synopsys.com>");
++MODULE_DESCRIPTION("A low-level driver for OmniVision ov5647 sensors");
++MODULE_LICENSE("GPL");
+diff --git a/drivers/media/i2c/soc_camera/ov5647.h b/drivers/media/i2c/soc_camera/ov5647.h
+new file mode 100644
+index 0000000..f854da8
+--- /dev/null
++++ b/drivers/media/i2c/soc_camera/ov5647.h
+@@ -0,0 +1,242 @@
++/*
++ * Copyright (c) 2012, The Linux Foundation. All rights reserved.
++ * Copyright (C) 2017 Cogent Embedded, Inc
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 and
++ * only version 2 as published by the Free Software Foundation.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ */
++
++//#define TEST_PATTERN
++
++#define OV5647_WIDTH 2592
++#define OV5647_HEIGHT 1944
++
++#define OV5647_CODE MEDIA_BUS_FMT_SBGGR8_1X8
++//#define OV5647_CODE MEDIA_BUS_FMT_YUYV8_2X8
++
++struct regval_list {
++ uint16_t addr;
++ uint8_t data;
++};
++
++enum ov5647_test_mode_t {
++ TEST_OFF,
++ TEST_1,
++ TEST_2,
++ TEST_3
++};
++
++struct regval_list ov5647_prev_settings[] = {
++ /*1280*960 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps
++ for back to preview*/
++ {0x3035, 0x21},
++ {0x3036, 0x37},
++ {0x3821, 0x07},
++ {0x3820, 0x41},
++ {0x3612, 0x09},
++ {0x3618, 0x00},
++ {0x380c, 0x07},
++ {0x380d, 0x68},
++ {0x380e, 0x03},
++ {0x380f, 0xd8},
++ {0x3814, 0x31},
++ {0x3815, 0x31},
++ {0x3709, 0x52},
++ {0x3808, 0x05}, // 1280
++ {0x3809, 0x00},
++ {0x380a, 0x03}, // 960
++ {0x380b, 0xc0},
++ {0x3800, 0x00},
++ {0x3801, 0x18},
++ {0x3802, 0x00},
++ {0x3803, 0x0e},
++ {0x3804, 0x0a},
++ {0x3805, 0x27},
++ {0x3806, 0x07},
++ {0x3807, 0x95},
++ {0x4004, 0x02},
++};
++struct regval_list ov5647_snap_settings[] = {
++ /*2608*1952 Reference Setting 24M MCLK 2lane 280Mbps/lane 30fps*/
++ {0x3035, 0x21},
++ {0x3036, 0x4f},
++ {0x3821, 0x06},
++ {0x3820, 0x00},
++ {0x3612, 0x0b},
++ {0x3618, 0x04},
++ {0x380c, 0x0a},
++ {0x380d, 0x8c},
++ {0x380e, 0x07},
++ {0x380f, 0xb0},
++ {0x3814, 0x11},
++ {0x3815, 0x11},
++ {0x3709, 0x12},
++#if 0
++ {0x3808, 0x0a},
++ {0x3809, 0x30},
++ {0x380a, 0x07},
++ {0x380b, 0xa0},
++#else
++ {0x3808, OV5647_WIDTH >> 8},
++ {0x3809, OV5647_WIDTH & 0xff},
++ {0x380a, OV5647_HEIGHT >> 8},
++ {0x380b, OV5647_HEIGHT & 0xff},
++#endif
++ {0x3800, 0x00},
++ {0x3801, 0x04},
++ {0x3802, 0x00},
++ {0x3803, 0x00},
++ {0x3804, 0x0a},
++ {0x3805, 0x3b},
++ {0x3806, 0x07},
++ {0x3807, 0xa3},
++ {0x4004, 0x04},
++};
++struct regval_list ov5647_recommend_settings[] = {
++#ifdef TEST_PATTERN
++ {0x503d, 0x80},
++#endif
++#if 0
++ {0x4814, 0x1e},
++ {0x4801, 0x8f},
++#endif
++ {0x3035, 0x11},
++ {0x303c, 0x11},
++ {0x370c, 0x03},
++ {0x5000, 0x06},
++ {0x5003, 0x08},
++ {0x5a00, 0x08},
++ {0x3000, 0xff},
++ {0x3001, 0xff},
++ {0x3002, 0xff},
++ {0x301d, 0xf0},
++ {0x3a18, 0x00},
++ {0x3a19, 0xf8},
++ {0x3c01, 0x80},
++ {0x3b07, 0x0c},
++ {0x3708, 0x64},
++ {0x3630, 0x2e},
++ {0x3632, 0xe2},
++ {0x3633, 0x23},
++ {0x3634, 0x44},
++ {0x3620, 0x64},
++ {0x3621, 0xe0},
++ {0x3600, 0x37},
++ {0x3704, 0xa0},
++ {0x3703, 0x5a},
++ {0x3715, 0x78},
++ {0x3717, 0x01},
++ {0x3731, 0x02},
++ {0x370b, 0x60},
++ {0x3705, 0x1a},
++ {0x3f05, 0x02},
++ {0x3f06, 0x10},
++ {0x3f01, 0x0a},
++ {0x3a08, 0x01},
++ {0x3a0f, 0x58},
++ {0x3a10, 0x50},
++ {0x3a1b, 0x58},
++ {0x3a1e, 0x50},
++ {0x3a11, 0x60},
++ {0x3a1f, 0x28},
++ {0x4001, 0x02},
++ {0x4000, 0x09},
++ {0x3000, 0x00},
++ {0x3001, 0x00},
++ {0x3002, 0x00},
++ {0x3017, 0xe0},
++ {0x301c, 0xfc},
++ {0x3636, 0x06},
++ {0x3016, 0x08},
++ {0x3827, 0xec},
++ {0x3018, 0x44},
++ {0x3035, 0x21},
++ {0x3106, 0xf5},
++ {0x3034, 0x18},
++ {0x301c, 0xf8},
++ /*lens setting*/
++ {0x5000, 0x86},
++ {0x5800, 0x11},
++ {0x5801, 0x0c},
++ {0x5802, 0x0a},
++ {0x5803, 0x0b},
++ {0x5804, 0x0d},
++ {0x5805, 0x13},
++ {0x5806, 0x09},
++ {0x5807, 0x05},
++ {0x5808, 0x03},
++ {0x5809, 0x03},
++ {0x580a, 0x06},
++ {0x580b, 0x08},
++ {0x580c, 0x05},
++ {0x580d, 0x01},
++ {0x580e, 0x00},
++ {0x580f, 0x00},
++ {0x5810, 0x02},
++ {0x5811, 0x06},
++ {0x5812, 0x05},
++ {0x5813, 0x01},
++ {0x5814, 0x00},
++ {0x5815, 0x00},
++ {0x5816, 0x02},
++ {0x5817, 0x06},
++ {0x5818, 0x09},
++ {0x5819, 0x05},
++ {0x581a, 0x04},
++ {0x581b, 0x04},
++ {0x581c, 0x06},
++ {0x581d, 0x09},
++ {0x581e, 0x11},
++ {0x581f, 0x0c},
++ {0x5820, 0x0b},
++ {0x5821, 0x0b},
++ {0x5822, 0x0d},
++ {0x5823, 0x13},
++ {0x5824, 0x22},
++ {0x5825, 0x26},
++ {0x5826, 0x26},
++ {0x5827, 0x24},
++ {0x5828, 0x24},
++ {0x5829, 0x24},
++ {0x582a, 0x22},
++ {0x582b, 0x20},
++ {0x582c, 0x22},
++ {0x582d, 0x26},
++ {0x582e, 0x22},
++ {0x582f, 0x22},
++ {0x5830, 0x42},
++ {0x5831, 0x22},
++ {0x5832, 0x02},
++ {0x5833, 0x24},
++ {0x5834, 0x22},
++ {0x5835, 0x22},
++ {0x5836, 0x22},
++ {0x5837, 0x26},
++ {0x5838, 0x42},
++ {0x5839, 0x26},
++ {0x583a, 0x06},
++ {0x583b, 0x26},
++ {0x583c, 0x24},
++ {0x583d, 0xce},
++ /* manual AWB,manual AE,close Lenc,open WBC*/
++ {0x3503, 0x03}, /*manual AE*/
++ {0x3501, 0x10},
++ {0x3502, 0x80},
++ {0x350a, 0x00},
++ {0x350b, 0x7f},
++ {0x5001, 0x01}, /*manual AWB*/
++ {0x5180, 0x08},
++ {0x5186, 0x04},
++ {0x5187, 0x00},
++ {0x5188, 0x04},
++ {0x5189, 0x00},
++ {0x518a, 0x04},
++ {0x518b, 0x00},
++ {0x5000, 0x06}, /*No lenc,WBC on*/
++};
+--
+1.9.1
+
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/h3ulcb.cfg b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/h3ulcb.cfg
index dc052de..3c8ca47 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/h3ulcb.cfg
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/h3ulcb.cfg
@@ -29,9 +29,11 @@ CONFIG_SOC_CAMERA_MAX9286_MAX9271=y
CONFIG_SOC_CAMERA_TI964_TI9X3=y
CONFIG_SOC_CAMERA_TI954_TI9X3=y
CONFIG_SOC_CAMERA_OV106XX=y
+CONFIG_SOC_CAMERA_OV5647=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_USB_XHCI_RCAR=y
+CONFIG_USB_ACM=y
CONFIG_VIDEO_RENESAS_IMR=y
CONFIG_VIRTIO_RCAR_PCIE=y
CONFIG_BT=y
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/m3ulcb.cfg b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/m3ulcb.cfg
index dc052de..3c8ca47 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/m3ulcb.cfg
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/m3ulcb.cfg
@@ -29,9 +29,11 @@ CONFIG_SOC_CAMERA_MAX9286_MAX9271=y
CONFIG_SOC_CAMERA_TI964_TI9X3=y
CONFIG_SOC_CAMERA_TI954_TI9X3=y
CONFIG_SOC_CAMERA_OV106XX=y
+CONFIG_SOC_CAMERA_OV5647=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_USB_XHCI_RCAR=y
+CONFIG_USB_ACM=y
CONFIG_VIDEO_RENESAS_IMR=y
CONFIG_VIRTIO_RCAR_PCIE=y
CONFIG_BT=y
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend
index 3a3ab64..689f29b 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas_4.9.bbappend
@@ -46,6 +46,7 @@ SRC_URI_append = " \
${@base_conditional("LVDSCAMERA_FIRST4_TYPE1", "1", " file://0050-arm64-dts-Gen3-view-boards-TYPE1-first-4-cameras.patch", "", d)} \
${@base_conditional("LVDSCAMERA_SECOND4_TYPE1", "1", " file://0051-arm64-dts-Gen3-view-boards-TYPE1-second-4-cameras.patch", "", d)} \
${@base_conditional("LVDSCAMERA_FIRST4_TYPE2", "1", " file://0052-arm64-dts-Gen3-view-boards-TYPE2-first-4-cameras.patch", "", d)} \
+ file://0060-media-i2c-Add-ov5647-sensor.patch \
"
SRC_URI_append_h3ulcb = " file://h3ulcb.cfg"