Re: [PATCH v4 13/13] V4L: Add driver for s5k4e5 image sensor

2013-08-09 Thread Sylwester Nawrocki

On 08/07/2013 11:04 AM, Arun Kumar K wrote:

This patch adds subdev driver for Samsung S5K4E5 raw image sensor.
Like s5k6a3, it is also another fimc-is firmware controlled
sensor. This minimal sensor driver doesn't do any I2C communications
as its done by ISP firmware. It can be updated if needed to a
regular sensor driver by adding the I2C communication.

Signed-off-by: Arun Kumar Karun...@samsung.com
---
  .../devicetree/bindings/media/i2c/s5k4e5.txt   |   44 +++
  drivers/media/i2c/Kconfig  |8 +
  drivers/media/i2c/Makefile |1 +
  drivers/media/i2c/s5k4e5.c |  361 
  4 files changed, 414 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
  create mode 100644 drivers/media/i2c/s5k4e5.c

diff --git a/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt 
b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
new file mode 100644
index 000..88dd726
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
@@ -0,0 +1,44 @@
+* Samsung S5K4E5 Raw Image Sensor
+
+S5K4E5 is a raw image sensor with maximum resolution of 2560x1920
+pixels. Data transfer is carried out via MIPI-CSI2 port and controls


s/MIPI-CSI2/MIPI CSI-2 ?


+via I2C bus.
+
+Required Properties:
+- compatible   : must be samsung,s5k4e5
+- reg  : I2C device address
+- gpios: reset gpio pin
+- clocks   : clock specifier for the clock-names property.
+- clock-names  : must contain mclk entry and matching clock property
+  entry.


Perhaps just:

- clock-names   : must contain mclk entry

?

+- svdda-supply : core voltage supply
+- svddio-supply: I/O voltage supply
+
+Optional Properties:
+- clock-frequency : operating frequency for the sensor
+default value will be taken if not provided.
+
+The device node should be added to their control bus controller (e.g.


s/their/respective ?


+I2C0) nodes and linked to the csis port node, using the common video
+interfaces bindings, defined in video-interfaces.txt.
+
+Example:
+
+   i2c-isp@1313 {
+   s5k4e5@20 {
+   compatible = samsung,s5k4e5;
+   reg =0x20;
+   gpios =gpx1 2 1;
+   clock-frequency =2400;
+   clocks =clock 129;
+   clock-names = mclk;
+   svdda-supply =...;
+   svddio-supply =...;
+   port {
+   is_s5k4e5_ep: endpoint {
+   data-lanes =1 2 3 4;
+   remote-endpoint =csis0_ep;
+   };
+   };
+   };
+   };
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index f7e9147..271028b 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -572,6 +572,14 @@ config VIDEO_S5K6A3
  This is a V4L2 sensor-level driver for Samsung S5K6A3 raw
  camera sensor.

+config VIDEO_S5K4E5
+   tristate Samsung S5K4E5 sensor support
+   depends on MEDIA_CAMERA_SUPPORT
+   depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API  OF
+   ---help---
+ This is a V4L2 sensor-level driver for Samsung S5K4E5 raw
+ camera sensor.
+
  config VIDEO_S5K4ECGX
  tristate Samsung S5K4ECGX sensor support
  depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index cf3cf03..0aeed8e 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -65,6 +65,7 @@ obj-$(CONFIG_VIDEO_SR030PC30) += sr030pc30.o
  obj-$(CONFIG_VIDEO_NOON010PC30)   += noon010pc30.o
  obj-$(CONFIG_VIDEO_S5K6AA)+= s5k6aa.o
  obj-$(CONFIG_VIDEO_S5K6A3)+= s5k6a3.o
+obj-$(CONFIG_VIDEO_S5K4E5) += s5k4e5.o
  obj-$(CONFIG_VIDEO_S5K4ECGX)  += s5k4ecgx.o
  obj-$(CONFIG_VIDEO_S5C73M3)   += s5c73m3/
  obj-$(CONFIG_VIDEO_ADP1653)   += adp1653.o
diff --git a/drivers/media/i2c/s5k4e5.c b/drivers/media/i2c/s5k4e5.c
new file mode 100644
index 000..0a6ece6
--- /dev/null
+++ b/drivers/media/i2c/s5k4e5.c
@@ -0,0 +1,361 @@
+/*
+ * Samsung S5K4E5 image sensor driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Arun Kumar Karun...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#includelinux/clk.h
+#includelinux/delay.h
+#includelinux/device.h
+#includelinux/errno.h
+#includelinux/gpio.h
+#includelinux/i2c.h
+#includelinux/kernel.h
+#includelinux/module.h
+#includelinux/of_gpio.h
+#includelinux/pm_runtime.h
+#includelinux/regulator/consumer.h
+#includelinux/slab.h
+#includelinux/videodev2.h

[PATCH v4 13/13] V4L: Add driver for s5k4e5 image sensor

2013-08-07 Thread Arun Kumar K
This patch adds subdev driver for Samsung S5K4E5 raw image sensor.
Like s5k6a3, it is also another fimc-is firmware controlled
sensor. This minimal sensor driver doesn't do any I2C communications
as its done by ISP firmware. It can be updated if needed to a
regular sensor driver by adding the I2C communication.

Signed-off-by: Arun Kumar K arun...@samsung.com
---
 .../devicetree/bindings/media/i2c/s5k4e5.txt   |   44 +++
 drivers/media/i2c/Kconfig  |8 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/s5k4e5.c |  361 
 4 files changed, 414 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
 create mode 100644 drivers/media/i2c/s5k4e5.c

diff --git a/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt 
b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
new file mode 100644
index 000..88dd726
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/s5k4e5.txt
@@ -0,0 +1,44 @@
+* Samsung S5K4E5 Raw Image Sensor
+
+S5K4E5 is a raw image sensor with maximum resolution of 2560x1920
+pixels. Data transfer is carried out via MIPI-CSI2 port and controls
+via I2C bus.
+
+Required Properties:
+- compatible   : must be samsung,s5k4e5
+- reg  : I2C device address
+- gpios: reset gpio pin
+- clocks   : clock specifier for the clock-names property.
+- clock-names  : must contain mclk entry and matching clock property
+  entry.
+- svdda-supply : core voltage supply
+- svddio-supply: I/O voltage supply
+
+Optional Properties:
+- clock-frequency : operating frequency for the sensor
+default value will be taken if not provided.
+
+The device node should be added to their control bus controller (e.g.
+I2C0) nodes and linked to the csis port node, using the common video
+interfaces bindings, defined in video-interfaces.txt.
+
+Example:
+
+   i2c-isp@1313 {
+   s5k4e5@20 {
+   compatible = samsung,s5k4e5;
+   reg = 0x20;
+   gpios = gpx1 2 1;
+   clock-frequency = 2400;
+   clocks = clock 129;
+   clock-names = mclk;
+   svdda-supply = ...;
+   svddio-supply = ...;
+   port {
+   is_s5k4e5_ep: endpoint {
+   data-lanes = 1 2 3 4;
+   remote-endpoint = csis0_ep;
+   };
+   };
+   };
+   };
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index f7e9147..271028b 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -572,6 +572,14 @@ config VIDEO_S5K6A3
  This is a V4L2 sensor-level driver for Samsung S5K6A3 raw
  camera sensor.
 
+config VIDEO_S5K4E5
+   tristate Samsung S5K4E5 sensor support
+   depends on MEDIA_CAMERA_SUPPORT
+   depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API  OF
+   ---help---
+ This is a V4L2 sensor-level driver for Samsung S5K4E5 raw
+ camera sensor.
+
 config VIDEO_S5K4ECGX
 tristate Samsung S5K4ECGX sensor support
 depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index cf3cf03..0aeed8e 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -65,6 +65,7 @@ obj-$(CONFIG_VIDEO_SR030PC30) += sr030pc30.o
 obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
 obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
 obj-$(CONFIG_VIDEO_S5K6A3) += s5k6a3.o
+obj-$(CONFIG_VIDEO_S5K4E5) += s5k4e5.o
 obj-$(CONFIG_VIDEO_S5K4ECGX)   += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_S5C73M3)+= s5c73m3/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
diff --git a/drivers/media/i2c/s5k4e5.c b/drivers/media/i2c/s5k4e5.c
new file mode 100644
index 000..0a6ece6
--- /dev/null
+++ b/drivers/media/i2c/s5k4e5.c
@@ -0,0 +1,361 @@
+/*
+ * Samsung S5K4E5 image sensor driver
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Author: Arun Kumar K arun...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/clk.h
+#include linux/delay.h
+#include linux/device.h
+#include linux/errno.h
+#include linux/gpio.h
+#include linux/i2c.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of_gpio.h
+#include linux/pm_runtime.h
+#include linux/regulator/consumer.h
+#include linux/slab.h
+#include linux/videodev2.h
+#include media/v4l2-async.h
+#include media/v4l2-subdev.h
+
+#define S5K4E5_SENSOR_MAX_WIDTH2576
+#define S5K4E5_SENSOR_MAX_HEIGHT   1930
+