From: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
To: Jean-Michel Hautbois
<jean-michel.hautbois-B+Q8N6RmIDZBDgjK7y7TUQ@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org,
laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org
Subject: Re: [PATCH v2 2/2] adv7604: Use DT parsing in dummy creation
Date: Fri, 29 Aug 2014 17:49:26 +0200 [thread overview]
Message-ID: <5400A106.6060004@metafoo.de> (raw)
In-Reply-To: <1409325303-15906-2-git-send-email-jean-michel.hautbois-B+Q8N6RmIDZBDgjK7y7TUQ@public.gmane.org>
On 08/29/2014 05:15 PM, Jean-Michel Hautbois wrote:
> This patch uses DT in order to parse addresses for dummy devices of adv7604.
> The ADV7604 has thirteen 256-byte maps that can be accessed via the main
> I²C ports. Each map has it own I²C address and acts
> as a standard slave device on the I²C bus.
>
> If nothing is defined, it uses default addresses.
> The main prupose is using two adv76xx on the same i2c bus.
Ideally this patch is split up in two patches. One patch adding support for
i2c_new_secondary_device() and one patch adding support for DT for the adv7604.
[...]
> +static const char const *adv7604_secondary_names[] = {
> + "main", /* ADV7604_PAGE_IO */
How about [ADV7604_PAGE_IO] = "main", instead of having the comment, this
makes things more explicit.
> + "avlink", /* ADV7604_PAGE_AVLINK */
> + "cec", /* ADV7604_PAGE_CEC */
> + "infoframe", /* ADV7604_PAGE_INFOFRAME */
> + "esdp", /* ADV7604_PAGE_ESDP */
> + "dpp", /* ADV7604_PAGE_DPP */
> + "afe", /* ADV7604_PAGE_AFE */
> + "rep", /* ADV7604_PAGE_REP */
> + "edid", /* ADV7604_PAGE_EDID */
> + "hdmi", /* ADV7604_PAGE_HDMI */
> + "test", /* ADV7604_PAGE_TEST */
> + "cp", /* ADV7604_PAGE_CP */
> + "vdp" /* ADV7604_PAGE_VDP */
> +};
> +
> /* ----------------------------------------------------------------------- */
>
> static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
> @@ -2528,13 +2544,31 @@ static void adv7604_unregister_clients(struct adv7604_state *state)
> }
>
> static struct i2c_client *adv7604_dummy_client(struct v4l2_subdev *sd,
> - u8 addr, u8 io_reg)
> + unsigned int i)
> {
> struct i2c_client *client = v4l2_get_subdevdata(sd);
> + struct adv7604_platform_data *pdata = client->dev.platform_data;
> + unsigned int io_reg = 0xf2 + i;
> + unsigned int default_addr = io_read(sd, io_reg) >> 1;
> + struct i2c_client *new_client;
> +
> + if (IS_ENABLED(CONFIG_OF)) {
No CONFIG_OF. i2c_new_secondary_device() is supposed to be the generic
method of instantiating the secondary i2c_client, regardless of how the
address is specified. For this driver we still need to keep the old method
of instantiation via platform data for legacy reasons for now. So what this
should look like is:
if (pdata && pdata->i2c_addresses[i])
new_client = i2c_new_dummy(client->adapter,
pdata->i2c_addresses[i]);
else
new_client = i2c_new_secondary_device(client,
adv7604_secondary_names[i], default_addr);
> + /* Try to find it in DT */
> + new_client = i2c_new_secondary_device(client,
> + adv7604_secondary_names[i], default_addr);
> + } else if (pdata) {
> + if (pdata->i2c_addresses[i])
> + new_client = i2c_new_dummy(client->adapter,
> + pdata->i2c_addresses[i]);
> + else
> + new_client = i2c_new_dummy(client->adapter,
> + default_addr);
> + }
>
[...]
--
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
next prev parent reply other threads:[~2014-08-29 15:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-29 15:15 [PATCH v2 1/2] Allow DT parsing of secondary devices Jean-Michel Hautbois
2014-08-29 15:15 ` [PATCH v2 2/2] adv7604: Use DT parsing in dummy creation Jean-Michel Hautbois
[not found] ` <1409325303-15906-2-git-send-email-jean-michel.hautbois-B+Q8N6RmIDZBDgjK7y7TUQ@public.gmane.org>
2014-08-29 15:49 ` Lars-Peter Clausen [this message]
2014-08-31 17:18 ` Laurent Pinchart
2014-09-01 10:08 ` Jean-Michel Hautbois
[not found] ` <1409325303-15906-1-git-send-email-jean-michel.hautbois-B+Q8N6RmIDZBDgjK7y7TUQ@public.gmane.org>
2014-08-29 15:38 ` [PATCH v2 1/2] Allow DT parsing of secondary devices Lars-Peter Clausen
2014-08-29 15:39 ` Lars-Peter Clausen
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=5400A106.6060004@metafoo.de \
--to=lars-qo5elluwu/uelga04laivw@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org \
--cc=jean-michel.hautbois-B+Q8N6RmIDZBDgjK7y7TUQ@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
/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).