Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp569517iob; Thu, 28 Apr 2022 08:04:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym1BRrkjqKdO6yYPQcc0hDMznIDXnVKkjhPQy7DEU7H60dQAV5BEBbB7t8x3kQMZ9RfCWd X-Received: by 2002:a05:6808:17a8:b0:322:7964:1b6c with SMTP id bg40-20020a05680817a800b0032279641b6cmr20435202oib.25.1651158286594; Thu, 28 Apr 2022 08:04:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651158286; cv=none; d=google.com; s=arc-20160816; b=gQtx2OtfXbz6kflvP81+0Sl2VmTcJMD/5hAUOkf+siD3bbZ9gM1d97mSu9p2SeziSn qL7FgsB/sriZxAKDxl0keWxUFr4rV0mSpGUqnKFx8HCnGSvefX4p4p7fHSsV8dTEnxQC ddegMeQzI87mdmBxaidKen2nnnDe+Jm0LzzyRnUHD/kFgN/PcnqwE45b/nsXwfB9JumU qT+gXHYcAoF+9qxhwxA1XXoKczB25T76J/XzvJN1uG0Qbv+EZCnupRzwwqmDHduwKO9D MLKdX2pNOcMcE0QcEf2kE9nOpYfZP8PvrXkBWQYXvNA7l7PAGPgoo18oOfM2vprCB3t/ a8HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PwJWSFPyWMtOiNkzX7trHwiAp5qywL60TmDmXyh8PGE=; b=vwlKDa35VrMBn2vyGV8TEwN9S9bLFg2KDg5Mb1UEUuoyvRH4khS5w33ZQU7fx1XFb/ 6GFDZE9f7IwRNhjkwhymQjTi3Dy6bHxeSnXVEXxAn83wsSnoC6JvU8s+oBb9TcnhPnHG hkOpzkbOWWZbBbCy6LrJINDmF/H8ecPOf91PZkd5daS4JEPiVONL/6xebhrckE2ckM/v sXpDymLnugj5GmOxkwwHt5ZxgkBWZDozvUibKaM9rYjUk3sEq1vWybajtMyrU1jXtQPm LB2VEAUEFcoWO8YIHviBHomu/UhLrP7/5a6+PDmlbnuDJLVjdlQoMkz0bKGlf+WZQwJ/ /otQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dvpykhS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j192-20020acaebc9000000b002ef0c34761fsi2440596oih.159.2022.04.28.08.04.20; Thu, 28 Apr 2022 08:04:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=dvpykhS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343562AbiD1H7W (ORCPT + 99 others); Thu, 28 Apr 2022 03:59:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245733AbiD1H7U (ORCPT ); Thu, 28 Apr 2022 03:59:20 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B47F20BCE; Thu, 28 Apr 2022 00:56:05 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 2362040007; Thu, 28 Apr 2022 07:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1651132564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PwJWSFPyWMtOiNkzX7trHwiAp5qywL60TmDmXyh8PGE=; b=dvpykhS3lCXFqqBThqULeTtNcre6KG0VweOfWsTgp9gaa45NvaKxFs1rVpHur9eqVU3bmD CJ3wAoHMqu/3EZT8oXNhPed2JIt/fgielZnLo2c7dJuqNmmXQ4c6A73EGOBBfRMTGcH6Ea VNOhcXutVN3OWNCv6nZfZ1j6F9R4fAnd/4lucF8QHzdMkPjKidzTI2L+teZJZlvrRQSOCu MU8PTHX+fqSU7idnkfHN4ccBqbNaqJdLlP8GBnzfIpPNQ5/b3C9fG+0QUQr56bWZ289iWX d9W7nhhCk/K6rsARwdtrAsNhjHJBMjZhRDoTm9EvMPBRu8WPDtKi5TSusOE5ag== Date: Thu, 28 Apr 2022 09:55:56 +0200 From: Paul Kocialkowski To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Yong Deng , Mauro Carvalho Chehab , Chen-Yu Tsai , Samuel Holland , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: Re: [PATCH v4 43/45] media: sun6i-csi: Detect the availability of the ISP Message-ID: References: <20220415152811.636419-1-paul.kocialkowski@bootlin.com> <20220415152811.636419-44-paul.kocialkowski@bootlin.com> <2029179.KlZ2vcFHjT@jernej-laptop> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ed//Kfe9t1pc7ZsY" Content-Disposition: inline In-Reply-To: <2029179.KlZ2vcFHjT@jernej-laptop> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Ed//Kfe9t1pc7ZsY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jernej, Thanks a lot for all your reviews! On Wed 27 Apr 22, 22:07, Jernej =C5=A0krabec wrote: > Dne petek, 15. april 2022 ob 17:28:09 CEST je Paul Kocialkowski napisal(a= ): > > Add a helper to detect whether the ISP is available and connected > > and store the indication in a driver-wide variable. > >=20 > > Signed-off-by: Paul Kocialkowski > > --- > > .../platform/sunxi/sun6i-csi/sun6i_csi.c | 33 +++++++++++++++++++ > > .../platform/sunxi/sun6i-csi/sun6i_csi.h | 3 ++ > > 2 files changed, 36 insertions(+) > >=20 > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index > > a88deb8ba1e7..f185cbd113c7 100644 > > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > @@ -25,6 +25,35 @@ > > #include "sun6i_csi_capture.h" > > #include "sun6i_csi_reg.h" > >=20 > > +/* ISP */ > > + > > +static bool sun6i_csi_isp_detect(struct sun6i_csi_device *csi_dev) > > +{ > > + struct device *dev =3D csi_dev->dev; > > + struct fwnode_handle *handle =3D NULL; > > + > > + /* ISP is not available if disabled in kernel config. */ > > + if (!IS_ENABLED(CONFIG_VIDEO_SUN6I_ISP)) >=20 > Where is this symbol defined? That is defined through Kconfig's auto-generated header, from the associated option for the ISP driver. It is defined in the ISP support series so this will effectively always be false for now. > Best regards, > Jernej >=20 > > + return 0; > > + > > + /* > > + * ISP is not available if not connected via fwnode graph. > > + * This weill also check that the remote parent node is available. > > + */ > > + handle =3D fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), > > + =20 > SUN6I_CSI_PORT_ISP, 0, > > + =20 > FWNODE_GRAPH_ENDPOINT_NEXT); > > + if (!handle) > > + return 0; > > + > > + fwnode_handle_put(handle); > > + > > + dev_info(dev, "ISP link is available\n"); > > + csi_dev->isp_available =3D true; > > + > > + return 0; > > +} > > + > > /* Media */ > >=20 > > static const struct media_device_ops sun6i_csi_media_ops =3D { > > @@ -306,6 +335,10 @@ static int sun6i_csi_probe(struct platform_device > > *platform_dev) if (ret) > > return ret; > >=20 > > + ret =3D sun6i_csi_isp_detect(csi_dev); > > + if (ret) > > + goto error_resources; > > + > > ret =3D sun6i_csi_v4l2_setup(csi_dev); > > if (ret) > > goto error_resources; > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h > > b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h index > > 6aa83dd11684..9b105c341047 100644 > > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h > > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h > > @@ -22,6 +22,7 @@ > > enum sun6i_csi_port { > > SUN6I_CSI_PORT_PARALLEL =3D 0, > > SUN6I_CSI_PORT_MIPI_CSI2 =3D 1, > > + SUN6I_CSI_PORT_ISP =3D 2, > > }; > >=20 > > struct sun6i_csi_buffer { > > @@ -46,6 +47,8 @@ struct sun6i_csi_device { > > struct clk *clock_mod; > > struct clk *clock_ram; > > struct reset_control *reset; > > + > > + bool isp_available; > > }; > >=20 > > struct sun6i_csi_variant { >=20 >=20 >=20 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --Ed//Kfe9t1pc7ZsY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmJqSIsACgkQ3cLmz3+f v9FaXQgAofXC4aKthXOVBgx2avaUKkXQfv+k5TuIIIcHUt5UxHio7Jz/Jo63k4aS 40fL2G9UAHlkY/pvlmXOPWyoFOZkEOMgSPrDtOOYHnFDxfVdMMDr+WtEWewhiEic bWgj3LQRgrW51O/SFiAmCcFe3lrrkPy7MpSOKduQlfwXxnN9BKyF+SfC/Xd1fcD5 qHNk3WuDDyJ/jYC7d3hgdy4WdcE4Hy4OvZY8VzvGw0OGA9Ys0s0JMs74ohNqOnz/ 92wSVjm9u7Shz8UZMdA0rY9MKNN1d4WTFTp8ok4IOAIzv/2irOo3HA9+PBzatZw1 ZcQIEdZFCx0heApvDexHrVygwHTWWw== =JFVd -----END PGP SIGNATURE----- --Ed//Kfe9t1pc7ZsY--