mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Himanshu Bhavani <himanshu.bhavani@siliconsignals.io>
Cc: robh@kernel.org, krzk+dt@kernel.org,
	"Elgin Perumbilly" <elgin.perumbilly@siliconsignals.io>,
	"Vladimir Zapolskiy" <vladimir.zapolskiy@linaro.org>,
	"Mehdi Djait" <mehdi.djait@linux.intel.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Hans Verkuil" <hverkuil@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"André Apitzsch" <git@apitzsch.eu>,
	"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
	"Dongcheng Yan" <dongcheng.yan@intel.com>,
	"Sylvain Petinot" <sylvain.petinot@foss.st.com>,
	"Heimir Thor Sverrisson" <heimir.sverrisson@gmail.com>,
	"Hardevsinh Palaniya" <hardevsinh.palaniya@siliconsignals.io>,
	"Svyatoslav Ryhel" <clamor95@gmail.com>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND v9 2/2] media: i2c: add os05b10 image sensor driver
Date: Thu, 8 Jan 2026 00:07:03 +0200	[thread overview]
Message-ID: <aV7ZB40s7L2PdW21@kekkonen.localdomain> (raw)
In-Reply-To: <20260105093420.110973-3-himanshu.bhavani@siliconsignals.io>

Hi Himanshu,

Thanks for the update.

A few comments below... please post a patch on top.

On Mon, Jan 05, 2026 at 03:04:14PM +0530, Himanshu Bhavani wrote:

...

> +static int os05b10_disable_streams(struct v4l2_subdev *sd,
> +				   struct v4l2_subdev_state *state,
> +				   u32 pad, u64 streams_mask)
> +{
> +	struct os05b10 *os05b10 = to_os05b10(sd);
> +	int ret;
> +
> +	ret = cci_write(os05b10->cci, OS05B10_REG_CTRL_MODE,
> +			OS05B10_MODE_STANDBY, NULL);
> +	if (ret)
> +		dev_err(os05b10->dev, "failed to set stream off\n");
> +
> +	pm_runtime_put(os05b10->dev);
> +
> +	return ret;

I'd return 0 here: there's nothing the caller can really do about this.


...

> +static u64 os05b10_pixel_rate(struct os05b10 *os05b10,
> +			      const struct os05b10_mode *mode)
> +{
> +	u64 link_freq = link_frequencies[os05b10->link_freq_index];
> +	const unsigned int lanes = os05b10->data_lanes;
> +	u64 numerator = link_freq * 2 * lanes;
> +	unsigned int bpp = mode->bpp;
> +
> +	do_div(numerator, bpp);
> +
> +	dev_info(os05b10->dev,
> +		 "link_freq=%llu bpp=%u lanes=%u pixel_rate=%llu\n",
> +		 link_freq, bpp, lanes, numerator);

Use dev_dbg() if you print this at all. I wouldn't: it looks like a
development time leftover.

You can also make this more simple by using div_u64(). Also, there's no
really point for have a local variable for everything.

...

> +static int os05b10_probe(struct i2c_client *client)
> +{
> +	struct os05b10 *os05b10;
> +	unsigned int xclk_freq;
> +	unsigned int i;
> +	int ret;
> +
> +	os05b10 = devm_kzalloc(&client->dev, sizeof(*os05b10), GFP_KERNEL);
> +	if (!os05b10)
> +		return -ENOMEM;
> +
> +	os05b10->client = client;
> +	os05b10->dev = &client->dev;
> +
> +	v4l2_i2c_subdev_init(&os05b10->sd, client, &os05b10_subdev_ops);
> +
> +	os05b10->cci = devm_cci_regmap_init_i2c(client, 16);
> +	if (IS_ERR(os05b10->cci))
> +		return dev_err_probe(os05b10->dev, PTR_ERR(os05b10->cci),
> +				     "failed to initialize CCI\n");
> +
> +	os05b10->xclk = devm_v4l2_sensor_clk_get(os05b10->dev, NULL);
> +	if (IS_ERR(os05b10->xclk))
> +		return dev_err_probe(os05b10->dev, PTR_ERR(os05b10->xclk),
> +				     "failed to get xclk\n");
> +
> +	xclk_freq = clk_get_rate(os05b10->xclk);
> +	if (xclk_freq != OS05B10_XCLK_FREQ)
> +		return dev_err_probe(os05b10->dev, -EINVAL,
> +				     "xclk frequency not supported: %d Hz\n",
> +				     xclk_freq);
> +
> +	for (i = 0; i < ARRAY_SIZE(os05b10_supply_name); i++)

You could declare i here -- as unsigned int.

> +		os05b10->supplies[i].supply = os05b10_supply_name[i];
> +

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2026-01-07 22:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  9:34 [PATCH RESEND v9 0/2] media: i2c: Add os05b10 camera " Himanshu Bhavani
2026-01-05  9:34 ` [PATCH RESEND v9 1/2] dt-bindings: media: i2c: Add os05b10 sensor Himanshu Bhavani
2026-01-05  9:34 ` [PATCH RESEND v9 2/2] media: i2c: add os05b10 image sensor driver Himanshu Bhavani
2026-01-07 22:07   ` Sakari Ailus [this message]
2026-01-08  5:30     ` Himanshu Bhavani
2026-01-08  5:54   ` [PATCH] media: i2c: os05b10: Few minor improvements Himanshu Bhavani
2026-01-16 12:27     ` Sakari Ailus
2026-01-19  5:34       ` Himanshu Bhavani

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=aV7ZB40s7L2PdW21@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dongcheng.yan@intel.com \
    --cc=elgin.perumbilly@siliconsignals.io \
    --cc=git@apitzsch.eu \
    --cc=hansg@kernel.org \
    --cc=hardevsinh.palaniya@siliconsignals.io \
    --cc=heimir.sverrisson@gmail.com \
    --cc=himanshu.bhavani@siliconsignals.io \
    --cc=hverkuil@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=mehdi.djait@linux.intel.com \
    --cc=robh@kernel.org \
    --cc=sylvain.petinot@foss.st.com \
    --cc=vladimir.zapolskiy@linaro.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

all inboxes | Powered by JetHome®