From: Hans de Goede <hdegoede@redhat.com>
To: Mark Gross <markgross@kernel.org>,
Andy Shevchenko <andy@kernel.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Linus Walleij <linus.walleij@linaro.org>,
Daniel Scally <djrscally@gmail.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org, linux-gpio@vger.kernel.org,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Kate Hsuan <hpa@redhat.com>,
linux-media@vger.kernel.org
Subject: [PATCH 4/5] media: ov8865: Add support for a privacy-led GPIO
Date: Mon, 28 Nov 2022 22:44:07 +0100 [thread overview]
Message-ID: <20221128214408.165726-5-hdegoede@redhat.com> (raw)
In-Reply-To: <20221128214408.165726-1-hdegoede@redhat.com>
Add support for a privacy-led GPIO.
Making the privacy LED to controlable from userspace, as using the LED
class subsystem would do, would make it too easy for spy-ware to disable
the LED.
To avoid this have the sensor driver directly control the LED.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Note an additional advantage of directly controlling the GPIO is that
GPIOs are tied directly to consumer devices. Where as with a LED class
device, there would need to be some mechanism to tie the right LED
(e.g front or back) to the right sensor.
---
drivers/media/i2c/ov8865.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index cae1866134a0..fe86b166b28b 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -688,6 +688,7 @@ struct ov8865_sensor {
struct i2c_client *i2c_client;
struct gpio_desc *reset;
struct gpio_desc *powerdown;
+ struct gpio_desc *privacy_led;
struct regulator *avdd;
struct regulator *dvdd;
struct regulator *dovdd;
@@ -2432,10 +2433,12 @@ static int ov8865_sensor_power(struct ov8865_sensor *sensor, bool on)
gpiod_set_value_cansleep(sensor->reset, 0);
gpiod_set_value_cansleep(sensor->powerdown, 0);
+ gpiod_set_value_cansleep(sensor->privacy_led, 1);
/* Time to enter streaming mode according to power timings. */
usleep_range(10000, 12000);
} else {
+ gpiod_set_value_cansleep(sensor->privacy_led, 0);
gpiod_set_value_cansleep(sensor->powerdown, 1);
gpiod_set_value_cansleep(sensor->reset, 1);
@@ -3009,6 +3012,12 @@ static int ov8865_probe(struct i2c_client *client)
goto error_endpoint;
}
+ sensor->privacy_led = devm_gpiod_get_optional(dev, "privacy-led", GPIOD_OUT_LOW);
+ if (IS_ERR(sensor->privacy_led)) {
+ ret = PTR_ERR(sensor->privacy_led);
+ goto error_endpoint;
+ }
+
/* External Clock */
sensor->extclk = devm_clk_get(dev, NULL);
--
2.38.1
next prev parent reply other threads:[~2022-11-28 21:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 21:44 [PATCH 0/5] gpio/media/int3472: Add support for tps68470 privacy-LED output Hans de Goede
2022-11-28 21:44 ` [PATCH 1/5] gpio: tps68470: Fix tps68470_gpio_get() reading from the wrong register Hans de Goede
2022-11-29 10:22 ` Andy Shevchenko
2022-11-29 11:27 ` Hans de Goede
2022-11-29 11:56 ` Andy Shevchenko
2022-11-29 12:19 ` Hans de Goede
2022-11-29 12:34 ` Andy Shevchenko
2022-11-29 12:59 ` Hans de Goede
2022-11-30 15:16 ` Dan Scally
2022-11-28 21:44 ` [PATCH 2/5] gpio: tps68470: Make tps68470_gpio_output() always set the initial value Hans de Goede
2022-11-29 10:24 ` Andy Shevchenko
2022-11-29 11:33 ` Hans de Goede
2022-11-30 16:04 ` Dan Scally
2022-11-28 21:44 ` [PATCH 3/5] gpio: tps68470: Add support for the indicator LED outputs Hans de Goede
2022-11-29 10:28 ` Andy Shevchenko
2022-11-29 11:32 ` Hans de Goede
2022-11-29 11:59 ` Andy Shevchenko
2022-11-29 12:20 ` Hans de Goede
2022-11-29 12:35 ` Andy Shevchenko
2022-11-28 21:44 ` Hans de Goede [this message]
2022-11-28 21:44 ` [PATCH 5/5] platform/x86: int3472: Add support for the back privacy LED on Surface Go models Hans de Goede
2022-12-03 9:32 ` [PATCH 0/5] gpio/media/int3472: Add support for tps68470 privacy-LED output Linus Walleij
2022-12-03 12:28 ` Hans de Goede
2022-12-05 15:01 ` Hans de Goede
2022-12-05 21:26 ` Laurent Pinchart
2022-12-05 21:37 ` Hans de Goede
2022-12-07 0:25 ` Linus Walleij
2022-12-07 17:37 ` Hans de Goede
2022-12-05 9:18 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221128214408.165726-5-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy@kernel.org \
--cc=bgolaszewski@baylibre.com \
--cc=djrscally@gmail.com \
--cc=hpa@redhat.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).