File tree Expand file tree Collapse file tree 4 files changed +35
-4
lines changed
Expand file tree Collapse file tree 4 files changed +35
-4
lines changed Original file line number Diff line number Diff line change 5959 ec_smb_da7 {
6060 gpios = <&gpiob 2 GPIO_INPUT>;
6161 };
62- mic_sw {
62+ gpio_mic_sw: mic_sw {
6363 gpios = <&gpioc 1 GPIO_INPUT>;
6464 };
6565 gpio_on_off_btn_l: on_off_btn_l {
157157 gpio_apu_ec_int2_l: apu_ec_int2_l {
158158 gpios = <&gpio7 4 GPIO_ODR_HIGH>; /* EC notify host HID interrupt 2*/
159159 };
160- cam_sw {
160+ gpio_cam_sw: cam_sw {
161161 gpios = <&gpio9 3 GPIO_INPUT>;
162162 };
163163 gpio_spok: pwr_3v5v_pg {
Original file line number Diff line number Diff line change @@ -240,6 +240,16 @@ struct ec_params_standalone_mode {
240240 uint8_t enable ;
241241} __ec_align1 ;
242242
243+ /*****************************************************************************/
244+ /*
245+ * This command returns the current state of the camera and microphone privacy switches
246+ */
247+ #define EC_CMD_PRIVACY_SWITCHES_CHECK_MODE 0x3E14
248+
249+ struct ec_response_privacy_switches_check {
250+ uint8_t microphone ;
251+ uint8_t camera ;
252+ } __ec_align1 ;
243253
244254/*****************************************************************************/
245255/*
Original file line number Diff line number Diff line change 7777 ec_smb_da7 {
7878 gpios = <&gpiob 2 GPIO_INPUT>;
7979 };
80- mic_sw {
80+ gpio_mic_sw: mic_sw {
8181 gpios = <&gpioc 1 GPIO_INPUT>;
8282 };
8383 gpu_b_gpio00_ec {
257257 i2c_int_tp_2 {
258258 gpios = <&gpio9 6 GPIO_INPUT>; /* HUB board TP module */
259259 };
260- cam_sw {
260+ gpio_cam_sw: cam_sw {
261261 gpios = <&gpio9 3 GPIO_INPUT>;
262262 };
263263 gpio_spok: spok {
Original file line number Diff line number Diff line change @@ -417,6 +417,27 @@ static enum ec_status host_command_uefi_app_btn_status(struct host_cmd_handler_a
417417DECLARE_HOST_COMMAND (EC_CMD_UEFI_APP_BTN_STATUS , host_command_uefi_app_btn_status , EC_VER_MASK (0 ));
418418#endif /* CONFIG_BOARD_LOTUS */
419419
420+ static enum ec_status privacy_switches_check (struct host_cmd_handler_args * args )
421+ {
422+ struct ec_response_privacy_switches_check * r = args -> response ;
423+
424+ /*
425+ * Camera is low when off, microphone is high when off
426+ * Return 0 when off/close and 1 when high/open
427+ */
428+ r -> microphone = !gpio_pin_get_dt (GPIO_DT_FROM_NODELABEL (gpio_mic_sw ));
429+ r -> camera = gpio_pin_get_dt (GPIO_DT_FROM_NODELABEL (gpio_cam_sw ));
430+
431+ CPRINTS ("Microphone switch open: %d" , r -> microphone );
432+ CPRINTS ("Camera switch open: %d" , r -> camera );
433+
434+ args -> response_size = sizeof (* r );
435+
436+ return EC_RES_SUCCESS ;
437+
438+ }
439+ DECLARE_HOST_COMMAND (EC_CMD_PRIVACY_SWITCHES_CHECK_MODE , privacy_switches_check , EC_VER_MASK (0 ));
440+
420441/*******************************************************************************/
421442/* EC console command for Project */
422443/*******************************************************************************/
You can’t perform that action at this time.
0 commit comments