Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp552984lqm; Wed, 1 May 2024 08:36:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvW8dB6xMaVQd8S0FQdpB91UC5n5FgknlAlau554MlrKxsRGJNMGcDOmncUBDhjAkzv6mQFj7PNcuMELPsoOwMVFIsyLkZx6YTw9GM9g== X-Google-Smtp-Source: AGHT+IHVhPY2i2XbmqV90481PuT/wT8bAPhJxtfJZMoqdrEEPZlR83oa6OkGgF/dLg0lnkgDRENd X-Received: by 2002:a17:906:354b:b0:a55:a895:46ae with SMTP id s11-20020a170906354b00b00a55a89546aemr1805843eja.63.1714577815978; Wed, 01 May 2024 08:36:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714577815; cv=pass; d=google.com; s=arc-20160816; b=AuKYudETsrTVKw/3MdqD0JWh6baT8VkRma1vLb+YNxnZYvGRsKo6zBXyN47EVvqrw6 CF8QKRfkAO/hEYcDs/1witigffzKOQOGsvpGPBsCWyg6DD31R+mPemAW6+hWk1My6YXi 7tMHI/QzdqZoieAWH7ljHAz7CU3YyRy5hatQgBNi/5N5EXDTNvkWhTwwG9E9fP7vmS08 oJL2uHUuXFTJq0qZHgDIKM9P9FqcK4RoSnXTaBqeyTmaYXaYvquyKynVB72GxvRrNNVu EBy5y26wKPM3/38NygmCEFu+8ilo61IhSYcA39AujTIoZq5id1zJ7O8hE14bJbDf82U+ 0bsw== 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=8XM+yDZwX8unHh0IpGoxwkH3HhBX4oqo+tDv7sLbN1s=; fh=O4sVOwLDCFgSoLfxNsqzaojkVY2TENbPJsLicJ27zOI=; b=DelLYVd5DiPc+cswOxnDEbJpYVn8w97zfNfJQYhYtOOmxGugqG9nrNmwQ6lcL7SQNW 8gdgucFFPv1Imf/nJh8/dat5Lqw9BBQIiu4FjUYvgz3mr0W1Y9LrhSnW1BAinUEZKqsJ PTAIniW6dlgVPyE4Apar4crM5quGJlDWkBjwF9c2fiyiiMyX9KikI4VPOIQ1Z5rd9I9l +yi9ibodgu/RJZw8vFjVFVt2F0WbdX01cajpslZ02QAR88JetlaCs+FxZVEqH3NxSBpr VcETZsggl0UBAZjonqqXZMQv9zvGSCQRDxuGEwTC0zjqniwgyZEVRNPybLgw93VZrcLm xPBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=bI7olhIK; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-165494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165494-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hr8-20020a1709073f8800b00a588f7a46e7si9893907ejc.692.2024.05.01.08.36.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 08:36:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=bI7olhIK; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-165494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165494-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4A2101F219AC for ; Wed, 1 May 2024 15:36:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F886134CEA; Wed, 1 May 2024 15:32:10 +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="bI7olhIK" Received: from mail-108-mta234.mxroute.com (mail-108-mta234.mxroute.com [136.175.108.234]) (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 05E42130AF6 for ; Wed, 1 May 2024 15:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=136.175.108.234 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714577529; cv=none; b=qQFkGl9B4r4JNFxf72LjFWrwalcT0Mjb3UnavEg++mCjxtntIh8BVzz0b6mt+4Z9vL5KcC/or67XNWWXZrLaUEZoYTfQMRNJZqu5LlMWP6vLjem+rRoU3A+odXxV0ggrlEu0UMpIpZ1G4cuLLO1yuBkMNbHhw0v3Ei+F/XxqBcQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714577529; c=relaxed/simple; bh=nLM7risJ0XMUwfzT2iF91IqF6mJWvjzYjQDU7pYI8ac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tn/X7bvdIRlLFXcJLEqhDVJd4QTauc/ZnfI6yNH5btcc/Lcrla0XDlEz8vUh/ixtOsvsofrgJWMgLlw90Yy06/KfyxWJe0hzlbs/YAPiagDt4EJbsjxDY7AoFC+DMalY7rt9YRx2m07tEYtMnuTUsQ5j4ZJ68LyH9juf4daLK2o= 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=bI7olhIK; arc=none smtp.client-ip=136.175.108.234 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-mta234.mxroute.com (ZoneMTA) with ESMTPSA id 18f34c2fd460008ca2.010 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 01 May 2024 15:25:45 +0000 X-Zone-Loop: 10330c76fae8cfad19e02e7f2712228b156028f39a0b 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=8XM+yDZwX8unHh0IpGoxwkH3HhBX4oqo+tDv7sLbN1s=; b=bI7olhIKP9WJMIk2FYTePpq+IM CVtmkDTxXXg7wE364rki2eHxCwJGdSggYwQT6grqjzakR4Yk+7DTu0gSxnTSIAkhw09X371E21Kpm Tm8D2JHbu6RFeLvVfX8WAWZLSFi4QoENukspiX/b1EbHB4whncLKBgcond1biHwjle/NoUBly3j+j EWdo5e2YIBsW+HylFydNSXG4DgTnn/FP5MblV4vQXdNKZGAd0wRI8/wCbQJRO/ZOc+kIvbLdcx1ca fmxq7vsti0LczCQd/dUaUJ077H87hRCugoBp4jYSojSqII/u6LwW7r34Y+GEbJ1k3zPJyNUVnuNNx 0PXGaIEQ==; 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, Ondrej Jirman , Luis Garcia Subject: [PATCH v5 22/25] media: i2c: imx258: Add support for powerdown gpio Date: Wed, 1 May 2024 09:24:39 -0600 Message-ID: <20240501152442.1072627-23-git@luigi311.com> In-Reply-To: <20240501152442.1072627-1-git@luigi311.com> References: <20240501152442.1072627-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: Ondrej Jirman On some boards powerdown signal needs to be deasserted for this sensor to be enabled. Signed-off-by: Ondrej Jirman Signed-off-by: Luis Garcia Reviewed-by: Pavel Machek --- drivers/media/i2c/imx258.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c index f043200e336e..f0bd72f241e4 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -698,6 +698,8 @@ struct imx258 { unsigned int lane_mode_idx; unsigned int csi2_flags; + struct gpio_desc *powerdown_gpio; + /* * Mutex for serialized access: * Protect sensor module set pad format and start/stop streaming safely. @@ -1231,6 +1233,8 @@ static int imx258_power_on(struct device *dev) struct imx258 *imx258 = to_imx258(sd); int ret; + gpiod_set_value_cansleep(imx258->powerdown_gpio, 0); + ret = regulator_bulk_enable(IMX258_NUM_SUPPLIES, imx258->supplies); if (ret) { @@ -1242,6 +1246,7 @@ static int imx258_power_on(struct device *dev) ret = clk_prepare_enable(imx258->clk); if (ret) { dev_err(dev, "failed to enable clock\n"); + gpiod_set_value_cansleep(imx258->powerdown_gpio, 1); regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); } @@ -1254,6 +1259,9 @@ static int imx258_power_off(struct device *dev) struct imx258 *imx258 = to_imx258(sd); clk_disable_unprepare(imx258->clk); + + gpiod_set_value_cansleep(imx258->powerdown_gpio, 1); + regulator_bulk_disable(IMX258_NUM_SUPPLIES, imx258->supplies); return 0; @@ -1559,6 +1567,12 @@ static int imx258_probe(struct i2c_client *client) if (!imx258->variant_cfg) imx258->variant_cfg = &imx258_cfg; + /* request optional power down pin */ + imx258->powerdown_gpio = devm_gpiod_get_optional(&client->dev, "powerdown", + GPIOD_OUT_HIGH); + if (IS_ERR(imx258->powerdown_gpio)) + return PTR_ERR(imx258->powerdown_gpio); + /* Initialize subdev */ v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops); -- 2.44.0