From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: johannes.goede@oss.qualcomm.com,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] media: i2c: mt9m114: add support for Aptina MI1040
Date: Wed, 4 Mar 2026 15:10:33 +0200 [thread overview]
Message-ID: <aagvSf4TE3c9PdKt@kekkonen.localdomain> (raw)
In-Reply-To: <CAPVz0n0moFZkubOwDnXGpMLg8S4LW9KEFgnFMH5PmrEzExH6bg@mail.gmail.com>
Hi Svyatoslav,
On Wed, Mar 04, 2026 at 10:40:04AM +0200, Svyatoslav Ryhel wrote:
> ср, 4 бер. 2026 р. о 10:32 Sakari Ailus <sakari.ailus@linux.intel.com> пише:
> >
> > Hi Svyatoslav, Hans,
> >
> > On Thu, Feb 12, 2026 at 06:44:06PM +0200, Svyatoslav Ryhel wrote:
> > > чт, 12 лют. 2026 р. о 17:53 <johannes.goede@oss.qualcomm.com> пише:
> > > >
> > > > Hi,
> > > >
> > > > On 12-Feb-26 13:23, Svyatoslav Ryhel wrote:
> > > > > Slightly different version of MT9M114 camera module is used in a several
> > > > > devices like ASUS Nexus 7 (2012) or ASUS Transformer Prime TF201 and is
> > > > > called Aptina MI1040. The only difference found so far is lacking ability
> > > > > to poll STATE register during power on sequence, which causes driver to
> > > > > fail with time out error. Add state_polling flag to diverge models and
> > > > > address quirk found in MI1040.
> > > > >
> > > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > > > ---
> > > > > drivers/media/i2c/mt9m114.c | 29 ++++++++++++++++++++++++-----
> > > > > 1 file changed, 24 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
> > > > > index d5b142fe68a9..a4b021702a1f 100644
> > > > > --- a/drivers/media/i2c/mt9m114.c
> > > > > +++ b/drivers/media/i2c/mt9m114.c
> > > > > @@ -373,6 +373,10 @@ enum {
> > > > > * Data Structures
> > > > > */
> > > > >
> > > > > +struct mt9m114_model_info {
> > > > > + bool state_polling;
> > > > > +};
> > > > > +
> > > > > enum mt9m114_format_flag {
> > > > > MT9M114_FMT_FLAG_PARALLEL = BIT(0),
> > > > > MT9M114_FMT_FLAG_CSI2 = BIT(1),
> > > > > @@ -422,6 +426,8 @@ struct mt9m114 {
> > > > >
> > > > > struct v4l2_ctrl *tpg[4];
> > > > > } ifp;
> > > > > +
> > > > > + const struct mt9m114_model_info *info;
> > > > > };
> > > > >
> > > > > /* -----------------------------------------------------------------------------
> > > > > @@ -2279,9 +2285,11 @@ static int mt9m114_power_on(struct mt9m114 *sensor)
> > > > > * reaches the standby mode (either initiated manually above in
> > > > > * parallel mode, or automatically after reset in MIPI mode).
> > > > > */
> > > > > - ret = mt9m114_poll_state(sensor, MT9M114_SYS_STATE_STANDBY);
> > > > > - if (ret < 0)
> > > > > - goto error_clock;
> > > > > + if (sensor->info->state_polling) {
> > > > > + ret = mt9m114_poll_state(sensor, MT9M114_SYS_STATE_STANDBY);
> > > > > + if (ret < 0)
> > > > > + goto error_clock;
> > > > > + }
> > > >
> > > > So I would expect a flag called state_polling to be checked
> > > > in mt9m114_poll_state(). It looks like you are only disabling
> > > > one specific case of state polling, not all of them.
> >
> > There's a single user for mt9m114_poll_state()... I think the current name
> > is fine.
> >
>
> I will name the flag `state_standby_polling` if everyone is fine with
> it since the case below requires resending anyway.
>
> > > >
> > > > Please rename the flag to reflect this.
> > > >
> > >
> > > And which name you see fitting? There is only one instance of using
> > > mt9m114_poll_state in this driver, I see no controversy in naming.
> > >
> > > > >
> > > > > return 0;
> > > > >
> > > > > @@ -2527,6 +2535,8 @@ static int mt9m114_probe(struct i2c_client *client)
> > > > > if (ret < 0)
> > > > > return ret;
> > > > >
> > > > > + sensor->info = device_get_match_data(dev);
> > > > > +
> > > >
> > > > This can return NULL when the driver is manually bound through
> > > > sysfs, which will result in a crash later on when checked in
> > > > mt9m114_power_on()
> >
> > Svyatoslav, can you add a check for this?
> >
> > I guess a few other drivers also suffer from this...
> >
>
> Yes, sure. Should I set it to return neg error or fallback to default entry?
In fact probe() won't run that far as it'll return an error on the missing
endpoint.
You could return an error here, it doesn't really matter.
--
Kind regards,
Sakari Ailus
prev parent reply other threads:[~2026-03-04 13:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 12:23 [PATCH v2 0/2] " Svyatoslav Ryhel
2026-02-12 12:23 ` [PATCH v2 1/2] dt-bindings: media: mt9m114: document MI1040 sensor Svyatoslav Ryhel
2026-02-12 12:23 ` [PATCH v2 2/2] media: i2c: mt9m114: add support for Aptina MI1040 Svyatoslav Ryhel
2026-02-12 15:53 ` johannes.goede
2026-02-12 16:44 ` Svyatoslav Ryhel
2026-03-04 8:33 ` Sakari Ailus
2026-03-04 8:40 ` Svyatoslav Ryhel
2026-03-04 13:10 ` Sakari Ailus [this message]
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=aagvSf4TE3c9PdKt@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=clamor95@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=johannes.goede@oss.qualcomm.com \
--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=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
all inboxes | Powered by JetHome®