From: Oliver Neukum on
Am Sonntag, 11. April 2010 13:02:26 schrieb Bruno Prémont:
> Where do I find the bluetooth HID bits? I've been searching through kernel
> sources (under drivers/) but did not find bluetooth code trying to
> register a HID device...

net/bluetooth/hidp/core.c

> Below an updated patch which also calls the hook for auto-suspend case.
> The patch compiles but I've not runtime-tested it yet (especially for
> the auto-suspend part, as I'm not sure what should trigger it).

Looks basically good.

> As far as I understand the code, in auto-suspend case if the driver
> sends commands to the device it will have to call usbhid_wait_io().
> Please correct me if I'm wrong!

No, only if it wants to know that the command has finished.
hid_submit_out() will queue IO in the autosuspended case
and schedule a resumption.

> @@ -629,6 +632,11 @@ struct hid_driver {
> int (*input_mapped)(struct hid_device *hdev,
> struct hid_input *hidinput, struct hid_field *field,
> struct hid_usage *usage, unsigned long **bit, int *max);
> +#ifdef CONFIG_PM
> + int (*suspend)(struct hid_device *hdev, int auto_suspend);

It would be better to pass the full message.

Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Oliver Neukum on
Am Sonntag, 11. April 2010 20:40:02 schrieb Bruno Pr�mont:
> On Sun, 11 April 2010 Jiri Kosina <jkosina(a)suse.cz> wrote:
> > > As far as I understand the code, in auto-suspend case if the driver
> > > sends commands to the device it will have to call usbhid_wait_io().
> > > Please correct me if I'm wrong!
> >
> > It's not needed. There is a queuing mechanism in place on
> > 'resumption_waker' workqueue.
>
> So the driver is not allowed to ask the device to do something
> at auto-suspend time (as that would abort the auto-suspension).

From within suspend()?

Generally if the driver wants to talk to a device that's a good
reason to wake up a device.

Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Oliver Neukum on
Am Montag, 12. April 2010 18:56:07 schrieb Bruno Prémont:
> > Yes, it will wake the device up from auto-suspension. However, that's
> > usually what you want to happen, is there is anything you need to dispatch
> > to the device, isn't it?
>
> I thought of a report to send to device to ask the device to disable some
> power using feature (e.g. turning off or dimming LEDs)

The device should do this on its own. If it is really necessary you
can do this in suspend()

Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Jiri Kosina on
On Sun, 25 Apr 2010, Bruno Prémont wrote:

> Add suspend/resume hooks for HID drivers so these can do some
> additional state adjustment when device gets suspended/resumed.
>
> v3:
> - Pass full message to hid driver's suspend hook
> v2:
> - Adds auto_suspend parameter to suspend hook
> - Only calls HID driver's resume hooks when previous code
> did succeed
>

I have applied this to 'hid-suspend' branch of my tree for now. Thanks,

--
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/