[PATCH v3] powerpc: Add i8042 keyboard and mouse irq parsing

Grant Likely grant.likely at secretlab.ca
Wed May 26 06:21:50 EST 2010


On Tue, May 25, 2010 at 2:09 AM, Martyn Welch <martyn.welch at ge.com> wrote:
> Currently the irqs for the i8042, which historically provides keyboard and
> mouse (aux) support, is hardwired in the driver rather than parsing the
> dts.  This patch modifies the powerpc legacy IO code to attempt to parse
> the device tree for this information, failing back to the hardcoded values
> if it fails.
>
> Signed-off-by: Martyn Welch <martyn.welch at ge.com>
> ---
>
> v2: This patch no longer requires the DTS files to be modified, reading the
> interrupts from the current location as suggested by Grant.
>
> v3: Code compacted as suggested by Grant.
>
>  arch/powerpc/kernel/setup-common.c |   13 +++++++++++++
>  drivers/input/serio/i8042-io.h     |    5 +++++
>  2 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 48f0a00..3d169bb 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -94,6 +94,10 @@ struct screen_info screen_info = {
>        .orig_video_points = 16
>  };
>
> +/* Variables required to store legacy IO irq routing */
> +int of_i8042_kbd_irq;
> +int of_i8042_aux_irq;
> +
>  #ifdef __DO_IRQ_CANON
>  /* XXX should go elsewhere eventually */
>  int ppc_do_canonicalize_irqs;
> @@ -567,6 +571,15 @@ int check_legacy_ioport(unsigned long base_port)
>                        np = of_find_compatible_node(NULL, NULL, "pnpPNP,f03");
>                if (np) {
>                        parent = of_get_parent(np);
> +
> +                       of_i8042_kbd_irq = irq_of_parse_and_map(parent, 0);
> +                       if (!of_i8042_kbd_irq)
> +                               of_i8042_kbd_irq = 1;
> +
> +                       of_i8042_aux_irq = irq_of_parse_and_map(parent, 1);
> +                       if (!of_i8042_aux_irq)
> +                               of_i8042_aux_irq = 12;
> +

The patch looks okay to me.

BTW, where is the i8042 binding documented?  Ben, is this location of
the kbd/mouse irq historical, or is it just something that we happened
to get when the .dts files were first created?  Having the irq
specified directly in the kbd or aux nodes would make a lot more
sense, and if this isn't something already nailed down, then it
probably does make sense to move the irq specification, fall back to
the parent node to still support older trees, and with the hard coded
irq numbers as the last resort.

Cheers,
g.


More information about the devicetree-discuss mailing list