* [PATCH 1/2] media: mt9m111: add device-tree suppport
@ 2014-06-15 20:17 Robert Jarzmik
2014-06-15 20:17 ` [PATCH 2/2] media: mt9m111: add device-tree documentation Robert Jarzmik
2014-06-19 7:36 ` [PATCH 1/2] media: mt9m111: add device-tree suppport Guennadi Liakhovetski
0 siblings, 2 replies; 6+ messages in thread
From: Robert Jarzmik @ 2014-06-15 20:17 UTC (permalink / raw)
To: g.liakhovetski, devicetree; +Cc: linux-media, Robert Jarzmik
Add device-tree support for mt9m111 camera sensor.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/media/i2c/soc_camera/mt9m111.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c
index ccf5940..7d283ea 100644
--- a/drivers/media/i2c/soc_camera/mt9m111.c
+++ b/drivers/media/i2c/soc_camera/mt9m111.c
@@ -923,6 +923,12 @@ done:
return ret;
}
+static int of_get_mt9m111_platform_data(struct device *dev,
+ struct soc_camera_subdev_desc *desc)
+{
+ return 0;
+}
+
static int mt9m111_probe(struct i2c_client *client,
const struct i2c_device_id *did)
{
@@ -931,6 +937,15 @@ static int mt9m111_probe(struct i2c_client *client,
struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
int ret;
+ if (client->dev.of_node) {
+ ssdd = devm_kzalloc(&client->dev, sizeof(*ssdd), GFP_KERNEL);
+ if (!ssdd)
+ return -ENOMEM;
+ client->dev.platform_data = ssdd;
+ ret = of_get_mt9m111_platform_data(&client->dev, ssdd);
+ if (ret < 0)
+ return ret;
+ }
if (!ssdd) {
dev_err(&client->dev, "mt9m111: driver needs platform data\n");
return -EINVAL;
@@ -1015,6 +1030,11 @@ static int mt9m111_remove(struct i2c_client *client)
return 0;
}
+static const struct of_device_id mt9m111_of_match[] = {
+ { .compatible = "micron,mt9m111", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, mt9m111_of_match);
static const struct i2c_device_id mt9m111_id[] = {
{ "mt9m111", 0 },
@@ -1025,6 +1045,7 @@ MODULE_DEVICE_TABLE(i2c, mt9m111_id);
static struct i2c_driver mt9m111_i2c_driver = {
.driver = {
.name = "mt9m111",
+ .of_match_table = of_match_ptr(mt9m111_of_match),
},
.probe = mt9m111_probe,
.remove = mt9m111_remove,
--
2.0.0.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] media: mt9m111: add device-tree documentation
2014-06-15 20:17 [PATCH 1/2] media: mt9m111: add device-tree suppport Robert Jarzmik
@ 2014-06-15 20:17 ` Robert Jarzmik
2014-06-19 7:38 ` Guennadi Liakhovetski
2014-06-19 7:36 ` [PATCH 1/2] media: mt9m111: add device-tree suppport Guennadi Liakhovetski
1 sibling, 1 reply; 6+ messages in thread
From: Robert Jarzmik @ 2014-06-15 20:17 UTC (permalink / raw)
To: g.liakhovetski, devicetree; +Cc: linux-media, Robert Jarzmik
Add documentation for the Micron mt9m111 image sensor.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
.../devicetree/bindings/media/i2c/mt9m111.txt | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/mt9m111.txt
diff --git a/Documentation/devicetree/bindings/media/i2c/mt9m111.txt b/Documentation/devicetree/bindings/media/i2c/mt9m111.txt
new file mode 100644
index 0000000..ed5a334
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/mt9m111.txt
@@ -0,0 +1,28 @@
+Micron 1.3Mp CMOS Digital Image Sensor
+
+The Micron MT9M111 is a CMOS active pixel digital image sensor with an active
+array size of 1280H x 1024V. It is programmable through a simple two-wire serial
+interface.
+
+Required Properties:
+- compatible: value should be "micron,mt9m111"
+
+For further reading on port node refer to
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+
+ i2c_master {
+ mt9m111@5d {
+ compatible = "micron,mt9m111";
+ reg = <0x5d>;
+
+ remote = <&pxa_camera>;
+ port {
+ mt9m111_1: endpoint {
+ bus-width = <8>;
+ remote-endpoint = <&pxa_camera>;
+ };
+ };
+ };
+ };
--
2.0.0.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] media: mt9m111: add device-tree suppport
2014-06-15 20:17 [PATCH 1/2] media: mt9m111: add device-tree suppport Robert Jarzmik
2014-06-15 20:17 ` [PATCH 2/2] media: mt9m111: add device-tree documentation Robert Jarzmik
@ 2014-06-19 7:36 ` Guennadi Liakhovetski
2014-06-19 19:15 ` Robert Jarzmik
1 sibling, 1 reply; 6+ messages in thread
From: Guennadi Liakhovetski @ 2014-06-19 7:36 UTC (permalink / raw)
To: Robert Jarzmik; +Cc: devicetree, linux-media
Hi Robert,
Thanks for the patch.
On Sun, 15 Jun 2014, Robert Jarzmik wrote:
> Add device-tree support for mt9m111 camera sensor.
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> drivers/media/i2c/soc_camera/mt9m111.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c
> index ccf5940..7d283ea 100644
> --- a/drivers/media/i2c/soc_camera/mt9m111.c
> +++ b/drivers/media/i2c/soc_camera/mt9m111.c
> @@ -923,6 +923,12 @@ done:
> return ret;
> }
>
> +static int of_get_mt9m111_platform_data(struct device *dev,
> + struct soc_camera_subdev_desc *desc)
> +{
> + return 0;
> +}
Why do you need this function? I would just drop it.
> +
> static int mt9m111_probe(struct i2c_client *client,
> const struct i2c_device_id *did)
> {
> @@ -931,6 +937,15 @@ static int mt9m111_probe(struct i2c_client *client,
> struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
> int ret;
>
> + if (client->dev.of_node) {
> + ssdd = devm_kzalloc(&client->dev, sizeof(*ssdd), GFP_KERNEL);
> + if (!ssdd)
> + return -ENOMEM;
> + client->dev.platform_data = ssdd;
> + ret = of_get_mt9m111_platform_data(&client->dev, ssdd);
> + if (ret < 0)
> + return ret;
> + }
> if (!ssdd) {
> dev_err(&client->dev, "mt9m111: driver needs platform data\n");
> return -EINVAL;
> @@ -1015,6 +1030,11 @@ static int mt9m111_remove(struct i2c_client *client)
>
> return 0;
> }
> +static const struct of_device_id mt9m111_of_match[] = {
> + { .compatible = "micron,mt9m111", },
Not a flaw in this patch, but someone might want to add "micron" to
Documentation/devicetree/bindings/vendor-prefixes.txt
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, mt9m111_of_match);
>
> static const struct i2c_device_id mt9m111_id[] = {
> { "mt9m111", 0 },
> @@ -1025,6 +1045,7 @@ MODULE_DEVICE_TABLE(i2c, mt9m111_id);
> static struct i2c_driver mt9m111_i2c_driver = {
> .driver = {
> .name = "mt9m111",
> + .of_match_table = of_match_ptr(mt9m111_of_match),
> },
> .probe = mt9m111_probe,
> .remove = mt9m111_remove,
> --
> 2.0.0.rc2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] media: mt9m111: add device-tree documentation
2014-06-15 20:17 ` [PATCH 2/2] media: mt9m111: add device-tree documentation Robert Jarzmik
@ 2014-06-19 7:38 ` Guennadi Liakhovetski
2014-06-19 19:13 ` Robert Jarzmik
0 siblings, 1 reply; 6+ messages in thread
From: Guennadi Liakhovetski @ 2014-06-19 7:38 UTC (permalink / raw)
To: Robert Jarzmik; +Cc: devicetree, linux-media
Hi Robert,
On Sun, 15 Jun 2014, Robert Jarzmik wrote:
> Add documentation for the Micron mt9m111 image sensor.
A nitpick: this isn't documentation for the sensor:) This is driver DT
bindings' documentation.
Thanks
Guennadi
>
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> .../devicetree/bindings/media/i2c/mt9m111.txt | 28 ++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/i2c/mt9m111.txt
>
> diff --git a/Documentation/devicetree/bindings/media/i2c/mt9m111.txt b/Documentation/devicetree/bindings/media/i2c/mt9m111.txt
> new file mode 100644
> index 0000000..ed5a334
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/mt9m111.txt
> @@ -0,0 +1,28 @@
> +Micron 1.3Mp CMOS Digital Image Sensor
> +
> +The Micron MT9M111 is a CMOS active pixel digital image sensor with an active
> +array size of 1280H x 1024V. It is programmable through a simple two-wire serial
> +interface.
> +
> +Required Properties:
> +- compatible: value should be "micron,mt9m111"
> +
> +For further reading on port node refer to
> +Documentation/devicetree/bindings/media/video-interfaces.txt.
> +
> +Example:
> +
> + i2c_master {
> + mt9m111@5d {
> + compatible = "micron,mt9m111";
> + reg = <0x5d>;
> +
> + remote = <&pxa_camera>;
> + port {
> + mt9m111_1: endpoint {
> + bus-width = <8>;
> + remote-endpoint = <&pxa_camera>;
> + };
> + };
> + };
> + };
> --
> 2.0.0.rc2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] media: mt9m111: add device-tree documentation
2014-06-19 7:38 ` Guennadi Liakhovetski
@ 2014-06-19 19:13 ` Robert Jarzmik
0 siblings, 0 replies; 6+ messages in thread
From: Robert Jarzmik @ 2014-06-19 19:13 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: devicetree, linux-media
Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:
> Hi Robert,
>
> On Sun, 15 Jun 2014, Robert Jarzmik wrote:
>
>> Add documentation for the Micron mt9m111 image sensor.
>
> A nitpick: this isn't documentation for the sensor:) This is driver DT
> bindings' documentation.
OK, for V2 (as its twin in pxa_camera).
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] media: mt9m111: add device-tree suppport
2014-06-19 7:36 ` [PATCH 1/2] media: mt9m111: add device-tree suppport Guennadi Liakhovetski
@ 2014-06-19 19:15 ` Robert Jarzmik
0 siblings, 0 replies; 6+ messages in thread
From: Robert Jarzmik @ 2014-06-19 19:15 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: devicetree, linux-media
Guennadi Liakhovetski <g.liakhovetski@gmx.de> writes:
> Hi Robert,
>> +static int of_get_mt9m111_platform_data(struct device *dev,
>> + struct soc_camera_subdev_desc *desc)
>> +{
>> + return 0;
>> +}
>
> Why do you need this function? I would just drop it.
Yeah, drop it sounds good. I wrote it at the beginning to have a clear
structure, and then didn't use it.
>> +static const struct of_device_id mt9m111_of_match[] = {
>> + { .compatible = "micron,mt9m111", },
>
> Not a flaw in this patch, but someone might want to add "micron" to
> Documentation/devicetree/bindings/vendor-prefixes.txt
OK, I'll see what I can submit, it should be doable :)
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-19 19:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-15 20:17 [PATCH 1/2] media: mt9m111: add device-tree suppport Robert Jarzmik
2014-06-15 20:17 ` [PATCH 2/2] media: mt9m111: add device-tree documentation Robert Jarzmik
2014-06-19 7:38 ` Guennadi Liakhovetski
2014-06-19 19:13 ` Robert Jarzmik
2014-06-19 7:36 ` [PATCH 1/2] media: mt9m111: add device-tree suppport Guennadi Liakhovetski
2014-06-19 19:15 ` Robert Jarzmik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.