From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46AC729CEB; Tue, 8 Oct 2024 13:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728394103; cv=none; b=tDMJR2kffbvJ1RGt55smByWWMxcO4l1xrQNnhY0Gckyl6DMPJxDp491lCi/4ZiNT8XE7W27ZaK/LiO3jrrnX3W7Rzq8WF2eULITjPXYyoEggbUycq7YMKJX/Hf1Es/H9gva7aB4hOKbjXdrMhA+i4Lss5SD5eIvJhU4c8taW0io= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728394103; c=relaxed/simple; bh=BYCm4H0GfoRhDY5Df/Nl/8ZCzyxV13HPbHuv+Py7SiE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VfuW1o5hM1KUck3HEfhUahEyfSNltC+Sz9uXRGsqoFs9KM8n/P8rUsd2XJJmNyzFdvdf/uEK1ghgRMcYgZ9eHM4VYkyBdkEeCzO4LxVY/U9MtPX3W3q05K+iC+YEFauCEQKr/5g4NW77Tb/tzbCLpT5IXnM0H9UZcFjkfWtc7So= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gvf5+HAN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gvf5+HAN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBA05C4CECD; Tue, 8 Oct 2024 13:28:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728394103; bh=BYCm4H0GfoRhDY5Df/Nl/8ZCzyxV13HPbHuv+Py7SiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gvf5+HANEjCKdBuirOJHuS3Cw/l49KQGQ6lbdhAocwAiD/nOTohcIZXtbknAi5EhS 8YEc6ySxbyBa/5DiU3r2nSByE+IXDolS6Ce+My3kpc6CJ3qILKgfjTlz8cD+eN1sOs f9yRee7noRkM2RBwRlnfwECQgNCqb0U3ZtnJs6Vo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Laurent Pinchart , Umang Jain , Sakari Ailus , Hans Verkuil , Sasha Levin Subject: [PATCH 6.6 348/386] media: imx335: Fix reset-gpio handling Date: Tue, 8 Oct 2024 14:09:53 +0200 Message-ID: <20241008115643.076130791@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115629.309157387@linuxfoundation.org> References: <20241008115629.309157387@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Umang Jain [ Upstream commit 99d30e2fdea4086be4e66e2deb10de854b547ab8 ] Rectify the logical value of reset-gpio so that it is set to 0 (disabled) during power-on and to 1 (enabled) during power-off. Set the reset-gpio to GPIO_OUT_HIGH at initialization time to make sure it starts off in reset. Also drop the "Set XCLR" comment which is not-so-informative. The existing usage of imx335 had reset-gpios polarity inverted (GPIO_ACTIVE_HIGH) in their device-tree sources. With this patch included, those DTS will not be able to stream imx335 anymore. The reset-gpio polarity will need to be rectified in the device-tree sources as shown in [1] example, in order to get imx335 functional again (as it remains in reset prior to this fix). Cc: stable@vger.kernel.org Fixes: 45d19b5fb9ae ("media: i2c: Add imx335 camera sensor driver") Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/linux-media/20240729110437.199428-1-umang.jain@ideasonboard.com/ Signed-off-by: Umang Jain Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/i2c/imx335.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index 771f13b524baf..cb3f4fc66a174 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -792,7 +792,7 @@ static int imx335_parse_hw_config(struct imx335 *imx335) /* Request optional reset pin */ imx335->reset_gpio = devm_gpiod_get_optional(imx335->dev, "reset", - GPIOD_OUT_LOW); + GPIOD_OUT_HIGH); if (IS_ERR(imx335->reset_gpio)) { dev_err(imx335->dev, "failed to get reset gpio %ld", PTR_ERR(imx335->reset_gpio)); @@ -898,8 +898,7 @@ static int imx335_power_on(struct device *dev) usleep_range(500, 550); /* Tlow */ - /* Set XCLR */ - gpiod_set_value_cansleep(imx335->reset_gpio, 1); + gpiod_set_value_cansleep(imx335->reset_gpio, 0); ret = clk_prepare_enable(imx335->inclk); if (ret) { @@ -912,7 +911,7 @@ static int imx335_power_on(struct device *dev) return 0; error_reset: - gpiod_set_value_cansleep(imx335->reset_gpio, 0); + gpiod_set_value_cansleep(imx335->reset_gpio, 1); regulator_bulk_disable(ARRAY_SIZE(imx335_supply_name), imx335->supplies); return ret; @@ -929,7 +928,7 @@ static int imx335_power_off(struct device *dev) struct v4l2_subdev *sd = dev_get_drvdata(dev); struct imx335 *imx335 = to_imx335(sd); - gpiod_set_value_cansleep(imx335->reset_gpio, 0); + gpiod_set_value_cansleep(imx335->reset_gpio, 1); clk_disable_unprepare(imx335->inclk); regulator_bulk_disable(ARRAY_SIZE(imx335_supply_name), imx335->supplies); -- 2.43.0