From: Krzysztof Kozlowski <krzk@kernel.org>
To: Alex Tran <alex.t.tran@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Pavel Machek <pavel@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] media: i2c: et8ek8: et8ek8_driver: add support for crc configuration via device tree
Date: Wed, 17 Dec 2025 09:28:12 +0100 [thread overview]
Message-ID: <20251217-radiant-opal-spoonbill-1f7378@quoll> (raw)
In-Reply-To: <fca7331649892206b92f1c63aedac6050a2d8d4a.1765782992.git.alex.t.tran@gmail.com>
On Sun, Dec 14, 2025 at 11:58:32PM -0800, Alex Tran wrote:
> Retrieve the configuration for CRC from the device tree instead
> using the hard coded USE_CRC macro. If there is an issue
> retrieving the endpoint node or the CRC property then the default
> of 1 is used and the driver does not fail to maintain backward
> compatibility.
>
> Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
> ---
> drivers/media/i2c/et8ek8/et8ek8_driver.c | 49 +++++++++++++++++++-----
> 1 file changed, 39 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/media/i2c/et8ek8/et8ek8_driver.c b/drivers/media/i2c/et8ek8/et8ek8_driver.c
> index 2cb7b7187..4ef92359c 100644
> --- a/drivers/media/i2c/et8ek8/et8ek8_driver.c
> +++ b/drivers/media/i2c/et8ek8/et8ek8_driver.c
> @@ -29,6 +29,7 @@
> #include <media/media-entity.h>
> #include <media/v4l2-ctrls.h>
> #include <media/v4l2-device.h>
> +#include <media/v4l2-fwnode.h>
> #include <media/v4l2-subdev.h>
>
> #include "et8ek8_reg.h"
> @@ -45,6 +46,7 @@ struct et8ek8_sensor {
> struct regulator *vana;
> struct clk *ext_clk;
> u32 xclk_freq;
> + u32 use_crc;
>
> u16 version;
>
> @@ -130,8 +132,6 @@ static struct et8ek8_gain {
>
> #define ET8EK8_I2C_DELAY 3 /* msec delay b/w accesses */
>
> -#define USE_CRC 1
> -
> /*
> * Register access helpers
> *
> @@ -844,20 +844,16 @@ static int et8ek8_power_on(struct et8ek8_sensor *sensor)
> if (rval)
> goto out;
>
> -#ifdef USE_CRC
> rval = et8ek8_i2c_read_reg(client, ET8EK8_REG_8BIT, 0x1263, &val);
> if (rval)
> goto out;
> -#if USE_CRC /* TODO get crc setting from DT */
> - val |= BIT(4);
> -#else
> - val &= ~BIT(4);
> -#endif
> + if (sensor->use_crc)
> + val |= BIT(4);
> + else
> + val &= ~BIT(4);
> rval = et8ek8_i2c_write_reg(client, ET8EK8_REG_8BIT, 0x1263, val);
> if (rval)
> goto out;
> -#endif
> -
> out:
> if (rval)
> et8ek8_power_off(sensor);
> @@ -1396,6 +1392,34 @@ static int __maybe_unused et8ek8_resume(struct device *dev)
> return __et8ek8_set_power(sensor, true);
> }
>
> +static int et8ek8_parse_fwnode(struct device *dev, struct et8ek8_sensor *sensor)
> +{
> + struct v4l2_fwnode_endpoint bus_cfg = {
> + .bus_type = V4L2_MBUS_CCP2,
> + };
> + struct fwnode_handle *ep;
> + int ret;
> +
> + ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0, 0,
> + FWNODE_GRAPH_ENDPOINT_NEXT);
> + if (!ep) {
> + dev_warn(dev, "could not get endpoint node\n");
> + return -EINVAL;
> + }
> +
> + ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
> + if (ret) {
> + dev_warn(dev, "parsing endpoint node failed\n");
> + goto done;
> + }
> +
> + fwnode_property_read_u32(ep, "crc", &sensor->use_crc);
Undocumented ABI. In case you document it in other cases, it is really
unclear, so be sure you read submitting patches in DT.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-12-17 8:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 7:58 [PATCH v2 0/4] media: omap3isp/et8ek8: Add CCP2 CRC configuration support Alex Tran
2025-12-15 7:58 ` [PATCH v2 1/4] media: i2c: et8ek8: et8ek8_driver: add support for crc configuration via device tree Alex Tran
2025-12-17 8:28 ` Krzysztof Kozlowski [this message]
2025-12-15 7:58 ` [PATCH v2 2/4] dt-bindings: media: i2c: et8ek8: document missing crc as optional property Alex Tran
2025-12-17 8:27 ` Krzysztof Kozlowski
2025-12-18 23:50 ` Alex Tran
2025-12-15 7:58 ` [PATCH v2 3/4] media: platform: ti: omap3isp: isp: read crc configuration from device tree for CCP2 Alex Tran
2025-12-15 7:58 ` [PATCH v2 4/4] dt-bindings: media: omap3isp: document missing crc as optional property Alex Tran
2025-12-17 8:28 ` Krzysztof Kozlowski
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=20251217-radiant-opal-spoonbill-1f7378@quoll \
--to=krzk@kernel.org \
--cc=alex.t.tran@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pavel@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.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