From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Andy Shevchenko <andriy.shevchenko@intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
Satish Nagireddy <satish.nagireddy@getcruise.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/8] media: i2c: ds90ub913: Use v4l2_fwnode_endpoint_parse()
Date: Tue, 25 Jul 2023 19:34:10 +0300 [thread overview]
Message-ID: <20230725163410.GJ31069@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230720-fpdlink-additions-v2-3-b91b1eca2ad3@ideasonboard.com>
Hi Tomi,
Thank you for the patch.
On Thu, Jul 20, 2023 at 01:30:34PM +0300, Tomi Valkeinen wrote:
> Use v4l2_fwnode_endpoint_parse() to parse the sink endpoint parameters.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
> drivers/media/i2c/ds90ub913.c | 32 ++++++++++++++++++++------------
> 1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c
> index 4dae5afa9fa9..cb53b0654a43 100644
> --- a/drivers/media/i2c/ds90ub913.c
> +++ b/drivers/media/i2c/ds90ub913.c
> @@ -21,6 +21,8 @@
> #include <linux/regmap.h>
>
> #include <media/i2c/ds90ub9xx.h>
> +#include <media/v4l2-fwnode.h>
> +#include <media/v4l2-mediabus.h>
> #include <media/v4l2-subdev.h>
>
> #define UB913_PAD_SINK 0
> @@ -83,7 +85,7 @@ struct ub913_data {
>
> struct ds90ub9xx_platform_data *plat_data;
>
> - u32 pclk_polarity;
> + u32 pclk_polarity_rising;
bool ?
> };
>
> static inline struct ub913_data *sd_to_ub913(struct v4l2_subdev *sd)
> @@ -675,25 +677,31 @@ static int ub913_add_i2c_adapter(struct ub913_data *priv)
> static int ub913_parse_dt(struct ub913_data *priv)
> {
> struct device *dev = &priv->client->dev;
> + struct v4l2_fwnode_endpoint vep = {};
> struct fwnode_handle *ep_fwnode;
> int ret;
>
> ep_fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev),
> UB913_PAD_SINK, 0, 0);
> - if (!ep_fwnode) {
> - dev_err_probe(dev, -ENOENT, "No sink endpoint\n");
> - return -ENOENT;
> - }
> + if (!ep_fwnode)
> + return dev_err_probe(dev, -ENOENT, "No sink endpoint\n");
>
> - ret = fwnode_property_read_u32(ep_fwnode, "pclk-sample",
> - &priv->pclk_polarity);
> + vep.bus_type = V4L2_MBUS_PARALLEL;
I'd initialize this when declaring the variable.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> + ret = v4l2_fwnode_endpoint_parse(ep_fwnode, &vep);
>
> fwnode_handle_put(ep_fwnode);
>
> - if (ret) {
> - dev_err_probe(dev, ret, "failed to parse 'pclk-sample'\n");
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to parse sink endpoint data\n");
> +
> + if (vep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
> + priv->pclk_polarity_rising = true;
> + else if (vep.bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
> + priv->pclk_polarity_rising = false;
> + else
> + return dev_err_probe(dev, -EINVAL,
> + "bad value for 'pclk-sample'\n");
>
> return 0;
> }
> @@ -726,7 +734,7 @@ static int ub913_hw_init(struct ub913_data *priv)
>
> ub913_read(priv, UB913_REG_GENERAL_CFG, &v);
> v &= ~UB913_REG_GENERAL_CFG_PCLK_RISING;
> - v |= priv->pclk_polarity ? UB913_REG_GENERAL_CFG_PCLK_RISING : 0;
> + v |= priv->pclk_polarity_rising ? UB913_REG_GENERAL_CFG_PCLK_RISING : 0;
> ub913_write(priv, UB913_REG_GENERAL_CFG, v);
>
> return 0;
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-07-25 16:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 10:30 [PATCH v2 0/8] media: i2c: ds90ub9xx: Misc improvements Tomi Valkeinen
2023-07-20 10:30 ` [PATCH v2 1/8] media: i2c: ds90ub960: Configure CSI-2 continuous clock Tomi Valkeinen
2023-07-25 16:29 ` Laurent Pinchart
2023-07-20 10:30 ` [PATCH v2 2/8] media: i2c: ds90ub953: Use v4l2_fwnode_endpoint_parse() Tomi Valkeinen
2023-07-25 16:30 ` Laurent Pinchart
2023-07-20 10:30 ` [PATCH v2 3/8] media: i2c: ds90ub913: " Tomi Valkeinen
2023-07-25 16:34 ` Laurent Pinchart [this message]
2023-07-20 10:30 ` [PATCH v2 4/8] media: i2c: ds90ub953: Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK Tomi Valkeinen
2023-07-25 16:36 ` Laurent Pinchart
2023-07-20 10:30 ` [PATCH v2 5/8] media: i2c: ds90ub960: Allow FPD-Link async mode Tomi Valkeinen
2023-07-25 16:38 ` Laurent Pinchart
2023-07-20 10:30 ` [PATCH v2 6/8] media: i2c: ds90ub953: Restructure clkout management Tomi Valkeinen
2023-07-21 10:29 ` Andy Shevchenko
2023-07-21 13:23 ` Tomi Valkeinen
2023-07-21 13:44 ` Andy Shevchenko
2023-07-25 16:50 ` Laurent Pinchart
2023-07-20 10:30 ` [PATCH v2 7/8] media: i2c: ds90ub953: Support non-sync mode Tomi Valkeinen
2023-07-25 16:44 ` Laurent Pinchart
2023-07-20 10:30 ` [PATCH v2 8/8] media: i2c: ds90ub960: Rename RXPORT_MODE_CSI2_ASYNC to RXPORT_MODE_CSI2_NONSYNC Tomi Valkeinen
2023-07-25 16:45 ` Laurent Pinchart
2023-07-21 10:32 ` [PATCH v2 0/8] media: i2c: ds90ub9xx: Misc improvements Andy Shevchenko
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=20230725163410.GJ31069@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=andriy.shevchenko@intel.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=mazziesaccount@gmail.com \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=satish.nagireddy@getcruise.com \
--cc=tomi.valkeinen@ideasonboard.com \
/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