Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2774015lqz; Wed, 3 Apr 2024 08:15:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmfOqsQxyEVkiTtDBUe1ttb+d62gBubaEtvSl29ckAwsiSaMpsqy2BeXzIra3+TyJ2cYNYfNwjAKkckwQyunx2Jn8OIxLDg81C0T9TfA== X-Google-Smtp-Source: AGHT+IH9R4d/sF/8+TkciPqaNg34TsEKB7NBw+MSp+dh358pBZ9tax3ziqvVy28Pd+1wVVi+pAqo X-Received: by 2002:a50:d6c3:0:b0:56b:d158:7fbf with SMTP id l3-20020a50d6c3000000b0056bd1587fbfmr9914922edj.15.1712157318106; Wed, 03 Apr 2024 08:15:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712157318; cv=pass; d=google.com; s=arc-20160816; b=ky9hol1vDOKDaCRpsOdZ4/84A3Gb3K4EKrPuDxm0Lc28CtWPFhcc8r0ScCsaICPLsM jcGE3HZ/knDmvsSl89ydHfTWSbChrXJujBmcEh4EkTl8PX38KYqQXwswKIPOVLi+MkA6 p1+ScNQ5SIkt8NUAlc3Dv8wD/hLM0+dU5ldUE6GOEipO84rz6voEngK+6CRgLLyyTqb5 ibN3+XX+5hnCChlaxmDbMtu7VCctxQPbsiAQXUyG33m+d3qZ2FYxcAhaNhztRl2IHqtb DNoG7IhDO6wiXaGASRT7P6FXl9iXwQ4oDIb0FMt6ihE1NnwZfDP5p+gkblmMpGc5tmuV EASQ== 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=MUtTZIUft2Qwd/Ss8DLnay+tIu1VwSFMmHTaDB0Zatw=; fh=rjYdOm40b1YRxqtsJmxL8Z/VH4snW04izM6705HQ2es=; b=uqsl2NxuJBB6gBwJyBkH/YJJW7J9GhZ+avTVbPbckCKhb9e6yhYs9hVaQZAoIglnDW K5RP+38KlK+uCA+qb/65iZYyU8U16ouI0M9o/YBm0C8JwKl8dJN2ZwjBWqHDXskgBX9u D9b8FdX9wWNnT4DIYASmz+hNNfaEMnLQzeuoMYXi/HC0NOu83DXNcvb2iAUUWmyy21BV ZJdnx+GQ54e3IMRwGMji52k5j8QkzCYQCk+EcSVUpkRNGY0VElv9crdc11iMQ7bZJsBQ cyLBX1jXHJ5KVGZig1oENapOGS7f3+KyRTLBoO7Ie4+voX+7C35TxEhf2gnt9Jll1Gfk ITcw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=Mx8JedB6; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-130056-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130056-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x10-20020a50d60a000000b0056bd1c4942dsi7023081edi.377.2024.04.03.08.15.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 08:15:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130056-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=fail header.i=@luigi311.com header.s=x header.b=Mx8JedB6; arc=pass (i=1 spf=pass spfdomain=luigi311.com dkim=pass dkdomain=luigi311.com); spf=pass (google.com: domain of linux-kernel+bounces-130056-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130056-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 405771F29BE2 for ; Wed, 3 Apr 2024 15:13:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97BC115252D; Wed, 3 Apr 2024 15:09:21 +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="Mx8JedB6" Received: from mail-108-mta38.mxroute.com (mail-108-mta38.mxroute.com [136.175.108.38]) (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 4DE5614BF9E for ; Wed, 3 Apr 2024 15:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=136.175.108.38 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712156960; cv=none; b=PQghYN26kv665Tz+H9MdixXII2cXP2QDD9bamTNhuKB/Gsoszy62i3is6G2U8RyKD1Hgei7EbfotfPQelW8PmuNbU+uJFe0v5SOl5NI6gGvs/K5PSNoz4y+Nh8MBG1IkEuusmaDpcrlEqbrfxupxzrbafqlGSS4I2SVCgrkEo9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712156960; c=relaxed/simple; bh=X8l0Qu5ct8EeMly/eTF0Crxww6UHAs2wZ0Q0VRWgXwg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jjM4O463lV1Czh3+WiynO/O0xtjg63x7TAIpNt0mx/ZHN/2y5BS0MUeTOP93SrtpvHKKi2YPfCpVm3dhzMTLZrtvMLwWQ+IX2HF1FuZhPcYbz2vqgNkt3hRpPMDS97FvbOnACwtR4CTYheQmaCCR0+nRmX7EvfgaK619VNc7Hsc= 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=Mx8JedB6; arc=none smtp.client-ip=136.175.108.38 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-mta38.mxroute.com (ZoneMTA) with ESMTPSA id 18ea480c0610003bea.010 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 03 Apr 2024 15:08:05 +0000 X-Zone-Loop: 981a6e85839eab7669b67697654f107c0738c5e9f91f 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=MUtTZIUft2Qwd/Ss8DLnay+tIu1VwSFMmHTaDB0Zatw=; b=Mx8JedB6wozdYbTdvWIQzPOy0e w6Plus8ggU9/koj1uwXYIszoXv64qrgqvk15H0r5BAj68b2y9h8r7PKgGwN49Uwh/5s/BBDlRLma8 KcbV3u6V0bVVYd3wDdorlrd+51wNDg0LSKIknwqv70jgmpm9mj9Zih9E588IoQZLVADJS5dxd3C+W //o2aCL84V2i2etbv2S/PSG9dFlr/y4qKsnwKj3OV7tfSjm2b3VXkFGfQAN/qkzwXu35ITEvkOArA jAZgVg2H08N+AxO1s8jk/trOSANpG4aJecgwm1Ia1b6jzOUHvbo3JxHOhoFjg+HeFsjAqEDxkZqCS VQtQv09g==; 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 , Ondrej Jirman Subject: [PATCH v3 23/25] drivers: media: i2c: imx258: Add support for powerdown gpio Date: Wed, 3 Apr 2024 09:03:52 -0600 Message-ID: <20240403150355.189229-24-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-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: Luis Garcia 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 --- drivers/media/i2c/imx258.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c index 30352c33f63c..163f04f6f954 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -679,6 +679,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. @@ -1213,6 +1215,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) { @@ -1224,6 +1228,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); } @@ -1238,6 +1243,8 @@ 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->powerdown_gpio, 1); + return 0; } @@ -1541,6 +1548,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.42.0