* [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging
@ 2015-03-14 14:57 Laurent Pinchart
2015-03-14 14:57 ` [PATCH v3 2/2] v4l: mt9v032: Add OF support Laurent Pinchart
[not found] ` <1426345057-2752-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
0 siblings, 2 replies; 10+ messages in thread
From: Laurent Pinchart @ 2015-03-14 14:57 UTC (permalink / raw)
To: linux-media, devicetree; +Cc: Carlos Sanmartín Bustos, Sylwester Nawrocki
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
1 file changed, 1 insertion(+)
Aptina has recently been acquired by ON Semiconductor, but the name Aptina is
still widely used. Should the onnn prefix be used instead ?
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 389ca13..4326f52 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -20,6 +20,7 @@ amlogic Amlogic, Inc.
ams AMS AG
amstaos AMS-Taos Inc.
apm Applied Micro Circuits Corporation (APM)
+aptina Aptina Imaging
arm ARM Ltd.
armadeus ARMadeus Systems SARL
asahi-kasei Asahi Kasei Corp.
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] v4l: mt9v032: Add OF support
2015-03-14 14:57 [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging Laurent Pinchart
@ 2015-03-14 14:57 ` Laurent Pinchart
[not found] ` <1426345057-2752-2-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
[not found] ` <1426345057-2752-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
1 sibling, 1 reply; 10+ messages in thread
From: Laurent Pinchart @ 2015-03-14 14:57 UTC (permalink / raw)
To: linux-media, devicetree; +Cc: Carlos Sanmartín Bustos, Sylwester Nawrocki
Parse DT properties into a platform data structure when a DT node is
available.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v2:
- Use of_graph_get_next_endpoint()
Changes since v1:
- Add MT9V02[24] compatible strings
- Prefix all compatible strings with "aptina,"
- Use "link-frequencies" instead of "link-freqs"
Open questions:
- Should the color/monochrome model be inferred from the compatible string, or
should a separate DT property be used for that ?
---
.../devicetree/bindings/media/i2c/mt9v032.txt | 45 ++++++++++++++
MAINTAINERS | 1 +
drivers/media/i2c/mt9v032.c | 70 +++++++++++++++++++++-
3 files changed, 115 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/media/i2c/mt9v032.txt
diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
new file mode 100644
index 0000000..68b134e
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
@@ -0,0 +1,45 @@
+* Aptina 1/3-Inch WVGA CMOS Digital Image Sensor
+
+The Aptina MT9V032 is a 1/3-inch CMOS active pixel digital image sensor with
+an active array size of 752H x 480V. It is programmable through a simple
+two-wire serial interface.
+
+Required Properties:
+
+- compatible: value should be either one among the following
+ (a) "aptina,mt9v022" for MT9V022 color sensor
+ (b) "aptina,mt9v022m" for MT9V022 monochrome sensor
+ (c) "aptina,mt9v024" for MT9V024 color sensor
+ (d) "aptina,mt9v024m" for MT9V024 monochrome sensor
+ (e) "aptina,mt9v032" for MT9V032 color sensor
+ (f) "aptina,mt9v032m" for MT9V032 monochrome sensor
+ (g) "aptina,mt9v034" for MT9V034 color sensor
+ (h) "aptina,mt9v034m" for MT9V034 monochrome sensor
+
+Optional Properties:
+
+- link-frequencies: List of allowed link frequencies in Hz. Each frequency is
+ expressed as a 64-bit big-endian integer.
+
+For further reading on port node refer to
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+
+ i2c0@1c22000 {
+ ...
+ ...
+ mt9v032@5c {
+ compatible = "aptina,mt9v032";
+ reg = <0x5c>;
+
+ port {
+ mt9v032_1: endpoint {
+ link-frequencies =
+ <0 13000000>, <0 26600000>,
+ <0 27000000>;
+ };
+ };
+ };
+ ...
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index ddc5a8c..180f6fb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6535,6 +6535,7 @@ M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
L: linux-media@vger.kernel.org
T: git git://linuxtv.org/media_tree.git
S: Maintained
+F: Documentation/devicetree/bindings/media/i2c/mt9v032.txt
F: drivers/media/i2c/mt9v032.c
F: include/media/mt9v032.h
diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 255ea91..139eeef 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -17,6 +17,8 @@
#include <linux/i2c.h>
#include <linux/log2.h>
#include <linux/mutex.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
@@ -26,6 +28,7 @@
#include <media/mt9v032.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
+#include <media/v4l2-of.h>
#include <media/v4l2-subdev.h>
/* The first four rows are black rows. The active area spans 753x481 pixels. */
@@ -876,10 +879,59 @@ static const struct regmap_config mt9v032_regmap_config = {
* Driver initialization and probing
*/
+static struct mt9v032_platform_data *
+mt9v032_get_pdata(struct i2c_client *client)
+{
+ struct mt9v032_platform_data *pdata;
+ struct v4l2_of_endpoint endpoint;
+ struct device_node *np;
+ struct property *prop;
+
+ if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+ return client->dev.platform_data;
+
+ np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+ if (!np)
+ return NULL;
+
+ if (v4l2_of_parse_endpoint(np, &endpoint) < 0)
+ goto done;
+
+ pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ goto done;
+
+ prop = of_find_property(np, "link-frequencies", NULL);
+ if (prop) {
+ size_t size = prop->length / 8;
+ u64 *link_freqs;
+
+ link_freqs = devm_kzalloc(&client->dev,
+ size * sizeof(*link_freqs),
+ GFP_KERNEL);
+ if (!link_freqs)
+ goto done;
+
+ if (of_property_read_u64_array(np, "link-frequencies",
+ link_freqs, size) < 0)
+ goto done;
+
+ pdata->link_freqs = link_freqs;
+ pdata->link_def_freq = link_freqs[0];
+ }
+
+ pdata->clk_pol = !!(endpoint.bus.parallel.flags &
+ V4L2_MBUS_PCLK_SAMPLE_RISING);
+
+done:
+ of_node_put(np);
+ return pdata;
+}
+
static int mt9v032_probe(struct i2c_client *client,
const struct i2c_device_id *did)
{
- struct mt9v032_platform_data *pdata = client->dev.platform_data;
+ struct mt9v032_platform_data *pdata = mt9v032_get_pdata(client);
struct mt9v032 *mt9v032;
unsigned int i;
int ret;
@@ -1037,9 +1089,25 @@ static const struct i2c_device_id mt9v032_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mt9v032_id);
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id mt9v032_of_match[] = {
+ { .compatible = "aptina,mt9v022" },
+ { .compatible = "aptina,mt9v022m" },
+ { .compatible = "aptina,mt9v024" },
+ { .compatible = "aptina,mt9v024m" },
+ { .compatible = "aptina,mt9v032" },
+ { .compatible = "aptina,mt9v032m" },
+ { .compatible = "aptina,mt9v034" },
+ { .compatible = "aptina,mt9v034m" },
+ { /* Sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mt9v032_of_match);
+#endif
+
static struct i2c_driver mt9v032_driver = {
.driver = {
.name = "mt9v032",
+ .of_match_table = of_match_ptr(mt9v032_of_match),
},
.probe = mt9v032_probe,
.remove = mt9v032_remove,
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] v4l: mt9v032: Add OF support
2015-03-14 14:57 ` [PATCH v3 2/2] v4l: mt9v032: Add OF support Laurent Pinchart
@ 2015-03-15 0:21 ` Sakari Ailus
0 siblings, 0 replies; 10+ messages in thread
From: Sakari Ailus @ 2015-03-15 0:21 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Carlos Sanmartín Bustos,
Sylwester Nawrocki
Hi Laurent,
On Sat, Mar 14, 2015 at 04:57:37PM +0200, Laurent Pinchart wrote:
...
> diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> new file mode 100644
> index 0000000..68b134e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> @@ -0,0 +1,45 @@
> +* Aptina 1/3-Inch WVGA CMOS Digital Image Sensor
> +
> +The Aptina MT9V032 is a 1/3-inch CMOS active pixel digital image sensor with
> +an active array size of 752H x 480V. It is programmable through a simple
> +two-wire serial interface.
> +
> +Required Properties:
> +
> +- compatible: value should be either one among the following
> + (a) "aptina,mt9v022" for MT9V022 color sensor
> + (b) "aptina,mt9v022m" for MT9V022 monochrome sensor
> + (c) "aptina,mt9v024" for MT9V024 color sensor
> + (d) "aptina,mt9v024m" for MT9V024 monochrome sensor
> + (e) "aptina,mt9v032" for MT9V032 color sensor
> + (f) "aptina,mt9v032m" for MT9V032 monochrome sensor
> + (g) "aptina,mt9v034" for MT9V034 color sensor
> + (h) "aptina,mt9v034m" for MT9V034 monochrome sensor
> +
> +Optional Properties:
> +
> +- link-frequencies: List of allowed link frequencies in Hz. Each frequency is
> + expressed as a 64-bit big-endian integer.
> +
> +For further reading on port node refer to
> +Documentation/devicetree/bindings/media/video-interfaces.txt.
> +
> +Example:
> +
> + i2c0@1c22000 {
> + ...
> + ...
> + mt9v032@5c {
> + compatible = "aptina,mt9v032";
> + reg = <0x5c>;
> +
> + port {
> + mt9v032_1: endpoint {
> + link-frequencies =
> + <0 13000000>, <0 26600000>,
How about:
/bits/ 64 <13000000> ...
> + <0 27000000>;
> + };
> + };
> + };
> + ...
> + };
> diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
> index 255ea91..139eeef 100644
> --- a/drivers/media/i2c/mt9v032.c
> +++ b/drivers/media/i2c/mt9v032.c
> @@ -17,6 +17,8 @@
> #include <linux/i2c.h>
> #include <linux/log2.h>
> #include <linux/mutex.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
> #include <linux/regmap.h>
> #include <linux/slab.h>
> #include <linux/videodev2.h>
> @@ -26,6 +28,7 @@
> #include <media/mt9v032.h>
> #include <media/v4l2-ctrls.h>
> #include <media/v4l2-device.h>
> +#include <media/v4l2-of.h>
> #include <media/v4l2-subdev.h>
>
> /* The first four rows are black rows. The active area spans 753x481 pixels. */
> @@ -876,10 +879,59 @@ static const struct regmap_config mt9v032_regmap_config = {
> * Driver initialization and probing
> */
>
> +static struct mt9v032_platform_data *
> +mt9v032_get_pdata(struct i2c_client *client)
> +{
> + struct mt9v032_platform_data *pdata;
> + struct v4l2_of_endpoint endpoint;
> + struct device_node *np;
> + struct property *prop;
> +
> + if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
> + return client->dev.platform_data;
> +
> + np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
> + if (!np)
> + return NULL;
> +
> + if (v4l2_of_parse_endpoint(np, &endpoint) < 0)
> + goto done;
> +
> + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + goto done;
> +
> + prop = of_find_property(np, "link-frequencies", NULL);
> + if (prop) {
> + size_t size = prop->length / 8;
> + u64 *link_freqs;
> +
> + link_freqs = devm_kzalloc(&client->dev,
> + size * sizeof(*link_freqs),
You could simply use prop->length here. I think that'd look nicer.
> + GFP_KERNEL);
> + if (!link_freqs)
> + goto done;
> +
> + if (of_property_read_u64_array(np, "link-frequencies",
> + link_freqs, size) < 0)
> + goto done;
> +
> + pdata->link_freqs = link_freqs;
> + pdata->link_def_freq = link_freqs[0];
> + }
> +
> + pdata->clk_pol = !!(endpoint.bus.parallel.flags &
> + V4L2_MBUS_PCLK_SAMPLE_RISING);
> +
> +done:
> + of_node_put(np);
> + return pdata;
> +}
> +
> static int mt9v032_probe(struct i2c_client *client,
> const struct i2c_device_id *did)
> {
> - struct mt9v032_platform_data *pdata = client->dev.platform_data;
> + struct mt9v032_platform_data *pdata = mt9v032_get_pdata(client);
> struct mt9v032 *mt9v032;
> unsigned int i;
> int ret;
> @@ -1037,9 +1089,25 @@ static const struct i2c_device_id mt9v032_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, mt9v032_id);
>
> +#if IS_ENABLED(CONFIG_OF)
> +static const struct of_device_id mt9v032_of_match[] = {
> + { .compatible = "aptina,mt9v022" },
> + { .compatible = "aptina,mt9v022m" },
> + { .compatible = "aptina,mt9v024" },
> + { .compatible = "aptina,mt9v024m" },
> + { .compatible = "aptina,mt9v032" },
> + { .compatible = "aptina,mt9v032m" },
> + { .compatible = "aptina,mt9v034" },
> + { .compatible = "aptina,mt9v034m" },
> + { /* Sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mt9v032_of_match);
> +#endif
> +
> static struct i2c_driver mt9v032_driver = {
> .driver = {
> .name = "mt9v032",
> + .of_match_table = of_match_ptr(mt9v032_of_match),
> },
> .probe = mt9v032_probe,
> .remove = mt9v032_remove,
--
Kind regards,
Sakari Ailus
e-mail: sakari.ailus-X3B1VOXEql0@public.gmane.org XMPP: sailus-PCDdDYkjdNMDXYZnReoRVg@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] v4l: mt9v032: Add OF support
@ 2015-03-15 0:21 ` Sakari Ailus
0 siblings, 0 replies; 10+ messages in thread
From: Sakari Ailus @ 2015-03-15 0:21 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media, devicetree, Carlos Sanmartín Bustos,
Sylwester Nawrocki
Hi Laurent,
On Sat, Mar 14, 2015 at 04:57:37PM +0200, Laurent Pinchart wrote:
...
> diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> new file mode 100644
> index 0000000..68b134e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> @@ -0,0 +1,45 @@
> +* Aptina 1/3-Inch WVGA CMOS Digital Image Sensor
> +
> +The Aptina MT9V032 is a 1/3-inch CMOS active pixel digital image sensor with
> +an active array size of 752H x 480V. It is programmable through a simple
> +two-wire serial interface.
> +
> +Required Properties:
> +
> +- compatible: value should be either one among the following
> + (a) "aptina,mt9v022" for MT9V022 color sensor
> + (b) "aptina,mt9v022m" for MT9V022 monochrome sensor
> + (c) "aptina,mt9v024" for MT9V024 color sensor
> + (d) "aptina,mt9v024m" for MT9V024 monochrome sensor
> + (e) "aptina,mt9v032" for MT9V032 color sensor
> + (f) "aptina,mt9v032m" for MT9V032 monochrome sensor
> + (g) "aptina,mt9v034" for MT9V034 color sensor
> + (h) "aptina,mt9v034m" for MT9V034 monochrome sensor
> +
> +Optional Properties:
> +
> +- link-frequencies: List of allowed link frequencies in Hz. Each frequency is
> + expressed as a 64-bit big-endian integer.
> +
> +For further reading on port node refer to
> +Documentation/devicetree/bindings/media/video-interfaces.txt.
> +
> +Example:
> +
> + i2c0@1c22000 {
> + ...
> + ...
> + mt9v032@5c {
> + compatible = "aptina,mt9v032";
> + reg = <0x5c>;
> +
> + port {
> + mt9v032_1: endpoint {
> + link-frequencies =
> + <0 13000000>, <0 26600000>,
How about:
/bits/ 64 <13000000> ...
> + <0 27000000>;
> + };
> + };
> + };
> + ...
> + };
> diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
> index 255ea91..139eeef 100644
> --- a/drivers/media/i2c/mt9v032.c
> +++ b/drivers/media/i2c/mt9v032.c
> @@ -17,6 +17,8 @@
> #include <linux/i2c.h>
> #include <linux/log2.h>
> #include <linux/mutex.h>
> +#include <linux/of.h>
> +#include <linux/of_gpio.h>
> #include <linux/regmap.h>
> #include <linux/slab.h>
> #include <linux/videodev2.h>
> @@ -26,6 +28,7 @@
> #include <media/mt9v032.h>
> #include <media/v4l2-ctrls.h>
> #include <media/v4l2-device.h>
> +#include <media/v4l2-of.h>
> #include <media/v4l2-subdev.h>
>
> /* The first four rows are black rows. The active area spans 753x481 pixels. */
> @@ -876,10 +879,59 @@ static const struct regmap_config mt9v032_regmap_config = {
> * Driver initialization and probing
> */
>
> +static struct mt9v032_platform_data *
> +mt9v032_get_pdata(struct i2c_client *client)
> +{
> + struct mt9v032_platform_data *pdata;
> + struct v4l2_of_endpoint endpoint;
> + struct device_node *np;
> + struct property *prop;
> +
> + if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
> + return client->dev.platform_data;
> +
> + np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
> + if (!np)
> + return NULL;
> +
> + if (v4l2_of_parse_endpoint(np, &endpoint) < 0)
> + goto done;
> +
> + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + goto done;
> +
> + prop = of_find_property(np, "link-frequencies", NULL);
> + if (prop) {
> + size_t size = prop->length / 8;
> + u64 *link_freqs;
> +
> + link_freqs = devm_kzalloc(&client->dev,
> + size * sizeof(*link_freqs),
You could simply use prop->length here. I think that'd look nicer.
> + GFP_KERNEL);
> + if (!link_freqs)
> + goto done;
> +
> + if (of_property_read_u64_array(np, "link-frequencies",
> + link_freqs, size) < 0)
> + goto done;
> +
> + pdata->link_freqs = link_freqs;
> + pdata->link_def_freq = link_freqs[0];
> + }
> +
> + pdata->clk_pol = !!(endpoint.bus.parallel.flags &
> + V4L2_MBUS_PCLK_SAMPLE_RISING);
> +
> +done:
> + of_node_put(np);
> + return pdata;
> +}
> +
> static int mt9v032_probe(struct i2c_client *client,
> const struct i2c_device_id *did)
> {
> - struct mt9v032_platform_data *pdata = client->dev.platform_data;
> + struct mt9v032_platform_data *pdata = mt9v032_get_pdata(client);
> struct mt9v032 *mt9v032;
> unsigned int i;
> int ret;
> @@ -1037,9 +1089,25 @@ static const struct i2c_device_id mt9v032_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, mt9v032_id);
>
> +#if IS_ENABLED(CONFIG_OF)
> +static const struct of_device_id mt9v032_of_match[] = {
> + { .compatible = "aptina,mt9v022" },
> + { .compatible = "aptina,mt9v022m" },
> + { .compatible = "aptina,mt9v024" },
> + { .compatible = "aptina,mt9v024m" },
> + { .compatible = "aptina,mt9v032" },
> + { .compatible = "aptina,mt9v032m" },
> + { .compatible = "aptina,mt9v034" },
> + { .compatible = "aptina,mt9v034m" },
> + { /* Sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mt9v032_of_match);
> +#endif
> +
> static struct i2c_driver mt9v032_driver = {
> .driver = {
> .name = "mt9v032",
> + .of_match_table = of_match_ptr(mt9v032_of_match),
> },
> .probe = mt9v032_probe,
> .remove = mt9v032_remove,
--
Kind regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] v4l: mt9v032: Add OF support
2015-03-15 0:21 ` Sakari Ailus
(?)
@ 2015-03-18 13:32 ` Laurent Pinchart
2015-03-18 20:56 ` Sakari Ailus
-1 siblings, 1 reply; 10+ messages in thread
From: Laurent Pinchart @ 2015-03-18 13:32 UTC (permalink / raw)
To: Sakari Ailus
Cc: linux-media, devicetree, Carlos Sanmartín Bustos,
Sylwester Nawrocki
Hi Sakari,
On Sunday 15 March 2015 02:21:07 Sakari Ailus wrote:
> On Sat, Mar 14, 2015 at 04:57:37PM +0200, Laurent Pinchart wrote:
> ...
>
> > diff --git a/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> > b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt new file mode
> > 100644
> > index 0000000..68b134e
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/i2c/mt9v032.txt
> > @@ -0,0 +1,45 @@
> > +* Aptina 1/3-Inch WVGA CMOS Digital Image Sensor
> > +
> > +The Aptina MT9V032 is a 1/3-inch CMOS active pixel digital image sensor
> > with +an active array size of 752H x 480V. It is programmable through a
> > simple +two-wire serial interface.
> > +
> > +Required Properties:
> > +
> > +- compatible: value should be either one among the following
> > + (a) "aptina,mt9v022" for MT9V022 color sensor
> > + (b) "aptina,mt9v022m" for MT9V022 monochrome sensor
> > + (c) "aptina,mt9v024" for MT9V024 color sensor
> > + (d) "aptina,mt9v024m" for MT9V024 monochrome sensor
> > + (e) "aptina,mt9v032" for MT9V032 color sensor
> > + (f) "aptina,mt9v032m" for MT9V032 monochrome sensor
> > + (g) "aptina,mt9v034" for MT9V034 color sensor
> > + (h) "aptina,mt9v034m" for MT9V034 monochrome sensor
> > +
> > +Optional Properties:
> > +
> > +- link-frequencies: List of allowed link frequencies in Hz. Each
> > frequency is + expressed as a 64-bit big-endian integer.
> > +
> > +For further reading on port node refer to
> > +Documentation/devicetree/bindings/media/video-interfaces.txt.
> > +
> > +Example:
> > +
> > + i2c0@1c22000 {
> > + ...
> > + ...
> > + mt9v032@5c {
> > + compatible = "aptina,mt9v032";
> > + reg = <0x5c>;
> > +
> > + port {
> > + mt9v032_1: endpoint {
> > + link-frequencies =
> > + <0 13000000>, <0 26600000>,
>
> How about:
>
> /bits/ 64 <13000000> ...
Absolutely.
> > + <0 27000000>;
> > + };
> > + };
> > + };
> > + ...
> > + };
> > diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
> > index 255ea91..139eeef 100644
> > --- a/drivers/media/i2c/mt9v032.c
> > +++ b/drivers/media/i2c/mt9v032.c
[snip]
> > @@ -876,10 +879,59 @@ static const struct regmap_config
> > mt9v032_regmap_config = {>
> > * Driver initialization and probing
> > */
> >
> > +static struct mt9v032_platform_data *
> > +mt9v032_get_pdata(struct i2c_client *client)
> > +{
> > + struct mt9v032_platform_data *pdata;
> > + struct v4l2_of_endpoint endpoint;
> > + struct device_node *np;
> > + struct property *prop;
> > +
> > + if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
> > + return client->dev.platform_data;
> > +
> > + np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
> > + if (!np)
> > + return NULL;
> > +
> > + if (v4l2_of_parse_endpoint(np, &endpoint) < 0)
> > + goto done;
> > +
> > + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
> > + if (!pdata)
> > + goto done;
> > +
> > + prop = of_find_property(np, "link-frequencies", NULL);
> > + if (prop) {
> > + size_t size = prop->length / 8;
> > + u64 *link_freqs;
> > +
> > + link_freqs = devm_kzalloc(&client->dev,
> > + size * sizeof(*link_freqs),
>
> You could simply use prop->length here. I think that'd look nicer.
How about devm_kcalloc(&client->dev, size, sizeof(*link_freqs)) as this is
allocating an array ?
> > + GFP_KERNEL);
> > + if (!link_freqs)
> > + goto done;
> > +
> > + if (of_property_read_u64_array(np, "link-frequencies",
> > + link_freqs, size) < 0)
> > + goto done;
> > +
> > + pdata->link_freqs = link_freqs;
> > + pdata->link_def_freq = link_freqs[0];
> > + }
> > +
> > + pdata->clk_pol = !!(endpoint.bus.parallel.flags &
> > + V4L2_MBUS_PCLK_SAMPLE_RISING);
> > +
> > +done:
> > + of_node_put(np);
> > + return pdata;
> > +}
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging
2015-03-14 14:57 [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging Laurent Pinchart
@ 2015-03-18 13:40 ` Laurent Pinchart
[not found] ` <1426345057-2752-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
1 sibling, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2015-03-18 13:40 UTC (permalink / raw)
To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Carlos Sanmartín Bustos,
Sylwester Nawrocki
Hello,
Gentle ping to the DT maintainers for this (hopefully) simple bikeshedding
question.
On Saturday 14 March 2015 16:57:36 Laurent Pinchart wrote:
> Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
> Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> Aptina has recently been acquired by ON Semiconductor, but the name Aptina
> is still widely used. Should the onnn prefix be used instead ?
>
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt
> b/Documentation/devicetree/bindings/vendor-prefixes.txt index
> 389ca13..4326f52 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -20,6 +20,7 @@ amlogic Amlogic, Inc.
> ams AMS AG
> amstaos AMS-Taos Inc.
> apm Applied Micro Circuits Corporation (APM)
> +aptina Aptina Imaging
> arm ARM Ltd.
> armadeus ARMadeus Systems SARL
> asahi-kasei Asahi Kasei Corp.
--
Regards,
Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging
@ 2015-03-18 13:40 ` Laurent Pinchart
0 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2015-03-18 13:40 UTC (permalink / raw)
To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala
Cc: linux-media, devicetree, Carlos Sanmartín Bustos,
Sylwester Nawrocki
Hello,
Gentle ping to the DT maintainers for this (hopefully) simple bikeshedding
question.
On Saturday 14 March 2015 16:57:36 Laurent Pinchart wrote:
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> Aptina has recently been acquired by ON Semiconductor, but the name Aptina
> is still widely used. Should the onnn prefix be used instead ?
>
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt
> b/Documentation/devicetree/bindings/vendor-prefixes.txt index
> 389ca13..4326f52 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -20,6 +20,7 @@ amlogic Amlogic, Inc.
> ams AMS AG
> amstaos AMS-Taos Inc.
> apm Applied Micro Circuits Corporation (APM)
> +aptina Aptina Imaging
> arm ARM Ltd.
> armadeus ARMadeus Systems SARL
> asahi-kasei Asahi Kasei Corp.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging
2015-03-14 14:57 [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging Laurent Pinchart
@ 2015-03-18 15:59 ` Rob Herring
[not found] ` <1426345057-2752-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2015-03-18 15:59 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Carlos Sanmartín Bustos,
Sylwester Nawrocki
On Sat, Mar 14, 2015 at 9:57 AM, Laurent Pinchart
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org> wrote:
> Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
> Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> Aptina has recently been acquired by ON Semiconductor, but the name Aptina is
> still widely used. Should the onnn prefix be used instead ?
Using aptina is fine.
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Rob
>
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index 389ca13..4326f52 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -20,6 +20,7 @@ amlogic Amlogic, Inc.
> ams AMS AG
> amstaos AMS-Taos Inc.
> apm Applied Micro Circuits Corporation (APM)
> +aptina Aptina Imaging
> arm ARM Ltd.
> armadeus ARMadeus Systems SARL
> asahi-kasei Asahi Kasei Corp.
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging
@ 2015-03-18 15:59 ` Rob Herring
0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2015-03-18 15:59 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media, devicetree, Carlos Sanmartín Bustos,
Sylwester Nawrocki
On Sat, Mar 14, 2015 at 9:57 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> Aptina has recently been acquired by ON Semiconductor, but the name Aptina is
> still widely used. Should the onnn prefix be used instead ?
Using aptina is fine.
Acked-by: Rob Herring <robh@kernel.org>
Rob
>
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index 389ca13..4326f52 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -20,6 +20,7 @@ amlogic Amlogic, Inc.
> ams AMS AG
> amstaos AMS-Taos Inc.
> apm Applied Micro Circuits Corporation (APM)
> +aptina Aptina Imaging
> arm ARM Ltd.
> armadeus ARMadeus Systems SARL
> asahi-kasei Asahi Kasei Corp.
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 2/2] v4l: mt9v032: Add OF support
2015-03-18 13:32 ` Laurent Pinchart
@ 2015-03-18 20:56 ` Sakari Ailus
0 siblings, 0 replies; 10+ messages in thread
From: Sakari Ailus @ 2015-03-18 20:56 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media, devicetree, Carlos Sanmartín Bustos,
Sylwester Nawrocki
Hi Laurent,
On Wed, Mar 18, 2015 at 03:32:28PM +0200, Laurent Pinchart wrote:
...
> > > @@ -876,10 +879,59 @@ static const struct regmap_config
> > > mt9v032_regmap_config = {>
> > > * Driver initialization and probing
> > > */
> > >
> > > +static struct mt9v032_platform_data *
> > > +mt9v032_get_pdata(struct i2c_client *client)
> > > +{
> > > + struct mt9v032_platform_data *pdata;
> > > + struct v4l2_of_endpoint endpoint;
> > > + struct device_node *np;
> > > + struct property *prop;
> > > +
> > > + if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
> > > + return client->dev.platform_data;
> > > +
> > > + np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
> > > + if (!np)
> > > + return NULL;
> > > +
> > > + if (v4l2_of_parse_endpoint(np, &endpoint) < 0)
> > > + goto done;
> > > +
> > > + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
> > > + if (!pdata)
> > > + goto done;
> > > +
> > > + prop = of_find_property(np, "link-frequencies", NULL);
> > > + if (prop) {
> > > + size_t size = prop->length / 8;
> > > + u64 *link_freqs;
> > > +
> > > + link_freqs = devm_kzalloc(&client->dev,
> > > + size * sizeof(*link_freqs),
> >
> > You could simply use prop->length here. I think that'd look nicer.
>
> How about devm_kcalloc(&client->dev, size, sizeof(*link_freqs)) as this is
> allocating an array ?
That's certainly fine as well, I think. Feel free to divide prop->length by
sizeof(*link_freqs) instead of plain 8.
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-03-18 20:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-14 14:57 [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging Laurent Pinchart
2015-03-14 14:57 ` [PATCH v3 2/2] v4l: mt9v032: Add OF support Laurent Pinchart
[not found] ` <1426345057-2752-2-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2015-03-15 0:21 ` Sakari Ailus
2015-03-15 0:21 ` Sakari Ailus
2015-03-18 13:32 ` Laurent Pinchart
2015-03-18 20:56 ` Sakari Ailus
[not found] ` <1426345057-2752-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2015-03-18 13:40 ` [PATCH v3 1/2] of: Add vendor prefix for Aptina Imaging Laurent Pinchart
2015-03-18 13:40 ` Laurent Pinchart
2015-03-18 15:59 ` Rob Herring
2015-03-18 15:59 ` Rob Herring
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.