devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benoit Parrot <bparrot@ti.com>
To: Rob Herring <robh@kernel.org>
Cc: Hans Verkuil <hverkuil@xs4all.nl>, <linux-media@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [Patch 03/19] media: ti-vpe: cal: Add per platform data support
Date: Wed, 30 Oct 2019 08:34:12 -0500	[thread overview]
Message-ID: <20191030133412.un4w25qpn3usmcnw@ti.com> (raw)
In-Reply-To: <20191029131855.GA27597@bogus>

Rob Herring <robh@kernel.org> wrote on Tue [2019-Oct-29 08:18:55 -0500]:
> On Fri, Oct 18, 2019 at 10:34:21AM -0500, Benoit Parrot wrote:
> > First this patch adds a method to access the CTRL_CORE_CAMERRX_CONTROL
> > register to use the syscon mechanism. For backward compatibility we also
> > handle using the existing camerrx_control "reg" entry if a syscon node
> > is not found.
> > 
> > In addition the register bit layout for the CTRL_CORE_CAMERRX_CONTROL
> > changes depending on the device. In order to support this we need to use
> > a register access scheme based on data configuration instead of using
> > static macro.
> > 
> > In this case we make use of the regmap facility and create data set
> > based on the various device and phy available.
> > 
> > Signed-off-by: Benoit Parrot <bparrot@ti.com>
> > ---
> >  drivers/media/platform/ti-vpe/cal.c | 281 +++++++++++++++++++++-------
> >  1 file changed, 212 insertions(+), 69 deletions(-)
> 
> 
> > @@ -1816,6 +1911,18 @@ static int cal_probe(struct platform_device *pdev)
> >  	if (!dev)
> >  		return -ENOMEM;
> >  
> > +	match = of_match_device(of_match_ptr(cal_of_match), &pdev->dev);
> 
> Use of_device_get_match_data() instead.

Ok I'll change that.

> 
> > +	if (!match)
> > +		return -ENODEV;
> > +
> > +	if (match->data) {
> > +		dev->data = (struct cal_data *)match->data;
> > +		dev->flags = dev->data->flags;
> > +	} else {
> > +		dev_err(&pdev->dev, "Could not get feature data based on compatible version\n");
> > +		return -ENODEV;
> > +	}
> > +
> >  	/* set pseudo v4l2 device name so we can use v4l2_printk */
> >  	strscpy(dev->v4l2_dev.name, CAL_MODULE_NAME,
> >  		sizeof(dev->v4l2_dev.name));
> > @@ -1823,6 +1930,43 @@ static int cal_probe(struct platform_device *pdev)
> >  	/* save pdev pointer */
> >  	dev->pdev = pdev;
> >  
> > +	if (parent && of_property_read_bool(parent, "syscon-camerrx")) {
> > +		syscon_camerrx =
> > +			syscon_regmap_lookup_by_phandle(parent,
> > +							"syscon-camerrx");
> > +		if (IS_ERR(syscon_camerrx)) {
> > +			dev_err(&pdev->dev, "failed to get syscon-camerrx regmap\n");
> > +			return PTR_ERR(syscon_camerrx);
> > +		}
> > +
> > +		if (of_property_read_u32_index(parent, "syscon-camerrx", 1,
> > +					       &syscon_camerrx_offset)) {
> 
> Kind of odd to read the property twice and using functions that don't 
> match the type. We have functions to retrieve phandle and args.

Yeah, I wanted to make a distinction between the node being present and
any other kind of errors, so we can have a little more precise error
message.

> 
> > +			dev_err(&pdev->dev, "failed to get syscon-camerrx offset\n");
> > +			return -EINVAL;
> > +		}
> > +	} else {
> > +		/*
> > +		 * Backward DTS compatibility.
> > +		 * If syscon entry is not present then check if the
> > +		 * camerrx_control resource is present.
> > +		 */
> > +		syscon_camerrx = cal_get_camerarx_regmap(dev);
> > +		if (IS_ERR(syscon_camerrx)) {
> > +			dev_err(&pdev->dev, "failed to get camerrx_control regmap\n");
> > +			return PTR_ERR(syscon_camerrx);
> > +		}
> > +		/* In this case the base already point to the direct
> > +		 * CM register so no need for an offset
> > +		 */
> > +		syscon_camerrx_offset = 0;
> > +	}
> > +
> > +	dev->syscon_camerrx = syscon_camerrx;
> > +	dev->syscon_camerrx_offset = syscon_camerrx_offset;
> > +	ret = cal_camerarx_regmap_init(dev);
> > +	if (ret)
> > +		return ret;
> > +
> >  	dev->res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> >  						"cal_top");
> >  	dev->base = devm_ioremap_resource(&pdev->dev, dev->res);
> 

  reply	other threads:[~2019-10-30 13:34 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 15:34 [Patch 00/19] media: ti-vpe: cal: maintenance Benoit Parrot
2019-10-18 15:34 ` [Patch 01/19] dt-bindings: media: cal: update binding to use syscon Benoit Parrot
2019-10-29 13:20   ` Rob Herring
2019-10-30 13:39     ` Benoit Parrot
2019-10-18 15:34 ` [Patch 02/19] dt-bindings: media: cal: update binding example Benoit Parrot
2019-10-29 13:21   ` Rob Herring
2019-10-30 13:41     ` Benoit Parrot
2019-10-18 15:34 ` [Patch 03/19] media: ti-vpe: cal: Add per platform data support Benoit Parrot
2019-10-29 13:18   ` Rob Herring
2019-10-30 13:34     ` Benoit Parrot [this message]
2019-10-18 15:34 ` [Patch 04/19] media: ti-vpe: cal: Enable DMABUF export Benoit Parrot
2019-10-18 15:34 ` [Patch 05/19] media: ti-vpe: cal: Restrict DMA to avoid memory corruption Benoit Parrot
2019-10-18 15:34 ` [Patch 06/19] dt-bindings: media: cal: update binding to add PHY LDO errata support Benoit Parrot
2019-10-29 13:23   ` Rob Herring
2019-10-18 15:34 ` [Patch 07/19] media: ti-vpe: cal: add CSI2 " Benoit Parrot
2019-10-21 10:38   ` Hans Verkuil
2019-10-23 16:03     ` Benoit Parrot
2019-10-18 15:34 ` [Patch 08/19] media: ti-vpe: cal: Fix ths_term/ths_settle parameters Benoit Parrot
2019-10-18 15:34 ` [Patch 09/19] media: ti-vpe: cal: Fix pixel processing parameters Benoit Parrot
2019-10-18 15:34 ` [Patch 10/19] media: ti-vpe: cal: Align DPHY init sequence with docs Benoit Parrot
2019-10-18 15:34 ` [Patch 11/19] dt-bindings: media: cal: update binding to add DRA76x support Benoit Parrot
2019-10-29 13:24   ` Rob Herring
2019-10-18 15:34 ` [Patch 12/19] media: ti-vpe: cal: Add " Benoit Parrot
2019-10-18 15:34 ` [Patch 13/19] dt-bindings: media: cal: update binding to add AM654 support Benoit Parrot
2019-10-29 13:24   ` Rob Herring
2019-10-18 15:34 ` [Patch 14/19] media: ti-vpe: cal: Add " Benoit Parrot
2019-10-18 15:34 ` [Patch 15/19] media: ti-vpe: cal: Add subdev s_power hooks Benoit Parrot
2019-10-18 15:34 ` [Patch 16/19] media: ti-vpe: cal: Properly calculate max resolution boundary Benoit Parrot
2019-10-18 15:34 ` [Patch 17/19] media: ti-vpe: cal: Fix a WARN issued when start streaming fails Benoit Parrot
2019-10-18 15:34 ` [Patch 18/19] media: ti-vpe: cal: fix enum_mbus_code/frame_size subdev arguments Benoit Parrot
2019-10-18 15:34 ` [Patch 19/19] dt-bindings: media: cal: convert binding to yaml Benoit Parrot
2019-10-21 10:49   ` Hans Verkuil
2019-10-23 16:06     ` Benoit Parrot
2019-10-22  7:46   ` Sakari Ailus
2019-10-23 16:18     ` Benoit Parrot
2019-10-24  6:13       ` Sakari Ailus
2019-10-29 14:22   ` Rob Herring
2019-10-30 13:54     ` Benoit Parrot
2019-10-21 10:50 ` [Patch 00/19] media: ti-vpe: cal: maintenance Hans Verkuil
2019-10-23 16:05   ` Benoit Parrot

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=20191030133412.un4w25qpn3usmcnw@ti.com \
    --to=bparrot@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=robh@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).