From nobody Sat Oct 11 00:26:03 2025 Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) (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 8586A2F4325; Thu, 12 Jun 2025 06:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.41.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749711259; cv=none; b=OLdAqEAXSig0U7aK8qYXEe0pw7d2vDkRcdEaNnjh1iuDfw96DtsidOz/3Zx3UWipuskRNXNk+tjC3S90ElZvCp5lDTqlIRG4yKgcNykOUqMfo2FQMyqCQCFYld9DfBuG0Ge9MMAeU4MqpC3lzeHZlm6s0kfoaJ8TZg9mZfgMqYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749711259; c=relaxed/simple; bh=abOkBWJGlLGt8B6Uxene1xzpp8AN59b8XJc9hJfjlf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eP4DtUyxPRz5FfQIYpcWLvLsoW4mgEAkQrkTTyl5jlQ3h8LlhyljU470fEPBejLB/56V0upC0PVvL7X6OR2hc3QG5h7ct/Z2RS8/jnfyLGc1vvHBkeJfz6l2JuelpkHVkU5u8Kh1b1E5dPxMoigVPJnctGVUX24RVd7QTsNbcXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emfend.at; spf=pass smtp.mailfrom=emfend.at; dkim=pass (1024-bit key) header.d=emfend.at header.i=@emfend.at header.b=BVqcTbb7; arc=none smtp.client-ip=168.119.41.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emfend.at Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emfend.at Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=emfend.at header.i=@emfend.at header.b="BVqcTbb7" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To: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=vRObdDN3QzY2W/qwTV0fHN32ShwflGcphDsUHMARNFo=; b=BVqcTbb7B2uLKpsYnNbLx7pq1z rqztQy5g7dG6p3Tu0AzRtWe3qLwv6QY1CmonYuk9fwWDBg5xo1rJSz3QFMYNpDCiiMfDi9mIkin4x NNAXxd/jdvGciJXpB2VniLBPVS3suy16iFmDsJARWNBBtprPw3zJEEEQBKwY6+nbx7S8=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:59918 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1uPbpF-003wuh-LP; Thu, 12 Jun 2025 08:54:13 +0200 From: Matthias Fend Date: Thu, 12 Jun 2025 08:54:10 +0200 Subject: [PATCH 1/3] media: dw9714: coding style fixes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250612-dw9714-v1-1-1a2d6d682829@emfend.at> References: <20250612-dw9714-v1-0-1a2d6d682829@emfend.at> In-Reply-To: <20250612-dw9714-v1-0-1a2d6d682829@emfend.at> To: Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Fend , bsp-development.geo@leica-geosystems.com X-Mailer: b4 0.14.2 X-Spam-Score: -1.0 X-Spam-Bar: - X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Besides minor fixes, this series mainly adds support for the powerdown pin. Note: I already sent a single patch for power down pin support, but since more things have changed and this has become a series, I've decided to start it with V1. Content analysis details: (-1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment Just some minor coding style fixes reported by checkpatch. Signed-off-by: Matthias Fend --- drivers/media/i2c/dw9714.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 2ddd7daa79e28a2cde915b4173fa27e60d5a2b57..1392cddab738ce38efa18b2b9bd= 7821bddaa0626 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -144,7 +144,7 @@ static int dw9714_probe(struct i2c_client *client) =20 dw9714_dev =3D devm_kzalloc(&client->dev, sizeof(*dw9714_dev), GFP_KERNEL); - if (dw9714_dev =3D=3D NULL) + if (!dw9714_dev) return -ENOMEM; =20 dw9714_dev->vcc =3D devm_regulator_get(&client->dev, "vcc"); @@ -247,7 +247,7 @@ static int __maybe_unused dw9714_vcm_suspend(struct dev= ice *dev) * The lens position is gradually moved in units of DW9714_CTRL_STEPS, * to make the movements smoothly. */ -static int __maybe_unused dw9714_vcm_resume(struct device *dev) +static int __maybe_unused dw9714_vcm_resume(struct device *dev) { struct i2c_client *client =3D to_i2c_client(dev); struct v4l2_subdev *sd =3D i2c_get_clientdata(client); @@ -271,7 +271,7 @@ static int __maybe_unused dw9714_vcm_resume(struct dev= ice *dev) DW9714_VAL(val, DW9714_DEFAULT_S)); if (ret) dev_err_ratelimited(dev, "%s I2C failure: %d", - __func__, ret); + __func__, ret); usleep_range(DW9714_CTRL_DELAY_US, DW9714_CTRL_DELAY_US + 10); } =20 --=20 2.34.1 From nobody Sat Oct 11 00:26:03 2025 Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) (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 859081F419A; Thu, 12 Jun 2025 06:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.41.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749711259; cv=none; b=abGOiI++gEgjVWhy+MuBPNDDchpDFQl2eUqsBreVy+15GYI40urNrCShHzRCZLisk6adBu6K9GG5IV725PiI5FtIO+vqR3iCcVCP8j9V13KODfbfJB53VvKmGvLAWwBWZvbExynZy72jUAdzVztk5O840FoOKGCQGAWBBeE4qt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749711259; c=relaxed/simple; bh=shvm3JSe1YLteXq1Iq05JnBx+znmHne5CKADCDUG+M0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GUs+TjhPRSJP0PaRCg4roeNSniWa90c7yJhZCXKl9wLmxbTdQCpUpWf0D1GFXfvxi60CrDUTzjuKiqJJWvREH7AvWQP63xhlkxitgQcQtexWqMj9sRdCTbk8Do9fKZFEL8E14C/dlzgqdKqOpBl/0K5/f1onEe3bsgjHSHFnSrE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emfend.at; spf=pass smtp.mailfrom=emfend.at; dkim=pass (1024-bit key) header.d=emfend.at header.i=@emfend.at header.b=iQWp9/ya; arc=none smtp.client-ip=168.119.41.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emfend.at Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emfend.at Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=emfend.at header.i=@emfend.at header.b="iQWp9/ya" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To: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=GHOXo2JErjFm80UUzfcS2rg1o0GmPsZ/2xPfv1KLyuY=; b=iQWp9/yaldM/wVqIkJ0rIbjJU3 RLWwU/m9Sa8gG5p8RjShnvFGZa+TnNcR/V1ifLMxWH76v+2X10xmiyMf2C9dt+zzTtTZdLky1F5wX zTydPovT+RkpxWJpNYOhD/QH5XjrrmocdgtbD/ELona3hGSSpD9G7GOwA5khXwF5Vq40=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:59918 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1uPbpG-003wuh-52; Thu, 12 Jun 2025 08:54:14 +0200 From: Matthias Fend Date: Thu, 12 Jun 2025 08:54:11 +0200 Subject: [PATCH 2/3] media: dw9714: move power sequences to dedicated functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250612-dw9714-v1-2-1a2d6d682829@emfend.at> References: <20250612-dw9714-v1-0-1a2d6d682829@emfend.at> In-Reply-To: <20250612-dw9714-v1-0-1a2d6d682829@emfend.at> To: Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Fend , bsp-development.geo@leica-geosystems.com X-Mailer: b4 0.14.2 X-Spam-Score: -1.0 X-Spam-Bar: - X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Just some minor coding style fixes reported by checkpatch. Signed-off-by: Matthias Fend --- drivers/media/i2c/dw9714.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Content analysis details: (-1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment Move the power-up and power-down sequences to their own functions. This is a preparation for the upcoming powerdown pin support. Signed-off-by: Matthias Fend --- drivers/media/i2c/dw9714.c | 44 +++++++++++++++++++++++++++++-------------= -- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 1392cddab738ce38efa18b2b9bd7821bddaa0626..2abd4fb5e7c0f02ab96bf8fa5f5= 57941187920a3 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -137,6 +137,24 @@ static int dw9714_init_controls(struct dw9714_device *= dev_vcm) return hdl->error; } =20 +static int dw9714_power_up(struct dw9714_device *dw9714_dev) +{ + int ret; + + ret =3D regulator_enable(dw9714_dev->vcc); + if (ret) + return ret; + + usleep_range(1000, 2000); + + return 0; +} + +static int dw9714_power_down(struct dw9714_device *dw9714_dev) +{ + return regulator_disable(dw9714_dev->vcc); +} + static int dw9714_probe(struct i2c_client *client) { struct dw9714_device *dw9714_dev; @@ -151,13 +169,10 @@ static int dw9714_probe(struct i2c_client *client) if (IS_ERR(dw9714_dev->vcc)) return PTR_ERR(dw9714_dev->vcc); =20 - rval =3D regulator_enable(dw9714_dev->vcc); - if (rval < 0) { - dev_err(&client->dev, "failed to enable vcc: %d\n", rval); - return rval; - } - - usleep_range(1000, 2000); + rval =3D dw9714_power_up(dw9714_dev); + if (rval) + return dev_err_probe(&client->dev, rval, + "failed to power up: %d\n", rval); =20 v4l2_i2c_subdev_init(&dw9714_dev->sd, client, &dw9714_ops); dw9714_dev->sd.flags |=3D V4L2_SUBDEV_FL_HAS_DEVNODE | @@ -185,7 +200,7 @@ static int dw9714_probe(struct i2c_client *client) return 0; =20 err_cleanup: - regulator_disable(dw9714_dev->vcc); + dw9714_power_down(dw9714_dev); v4l2_ctrl_handler_free(&dw9714_dev->ctrls_vcm); media_entity_cleanup(&dw9714_dev->sd.entity); =20 @@ -200,10 +215,10 @@ static void dw9714_remove(struct i2c_client *client) =20 pm_runtime_disable(&client->dev); if (!pm_runtime_status_suspended(&client->dev)) { - ret =3D regulator_disable(dw9714_dev->vcc); + ret =3D dw9714_power_down(dw9714_dev); if (ret) { dev_err(&client->dev, - "Failed to disable vcc: %d\n", ret); + "Failed to power down: %d\n", ret); } } pm_runtime_set_suspended(&client->dev); @@ -234,9 +249,9 @@ static int __maybe_unused dw9714_vcm_suspend(struct dev= ice *dev) usleep_range(DW9714_CTRL_DELAY_US, DW9714_CTRL_DELAY_US + 10); } =20 - ret =3D regulator_disable(dw9714_dev->vcc); + ret =3D dw9714_power_down(dw9714_dev); if (ret) - dev_err(dev, "Failed to disable vcc: %d\n", ret); + dev_err(dev, "Failed to power down: %d\n", ret); =20 return ret; } @@ -257,12 +272,11 @@ static int __maybe_unused dw9714_vcm_resume(struct de= vice *dev) if (pm_runtime_suspended(&client->dev)) return 0; =20 - ret =3D regulator_enable(dw9714_dev->vcc); + ret =3D dw9714_power_up(dw9714_dev); if (ret) { - dev_err(dev, "Failed to enable vcc: %d\n", ret); + dev_err(dev, "Failed to power up: %d\n", ret); return ret; } - usleep_range(1000, 2000); =20 for (val =3D dw9714_dev->current_val % DW9714_CTRL_STEPS; val < dw9714_dev->current_val + DW9714_CTRL_STEPS - 1; --=20 2.34.1 From nobody Sat Oct 11 00:26:03 2025 Received: from lx20.hoststar.hosting (lx20.hoststar.hosting [168.119.41.54]) (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 696771F5858; Thu, 12 Jun 2025 06:54:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.41.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749711259; cv=none; b=NaoXBiFQzY2Mp3ps/8ntLDbGysvNvYHRhvc/anVKnHu4K0J6lLqrge58oEe9okjjiT0mp3kpKxu171oeJs/sargx53hk3tm7Xq4jLnzjjwJUGIgTzS6zUzk75wVwhje+5qOINZF1SavTRu8t9x0SrC2a0agDK/kOU8c7I3iMZzc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749711259; c=relaxed/simple; bh=Avx/bZPrFIGD64hllwTAtrOlbzCtKU98XJKKjdws/7Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KMfkXaVW7aP1RvMtpGSpVAaPzm6rDaOn+OeFicd2v0I+Nf2Er/6PmQoOEpHOHdXotuVL3ex4hJi3yfdXlPxXJJYAWZ70Ie9JXpkDsg8OXiEyYS2YPMOZMNhN/3hxS1L2qmLcmQHIWeCTsxl/HsD7F7nAULCCruJx8Jkddo5sWng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emfend.at; spf=pass smtp.mailfrom=emfend.at; dkim=pass (1024-bit key) header.d=emfend.at header.i=@emfend.at header.b=REJ3WHGL; arc=none smtp.client-ip=168.119.41.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=emfend.at Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=emfend.at Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=emfend.at header.i=@emfend.at header.b="REJ3WHGL" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=emfend.at; s=mail; h=Cc:To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To: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=zWKIxha0h/MkAneWTZJnd3xYa0jCgEGPkTWolmK3Lus=; b=REJ3WHGLswoycqkWEzCFxy9Xhd NheqYQRxeV5g5mR3gZyuzL6aoQXCHLCX8AfFfQenkqzTDNedQzg/rzgFeCm918HLEKZkjGQfITMTH yslNAjMJEpVuwoLLKLO9BdGpVwGwF+9NJdOq3hAmMDcltryfJ4buueI7I62hvkw9tITw=; Received: from 194-208-208-245.tele.net ([194.208.208.245]:59918 helo=[127.0.1.1]) by lx20.hoststar.hosting with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1uPbpG-003wuh-PP; Thu, 12 Jun 2025 08:54:15 +0200 From: Matthias Fend Date: Thu, 12 Jun 2025 08:54:12 +0200 Subject: [PATCH 3/3] media: dw9714: add support for powerdown pin Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250612-dw9714-v1-3-1a2d6d682829@emfend.at> References: <20250612-dw9714-v1-0-1a2d6d682829@emfend.at> In-Reply-To: <20250612-dw9714-v1-0-1a2d6d682829@emfend.at> To: Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Fend , bsp-development.geo@leica-geosystems.com X-Mailer: b4 0.14.2 X-Spam-Score: -1.0 X-Spam-Bar: - X-Spam-Report: Spam detection software, running on the system "lx20.hoststar.hosting", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Move the power-up and power-down sequences to their own functions. This is a preparation for the upcoming powerdown pin support. Signed-off-by: Matthias Fend --- drivers/media/i2c/dw9714.c | 44 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+), 15 deletions(-) Content analysis details: (-1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 Local_hs1_NotHoststar Sender is not from hoststar.ch|de|com 0.0 TVD_RCVD_IP Message was received from an IP address 0.0 KAM_DMARC_STATUS Test Rule for DKIM or SPF Failure with Strict Alignment Add support for the powerdown pin (xSD), which can be used to put the VCM driver into power down mode. This is useful, for example, if the VCM driver's power supply cannot be controlled. The use of the powerdown pin is optional. Signed-off-by: Matthias Fend --- drivers/media/i2c/Kconfig | 2 +- drivers/media/i2c/dw9714.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index e45ba127069fc0848f1a06ceb789efd3c222c008..e923daeec9c574c5b8c7014b9e8= 3fcbad47866c0 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -748,7 +748,7 @@ config VIDEO_AK7375 =20 config VIDEO_DW9714 tristate "DW9714 lens voice coil support" - depends on I2C && VIDEO_DEV + depends on GPIOLIB && I2C && VIDEO_DEV select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API select V4L2_ASYNC diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 2abd4fb5e7c0f02ab96bf8fa5f557941187920a3..1e7ad355a388cfc37253bd764ec= 8df98f59beeea 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -2,6 +2,7 @@ // Copyright (c) 2015--2017 Intel Corporation. =20 #include +#include #include #include #include @@ -38,6 +39,7 @@ struct dw9714_device { struct v4l2_subdev sd; u16 current_val; struct regulator *vcc; + struct gpio_desc *powerdown_gpio; }; =20 static inline struct dw9714_device *to_dw9714_vcm(struct v4l2_ctrl *ctrl) @@ -145,6 +147,8 @@ static int dw9714_power_up(struct dw9714_device *dw9714= _dev) if (ret) return ret; =20 + gpiod_set_value_cansleep(dw9714_dev->powerdown_gpio, 0); + usleep_range(1000, 2000); =20 return 0; @@ -152,6 +156,8 @@ static int dw9714_power_up(struct dw9714_device *dw9714= _dev) =20 static int dw9714_power_down(struct dw9714_device *dw9714_dev) { + gpiod_set_value_cansleep(dw9714_dev->powerdown_gpio, 1); + return regulator_disable(dw9714_dev->vcc); } =20 @@ -169,6 +175,14 @@ static int dw9714_probe(struct i2c_client *client) if (IS_ERR(dw9714_dev->vcc)) return PTR_ERR(dw9714_dev->vcc); =20 + dw9714_dev->powerdown_gpio =3D devm_gpiod_get_optional(&client->dev, + "powerdown", + GPIOD_OUT_HIGH); + if (IS_ERR(dw9714_dev->powerdown_gpio)) + return dev_err_probe(&client->dev, + PTR_ERR(dw9714_dev->powerdown_gpio), + "could not get powerdown gpio\n"); + rval =3D dw9714_power_up(dw9714_dev); if (rval) return dev_err_probe(&client->dev, rval, --=20 2.34.1