From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
To: Prabhakar Lad <prabhakar.csengg@gmail.com>
Cc: LMML <linux-media@vger.kernel.org>,
DLOS <davinci-linux-open-source@linux.davincidsp.com>,
"Lad, Prabhakar" <prabhakar.lad@ti.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@redhat.com>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Sakari Ailus <sakari.ailus@iki.fi>,
Grant Likely <grant.likely@secretlab.ca>,
Rob Herring <rob.herring@calxeda.com>,
Rob Landley <rob@landley.net>,
devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC v2] media: tvp514x: add OF support
Date: Sun, 03 Feb 2013 14:27:15 +0100 [thread overview]
Message-ID: <510E65B3.10901@gmail.com> (raw)
In-Reply-To: <CA+V-a8u6VADw_HfbBN4ESGUXTSMKfVyKZaEf1bhVGACof6qZ8A@mail.gmail.com>
Hi Prabhakar,
On 02/03/2013 11:13 AM, Prabhakar Lad wrote:
[...]
>>> +Required Properties :
>>> +- compatible: Must be "ti,tvp514x-decoder"
>>
>>
>> There are no significant differences among TVP514* devices as listed above,
>> you would like to handle above ?
Sorry for the mangled sentence, I intended to write "in the driver" instead
of the last "above".
>> I'm just wondering if you don't need ,for instance, two separate compatible
>> properties, e.g. "ti,tvp5146-decoder" and "ti,tvp5147-decoder" ?
>>
> There are few differences in init/power sequence tough, I would still
> like to have
> single compatible property "ti,tvp514x-decoder", If you feel we need separate
> property I will change it please let me know on this.
As Sekhar already mentioned, wildcards in the compatible property should
not be used. You could just use exact part names in the compatible
properties and list them all in the tvp514x_of_match[] array. Even though
this driver doesn't care about the differences between various tvp514?
chips, there might be others that do.
[...]
>>> +#if defined(CONFIG_OF)
>>> +static const struct of_device_id tvp514x_of_match[] = {
>>> + {.compatible = "ti,tvp514x-decoder", },
>>> + {},
>>> +};
>>> +MODULE_DEVICE_TABLE(of, tvp514x_of_match);
>>> +
>>> +static struct tvp514x_platform_data
>>> + *tvp514x_get_pdata(struct i2c_client *client)
>>> +{
>>> + if (!client->dev.platform_data&& client->dev.of_node) {
>>>
>>> + struct tvp514x_platform_data *pdata;
>>> + struct v4l2_of_endpoint bus_cfg;
>>> + struct device_node *endpoint;
>>> +
>>> + pdata = devm_kzalloc(&client->dev,
>>> + sizeof(struct tvp514x_platform_data),
>>> + GFP_KERNEL);
>>> + client->dev.platform_data = pdata;
>>
>>
>> Do you really need to set client->dev.platform_data this way ?
>> What about passing struct tvp514x_decoder pointer to this function
>> and initializing struct tvp514x_decoder::pdata instead ?
>>
>>
> Yes that can work too, I'll do the same.
Ok, thanks.
>>> + if (!pdata)
>>> + return NULL;
>>> +
>>> + endpoint = of_get_child_by_name(client->dev.of_node,
>>> "port");
>>> + if (endpoint)
>>> + endpoint = of_get_child_by_name(endpoint,
>>> "endpoint");
>>
>>
>> I think you could replace these two calls above with
>>
>> endpoint = v4l2_of_get_next_endpoint(client->dev.of_node);
>>
> Ok
>
>> Now I see I should have modified this function to ensure it works also when
>> 'port' nodes are grouped in a 'ports' node.
>>
> So V5 series of V4l OF parser doesn't have this fix ?
No, it doesn't. I think we need something along the lines of:
diff --git a/drivers/media/v4l2-core/v4l2-of.c
b/drivers/media/v4l2-core/v4l2-of.c
index e1f570b..8a286f1 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -185,10 +185,15 @@ struct device_node
*v4l2_of_get_next_endpoint(const struct device_node *parent,
* This is the first call, we have to find a port within
* this node.
*/
- for_each_child_of_node(parent, port) {
+ while (port = of_get_next_child(parent, port)) {
if (!of_node_cmp(port->name, "port"))
break;
- }
+ if (!of_node_cmp(port->name, "ports")) {
+ parent = port;
+ of_node_put(port);
+ port = NULL:
+ }
+ };
if (port) {
/* Found a port, get an endpoint. */
endpoint = of_get_next_child(port, NULL);
However this shouldn't affect you, as you don't use the 'ports' node...
I will likely post v6 including this fix tomorrow.
--
Regards,
Sylwester
next prev parent reply other threads:[~2013-02-03 13:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-29 13:07 [PATCH RFC v2] media: tvp514x: add OF support Prabhakar Lad
2013-02-01 22:37 ` Sylwester Nawrocki
2013-02-03 10:13 ` Prabhakar Lad
[not found] ` <CA+V-a8u6VADw_HfbBN4ESGUXTSMKfVyKZaEf1bhVGACof6qZ8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-03 13:10 ` Sekhar Nori
2013-02-03 16:10 ` Prabhakar Lad
2013-02-03 13:14 ` Laurent Pinchart
2013-02-03 16:12 ` Prabhakar Lad
2013-02-03 13:27 ` Sylwester Nawrocki [this message]
2013-02-03 16:18 ` Prabhakar Lad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=510E65B3.10901@gmail.com \
--to=sylvester.nawrocki@gmail.com \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=g.liakhovetski@gmx.de \
--cc=grant.likely@secretlab.ca \
--cc=hans.verkuil@cisco.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.com \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.lad@ti.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).