Re: [PATCH 07/13] Input: synaptics-rmi4 - add support for F03

2016-12-01 Thread Benjamin Tissoires
Hi Dmitry,

On Nov 30 2016 or thereabouts, Dmitry Torokhov wrote:
> Hi Benjamin,
> 
> On Tue, Nov 29, 2016 at 11:08:18AM +0100, Benjamin Tissoires wrote:
> > From: Lyude Paul 
> > 
> > This adds basic functionality for PS/2 passthrough on Synaptics
> > Touchpads using RMI4 through smbus.
> > 
> > Reviewed-by: Andrew Duggan 
> > Signed-off-by: Lyude Paul 
> > Signed-off-by: Benjamin Tissoires 
> > 
> > ---
> >  drivers/input/mouse/psmouse-base.c |   6 +
> >  drivers/input/rmi4/Kconfig |   9 ++
> >  drivers/input/rmi4/Makefile|   1 +
> >  drivers/input/rmi4/rmi_bus.c   |   3 +
> >  drivers/input/rmi4/rmi_driver.h|   1 +
> >  drivers/input/rmi4/rmi_f03.c   | 227 
> > +
> >  include/uapi/linux/serio.h |   1 +
> >  7 files changed, 248 insertions(+)
> >  create mode 100644 drivers/input/rmi4/rmi_f03.c
> > 
> > diff --git a/drivers/input/mouse/psmouse-base.c 
> > b/drivers/input/mouse/psmouse-base.c
> > index fb4b185..691dd74 100644
> > --- a/drivers/input/mouse/psmouse-base.c
> > +++ b/drivers/input/mouse/psmouse-base.c
> > @@ -1663,6 +1663,12 @@ static struct serio_device_id psmouse_serio_ids[] = {
> > .id = SERIO_ANY,
> > .extra  = SERIO_ANY,
> > },
> > +   {
> > +   .type   = SERIO_RMI_PSTHRU,
> 
> Why do we need new serio type here? We had SERIO_PS_PSTHRU because we
> needed some quirks in how it interacted with the parent PS/2 port, but
> here it seems SERIO_I8042 (which could be called SERIO_STANDARD_PS2)
> would suffice?

I guess this must be some kind of left over from the time we were trying
to fix the suspend/resume interactions between this driver and the PS/2
connection of the rmi-smbus devices.

Given the rest of the code which seems to be indeed not dependent of
SERIO_RMI_PSTHRU, I'll switch over to SERIO_I8042.

> 
> > +   .proto  = SERIO_ANY,
> > +   .id = SERIO_ANY,
> > +   .extra  = SERIO_ANY,
> > +   },
> > { 0 }
> >  };
> >  
> > diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
> > index a9c36a5..b8189a3 100644
> > --- a/drivers/input/rmi4/Kconfig
> > +++ b/drivers/input/rmi4/Kconfig
> > @@ -39,6 +39,15 @@ config RMI4_SMB
> >   To compile this driver as a module, choose M here: the module will be
> >   called rmi_smbus.
> >  
> > +config RMI4_F03
> > +bool "RMI4 Function 03 (PS2 Guest)"
> > +depends on RMI4_CORE
> > +help
> > +  Say Y here if you want to add support for RMI4 function 03.
> > +
> > +  Function 03 provides PS2 guest support for RMI4 devices. This
> > +  includes support for TrackPoints on TouchPads.
> > +
> >  config RMI4_2D_SENSOR
> > bool
> > depends on RMI4_CORE
> > diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile
> > index e7f4ca6..a199cbe 100644
> > --- a/drivers/input/rmi4/Makefile
> > +++ b/drivers/input/rmi4/Makefile
> > @@ -4,6 +4,7 @@ rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o
> >  rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o
> >  
> >  # Function drivers
> > +rmi_core-$(CONFIG_RMI4_F03) += rmi_f03.o
> >  rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
> >  rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o
> >  rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o
> > diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
> > index 81be9c1..1c40d94 100644
> > --- a/drivers/input/rmi4/rmi_bus.c
> > +++ b/drivers/input/rmi4/rmi_bus.c
> > @@ -305,6 +305,9 @@ struct bus_type rmi_bus_type = {
> >  
> >  static struct rmi_function_handler *fn_handlers[] = {
> > _f01_handler,
> > +#ifdef CONFIG_RMI4_F03
> > +   _f03_handler,
> > +#endif
> >  #ifdef CONFIG_RMI4_F11
> > _f11_handler,
> >  #endif
> > diff --git a/drivers/input/rmi4/rmi_driver.h 
> > b/drivers/input/rmi4/rmi_driver.h
> > index cc94585..24f8f76 100644
> > --- a/drivers/input/rmi4/rmi_driver.h
> > +++ b/drivers/input/rmi4/rmi_driver.h
> > @@ -121,6 +121,7 @@ static inline void rmi_f34_remove_sysfs(struct 
> > rmi_device *rmi_dev)
> >  #endif /* CONFIG_RMI_F34 */
> >  
> >  extern struct rmi_function_handler rmi_f01_handler;
> > +extern struct rmi_function_handler rmi_f03_handler;
> >  extern struct rmi_function_handler rmi_f11_handler;
> >  extern struct rmi_function_handler rmi_f12_handler;
> >  extern struct rmi_function_handler rmi_f30_handler;
> > diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
> > new file mode 100644
> > index 000..a7e1b98
> > --- /dev/null
> > +++ b/drivers/input/rmi4/rmi_f03.c
> > @@ -0,0 +1,227 @@
> > +/*
> > + * Copyright (C) 2015-2016 Red Hat
> > + * Copyright (C) 2015 Lyude Paul 
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License version 2 as 
> > published by
> > + * the Free Software 

Re: [PATCH 07/13] Input: synaptics-rmi4 - add support for F03

2016-12-01 Thread Benjamin Tissoires
Hi Dmitry,

On Nov 30 2016 or thereabouts, Dmitry Torokhov wrote:
> Hi Benjamin,
> 
> On Tue, Nov 29, 2016 at 11:08:18AM +0100, Benjamin Tissoires wrote:
> > From: Lyude Paul 
> > 
> > This adds basic functionality for PS/2 passthrough on Synaptics
> > Touchpads using RMI4 through smbus.
> > 
> > Reviewed-by: Andrew Duggan 
> > Signed-off-by: Lyude Paul 
> > Signed-off-by: Benjamin Tissoires 
> > 
> > ---
> >  drivers/input/mouse/psmouse-base.c |   6 +
> >  drivers/input/rmi4/Kconfig |   9 ++
> >  drivers/input/rmi4/Makefile|   1 +
> >  drivers/input/rmi4/rmi_bus.c   |   3 +
> >  drivers/input/rmi4/rmi_driver.h|   1 +
> >  drivers/input/rmi4/rmi_f03.c   | 227 
> > +
> >  include/uapi/linux/serio.h |   1 +
> >  7 files changed, 248 insertions(+)
> >  create mode 100644 drivers/input/rmi4/rmi_f03.c
> > 
> > diff --git a/drivers/input/mouse/psmouse-base.c 
> > b/drivers/input/mouse/psmouse-base.c
> > index fb4b185..691dd74 100644
> > --- a/drivers/input/mouse/psmouse-base.c
> > +++ b/drivers/input/mouse/psmouse-base.c
> > @@ -1663,6 +1663,12 @@ static struct serio_device_id psmouse_serio_ids[] = {
> > .id = SERIO_ANY,
> > .extra  = SERIO_ANY,
> > },
> > +   {
> > +   .type   = SERIO_RMI_PSTHRU,
> 
> Why do we need new serio type here? We had SERIO_PS_PSTHRU because we
> needed some quirks in how it interacted with the parent PS/2 port, but
> here it seems SERIO_I8042 (which could be called SERIO_STANDARD_PS2)
> would suffice?

I guess this must be some kind of left over from the time we were trying
to fix the suspend/resume interactions between this driver and the PS/2
connection of the rmi-smbus devices.

Given the rest of the code which seems to be indeed not dependent of
SERIO_RMI_PSTHRU, I'll switch over to SERIO_I8042.

> 
> > +   .proto  = SERIO_ANY,
> > +   .id = SERIO_ANY,
> > +   .extra  = SERIO_ANY,
> > +   },
> > { 0 }
> >  };
> >  
> > diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
> > index a9c36a5..b8189a3 100644
> > --- a/drivers/input/rmi4/Kconfig
> > +++ b/drivers/input/rmi4/Kconfig
> > @@ -39,6 +39,15 @@ config RMI4_SMB
> >   To compile this driver as a module, choose M here: the module will be
> >   called rmi_smbus.
> >  
> > +config RMI4_F03
> > +bool "RMI4 Function 03 (PS2 Guest)"
> > +depends on RMI4_CORE
> > +help
> > +  Say Y here if you want to add support for RMI4 function 03.
> > +
> > +  Function 03 provides PS2 guest support for RMI4 devices. This
> > +  includes support for TrackPoints on TouchPads.
> > +
> >  config RMI4_2D_SENSOR
> > bool
> > depends on RMI4_CORE
> > diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile
> > index e7f4ca6..a199cbe 100644
> > --- a/drivers/input/rmi4/Makefile
> > +++ b/drivers/input/rmi4/Makefile
> > @@ -4,6 +4,7 @@ rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o
> >  rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o
> >  
> >  # Function drivers
> > +rmi_core-$(CONFIG_RMI4_F03) += rmi_f03.o
> >  rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
> >  rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o
> >  rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o
> > diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
> > index 81be9c1..1c40d94 100644
> > --- a/drivers/input/rmi4/rmi_bus.c
> > +++ b/drivers/input/rmi4/rmi_bus.c
> > @@ -305,6 +305,9 @@ struct bus_type rmi_bus_type = {
> >  
> >  static struct rmi_function_handler *fn_handlers[] = {
> > _f01_handler,
> > +#ifdef CONFIG_RMI4_F03
> > +   _f03_handler,
> > +#endif
> >  #ifdef CONFIG_RMI4_F11
> > _f11_handler,
> >  #endif
> > diff --git a/drivers/input/rmi4/rmi_driver.h 
> > b/drivers/input/rmi4/rmi_driver.h
> > index cc94585..24f8f76 100644
> > --- a/drivers/input/rmi4/rmi_driver.h
> > +++ b/drivers/input/rmi4/rmi_driver.h
> > @@ -121,6 +121,7 @@ static inline void rmi_f34_remove_sysfs(struct 
> > rmi_device *rmi_dev)
> >  #endif /* CONFIG_RMI_F34 */
> >  
> >  extern struct rmi_function_handler rmi_f01_handler;
> > +extern struct rmi_function_handler rmi_f03_handler;
> >  extern struct rmi_function_handler rmi_f11_handler;
> >  extern struct rmi_function_handler rmi_f12_handler;
> >  extern struct rmi_function_handler rmi_f30_handler;
> > diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
> > new file mode 100644
> > index 000..a7e1b98
> > --- /dev/null
> > +++ b/drivers/input/rmi4/rmi_f03.c
> > @@ -0,0 +1,227 @@
> > +/*
> > + * Copyright (C) 2015-2016 Red Hat
> > + * Copyright (C) 2015 Lyude Paul 
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License version 2 as 
> > published by
> > + * the Free Software Foundation.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include "rmi_driver.h"
> > +
> 

Re: [PATCH 07/13] Input: synaptics-rmi4 - add support for F03

2016-11-30 Thread Dmitry Torokhov
Hi Benjamin,

On Tue, Nov 29, 2016 at 11:08:18AM +0100, Benjamin Tissoires wrote:
> From: Lyude Paul 
> 
> This adds basic functionality for PS/2 passthrough on Synaptics
> Touchpads using RMI4 through smbus.
> 
> Reviewed-by: Andrew Duggan 
> Signed-off-by: Lyude Paul 
> Signed-off-by: Benjamin Tissoires 
> 
> ---
>  drivers/input/mouse/psmouse-base.c |   6 +
>  drivers/input/rmi4/Kconfig |   9 ++
>  drivers/input/rmi4/Makefile|   1 +
>  drivers/input/rmi4/rmi_bus.c   |   3 +
>  drivers/input/rmi4/rmi_driver.h|   1 +
>  drivers/input/rmi4/rmi_f03.c   | 227 
> +
>  include/uapi/linux/serio.h |   1 +
>  7 files changed, 248 insertions(+)
>  create mode 100644 drivers/input/rmi4/rmi_f03.c
> 
> diff --git a/drivers/input/mouse/psmouse-base.c 
> b/drivers/input/mouse/psmouse-base.c
> index fb4b185..691dd74 100644
> --- a/drivers/input/mouse/psmouse-base.c
> +++ b/drivers/input/mouse/psmouse-base.c
> @@ -1663,6 +1663,12 @@ static struct serio_device_id psmouse_serio_ids[] = {
>   .id = SERIO_ANY,
>   .extra  = SERIO_ANY,
>   },
> + {
> + .type   = SERIO_RMI_PSTHRU,

Why do we need new serio type here? We had SERIO_PS_PSTHRU because we
needed some quirks in how it interacted with the parent PS/2 port, but
here it seems SERIO_I8042 (which could be called SERIO_STANDARD_PS2)
would suffice?

> + .proto  = SERIO_ANY,
> + .id = SERIO_ANY,
> + .extra  = SERIO_ANY,
> + },
>   { 0 }
>  };
>  
> diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
> index a9c36a5..b8189a3 100644
> --- a/drivers/input/rmi4/Kconfig
> +++ b/drivers/input/rmi4/Kconfig
> @@ -39,6 +39,15 @@ config RMI4_SMB
> To compile this driver as a module, choose M here: the module will be
> called rmi_smbus.
>  
> +config RMI4_F03
> +bool "RMI4 Function 03 (PS2 Guest)"
> +depends on RMI4_CORE
> +help
> +  Say Y here if you want to add support for RMI4 function 03.
> +
> +  Function 03 provides PS2 guest support for RMI4 devices. This
> +  includes support for TrackPoints on TouchPads.
> +
>  config RMI4_2D_SENSOR
>   bool
>   depends on RMI4_CORE
> diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile
> index e7f4ca6..a199cbe 100644
> --- a/drivers/input/rmi4/Makefile
> +++ b/drivers/input/rmi4/Makefile
> @@ -4,6 +4,7 @@ rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o
>  rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o
>  
>  # Function drivers
> +rmi_core-$(CONFIG_RMI4_F03) += rmi_f03.o
>  rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
>  rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o
>  rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o
> diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
> index 81be9c1..1c40d94 100644
> --- a/drivers/input/rmi4/rmi_bus.c
> +++ b/drivers/input/rmi4/rmi_bus.c
> @@ -305,6 +305,9 @@ struct bus_type rmi_bus_type = {
>  
>  static struct rmi_function_handler *fn_handlers[] = {
>   _f01_handler,
> +#ifdef CONFIG_RMI4_F03
> + _f03_handler,
> +#endif
>  #ifdef CONFIG_RMI4_F11
>   _f11_handler,
>  #endif
> diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
> index cc94585..24f8f76 100644
> --- a/drivers/input/rmi4/rmi_driver.h
> +++ b/drivers/input/rmi4/rmi_driver.h
> @@ -121,6 +121,7 @@ static inline void rmi_f34_remove_sysfs(struct rmi_device 
> *rmi_dev)
>  #endif /* CONFIG_RMI_F34 */
>  
>  extern struct rmi_function_handler rmi_f01_handler;
> +extern struct rmi_function_handler rmi_f03_handler;
>  extern struct rmi_function_handler rmi_f11_handler;
>  extern struct rmi_function_handler rmi_f12_handler;
>  extern struct rmi_function_handler rmi_f30_handler;
> diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
> new file mode 100644
> index 000..a7e1b98
> --- /dev/null
> +++ b/drivers/input/rmi4/rmi_f03.c
> @@ -0,0 +1,227 @@
> +/*
> + * Copyright (C) 2015-2016 Red Hat
> + * Copyright (C) 2015 Lyude Paul 
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published 
> by
> + * the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "rmi_driver.h"
> +
> +#define RMI_F03_RX_DATA_OFB  0x01
> +#define RMI_F03_OB_SIZE  2
> +
> +#define RMI_F03_OB_OFFSET2
> +#define RMI_F03_OB_DATA_OFFSET   1
> +#define RMI_F03_OB_FLAG_TIMEOUT  (1 << 6)
> +#define RMI_F03_OB_FLAG_PARITY   (1 << 7)

BIT()?

> +
> +#define RMI_F03_DEVICE_COUNT 0x07
> +#define RMI_F03_BYTES_PER_DEVICE_MASK0x70
> +#define RMI_F03_BYTES_PER_DEVICE_SHIFT   4
> +#define 

Re: [PATCH 07/13] Input: synaptics-rmi4 - add support for F03

2016-11-30 Thread Dmitry Torokhov
Hi Benjamin,

On Tue, Nov 29, 2016 at 11:08:18AM +0100, Benjamin Tissoires wrote:
> From: Lyude Paul 
> 
> This adds basic functionality for PS/2 passthrough on Synaptics
> Touchpads using RMI4 through smbus.
> 
> Reviewed-by: Andrew Duggan 
> Signed-off-by: Lyude Paul 
> Signed-off-by: Benjamin Tissoires 
> 
> ---
>  drivers/input/mouse/psmouse-base.c |   6 +
>  drivers/input/rmi4/Kconfig |   9 ++
>  drivers/input/rmi4/Makefile|   1 +
>  drivers/input/rmi4/rmi_bus.c   |   3 +
>  drivers/input/rmi4/rmi_driver.h|   1 +
>  drivers/input/rmi4/rmi_f03.c   | 227 
> +
>  include/uapi/linux/serio.h |   1 +
>  7 files changed, 248 insertions(+)
>  create mode 100644 drivers/input/rmi4/rmi_f03.c
> 
> diff --git a/drivers/input/mouse/psmouse-base.c 
> b/drivers/input/mouse/psmouse-base.c
> index fb4b185..691dd74 100644
> --- a/drivers/input/mouse/psmouse-base.c
> +++ b/drivers/input/mouse/psmouse-base.c
> @@ -1663,6 +1663,12 @@ static struct serio_device_id psmouse_serio_ids[] = {
>   .id = SERIO_ANY,
>   .extra  = SERIO_ANY,
>   },
> + {
> + .type   = SERIO_RMI_PSTHRU,

Why do we need new serio type here? We had SERIO_PS_PSTHRU because we
needed some quirks in how it interacted with the parent PS/2 port, but
here it seems SERIO_I8042 (which could be called SERIO_STANDARD_PS2)
would suffice?

> + .proto  = SERIO_ANY,
> + .id = SERIO_ANY,
> + .extra  = SERIO_ANY,
> + },
>   { 0 }
>  };
>  
> diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
> index a9c36a5..b8189a3 100644
> --- a/drivers/input/rmi4/Kconfig
> +++ b/drivers/input/rmi4/Kconfig
> @@ -39,6 +39,15 @@ config RMI4_SMB
> To compile this driver as a module, choose M here: the module will be
> called rmi_smbus.
>  
> +config RMI4_F03
> +bool "RMI4 Function 03 (PS2 Guest)"
> +depends on RMI4_CORE
> +help
> +  Say Y here if you want to add support for RMI4 function 03.
> +
> +  Function 03 provides PS2 guest support for RMI4 devices. This
> +  includes support for TrackPoints on TouchPads.
> +
>  config RMI4_2D_SENSOR
>   bool
>   depends on RMI4_CORE
> diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile
> index e7f4ca6..a199cbe 100644
> --- a/drivers/input/rmi4/Makefile
> +++ b/drivers/input/rmi4/Makefile
> @@ -4,6 +4,7 @@ rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o
>  rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o
>  
>  # Function drivers
> +rmi_core-$(CONFIG_RMI4_F03) += rmi_f03.o
>  rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
>  rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o
>  rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o
> diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
> index 81be9c1..1c40d94 100644
> --- a/drivers/input/rmi4/rmi_bus.c
> +++ b/drivers/input/rmi4/rmi_bus.c
> @@ -305,6 +305,9 @@ struct bus_type rmi_bus_type = {
>  
>  static struct rmi_function_handler *fn_handlers[] = {
>   _f01_handler,
> +#ifdef CONFIG_RMI4_F03
> + _f03_handler,
> +#endif
>  #ifdef CONFIG_RMI4_F11
>   _f11_handler,
>  #endif
> diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
> index cc94585..24f8f76 100644
> --- a/drivers/input/rmi4/rmi_driver.h
> +++ b/drivers/input/rmi4/rmi_driver.h
> @@ -121,6 +121,7 @@ static inline void rmi_f34_remove_sysfs(struct rmi_device 
> *rmi_dev)
>  #endif /* CONFIG_RMI_F34 */
>  
>  extern struct rmi_function_handler rmi_f01_handler;
> +extern struct rmi_function_handler rmi_f03_handler;
>  extern struct rmi_function_handler rmi_f11_handler;
>  extern struct rmi_function_handler rmi_f12_handler;
>  extern struct rmi_function_handler rmi_f30_handler;
> diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c
> new file mode 100644
> index 000..a7e1b98
> --- /dev/null
> +++ b/drivers/input/rmi4/rmi_f03.c
> @@ -0,0 +1,227 @@
> +/*
> + * Copyright (C) 2015-2016 Red Hat
> + * Copyright (C) 2015 Lyude Paul 
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published 
> by
> + * the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "rmi_driver.h"
> +
> +#define RMI_F03_RX_DATA_OFB  0x01
> +#define RMI_F03_OB_SIZE  2
> +
> +#define RMI_F03_OB_OFFSET2
> +#define RMI_F03_OB_DATA_OFFSET   1
> +#define RMI_F03_OB_FLAG_TIMEOUT  (1 << 6)
> +#define RMI_F03_OB_FLAG_PARITY   (1 << 7)

BIT()?

> +
> +#define RMI_F03_DEVICE_COUNT 0x07
> +#define RMI_F03_BYTES_PER_DEVICE_MASK0x70
> +#define RMI_F03_BYTES_PER_DEVICE_SHIFT   4
> +#define RMI_F03_QUEUE_LENGTH 0x0F
> +
> +struct f03_data {
> + struct rmi_function *fn;
> +
> + struct serio *serio;