diff --git a/packages/linux/patches/default/linux-999-Revert-drm_i915_edp-Allow-alternate-fixed-mode-for-eDP-if-available.patch b/packages/linux/patches/default/linux-999-Revert-drm_i915_edp-Allow-alternate-fixed-mode-for-eDP-if-available.patch deleted file mode 100644 index 83ac849027..0000000000 --- a/packages/linux/patches/default/linux-999-Revert-drm_i915_edp-Allow-alternate-fixed-mode-for-eDP-if-available.patch +++ /dev/null @@ -1,242 +0,0 @@ -From 997fbfe5508bc7d29fdf0a7a103f3864d4db380a Mon Sep 17 00:00:00 2001 -Message-Id: <997fbfe5508bc7d29fdf0a7a103f3864d4db380a.1528140572.git.jan.steffens@gmail.com> -In-Reply-To: -References: -From: Jani Nikula -Date: Wed, 16 May 2018 11:01:10 +0300 -Subject: [PATCH 2/2] Revert "drm/i915/edp: Allow alternate fixed mode for eDP - if available." - -This reverts commit dc911f5bd8aacfcf8aabd5c26c88e04c837a938e. - -Per the report, no matter what display mode you select with xrandr, the -i915 driver will always select the alternate fixed mode. For the -reporter this means that the display will always run at 40Hz which is -quite annoying. This may be due to the mode comparison. - -But there are some other potential issues. The choice of alt_fixed_mode -seems dubious. It's the first non-preferred mode, but there are no -guarantees that the only difference would be refresh rate. Similarly, -there may be more than one preferred mode in the probed modes list, and -the commit changes the preferred mode selection to choose the last one -on the list instead of the first. - -(Note that the probed modes list is the raw, unfiltered, unsorted list -of modes from drm_add_edid_modes(), not the pretty result after a -drm_helper_probe_single_connector_modes() call.) - -Finally, we already have eerily similar code in place to find the -downclock mode for DRRS that seems like could be reused here. - -Back to the drawing board. - -Note: This is a hand-crafted revert due to conflicts. If it fails to -backport, please just try reverting the original commit directly. - -Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105469 -Reported-by: Rune Petersen -Reported-by: Mark Spencer -Fixes: dc911f5bd8aa ("drm/i915/edp: Allow alternate fixed mode for eDP if available.") -Cc: Clint Taylor -Cc: David Weinehall -Cc: Rodrigo Vivi -Cc: Paulo Zanoni -Cc: Jani Nikula -Cc: Chris Wilson -Cc: Jim Bride -Cc: Jani Nikula -Cc: Joonas Lahtinen -Cc: intel-gfx@lists.freedesktop.org -Cc: # v4.14+ -Signed-off-by: Jani Nikula -Reviewed-by: Dhinakaran Pandiyan -Link: https://patchwork.freedesktop.org/patch/msgid/20180516080110.22770-1-jani.nikula@intel.com ---- - drivers/gpu/drm/i915/intel_dp.c | 38 ++++-------------------------- - drivers/gpu/drm/i915/intel_drv.h | 2 -- - drivers/gpu/drm/i915/intel_dsi.c | 2 +- - drivers/gpu/drm/i915/intel_dvo.c | 2 +- - drivers/gpu/drm/i915/intel_lvds.c | 3 +-- - drivers/gpu/drm/i915/intel_panel.c | 6 ----- - 6 files changed, 8 insertions(+), 45 deletions(-) - -diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c -index b7b4cfdeb974..48cb8df5ae97 100644 ---- a/drivers/gpu/drm/i915/intel_dp.c -+++ b/drivers/gpu/drm/i915/intel_dp.c -@@ -1671,23 +1671,6 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp, - return bpp; - } - --static bool intel_edp_compare_alt_mode(struct drm_display_mode *m1, -- struct drm_display_mode *m2) --{ -- bool bres = false; -- -- if (m1 && m2) -- bres = (m1->hdisplay == m2->hdisplay && -- m1->hsync_start == m2->hsync_start && -- m1->hsync_end == m2->hsync_end && -- m1->htotal == m2->htotal && -- m1->vdisplay == m2->vdisplay && -- m1->vsync_start == m2->vsync_start && -- m1->vsync_end == m2->vsync_end && -- m1->vtotal == m2->vtotal); -- return bres; --} -- - bool - intel_dp_compute_config(struct intel_encoder *encoder, - struct intel_crtc_state *pipe_config, -@@ -1734,16 +1717,8 @@ intel_dp_compute_config(struct intel_encoder *encoder, - pipe_config->has_audio = intel_conn_state->force_audio == HDMI_AUDIO_ON; - - if (intel_dp_is_edp(intel_dp) && intel_connector->panel.fixed_mode) { -- struct drm_display_mode *panel_mode = -- intel_connector->panel.alt_fixed_mode; -- struct drm_display_mode *req_mode = &pipe_config->base.mode; -- -- if (!intel_edp_compare_alt_mode(req_mode, panel_mode)) -- panel_mode = intel_connector->panel.fixed_mode; -- -- drm_mode_debug_printmodeline(panel_mode); -- -- intel_fixed_panel_mode(panel_mode, adjusted_mode); -+ intel_fixed_panel_mode(intel_connector->panel.fixed_mode, -+ adjusted_mode); - - if (INTEL_GEN(dev_priv) >= 9) { - int ret; -@@ -6121,7 +6096,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, - struct drm_i915_private *dev_priv = to_i915(dev); - struct drm_connector *connector = &intel_connector->base; - struct drm_display_mode *fixed_mode = NULL; -- struct drm_display_mode *alt_fixed_mode = NULL; - struct drm_display_mode *downclock_mode = NULL; - bool has_dpcd; - struct drm_display_mode *scan; -@@ -6176,14 +6150,13 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, - } - intel_connector->edid = edid; - -- /* prefer fixed mode from EDID if available, save an alt mode also */ -+ /* prefer fixed mode from EDID if available */ - list_for_each_entry(scan, &connector->probed_modes, head) { - if ((scan->type & DRM_MODE_TYPE_PREFERRED)) { - fixed_mode = drm_mode_duplicate(dev, scan); - downclock_mode = intel_dp_drrs_init( - intel_connector, fixed_mode); -- } else if (!alt_fixed_mode) { -- alt_fixed_mode = drm_mode_duplicate(dev, scan); -+ break; - } - } - -@@ -6220,8 +6193,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, - pipe_name(pipe)); - } - -- intel_panel_init(&intel_connector->panel, fixed_mode, alt_fixed_mode, -- downclock_mode); -+ intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); - intel_connector->panel.backlight.power = intel_edp_backlight_power; - intel_panel_setup_backlight(connector, pipe); - -diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h -index a80fbad9be0f..7f3e83f17adb 100644 ---- a/drivers/gpu/drm/i915/intel_drv.h -+++ b/drivers/gpu/drm/i915/intel_drv.h -@@ -269,7 +269,6 @@ struct intel_encoder { - - struct intel_panel { - struct drm_display_mode *fixed_mode; -- struct drm_display_mode *alt_fixed_mode; - struct drm_display_mode *downclock_mode; - - /* backlight */ -@@ -1820,7 +1819,6 @@ void intel_overlay_reset(struct drm_i915_private *dev_priv); - /* intel_panel.c */ - int intel_panel_init(struct intel_panel *panel, - struct drm_display_mode *fixed_mode, -- struct drm_display_mode *alt_fixed_mode, - struct drm_display_mode *downclock_mode); - void intel_panel_fini(struct intel_panel *panel); - void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode, -diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c -index 51a1d6868b1e..cf39ca90d887 100644 ---- a/drivers/gpu/drm/i915/intel_dsi.c -+++ b/drivers/gpu/drm/i915/intel_dsi.c -@@ -1846,7 +1846,7 @@ void intel_dsi_init(struct drm_i915_private *dev_priv) - connector->display_info.width_mm = fixed_mode->width_mm; - connector->display_info.height_mm = fixed_mode->height_mm; - -- intel_panel_init(&intel_connector->panel, fixed_mode, NULL, NULL); -+ intel_panel_init(&intel_connector->panel, fixed_mode, NULL); - intel_panel_setup_backlight(connector, INVALID_PIPE); - - intel_dsi_add_properties(intel_connector); -diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c -index eb0c559b2715..a70d767313aa 100644 ---- a/drivers/gpu/drm/i915/intel_dvo.c -+++ b/drivers/gpu/drm/i915/intel_dvo.c -@@ -536,7 +536,7 @@ void intel_dvo_init(struct drm_i915_private *dev_priv) - */ - intel_panel_init(&intel_connector->panel, - intel_dvo_get_current_mode(intel_encoder), -- NULL, NULL); -+ NULL); - intel_dvo->panel_wants_dither = true; - } - -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c -index e125d16a1aa7..d278f24ba6ae 100644 ---- a/drivers/gpu/drm/i915/intel_lvds.c -+++ b/drivers/gpu/drm/i915/intel_lvds.c -@@ -1175,8 +1175,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) - out: - mutex_unlock(&dev->mode_config.mutex); - -- intel_panel_init(&intel_connector->panel, fixed_mode, NULL, -- downclock_mode); -+ intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); - intel_panel_setup_backlight(connector, INVALID_PIPE); - - lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder); -diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c -index 41d00b1603e3..b443278e569c 100644 ---- a/drivers/gpu/drm/i915/intel_panel.c -+++ b/drivers/gpu/drm/i915/intel_panel.c -@@ -1928,30 +1928,24 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel) - - int intel_panel_init(struct intel_panel *panel, - struct drm_display_mode *fixed_mode, -- struct drm_display_mode *alt_fixed_mode, - struct drm_display_mode *downclock_mode) - { - intel_panel_init_backlight_funcs(panel); - - panel->fixed_mode = fixed_mode; -- panel->alt_fixed_mode = alt_fixed_mode; - panel->downclock_mode = downclock_mode; - - return 0; - } - - void intel_panel_fini(struct intel_panel *panel) - { - struct intel_connector *intel_connector = - container_of(panel, struct intel_connector, panel); - - if (panel->fixed_mode) - drm_mode_destroy(intel_connector->base.dev, panel->fixed_mode); - -- if (panel->alt_fixed_mode) -- drm_mode_destroy(intel_connector->base.dev, -- panel->alt_fixed_mode); -- - if (panel->downclock_mode) - drm_mode_destroy(intel_connector->base.dev, - panel->downclock_mode); --- -2.17.1 - diff --git a/packages/linux/patches/default/linux-999-backport-4.18-nuvoton-cir-fix.patch b/packages/linux/patches/default/linux-999-backport-4.18-nuvoton-cir-fix.patch deleted file mode 100644 index 2f6b940b10..0000000000 --- a/packages/linux/patches/default/linux-999-backport-4.18-nuvoton-cir-fix.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 70c30b1ea706affcb117e3cd3065690abca5ba69 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C5=82=20Winiarski?= -Date: Mon, 21 May 2018 10:38:01 -0400 -Subject: [PATCH] media: rc: nuvoton: Tweak the interrupt enabling dance -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -It appears that we need to enable CIR device before attempting to touch -some of the registers. Previously, this was not a big issue, since we -were rarely seeing nvt_close() getting called. - -Unfortunately, since commit cb84343fced1 ("media: lirc: do not call close() -or open() on unregistered devices") the initial open() during probe from -rc_setup_rx_device() is no longer successful, which means that userspace -clients will actually end up calling nvt_open()/nvt_close(). Since -nvt_open() is broken, the device doesn't seem to work as expected. - -Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199597 - -Signed-off-by: MichaƂ Winiarski -Cc: Jarod Wilson -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/nuvoton-cir.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c -index 5e1d866a61a5..ce8949b6549d 100644 ---- a/drivers/media/rc/nuvoton-cir.c -+++ b/drivers/media/rc/nuvoton-cir.c -@@ -922,6 +922,9 @@ static int nvt_open(struct rc_dev *dev) - struct nvt_dev *nvt = dev->priv; - unsigned long flags; - -+ /* enable the CIR logical device */ -+ nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); -+ - spin_lock_irqsave(&nvt->lock, flags); - - /* set function enable flags */ -@@ -937,9 +940,6 @@ static int nvt_open(struct rc_dev *dev) - - spin_unlock_irqrestore(&nvt->lock, flags); - -- /* enable the CIR logical device */ -- nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); -- - return 0; - } - --- -2.11.0 - diff --git a/packages/linux/patches/default/linux-999-improve-ir-timeout-handling.patch b/packages/linux/patches/default/linux-999-improve-ir-timeout-handling.patch deleted file mode 100644 index f50138ada9..0000000000 --- a/packages/linux/patches/default/linux-999-improve-ir-timeout-handling.patch +++ /dev/null @@ -1,1051 +0,0 @@ -From 53b3bcf17209cd9b01d8b31c21eee8f0f30cf4dc Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Fri, 23 Mar 2018 16:47:37 -0400 -Subject: [PATCH 01/12] media: rc: set timeout to smallest value required by - enabled protocols - -The longer the IR timeout, the longer the rc device waits until delivering -the trailing space. So, by reducing this timeout, we reduce the delay for -the last scancode to be delivered. - -Note that the lirc daemon disables all protocols, in which case we revert -back to the default value. - -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/ir-imon-decoder.c | 1 + - drivers/media/rc/ir-jvc-decoder.c | 1 + - drivers/media/rc/ir-mce_kbd-decoder.c | 1 + - drivers/media/rc/ir-nec-decoder.c | 1 + - drivers/media/rc/ir-rc5-decoder.c | 1 + - drivers/media/rc/ir-rc6-decoder.c | 1 + - drivers/media/rc/ir-sanyo-decoder.c | 1 + - drivers/media/rc/ir-sharp-decoder.c | 1 + - drivers/media/rc/ir-sony-decoder.c | 1 + - drivers/media/rc/ir-xmp-decoder.c | 1 + - drivers/media/rc/rc-core-priv.h | 1 + - drivers/media/rc/rc-ir-raw.c | 31 ++++++++++++++++++++++++++++++- - drivers/media/rc/rc-main.c | 12 ++++++------ - 13 files changed, 47 insertions(+), 7 deletions(-) - -diff --git a/drivers/media/rc/ir-imon-decoder.c b/drivers/media/rc/ir-imon-decoder.c -index a1ff06a..52ea3b2 100644 ---- a/drivers/media/rc/ir-imon-decoder.c -+++ b/drivers/media/rc/ir-imon-decoder.c -@@ -170,6 +170,7 @@ static struct ir_raw_handler imon_handler = { - .decode = ir_imon_decode, - .encode = ir_imon_encode, - .carrier = 38000, -+ .min_timeout = IMON_UNIT * IMON_BITS * 2, - }; - - static int __init ir_imon_decode_init(void) -diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c -index 8cb68ae..5706cfe 100644 ---- a/drivers/media/rc/ir-jvc-decoder.c -+++ b/drivers/media/rc/ir-jvc-decoder.c -@@ -213,6 +213,7 @@ static struct ir_raw_handler jvc_handler = { - .decode = ir_jvc_decode, - .encode = ir_jvc_encode, - .carrier = 38000, -+ .min_timeout = JVC_TRAILER_SPACE, - }; - - static int __init ir_jvc_decode_init(void) -diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c -index d94f1c1..03d0f7e 100644 ---- a/drivers/media/rc/ir-mce_kbd-decoder.c -+++ b/drivers/media/rc/ir-mce_kbd-decoder.c -@@ -479,6 +479,7 @@ static struct ir_raw_handler mce_kbd_handler = { - .raw_register = ir_mce_kbd_register, - .raw_unregister = ir_mce_kbd_unregister, - .carrier = 36000, -+ .min_timeout = MCIR2_MAX_LEN + MCIR2_UNIT / 2, - }; - - static int __init ir_mce_kbd_decode_init(void) -diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c -index 21647b8..6a8973a 100644 ---- a/drivers/media/rc/ir-nec-decoder.c -+++ b/drivers/media/rc/ir-nec-decoder.c -@@ -253,6 +253,7 @@ static struct ir_raw_handler nec_handler = { - .decode = ir_nec_decode, - .encode = ir_nec_encode, - .carrier = 38000, -+ .min_timeout = NEC_TRAILER_SPACE, - }; - - static int __init ir_nec_decode_init(void) -diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c -index 74d3b85..cbfaadb 100644 ---- a/drivers/media/rc/ir-rc5-decoder.c -+++ b/drivers/media/rc/ir-rc5-decoder.c -@@ -274,6 +274,7 @@ static struct ir_raw_handler rc5_handler = { - .decode = ir_rc5_decode, - .encode = ir_rc5_encode, - .carrier = 36000, -+ .min_timeout = RC5_TRAILER, - }; - - static int __init ir_rc5_decode_init(void) -diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c -index 8314da3..66e0710 100644 ---- a/drivers/media/rc/ir-rc6-decoder.c -+++ b/drivers/media/rc/ir-rc6-decoder.c -@@ -394,6 +394,7 @@ static struct ir_raw_handler rc6_handler = { - .decode = ir_rc6_decode, - .encode = ir_rc6_encode, - .carrier = 36000, -+ .min_timeout = RC6_SUFFIX_SPACE, - }; - - static int __init ir_rc6_decode_init(void) -diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c -index 4efe6db..dd6ee1e 100644 ---- a/drivers/media/rc/ir-sanyo-decoder.c -+++ b/drivers/media/rc/ir-sanyo-decoder.c -@@ -210,6 +210,7 @@ static struct ir_raw_handler sanyo_handler = { - .decode = ir_sanyo_decode, - .encode = ir_sanyo_encode, - .carrier = 38000, -+ .min_timeout = SANYO_TRAILER_SPACE, - }; - - static int __init ir_sanyo_decode_init(void) -diff --git a/drivers/media/rc/ir-sharp-decoder.c b/drivers/media/rc/ir-sharp-decoder.c -index 6a38c50..f96e0c9 100644 ---- a/drivers/media/rc/ir-sharp-decoder.c -+++ b/drivers/media/rc/ir-sharp-decoder.c -@@ -226,6 +226,7 @@ static struct ir_raw_handler sharp_handler = { - .decode = ir_sharp_decode, - .encode = ir_sharp_encode, - .carrier = 38000, -+ .min_timeout = SHARP_ECHO_SPACE + SHARP_ECHO_SPACE / 4, - }; - - static int __init ir_sharp_decode_init(void) -diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c -index 6764ec9..5065c08 100644 ---- a/drivers/media/rc/ir-sony-decoder.c -+++ b/drivers/media/rc/ir-sony-decoder.c -@@ -224,6 +224,7 @@ static struct ir_raw_handler sony_handler = { - .decode = ir_sony_decode, - .encode = ir_sony_encode, - .carrier = 40000, -+ .min_timeout = SONY_TRAILER_SPACE, - }; - - static int __init ir_sony_decode_init(void) -diff --git a/drivers/media/rc/ir-xmp-decoder.c b/drivers/media/rc/ir-xmp-decoder.c -index 58b47af..c965f51 100644 ---- a/drivers/media/rc/ir-xmp-decoder.c -+++ b/drivers/media/rc/ir-xmp-decoder.c -@@ -199,6 +199,7 @@ static int ir_xmp_decode(struct rc_dev *dev, struct ir_raw_event ev) - static struct ir_raw_handler xmp_handler = { - .protocols = RC_PROTO_BIT_XMP, - .decode = ir_xmp_decode, -+ .min_timeout = XMP_TRAILER_SPACE, - }; - - static int __init ir_xmp_decode_init(void) -diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h -index e0e6a17..f785513 100644 ---- a/drivers/media/rc/rc-core-priv.h -+++ b/drivers/media/rc/rc-core-priv.h -@@ -37,6 +37,7 @@ struct ir_raw_handler { - int (*encode)(enum rc_proto protocol, u32 scancode, - struct ir_raw_event *events, unsigned int max); - u32 carrier; -+ u32 min_timeout; - - /* These two should only be used by the mce kbd decoder */ - int (*raw_register)(struct rc_dev *dev); -diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c -index 374f831..22e44c8 100644 ---- a/drivers/media/rc/rc-ir-raw.c -+++ b/drivers/media/rc/rc-ir-raw.c -@@ -233,7 +233,36 @@ ir_raw_get_allowed_protocols(void) - - static int change_protocol(struct rc_dev *dev, u64 *rc_proto) - { -- /* the caller will update dev->enabled_protocols */ -+ struct ir_raw_handler *handler; -+ u32 timeout = 0; -+ -+ if (!dev->max_timeout) -+ return 0; -+ -+ mutex_lock(&ir_raw_handler_lock); -+ list_for_each_entry(handler, &ir_raw_handler_list, list) { -+ if (handler->protocols & *rc_proto) { -+ if (timeout < handler->min_timeout) -+ timeout = handler->min_timeout; -+ } -+ } -+ mutex_unlock(&ir_raw_handler_lock); -+ -+ if (timeout == 0) -+ timeout = IR_DEFAULT_TIMEOUT; -+ else -+ timeout += MS_TO_NS(10); -+ -+ if (timeout < dev->min_timeout) -+ timeout = dev->min_timeout; -+ else if (timeout > dev->max_timeout) -+ timeout = dev->max_timeout; -+ -+ if (dev->s_timeout) -+ dev->s_timeout(dev, timeout); -+ else -+ dev->timeout = timeout; -+ - return 0; - } - -diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c -index cea7b2d..8cd7a26 100644 ---- a/drivers/media/rc/rc-main.c -+++ b/drivers/media/rc/rc-main.c -@@ -1241,6 +1241,9 @@ static ssize_t store_protocols(struct device *device, - if (rc < 0) - goto out; - -+ if (dev->driver_type == RC_DRIVER_IR_RAW) -+ ir_raw_load_modules(&new_protocols); -+ - rc = dev->change_protocol(dev, &new_protocols); - if (rc < 0) { - dev_dbg(&dev->dev, "Error setting protocols to 0x%llx\n", -@@ -1248,9 +1251,6 @@ static ssize_t store_protocols(struct device *device, - goto out; - } - -- if (dev->driver_type == RC_DRIVER_IR_RAW) -- ir_raw_load_modules(&new_protocols); -- - if (new_protocols != old_protocols) { - *current_protocols = new_protocols; - dev_dbg(&dev->dev, "Protocols changed to 0x%llx\n", -@@ -1735,6 +1735,9 @@ static int rc_prepare_rx_device(struct rc_dev *dev) - if (dev->driver_type == RC_DRIVER_SCANCODE && !dev->change_protocol) - dev->enabled_protocols = dev->allowed_protocols; - -+ if (dev->driver_type == RC_DRIVER_IR_RAW) -+ ir_raw_load_modules(&rc_proto); -+ - if (dev->change_protocol) { - rc = dev->change_protocol(dev, &rc_proto); - if (rc < 0) -@@ -1742,9 +1745,6 @@ static int rc_prepare_rx_device(struct rc_dev *dev) - dev->enabled_protocols = rc_proto; - } - -- if (dev->driver_type == RC_DRIVER_IR_RAW) -- ir_raw_load_modules(&rc_proto); -- - set_bit(EV_KEY, dev->input_dev->evbit); - set_bit(EV_REP, dev->input_dev->evbit); - set_bit(EV_MSC, dev->input_dev->evbit); --- -2.14.1 - - -From 78c7e2b34fd53578770fc9098930ba2fcede0df5 Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Fri, 23 Mar 2018 16:59:52 -0400 -Subject: [PATCH 02/12] media: rc: add ioctl to get the current timeout - -Since the kernel now modifies the timeout, make it possible to retrieve -the current value. - -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - Documentation/media/uapi/rc/lirc-func.rst | 1 + - Documentation/media/uapi/rc/lirc-set-rec-timeout.rst | 14 +++++++++----- - drivers/media/rc/lirc_dev.c | 7 +++++++ - include/uapi/linux/lirc.h | 6 ++++++ - 4 files changed, 23 insertions(+), 5 deletions(-) - -diff --git a/Documentation/media/uapi/rc/lirc-func.rst b/Documentation/media/uapi/rc/lirc-func.rst -index ddb4620..9656423 100644 ---- a/Documentation/media/uapi/rc/lirc-func.rst -+++ b/Documentation/media/uapi/rc/lirc-func.rst -@@ -17,6 +17,7 @@ LIRC Function Reference - lirc-get-rec-resolution - lirc-set-send-duty-cycle - lirc-get-timeout -+ lirc-get-rec-timeout - lirc-set-rec-timeout - lirc-set-rec-carrier - lirc-set-rec-carrier-range -diff --git a/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst b/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst -index b3e16bb..a833a6a 100644 ---- a/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst -+++ b/Documentation/media/uapi/rc/lirc-set-rec-timeout.rst -@@ -1,19 +1,23 @@ - .. -*- coding: utf-8; mode: rst -*- - - .. _lirc_set_rec_timeout: -+.. _lirc_get_rec_timeout: - --************************** --ioctl LIRC_SET_REC_TIMEOUT --************************** -+*************************************************** -+ioctl LIRC_GET_REC_TIMEOUT and LIRC_SET_REC_TIMEOUT -+*************************************************** - - Name - ==== - --LIRC_SET_REC_TIMEOUT - sets the integer value for IR inactivity timeout. -+LIRC_GET_REC_TIMEOUT/LIRC_SET_REC_TIMEOUT - Get/set the integer value for IR inactivity timeout. - - Synopsis - ======== - -+.. c:function:: int ioctl( int fd, LIRC_GET_REC_TIMEOUT, __u32 *timeout ) -+ :name: LIRC_GET_REC_TIMEOUT -+ - .. c:function:: int ioctl( int fd, LIRC_SET_REC_TIMEOUT, __u32 *timeout ) - :name: LIRC_SET_REC_TIMEOUT - -@@ -30,7 +34,7 @@ Arguments - Description - =========== - --Sets the integer value for IR inactivity timeout. -+Get and set the integer value for IR inactivity timeout. - - If supported by the hardware, setting it to 0 disables all hardware timeouts - and data should be reported as soon as possible. If the exact value -diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c -index 24e9fbb..17f40c8 100644 ---- a/drivers/media/rc/lirc_dev.c -+++ b/drivers/media/rc/lirc_dev.c -@@ -575,6 +575,13 @@ static long ir_lirc_ioctl(struct file *file, unsigned int cmd, - } - break; - -+ case LIRC_GET_REC_TIMEOUT: -+ if (!dev->timeout) -+ ret = -ENOTTY; -+ else -+ val = DIV_ROUND_UP(dev->timeout, 1000); -+ break; -+ - case LIRC_SET_REC_TIMEOUT_REPORTS: - if (!dev->timeout) - ret = -ENOTTY; -diff --git a/include/uapi/linux/lirc.h b/include/uapi/linux/lirc.h -index f189931..6b31958 100644 ---- a/include/uapi/linux/lirc.h -+++ b/include/uapi/linux/lirc.h -@@ -133,6 +133,12 @@ - - #define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32) - -+/* -+ * Return the recording timeout, which is either set by -+ * the ioctl LIRC_SET_REC_TIMEOUT or by the kernel after setting the protocols. -+ */ -+#define LIRC_GET_REC_TIMEOUT _IOR('i', 0x00000024, __u32) -+ - /* - * struct lirc_scancode - decoded scancode with protocol for use with - * LIRC_MODE_SCANCODE --- -2.14.1 - - -From b4bd3b39310b4f091edb7ce9f3f73e3fe1f7cc5f Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Sat, 24 Mar 2018 08:02:48 -0400 -Subject: [PATCH 03/12] media: rc: per-protocol repeat period and minimum keyup - timer - -Each IR protocol has its own repeat period. We can minimise the keyup -timer to be the protocol period + IR timeout. This makes keys less -"sticky" and makes IR more reactive and nicer to use. - -This feature was previously attempted in commit d57ea877af38 ("media: rc: -per-protocol repeat period"), but that did not take the IR timeout into -account, and had to be reverted. - -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/cec/cec-core.c | 2 +- - drivers/media/rc/lirc_dev.c | 2 +- - drivers/media/rc/rc-main.c | 56 +++++++++++++++++++++++--------------------- - 3 files changed, 31 insertions(+), 29 deletions(-) - -diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c -index b0c87f9..b278ab9 100644 ---- a/drivers/media/cec/cec-core.c -+++ b/drivers/media/cec/cec-core.c -@@ -322,7 +322,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, - adap->rc->allowed_protocols = RC_PROTO_BIT_CEC; - adap->rc->priv = adap; - adap->rc->map_name = RC_MAP_CEC; -- adap->rc->timeout = MS_TO_NS(100); -+ adap->rc->timeout = MS_TO_NS(550); - #endif - return adap; - } -diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c -index 17f40c8..19660f9 100644 ---- a/drivers/media/rc/lirc_dev.c -+++ b/drivers/media/rc/lirc_dev.c -@@ -583,7 +583,7 @@ static long ir_lirc_ioctl(struct file *file, unsigned int cmd, - break; - - case LIRC_SET_REC_TIMEOUT_REPORTS: -- if (!dev->timeout) -+ if (dev->driver_type != RC_DRIVER_IR_RAW) - ret = -ENOTTY; - else - fh->send_timeout_reports = !!val; -diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c -index 8cd7a26..3b11241 100644 ---- a/drivers/media/rc/rc-main.c -+++ b/drivers/media/rc/rc-main.c -@@ -26,50 +26,50 @@ static const struct { - unsigned int repeat_period; - unsigned int scancode_bits; - } protocols[] = { -- [RC_PROTO_UNKNOWN] = { .name = "unknown", .repeat_period = 250 }, -- [RC_PROTO_OTHER] = { .name = "other", .repeat_period = 250 }, -+ [RC_PROTO_UNKNOWN] = { .name = "unknown", .repeat_period = 125 }, -+ [RC_PROTO_OTHER] = { .name = "other", .repeat_period = 125 }, - [RC_PROTO_RC5] = { .name = "rc-5", -- .scancode_bits = 0x1f7f, .repeat_period = 250 }, -+ .scancode_bits = 0x1f7f, .repeat_period = 114 }, - [RC_PROTO_RC5X_20] = { .name = "rc-5x-20", -- .scancode_bits = 0x1f7f3f, .repeat_period = 250 }, -+ .scancode_bits = 0x1f7f3f, .repeat_period = 114 }, - [RC_PROTO_RC5_SZ] = { .name = "rc-5-sz", -- .scancode_bits = 0x2fff, .repeat_period = 250 }, -+ .scancode_bits = 0x2fff, .repeat_period = 114 }, - [RC_PROTO_JVC] = { .name = "jvc", -- .scancode_bits = 0xffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffff, .repeat_period = 125 }, - [RC_PROTO_SONY12] = { .name = "sony-12", -- .scancode_bits = 0x1f007f, .repeat_period = 250 }, -+ .scancode_bits = 0x1f007f, .repeat_period = 100 }, - [RC_PROTO_SONY15] = { .name = "sony-15", -- .scancode_bits = 0xff007f, .repeat_period = 250 }, -+ .scancode_bits = 0xff007f, .repeat_period = 100 }, - [RC_PROTO_SONY20] = { .name = "sony-20", -- .scancode_bits = 0x1fff7f, .repeat_period = 250 }, -+ .scancode_bits = 0x1fff7f, .repeat_period = 100 }, - [RC_PROTO_NEC] = { .name = "nec", -- .scancode_bits = 0xffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffff, .repeat_period = 110 }, - [RC_PROTO_NECX] = { .name = "nec-x", -- .scancode_bits = 0xffffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffffff, .repeat_period = 110 }, - [RC_PROTO_NEC32] = { .name = "nec-32", -- .scancode_bits = 0xffffffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffffffff, .repeat_period = 110 }, - [RC_PROTO_SANYO] = { .name = "sanyo", -- .scancode_bits = 0x1fffff, .repeat_period = 250 }, -+ .scancode_bits = 0x1fffff, .repeat_period = 125 }, - [RC_PROTO_MCIR2_KBD] = { .name = "mcir2-kbd", -- .scancode_bits = 0xffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffff, .repeat_period = 100 }, - [RC_PROTO_MCIR2_MSE] = { .name = "mcir2-mse", -- .scancode_bits = 0x1fffff, .repeat_period = 250 }, -+ .scancode_bits = 0x1fffff, .repeat_period = 100 }, - [RC_PROTO_RC6_0] = { .name = "rc-6-0", -- .scancode_bits = 0xffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffff, .repeat_period = 114 }, - [RC_PROTO_RC6_6A_20] = { .name = "rc-6-6a-20", -- .scancode_bits = 0xfffff, .repeat_period = 250 }, -+ .scancode_bits = 0xfffff, .repeat_period = 114 }, - [RC_PROTO_RC6_6A_24] = { .name = "rc-6-6a-24", -- .scancode_bits = 0xffffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffffff, .repeat_period = 114 }, - [RC_PROTO_RC6_6A_32] = { .name = "rc-6-6a-32", -- .scancode_bits = 0xffffffff, .repeat_period = 250 }, -+ .scancode_bits = 0xffffffff, .repeat_period = 114 }, - [RC_PROTO_RC6_MCE] = { .name = "rc-6-mce", -- .scancode_bits = 0xffff7fff, .repeat_period = 250 }, -+ .scancode_bits = 0xffff7fff, .repeat_period = 114 }, - [RC_PROTO_SHARP] = { .name = "sharp", -- .scancode_bits = 0x1fff, .repeat_period = 250 }, -- [RC_PROTO_XMP] = { .name = "xmp", .repeat_period = 250 }, -- [RC_PROTO_CEC] = { .name = "cec", .repeat_period = 550 }, -+ .scancode_bits = 0x1fff, .repeat_period = 125 }, -+ [RC_PROTO_XMP] = { .name = "xmp", .repeat_period = 125 }, -+ [RC_PROTO_CEC] = { .name = "cec", .repeat_period = 0 }, - [RC_PROTO_IMON] = { .name = "imon", -- .scancode_bits = 0x7fffffff, .repeat_period = 250 }, -+ .scancode_bits = 0x7fffffff, .repeat_period = 114 }, - }; - - /* Used to keep track of known keymaps */ -@@ -690,7 +690,8 @@ static void ir_timer_repeat(struct timer_list *t) - void rc_repeat(struct rc_dev *dev) - { - unsigned long flags; -- unsigned int timeout = protocols[dev->last_protocol].repeat_period; -+ unsigned int timeout = nsecs_to_jiffies(dev->timeout) + -+ msecs_to_jiffies(protocols[dev->last_protocol].repeat_period); - struct lirc_scancode sc = { - .scancode = dev->last_scancode, .rc_proto = dev->last_protocol, - .keycode = dev->keypressed ? dev->last_keycode : KEY_RESERVED, -@@ -706,7 +707,7 @@ void rc_repeat(struct rc_dev *dev) - input_sync(dev->input_dev); - - if (dev->keypressed) { -- dev->keyup_jiffies = jiffies + msecs_to_jiffies(timeout); -+ dev->keyup_jiffies = jiffies + timeout; - mod_timer(&dev->timer_keyup, dev->keyup_jiffies); - } - -@@ -801,7 +802,7 @@ void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u32 scancode, - ir_do_keydown(dev, protocol, scancode, keycode, toggle); - - if (dev->keypressed) { -- dev->keyup_jiffies = jiffies + -+ dev->keyup_jiffies = jiffies + nsecs_to_jiffies(dev->timeout) + - msecs_to_jiffies(protocols[protocol].repeat_period); - mod_timer(&dev->timer_keyup, dev->keyup_jiffies); - } -@@ -1647,6 +1648,7 @@ struct rc_dev *rc_allocate_device(enum rc_driver_type type) - dev->input_dev->setkeycode = ir_setkeycode; - input_set_drvdata(dev->input_dev, dev); - -+ dev->timeout = IR_DEFAULT_TIMEOUT; - timer_setup(&dev->timer_keyup, ir_timer_keyup, 0); - timer_setup(&dev->timer_repeat, ir_timer_repeat, 0); - --- -2.14.1 - - -From c2f422fb5bc97a1e0db5f4ca8fe41fdf9a9b7fcd Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Sat, 7 Apr 2018 17:41:17 -0400 -Subject: [PATCH 04/12] media: rc: mce_kbd protocol encodes two scancodes - -If two keys are pressed, then both keys are encoded in the scancode. This -makes the mce keyboard more responsive. - -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/ir-mce_kbd-decoder.c | 21 ++++++++++++--------- - drivers/media/rc/rc-main.c | 2 +- - 2 files changed, 13 insertions(+), 10 deletions(-) - -diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c -index 03d0f7e..002b832 100644 ---- a/drivers/media/rc/ir-mce_kbd-decoder.c -+++ b/drivers/media/rc/ir-mce_kbd-decoder.c -@@ -149,13 +149,14 @@ static enum mce_kbd_mode mce_kbd_mode(struct mce_kbd_dec *data) - static void ir_mce_kbd_process_keyboard_data(struct rc_dev *dev, u32 scancode) - { - struct mce_kbd_dec *data = &dev->raw->mce_kbd; -- u8 keydata = (scancode >> 8) & 0xff; -+ u8 keydata1 = (scancode >> 8) & 0xff; -+ u8 keydata2 = (scancode >> 16) & 0xff; - u8 shiftmask = scancode & 0xff; -- unsigned char keycode, maskcode; -+ unsigned char maskcode; - int i, keystate; - -- dev_dbg(&dev->dev, "keyboard: keydata = 0x%02x, shiftmask = 0x%02x\n", -- keydata, shiftmask); -+ dev_dbg(&dev->dev, "keyboard: keydata2 = 0x%02x, keydata1 = 0x%02x, shiftmask = 0x%02x\n", -+ keydata2, keydata1, shiftmask); - - for (i = 0; i < 7; i++) { - maskcode = kbd_keycodes[MCIR2_MASK_KEYS_START + i]; -@@ -166,10 +167,12 @@ static void ir_mce_kbd_process_keyboard_data(struct rc_dev *dev, u32 scancode) - input_report_key(data->idev, maskcode, keystate); - } - -- if (keydata) { -- keycode = kbd_keycodes[keydata]; -- input_report_key(data->idev, keycode, 1); -- } else { -+ if (keydata1) -+ input_report_key(data->idev, kbd_keycodes[keydata1], 1); -+ if (keydata2) -+ input_report_key(data->idev, kbd_keycodes[keydata2], 1); -+ -+ if (!keydata1 && !keydata2) { - for (i = 0; i < MCIR2_MASK_KEYS_START; i++) - input_report_key(data->idev, kbd_keycodes[i], 0); - } -@@ -321,7 +324,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) - - switch (data->wanted_bits) { - case MCIR2_KEYBOARD_NBITS: -- scancode = data->body & 0xffff; -+ scancode = data->body & 0xffffff; - dev_dbg(&dev->dev, "keyboard data 0x%08x\n", - data->body); - if (scancode) { -diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c -index 3b11241..2e222d9 100644 ---- a/drivers/media/rc/rc-main.c -+++ b/drivers/media/rc/rc-main.c -@@ -51,7 +51,7 @@ static const struct { - [RC_PROTO_SANYO] = { .name = "sanyo", - .scancode_bits = 0x1fffff, .repeat_period = 125 }, - [RC_PROTO_MCIR2_KBD] = { .name = "mcir2-kbd", -- .scancode_bits = 0xffff, .repeat_period = 100 }, -+ .scancode_bits = 0xffffff, .repeat_period = 100 }, - [RC_PROTO_MCIR2_MSE] = { .name = "mcir2-mse", - .scancode_bits = 0x1fffff, .repeat_period = 100 }, - [RC_PROTO_RC6_0] = { .name = "rc-6-0", --- -2.14.1 - - -From 888dab026c977b6f712b70f16ebeb2f6bf6f16db Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Wed, 11 Apr 2018 11:02:16 -0400 -Subject: [PATCH 05/12] media: rc: mce_kbd decoder: remove superfluous call to - input_sync - -There is nothing to sync in this code path. - -Reported-by: Matthias Reichl -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/ir-mce_kbd-decoder.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c -index 002b832..2fc7871 100644 ---- a/drivers/media/rc/ir-mce_kbd-decoder.c -+++ b/drivers/media/rc/ir-mce_kbd-decoder.c -@@ -362,7 +362,6 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) - dev_dbg(&dev->dev, "failed at state %i (%uus %s)\n", - data->state, TO_US(ev.duration), TO_STR(ev.pulse)); - data->state = STATE_INACTIVE; -- input_sync(data->idev); - return -EINVAL; - } - --- -2.14.1 - - -From 7b83e504b6bd4238468f807c32069d12cc450ef7 Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Thu, 12 Apr 2018 16:28:39 -0400 -Subject: [PATCH 06/12] media: rc: mce_kbd decoder: fix race condition - -The MCE keyboard sends both key down and key up events. We have a timeout -handler mce_kbd_rx_timeout() in case the keyup event is never received; -however, this may race with new key down events from occurring. - -The race is that key down scancode arrives and key down events are -generated. The timeout handler races this and generates key up events -straight afterwards. Since the keyboard generates scancodes every 100ms, -most likely the keys will be repeated 100ms later, and now we have new -key down events and the user sees duplicate key presses. - -Reported-by: Matthias Reichl -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/ir-mce_kbd-decoder.c | 23 ++++++++++++++++------- - drivers/media/rc/rc-core-priv.h | 2 ++ - 2 files changed, 18 insertions(+), 7 deletions(-) - -diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c -index 2fc7871..9574c3d 100644 ---- a/drivers/media/rc/ir-mce_kbd-decoder.c -+++ b/drivers/media/rc/ir-mce_kbd-decoder.c -@@ -119,19 +119,25 @@ static void mce_kbd_rx_timeout(struct timer_list *t) - { - struct ir_raw_event_ctrl *raw = from_timer(raw, t, mce_kbd.rx_timeout); - unsigned char maskcode; -+ unsigned long flags; - int i; - - dev_dbg(&raw->dev->dev, "timer callback clearing all keys\n"); - -- for (i = 0; i < 7; i++) { -- maskcode = kbd_keycodes[MCIR2_MASK_KEYS_START + i]; -- input_report_key(raw->mce_kbd.idev, maskcode, 0); -- } -+ spin_lock_irqsave(&raw->mce_kbd.keylock, flags); - -- for (i = 0; i < MCIR2_MASK_KEYS_START; i++) -- input_report_key(raw->mce_kbd.idev, kbd_keycodes[i], 0); -+ if (time_is_before_eq_jiffies(raw->mce_kbd.rx_timeout.expires)) { -+ for (i = 0; i < 7; i++) { -+ maskcode = kbd_keycodes[MCIR2_MASK_KEYS_START + i]; -+ input_report_key(raw->mce_kbd.idev, maskcode, 0); -+ } - -- input_sync(raw->mce_kbd.idev); -+ for (i = 0; i < MCIR2_MASK_KEYS_START; i++) -+ input_report_key(raw->mce_kbd.idev, kbd_keycodes[i], 0); -+ -+ input_sync(raw->mce_kbd.idev); -+ } -+ spin_unlock_irqrestore(&raw->mce_kbd.keylock, flags); - } - - static enum mce_kbd_mode mce_kbd_mode(struct mce_kbd_dec *data) -@@ -327,6 +333,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) - scancode = data->body & 0xffffff; - dev_dbg(&dev->dev, "keyboard data 0x%08x\n", - data->body); -+ spin_lock(&data->keylock); - if (scancode) { - delay = nsecs_to_jiffies(dev->timeout) + - msecs_to_jiffies(100); -@@ -336,6 +343,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) - } - /* Pass data to keyboard buffer parser */ - ir_mce_kbd_process_keyboard_data(dev, scancode); -+ spin_unlock(&data->keylock); - lsc.rc_proto = RC_PROTO_MCIR2_KBD; - break; - case MCIR2_MOUSE_NBITS: -@@ -400,6 +408,7 @@ static int ir_mce_kbd_register(struct rc_dev *dev) - set_bit(MSC_SCAN, idev->mscbit); - - timer_setup(&mce_kbd->rx_timeout, mce_kbd_rx_timeout, 0); -+ spin_lock_init(&mce_kbd->keylock); - - input_set_drvdata(idev, mce_kbd); - -diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h -index f785513..07ba77f 100644 ---- a/drivers/media/rc/rc-core-priv.h -+++ b/drivers/media/rc/rc-core-priv.h -@@ -105,6 +105,8 @@ struct ir_raw_event_ctrl { - } sharp; - struct mce_kbd_dec { - struct input_dev *idev; -+ /* locks key up timer */ -+ spinlock_t keylock; - struct timer_list rx_timeout; - char name[64]; - char phys[64]; --- -2.14.1 - - -From 1a9b9e6b0b83261922f3cd6c2be0499a2a9f9ee9 Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Wed, 18 Apr 2018 05:36:25 -0400 -Subject: [PATCH 07/12] media: rc: mceusb: IR of length 0 means IR timeout, not - reset - -The last usb packet with IR data will end with 0x80 (MCE_IRDATA_TRAILER). -If we reset the decoder state at this point, IR decoding can fail. - -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/mceusb.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c -index 69ba573..a1c2190 100644 ---- a/drivers/media/rc/mceusb.c -+++ b/drivers/media/rc/mceusb.c -@@ -1182,7 +1182,12 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) - if (ir->rem) { - ir->parser_state = PARSE_IRDATA; - } else { -- ir_raw_event_reset(ir->rc); -+ init_ir_raw_event(&rawir); -+ rawir.timeout = 1; -+ rawir.duration = ir->rc->timeout; -+ if (ir_raw_event_store_with_filter(ir->rc, -+ &rawir)) -+ event = true; - ir->pulse_tunit = 0; - ir->pulse_count = 0; - } --- -2.14.1 - - -From a137c26c8f9ac1ed406cc0a4a4dad3398fb0c920 Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Sun, 8 Apr 2018 11:06:49 -0400 -Subject: [PATCH 08/12] media: rc: mceusb: allow the timeout to be configurable - -mceusb devices have a default timeout of 100ms, but this can be changed. - -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/mceusb.c | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c -index a1c2190..5c0bf61 100644 ---- a/drivers/media/rc/mceusb.c -+++ b/drivers/media/rc/mceusb.c -@@ -982,6 +982,25 @@ static int mceusb_set_tx_carrier(struct rc_dev *dev, u32 carrier) - return 0; - } - -+static int mceusb_set_timeout(struct rc_dev *dev, unsigned int timeout) -+{ -+ u8 cmdbuf[4] = { MCE_CMD_PORT_IR, MCE_CMD_SETIRTIMEOUT, 0, 0 }; -+ struct mceusb_dev *ir = dev->priv; -+ unsigned int units; -+ -+ units = DIV_ROUND_CLOSEST(timeout, US_TO_NS(MCE_TIME_UNIT)); -+ -+ cmdbuf[2] = units >> 8; -+ cmdbuf[3] = units; -+ -+ mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); -+ -+ /* get receiver timeout value */ -+ mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); -+ -+ return 0; -+} -+ - /* - * Select or deselect the 2nd receiver port. - * Second receiver is learning mode, wide-band, short-range receiver. -@@ -1420,7 +1439,10 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) - rc->dev.parent = dev; - rc->priv = ir; - rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; -+ rc->min_timeout = US_TO_NS(MCE_TIME_UNIT); - rc->timeout = MS_TO_NS(100); -+ rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT; -+ rc->s_timeout = mceusb_set_timeout; - if (!ir->flags.no_tx) { - rc->s_tx_mask = mceusb_set_tx_mask; - rc->s_tx_carrier = mceusb_set_tx_carrier; --- -2.14.1 - - -From dd8159588ef7ab8cb05cd2730825a2e3406c3dbe Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Wed, 9 May 2018 06:11:28 -0400 -Subject: [PATCH 09/12] media: mceusb: MCE_CMD_SETIRTIMEOUT cause strange - behaviour on device - -If the IR timeout is set on vid 1784 pid 0011, the device starts -behaving strangely. - -Reported-by: Matthias Reichl -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/mceusb.c | 22 +++++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c -index 5c0bf61..1619b74 100644 ---- a/drivers/media/rc/mceusb.c -+++ b/drivers/media/rc/mceusb.c -@@ -181,6 +181,7 @@ enum mceusb_model_type { - MCE_GEN2 = 0, /* Most boards */ - MCE_GEN1, - MCE_GEN3, -+ MCE_GEN3_BROKEN_IRTIMEOUT, - MCE_GEN2_TX_INV, - MCE_GEN2_TX_INV_RX_GOOD, - POLARIS_EVK, -@@ -199,6 +200,7 @@ struct mceusb_model { - u32 mce_gen3:1; - u32 tx_mask_normal:1; - u32 no_tx:1; -+ u32 broken_irtimeout:1; - /* - * 2nd IR receiver (short-range, wideband) for learning mode: - * 0, absent 2nd receiver (rx2) -@@ -242,6 +244,12 @@ static const struct mceusb_model mceusb_model[] = { - .tx_mask_normal = 1, - .rx2 = 2, - }, -+ [MCE_GEN3_BROKEN_IRTIMEOUT] = { -+ .mce_gen3 = 1, -+ .tx_mask_normal = 1, -+ .rx2 = 2, -+ .broken_irtimeout = 1 -+ }, - [POLARIS_EVK] = { - /* - * In fact, the EVK is shipped without -@@ -352,7 +360,7 @@ static const struct usb_device_id mceusb_dev_table[] = { - .driver_info = MCE_GEN2_TX_INV }, - /* Topseed eHome Infrared Transceiver */ - { USB_DEVICE(VENDOR_TOPSEED, 0x0011), -- .driver_info = MCE_GEN3 }, -+ .driver_info = MCE_GEN3_BROKEN_IRTIMEOUT }, - /* Ricavision internal Infrared Transceiver */ - { USB_DEVICE(VENDOR_RICAVISION, 0x0010) }, - /* Itron ione Libra Q-11 */ -@@ -1441,8 +1449,16 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir) - rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER; - rc->min_timeout = US_TO_NS(MCE_TIME_UNIT); - rc->timeout = MS_TO_NS(100); -- rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT; -- rc->s_timeout = mceusb_set_timeout; -+ if (!mceusb_model[ir->model].broken_irtimeout) { -+ rc->s_timeout = mceusb_set_timeout; -+ rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT; -+ } else { -+ /* -+ * If we can't set the timeout using CMD_SETIRTIMEOUT, we can -+ * rely on software timeouts for timeouts < 100ms. -+ */ -+ rc->max_timeout = rc->timeout; -+ } - if (!ir->flags.no_tx) { - rc->s_tx_mask = mceusb_set_tx_mask; - rc->s_tx_carrier = mceusb_set_tx_carrier; --- -2.14.1 - - -From 1391fe65757811bc1e197200a27918141b2fd90b Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Thu, 10 May 2018 07:37:51 -0400 -Subject: [PATCH 10/12] media: mceusb: filter out bogus timing irdata of - duration 0 - -A mceusb device has been observed producing invalid irdata. Proactively -guard against this. - -Suggested-by: Matthias Reichl -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/mceusb.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c -index 1619b74..1ca4949 100644 ---- a/drivers/media/rc/mceusb.c -+++ b/drivers/media/rc/mceusb.c -@@ -1177,6 +1177,11 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) - init_ir_raw_event(&rawir); - rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); - rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK); -+ if (unlikely(!rawir.duration)) { -+ dev_warn(ir->dev, "nonsensical irdata %02x with duration 0", -+ ir->buf_in[i]); -+ break; -+ } - if (rawir.pulse) { - ir->pulse_tunit += rawir.duration; - ir->pulse_count++; --- -2.14.1 - - -From 2b7fc5287aba07497933d9cceb3898ebd8001af4 Mon Sep 17 00:00:00 2001 -From: Sean Young -Date: Thu, 10 May 2018 07:49:49 -0400 -Subject: [PATCH 11/12] media: mceusb: add missing break - -Fallthrough is not intended here. - -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/mceusb.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c -index 1ca4949..4c0c800 100644 ---- a/drivers/media/rc/mceusb.c -+++ b/drivers/media/rc/mceusb.c -@@ -572,6 +572,7 @@ static int mceusb_cmd_datasize(u8 cmd, u8 subcmd) - datasize = 1; - break; - } -+ break; - case MCE_CMD_PORT_IR: - switch (subcmd) { - case MCE_CMD_UNKNOWN: --- -2.14.1 - - -From 06ea4ee6cc2d2d6fae27ddb29f31595f2d6a018b Mon Sep 17 00:00:00 2001 -From: Matthias Reichl -Date: Sun, 13 May 2018 07:24:31 -0400 -Subject: [PATCH 12/12] media: rc: ite-cir: lower timeout and extend allowed - timeout range - -The minimum possible timeout of ite-cir is 8 samples, which is -typically about 70us. The driver however changes the FIFO trigger -level from the hardware's default of 1 byte to 17 bytes, so the minimum -usable timeout value is 17 * 8 samples, which is typically about 1.2ms. - -Tests showed that using timeouts down to 1.2ms actually work fine. - -The current default timeout of 200ms is much longer than necessary and -the maximum timeout of 1s seems to have been chosen a bit arbitrarily. - -So change the minimum timeout to the driver's limit of 17 * 8 samples -and bring timeout and maximum timeout in line with the settings -of many other receivers. - -Signed-off-by: Matthias Reichl -Signed-off-by: Sean Young -Signed-off-by: Mauro Carvalho Chehab ---- - drivers/media/rc/ite-cir.c | 8 +++++--- - drivers/media/rc/ite-cir.h | 7 ------- - 2 files changed, 5 insertions(+), 10 deletions(-) - -diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c -index 65e104c..de77d22 100644 ---- a/drivers/media/rc/ite-cir.c -+++ b/drivers/media/rc/ite-cir.c -@@ -1561,9 +1561,11 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id - rdev->close = ite_close; - rdev->s_idle = ite_s_idle; - rdev->s_rx_carrier_range = ite_set_rx_carrier_range; -- rdev->min_timeout = ITE_MIN_IDLE_TIMEOUT; -- rdev->max_timeout = ITE_MAX_IDLE_TIMEOUT; -- rdev->timeout = ITE_IDLE_TIMEOUT; -+ /* FIFO threshold is 17 bytes, so 17 * 8 samples minimum */ -+ rdev->min_timeout = 17 * 8 * ITE_BAUDRATE_DIVISOR * -+ itdev->params.sample_period; -+ rdev->timeout = IR_DEFAULT_TIMEOUT; -+ rdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT; - rdev->rx_resolution = ITE_BAUDRATE_DIVISOR * - itdev->params.sample_period; - rdev->tx_resolution = ITE_BAUDRATE_DIVISOR * -diff --git a/drivers/media/rc/ite-cir.h b/drivers/media/rc/ite-cir.h -index 0e8ebc8..9cb24ac 100644 ---- a/drivers/media/rc/ite-cir.h -+++ b/drivers/media/rc/ite-cir.h -@@ -154,13 +154,6 @@ struct ite_dev { - /* default carrier freq for when demodulator is off (Hz) */ - #define ITE_DEFAULT_CARRIER_FREQ 38000 - --/* default idling timeout in ns (0.2 seconds) */ --#define ITE_IDLE_TIMEOUT 200000000UL -- --/* limit timeout values */ --#define ITE_MIN_IDLE_TIMEOUT 100000000UL --#define ITE_MAX_IDLE_TIMEOUT 1000000000UL -- - /* convert bits to us */ - #define ITE_BITS_TO_NS(bits, sample_period) \ - ((u32) ((bits) * ITE_BAUDRATE_DIVISOR * sample_period)) --- -2.14.1 - diff --git a/packages/linux/patches/default/linux-999-use-linus-commit-to-fix-ksoftirqd-issues.patch b/packages/linux/patches/default/linux-999-use-linus-commit-to-fix-ksoftirqd-issues.patch deleted file mode 100644 index 947c47620e..0000000000 --- a/packages/linux/patches/default/linux-999-use-linus-commit-to-fix-ksoftirqd-issues.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 5839d34af2063552f83865fd5ebac651688087f9 Mon Sep 17 00:00:00 2001 -From: MilhouseVH -Date: Thu, 1 Feb 2018 09:25:19 +0000 -Subject: [PATCH] Fix issues introduced by ksoftirqd change - ---- - kernel/softirq.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/kernel/softirq.c b/kernel/softirq.c -index 4e09821..d6772be 100644 ---- a/kernel/softirq.c -+++ b/kernel/softirq.c -@@ -79,12 +79,16 @@ static void wakeup_softirqd(void) - - /* - * If ksoftirqd is scheduled, we do not want to process pending softirqs -- * right now. Let ksoftirqd handle this at its own rate, to get fairness. -+ * right now. Let ksoftirqd handle this at its own rate, to get fairness, -+ * unless we're doing some of the synchronous softirqs. - */ --static bool ksoftirqd_running(void) -+#define SOFTIRQ_NOW_MASK ((1 << HI_SOFTIRQ) | (1 << TASKLET_SOFTIRQ)) -+static bool ksoftirqd_running(unsigned long pending) - { - struct task_struct *tsk = __this_cpu_read(ksoftirqd); - -+ if (pending & SOFTIRQ_NOW_MASK) -+ return false; - return tsk && (tsk->state == TASK_RUNNING); - } - -@@ -324,7 +328,7 @@ asmlinkage __visible void do_softirq(void) - - pending = local_softirq_pending(); - -- if (pending && !ksoftirqd_running()) -+ if (pending && !ksoftirqd_running(pending)) - do_softirq_own_stack(); - - local_irq_restore(flags); -@@ -351,7 +355,7 @@ void irq_enter(void) - - static inline void invoke_softirq(void) - { -- if (ksoftirqd_running()) -+ if (ksoftirqd_running(local_softirq_pending())) - return; - - if (!force_irqthreads) { --- -2.14.1 -