diff mbox series

[v1,4/5] HID: add reset() field to struct hid_ll_driver

Message ID 20211229231141.303919-5-dmanti@microsoft.com (mailing list archive)
State Superseded
Headers show
Series Add spi-hid, transport for HID over SPI bus | expand

Commit Message

Dmitry Antipov Dec. 29, 2021, 11:11 p.m. UTC
This new API allows a device driver to reset the device.

Signed-off-by: Dmitry Antipov <dmanti@microsoft.com>
---
 include/linux/hid.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Benjamin Tissoires Jan. 3, 2022, 3:32 p.m. UTC | #1
On Thu, Dec 30, 2021 at 12:11 AM Dmitry Antipov <daantipov@gmail.com> wrote:
>
> This new API allows a device driver to reset the device.
>
> Signed-off-by: Dmitry Antipov <dmanti@microsoft.com>
> ---
>  include/linux/hid.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/hid.h b/include/linux/hid.h
> index 97041c322a0f..129b542e1adb 100644
> --- a/include/linux/hid.h
> +++ b/include/linux/hid.h
> @@ -823,6 +823,7 @@ struct hid_driver {
>   * @output_report: send output report to device
>   * @idle: send idle request to device
>   * @may_wakeup: return if device may act as a wakeup source during system-suspend
> + * @reset: reset the device

I'm OK with this, but we probably expand it a little bit more (and in
the commit description too). What are we supposed to reset here? Just
assert the reset line or do a full probe of the device with re-asking
for the device descriptor, then the report descriptor?

If you can, it would be very nice (but not mandatory) to implement the
expected reset callback in i2c-hid or usbhid, so we get an idea on
what need to be done in that case. (i2c-hid would probably be closer
to spi-hid).

Cheers,
Benjamin

>   */
>  struct hid_ll_driver {
>         int (*start)(struct hid_device *hdev);
> @@ -848,6 +849,8 @@ struct hid_ll_driver {
>
>         int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
>         bool (*may_wakeup)(struct hid_device *hdev);
> +
> +       void (*reset)(struct hid_device *hdev);
>  };
>
>  extern struct hid_ll_driver i2c_hid_ll_driver;
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 97041c322a0f..129b542e1adb 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -823,6 +823,7 @@  struct hid_driver {
  * @output_report: send output report to device
  * @idle: send idle request to device
  * @may_wakeup: return if device may act as a wakeup source during system-suspend
+ * @reset: reset the device
  */
 struct hid_ll_driver {
 	int (*start)(struct hid_device *hdev);
@@ -848,6 +849,8 @@  struct hid_ll_driver {
 
 	int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
 	bool (*may_wakeup)(struct hid_device *hdev);
+
+	void (*reset)(struct hid_device *hdev);
 };
 
 extern struct hid_ll_driver i2c_hid_ll_driver;