From patchwork Thu Jan 4 15:49:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Seibold X-Patchwork-Id: 760093 Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (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 DB0E6249EA for ; Thu, 4 Jan 2024 15:49:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bernhard-seibold.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bernhard-seibold.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bernhard-seibold.de header.i=@bernhard-seibold.de header.b="M7vbTFJR" Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4T5WHY6LNwz9svV; Thu, 4 Jan 2024 16:49:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-seibold.de; s=MBO0001; t=1704383385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3ocmnRcbuvFQVKD+brebemDUKQhBnerstCOqxF24EiE=; b=M7vbTFJRsdfvFdxKLGvVZasCaIxh10fsoTOhxghiQFtcn+2gQMx/gK6nRwBsyaGqXxiJ+d JLLg58ypg36ojzRTuRaZwiyNgRLMW+z3TVKL4zi1785Omw2qVUtUyFrYuwhtLqEScmvCJ7 qtOSXhZ5pC6PI7zGOVmvZ7szYA5ha6tU5KU5B8oXHypajRbIyWwCl+d7J6Iba6QEeF3Bjs LFpix2BAnSstk1/QmVBGXVbSp4cAlIJVMaFdo08tDLb1OYPnrw6nMyrf+i8vkNgjXG+yNH 6DCu2yCFysjd7itQYenLRkPXL9eyuorlbf+kIH87ZBFv2baKx4oCXQ279eta/w== From: Bernhard Seibold To: linux-input@vger.kernel.org Cc: Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov , Hans de Goede , Jamie Lentin , Bernhard Seibold Subject: [PATCH 1/3] HID: input - Add microphone mute LED support Date: Thu, 4 Jan 2024 16:49:39 +0100 Message-ID: <20240104154941.6919-1-mail@bernhard-seibold.de> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Define an input event code for micmute led and enable sending it via HID Signed-off-by: Bernhard Seibold --- drivers/hid/hid-input.c | 1 + include/uapi/linux/input-event-codes.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index c8b20d44b147..96c595bb14ce 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -928,6 +928,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */ case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */ case 0x05: map_led (LED_KANA); break; /* "Kana" */ + case 0x21: map_led (LED_MICMUTE); break; /* "Microphone" */ case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */ case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */ case 0x09: map_led (LED_MUTE); break; /* "Mute" */ diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 022a520e31fc..f9a4f9040c59 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -952,6 +952,7 @@ #define LED_MISC 0x08 #define LED_MAIL 0x09 #define LED_CHARGING 0x0a +#define LED_MICMUTE 0x0b #define LED_MAX 0x0f #define LED_CNT (LED_MAX+1) From patchwork Thu Jan 4 15:49:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Seibold X-Patchwork-Id: 760964 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) (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 82C63249F5 for ; Thu, 4 Jan 2024 15:49:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bernhard-seibold.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bernhard-seibold.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bernhard-seibold.de header.i=@bernhard-seibold.de header.b="QmPL964c" Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4T5WHb117bz9ssn; Thu, 4 Jan 2024 16:49:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-seibold.de; s=MBO0001; t=1704383387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHPVlduRZzGfAUVMYF/x2qKCVMjH8lFztVJTg382NcI=; b=QmPL964cn4auvpOHzfy4y3o/HxUasYTeVzSCVDfo7e7rxW2g7xKeskgmdm0r/WoUvXEiuh /7eweqB/dviLkxCHOv6DIg2s8PpxOl9IZHpPk+5BV85JLVu1T2UjURDFxQuno1bgO9qtwB trYZZeUW46Ea+5NxTU1ZzZlKp6iQDdgnNHQnQHELcR71YaVYaU/qpCu3bJgAbkUu+moPiq OSg5OIA5HEnvr3Of1pZ0D7GsdPXnfhfeRO5cCcWIxoeVJa2jw6isl/qc3iO8IYsixpC5xz WQrhmjHWRofspN1ertbBUz5hv9vJ7IV3qrXBuGMj/9PB14fB5hFmPGqT/nMi6w== From: Bernhard Seibold To: linux-input@vger.kernel.org Cc: Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov , Hans de Goede , Jamie Lentin , Bernhard Seibold Subject: [PATCH 2/3] Input: leds - add micmute and triggers Date: Thu, 4 Jan 2024 16:49:40 +0100 Message-ID: <20240104154941.6919-2-mail@bernhard-seibold.de> In-Reply-To: <20240104154941.6919-1-mail@bernhard-seibold.de> References: <20240104154941.6919-1-mail@bernhard-seibold.de> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4T5WHb117bz9ssn Add microphone mute and add default triggers for mute and micmute Signed-off-by: Bernhard Seibold --- drivers/input/input-leds.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c index 0e935914bc3a..327a7aea4f26 100644 --- a/drivers/input/input-leds.c +++ b/drivers/input/input-leds.c @@ -18,6 +18,12 @@ #define VT_TRIGGER(_name) .trigger = NULL #endif +#if IS_ENABLED(CONFIG_LEDS_TRIGGER_AUDIO) +#define AUDIO_TRIGGER(_name) .trigger = _name +#else +#define AUDIO_TRIGGER(_name) .trigger = NULL +#endif + static const struct { const char *name; const char *trigger; @@ -29,7 +35,8 @@ static const struct { [LED_KANA] = { "kana", VT_TRIGGER("kbd-kanalock") }, [LED_SLEEP] = { "sleep" } , [LED_SUSPEND] = { "suspend" }, - [LED_MUTE] = { "mute" }, + [LED_MUTE] = { "mute", AUDIO_TRIGGER("audio-mute") }, + [LED_MICMUTE] = { "micmute", AUDIO_TRIGGER("audio-micmute") }, [LED_MISC] = { "misc" }, [LED_MAIL] = { "mail" }, [LED_CHARGING] = { "charging" }, From patchwork Thu Jan 4 15:49:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Seibold X-Patchwork-Id: 760092 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) (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 A33A4249E0 for ; Thu, 4 Jan 2024 15:49:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bernhard-seibold.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bernhard-seibold.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bernhard-seibold.de header.i=@bernhard-seibold.de header.b="tJTmcpGb" Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4T5WHc3qxVz9scN; Thu, 4 Jan 2024 16:49:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bernhard-seibold.de; s=MBO0001; t=1704383388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pejGJXiuFY1IZfLGoULiEKdL6L6leJG1TWmRmEqvmHc=; b=tJTmcpGbHbcxqQjq+K8nO3FBCYyDlbO4pt2VEm/qSE6jmpFQD4qw5pERA1E7AAaWy9oih4 QsXyXg9gxQP347LMUYcEpe93cMA4c9KPkE5p6SnPMqxz88HisA+6Prkcj1/dGhJIB3MwFp iDbcZpy/AKOJToMMOv3LygL0IiYHhwCjhUaSzzoRwJhuMG+1IoB2VhUfVGLBDjTMkpM8Sr 2CgGz36QGYzPvaEM6JxcJm/D3LZ+o2w3odgObyvTUPFoYaflfKbC2z5i93TCjsLfFBdLR0 X7O5sxXlSAhNo0/nWR38GXSMVLoLQ03PSZ4zlmuI4Z8Ph9aoJdcIYgMZ2Hvb8A== From: Bernhard Seibold To: linux-input@vger.kernel.org Cc: Jiri Kosina , Benjamin Tissoires , Dmitry Torokhov , Hans de Goede , Jamie Lentin , Bernhard Seibold Subject: [PATCH 3/3] HID: lenovo: Remove LEDs from tpkbd Date: Thu, 4 Jan 2024 16:49:41 +0100 Message-ID: <20240104154941.6919-3-mail@bernhard-seibold.de> In-Reply-To: <20240104154941.6919-1-mail@bernhard-seibold.de> References: <20240104154941.6919-1-mail@bernhard-seibold.de> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4T5WHc3qxVz9scN Since both LEDs are now supported by the input-leds module, the custom LEDs set via a proprietary method are no longer required. In fact they are duplicates that might interfere with each other. Signed-off-by: Bernhard Seibold --- drivers/hid/hid-lenovo.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 149a3c74346b..e3eae18fd4ab 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -1004,17 +1004,6 @@ static const struct attribute_group lenovo_attr_group_tpkbd = { .attrs = lenovo_attributes_tpkbd, }; -static void lenovo_led_set_tpkbd(struct hid_device *hdev) -{ - struct lenovo_drvdata *data_pointer = hid_get_drvdata(hdev); - struct hid_report *report; - - report = hdev->report_enum[HID_OUTPUT_REPORT].report_id_hash[3]; - report->field[0]->value[0] = (data_pointer->led_state >> 0) & 1; - report->field[0]->value[1] = (data_pointer->led_state >> 1) & 1; - hid_hw_request(hdev, report, HID_REQ_SET_REPORT); -} - static int lenovo_led_brightness_set(struct led_classdev *led_cdev, enum led_brightness value) { @@ -1034,9 +1023,6 @@ static int lenovo_led_brightness_set(struct led_classdev *led_cdev, data_pointer->led_state |= 1 << led_nr; switch (hdev->product) { - case USB_DEVICE_ID_LENOVO_TPKBD: - lenovo_led_set_tpkbd(hdev); - break; case USB_DEVICE_ID_LENOVO_TP10UBKBD: case USB_DEVICE_ID_LENOVO_X1_TAB: ret = lenovo_led_set_tp10ubkbd(hdev, tp10ubkbd_led[led_nr], value); @@ -1128,10 +1114,6 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev) hid_set_drvdata(hdev, data_pointer); - ret = lenovo_register_leds(hdev); - if (ret) - goto err; - lenovo_features_set_tpkbd(hdev); return 0; @@ -1315,9 +1297,6 @@ static void lenovo_remove_tpkbd(struct hid_device *hdev) sysfs_remove_group(&hdev->dev.kobj, &lenovo_attr_group_tpkbd); - - led_classdev_unregister(&data_pointer->led_micmute); - led_classdev_unregister(&data_pointer->led_mute); } static void lenovo_remove_cptkbd(struct hid_device *hdev)