Skip to contentSkip to conversation

media: atmel-isi: Add DT support for Atmel ISI driver

PATCH Superseded Josh Wu 2 participants 6 messages Jul 25, 2014 – Jul 28, 2014

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Josh Wu

author
#0 lore raw

v3 cover media: atmel-isi: Add DT support for Atmel ISI driver

This patch series add DT support for atmel ISI driver. It can support the common v4l2 DT interfaces.

v2 -> v3:
support bus-width property for atmel-isi endpoint.

v1 -> v2:
modified the device tree binding document to remove an optonal property.

Josh Wu (3):
atmel-isi: add v4l2 async probe support
atmel-isi: convert the pdata from pointer to structure
atmel-isi: add primary DT support

 .../devicetree/bindings/media/atmel-isi.txt        | 51 +++++++++++++
 drivers/media/platform/soc_camera/atmel-isi.c      | 89 +++++++++++++++++++---
 include/media/atmel-isi.h                          |  4 +
 3 files changed, 132 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/atmel-isi.txt
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v3 1/3 media: atmel-isi: add v4l2 async probe support

---
v2 -> v3:
no change.

 drivers/media/platform/soc_camera/atmel-isi.c | 5 +++++
 include/media/atmel-isi.h                     | 4 ++++
 2 files changed, 9 insertions(+)
drivers/media/platform/soc_camera/atmel-isi.c +5 -0
index 14bc886..802c203 100644
@@ -987,6 +987,11 @@ static int atmel_isi_probe(struct platform_device *pdev)
 	soc_host->v4l2_dev.dev	= &pdev->dev;
 	soc_host->nr		= pdev->id;
 
+	if (isi->pdata.asd_sizes) {
+		soc_host->asd = isi->pdata.asd;
+		soc_host->asd_sizes = isi->pdata.asd_sizes;
+	}
+
 	ret = soc_camera_host_register(soc_host);
 	if (ret) {
 		dev_err(&pdev->dev, "Unable to register soc camera host\n");
include/media/atmel-isi.h +4 -0
index 2b02347..c2e5703 100644
@@ -106,6 +106,8 @@
 #define ISI_DATAWIDTH_8				0x01
 #define ISI_DATAWIDTH_10			0x02
 
+struct v4l2_async_subdev;
+
 struct isi_platform_data {
 	u8 has_emb_sync;
 	u8 emb_crc_sync;
@@ -118,6 +120,8 @@ struct isi_platform_data {
 	u32 frate;
 	/* Using for ISI_MCK */
 	u32 mck_hz;
+	struct v4l2_async_subdev **asd;	/* Flat array, arranged in groups */
+	int *asd_sizes;		/* 0-terminated array of asd group sizes */
 };
 
 #endif /* __ATMEL_ISI_H__ */
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v3 2/3 media: atmel-isi: convert the pdata from pointer to structure

In reply to Josh Wu

Now the platform data is initialized by allocation of isi structure. In the future, we use pdata to store the dt parameters.

---
v2 -> v3:
use sizeof(isi->pdata) instead of using sizeof(struct).

 drivers/media/platform/soc_camera/atmel-isi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/media/platform/soc_camera/atmel-isi.c +11 -11
index 802c203..74af560 100644
@@ -84,7 +84,7 @@ struct atmel_isi {
 	struct clk			*mck;
 	unsigned int			irq;
 
-	struct isi_platform_data	*pdata;
+	struct isi_platform_data	pdata;
 	u16				width_flags;	/* max 12 bits */
 
 	struct list_head		video_buffer_list;
@@ -350,7 +350,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer)
 
 	cfg1 &= ~ISI_CFG1_FRATE_DIV_MASK;
 	/* Enable linked list */
-	cfg1 |= isi->pdata->frate | ISI_CFG1_DISCR;
+	cfg1 |= isi->pdata.frate | ISI_CFG1_DISCR;
 
 	/* Enable codec path and ISI */
 	ctrl = ISI_CTRL_CDC | ISI_CTRL_EN;
@@ -795,7 +795,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd)
 	/* Make choises, based on platform preferences */
 	if ((common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) &&
 	    (common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) {
-		if (isi->pdata->hsync_act_low)
+		if (isi->pdata.hsync_act_low)
 			common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_HIGH;
 		else
 			common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_LOW;
@@ -803,7 +803,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd)
 
 	if ((common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) &&
 	    (common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) {
-		if (isi->pdata->vsync_act_low)
+		if (isi->pdata.vsync_act_low)
 			common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH;
 		else
 			common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW;
@@ -811,7 +811,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd)
 
 	if ((common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) &&
 	    (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)) {
-		if (isi->pdata->pclk_act_falling)
+		if (isi->pdata.pclk_act_falling)
 			common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_RISING;
 		else
 			common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_FALLING;
@@ -833,9 +833,9 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd)
 	if (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
 		cfg1 |= ISI_CFG1_PIXCLK_POL_ACTIVE_FALLING;
 
-	if (isi->pdata->has_emb_sync)
+	if (isi->pdata.has_emb_sync)
 		cfg1 |= ISI_CFG1_EMB_SYNC;
-	if (isi->pdata->full_mode)
+	if (isi->pdata.full_mode)
 		cfg1 |= ISI_CFG1_FULL_MODE;
 
 	isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
@@ -910,7 +910,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
 	if (IS_ERR(isi->pclk))
 		return PTR_ERR(isi->pclk);
 
-	isi->pdata = pdata;
+	memcpy(&isi->pdata, pdata, sizeof(isi->pdata));
 	isi->active = NULL;
 	spin_lock_init(&isi->lock);
 	INIT_LIST_HEAD(&isi->video_buffer_list);
@@ -926,7 +926,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
 		/* Set ISI_MCK's frequency, it should be faster than pixel
 		 * clock.
 		 */
-		ret = clk_set_rate(isi->mck, pdata->mck_hz);
+		ret = clk_set_rate(isi->mck, isi->pdata.mck_hz);
 		if (ret < 0)
 			return ret;
 	}
@@ -960,9 +960,9 @@ static int atmel_isi_probe(struct platform_device *pdev)
 		goto err_ioremap;
 	}
 
-	if (pdata->data_width_flags & ISI_DATAWIDTH_8)
+	if (isi->pdata.data_width_flags & ISI_DATAWIDTH_8)
 		isi->width_flags = 1 << 7;
-	if (pdata->data_width_flags & ISI_DATAWIDTH_10)
+	if (isi->pdata.data_width_flags & ISI_DATAWIDTH_10)
 		isi->width_flags |= 1 << 9;
 
 	isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v3 3/3 media: atmel-isi: add primary DT support

In reply to Josh Wu

This patch add the DT support for Atmel ISI driver.
It use the same v4l2 DT interface that defined in video-interfaces.txt.

Cc devicetree at vger.kernel.org

---
v2 -> v3:
add bus-width property support.
add error handling when calling atmel_isi_probe_dt().

v1 -> v2:
refine the binding document.
add port node description.
removed the optional property.

 .../devicetree/bindings/media/atmel-isi.txt        | 51 +++++++++++++++++
 drivers/media/platform/soc_camera/atmel-isi.c      | 64 +++++++++++++++++++++-
 2 files changed, 113 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/atmel-isi.txt
Documentation/devicetree/bindings/media/atmel-isi.txt new file +51 -0
new file mode 100644
index 0000000..17e71b7
@@ -0,0 +1,51 @@
+Atmel Image Sensor Interface (ISI) SoC Camera Subsystem
+----------------------------------------------
+
+Required properties:
+- compatible: must be "atmel,at91sam9g45-isi"
+- reg: physical base address and length of the registers set for the device;
+- interrupts: should contain IRQ line for the ISI;
+- clocks: list of clock specifiers, corresponding to entries in
+          the clock-names property;
+- clock-names: must contain "isi_clk", which is the isi peripherial clock.
+
+ISI supports a single port node with parallel bus. It should contain one
+'port' child node with child 'endpoint' node. Please refer to the bindings
+defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+	isi: isi at f0034000 {
+		compatible = "atmel,at91sam9g45-isi";
+		reg = <0xf0034000 0x4000>;
+		interrupts = <37 IRQ_TYPE_LEVEL_HIGH 5>;
+
+		clocks = <&isi_clk>;
+		clock-names = "isi_clk";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_isi>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			isi_0: endpoint {
+				remote-endpoint = <&ov2640_0>;
+				bus-width = <8>;
+			};
+		};
+	};
+
+	i2c1: i2c at f0018000 {
+		ov2640: camera at 0x30 {
+			compatible = "omnivision,ov2640";
+			reg = <0x30>;
+
+			port {
+				ov2640_0: endpoint {
+					remote-endpoint = <&isi_0>;
+					bus-width = <8>;
+				};
+			};
+		};
+	};
drivers/media/platform/soc_camera/atmel-isi.c +62 -2

105 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw

PATCH v3 3/3 media: atmel-isi: add primary DT support

Hi Josh,

Thanks for a prompt update! A couple of minor questions:

Quoted 123 lines · Josh Wu

This patch add the DT support for Atmel ISI driver.
It use the same v4l2 DT interface that defined in video-interfaces.txt.

Cc devicetree at vger.kernel.org

---
v2 -> v3:
add bus-width property support.
add error handling when calling atmel_isi_probe_dt().

v1 -> v2:
refine the binding document.
add port node description.
removed the optional property.

 .../devicetree/bindings/media/atmel-isi.txt        | 51 +++++++++++++++++
 drivers/media/platform/soc_camera/atmel-isi.c      | 64 +++++++++++++++++++++-
 2 files changed, 113 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/atmel-isi.txt
Documentation/devicetree/bindings/media/atmel-isi.txt new file +51 -0
new file mode 100644
index 0000000..17e71b7
@@ -0,0 +1,51 @@
+Atmel Image Sensor Interface (ISI) SoC Camera Subsystem
+----------------------------------------------
+
+Required properties:
+- compatible: must be "atmel,at91sam9g45-isi"
+- reg: physical base address and length of the registers set for the device;
+- interrupts: should contain IRQ line for the ISI;
+- clocks: list of clock specifiers, corresponding to entries in
+          the clock-names property;
+- clock-names: must contain "isi_clk", which is the isi peripherial clock.
+
+ISI supports a single port node with parallel bus. It should contain one
+'port' child node with child 'endpoint' node. Please refer to the bindings
+defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+	isi: isi at f0034000 {
+		compatible = "atmel,at91sam9g45-isi";
+		reg = <0xf0034000 0x4000>;
+		interrupts = <37 IRQ_TYPE_LEVEL_HIGH 5>;
+
+		clocks = <&isi_clk>;
+		clock-names = "isi_clk";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_isi>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			isi_0: endpoint {
+				remote-endpoint = <&ov2640_0>;
+				bus-width = <8>;
+			};
+		};
+	};
+
+	i2c1: i2c at f0018000 {
+		ov2640: camera at 0x30 {
+			compatible = "omnivision,ov2640";
+			reg = <0x30>;
+
+			port {
+				ov2640_0: endpoint {
+					remote-endpoint = <&isi_0>;
+					bus-width = <8>;
+				};
+			};
+		};
+	};
drivers/media/platform/soc_camera/atmel-isi.c +23 -0
index 74af560..ca4e43e 100644
@@ -25,6 +25,7 @@
 #include <media/atmel-isi.h>
 #include <media/soc_camera.h>
 #include <media/soc_mediabus.h>
+#include <media/v4l2-of.h>
 #include <media/videobuf2-dma-contig.h>
 
 #define MAX_BUFFER_NUM			32
@@ -33,6 +34,7 @@
 #define VID_LIMIT_BYTES			(16 * 1024 * 1024)
 #define MIN_FRAME_RATE			15
 #define FRAME_INTERVAL_MILLI_SEC	(1000 / MIN_FRAME_RATE)
+#define ISI_DEFAULT_MCLK_FREQ		25000000
 
 /* Frame buffer descriptor */
 struct fbd {
@@ -883,6 +885,50 @@ static int atmel_isi_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static int atmel_isi_probe_dt(struct atmel_isi *isi,
+			struct platform_device *pdev)
+{
+	struct device_node *np= pdev->dev.of_node;
+	struct v4l2_of_endpoint ep;
+	int err;
+
+	/* Default settings for ISI */
+	isi->pdata.full_mode = 1;
+	isi->pdata.mck_hz = ISI_DEFAULT_MCLK_FREQ;
+	isi->pdata.frate = ISI_CFG1_FRATE_CAPTURE_ALL;
+
+	np = of_graph_get_next_endpoint(np, NULL);
+	if (!np) {
+		dev_err(&pdev->dev, "Could not find the endpoint\n");
+		return -EINVAL;
+	}
+
+	err = v4l2_of_parse_endpoint(np, &ep);
+	if (err) {
+		dev_err(&pdev->dev, "Could not parse the endpoint\n");

drivers/media/platform/soc_camera/atmel-isi.c static int atmel_isi_remove(struct platform_device *pdev) · line 918

Quoted 10 lines
drivers/media/platform/soc_camera/atmel-isi.c +10 -0
+		goto err_probe_dt;
+	}
+
+	switch (ep.bus.parallel.bus_width) {
+	case 8:
+		isi->pdata.data_width_flags = ISI_DATAWIDTH_8;
+		break;
+	case 10:
+		isi->pdata.data_width_flags = ISI_DATAWIDTH_10;
+		break;

Wouldn't it be natural, if bus_width=10 is specified in DT to enable both ISI_DATAWIDTH_8 and ISI_DATAWIDTH_10?

drivers/media/platform/soc_camera/atmel-isi.c static int atmel_isi_remove(struct platform_device *pdev) · line 920

Quoted 2 lines
drivers/media/platform/soc_camera/atmel-isi.c +2 -0
+	default:
+		dev_err(&pdev->dev, "Not supported bus width: %d\n",

Wouldn't "Unsupported" be better?

Quoted 45 lines
drivers/media/platform/soc_camera/atmel-isi.c +22 -2
+				ep.bus.parallel.bus_width);
+		err = -EINVAL;
+		goto err_probe_dt;
+	}
+
+err_probe_dt:
+	of_node_put(np);
+
+	return err;
+}
+
 static int atmel_isi_probe(struct platform_device *pdev)
 {
 	unsigned int irq;
@@ -894,7 +940,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
 	struct isi_platform_data *pdata;
 
 	pdata = dev->platform_data;
-	if (!pdata || !pdata->data_width_flags) {
+	if ((!pdata || !pdata->data_width_flags) && !pdev->dev.of_node) {
 		dev_err(&pdev->dev,
 			"No config available for Atmel ISI\n");
 		return -EINVAL;
@@ -910,7 +956,14 @@ static int atmel_isi_probe(struct platform_device *pdev)
 	if (IS_ERR(isi->pclk))
 		return PTR_ERR(isi->pclk);
 
-	memcpy(&isi->pdata, pdata, sizeof(isi->pdata));
+	if (pdata) {
+		memcpy(&isi->pdata, pdata, sizeof(isi->pdata));
+	} else {
+		ret = atmel_isi_probe_dt(isi, pdev);
+		if (ret)
+			return ret;
+	}
+
 	isi->active = NULL;
 	spin_lock_init(&isi->lock);
 	INIT_LIST_HEAD(&isi->video_buffer_list);
@@ -1012,11 +1065,18 @@ err_alloc_ctx:
 	return ret;
 }
 
+static const struct of_device_id atmel_isi_of_match[] = {
+	{ .compatible = "atmel,at91sam9g45-isi" },

drivers/media/platform/soc_camera/atmel-isi.c err_alloc_ctx: · line 1079

Quoted 10 lines
drivers/media/platform/soc_camera/atmel-isi.c +5 -0
+	{ }
+};
+MODULE_DEVICE_TABLE(of, atmel_isi_of_match);
+
 static struct platform_driver atmel_isi_driver = {
 	.remove		= atmel_isi_remove,
 	.driver		= {
 		.name = "atmel_isi",
 		.owner = THIS_MODULE,
+		.of_match_table = atmel_isi_of_match,

I think you're supposed to use of_match_ptr() here for your driver to be usable both with and without DT?

Thanks
Guennadi

Quoted 6 lines
drivers/media/platform/soc_camera/atmel-isi.c +0 -0
 	},
 };
 
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH v3 3/3 media: atmel-isi: add primary DT support

Hi, Guennadi

Quoted 133 lines · Guennadi Liakhovetski

Hi Josh,

Thanks for a prompt update! A couple of minor questions:

Quoted 127 lines · Josh Wu

This patch add the DT support for Atmel ISI driver.
It use the same v4l2 DT interface that defined in video-interfaces.txt.

Cc devicetree at vger.kernel.org

---
v2 -> v3:
add bus-width property support.
add error handling when calling atmel_isi_probe_dt().

v1 -> v2:
refine the binding document.
add port node description.
removed the optional property.

  .../devicetree/bindings/media/atmel-isi.txt        | 51 +++++++++++++++++
  drivers/media/platform/soc_camera/atmel-isi.c      | 64 +++++++++++++++++++++-
  2 files changed, 113 insertions(+), 2 deletions(-)

create mode 100644 Documentation/devicetree/bindings/media/atmel-isi.txt

Documentation/devicetree/bindings/media/atmel-isi.txt new file +51 -0
new file mode 100644
index 0000000..17e71b7
@@ -0,0 +1,51 @@
+Atmel Image Sensor Interface (ISI) SoC Camera Subsystem
+----------------------------------------------
+
+Required properties:
+- compatible: must be "atmel,at91sam9g45-isi"
+- reg: physical base address and length of the registers set for the device;
+- interrupts: should contain IRQ line for the ISI;
+- clocks: list of clock specifiers, corresponding to entries in
+          the clock-names property;
+- clock-names: must contain "isi_clk", which is the isi peripherial clock.
+
+ISI supports a single port node with parallel bus. It should contain one
+'port' child node with child 'endpoint' node. Please refer to the bindings
+defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+	isi: isi at f0034000 {
+		compatible = "atmel,at91sam9g45-isi";
+		reg = <0xf0034000 0x4000>;
+		interrupts = <37 IRQ_TYPE_LEVEL_HIGH 5>;
+
+		clocks = <&isi_clk>;
+		clock-names = "isi_clk";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_isi>;
+
+		port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			isi_0: endpoint {
+				remote-endpoint = <&ov2640_0>;
+				bus-width = <8>;
+			};
+		};
+	};
+
+	i2c1: i2c at f0018000 {
+		ov2640: camera at 0x30 {
+			compatible = "omnivision,ov2640";
+			reg = <0x30>;
+
+			port {
+				ov2640_0: endpoint {
+					remote-endpoint = <&isi_0>;
+					bus-width = <8>;
+				};
+			};
+		};
+	};
drivers/media/platform/soc_camera/atmel-isi.c +27 -0
index 74af560..ca4e43e 100644
@@ -25,6 +25,7 @@
  #include <media/atmel-isi.h>
  #include <media/soc_camera.h>
  #include <media/soc_mediabus.h>
+#include <media/v4l2-of.h>
  #include <media/videobuf2-dma-contig.h>
 
  #define MAX_BUFFER_NUM			32
@@ -33,6 +34,7 @@
  #define VID_LIMIT_BYTES			(16 * 1024 * 1024)
  #define MIN_FRAME_RATE			15
  #define FRAME_INTERVAL_MILLI_SEC	(1000 / MIN_FRAME_RATE)
+#define ISI_DEFAULT_MCLK_FREQ		25000000
 
  /* Frame buffer descriptor */
  struct fbd {
@@ -883,6 +885,50 @@ static int atmel_isi_remove(struct platform_device *pdev)
  	return 0;
  }
 
+static int atmel_isi_probe_dt(struct atmel_isi *isi,
+			struct platform_device *pdev)
+{
+	struct device_node *np= pdev->dev.of_node;
+	struct v4l2_of_endpoint ep;
+	int err;
+
+	/* Default settings for ISI */
+	isi->pdata.full_mode = 1;
+	isi->pdata.mck_hz = ISI_DEFAULT_MCLK_FREQ;
+	isi->pdata.frate = ISI_CFG1_FRATE_CAPTURE_ALL;
+
+	np = of_graph_get_next_endpoint(np, NULL);
+	if (!np) {
+		dev_err(&pdev->dev, "Could not find the endpoint\n");
+		return -EINVAL;
+	}
+
+	err = v4l2_of_parse_endpoint(np, &ep);
+	if (err) {
+		dev_err(&pdev->dev, "Could not parse the endpoint\n");
+		goto err_probe_dt;
+	}
+
+	switch (ep.bus.parallel.bus_width) {
Quoted 8 lines

drivers/media/platform/soc_camera/atmel-isi.c static int atmel_isi_remove(struct platform_device *pdev) · line 918

Quoted 6 lines
drivers/media/platform/soc_camera/atmel-isi.c +6 -0
+	case 8:
+		isi->pdata.data_width_flags = ISI_DATAWIDTH_8;
+		break;
+	case 10:
+		isi->pdata.data_width_flags = ISI_DATAWIDTH_10;
+		break;

Wouldn't it be natural, if bus_width=10 is specified in DT to enable both ISI_DATAWIDTH_8 and ISI_DATAWIDTH_10?

yes. That's what I want to supported. Thanks.

Quoted 4 lines

drivers/media/platform/soc_camera/atmel-isi.c static int atmel_isi_remove(struct platform_device *pdev) · line 920

Quoted 3 lines
drivers/media/platform/soc_camera/atmel-isi.c +2 -0
+	default:
+		dev_err(&pdev->dev, "Not supported bus width: %d\n",

Wouldn't "Unsupported" be better?

OK.

Quoted 44 lines
Quoted 44 lines
drivers/media/platform/soc_camera/atmel-isi.c +20 -2
+				ep.bus.parallel.bus_width);
+		err = -EINVAL;
+		goto err_probe_dt;
+	}
+
+err_probe_dt:
+	of_node_put(np);
+
+	return err;
+}
+
  static int atmel_isi_probe(struct platform_device *pdev)
  {
  	unsigned int irq;
@@ -894,7 +940,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
  	struct isi_platform_data *pdata;
 
  	pdata = dev->platform_data;
-	if (!pdata || !pdata->data_width_flags) {
+	if ((!pdata || !pdata->data_width_flags) && !pdev->dev.of_node) {
  		dev_err(&pdev->dev,
  			"No config available for Atmel ISI\n");
  		return -EINVAL;
@@ -910,7 +956,14 @@ static int atmel_isi_probe(struct platform_device *pdev)
  	if (IS_ERR(isi->pclk))
  		return PTR_ERR(isi->pclk);
 
-	memcpy(&isi->pdata, pdata, sizeof(isi->pdata));
+	if (pdata) {
+		memcpy(&isi->pdata, pdata, sizeof(isi->pdata));
+	} else {
+		ret = atmel_isi_probe_dt(isi, pdev);
+		if (ret)
+			return ret;
+	}
+
  	isi->active = NULL;
  	spin_lock_init(&isi->lock);
  	INIT_LIST_HEAD(&isi->video_buffer_list);
@@ -1012,11 +1065,18 @@ err_alloc_ctx:
  	return ret;
  }
 
Quoted 14 lines

drivers/media/platform/soc_camera/atmel-isi.c err_alloc_ctx: · line 1079

Quoted 12 lines
drivers/media/platform/soc_camera/atmel-isi.c +7 -0
+static const struct of_device_id atmel_isi_of_match[] = {
+	{ .compatible = "atmel,at91sam9g45-isi" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, atmel_isi_of_match);
+
  static struct platform_driver atmel_isi_driver = {
  	.remove		= atmel_isi_remove,
  	.driver		= {
  		.name = "atmel_isi",
  		.owner = THIS_MODULE,
+		.of_match_table = atmel_isi_of_match,

I think you're supposed to use of_match_ptr() here for your driver to be usable both with and without DT?

Thanks for review. I will fix above by your suggestion in next version.

Best Regards,
Josh Wu

Quoted 9 lines

Thanks
Guennadi

Quoted 6 lines
drivers/media/platform/soc_camera/atmel-isi.c +0 -0
  	},
  };
 
Signature · 1 line
1.9.1