From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
Rui Miguel Silva <rmfrfs@gmail.com>,
Steve Longerbeam <slongerbeam@gmail.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH 1/2] staging: media: imx: imx7-mipi-csic: Resume on debug
Date: Wed, 26 Jan 2022 02:28:34 +0200 [thread overview]
Message-ID: <YfCVslLYx115/Tv1@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220125102257.7kziixej2c5k7fss@uno.localdomain>
Hi Jacopo,
On Tue, Jan 25, 2022 at 11:22:57AM +0100, Jacopo Mondi wrote:
> On Tue, Jan 25, 2022 at 05:18:26AM +0200, Laurent Pinchart wrote:
> > On Wed, Jan 19, 2022 at 04:24:51PM +0200, Laurent Pinchart wrote:
> > > On Wed, Jan 19, 2022 at 12:20:23PM +0100, Jacopo Mondi wrote:
> > > > The mipi_csis_dump_regs() function reads and printout the interface
> > > > registers for debugging purposes.
> > > >
> > > > Trying to access the registers without proper powering up the interface
> > > > causes the chip to hang.
> > > >
> > > > Fix that by increasing the pm runtime usage count which, if necessary,
> > > > resumes the interface.
> > > >
> > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > > > ---
> > > > drivers/staging/media/imx/imx7-mipi-csis.c | 4 ++++
> > > > 1 file changed, 4 insertions(+)
> > > >
> > > > diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
> > > > index 2b73fa55c938..cb54bb7491d9 100644
> > > > --- a/drivers/staging/media/imx/imx7-mipi-csis.c
> > > > +++ b/drivers/staging/media/imx/imx7-mipi-csis.c
> > > > @@ -780,11 +780,15 @@ static int mipi_csis_dump_regs(struct csi_state *state)
> > > >
> > > > dev_info(state->dev, "--- REGISTERS ---\n");
> > > >
> > > > + pm_runtime_resume_and_get(state->dev);
> > >
> > > Should this have an error check ? With that,
> > >
> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > I just noticed that the call to mipi_csis_dump_regs() in
> > mipi_csis_log_status() is conditioned by state->state & ST_POWERED. An
> > alternative would thus be to add the same condition to
> > mipi_csis_dump_regs_show() (or to move it to mipi_csis_dump_regs()), as
> > dumping the register when then hardware is turned off is quite
> > pointeless. Up to you.
>
> Tbh, I would drop this custom sysfs attribute completely.
> It should serve the purpose to easily dump the reg value, but it is
> either accessed at the right time (ie during the streaming session)
> otherwise all you get is POR default values (or a hang, without this
> patch)
The debugfs interface has served me before to diagnose problems, as it
allows checking how the register values change during streaming, in
particular the DPHY status. I'd like to keep it if possible.
> > > > +
> > > > for (i = 0; i < ARRAY_SIZE(registers); i++) {
> > > > cfg = mipi_csis_read(state, registers[i].offset);
> > > > dev_info(state->dev, "%14s: 0x%08x\n", registers[i].name, cfg);
> > > > }
> > > >
> > > > + pm_runtime_put(state->dev);
> > > > +
> > > > return 0;
> > > > }
> > > >
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2022-01-26 0:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 11:20 [PATCH 0/2] staging: media: imx7-mipi-csis: Two small fixes Jacopo Mondi
2022-01-19 11:20 ` [PATCH 1/2] staging: media: imx: imx7-mipi-csic: Resume on debug Jacopo Mondi
2022-01-19 14:24 ` Laurent Pinchart
2022-01-25 3:18 ` Laurent Pinchart
2022-01-25 10:22 ` Jacopo Mondi
2022-01-26 0:28 ` Laurent Pinchart [this message]
2022-01-19 11:20 ` [PATCH 2/2] staging: media: imx: imx7-mipi-csic: Set PIXEL_MODE for YUV422 Jacopo Mondi
2022-01-19 14:26 ` Laurent Pinchart
2022-01-19 16:21 ` [PATCH 0/2] staging: media: imx7-mipi-csis: Two small fixes Rui Miguel Silva
2022-01-21 8:29 ` Jacopo Mondi
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=YfCVslLYx115/Tv1@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=jacopo@jmondi.org \
--cc=jbrunet@baylibre.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=rmfrfs@gmail.com \
--cc=slongerbeam@gmail.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