linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <kholk11@gmail.com>
To: Robert Foss <robert.foss@linaro.org>
Cc: Todor Tomov <todor.too@gmail.com>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	marijns95@gmail.com, konradybcio@gmail.com,
	martin.botka1@gmail.com, MSM <linux-arm-msm@vger.kernel.org>,
	linux-media <linux-media@vger.kernel.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] media: camss: ispif: Correctly reset based on the VFE ID
Date: Thu, 22 Oct 2020 19:08:57 +0200	[thread overview]
Message-ID: <CAK7fi1ZUE+C+Q7V-j=xR1V2OvUwmk=ZRcBwNLBDrjUr+rOW0Cw@mail.gmail.com> (raw)
In-Reply-To: <CAG3jFysUQJXdy0ogK1shbgW1Tmk6DJbS26EaeRPMDEnObQ2_zg@mail.gmail.com>

Il giorno mar 20 ott 2020 alle ore 11:03 Robert Foss
<robert.foss@linaro.org> ha scritto:
>
> I found a build issue in this commit.
>
>
> On Tue, 20 Oct 2020 at 10:59, Robert Foss <robert.foss@linaro.org> wrote:
> >
> > Nice catch! This patch looks good to me.
> >
Thank you! :)))

> > Signed-off-by: Robert Foss <robert.foss@linaro.org>
> >
> > On Sun, 18 Oct 2020 at 14:54, <kholk11@gmail.com> wrote:
> > >
> > > From: AngeloGioacchino Del Regno <kholk11@gmail.com>
> > >
> > > Resetting the ISPIF VFE0 context is wrong if we are using the VFE1
> > > for dual-camera or simply because a secondary camera is connected
> > > to it: in this case the reset will always happen on the VFE0 ctx
> > > of the ISPIF, which is .. useless.
> > >
> > > Fix this usecase by adding the ISPIF_RST_CMD_1 address and choose
> > > where to do the (or what to) reset based on the VFE line id.
> > >
> > > Signed-off-by: AngeloGioacchino Del Regno <kholk11@gmail.com>
> > > ---
> > >  .../media/platform/qcom/camss/camss-ispif.c   | 87 ++++++++++++-------
> > >  .../media/platform/qcom/camss/camss-ispif.h   |  2 +-
> > >  2 files changed, 57 insertions(+), 32 deletions(-)
> > >
> > > diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c
> > > index db94cfd6c508..252db6b33dab 100644
> > > --- a/drivers/media/platform/qcom/camss/camss-ispif.c
> > > +++ b/drivers/media/platform/qcom/camss/camss-ispif.c
> > > @@ -26,6 +26,7 @@
> > >  #define MSM_ISPIF_NAME "msm_ispif"
> > >
> > >  #define ISPIF_RST_CMD_0                        0x008
> > > +#define ISPIF_RST_CMD_1                        0x00c
> > >  #define ISPIF_RST_CMD_0_STROBED_RST_EN         (1 << 0)
> > >  #define ISPIF_RST_CMD_0_MISC_LOGIC_RST         (1 << 1)
> > >  #define ISPIF_RST_CMD_0_SW_REG_RST             (1 << 2)
> > > @@ -179,7 +180,10 @@ static irqreturn_t ispif_isr_8x96(int irq, void *dev)
> > >         writel(0x1, ispif->base + ISPIF_IRQ_GLOBAL_CLEAR_CMD);
> > >
> > >         if ((value0 >> 27) & 0x1)
> > > -               complete(&ispif->reset_complete);
> > > +               complete(&ispif->reset_complete[0]);
> > > +
> > > +       if ((value3 >> 27) & 0x1)
> > > +               complete(&ispif->reset_complete[1]);
> > >
> > >         if (unlikely(value0 & ISPIF_VFE_m_IRQ_STATUS_0_PIX0_OVERFLOW))
> > >                 dev_err_ratelimited(to_device(ispif), "VFE0 pix0 overflow\n");
> > > @@ -237,7 +241,7 @@ static irqreturn_t ispif_isr_8x16(int irq, void *dev)
> > >         writel(0x1, ispif->base + ISPIF_IRQ_GLOBAL_CLEAR_CMD);
> > >
> > >         if ((value0 >> 27) & 0x1)
> > > -               complete(&ispif->reset_complete);
> > > +               complete(&ispif->reset_complete[0]);
> > >
> > >         if (unlikely(value0 & ISPIF_VFE_m_IRQ_STATUS_0_PIX0_OVERFLOW))
> > >                 dev_err_ratelimited(to_device(ispif), "VFE0 pix0 overflow\n");
> > > @@ -257,33 +261,17 @@ static irqreturn_t ispif_isr_8x16(int irq, void *dev)
> > >         return IRQ_HANDLED;
> > >  }
> > >
> > > -/*
> > > - * ispif_reset - Trigger reset on ISPIF module and wait to complete
> > > - * @ispif: ISPIF device
> > > - *
> > > - * Return 0 on success or a negative error code otherwise
> > > - */
> > > -static int ispif_reset(struct ispif_device *ispif)
> > > +static int ispif_vfe_reset(struct ispif_device *ispif, u8 vfe_id)
> > >  {
> > > -       unsigned long time;
> > >         u32 val;
> > > -       int ret;
> > > -
> > > -       ret = camss_pm_domain_on(to_camss(ispif), PM_DOMAIN_VFE0);
> > > -       if (ret < 0)
> > > -               return ret;
> > >
> > > -       ret = camss_pm_domain_on(to_camss(ispif), PM_DOMAIN_VFE1);
> > > -       if (ret < 0)
> > > -               return ret;
> > > -
> > > -       ret = camss_enable_clocks(ispif->nclocks_for_reset,
> > > -                                 ispif->clock_for_reset,
> > > -                                 to_device(ispif));
> > > -       if (ret < 0)
> > > -               return ret;
> > > +       if (vfe_id > (to_camss(ispif)->vfe_num - 1)) {
> > > +               dev_err(to_device(ispif),
> > > +                       "Error: asked reset for invalid VFE%d\n", vfe_id);
> > > +               return -ENOENT;
> > > +       }
> > >
> > > -       reinit_completion(&ispif->reset_complete);
> > > +       reinit_completion(&ispif->reset_complete[vfe_id]);
> > >
> > >         val = ISPIF_RST_CMD_0_STROBED_RST_EN |
> > >                 ISPIF_RST_CMD_0_MISC_LOGIC_RST |
> > > @@ -303,15 +291,51 @@ static int ispif_reset(struct ispif_device *ispif)
> > >                 ISPIF_RST_CMD_0_RDI_OUTPUT_1_MISR_RST |
> > >                 ISPIF_RST_CMD_0_RDI_OUTPUT_2_MISR_RST;
> > >
> > > -       writel_relaxed(val, ispif->base + ISPIF_RST_CMD_0);
> > > +       if (vfe_id == 1)
> > > +               writel_relaxed(val, ispif->base + ISPIF_RST_CMD_1);
> > > +       else
> > > +               writel_relaxed(val, ispif->base + ISPIF_RST_CMD_0);
> > >
> > > -       time = wait_for_completion_timeout(&ispif->reset_complete,
> > > +       time = wait_for_completion_timeout(&ispif->reset_complete[vfe_id],
>
> 'time' is not a variable that exists in this scope, so the build fails.
>
Sorry about that, it looks like I've messed up a fix for that and it
went into another
unrelated commit instead of this one.
In V2 it's definitely going to be moved here.

> > >                 msecs_to_jiffies(ISPIF_RESET_TIMEOUT_MS));
> > >         if (!time) {
> > > -               dev_err(to_device(ispif), "ISPIF reset timeout\n");
> > > -               ret = -EIO;
> > > +               dev_err(to_device(ispif),
> > > +                       "ISPIF for VFE%d reset timeout\n", vfe_id);
> > > +               return -EIO;
> > >         }
> > >
> > > +       return 0;
> > > +}
> > > +
> > > +/*
> > > + * ispif_reset - Trigger reset on ISPIF module and wait to complete
> > > + * @ispif: ISPIF device
> > > + *
> > > + * Return 0 on success or a negative error code otherwise
> > > + */
> > > +static int ispif_reset(struct ispif_device *ispif, u8 vfe_id)
> > > +{
> > > +       unsigned long time;
> > > +       int ret;
> > > +
> > > +       ret = camss_pm_domain_on(to_camss(ispif), PM_DOMAIN_VFE0);
> > > +       if (ret < 0)
> > > +               return ret;
> > > +
> > > +       ret = camss_pm_domain_on(to_camss(ispif), PM_DOMAIN_VFE1);
> > > +       if (ret < 0)
> > > +               return ret;
> > > +
> > > +       ret = camss_enable_clocks(ispif->nclocks_for_reset,
> > > +                                 ispif->clock_for_reset,
> > > +                                 to_device(ispif));
> > > +       if (ret < 0)
> > > +               return ret;
> > > +
> > > +       ret = ispif_vfe_reset(ispif, vfe_id);
> > > +       if (ret)
> > > +               dev_dbg(to_device(ispif), "ISPIF Reset failed\n");
> > > +
> > >         camss_disable_clocks(ispif->nclocks_for_reset, ispif->clock_for_reset);
> > >
> > >         camss_pm_domain_off(to_camss(ispif), PM_DOMAIN_VFE0);
> > > @@ -355,7 +379,7 @@ static int ispif_set_power(struct v4l2_subdev *sd, int on)
> > >                         goto exit;
> > >                 }
> > >
> > > -               ret = ispif_reset(ispif);
> > > +               ret = ispif_reset(ispif, line->vfe_id);
> > >                 if (ret < 0) {
> > >                         pm_runtime_put_sync(dev);
> > >                         camss_disable_clocks(ispif->nclocks, ispif->clock);
> > > @@ -1192,7 +1216,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
> > >
> > >         mutex_init(&ispif->config_lock);
> > >
> > > -       init_completion(&ispif->reset_complete);
> > > +       for (i = 0; i < MSM_ISPIF_VFE_NUM; i++)
> > > +               init_completion(&ispif->reset_complete[i]);
> > >
> > >         return 0;
> > >  }
> > > diff --git a/drivers/media/platform/qcom/camss/camss-ispif.h b/drivers/media/platform/qcom/camss/camss-ispif.h
> > > index 1a5ba2425a42..4132174f7ea1 100644
> > > --- a/drivers/media/platform/qcom/camss/camss-ispif.h
> > > +++ b/drivers/media/platform/qcom/camss/camss-ispif.h
> > > @@ -56,7 +56,7 @@ struct ispif_device {
> > >         int nclocks;
> > >         struct camss_clock  *clock_for_reset;
> > >         int nclocks_for_reset;
> > > -       struct completion reset_complete;
> > > +       struct completion reset_complete[MSM_ISPIF_VFE_NUM];
> > >         int power_count;
> > >         struct mutex power_lock;
> > >         struct ispif_intf_cmd_reg intf_cmd[MSM_ISPIF_VFE_NUM];
> > > --
> > > 2.28.0
> > >

Regards,
Angelo

  reply	other threads:[~2020-10-22 17:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18 12:52 [PATCH 0/6] Add support for SDM630/660 Camera Subsystem kholk11
2020-10-18 12:52 ` [PATCH 1/6] media: camss: csiphy-3ph: Add support for SDM630/660 kholk11
2020-10-20  8:52   ` Robert Foss
2020-10-18 12:52 ` [PATCH 2/6] media: camss: ispif: Correctly reset based on the VFE ID kholk11
2020-10-20  8:59   ` Robert Foss
2020-10-20  9:02     ` Robert Foss
2020-10-22 17:08       ` AngeloGioacchino Del Regno [this message]
2020-10-18 12:52 ` [PATCH 3/6] media: camss: vfe: Add support for VFE 4.8 kholk11
2020-10-20  9:14   ` Robert Foss
2020-10-18 12:52 ` [PATCH 4/6] media: camss: Add support for SDM630/636/660 camera subsystem kholk11
2020-10-20 10:26   ` Robert Foss
2020-10-18 12:52 ` [PATCH 5/6] media: dt-bindings: media: qcom,camss: Add bindings for SDM660 camss kholk11
2020-10-20 10:34   ` Robert Foss
2020-10-18 12:52 ` [PATCH 6/6] media: camss: csiphy: Set rate on csiX_phy clock on SDM630/660 kholk11
2020-10-20 10:35   ` Robert Foss
2020-10-20 12:01 ` [PATCH 0/6] Add support for SDM630/660 Camera Subsystem Robert Foss

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='CAK7fi1ZUE+C+Q7V-j=xR1V2OvUwmk=ZRcBwNLBDrjUr+rOW0Cw@mail.gmail.com' \
    --to=kholk11@gmail.com \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=marijns95@gmail.com \
    --cc=martin.botka1@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=robert.foss@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=todor.too@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;
as well as URLs for NNTP newsgroup(s).