Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4345682pxu; Tue, 20 Oct 2020 14:51:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbgeaTqhip4LAdwqHAiII2Wo6BF44Y7rYZu5rcRshzjnNshIfkgFFpxjkfD+tfALuZ5n1D X-Received: by 2002:a17:906:53d6:: with SMTP id p22mr199480ejo.517.1603230663539; Tue, 20 Oct 2020 14:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603230663; cv=none; d=google.com; s=arc-20160816; b=KXxt3e6BBHNzi9Rw/FUrPSCTk2WLgXGY0Ruojb/scAXdJ8RLd7vqifk0v1Ax/Fl4gi n2hQ2EZ16cixBkHSoko4KV4PMez+iL0jzyS+dRU+zxHMZSn+kby0XpuXevqII5GzKE88 EO8auLDOJPQST5orccQqLX+OfVGRN/4tHQvmFqCxF/qF3eZ7RgcxApHMkbQpKTHevFKZ VEOzSIFTGxAlB4QhHnMqSrU8IZIUbQi27xjtahruf6tspS+D+2RERG9T8sFqumU8anAz fJrHK/xUpu03uFkWkOBKMNtBac7Gk567QMfhD1cYxdQZY/Y6ePt87ACQoMDL6yZyGJVV 8BRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4lQcBmOx+lvoDIHPYrOlN9FBXHgOaL5X05LzK3XG/XQ=; b=GjMeOlDdHRLwPCHgsEHBYK/TZLaNbHX6oL3NIvmOf4HFTwtWVxJXIBlujrXwJ9o4Kp N5kRLg+bjKRA4hDG8Lf/EzmZ5WBMrOWOr8jITYIyBKA57VA/gHEuyR+jlUHMOopDFHC9 18XLAN6cD4gmG4TWg8ZlqkC3nCIvKLBwLVeDcCSJNl/68K0ak0ViOWQfkZgZas3iwTvq k1aBAKaVxmDR+lh9az/40pXYGl3eEKDy0tULJE4ySEflGll6qCO0+XbBq0lu8qhq3D6X 8+dr8qSHr3KXlz4wvm3rudHrbAVWzvV3iCfrY6ovGgTdsXw8hOK08BoD2XmoRwDUjIdp wo+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v+he3CT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l26si71166edw.348.2020.10.20.14.50.40; Tue, 20 Oct 2020 14:51:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v+he3CT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392351AbgJTJDF (ORCPT + 99 others); Tue, 20 Oct 2020 05:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729938AbgJTJDE (ORCPT ); Tue, 20 Oct 2020 05:03:04 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48810C061755 for ; Tue, 20 Oct 2020 02:03:04 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id g16so584776pjv.3 for ; Tue, 20 Oct 2020 02:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4lQcBmOx+lvoDIHPYrOlN9FBXHgOaL5X05LzK3XG/XQ=; b=v+he3CT+vb5JfZ0WlJ1o1sKt8IelhzSVPbdoKqDaMa3qicDs8NSBARNqrwLVI0t6Ty FgKbb4XuNvDqIlCT1BG0paS4VI1ybb2zIlCfRPAwIvWTNOXyd9JfMnLdv4BF0c4MfokU L1eIqY97FugKgjx2q72bTywQvQ/CsH28WNPLhWrYZ2skPK2XdPNG50i76LgNJLU1EGB1 Ox3jOh5jHBq41skGgbrODfSHiqO3v96xm7zzEM2m400KMkgfTtfQlpjs4fI1+Psn5Wxj qedWL6RFJwzpiZY/qoMIXTAW5mWATlxDTjsW5Fl/E2wMLR6kKsqJ3NG4oXjbUjzTsK0Q afbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4lQcBmOx+lvoDIHPYrOlN9FBXHgOaL5X05LzK3XG/XQ=; b=LOuAmpXyGoiwMi1jPkRdi1+9/+q0Qh3Ye9FQFHGE71Kw2mOzr62jsGmUkiYXa/Y8hC 5GwKpOZYL/tPwoeHp/iqI216Q15Ub2pD4j7tkjDaimqX3KPE2oWNXlwMwOzd02+efMrU Z4mWjelMfHy0pa7EPZQQoNZnqTlUx/kWP63LQbyMXEmJcO+8c0x/NucCweS+9N11HNLG 8rykJhjnLjmVtZEeo96peGM85FiVtQxGXSx3BrgHkhpy7dy4aitfGYrjlJAyCGqeeUFD I50uC1ah3kkYT9MYWqumd1Hqq6ST7zY+HoloxE1vnuHxr1dfAyMYa0X84oUNCq+LIbom ZjKA== X-Gm-Message-State: AOAM531bz88IaMZBX/GtkJMB0XQQYu4JQ0YPy6xwpEY4g1MgKhotNhoz O95BvxBNAwHuA/FFNYD21qJRD0i6tg9QPGB0Agm28A== X-Received: by 2002:a17:90a:160f:: with SMTP id n15mr1905532pja.75.1603184583629; Tue, 20 Oct 2020 02:03:03 -0700 (PDT) MIME-Version: 1.0 References: <20201018125237.16717-1-kholk11@gmail.com> <20201018125237.16717-3-kholk11@gmail.com> In-Reply-To: From: Robert Foss Date: Tue, 20 Oct 2020 11:02:51 +0200 Message-ID: Subject: Re: [PATCH 2/6] media: camss: ispif: Correctly reset based on the VFE ID To: kholk11@gmail.com Cc: Todor Tomov , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Rob Herring , marijns95@gmail.com, konradybcio@gmail.com, martin.botka1@gmail.com, linux-arm-msm@vger.kernel.org, linux-media , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I found a build issue in this commit. On Tue, 20 Oct 2020 at 10:59, Robert Foss wrote: > > Nice catch! This patch looks good to me. > > Signed-off-by: Robert Foss > > On Sun, 18 Oct 2020 at 14:54, wrote: > > > > From: AngeloGioacchino Del Regno > > > > 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 > > --- > > .../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. > > 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 > >