From: Kieran Bingham <kieran.bingham@ideasonboard.com>
To: Svyatoslav Ryhel <clamor95@gmail.com>,
Tarang Raval <tarang.raval@siliconsignals.io>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Hans Verkuil" <hverkuil@xs4all.nl>,
"Hans de Goede" <hansg@kernel.org>,
"André Apitzsch" <git@apitzsch.eu>,
"Sylvain Petinot" <sylvain.petinot@foss.st.com>,
"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
"Dongcheng Yan" <dongcheng.yan@intel.com>,
"Heimir Thor Sverrisson" <heimir.sverrisson@gmail.com>,
linux-media@vger.kernel.org
Subject: Re: [PATCH v3 2/2] media: i2c: add Sony IMX111 CMOS camera sensor driver
Date: Thu, 30 Oct 2025 15:57:44 +0000 [thread overview]
Message-ID: <176183986424.3742839.1867363151241824725@ping.linuxembedded.co.uk> (raw)
In-Reply-To: <CAPVz0n0Vqi0xg8c=PS3vyFr9YzRC0PtFXyxw9G5yHohS4FKVbQ@mail.gmail.com>
Quoting Svyatoslav Ryhel (2025-10-30 15:13:31)
...
> >
> > > +static int imx111_initialize(struct imx111 *sensor)
> > > +{
> > > + struct device *dev = regmap_get_device(sensor->regmap);
> > > + int ret;
> >
> > ret = 0;
> >
>
> cci_write does not state that ret must be initiated.
>
> > > +
> > > + /* Configure the PLL. */
> > > + cci_write(sensor->regmap, IMX111_PRE_PLL_CLK_DIVIDER_PLL1,
> > > + sensor->pll->pre_div, &ret);
You definitely need to initialise ret = 0 or this line above will
probably fail because cci_write uses 'ret' to decide to do anything or
not.
- https://docs.kernel.org/driver-api/media/v4l2-cci.html
===============================================================================
int cci_write(struct regmap *map, u32 reg, u64 val, int *err)
Write a value to a single CCI register
Parameters
struct regmap *map
Register map to write to
u32 reg
Register address to write, use CCI_REG#() macros to encode reg width
u64 val
Value to be written
int *err
Optional pointer to store errors, if a previous error is set then
the write will be skipped
Return
0 on success or a negative error code on failure.
===============================================================================
So it should be initialised in a good state *or* you use NULL on
this first call and assign it - but init to ret = 0 is cleaner here I
think.
> > > + cci_write(sensor->regmap, IMX111_PLL_MULTIPLIER_PLL1, sensor->pll->mult, &ret);
> > > + cci_write(sensor->regmap, IMX111_POST_DIVIDER, IMX111_POST_DIVIDER_DIV1, &ret);
> > > + cci_write(sensor->regmap, IMX111_PLL_SETTLING_TIME,
> > > + to_settle_delay(sensor->pll->extclk_rate), &ret);
> > > +
> > > + ret = cci_multi_reg_write(sensor->regmap, imx111_global_init,
> > > + ARRAY_SIZE(imx111_global_init), NULL);
> >
> > You are overwriting the previous errors.
> >
> > please use ret |=
No - just continue with the same pattern:
cci_multi_reg_write(sensor->regmap, imx111_global_init,
ARRAY_SIZE(imx111_global_init), &ret);
> >
> > > + if (ret < 0) {
> > > + dev_err(dev, "Failed to initialize the sensor\n");
> > > + return ret;
> > > + }
> > > +
> > > + return 0;
> > > +}
next prev parent reply other threads:[~2025-10-30 15:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 11:57 [PATCH v3 0/2] media: i2c: add Sony IMX111 CMOS camera sensor driver Svyatoslav Ryhel
2025-10-30 11:57 ` [PATCH v3 1/2] dt-bindings: media: i2c: document Sony IMX111 CMOS sensor Svyatoslav Ryhel
2025-10-30 19:23 ` Conor Dooley
2025-10-30 11:57 ` [PATCH v3 2/2] media: i2c: add Sony IMX111 CMOS camera sensor driver Svyatoslav Ryhel
2025-10-30 14:55 ` Tarang Raval
2025-10-30 15:03 ` Svyatoslav Ryhel
2025-10-30 15:13 ` Svyatoslav Ryhel
2025-10-30 15:50 ` Jacopo Mondi
2025-10-30 16:11 ` Svyatoslav Ryhel
2025-10-30 16:37 ` Jacopo Mondi
2025-10-31 10:36 ` Tarang Raval
2025-10-30 15:57 ` Kieran Bingham [this message]
2025-11-03 19:24 ` Sakari Ailus
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=176183986424.3742839.1867363151241824725@ping.linuxembedded.co.uk \
--to=kieran.bingham@ideasonboard.com \
--cc=benjamin.mugnier@foss.st.com \
--cc=clamor95@gmail.com \
--cc=conor+dt@kernel.org \
--cc=dongcheng.yan@intel.com \
--cc=git@apitzsch.eu \
--cc=hansg@kernel.org \
--cc=heimir.sverrisson@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=krzk+dt@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=sylvain.petinot@foss.st.com \
--cc=tarang.raval@siliconsignals.io \
/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