Message ID | 20240403150355.189229-25-git@luigi311.com (mailing list archive) |
---|---|
State | Superseded |
Headers |
Received: from sv.mirrors.kernel.org ([139.178.88.99]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <linux-media+bounces-8557-patchwork=linuxtv.org@vger.kernel.org>) id 1rs2Nn-0004Jo-1B for patchwork@linuxtv.org; Wed, 03 Apr 2024 15:18:35 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C47BF28497C for <patchwork@linuxtv.org>; Wed, 3 Apr 2024 15:18:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 435CB14A0BB; Wed, 3 Apr 2024 15:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=luigi311.com header.i=@luigi311.com header.b="hzRF9p17" X-Original-To: linux-media@vger.kernel.org Received: from mail-108-mta235.mxroute.com (mail-108-mta235.mxroute.com [136.175.108.235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E95F14B08B for <linux-media@vger.kernel.org>; Wed, 3 Apr 2024 15:14:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=136.175.108.235 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712157269; cv=none; b=FyAvt/QXDZ4BnFdW9vWC4FXJxwvX9uQcfzJCPK0OrAhp43fJx54xGCN4YWXR6LT1OXTBJdKpMYa7YHdNnnZy0Q0mt4/xlpgD2oM71sk4Fn87kzWiiax6vNLN08Vd2bVZ2eAQxBw5/0PaQUKWpkY/5orqNhaaQy1PKhJmvYWMqmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712157269; c=relaxed/simple; bh=+vxCaqhpYUz4B3FGkuIBCQcJuaRcfN8mST5iCA4cSts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i3s0674rXOs9/cjvQB+Y+GgzbrsMr/dXjP++fK8toXyicI/0KVbDijevddOZMlGVbMXD3d5t+7mJ+rZw3x9eHm/QgkwT6h3dqQ3OjA5WjN8WK8s6aORvDUPCzrvjuSPFInTdMZXW+XIqtPYaDz+aEM68tKh0ZtlnYu+UHKGhJRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=luigi311.com; spf=pass smtp.mailfrom=luigi311.com; dkim=pass (2048-bit key) header.d=luigi311.com header.i=@luigi311.com header.b=hzRF9p17; arc=none smtp.client-ip=136.175.108.235 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=luigi311.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=luigi311.com Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta235.mxroute.com (ZoneMTA) with ESMTPSA id 18ea480cf250003bea.012 for <linux-media@vger.kernel.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 03 Apr 2024 15:08:08 +0000 X-Zone-Loop: 941beaf7b0891bb34769aabb7e3fe858482d4757bc48 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=luigi311.com; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VYOIOtA06rrhHKEkkVTvSuwBswDW7njXYjZqzK9f8oA=; b=hzRF9p174w+rysInUpCkyCEor+ 28/1Q++gJbbLCySptKAOW/2CtX5LPY/AwqwlTZlI8wwqhlUf8AO5EQPdJZuMHd5MO6izwZg5bycWW OCVkEO80i3/TZKudmprXaUZS+NZHLA1NjGsNAu69xS7266iiO9F46M5of1XlTAwpJGyWCi+HXADiB BywIKEuRqe6Hp78L/IIRu0VzaY+jvQXkcb0vhHW/plqwrTNwUN9LHvM0J3r7SElOq6Yjl1X2eHDDa h73nAhrSyhWlJN/A0Nae7RH74cLk8SGiBWnfgQ61DpmyA8GfEqYLhUFSs5X/kS8yFr93FwnZ2wetY s7ZJPnbA==; From: git@luigi311.com To: linux-media@vger.kernel.org Cc: dave.stevenson@raspberrypi.com, jacopo.mondi@ideasonboard.com, mchehab@kernel.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, sakari.ailus@linux.intel.com, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pavel@ucw.cz, phone-devel@vger.kernel.org, Luis Garcia <git@luigi311.com>, Ondrej Jirman <megous@megous.com> Subject: [PATCH v3 24/25] drivers: media: i2c: imx258: Add support for reset gpio Date: Wed, 3 Apr 2024 09:03:53 -0600 Message-ID: <20240403150355.189229-25-git@luigi311.com> In-Reply-To: <20240403150355.189229-1-git@luigi311.com> References: <20240403150355.189229-1-git@luigi311.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: personal@luigi311.com X-LSpam-Score: -4.6 (----) X-LSpam-Report: No, score=-4.6 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DKIM_INVALID=0.1,DKIM_SIGNED=0.1,DMARC_MISSING=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=ham autolearn_force=no |
Series |
imx258 improvement series
|
|
Commit Message
Luis Garcia
April 3, 2024, 3:03 p.m. UTC
From: Luis Garcia <git@luigi311.com> It was documented in DT, but not implemented. Signed-off-by: Ondrej Jirman <megous@megous.com> Signed-off-by: Luis Garcia <git@luigi311.com> --- drivers/media/i2c/imx258.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
Comments
Hi Luis, Could you unify the subject prefix for the driver patches, please? E.g. "media: imx258: " would be fine. On Wed, Apr 03, 2024 at 09:03:53AM -0600, git@luigi311.com wrote: > From: Luis Garcia <git@luigi311.com> > > It was documented in DT, but not implemented. > > Signed-off-by: Ondrej Jirman <megous@megous.com> > Signed-off-by: Luis Garcia <git@luigi311.com> > --- > drivers/media/i2c/imx258.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c > index 163f04f6f954..4c117c4829f1 100644 > --- a/drivers/media/i2c/imx258.c > +++ b/drivers/media/i2c/imx258.c > @@ -680,6 +680,7 @@ struct imx258 { > unsigned int csi2_flags; > > struct gpio_desc *powerdown_gpio; > + struct gpio_desc *reset_gpio; > > /* > * Mutex for serialized access: > @@ -1232,7 +1233,11 @@ static int imx258_power_on(struct device *dev) > regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); > } > > - return ret; > + gpiod_set_value_cansleep(imx258->reset_gpio, 0); > + > + usleep_range(400, 500); You could mention this at least in the commit message. > + > + return 0; > } > > static int imx258_power_off(struct device *dev) > @@ -1243,6 +1248,7 @@ static int imx258_power_off(struct device *dev) > clk_disable_unprepare(imx258->clk); > regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); > > + gpiod_set_value_cansleep(imx258->reset_gpio, 1); Same question than on the other GPIO: does this belong here? > gpiod_set_value_cansleep(imx258->powerdown_gpio, 1); > > return 0; > @@ -1554,6 +1560,12 @@ static int imx258_probe(struct i2c_client *client) > if (IS_ERR(imx258->powerdown_gpio)) > return PTR_ERR(imx258->powerdown_gpio); > > + /* request optional reset pin */ > + imx258->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", > + GPIOD_OUT_HIGH); > + if (IS_ERR(imx258->reset_gpio)) > + return PTR_ERR(imx258->reset_gpio); > + > /* Initialize subdev */ > v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops); >
Hi, On Wed, Apr 03, 2024 at 04:28:59PM GMT, Sakari Ailus wrote: > Hi Luis, > > Could you unify the subject prefix for the driver patches, please? E.g. > "media: imx258: " would be fine. > > On Wed, Apr 03, 2024 at 09:03:53AM -0600, git@luigi311.com wrote: > > From: Luis Garcia <git@luigi311.com> > > > > It was documented in DT, but not implemented. > > > > Signed-off-by: Ondrej Jirman <megous@megous.com> > > Signed-off-by: Luis Garcia <git@luigi311.com> > > --- > > drivers/media/i2c/imx258.c | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c > > index 163f04f6f954..4c117c4829f1 100644 > > --- a/drivers/media/i2c/imx258.c > > +++ b/drivers/media/i2c/imx258.c > > @@ -680,6 +680,7 @@ struct imx258 { > > unsigned int csi2_flags; > > > > struct gpio_desc *powerdown_gpio; > > + struct gpio_desc *reset_gpio; > > > > /* > > * Mutex for serialized access: > > @@ -1232,7 +1233,11 @@ static int imx258_power_on(struct device *dev) > > regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); > > } > > > > - return ret; > > + gpiod_set_value_cansleep(imx258->reset_gpio, 0); > > + > > + usleep_range(400, 500); > > You could mention this at least in the commit message. This is T6 in the datasheet: https://megous.com/dl/tmp/92c9223ce877216e.png > > + > > + return 0; > > } > > > > static int imx258_power_off(struct device *dev) > > @@ -1243,6 +1248,7 @@ static int imx258_power_off(struct device *dev) > > clk_disable_unprepare(imx258->clk); > > regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); > > > > + gpiod_set_value_cansleep(imx258->reset_gpio, 1); > > Same question than on the other GPIO: does this belong here? No, this should be before the regulator_bulk_disable. See: https://megous.com/dl/tmp/c96180b23d7ce63a.png kind regards, o. > > gpiod_set_value_cansleep(imx258->powerdown_gpio, 1); > > > > return 0; > > @@ -1554,6 +1560,12 @@ static int imx258_probe(struct i2c_client *client) > > if (IS_ERR(imx258->powerdown_gpio)) > > return PTR_ERR(imx258->powerdown_gpio); > > > > + /* request optional reset pin */ > > + imx258->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", > > + GPIOD_OUT_HIGH); > > + if (IS_ERR(imx258->reset_gpio)) > > + return PTR_ERR(imx258->reset_gpio); > > + > > /* Initialize subdev */ > > v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops); > > > > -- > Regards, > > Sakari Ailus
On 4/3/24 11:03, Ondřej Jirman wrote: > Hi, > > On Wed, Apr 03, 2024 at 04:28:59PM GMT, Sakari Ailus wrote: >> Hi Luis, >> >> Could you unify the subject prefix for the driver patches, please? E.g. >> "media: imx258: " would be fine. >> >> On Wed, Apr 03, 2024 at 09:03:53AM -0600, git@luigi311.com wrote: >>> From: Luis Garcia <git@luigi311.com> >>> >>> It was documented in DT, but not implemented. >>> >>> Signed-off-by: Ondrej Jirman <megous@megous.com> >>> Signed-off-by: Luis Garcia <git@luigi311.com> >>> --- >>> drivers/media/i2c/imx258.c | 14 +++++++++++++- >>> 1 file changed, 13 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c >>> index 163f04f6f954..4c117c4829f1 100644 >>> --- a/drivers/media/i2c/imx258.c >>> +++ b/drivers/media/i2c/imx258.c >>> @@ -680,6 +680,7 @@ struct imx258 { >>> unsigned int csi2_flags; >>> >>> struct gpio_desc *powerdown_gpio; >>> + struct gpio_desc *reset_gpio; >>> >>> /* >>> * Mutex for serialized access: >>> @@ -1232,7 +1233,11 @@ static int imx258_power_on(struct device *dev) >>> regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); >>> } >>> >>> - return ret; >>> + gpiod_set_value_cansleep(imx258->reset_gpio, 0); >>> + >>> + usleep_range(400, 500); >> >> You could mention this at least in the commit message. > > This is T6 in the datasheet: https://megous.com/dl/tmp/92c9223ce877216e.png > > >>> + >>> + return 0; >>> } >>> >>> static int imx258_power_off(struct device *dev) >>> @@ -1243,6 +1248,7 @@ static int imx258_power_off(struct device *dev) >>> clk_disable_unprepare(imx258->clk); >>> regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); >>> >>> + gpiod_set_value_cansleep(imx258->reset_gpio, 1); >> >> Same question than on the other GPIO: does this belong here? > > No, this should be before the regulator_bulk_disable. > > See: https://megous.com/dl/tmp/c96180b23d7ce63a.png > > kind regards, > o. > Since I'm supposed to move the reset up should I also move the power up with it to match your downstream driver? >>> gpiod_set_value_cansleep(imx258->powerdown_gpio, 1); >>> >>> return 0; >>> @@ -1554,6 +1560,12 @@ static int imx258_probe(struct i2c_client *client) >>> if (IS_ERR(imx258->powerdown_gpio)) >>> return PTR_ERR(imx258->powerdown_gpio); >>> >>> + /* request optional reset pin */ >>> + imx258->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", >>> + GPIOD_OUT_HIGH); >>> + if (IS_ERR(imx258->reset_gpio)) >>> + return PTR_ERR(imx258->reset_gpio); >>> + >>> /* Initialize subdev */ >>> v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops); >>> >> >> -- >> Regards, >> >> Sakari Ailus
diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c index 163f04f6f954..4c117c4829f1 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -680,6 +680,7 @@ struct imx258 { unsigned int csi2_flags; struct gpio_desc *powerdown_gpio; + struct gpio_desc *reset_gpio; /* * Mutex for serialized access: @@ -1232,7 +1233,11 @@ static int imx258_power_on(struct device *dev) regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); } - return ret; + gpiod_set_value_cansleep(imx258->reset_gpio, 0); + + usleep_range(400, 500); + + return 0; } static int imx258_power_off(struct device *dev) @@ -1243,6 +1248,7 @@ static int imx258_power_off(struct device *dev) clk_disable_unprepare(imx258->clk); regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); + gpiod_set_value_cansleep(imx258->reset_gpio, 1); gpiod_set_value_cansleep(imx258->powerdown_gpio, 1); return 0; @@ -1554,6 +1560,12 @@ static int imx258_probe(struct i2c_client *client) if (IS_ERR(imx258->powerdown_gpio)) return PTR_ERR(imx258->powerdown_gpio); + /* request optional reset pin */ + imx258->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", + GPIOD_OUT_HIGH); + if (IS_ERR(imx258->reset_gpio)) + return PTR_ERR(imx258->reset_gpio); + /* Initialize subdev */ v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops);