diff mbox series

[2/3] Revert "Input: hyperv-keyboard - register as a wakeup source"

Message ID 1726176470-13133-3-git-send-email-ernis@linux.microsoft.com (mailing list archive)
State Superseded
Headers show
Series Disable Suspend-to-Idle in Hyper-V and Fix Hibernation Interruptions | expand

Commit Message

Erni Sri Satya Vennela Sept. 12, 2024, 9:27 p.m. UTC
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(-)

Comments

Srivatsa S. Bhat Sept. 24, 2024, 3:28 a.m. UTC | #1
[+linux-pm, Rafael, Len, Pavel]

On Thu, Sep 12, 2024 at 02:27:49PM -0700, Erni Sri Satya Vennela wrote:
> 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
> 
>
Dmitry Torokhov Oct. 4, 2024, 8:14 a.m. UTC | #2
On Tue, Sep 24, 2024 at 03:28:51AM +0000, Srivatsa S. Bhat wrote:
> [+linux-pm, Rafael, Len, Pavel]
> 
> On Thu, Sep 12, 2024 at 02:27:49PM -0700, Erni Sri Satya Vennela wrote:
> > 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);

If you do not want the keyboard to be a wakeup source by default maybe
change this to:

	device_set_wakeup_capable(&hv_dev->device, true);

and leave the rest of the driver alone?

Same for the HID change.

Thanks.
Erni Sri Satya Vennela Oct. 17, 2024, 1:44 p.m. UTC | #3
On Fri, Oct 04, 2024 at 01:14:10AM -0700, Dmitry Torokhov wrote:
> On Tue, Sep 24, 2024 at 03:28:51AM +0000, Srivatsa S. Bhat wrote:
> > [+linux-pm, Rafael, Len, Pavel]
> > 
> > On Thu, Sep 12, 2024 at 02:27:49PM -0700, Erni Sri Satya Vennela wrote:
> > > 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);
> 
> If you do not want the keyboard to be a wakeup source by default maybe
> change this to:
> 
> 	device_set_wakeup_capable(&hv_dev->device, true);
> 
> and leave the rest of the driver alone?
> 
> Same for the HID change.
> 
> Thanks.
>
device_set_wakeup_capable() sets the @dev's power.can_wakeup flag and
adds wakeup-related attributes in sysfs.

Could you please help me understand why explicitly calling this function 
can be helpful in our use case?

> -- 
> Dmitry
diff mbox series

Patch

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: