Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp102621lqh; Wed, 27 Mar 2024 16:35:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVnJAJm+Lk3Hton6tKrfDL7mKRRHMfl40RjqGzbNdW0c6yGqbmgRpWvVzDv8OlSFd8oSDNK/s41ev46Fdxc+Ta/tbKMjBvVqLaxz1k8WQ== X-Google-Smtp-Source: AGHT+IEzAluYnIlVprhLIqmAINxZCXB47Gsppl633lmxep2USvV5odbz6QfdsMQ1K3/Y8IKOPmGj X-Received: by 2002:a17:903:98d:b0:1e2:5f3:23f5 with SMTP id mb13-20020a170903098d00b001e205f323f5mr1362291plb.41.1711582543811; Wed, 27 Mar 2024 16:35:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711582543; cv=pass; d=google.com; s=arc-20160816; b=H7SkA/YDUQJjj8w03ozRWQ8ZLDgjRPvvVPA/2ooweDgeWrfJ4VW6kG0HXQLcLWpF+g Lur/yzPXAa0htrpJMw6UWxnxW7UQQAaLN1SdP+8vqyNMdx68m9CoWx7FjF3EngTyttU9 sqN187wp+WaP7qIhH5Ly2l3QSyA/LdTEcIeo8xejhlLREfCsYoe7jyFGfRxOZtLsIj5c WjpFxet0/j38RjgGHnaItrMRv/8HL6v4A7+6NmkMrXzKsiSwGB0tI6in6q/ynuyNLQfL MG66MrcyqiTyZhtR0ZNSABvaCn1FUoEbNmdIByLfdKoyv8OKL9nqxYs5EUKPJu4Qi90U TjHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LjTpuhBdOaCqahODS/RH8FzgsjiJhHlH8fSAiGxPvj0=; fh=82l+0tsIf/u+2VnX9MwMKF8nhI1sxb27NpKPPUb2als=; b=iNY4pI/r0+yiUvhtOP0gzaIbHaQRlCpMJqsZxfKa4U0odnzY9YVr9i9SL6SSuaXB9w 4Nwhkx6tLhOCk7nsbEbnlS1zLnSzeTrZefVlNyVptSNqlmlZoll6ZSTxCb4zJrP44Dla CDVHX7Rzkebc/2sDkKZL8dEBeS5KFPiBnwz/BjeqgHlZ96hkYqZ510xXr7CZZ3nuXsNI Sp4WzMg5Z7JRwtPciXO+tdHGJS1Wf89doaq9fujf8cZSdq5RR6O8RxrDh4btrOkTu7nG eVHkpxM8tzfHExJrZ44kZnaUHffDm6PXq32+aa+wh2t+vwWVjz5aaXqTyL+h0QSS0oEq 6W7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=RhqwllJS; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-122179-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122179-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b4-20020a170902d88400b001e0d08fc3cbsi158942plz.411.2024.03.27.16.35.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 16:35:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122179-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=RhqwllJS; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-122179-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122179-linux.lists.archive=gmail.com@vger.kernel.org" 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 CBC3F2A6202 for ; Wed, 27 Mar 2024 23:26:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E2D0156C59; Wed, 27 Mar 2024 23:23:38 +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="RhqwllJS" Received: from mail-108-mta176.mxroute.com (mail-108-mta176.mxroute.com [136.175.108.176]) (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 B79F115699E for ; Wed, 27 Mar 2024 23:23:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=136.175.108.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581817; cv=none; b=fH7xXJYAyM8gAFH6Cl224Ogat8PJVE0Bp3XpZm9eSxCbcRcXNslbflqJBhykcH9nQbTaQcO2Ca5D27tcigMsMzA6begbhLG8P6JddLp9fAOY+D4qcVVG8EuryzxOxdH7GtO4xCzci6A144zSpU9KCd4Hh2th+Da57fEBdKDceeA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581817; c=relaxed/simple; bh=cod9Uff2WJHycV1JgYkB6YcxOlX/FeYXw3c4usUp97o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jvVxXAX3HDiuehcDl11dzFqeL5HqjHzFRhDJ110XYcFJ2Fye3Y/Qvo53eHKh3kQ6L+HCvYfkgB3V3mGY54kY+UgaEUQVXa3vbNDgE1yd3+dll+EQvdniWJigkVxUt+qkDlL0lU6pdyHOxZoHKwK4jHhV3WHjyQYXDM2QCt9ps3o= 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=RhqwllJS; arc=none smtp.client-ip=136.175.108.176 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-mta176.mxroute.com (ZoneMTA) with ESMTPSA id 18e8234d0610003bea.010 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 27 Mar 2024 23:18:03 +0000 X-Zone-Loop: 674513d93aca233e772d4d2bf66f03e12c8a62954d91 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=LjTpuhBdOaCqahODS/RH8FzgsjiJhHlH8fSAiGxPvj0=; b=RhqwllJSBTxd/TzOcE9rhrNwm/ ojUPMl2wS6Zrqe/2JHwhaHKHw98UlTxqsAr5cRSbd4WFMsrgLhtqKkLPjiLHnKAuoCbUOGpC9BRlT LSRjKfvQGq5BsSX16E+OxL25FMF6o0MxG0RaEJPBlB8gUKO0iS6EBFroAgerWKVL1vqJPICZQC4pd rfjN9rIx3y0rOpONq26ezELw0VlWXvhASTYQ0TuqCtc+W0IXoxJgIxDMYyGKN5fz1f06CXkAldUW2 /dnfLu3eQN5sT5HyuE853SpSJXAQ//2Jnc68M1Jf9Olo54V2ynbRbqa5fPPdGEYt3NPvhKbmGLL3S k2JD6JFg==; 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, Luigi311 , Ondrej Jirman Subject: [PATCH 23/23] drivers: media: i2c: imx258: Add support for reset gpio Date: Wed, 27 Mar 2024 17:17:09 -0600 Message-ID: <20240327231710.53188-24-git@luigi311.com> In-Reply-To: <20240327231710.53188-1-git@luigi311.com> References: <20240327231710.53188-1-git@luigi311.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: personal@luigi311.com From: Luigi311 It was documented in DT, but not implemented. Signed-off-by: Ondrej Jirman --- 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 d8c51d5f04e0..42e1c9246bed 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -687,6 +687,7 @@ struct imx258 { unsigned int csi2_flags; struct gpio_desc *powerdown_gpio; + struct gpio_desc *reset_gpio; /* * Mutex for serialized access: @@ -1239,7 +1240,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) @@ -1250,6 +1255,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; @@ -1561,6 +1567,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); -- 2.42.0