Lines Matching +full:ec +full:- +full:codec

1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/input/sparse-keymap.h>
19 #include "dell-wmi-privacy.h"
21 #define DELL_PRIVACY_GUID "6932965F-1671-4CEB-B988-D3AB0A901919"
78 return priv && (priv->features_present & BIT(DELL_PRIVACY_TYPE_AUDIO)); in dell_privacy_has_mic_mute()
86 * 3) WMI event is received by dell-privacy
87 * 4) KEY_MICMUTE emitted from dell-privacy
89 * 6) Codec kernel driver catches and calls ledtrig_audio_set which will call
91 * 7) dell-privacy notifies EC, the timeout is cancelled and the HW mute activates.
92 * If the EC is not notified then the HW mic mute will activate when the timeout
108 key = sparse_keymap_entry_from_scancode(priv->input_dev, (type << 16) | code); in dell_privacy_process_event()
110 dev_warn(&priv->wdev->dev, "Unknown key with type 0x%04x and code 0x%04x pressed\n", in dell_privacy_process_event()
114 dev_dbg(&priv->wdev->dev, "Key with type 0x%04x and code 0x%04x pressed\n", type, code); in dell_privacy_process_event()
118 priv->last_status = status; in dell_privacy_process_event()
119 sparse_keymap_report_entry(priv->input_dev, key, 1, true); in dell_privacy_process_event()
123 priv->last_status = status; in dell_privacy_process_event()
124 sparse_keymap_report_entry(priv->input_dev, key, !(status & CAMERA_STATUS), false); in dell_privacy_process_event()
128 dev_dbg(&priv->wdev->dev, "unknown event type 0x%04x 0x%04x\n", type, code); in dell_privacy_process_event()
145 privacy_list = priv->features_present; in dell_privacy_supported_type_show()
161 u32 privacy_supported = priv->features_present; in dell_privacy_current_state_show()
163 u32 privacy_state = priv->last_status; in dell_privacy_current_state_show()
197 * 0 - None; 0x1 - Microphone; 0x2 - Camera; 0x4 - ePrivacy Screen
200 * 0 - Off; 1 - On; Bit0 - Microphone; Bit1 - Camera; Bit2 - ePrivacyScreen
205 struct privacy_wmi_data *priv = dev_get_drvdata(&wdev->dev); in get_current_status()
211 dev_err(&wdev->dev, "dell privacy priv is NULL\n"); in get_current_status()
212 return -EINVAL; in get_current_status()
217 dev_err(&wdev->dev, "failed to read Binary MOF\n"); in get_current_status()
218 return -EIO; in get_current_status()
221 if (obj_present->type != ACPI_TYPE_BUFFER) { in get_current_status()
222 dev_err(&wdev->dev, "Binary MOF is not a buffer!\n"); in get_current_status()
223 ret = -EIO; in get_current_status()
229 if (obj_present->buffer.length != 8) { in get_current_status()
230 dev_err(&wdev->dev, "Dell privacy buffer has unexpected length (%d)!\n", in get_current_status()
231 obj_present->buffer.length); in get_current_status()
232 ret = -EINVAL; in get_current_status()
235 buffer = (u32 *)obj_present->buffer.pointer; in get_current_status()
236 priv->features_present = buffer[0]; in get_current_status()
237 priv->last_status = buffer[1]; in get_current_status()
254 return -EIO; in dell_privacy_micmute_led_set()
257 return -EIO; in dell_privacy_micmute_led_set()
261 dev_err(&priv->wdev->dev, "Error setting privacy EC ack value: %s\n", in dell_privacy_micmute_led_set()
263 return -EIO; in dell_privacy_micmute_led_set()
272 * state of the HW mute. The reason for the EC "ack" is so that software
277 * If the EC receives the SW ack, the circuit will be activated before the
280 * Exposing as an LED device allows the codec drivers notification path to
281 * EC ACK to work
287 priv->cdev.name = "dell-privacy::micmute"; in dell_privacy_leds_setup()
288 priv->cdev.max_brightness = 1; in dell_privacy_leds_setup()
289 priv->cdev.brightness_set_blocking = dell_privacy_micmute_led_set; in dell_privacy_leds_setup()
290 priv->cdev.default_trigger = "audio-micmute"; in dell_privacy_leds_setup()
291 return devm_led_classdev_register(dev, &priv->cdev); in dell_privacy_leds_setup()
300 priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); in dell_privacy_wmi_probe()
302 return -ENOMEM; in dell_privacy_wmi_probe()
304 dev_set_drvdata(&wdev->dev, priv); in dell_privacy_wmi_probe()
305 priv->wdev = wdev; in dell_privacy_wmi_probe()
307 ret = get_current_status(priv->wdev); in dell_privacy_wmi_probe()
312 priv->input_dev = devm_input_allocate_device(&wdev->dev); in dell_privacy_wmi_probe()
313 if (!priv->input_dev) in dell_privacy_wmi_probe()
314 return -ENOMEM; in dell_privacy_wmi_probe()
320 return -ENOMEM; in dell_privacy_wmi_probe()
333 !(priv->features_present & BIT(DELL_PRIVACY_TYPE_CAMERA))) in dell_privacy_wmi_probe()
340 ret = sparse_keymap_setup(priv->input_dev, keymap, NULL); in dell_privacy_wmi_probe()
345 priv->input_dev->dev.parent = &wdev->dev; in dell_privacy_wmi_probe()
346 priv->input_dev->name = "Dell Privacy Driver"; in dell_privacy_wmi_probe()
347 priv->input_dev->id.bustype = BUS_HOST; in dell_privacy_wmi_probe()
349 /* Report initial camera-cover status */ in dell_privacy_wmi_probe()
350 if (priv->features_present & BIT(DELL_PRIVACY_TYPE_CAMERA)) in dell_privacy_wmi_probe()
351 input_report_switch(priv->input_dev, SW_CAMERA_LENS_COVER, in dell_privacy_wmi_probe()
352 !(priv->last_status & CAMERA_STATUS)); in dell_privacy_wmi_probe()
354 ret = input_register_device(priv->input_dev); in dell_privacy_wmi_probe()
358 if (priv->features_present & BIT(DELL_PRIVACY_TYPE_AUDIO)) { in dell_privacy_wmi_probe()
359 ret = dell_privacy_leds_setup(&priv->wdev->dev); in dell_privacy_wmi_probe()
364 list_add_tail(&priv->list, &wmi_list); in dell_privacy_wmi_probe()
371 struct privacy_wmi_data *priv = dev_get_drvdata(&wdev->dev); in dell_privacy_wmi_remove()
374 list_del(&priv->list); in dell_privacy_wmi_remove()
385 .name = "dell-privacy",