Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH v4 27/28] gcc-sdm845: Add general purpose clock ops
From: Dzmitry Sankouski @ 2024-09-13 15:06 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: dmitry.baryshkov, Sebastian Reichel, Bjorn Andersson,
	Michael Turquette, Stephen Boyd, Neil Armstrong, Jessica Zhang,
	Sam Ravnborg, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Lee Jones, Dmitry Torokhov, Pavel Machek,
	Liam Girdwood, Mark Brown, Krzysztof Kozlowski, Konrad Dybcio,
	Chanwoo Choi, linux-pm, linux-kernel, linux-arm-msm, linux-clk,
	dri-devel, devicetree, linux-input, linux-leds, linux-pwm,
	linux-samsung-soc
In-Reply-To: <uevafpb6r7rfutiqrm5asfvv7zfxcb3acrlxqpispele5er52x@eegonpzqlm7j>

вт, 10 сент. 2024 г. в 12:59, Uwe Kleine-König <u.kleine-koenig@baylibre.com>:
>
> Hello,
>
> On Fri, Jul 19, 2024 at 03:55:04PM +0300, Dzmitry Sankouski wrote:
> > SDM845 has "General Purpose" clocks that can be muxed to
> > SoC pins to clock various external devices.
> > Those clocks may be used as e.g. PWM sources for external peripherals.
> >
> > GPCLK can in theory have arbitrary value depending on the use case, so
> > the concept of frequency tables, used in rcg2 clock driver, is not
> > efficient, because it allows only defined frequencies.
> >
> > Introduce clk_rcg2_gp_ops, which automatically calculate clock
> > mnd values for arbitrary clock rate.
> >
> > Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> > ---
> >  drivers/clk/qcom/clk-rcg.h    |   1 +
> >  drivers/clk/qcom/clk-rcg2.c   | 162 ++++++++++++++++++++++++++++++++++++++++--
> >  drivers/clk/qcom/gcc-sdm845.c |  19 ++---
> >  drivers/pwm/pwm-clk.c         |   5 ++
>
> I don't understand why a change to some qcom clk implementation detail
> needs a change to drivers/pwm/pwm-clk.c in the same commit. I guess if
> the change to drivers/pwm/pwm-clk.c is needed it should better go into a
> separate patch with an appropriate commit log?!
>
You're right, I'll fix that. Also I heavily rewrote this patch, and
included it in
starqltechn patch series. Since this patch has the wrong version (sorry for my
mistake) and order numbering, please consider the next patch a successor of it.

-- 

Best regards,
Dzmitry

^ permalink raw reply

* Re: [PATCH v3 04/23] dt-bindings: mfd: add maxim,max77705
From: Dzmitry Sankouski @ 2024-09-13 14:51 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Lee Jones, Dmitry Torokhov, Pavel Machek, Liam Girdwood,
	Mark Brown, Uwe Kleine-König, Konrad Dybcio, Chanwoo Choi,
	phone-devel, linux-pm, linux-kernel, linux-arm-msm, linux-clk,
	dri-devel, devicetree, linux-input, linux-leds, linux-pwm,
	linux-samsung-soc
In-Reply-To: <13a650f4-7ca7-4c95-b536-9814a22f00ff@kernel.org>

чт, 20 июн. 2024 г. в 18:46, Krzysztof Kozlowski <krzk@kernel.org>:
>
> On 18/06/2024 15:59, Dzmitry Sankouski wrote:
> > maxim,max77705 is MAX77705 pmic binding part
> >
> > Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> > ---
> >  .../devicetree/bindings/mfd/maxim,max77705.yaml    | 112 +++++++++++++++++++++
>
> Your patch order is totally messed. Not tested by automation. Only
> limited review follows.
>
Hmm, not sure what was wrong. I sent version 4 to myself with `b4 send
--reflect`, the order looks good.

-- 

Best regards,
Dzmitry

^ permalink raw reply

* Re: [PATCH] HID: plantronics: Update to map micmute controls
From: Benjamin Tissoires @ 2024-09-13 14:03 UTC (permalink / raw)
  To: Wade Wang; +Cc: jikos, linux-input, linux-kernel, stable
In-Reply-To: <20240913060800.1325954-1-wade.wang@hp.com>

On Sep 13 2024, Wade Wang wrote:
> telephony page of Plantronics headset is ignored currently, it caused
> micmute button no function, Now follow native HID key mapping for
> telephony page map, telephony micmute key is enabled by default

For which devices this patch is required? Is it related to the other
patch you sent today? If so please make a mention of the concerned
devices and make sure both patches are sent in a single v3 series.

Also, have you tested this change with other Plantronics headsets? Where
there any changes in behavior from them?

Cheers,
Benjamin

> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Wade Wang <wade.wang@hp.com>
> ---
>  drivers/hid/hid-plantronics.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
> index 2a19f3646ecb..2d17534fce61 100644
> --- a/drivers/hid/hid-plantronics.c
> +++ b/drivers/hid/hid-plantronics.c
> @@ -77,10 +77,10 @@ static int plantronics_input_mapping(struct hid_device *hdev,
>  		}
>  	}
>  	/* handle standard types - plt_type is 0xffa0uuuu or 0xffa2uuuu */
> -	/* 'basic telephony compliant' - allow default consumer page map */
> +	/* 'basic telephony compliant' - allow default consumer & telephony page map */
>  	else if ((plt_type & HID_USAGE) >= PLT_BASIC_TELEPHONY &&
>  		 (plt_type & HID_USAGE) != PLT_BASIC_EXCEPTION) {
> -		if (PLT_ALLOW_CONSUMER)
> +		if (PLT_ALLOW_CONSUMER || (usage->hid & HID_USAGE_PAGE) == HID_UP_TELEPHONY)
>  			goto defaulted;
>  	}
>  	/* not 'basic telephony' - apply legacy mapping */
> -- 
> 2.34.1
> 

^ permalink raw reply

* Re: [PATCH] HID: plantronics: Additional PID for double volume key presses quirk
From: Benjamin Tissoires @ 2024-09-13 14:01 UTC (permalink / raw)
  To: Wade Wang; +Cc: jikos, linux-input, linux-kernel, stable
In-Reply-To: <20240913060710.1325640-1-wade.wang@hp.com>

On Sep 13 2024, Wade Wang wrote:
> Add the below headsets for double volume key presses quirk
>         Plantronics EncorePro 500 Series  (047f:431e)
>         Plantronics Blackwire_3325 Series (047f:430c)
> 
> Quote from previous patch by Maxim Mikityanskiy and Terry Junge
> 	'commit f567d6ef8606 ("HID: plantronics: Workaround for double volume
> 	 key presses")'
> 	'commit 3d57f36c89d8 ("HID: plantronics: Additional PIDs for double
> 	 volume key presses quirk")'
> These Plantronics Series headset sends an opposite volume key following
> each volume key press. This patch adds a quirk to hid-plantronics for this
> product ID, which will ignore the second opposite volume key press if it
> happens within 250 ms from the last one that was handled.

This commit message is very confusing:
- you mention that you are quoting 2 commits,
- but then you don't quote them but slightly reword the content
- and then, and most of all, you insert in the driver a new timeout of
  250 ms, which seems to not be with the same bases than f567d6ef8606
  where it is mentioned that "Auto-repeat (when a key is held pressed)
  is not affected, because the rate is about 3 times per second, which
  is far less frequent than once in 5 ms." -> 250 ms gets in the roughly
  same range than 3 times per seconds, so some more explanations is
  required

Please also follow Greg's advice and, as you replied in your last message
that didn't made the list (HTML), please resubmit the series with a
clear v3 indicator and a description of changes.

Ideally, I'd like to also have the other plantronics patch you sent
today in the same series, so I know which order I should apply them, in
case one rely on the other.

Cheers,
Benjamin
  
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Wade Wang <wade.wang@hp.com>
> ---
>  drivers/hid/hid-ids.h         |  2 ++
>  drivers/hid/hid-plantronics.c | 11 +++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 781c5aa29859..a0aaac98a891 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -1050,6 +1050,8 @@
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES	0xc056
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES	0xc057
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES	0xc058
> +#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES	0x430c
> +#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES		0x431e
>  
>  #define USB_VENDOR_ID_PANASONIC		0x04da
>  #define USB_DEVICE_ID_PANABOARD_UBT780	0x1044
> diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
> index 3d414ae194ac..2a19f3646ecb 100644
> --- a/drivers/hid/hid-plantronics.c
> +++ b/drivers/hid/hid-plantronics.c
> @@ -38,8 +38,10 @@
>  			    (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)
>  
>  #define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0)
> +#define PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS BIT(1)
>  
>  #define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */
> +#define PLT_FOLLOWED_KEY_TIMEOUT 250 /* ms */
>  
>  struct plt_drv_data {
>  	unsigned long device_type;
> @@ -134,6 +136,9 @@ static int plantronics_event(struct hid_device *hdev, struct hid_field *field,
>  		cur_ts = jiffies;
>  		if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_DOUBLE_KEY_TIMEOUT)
>  			return 1; /* Ignore the repeated key. */
> +		if ((drv_data->quirks & PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS)
> +		 && jiffies_to_msecs(cur_ts - prev_ts) <= PLT_FOLLOWED_KEY_TIMEOUT)
> +			return 1; /* Ignore the followed volume key. */
>  
>  		drv_data->last_volume_key_ts = cur_ts;
>  	}
> @@ -210,6 +215,12 @@ static const struct hid_device_id plantronics_devices[] = {
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
>  					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES),
>  		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
> +	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
> +					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES),
> +		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
> +	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
> +					 USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES),
> +		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
>  	{ }
>  };
> -- 
> 2.34.1
> 

^ permalink raw reply

* Re: (subset) [PATCH HID v2 00/11] HID: bpf: add a new hook to control hid-generic
From: Benjamin Tissoires @ 2024-09-13 13:47 UTC (permalink / raw)
  To: Jiri Kosina, Peter Hutterer, Vicki Pfau, Shuah Khan
  Cc: linux-input, linux-kselftest, linux-kernel, bpf
In-Reply-To: <172623473588.1192461.11090201509053454593.b4-ty@kernel.org>

On Sep 13 2024, Benjamin Tissoires wrote:
> On Tue, 10 Sep 2024 23:43:36 +0900, Benjamin Tissoires wrote:
> > This is a slight change from the fundamentals of HID-BPF.
> > In theory, HID-BPF is abstract to the kernel itself, and makes
> > only changes at the HID level (through report descriptors or
> > events emitted to/from the device).
> > 
> > However, we have seen a few use cases where HID-BPF might interact with
> > the running kernel when the target device is already handled by a
> > specific device.
> > 
> > [...]
> 
> Applied to hid/hid.git (for-6.12/bpf), thanks!
> 
> [01/11] HID: bpf: move HID-BPF report descriptor fixup earlier
>         https://git.kernel.org/hid/hid/c/f10a11b7b599
> [02/11] HID: core: save one kmemdup during .probe()
>         https://git.kernel.org/hid/hid/c/6941754dbbc7
> [03/11] HID: core: remove one more kmemdup on .probe()
>         https://git.kernel.org/hid/hid/c/4fe29f36d2a3
> [04/11] HID: bpf: allow write access to quirks field in struct hid_device
>         https://git.kernel.org/hid/hid/c/b722f588adc6
> [05/11] selftests/hid: add dependency on hid_common.h
>         https://git.kernel.org/hid/hid/c/3d816765e12e
> [06/11] selftests/hid: cleanup C tests by adding a common struct uhid_device
>         https://git.kernel.org/hid/hid/c/28023a0f99d1
> [07/11] selftests/hid: allow to parametrize bus/vid/pid/rdesc on the test device
>         https://git.kernel.org/hid/hid/c/10d3147f9bb1
> [08/11] HID: add per device quirk to force bind to hid-generic
>         https://git.kernel.org/hid/hid/c/d030f826ea47
> [09/11] selftests/hid: add test for assigning a given device to hid-generic
>         https://git.kernel.org/hid/hid/c/10929078201f
> 

Just for completeness, I've dropped 10/11 and 11/11 when applying the
series because even if they are working it's unclear if the use case is
rock solid, like the first one is.

The patches are still on the LKML, so if anyone believes they required
it, we can alwasy pull them in later.

Cheers,
Benjamin

^ permalink raw reply

* Re: [PATCH -next] hid: cp2112: Use irq_get_trigger_type() helper
From: Benjamin Tissoires @ 2024-09-13 13:44 UTC (permalink / raw)
  To: jikos, linux-input, linux-kernel, Jinjie Ruan
In-Reply-To: <20240913074632.3779321-1-ruanjinjie@huawei.com>

On Fri, 13 Sep 2024 15:46:32 +0800, Jinjie Ruan wrote:
> Use irq_get_trigger_type() to replace irq_get_irq_data() and then
> irqd_get_trigger_type(), if the irq data is NULL it will return 0.
> 
> No functional changed.
> 
> 

Applied to hid/hid.git (for-6.12/cp2112), thanks!

[1/1] hid: cp2112: Use irq_get_trigger_type() helper
      https://git.kernel.org/hid/hid/c/e9a081c80cb3

Cheers,
-- 
Benjamin Tissoires <bentiss@kernel.org>


^ permalink raw reply

* Re: (subset) [PATCH HID v2 00/11] HID: bpf: add a new hook to control hid-generic
From: Benjamin Tissoires @ 2024-09-13 13:38 UTC (permalink / raw)
  To: Jiri Kosina, Peter Hutterer, Vicki Pfau, Shuah Khan,
	Benjamin Tissoires
  Cc: linux-input, linux-kselftest, linux-kernel, bpf
In-Reply-To: <20240910-hid-bpf-hid-generic-v2-0-083dfc189e97@kernel.org>

On Tue, 10 Sep 2024 23:43:36 +0900, Benjamin Tissoires wrote:
> This is a slight change from the fundamentals of HID-BPF.
> In theory, HID-BPF is abstract to the kernel itself, and makes
> only changes at the HID level (through report descriptors or
> events emitted to/from the device).
> 
> However, we have seen a few use cases where HID-BPF might interact with
> the running kernel when the target device is already handled by a
> specific device.
> 
> [...]

Applied to hid/hid.git (for-6.12/bpf), thanks!

[01/11] HID: bpf: move HID-BPF report descriptor fixup earlier
        https://git.kernel.org/hid/hid/c/f10a11b7b599
[02/11] HID: core: save one kmemdup during .probe()
        https://git.kernel.org/hid/hid/c/6941754dbbc7
[03/11] HID: core: remove one more kmemdup on .probe()
        https://git.kernel.org/hid/hid/c/4fe29f36d2a3
[04/11] HID: bpf: allow write access to quirks field in struct hid_device
        https://git.kernel.org/hid/hid/c/b722f588adc6
[05/11] selftests/hid: add dependency on hid_common.h
        https://git.kernel.org/hid/hid/c/3d816765e12e
[06/11] selftests/hid: cleanup C tests by adding a common struct uhid_device
        https://git.kernel.org/hid/hid/c/28023a0f99d1
[07/11] selftests/hid: allow to parametrize bus/vid/pid/rdesc on the test device
        https://git.kernel.org/hid/hid/c/10d3147f9bb1
[08/11] HID: add per device quirk to force bind to hid-generic
        https://git.kernel.org/hid/hid/c/d030f826ea47
[09/11] selftests/hid: add test for assigning a given device to hid-generic
        https://git.kernel.org/hid/hid/c/10929078201f

Cheers,
-- 
Benjamin Tissoires <bentiss@kernel.org>


^ permalink raw reply

* Re: [PATCH v27 01/32] xhci: add helper to stop endpoint and wait for completion
From: Michał Pecio @ 2024-09-13  8:32 UTC (permalink / raw)
  To: quic_wcheng, mathias.nyman
  Cc: Thinh.Nguyen, alsa-devel, bgoswami, broonie, conor+dt, corbet,
	devicetree, dmitry.torokhov, gregkh, krzk+dt, lgirdwood,
	linux-arm-msm, linux-doc, linux-input, linux-kernel, linux-sound,
	linux-usb, mathias.nyman, perex, pierre-louis.bossart, robh,
	srinivas.kandagatla, tiwai
In-Reply-To: <20240912193935.1916426-2-quic_wcheng@quicinc.com>

Hi,

> Expose xhci_stop_endpoint_sync() which is a synchronous variant of
> xhci_queue_stop_endpoint().  This is useful for client drivers that are
> using the secondary interrupters, and need to stop/clean up the current
> session.  The stop endpoint command handler will also take care of
> cleaning up the ring.

I'm not entirely sure what you meant by "cleaning up the ring" (maybe a
comment would be in order?), but I see nothing being done here after the
command completes and FYI xhci-ring.c will not run the default handler if
the command is queued with a completion, like here.

At least that's the case for certain command types and there is probably
a story behind each of them. I know that xhci_stop_device() queues a
Stop EP with completion (and also a few without(?)). Maybe it's a bug...

Regards,
Michal

^ permalink raw reply

* Re: [PATCH] HID: plantronics: Additional PID for double volume key presses quirk
From: Greg KH @ 2024-09-13  8:23 UTC (permalink / raw)
  To: Wang, Wade
  Cc: jikos@kernel.org, bentiss@kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
In-Reply-To: <EA2PR84MB37800B3DCB1F28FAAF266FC18B652@EA2PR84MB3780.NAMPRD84.PROD.OUTLOOK.COM>

Please do not top-post.

On Fri, Sep 13, 2024 at 07:16:13AM +0000, Wang, Wade wrote:
> Hi Greg,
> 
> Just add "Cc: stable@vger.kernel.org" in 2nd patch submission, because kernel test robot required. Any other thing I need to do for your question now? Thanks

That's a great start, but you need to document the difference when you
do this, as the documentation says to do so, below the --- line.
Otherwise maintainers have no idea what changed, and what version of a
patch to take.

Think about what you would want to see if you got 1000 emails a day to
do something with?

thanks,

greg k-h

^ permalink raw reply

* [PATCH v4 2/2] input: touchscreen: ad7877: add dt support
From: Antoniu Miclaus @ 2024-09-13  7:52 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Michael Hennerich, Mark Brown, Antoniu Miclaus, linux-input,
	devicetree, linux-kernel, linux-spi
In-Reply-To: <20240913075307.154435-1-antoniu.miclaus@analog.com>

Add devicetree support within the driver.

Remove old platform data approach since it is no longer used.

Add match table.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
changes in v4:
 - merge match table and dt support patches.
 - include mod_devicetable.h
 - update prop parsing based on the new changes in the bindings.
 drivers/input/touchscreen/ad7877.c | 176 ++++++++++++++++++++++++-----
 include/linux/spi/ad7877.h         |  25 ----
 2 files changed, 145 insertions(+), 56 deletions(-)
 delete mode 100644 include/linux/spi/ad7877.h

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index a0598e9c7aff..30c247ae59e5 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -25,11 +25,13 @@
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/input.h>
+#include <linux/input/touchscreen.h>
 #include <linux/interrupt.h>
+#include <linux/mod_devicetable.h>
 #include <linux/pm.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/ad7877.h>
 #include <linux/module.h>
 #include <asm/irq.h>
 
@@ -174,6 +176,8 @@ struct ad7877 {
 	u8			averaging;
 	u8			pen_down_acc_interval;
 
+	struct touchscreen_properties prop;
+
 	struct spi_transfer	xfer[AD7877_NR_SENSE + 2];
 	struct spi_message	msg;
 
@@ -353,8 +357,7 @@ static int ad7877_process_data(struct ad7877 *ts)
 		if (!timer_pending(&ts->timer))
 			input_report_key(input_dev, BTN_TOUCH, 1);
 
-		input_report_abs(input_dev, ABS_X, x);
-		input_report_abs(input_dev, ABS_Y, y);
+		touchscreen_report_pos(input_dev, &ts->prop, x, y, false);
 		input_report_abs(input_dev, ABS_PRESSURE, Rt);
 		input_sync(input_dev);
 
@@ -667,11 +670,136 @@ static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 	}
 }
 
+static int ad7877_parse_props(struct ad7877 *ts)
+{
+	struct device *dev = &ts->spi->dev;
+	u32 value, average;
+	int ret;
+
+	ts->model = (uintptr_t)device_get_match_data(dev);
+	if (!ts->model)
+		ts->model = 7877;
+
+	ret = device_property_match_string(dev, "adi,stopacq-polarity", "low");
+	if (ret < 0) {
+		ret = device_property_match_string(dev, "adi,stopacq-polarity", "high");
+		if (ret < 0)
+			ts->stopacq_polarity = 0;
+		ts->stopacq_polarity = 1;
+	} else {
+		ts->stopacq_polarity = 0;
+	}
+
+	ret = device_property_read_u32(dev, "adi,first-conv-delay-ns", &value);
+	if (!ret) {
+		switch (value) {
+		case 500:
+			ts->first_conversion_delay = 0;
+			break;
+		case 128000:
+			ts->first_conversion_delay = 1;
+			break;
+		case 1000000:
+			ts->first_conversion_delay = 2;
+			break;
+		case 8000000:
+			ts->first_conversion_delay = 3;
+			break;
+		default:
+			return dev_err_probe(dev, -EINVAL,
+					"Invalid adi,first-conv-delay-ns value\n");
+		}
+	}
+
+	device_property_read_u32(dev, "adi,pen-down-acc-interval-us",
+				 &value);
+	if (!ret) {
+		switch (value) {
+		case 0:
+			ts->acquisition_time = 0;
+			break;
+		case 500:
+			ts->acquisition_time = 1;
+			break;
+		case 1000:
+			ts->acquisition_time = 2;
+			break;
+		case 8000:
+			ts->acquisition_time = 3;
+			break;
+		default:
+			return dev_err_probe(dev, -EINVAL,
+					"Invalid adi,pen-down-acc-interval-us value\n");
+		}
+	}
+
+	ret = device_property_read_u32(dev, "adi,acquisition-time-us", &value);
+	if (!ret) {
+		switch (value) {
+		case 2:
+			ts->acquisition_time = 0;
+			break;
+		case 4:
+			ts->acquisition_time = 1;
+			break;
+		case 8:
+			ts->acquisition_time = 2;
+			break;
+		case 16:
+			ts->acquisition_time = 3;
+			break;
+		default:
+			return dev_err_probe(dev, -EINVAL,
+					"Invalid adi,first-conv-delay-ns value\n");
+		}
+	}
+
+	device_property_read_u32(dev, "adi,vref-delay-us",
+				 &value);
+	if (!value)
+		ts->vref_delay_usecs = 100;
+	else
+		ts->vref_delay_usecs = (u16)value;
+
+	device_property_read_u32(dev, "touchscreen-x-plate-ohms", &value);
+	if (value)
+		ts->x_plate_ohms = (u16)value;
+	else
+		ts->x_plate_ohms = 400;
+
+	/*
+	 * The property is parsed also in the touchscreen_parse_properties()
+	 * but is required for the ad7877_process_data() so we need to store it.
+	 */
+	device_property_read_u32(dev, "touchscreen-max-pressure", &value);
+	ts->pressure_max = (u16)value;
+
+	device_property_read_u32(dev, "touchscreen-average-samples", &average);
+	switch (average) {
+	case 1:
+		ts->averaging = 0;
+		break;
+	case 4:
+		ts->averaging = 1;
+		break;
+	case 8:
+		ts->averaging = 2;
+		break;
+	case 16:
+		ts->averaging = 3;
+		break;
+	default:
+		return dev_err_probe(dev, -EINVAL,
+				     "touchscreen-average-samples must be 1, 4, 8, or 16\n");
+	}
+
+	return 0;
+}
+
 static int ad7877_probe(struct spi_device *spi)
 {
 	struct ad7877			*ts;
 	struct input_dev		*input_dev;
-	struct ad7877_platform_data	*pdata = dev_get_platdata(&spi->dev);
 	int				err;
 	u16				verify;
 
@@ -680,11 +808,6 @@ static int ad7877_probe(struct spi_device *spi)
 		return -ENODEV;
 	}
 
-	if (!pdata) {
-		dev_dbg(&spi->dev, "no platform data?\n");
-		return -ENODEV;
-	}
-
 	/* don't exceed max specified SPI CLK frequency */
 	if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) {
 		dev_dbg(&spi->dev, "SPI CLK %d Hz?\n",spi->max_speed_hz);
@@ -714,27 +837,22 @@ static int ad7877_probe(struct spi_device *spi)
 	ts->spi = spi;
 	ts->input = input_dev;
 
+	err = ad7877_parse_props(ts);
+	if (err)
+		return err;
+
 	timer_setup(&ts->timer, ad7877_timer, 0);
 	mutex_init(&ts->mutex);
 	spin_lock_init(&ts->lock);
 
-	ts->model = pdata->model ? : 7877;
-	ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
-	ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
-	ts->pressure_max = pdata->pressure_max ? : ~0;
-
-	ts->stopacq_polarity = pdata->stopacq_polarity;
-	ts->first_conversion_delay = pdata->first_conversion_delay;
-	ts->acquisition_time = pdata->acquisition_time;
-	ts->averaging = pdata->averaging;
-	ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
-
 	snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
 
 	input_dev->name = "AD7877 Touchscreen";
 	input_dev->phys = ts->phys;
 	input_dev->dev.parent = &spi->dev;
 
+	touchscreen_parse_properties(ts->input, false, &ts->prop);
+
 	__set_bit(EV_KEY, input_dev->evbit);
 	__set_bit(BTN_TOUCH, input_dev->keybit);
 	__set_bit(EV_ABS, input_dev->evbit);
@@ -742,17 +860,6 @@ static int ad7877_probe(struct spi_device *spi)
 	__set_bit(ABS_Y, input_dev->absbit);
 	__set_bit(ABS_PRESSURE, input_dev->absbit);
 
-	input_set_abs_params(input_dev, ABS_X,
-			pdata->x_min ? : 0,
-			pdata->x_max ? : MAX_12BIT,
-			0, 0);
-	input_set_abs_params(input_dev, ABS_Y,
-			pdata->y_min ? : 0,
-			pdata->y_max ? : MAX_12BIT,
-			0, 0);
-	input_set_abs_params(input_dev, ABS_PRESSURE,
-			pdata->pressure_min, pdata->pressure_max, 0, 0);
-
 	ad7877_write(spi, AD7877_REG_SEQ1, AD7877_MM_SEQUENCE);
 
 	verify = ad7877_read(spi, AD7877_REG_SEQ1);
@@ -805,10 +912,17 @@ static int ad7877_resume(struct device *dev)
 
 static DEFINE_SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume);
 
+static const struct of_device_id ad7877_of_match[] = {
+	{ .compatible = "adi,ad7877", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ad7877_of_match);
+
 static struct spi_driver ad7877_driver = {
 	.driver = {
 		.name		= "ad7877",
 		.dev_groups	= ad7877_groups,
+		.of_match_table = ad7877_of_match,
 		.pm		= pm_sleep_ptr(&ad7877_pm),
 	},
 	.probe		= ad7877_probe,
diff --git a/include/linux/spi/ad7877.h b/include/linux/spi/ad7877.h
deleted file mode 100644
index b7be843c88e2..000000000000
--- a/include/linux/spi/ad7877.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/spi/ad7877.h */
-
-/* Touchscreen characteristics vary between boards and models.  The
- * platform_data for the device's "struct device" holds this information.
- *
- * It's OK if the min/max values are zero.
- */
-struct ad7877_platform_data {
-	u16	model;			/* 7877 */
-	u16	vref_delay_usecs;	/* 0 for external vref; etc */
-	u16	x_plate_ohms;
-	u16	y_plate_ohms;
-
-	u16	x_min, x_max;
-	u16	y_min, y_max;
-	u16	pressure_min, pressure_max;
-
-	u8	stopacq_polarity;	/* 1 = Active HIGH, 0 = Active LOW */
-	u8	first_conversion_delay;	/* 0 = 0.5us, 1 = 128us, 2 = 1ms, 3 = 8ms */
-	u8	acquisition_time;	/* 0 = 2us, 1 = 4us, 2 = 8us, 3 = 16us */
-	u8	averaging;		/* 0 = 1, 1 = 4, 2 = 8, 3 = 16 */
-	u8	pen_down_acc_interval;	/* 0 = covert once, 1 = every 0.5 ms,
-					   2 = ever 1 ms,   3 = every 8 ms,*/
-};
-- 
2.46.0


^ permalink raw reply related

* [PATCH v4 1/2] dt-bindings: touchscreen: add ad7877 support
From: Antoniu Miclaus @ 2024-09-13  7:52 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Michael Hennerich, Mark Brown, Antoniu Miclaus, linux-input,
	devicetree, linux-kernel, linux-spi

Add device tree bindings for ad7877.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
changes in v4:
 - add bindings patch first
 - update commit title/body based on review.
 - add units for pen-down-acc-interval property.
 - add default value for adi,acquisition-time-us and adi,vref-delay-us property
 .../input/touchscreen/adi,ad7877.yaml         | 106 ++++++++++++++++++
 1 file changed, 106 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml

diff --git a/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
new file mode 100644
index 000000000000..c472f50f7a59
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
@@ -0,0 +1,106 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/adi,ad7877.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD7877 Touch Screen Controller
+
+maintainers:
+  - Antoniu Miclaus <antoniu.miclaus@analog.com>
+
+description: |
+  Analog Devices Touch Screen Controller
+  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7877.pdf
+
+allOf:
+  - $ref: touchscreen.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - adi,ad7877
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  spi-max-frequency:
+    description: AD7877 SPI bus clock frequency.
+    minimum: 10000
+    maximum: 20000000
+
+  adi,stopacq-polarity:
+    description: The polarity of the signal applied to the STOPACQ pin.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [low, high]
+
+  adi,first-conv-delay-ns:
+    description: Delay in ns before the first conversion.
+    enum: [500, 128000, 1000000, 8000000]
+
+  adi,pen-down-acc-interval-us:
+    description: Enable the ADC to repeatedly perform conversions.
+    enum: [0, 500, 1000, 8000]
+    default: 0
+
+  adi,acquisition-time-us:
+    description: Select acquisition times in us for the ADC.
+    enum: [2, 4, 8, 16]
+    default: 2
+
+  adi,vref-delay-us:
+    description: Delay required for the SPI transfers depending on the VREF used.
+    default: 100
+
+  touchscreen-average-samples:
+    enum: [1, 4, 8, 16]
+
+  touchscreen-x-plate-ohms:
+    default: 400
+
+  touchscreen-min-x: true
+  touchscreen-min-y: true
+  touchscreen-size-x: true
+  touchscreen-size-y: true
+  touchscreen-max-pressure: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - touchscreen-average-samples
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      touchscreen@0 {
+        compatible = "adi,ad7877";
+        reg = <0>;
+        spi-max-frequency = <20000000>;
+        interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
+        interrupt-parent = <&gpio>;
+        adi,vref-delay-us = <100>;
+        adi,stopacq-polarity = "low";
+        adi,first-conv-delay-ns = <500>;
+        adi,pen-down-acc-interval-us = <0>;
+        adi,acquisition-time-us = <2>;
+        touchscreen-average-samples = <16>;
+        touchscreen-x-plate-ohms = <400>;
+        touchscreen-min-x = <0>;
+        touchscreen-min-y = <0>;
+        touchscreen-size-x = <800>;
+        touchscreen-size-y = <480>;
+        touchscreen-max-pressure = <4095>;
+      };
+    };
+...
-- 
2.46.0


^ permalink raw reply related

* [PATCH -next] hid: cp2112: Use irq_get_trigger_type() helper
From: Jinjie Ruan @ 2024-09-13  7:46 UTC (permalink / raw)
  To: jikos, bentiss, linux-input, linux-kernel; +Cc: ruanjinjie

Use irq_get_trigger_type() to replace irq_get_irq_data() and then
irqd_get_trigger_type(), if the irq data is NULL it will return 0.

No functional changed.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/hid/hid-cp2112.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index 20a0d1315d90..dae2b84a1490 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -1094,7 +1094,6 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
 {
 	struct cp2112_device *dev = container_of(work, struct cp2112_device,
 						 gpio_poll_worker.work);
-	struct irq_data *d;
 	u8 gpio_mask;
 	u32 irq_type;
 	int irq, virq, ret;
@@ -1111,12 +1110,10 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
 		if (!irq)
 			continue;
 
-		d = irq_get_irq_data(irq);
-		if (!d)
+		irq_type = irq_get_trigger_type(irq);
+		if (!irq_type)
 			continue;
 
-		irq_type = irqd_get_trigger_type(d);
-
 		if (gpio_mask & BIT(virq)) {
 			/* Level High */
 
-- 
2.34.1


^ permalink raw reply related

* Re: [PATCH 1/3] Drivers: hv: vmbus: Disable Suspend-to-Idle for VMBus
From: Naman Jain @ 2024-09-13  7:19 UTC (permalink / raw)
  To: Erni Sri Satya Vennela, kys, haiyangz, wei.liu, decui, jikos,
	bentiss, dmitry.torokhov, linux-hyperv, linux-input, linux-kernel
  Cc: ernis, Saurabh Sengar
In-Reply-To: <1726176470-13133-2-git-send-email-ernis@linux.microsoft.com>



On 9/13/2024 2:57 AM, Erni Sri Satya Vennela wrote:
> If the Virtual Machine Connection window is focused,
> a Hyper-V VM user can unintentionally touch the keyboard/mouse
> when the VM is hibernating or resuming, and consequently the
> hibernation or resume operation can be aborted unexpectedly.
> Fix the issue by no longer registering the keyboard/mouse as
> wakeup devices (see the other two patches for the
> changes to drivers/input/serio/hyperv-keyboard.c and
> drivers/hid/hid-hyperv.c).
> 
> The keyboard/mouse were registered as wakeup devices because the
> VM needs to be woken up from the Suspend-to-Idle state after
> a user runs "echo freeze > /sys/power/state". It seems like
> the Suspend-to-Idle feature has no real users in practice, so
> let's no longer support that by returning -EOPNOTSUPP if a
> user tries to use that.
> 

Maybe it would be good to capture here the kind of VMs that this is
going to be not supported - HyperV based VMs. You mentioned it in cover
letter, but it would be good to add it here as well, as cover letter
does not go to git log.

Also, the subject suggests that we are disabling suspend-to-idle for
vmbus specifically, but from commit description, it suggests that
"suspend to idle" feature itself is no longer supported on these
particular VMs. Please rephrase it based on what exactly we are trying
to do here. IIUC, we are now returning an error (EOPNOTSUPP) in vmbus
driver callback, which insures that we don't support Suspend-to-Idle in
these VMs.

> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
> ---
>   drivers/hv/vmbus_drv.c | 15 ++++++++++++++-
>   1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 965d2a4efb7e..4efd8856392f 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -900,6 +900,19 @@ static void vmbus_shutdown(struct device *child_device)
>   }
>   
>   #ifdef CONFIG_PM_SLEEP
> +/*
> + * vmbus_freeze - Suspend-to-Idle
> + */
> +static int vmbus_freeze(struct device *child_device)
> +{
> +/*
> + * Do not support Suspend-to-Idle ("echo freeze > /sys/power/state") as
> + * that would require registering the Hyper-V synthetic mouse/keyboard
> + * devices as wakeup devices, which can abort hibernation/resume unexpectedly.
> + */
> +	return -EOPNOTSUPP;
> +}
> +
>   /*
>    * vmbus_suspend - Suspend a vmbus device
>    */
> @@ -969,7 +982,7 @@ static void vmbus_device_release(struct device *device)
>    */
>   
>   static const struct dev_pm_ops vmbus_pm = {
> -	.suspend_noirq	= NULL,
> +	.suspend_noirq  = vmbus_freeze,
>   	.resume_noirq	= NULL,
>   	.freeze_noirq	= vmbus_suspend,

I am not sure if this is OK or how it works, but this naming scheme
seems a bit confusing to me -
*suspend* -> vmbus_*freeze*
*freeze* -> vmbus_*suspend*
and we are removing support for "freeze" by returning EOPNOTSUPP in
suspend callback.

I'll try to understand more on this, but just see if its OK.

>   	.thaw_noirq	= vmbus_resume,

Regards,
Naman

^ permalink raw reply

* RE: [PATCH] HID: plantronics: Additional PID for double volume key presses quirk
From: Wang, Wade @ 2024-09-13  7:16 UTC (permalink / raw)
  To: Greg KH
  Cc: jikos@kernel.org, bentiss@kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
In-Reply-To: <2024091355-antitrust-retiree-1299@gregkh>

Hi Greg,

Just add "Cc: stable@vger.kernel.org" in 2nd patch submission, because kernel test robot required. Any other thing I need to do for your question now? Thanks

Regards
Wade

-----Original Message-----
From: Greg KH <greg@kroah.com> 
Sent: Friday, September 13, 2024 2:28 PM
To: Wang, Wade <wade.wang@hp.com>
Cc: jikos@kernel.org; bentiss@kernel.org; linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; stable@vger.kernel.org
Subject: Re: [PATCH] HID: plantronics: Additional PID for double volume key presses quirk

CAUTION: External Email

On Fri, Sep 13, 2024 at 02:07:10PM +0800, Wade Wang wrote:
> Add the below headsets for double volume key presses quirk
>         Plantronics EncorePro 500 Series  (047f:431e)
>         Plantronics Blackwire_3325 Series (047f:430c)
>
> Quote from previous patch by Maxim Mikityanskiy and Terry Junge
>       'commit f567d6ef8606 ("HID: plantronics: Workaround for double volume
>        key presses")'
>       'commit 3d57f36c89d8 ("HID: plantronics: Additional PIDs for double
>        volume key presses quirk")'
> These Plantronics Series headset sends an opposite volume key 
> following each volume key press. This patch adds a quirk to 
> hid-plantronics for this product ID, which will ignore the second 
> opposite volume key press if it happens within 250 ms from the last one that was handled.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Wade Wang <wade.wang@hp.com>
> ---
>  drivers/hid/hid-ids.h         |  2 ++
>  drivers/hid/hid-plantronics.c | 11 +++++++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 
> 781c5aa29859..a0aaac98a891 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -1050,6 +1050,8 @@
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES      0xc056
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES      0xc057
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES      0xc058
> +#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES      0x430c
> +#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES               0x431e
>
>  #define USB_VENDOR_ID_PANASONIC              0x04da
>  #define USB_DEVICE_ID_PANABOARD_UBT780       0x1044
> diff --git a/drivers/hid/hid-plantronics.c 
> b/drivers/hid/hid-plantronics.c index 3d414ae194ac..2a19f3646ecb 
> 100644
> --- a/drivers/hid/hid-plantronics.c
> +++ b/drivers/hid/hid-plantronics.c
> @@ -38,8 +38,10 @@
>                           (usage->hid & HID_USAGE_PAGE) == 
> HID_UP_CONSUMER)
>
>  #define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0)
> +#define PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS BIT(1)
>
>  #define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */
> +#define PLT_FOLLOWED_KEY_TIMEOUT 250 /* ms */
>
>  struct plt_drv_data {
>       unsigned long device_type;
> @@ -134,6 +136,9 @@ static int plantronics_event(struct hid_device *hdev, struct hid_field *field,
>               cur_ts = jiffies;
>               if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_DOUBLE_KEY_TIMEOUT)
>                       return 1; /* Ignore the repeated key. */
> +             if ((drv_data->quirks & PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS)
> +              && jiffies_to_msecs(cur_ts - prev_ts) <= PLT_FOLLOWED_KEY_TIMEOUT)
> +                     return 1; /* Ignore the followed volume key. */
>
>               drv_data->last_volume_key_ts = cur_ts;
>       }
> @@ -210,6 +215,12 @@ static const struct hid_device_id plantronics_devices[] = {
>       { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
>                                        USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES),
>               .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
> +     { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
> +                                      USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES),
> +             .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
> +     { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
> +                                      USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES),
> +             .driver_data = 
> + PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
>       { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
>       { }
>  };
> --
> 2.34.1
>
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him a patch that has triggered this response.  He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created.  Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot


^ permalink raw reply

* Re: [PATCH 1/3] Drivers: hv: vmbus: Disable Suspend-to-Idle for VMBus
From: Saurabh Singh Sengar @ 2024-09-13  6:38 UTC (permalink / raw)
  To: Erni Sri Satya Vennela
  Cc: kys, haiyangz, wei.liu, decui, jikos, bentiss, dmitry.torokhov,
	linux-hyperv, linux-input, linux-kernel, ernis
In-Reply-To: <1726176470-13133-2-git-send-email-ernis@linux.microsoft.com>

On Thu, Sep 12, 2024 at 02:27:48PM -0700, Erni Sri Satya Vennela wrote:
> If the Virtual Machine Connection window is focused,
> a Hyper-V VM user can unintentionally touch the keyboard/mouse
> when the VM is hibernating or resuming, and consequently the
> hibernation or resume operation can be aborted unexpectedly.
> Fix the issue by no longer registering the keyboard/mouse as
> wakeup devices (see the other two patches for the
> changes to drivers/input/serio/hyperv-keyboard.c and
> drivers/hid/hid-hyperv.c).
> 
> The keyboard/mouse were registered as wakeup devices because the
> VM needs to be woken up from the Suspend-to-Idle state after
> a user runs "echo freeze > /sys/power/state". It seems like
> the Suspend-to-Idle feature has no real users in practice, so
> let's no longer support that by returning -EOPNOTSUPP if a
> user tries to use that.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>

Can we have a fixes tag ?
My vote is to backport this upto this commit atleast:
https://lore.kernel.org/all/1586663435-36243-1-git-send-email-decui@microsoft.com/

- Saurabh

> ---
>  drivers/hv/vmbus_drv.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 965d2a4efb7e..4efd8856392f 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -900,6 +900,19 @@ static void vmbus_shutdown(struct device *child_device)
>  }
>  
>  #ifdef CONFIG_PM_SLEEP
> +/*
> + * vmbus_freeze - Suspend-to-Idle
> + */
> +static int vmbus_freeze(struct device *child_device)
> +{
> +/*
> + * Do not support Suspend-to-Idle ("echo freeze > /sys/power/state") as
> + * that would require registering the Hyper-V synthetic mouse/keyboard
> + * devices as wakeup devices, which can abort hibernation/resume unexpectedly.
> + */
> +	return -EOPNOTSUPP;
> +}
> +
>  /*
>   * vmbus_suspend - Suspend a vmbus device
>   */
> @@ -969,7 +982,7 @@ static void vmbus_device_release(struct device *device)
>   */
>  
>  static const struct dev_pm_ops vmbus_pm = {
> -	.suspend_noirq	= NULL,
> +	.suspend_noirq  = vmbus_freeze,
>  	.resume_noirq	= NULL,
>  	.freeze_noirq	= vmbus_suspend,
>  	.thaw_noirq	= vmbus_resume,
> -- 
> 2.34.1

^ permalink raw reply

* Re: [PATCH] HID: plantronics: Additional PID for double volume key presses quirk
From: Greg KH @ 2024-09-13  6:28 UTC (permalink / raw)
  To: Wade Wang; +Cc: jikos, bentiss, linux-input, linux-kernel, stable
In-Reply-To: <20240913060710.1325640-1-wade.wang@hp.com>

On Fri, Sep 13, 2024 at 02:07:10PM +0800, Wade Wang wrote:
> Add the below headsets for double volume key presses quirk
>         Plantronics EncorePro 500 Series  (047f:431e)
>         Plantronics Blackwire_3325 Series (047f:430c)
> 
> Quote from previous patch by Maxim Mikityanskiy and Terry Junge
> 	'commit f567d6ef8606 ("HID: plantronics: Workaround for double volume
> 	 key presses")'
> 	'commit 3d57f36c89d8 ("HID: plantronics: Additional PIDs for double
> 	 volume key presses quirk")'
> These Plantronics Series headset sends an opposite volume key following
> each volume key press. This patch adds a quirk to hid-plantronics for this
> product ID, which will ignore the second opposite volume key press if it
> happens within 250 ms from the last one that was handled.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Wade Wang <wade.wang@hp.com>
> ---
>  drivers/hid/hid-ids.h         |  2 ++
>  drivers/hid/hid-plantronics.c | 11 +++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 781c5aa29859..a0aaac98a891 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -1050,6 +1050,8 @@
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES	0xc056
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES	0xc057
>  #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES	0xc058
> +#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES	0x430c
> +#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES		0x431e
>  
>  #define USB_VENDOR_ID_PANASONIC		0x04da
>  #define USB_DEVICE_ID_PANABOARD_UBT780	0x1044
> diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
> index 3d414ae194ac..2a19f3646ecb 100644
> --- a/drivers/hid/hid-plantronics.c
> +++ b/drivers/hid/hid-plantronics.c
> @@ -38,8 +38,10 @@
>  			    (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)
>  
>  #define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0)
> +#define PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS BIT(1)
>  
>  #define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */
> +#define PLT_FOLLOWED_KEY_TIMEOUT 250 /* ms */
>  
>  struct plt_drv_data {
>  	unsigned long device_type;
> @@ -134,6 +136,9 @@ static int plantronics_event(struct hid_device *hdev, struct hid_field *field,
>  		cur_ts = jiffies;
>  		if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_DOUBLE_KEY_TIMEOUT)
>  			return 1; /* Ignore the repeated key. */
> +		if ((drv_data->quirks & PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS)
> +		 && jiffies_to_msecs(cur_ts - prev_ts) <= PLT_FOLLOWED_KEY_TIMEOUT)
> +			return 1; /* Ignore the followed volume key. */
>  
>  		drv_data->last_volume_key_ts = cur_ts;
>  	}
> @@ -210,6 +215,12 @@ static const struct hid_device_id plantronics_devices[] = {
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
>  					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES),
>  		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
> +	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
> +					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES),
> +		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
> +	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
> +					 USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES),
> +		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
>  	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
>  	{ }
>  };
> -- 
> 2.34.1
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

^ permalink raw reply

* [PATCH] HID: plantronics: Update to map micmute controls
From: Wade Wang @ 2024-09-13  6:08 UTC (permalink / raw)
  To: jikos, bentiss, linux-input, linux-kernel, wade.wang; +Cc: stable

telephony page of Plantronics headset is ignored currently, it caused
micmute button no function, Now follow native HID key mapping for
telephony page map, telephony micmute key is enabled by default

Cc: stable@vger.kernel.org
Signed-off-by: Wade Wang <wade.wang@hp.com>
---
 drivers/hid/hid-plantronics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
index 2a19f3646ecb..2d17534fce61 100644
--- a/drivers/hid/hid-plantronics.c
+++ b/drivers/hid/hid-plantronics.c
@@ -77,10 +77,10 @@ static int plantronics_input_mapping(struct hid_device *hdev,
 		}
 	}
 	/* handle standard types - plt_type is 0xffa0uuuu or 0xffa2uuuu */
-	/* 'basic telephony compliant' - allow default consumer page map */
+	/* 'basic telephony compliant' - allow default consumer & telephony page map */
 	else if ((plt_type & HID_USAGE) >= PLT_BASIC_TELEPHONY &&
 		 (plt_type & HID_USAGE) != PLT_BASIC_EXCEPTION) {
-		if (PLT_ALLOW_CONSUMER)
+		if (PLT_ALLOW_CONSUMER || (usage->hid & HID_USAGE_PAGE) == HID_UP_TELEPHONY)
 			goto defaulted;
 	}
 	/* not 'basic telephony' - apply legacy mapping */
-- 
2.34.1


^ permalink raw reply related

* [PATCH] HID: plantronics: Additional PID for double volume key presses quirk
From: Wade Wang @ 2024-09-13  6:07 UTC (permalink / raw)
  To: jikos, bentiss, linux-input, linux-kernel, wade.wang; +Cc: stable

Add the below headsets for double volume key presses quirk
        Plantronics EncorePro 500 Series  (047f:431e)
        Plantronics Blackwire_3325 Series (047f:430c)

Quote from previous patch by Maxim Mikityanskiy and Terry Junge
	'commit f567d6ef8606 ("HID: plantronics: Workaround for double volume
	 key presses")'
	'commit 3d57f36c89d8 ("HID: plantronics: Additional PIDs for double
	 volume key presses quirk")'
These Plantronics Series headset sends an opposite volume key following
each volume key press. This patch adds a quirk to hid-plantronics for this
product ID, which will ignore the second opposite volume key press if it
happens within 250 ms from the last one that was handled.

Cc: stable@vger.kernel.org
Signed-off-by: Wade Wang <wade.wang@hp.com>
---
 drivers/hid/hid-ids.h         |  2 ++
 drivers/hid/hid-plantronics.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 781c5aa29859..a0aaac98a891 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1050,6 +1050,8 @@
 #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES	0xc056
 #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES	0xc057
 #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES	0xc058
+#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES	0x430c
+#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES		0x431e
 
 #define USB_VENDOR_ID_PANASONIC		0x04da
 #define USB_DEVICE_ID_PANABOARD_UBT780	0x1044
diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
index 3d414ae194ac..2a19f3646ecb 100644
--- a/drivers/hid/hid-plantronics.c
+++ b/drivers/hid/hid-plantronics.c
@@ -38,8 +38,10 @@
 			    (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)
 
 #define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0)
+#define PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS BIT(1)
 
 #define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */
+#define PLT_FOLLOWED_KEY_TIMEOUT 250 /* ms */
 
 struct plt_drv_data {
 	unsigned long device_type;
@@ -134,6 +136,9 @@ static int plantronics_event(struct hid_device *hdev, struct hid_field *field,
 		cur_ts = jiffies;
 		if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_DOUBLE_KEY_TIMEOUT)
 			return 1; /* Ignore the repeated key. */
+		if ((drv_data->quirks & PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS)
+		 && jiffies_to_msecs(cur_ts - prev_ts) <= PLT_FOLLOWED_KEY_TIMEOUT)
+			return 1; /* Ignore the followed volume key. */
 
 		drv_data->last_volume_key_ts = cur_ts;
 	}
@@ -210,6 +215,12 @@ static const struct hid_device_id plantronics_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
 					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES),
 		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
+					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES),
+		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
+					 USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES),
+		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
 	{ }
 };
-- 
2.34.1


^ permalink raw reply related

* [PATCH] HID: plantronics: Update to map micmute controls
From: Wade Wang @ 2024-09-13  5:58 UTC (permalink / raw)
  To: jikos, bentiss, linux-input, linux-kernel, wade.wang; +Cc: stable

telephony page of Plantronics headset is ignored currently, it caused
micmute button no function, Now follow native HID key mapping for
telephony page map, telephony micmute key is enabled by default

Signed-off-by: Wade Wang <wade.wang@hp.com>
---
 drivers/hid/hid-plantronics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
index 2a19f3646ecb..2d17534fce61 100644
--- a/drivers/hid/hid-plantronics.c
+++ b/drivers/hid/hid-plantronics.c
@@ -77,10 +77,10 @@ static int plantronics_input_mapping(struct hid_device *hdev,
 		}
 	}
 	/* handle standard types - plt_type is 0xffa0uuuu or 0xffa2uuuu */
-	/* 'basic telephony compliant' - allow default consumer page map */
+	/* 'basic telephony compliant' - allow default consumer & telephony page map */
 	else if ((plt_type & HID_USAGE) >= PLT_BASIC_TELEPHONY &&
 		 (plt_type & HID_USAGE) != PLT_BASIC_EXCEPTION) {
-		if (PLT_ALLOW_CONSUMER)
+		if (PLT_ALLOW_CONSUMER || (usage->hid & HID_USAGE_PAGE) == HID_UP_TELEPHONY)
 			goto defaulted;
 	}
 	/* not 'basic telephony' - apply legacy mapping */
-- 
2.34.1


^ permalink raw reply related

* [PATCH] HID: plantronics: Additional PID for double volume key presses quirk
From: Wade Wang @ 2024-09-13  5:58 UTC (permalink / raw)
  To: jikos, bentiss, linux-input, linux-kernel, wade.wang; +Cc: stable

Add the below headsets for double volume key presses quirk
        Plantronics EncorePro 500 Series  (047f:431e)
        Plantronics Blackwire_3325 Series (047f:430c)

Quote from previous patch by Maxim Mikityanskiy and Terry Junge
	'commit f567d6ef8606 ("HID: plantronics: Workaround for double volume
	 key presses")'
	'commit 3d57f36c89d8 ("HID: plantronics: Additional PIDs for double
	 volume key presses quirk")'
These Plantronics Series headset sends an opposite volume key following
each volume key press. This patch adds a quirk to hid-plantronics for this
product ID, which will ignore the second opposite volume key press if it
happens within 250 ms from the last one that was handled.

Signed-off-by: Wade Wang <wade.wang@hp.com>
---
 drivers/hid/hid-ids.h         |  2 ++
 drivers/hid/hid-plantronics.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 781c5aa29859..a0aaac98a891 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1050,6 +1050,8 @@
 #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES	0xc056
 #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES	0xc057
 #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES	0xc058
+#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES	0x430c
+#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES		0x431e
 
 #define USB_VENDOR_ID_PANASONIC		0x04da
 #define USB_DEVICE_ID_PANABOARD_UBT780	0x1044
diff --git a/drivers/hid/hid-plantronics.c b/drivers/hid/hid-plantronics.c
index 3d414ae194ac..2a19f3646ecb 100644
--- a/drivers/hid/hid-plantronics.c
+++ b/drivers/hid/hid-plantronics.c
@@ -38,8 +38,10 @@
 			    (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER)
 
 #define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0)
+#define PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS BIT(1)
 
 #define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */
+#define PLT_FOLLOWED_KEY_TIMEOUT 250 /* ms */
 
 struct plt_drv_data {
 	unsigned long device_type;
@@ -134,6 +136,9 @@ static int plantronics_event(struct hid_device *hdev, struct hid_field *field,
 		cur_ts = jiffies;
 		if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_DOUBLE_KEY_TIMEOUT)
 			return 1; /* Ignore the repeated key. */
+		if ((drv_data->quirks & PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS)
+		 && jiffies_to_msecs(cur_ts - prev_ts) <= PLT_FOLLOWED_KEY_TIMEOUT)
+			return 1; /* Ignore the followed volume key. */
 
 		drv_data->last_volume_key_ts = cur_ts;
 	}
@@ -210,6 +215,12 @@ static const struct hid_device_id plantronics_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
 					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES),
 		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
+					 USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES),
+		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
+					 USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES),
+		.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS|PLT_QUIRK_FOLLOWED_VOLUME_UP_DN_KEYS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
 	{ }
 };
-- 
2.34.1


^ permalink raw reply related

* [PATCH 3/3] Revert "HID: hyperv: register as a wakeup source"
From: Erni Sri Satya Vennela @ 2024-09-12 21:27 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, jikos, bentiss, dmitry.torokhov,
	linux-hyperv, linux-input, linux-kernel
  Cc: ernis, Erni Sri Satya Vennela
In-Reply-To: <1726176470-13133-1-git-send-email-ernis@linux.microsoft.com>

This reverts commit f1210455e78a610c7b316389b31c162c371d888c.

Remove mouse as wakeup source since Suspend-to-Idle feature
is disabled.

Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
---
 drivers/hid/hid-hyperv.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index f33485d83d24..b6d0f7db4c93 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -293,9 +293,6 @@ static void mousevsc_on_receive(struct hv_device *device,
 		memcpy(input_dev->input_buf, input_report->buffer, len);
 		hid_input_report(input_dev->hid_device, HID_INPUT_REPORT,
 				 input_dev->input_buf, len, 1);
-
-		pm_wakeup_hard_event(&input_dev->device->device);
-
 		break;
 	default:
 		pr_err("unsupported hid msg type - type %d len %d\n",
@@ -502,8 +499,6 @@ static int mousevsc_probe(struct hv_device *device,
 		goto probe_err2;
 	}
 
-	device_init_wakeup(&device->device, true);
-
 	input_dev->connected = true;
 	input_dev->init_complete = true;
 
@@ -526,7 +521,6 @@ static void mousevsc_remove(struct hv_device *dev)
 {
 	struct mousevsc_dev *input_dev = hv_get_drvdata(dev);
 
-	device_init_wakeup(&dev->device, false);
 	vmbus_close(dev->channel);
 	hid_hw_stop(input_dev->hid_device);
 	hid_destroy_device(input_dev->hid_device);
-- 
2.34.1


^ permalink raw reply related

* [PATCH 2/3] Revert "Input: hyperv-keyboard - register as a wakeup source"
From: Erni Sri Satya Vennela @ 2024-09-12 21:27 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, jikos, bentiss, dmitry.torokhov,
	linux-hyperv, linux-input, linux-kernel
  Cc: ernis, Erni Sri Satya Vennela
In-Reply-To: <1726176470-13133-1-git-send-email-ernis@linux.microsoft.com>

This reverts commit 62238f3aadc9bc56da70100e19ec61b9f8d72a5f.

Remove keyboard as wakeup source since Suspend-to-Idle feature
is disabled.

Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
---
 drivers/input/serio/hyperv-keyboard.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
index 31d9dacd2fd1..b42c546636bf 100644
--- a/drivers/input/serio/hyperv-keyboard.c
+++ b/drivers/input/serio/hyperv-keyboard.c
@@ -162,15 +162,6 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev,
 			serio_interrupt(kbd_dev->hv_serio, scan_code, 0);
 		}
 		spin_unlock_irqrestore(&kbd_dev->lock, flags);
-
-		/*
-		 * Only trigger a wakeup on key down, otherwise
-		 * "echo freeze > /sys/power/state" can't really enter the
-		 * state because the Enter-UP can trigger a wakeup at once.
-		 */
-		if (!(info & IS_BREAK))
-			pm_wakeup_hard_event(&hv_dev->device);
-
 		break;
 
 	default:
@@ -356,9 +347,6 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
 		goto err_close_vmbus;
 
 	serio_register_port(kbd_dev->hv_serio);
-
-	device_init_wakeup(&hv_dev->device, true);
-
 	return 0;
 
 err_close_vmbus:
-- 
2.34.1


^ permalink raw reply related

* [PATCH 1/3] Drivers: hv: vmbus: Disable Suspend-to-Idle for VMBus
From: Erni Sri Satya Vennela @ 2024-09-12 21:27 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, jikos, bentiss, dmitry.torokhov,
	linux-hyperv, linux-input, linux-kernel
  Cc: ernis, Erni Sri Satya Vennela, Saurabh Sengar
In-Reply-To: <1726176470-13133-1-git-send-email-ernis@linux.microsoft.com>

If the Virtual Machine Connection window is focused,
a Hyper-V VM user can unintentionally touch the keyboard/mouse
when the VM is hibernating or resuming, and consequently the
hibernation or resume operation can be aborted unexpectedly.
Fix the issue by no longer registering the keyboard/mouse as
wakeup devices (see the other two patches for the
changes to drivers/input/serio/hyperv-keyboard.c and
drivers/hid/hid-hyperv.c).

The keyboard/mouse were registered as wakeup devices because the
VM needs to be woken up from the Suspend-to-Idle state after
a user runs "echo freeze > /sys/power/state". It seems like
the Suspend-to-Idle feature has no real users in practice, so
let's no longer support that by returning -EOPNOTSUPP if a
user tries to use that.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com>
---
 drivers/hv/vmbus_drv.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 965d2a4efb7e..4efd8856392f 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -900,6 +900,19 @@ static void vmbus_shutdown(struct device *child_device)
 }
 
 #ifdef CONFIG_PM_SLEEP
+/*
+ * vmbus_freeze - Suspend-to-Idle
+ */
+static int vmbus_freeze(struct device *child_device)
+{
+/*
+ * Do not support Suspend-to-Idle ("echo freeze > /sys/power/state") as
+ * that would require registering the Hyper-V synthetic mouse/keyboard
+ * devices as wakeup devices, which can abort hibernation/resume unexpectedly.
+ */
+	return -EOPNOTSUPP;
+}
+
 /*
  * vmbus_suspend - Suspend a vmbus device
  */
@@ -969,7 +982,7 @@ static void vmbus_device_release(struct device *device)
  */
 
 static const struct dev_pm_ops vmbus_pm = {
-	.suspend_noirq	= NULL,
+	.suspend_noirq  = vmbus_freeze,
 	.resume_noirq	= NULL,
 	.freeze_noirq	= vmbus_suspend,
 	.thaw_noirq	= vmbus_resume,
-- 
2.34.1


^ permalink raw reply related

* [PATCH 0/3] Disable Suspend-to-Idle in Hyper-V and Fix Hibernation Interruptions
From: Erni Sri Satya Vennela @ 2024-09-12 21:27 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, jikos, bentiss, dmitry.torokhov,
	linux-hyperv, linux-input, linux-kernel
  Cc: ernis, Erni Sri Satya Vennela

It has been reported that Hyper-V VM users can unintentionally abort
hibernation by mouse or keyboard movements. To address this issue,
we have decided to remove the wakeup events for the Hyper-V keyboard
and mouse driver. However, this change introduces another problem: 
Suspend-to-Idle brings the system down with no method to wake it back up.

Given that there are no real users of Suspend-to-Idle in Hyper-V,
we have decided to disable this feature for VMBus. This results in:

$echo freeze > /sys/power/state
> bash: echo: write error: Operation not supported

The keyboard and mouse were previously registered as wakeup sources to
interrupt the freeze operation in a VM. Since the freeze operation itself
is no longer supported, we are disabling them as wakeup events.

This patchset ensures that the system remains stable and prevents
unintended interruptions during hibernation.

Erni Sri Satya Vennela (3):
  Drivers: hv: vmbus: Disable Suspend-to-Idle for VMBus
  Revert "Input: hyperv-keyboard - register as a wakeup source"
  Revert "HID: hyperv: register as a wakeup source"

 drivers/hid/hid-hyperv.c              |  6 ------
 drivers/hv/vmbus_drv.c                | 15 ++++++++++++++-
 drivers/input/serio/hyperv-keyboard.c | 12 ------------
 3 files changed, 14 insertions(+), 19 deletions(-)

-- 
2.34.1


^ permalink raw reply

* Re: [PATCH] Input: ps2-gpio - Use IRQF_NO_AUTOEN flag in request_irq()
From: Danilo Krummrich @ 2024-09-12 20:49 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: dmitry.torokhov, erick.archer, u.kleine-koenig, linus.walleij,
	robh, linux-input
In-Reply-To: <20240912033013.2610949-1-ruanjinjie@huawei.com>

On 9/12/24 5:30 AM, Jinjie Ruan wrote:
> disable_irq() after request_irq() still has a time gap in which
> interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
> disable IRQ auto-enable when request IRQ.
> 
> Fixes: 9ee0a0558819 ("Input: PS/2 gpio bit banging driver for serio bus")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Acked-by: Danilo Krummrich <dakr@kernel.org>

> ---
>   drivers/input/serio/ps2-gpio.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c
> index 0c8b390b8b4f..3a431395c464 100644
> --- a/drivers/input/serio/ps2-gpio.c
> +++ b/drivers/input/serio/ps2-gpio.c
> @@ -429,16 +429,14 @@ static int ps2_gpio_probe(struct platform_device *pdev)
>   	}
>   
>   	error = devm_request_irq(dev, drvdata->irq, ps2_gpio_irq,
> -				 IRQF_NO_THREAD, DRIVER_NAME, drvdata);
> +				 IRQF_NO_THREAD | IRQF_NO_AUTOEN, DRIVER_NAME,
> +				 drvdata);
>   	if (error) {
>   		dev_err(dev, "failed to request irq %d: %d\n",
>   			drvdata->irq, error);
>   		goto err_free_serio;
>   	}
>   
> -	/* Keep irq disabled until serio->open is called. */
> -	disable_irq(drvdata->irq);
> -
>   	serio->id.type = SERIO_8042;
>   	serio->open = ps2_gpio_open;
>   	serio->close = ps2_gpio_close;

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox