diff options
| author | Adrian Betschart <adrian.betschart@cinemaone.ch> | 2026-09-11 17:13:14 +0200 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-10-01 17:18:05 -0400 |
| commit | 106b4a2a78b2a2f14885604891957b84bba502db (patch) | |
| tree | 5d40eef2428fb1a4791ab46a4b19091a5910eac2 /drivers/hid/hid-rapoo.c | |
| download | linux-stable-106b4a2a78b2a2f14885604891957b84bba502db.tar.gz linux-stable-106b4a2a78b2a2f14885604891957b84bba502db.zip | |
drm/amd/display: Try RGB before YCbCr 4:4:4 in stream validationgrafted
amdgpu_dm_create_validate_stream_for_sink() walks encoding_order[] and
uses the first encoding that validates. YCbCr 4:4:4 is listed before
RGB, so an HDMI sink that advertises 4:4:4 gets YCbCr 4:4:4 whenever the
"color format" property is left at AUTO, even though RGB fits the same
link.
That contradicts the documented AUTO behaviour for HDMI in enum
drm_connector_color_format (RGB, falling back to YCbCr 4:2:0 only when
the bandwidth is not available or the mode is 4:2:0-only), which the
amdgpu implementation of the property also describes. It also leaves
the "Broadcast RGB" property without effect on such sinks, since the
quantization range it selects only applies to RGB output.
Try RGB first. The mask still holds every encoding the sink supports,
so a mode that cannot carry RGB falls back exactly as before.
For reference, v7.2 picked RGB here unless YCbCr 4:4:4 was forced
through debugfs, while earlier kernels picked YCbCr 4:4:4 for any HDMI
sink that advertised it.
Fixes: 0b0ff65d3ca1 ("drm/amd/display: Refactor stream validation")
Suggested-by: Adolfo Rodrigues <adolfotregosa@gmail.com>
Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Adrian Betschart <adrian.betschart@cinemaone.ch>
Reviewed-by: Fangzhi Zuo <jerry.zuo@amd.com>
Tested-by: Adolfo Rodrigues <adolfotregosa@gmail.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 7de432bc753133764dc40d37f9388da56de251e7)
Diffstat (limited to 'drivers/hid/hid-rapoo.c')
| -rw-r--r-- | drivers/hid/hid-rapoo.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/hid/hid-rapoo.c b/drivers/hid/hid-rapoo.c new file mode 100644 index 000000000..5c9c396fa --- /dev/null +++ b/drivers/hid/hid-rapoo.c @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <asm-generic/errno-base.h> +#include <asm-generic/int-ll64.h> +#include <linux/bitops.h> +#include <linux/input.h> +#include <linux/input-event-codes.h> +#include <linux/module.h> +#include <linux/hid.h> +#include <linux/usb.h> + +#include "hid-ids.h" + +#define RAPOO_BTN_BACK 0x08 +#define RAPOO_BTN_FORWARD 0x10 + +static const struct hid_device_id rapoo_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_RAPOO, USB_DEVICE_ID_RAPOO_2_4G_RECEIVER) }, + { } +}; +MODULE_DEVICE_TABLE(hid, rapoo_devices); + +static int rapoo_probe(struct hid_device *hdev, const struct hid_device_id *id) +{ + int ret; + struct input_dev *input; + + ret = hid_parse(hdev); + if (ret) { + hid_err(hdev, "parse failed\n"); + return ret; + } + + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + if (ret) { + hid_err(hdev, "start failed\n"); + return ret; + } + + if (hid_is_usb(hdev)) { + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); + + if (intf->cur_altsetting->desc.bInterfaceNumber != 1) + return 0; + } + + input = devm_input_allocate_device(&hdev->dev); + if (!input) + return -ENOMEM; + + input->name = "Rapoo 2.4G Wireless Mouse"; + input->phys = "rapoo/input1"; + input->id.bustype = hdev->bus; + input->id.vendor = hdev->vendor; + input->id.product = hdev->product; + input->id.version = hdev->version; + + __set_bit(EV_KEY, input->evbit); + __set_bit(KEY_BACK, input->keybit); + __set_bit(KEY_FORWARD, input->keybit); + + ret = input_register_device(input); + if (ret) + return ret; + + hid_set_drvdata(hdev, input); + + return ret; +} + +static int rapoo_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) +{ + struct input_dev *input = hid_get_drvdata(hdev); + + if (!input) + return 0; + + if (report->id == 1 && size >= 2) { + u8 btn = data[1]; + + input_report_key(input, KEY_BACK, btn & RAPOO_BTN_BACK); + input_report_key(input, KEY_FORWARD, btn & RAPOO_BTN_FORWARD); + input_sync(input); + return 1; + } + + return 0; +} + +static struct hid_driver rapoo_driver = { + .name = "hid-rapoo", + .id_table = rapoo_devices, + .probe = rapoo_probe, + .raw_event = rapoo_raw_event, +}; + +module_hid_driver(rapoo_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Nguyen Dinh Dang Duong <dangduong31205@gmail.com>"); +MODULE_DESCRIPTION("RAPOO 2.4G Wireless Device Driver"); + |
