arm64: dts: qcom: glymur-lenovo-yoga-slim7x: add the camera privacy switch
PATCH 1/1 arm64: dts: qcom: glymur-lenovo-yoga-slim7x: add the camera privacy switch
The laptop has a camera privacy switch on the side of the top case - a slider, not a mechanical cover over the lens, and it does nothing to the camera itself. TLMM gpio99 follows its position: high with the switch open, low with it engaged. Describe it as a gpio-keys switch so userspace can act on it.
SW_CAMERA_LENS_COVER is the only switch code the input layer has for a camera privacy state, and it is what the Lenovo WMI camera driver and Dell's privacy driver report for the same kind of electronic switch on x86 machines, so use it here as well despite the name.
The embedded controller also raises event 0x29 whenever the switch moves, which makes it tempting to report it from the EC driver instead. That would be the wrong layer: the pin is a plain level that tracks the slider position and needs no EC transaction to read, and the EC event carries nothing the pin does not already say.
--- .../boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts +14 -1
@@ -51,7 +51,7 @@ sleep_clk: sleep-clk { gpio-keys { compatible = "gpio-keys"; - pinctrl-0 = <&hall_int_n_default>; + pinctrl-0 = <&hall_int_n_default>, <&cam_privacy_default>; pinctrl-names = "default"; switch-lid {
@@ -62,6 +62,13 @@ switch-lid { wakeup-source; wakeup-event-action = <EV_ACT_DEASSERTED>; }; + + switch-camera-privacy { + label = "camera privacy switch"; + gpios = <&tlmm 99 GPIO_ACTIVE_LOW>; + linux,input-type = <EV_SW>; + linux,code = <SW_CAMERA_LENS_COVER>; + }; }; leds {
@@ -958,6 +965,12 @@ tpad_default: tpad-default-state { bias-disable; }; + cam_privacy_default: cam-privacy-default-state { + pins = "gpio99"; + function = "gpio"; + bias-pull-up; + }; + edp_bl_en: edp-bl-en-state { pins = "gpio18"; function = "gpio";
Signature · 4 lines
2.55.0 base-commit: 68142f986ff04b2b70b31db00f719bf690f64a9a
Quoted 36 lines · Oleg Keri
The laptop has a camera privacy switch on the side of the top case - a slider, not a mechanical cover over the lens, and it does nothing to the camera itself. TLMM gpio99 follows its position: high with the switch open, low with it engaged. Describe it as a gpio-keys switch so userspace can act on it.
SW_CAMERA_LENS_COVERis the only switch code the input layer has for a camera privacy state, and it is what the Lenovo WMI camera driver and Dell's privacy driver report for the same kind of electronic switch on x86 machines, so use it here as well despite the name.The embedded controller also raises event
0x29whenever the switch moves, which makes it tempting to report it from the EC driver instead. That would be the wrong layer: the pin is a plain level that tracks the slider position and needs no EC transaction to read, and the EC event carries nothing the pin does not already say.Signed-off-by Oleg Keri <[email protected]>--- .../boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)arch/arm64/boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts +1
-1@@ -51,7 +51,7 @@ sleep_clk: sleep-clk { gpio-keys { compatible = "gpio-keys"; - pinctrl-0 = <&hall_int_n_default>; + pinctrl-0 = <&hall_int_n_default>, <&cam_privacy_default>; pinctrl-names = "default"; switch-lid {
arch/arm64/boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts switch-lid { · line 67
Quoted 6 lines
arch/arm64/boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts +3
-0@@ -62,6 +62,13 @@ switch-lid { wakeup-source; wakeup-event-action = <EV_ACT_DEASSERTED>; }; + + switch-camera-privacy { + label = "camera privacy switch";
nit: other DTs normally capitalize this
[...]
arch/arm64/boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts tpad_default: tpad-default-state { · line 972
Quoted 5 lines
arch/arm64/boot/dts/qcom/glymur-lenovo-yoga-slim7x.dts +5
-0+ cam_privacy_default: cam-privacy-default-state { + pins = "gpio99"; + function = "gpio"; + bias-pull-up; + };
And the pin entries are normally sorted by their GPIO index
Otherwise, this looks good!
Konrad