From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Ben Dooks <ben.dooks@codethink.co.uk>, linux-media@vger.kernel.org
Cc: g.liakhovetski@gmx.de, linux-sh@vger.kernel.org
Subject: Re: [RFC 2/3] rcar_vin: add devicetree support
Date: Mon, 31 Mar 2014 11:27:45 +0000 [thread overview]
Message-ID: <53395131.6090002@cogentembedded.com> (raw)
In-Reply-To: <1396214765-23689-2-git-send-email-ben.dooks@codethink.co.uk>
Hello.
On 31-03-2014 1:26, Ben Dooks wrote:
> Add support for devicetree probe for the rcar-vin
> driver.
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> .../devicetree/bindings/media/rcar_vin.txt | 79 ++++++++++++++++++++++
> drivers/media/platform/soc_camera/rcar_vin.c | 67 ++++++++++++++++--
> 2 files changed, 140 insertions(+), 6 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/media/rcar_vin.txt
> diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt b/Documentation/devicetree/bindings/media/rcar_vin.txt
> new file mode 100644
> index 0000000..105b8de
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
> @@ -0,0 +1,79 @@
> +Renesas RCar Video Input driver (rcar_vin)
> +------------------------------------------
> +
> +The rcar_vin device provides video input capabilities for the Renesas R-Car
> +family of devices. The current blocks are always slaves and suppot one input
> +channel which can be either RGB, YUYV or BT656.
> +
> + - compatible: Must be one of the following
> + - "renesas,vin-r8a7791" for the R8A7791 device
> + - "renesas,vin-r8a7790" for the R8A7790 device
> + - "renesas,vin-r8a7779" for the R8A7779 device
> + - "renesas,vin-r8a7778" for the R8A7778 device
> + - reg: the register base and size for the device registers
Register base of the registers?
[...]
> +/* composite video input */
> +&vin1 {
> + pinctrl-0 = <&vin1_pins>;
> + pinctrl-names = "default";
> +
> + status = "ok";
> +
> + port {
> + #address-cells = <1>;
Where is this used? I don't see "reg" prop in the sub-node...
> + #size-cells = <0>;
> +
> + vin1ep0: endpoint {
> + remote-endpoint = <&adv7180_1>;
> + bus-width = <8>;
> + };
> + };
> +};
> +
> +
> +
> +[1] video-interfaces.txt common video media interface
> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
> index 47516df..73c56c7 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
[...]
> @@ -1392,6 +1395,17 @@ static struct soc_camera_host_ops rcar_vin_host_ops = {
> .init_videobuf2 = rcar_vin_init_videobuf2,
> };
>
> +#ifdef CONFIG_OF
I don't think it's worth using this #ifdef -- the OF code is not under
#ifdef anyway...
> +static struct of_device_id rcar_vin_of_table[] = {
> + { .compatible = "renesas,vin-r8a7791", .data = (void *)RCAR_GEN2 },
> + { .compatible = "renesas,vin-r8a7790", .data = (void *)RCAR_GEN2 },
> + { .compatible = "renesas,vin-r8a7779", .data = (void *)RCAR_H1 },
> + { .compatible = "renesas,vin-r8a7778", .data = (void *)RCAR_M1 },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, rcar_vin_of_table);
> +#endif
> +
> static struct platform_device_id rcar_vin_id_table[] = {
> { "r8a7791-vin", RCAR_GEN2 },
> { "r8a7790-vin", RCAR_GEN2 },
> @@ -1404,15 +1418,50 @@ MODULE_DEVICE_TABLE(platform, rcar_vin_id_table);
>
> static int rcar_vin_probe(struct platform_device *pdev)
> {
> + const struct of_device_id *match = NULL;
> struct rcar_vin_priv *priv;
> struct resource *mem;
> struct rcar_vin_platform_data *pdata;
> + unsigned int pdata_flags;
> int irq, ret;
>
> - pdata = pdev->dev.platform_data;
> - if (!pdata || !pdata->flags) {
> - dev_err(&pdev->dev, "platform data not set\n");
> - return -EINVAL;
> + if (pdev->dev.of_node) {
> + struct v4l2_of_endpoint ep;
> + struct device_node *np;
> +
> + match = of_match_device(of_match_ptr(rcar_vin_of_table),
> + &pdev->dev);
> +
> + np = v4l2_of_get_next_endpoint(pdev->dev.of_node, NULL);
> + if (!np) {
> + dev_err(&pdev->dev, "could not find endpoint\n");
> + return -EINVAL;
> + }
> +
> + ret = v4l2_of_parse_endpoint(np, &ep);
> + if (ret) {
> + dev_err(&pdev->dev, "could not parse endpoint\n");
> + return ret;
> + }
> +
> + if (ep.bus_type = V4L2_MBUS_BT656)
> + pdata_flags = RCAR_VIN_BT656;
> + else {
Need {} in all arms of this *if* statement.
[...]
> @@ -1447,8 +1496,13 @@ static int rcar_vin_probe(struct platform_device *pdev)
> priv->ici.drv_name = dev_name(&pdev->dev);
> priv->ici.ops = &rcar_vin_host_ops;
>
> - priv->pdata_flags = pdata->flags;
> - priv->chip = pdev->id_entry->driver_data;
> + priv->pdata_flags = pdata_flags;
> + if (!match)
> + priv->chip = pdev->id_entry->driver_data;
> + else
> + priv->chip = (enum chip_id)match->data;
> +
> +
Too many empty lines.
> @@ -1489,6 +1543,7 @@ static struct platform_driver rcar_vin_driver = {
> .driver = {
> .name = DRV_NAME,
> .owner = THIS_MODULE,
> + .of_match_table = of_match_ptr(rcar_vin_of_table),
Don't think we need of_match_ptr() as well as #ifdef CONFIG_OF.
[...]
WBR, Sergei
next prev parent reply other threads:[~2014-03-31 11:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-30 21:26 [RFC 1/3] rcar_vin: copy flags from pdata Ben Dooks
2014-03-30 21:26 ` [RFC 2/3] rcar_vin: add devicetree support Ben Dooks
2014-03-30 21:34 ` Ben Dooks
2014-03-31 11:27 ` Sergei Shtylyov [this message]
2014-03-30 21:26 ` [RFC 3/3] soc_camera: initial of code Ben Dooks
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=53395131.6090002@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=ben.dooks@codethink.co.uk \
--cc=g.liakhovetski@gmx.de \
--cc=linux-media@vger.kernel.org \
--cc=linux-sh@vger.kernel.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).