summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard
AgeCommit message (Collapse)Author
2012-05-10Input: spear-keyboard - add device tree bindingsViresh Kumar
This adds simple DT bindings for spear-keyboard controller. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-05-10Input: matrix-keymap - wire up device tree supportDmitry Torokhov
When platform keymap is not supplied to matrix_keypad_build_keymap() and device tree support is enabled, try locating specified property and load keymap from it. If property name is not defined, try using "linux,keymap". Based on earlier patch by Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-05-10Input: matrix-keymap - uninline and prepare for device tree supportDmitry Torokhov
Change matrix-keymap helper to be out-of-line, like sparse keymap, allow the helper perform basic keymap validation and return errors, and prepare for device tree support. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-05-10Input: adp5588 - add support for gpio namesJean-François Dagenais
Signed-off-by: Jean-François Dagenais <jeff.dagenais@gmail.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-05-10Input: omap-keypad - dynamically handle register offsetsPoddar, Sourav
Hi Dmitry, On Wed, May 9, 2012 at 3:14 PM, Poddar, Sourav <sourav.poddar@ti.com> wrote: > Hi Dmitry, > > I did some minor fixes to the patch which you suggested above and > the keypad is functional now. > > Changes: > - Move "pm_runtime_enable" before using "pm_runtime_get_sync". > > Sending the patch inlined..(also attached). > > From: G, Manjunath Kondaiah <manjugk@ti.com> > Date: Mon, 10 Oct 2011 20:52:05 +0530 > Subject: [PATCH] Input: omap-keypad: dynamically handle register offsets > > Keypad controller register offsets are different for omap4 > and omap5. Handle these offsets through static mapping and > assign these mappings during run time. > > Tested on omap4430 sdp with 3.4-rc3. > Tested on omap5430evm with 3.1-custom kernel. > > Cc: Andrew Morton <akpm@linux-foundation.org> > Signed-off-by: Felipe Balbi <balbi@ti.com> > Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com> > Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> > Signed-off-by: Dmitry Torokhov <dtor@mail.ru> > --- >  drivers/input/keyboard/Kconfig        |    4 +- >  drivers/input/keyboard/omap4-keypad.c |  120 +++++++++++++++++++++++++------- >  2 files changed, 95 insertions(+), 29 deletions(-) > > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig > index f354813..33bbdee 100644 > --- a/drivers/input/keyboard/Kconfig > +++ b/drivers/input/keyboard/Kconfig > @@ -512,9 +512,9 @@ config KEYBOARD_OMAP >          module will be called omap-keypad. > >  config KEYBOARD_OMAP4 > -       tristate "TI OMAP4 keypad support" > +       tristate "TI OMAP4+ keypad support" >        help > -         Say Y here if you want to use the OMAP4 keypad. > +         Say Y here if you want to use the OMAP4+ keypad. > >          To compile this driver as a module, choose M here: the >          module will be called omap4-keypad. > diff --git a/drivers/input/keyboard/omap4-keypad.c > b/drivers/input/keyboard/omap4-keypad.c > index e809ac0..d7102e8 100644 > --- a/drivers/input/keyboard/omap4-keypad.c > +++ b/drivers/input/keyboard/omap4-keypad.c > @@ -68,19 +68,52 @@ > >  #define OMAP4_MASK_IRQSTATUSDISABLE    0xFFFF > > +enum { > +       KBD_REVISION_OMAP4 = 0, > +       KBD_REVISION_OMAP5, > +}; > + >  struct omap4_keypad { >        struct input_dev *input; > >        void __iomem *base; > -       int irq; > +       unsigned int irq; > >        unsigned int rows; >        unsigned int cols; > +       u32 reg_offset; > +       u32 irqreg_offset; >        unsigned int row_shift; >        unsigned char key_state[8]; >        unsigned short keymap[]; >  }; > > +static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) > +{ > +       return __raw_readl(keypad_data->base + > +                               keypad_data->reg_offset + offset); > +} > + > +static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value) > +{ > +       __raw_writel(value, > +                    keypad_data->base + keypad_data->reg_offset + offset); > +} > + > +static int kbd_read_irqreg(struct omap4_keypad *keypad_data, u32 offset) > +{ > +       return __raw_readl(keypad_data->base + > +                               keypad_data->irqreg_offset + offset); > +} > + > +static void kbd_write_irqreg(struct omap4_keypad *keypad_data, > +                            u32 offset, u32 value) > +{ > +       __raw_writel(value, > +                    keypad_data->base + keypad_data->irqreg_offset + offset); > +} > + > + >  /* Interrupt handler */ >  static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) >  { > @@ -91,12 +124,11 @@ static irqreturn_t omap4_keypad_interrupt(int > irq, void *dev_id) >        u32 *new_state = (u32 *) key_state; > >        /* Disable interrupts */ > -       __raw_writel(OMAP4_VAL_IRQDISABLE, > -                    keypad_data->base + OMAP4_KBD_IRQENABLE); > +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, > +                        OMAP4_VAL_IRQDISABLE); > > -       *new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0); > -       *(new_state + 1) = __raw_readl(keypad_data->base > -                                               + OMAP4_KBD_FULLCODE63_32); > +       *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0); > +       *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32); > >        for (row = 0; row < keypad_data->rows; row++) { >                changed = key_state[row] ^ keypad_data->key_state[row]; > @@ -121,12 +153,13 @@ static irqreturn_t omap4_keypad_interrupt(int > irq, void *dev_id) >                sizeof(keypad_data->key_state)); > >        /* clear pending interrupts */ > -       __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS), > -                       keypad_data->base + OMAP4_KBD_IRQSTATUS); > +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, > +                        kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); > >        /* enable interrupts */ > -       __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY, > -                       keypad_data->base + OMAP4_KBD_IRQENABLE); > +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, > +               OMAP4_DEF_IRQENABLE_EVENTEN | > +                               OMAP4_DEF_IRQENABLE_LONGKEY); > >        return IRQ_HANDLED; >  } > @@ -139,16 +172,17 @@ static int omap4_keypad_open(struct input_dev *input) > >        disable_irq(keypad_data->irq); > > -       __raw_writel(OMAP4_VAL_FUNCTIONALCFG, > -                       keypad_data->base + OMAP4_KBD_CTRL); > -       __raw_writel(OMAP4_VAL_DEBOUNCINGTIME, > -                       keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME); > -       __raw_writel(OMAP4_VAL_IRQDISABLE, > -                       keypad_data->base + OMAP4_KBD_IRQSTATUS); > -       __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY, > -                       keypad_data->base + OMAP4_KBD_IRQENABLE); > -       __raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA, > -                       keypad_data->base + OMAP4_KBD_WAKEUPENABLE); > +       kbd_writel(keypad_data, OMAP4_KBD_CTRL, > +                       OMAP4_VAL_FUNCTIONALCFG); > +       kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME, > +                       OMAP4_VAL_DEBOUNCINGTIME); > +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, > +                       OMAP4_VAL_IRQDISABLE); > +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, > +                       OMAP4_DEF_IRQENABLE_EVENTEN | > +                               OMAP4_DEF_IRQENABLE_LONGKEY); > +       kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE, > +                       OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA); > >        enable_irq(keypad_data->irq); > > @@ -162,12 +196,12 @@ static void omap4_keypad_close(struct input_dev *input) >        disable_irq(keypad_data->irq); > >        /* Disable interrupts */ > -       __raw_writel(OMAP4_VAL_IRQDISABLE, > -                    keypad_data->base + OMAP4_KBD_IRQENABLE); > +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, > +                        OMAP4_VAL_IRQDISABLE); > >        /* clear pending interrupts */ > -       __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS), > -                       keypad_data->base + OMAP4_KBD_IRQSTATUS); > +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, > +                        kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); > >        enable_irq(keypad_data->irq); > > @@ -182,6 +216,7 @@ static int __devinit omap4_keypad_probe(struct > platform_device *pdev) >        struct resource *res; >        resource_size_t size; >        unsigned int row_shift, max_keys; > +       int rev; >        int irq; >        int error; > > @@ -241,11 +276,40 @@ static int __devinit omap4_keypad_probe(struct > platform_device *pdev) >        keypad_data->rows = pdata->rows; >        keypad_data->cols = pdata->cols; > > +       /* > +       * Enable clocks for the keypad module so that we can read > +       * revision register. > +       */ > +       pm_runtime_enable(&pdev->dev); > +       error = pm_runtime_get_sync(&pdev->dev); > +       if (error) { > +               dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n"); > +               goto err_unmap; > +       } > +       rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); > +       rev &= 0x03 << 30; > +       rev >>= 30; > +       switch (rev) { > +       case KBD_REVISION_OMAP4: > +               keypad_data->reg_offset = 0x00; > +               keypad_data->irqreg_offset = 0x00; > +               break; > +       case KBD_REVISION_OMAP5: > +               keypad_data->reg_offset = 0x10; > +               keypad_data->irqreg_offset = 0x0c; > +               break; > +       default: > +               dev_err(&pdev->dev, > +                       "Keypad reports unsupported revision %d", rev); > +               error = -EINVAL; > +               goto err_pm_put_sync; > +       } > + >        /* input device allocation */ >        keypad_data->input = input_dev = input_allocate_device(); >        if (!input_dev) { >                error = -ENOMEM; > -               goto err_unmap; > +               goto err_pm_put_sync; >        } > >        input_dev->name = pdev->name; > @@ -273,14 +337,14 @@ static int __devinit omap4_keypad_probe(struct > platform_device *pdev) >                        input_dev->keycode, input_dev->keybit); > >        error = request_irq(keypad_data->irq, omap4_keypad_interrupt, > -                            IRQF_TRIGGER_RISING, > +                           IRQF_DISABLED | IRQF_TRIGGER_RISING, Sorry, " IRQF_DISABLED" got included by mistake. Removing this stray change and sending it again. >                             "omap4-keypad", keypad_data); >        if (error) { >                dev_err(&pdev->dev, "failed to register interrupt\n"); >                goto err_free_input; >        } > > -       pm_runtime_enable(&pdev->dev); > +       pm_runtime_put_sync(&pdev->dev); > >        error = input_register_device(keypad_data->input); >        if (error < 0) { > @@ -296,6 +360,8 @@ err_pm_disable: >        free_irq(keypad_data->irq, keypad_data); >  err_free_input: >        input_free_device(input_dev); > +err_pm_put_sync: > +       pm_runtime_put_sync(&pdev->dev); >  err_unmap: >        iounmap(keypad_data->base); >  err_release_mem: > > > ~Sourav > > On Wed, May 9, 2012 at 1:15 PM, Dmitry Torokhov > <dmitry.torokhov@gmail.com> wrote: >>> Hi Dmitry , >>> >>> >>> On Wed, May 9, 2012 at 10:48 AM, Dmitry Torokhov >>> <dmitry.torokhov@gmail.com> wrote: >>> > Ho Sourav, >>> > >>> > On Thu, Apr 26, 2012 at 11:24:37AM +0530, Sourav Poddar wrote: >>> >> >>> >> -config KEYBOARD_OMAP4 >>> >> -     tristate "TI OMAP4 keypad support" >>> >> +config KEYBOARD_OMAP4+ >>> > >>> > I think this works purely by accident - '+' sign getting dropped by >>> > parser... >>> > >>> >> @@ -139,16 +192,33 @@ static int omap4_keypad_open(struct input_dev *input) >>> >> >>> >>       disable_irq(keypad_data->irq); >>> >> >>> >> -     __raw_writel(OMAP4_VAL_FUNCTIONALCFG, >>> >> -                     keypad_data->base + OMAP4_KBD_CTRL); >>> >> -     __raw_writel(OMAP4_VAL_DEBOUNCINGTIME, >>> >> -                     keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME); >>> >> -     __raw_writel(OMAP4_VAL_IRQDISABLE, >>> >> -                     keypad_data->base + OMAP4_KBD_IRQSTATUS); >>> >> -     __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY, >>> >> -                     keypad_data->base + OMAP4_KBD_IRQENABLE); >>> >> -     __raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA, >>> >> -                     keypad_data->base + OMAP4_KBD_WAKEUPENABLE); >>> >> +     keypad_data->revision = kbd_read_revision(keypad_data, >>> >> +                     OMAP4_KBD_REVISION); >>> >> +     switch (keypad_data->revision) { >>> >> +     case 1: >>> >> +             keypad_data->irqstatus = OMAP4_KBD_IRQSTATUS + 0x0c; >>> >> +             keypad_data->irqenable = OMAP4_KBD_IRQENABLE + 0x0c; >>> >> +             keypad_data->reg_offset = 0x10; >>> >> +             break; >>> > >>> > This should be done in probe(). >>> > >>> Dont we then require "pm_runtime_put_sync" in probe, since we are trying >>> to read the keypad revision register.? >> >> Ah, indeed, but I think not pm_runtime_get_sync() but >> pm_runtime_set_active(). >> >> Not sure if this will fix the crash... >> >> -- >> Dmitry >> >> >> Input: omap-keypad - dynamically handle register offsets >> >> From: G, Manjunath Kondaiah <manjugk@ti.com> >> >> Keypad controller register offsets are different for omap4 >> and omap5. Handle these offsets through static mapping and >> assign these mappings during run time. >> >> Tested on omap4430 sdp with 3.4-rc3. >> Tested on omap5430evm with 3.1-custom kernel. >> >> Signed-off-by: Felipe Balbi <balbi@ti.com> >> Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com> >> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> >> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> >> --- >> >>  drivers/input/keyboard/Kconfig        |    4 + >>  drivers/input/keyboard/omap4-keypad.c |  117 ++++++++++++++++++++++++++------- >>  2 files changed, 94 insertions(+), 27 deletions(-) >> >> >> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig >> index 20a3753..84ee155 100644 >> --- a/drivers/input/keyboard/Kconfig >> +++ b/drivers/input/keyboard/Kconfig >> @@ -531,9 +531,9 @@ config KEYBOARD_OMAP >>          module will be called omap-keypad. >> >>  config KEYBOARD_OMAP4 >> -       tristate "TI OMAP4 keypad support" >> +       tristate "TI OMAP4+ keypad support" >>        help >> -         Say Y here if you want to use the OMAP4 keypad. >> +         Say Y here if you want to use the OMAP4+ keypad. >> >>          To compile this driver as a module, choose M here: the >>          module will be called omap4-keypad. >> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c >> index e809ac0..c9fd0df 100644 >> --- a/drivers/input/keyboard/omap4-keypad.c >> +++ b/drivers/input/keyboard/omap4-keypad.c >> @@ -68,19 +68,52 @@ >> >>  #define OMAP4_MASK_IRQSTATUSDISABLE    0xFFFF >> >> +enum { >> +       KBD_REVISION_OMAP4 = 0, >> +       KBD_REVISION_OMAP5, >> +}; >> + >>  struct omap4_keypad { >>        struct input_dev *input; >> >>        void __iomem *base; >> -       int irq; >> +       unsigned int irq; >> >>        unsigned int rows; >>        unsigned int cols; >> +       u32 reg_offset; >> +       u32 irqreg_offset; >>        unsigned int row_shift; >>        unsigned char key_state[8]; >>        unsigned short keymap[]; >>  }; >> >> +static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) >> +{ >> +       return __raw_readl(keypad_data->base + >> +                               keypad_data->reg_offset + offset); >> +} >> + >> +static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value) >> +{ >> +       __raw_writel(value, >> +                    keypad_data->base + keypad_data->reg_offset + offset); >> +} >> + >> +static int kbd_read_irqreg(struct omap4_keypad *keypad_data, u32 offset) >> +{ >> +       return __raw_readl(keypad_data->base + >> +                               keypad_data->irqreg_offset + offset); >> +} >> + >> +static void kbd_write_irqreg(struct omap4_keypad *keypad_data, >> +                            u32 offset, u32 value) >> +{ >> +       __raw_writel(value, >> +                    keypad_data->base + keypad_data->irqreg_offset + offset); >> +} >> + >> + >>  /* Interrupt handler */ >>  static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) >>  { >> @@ -91,12 +124,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) >>        u32 *new_state = (u32 *) key_state; >> >>        /* Disable interrupts */ >> -       __raw_writel(OMAP4_VAL_IRQDISABLE, >> -                    keypad_data->base + OMAP4_KBD_IRQENABLE); >> +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, >> +                        OMAP4_VAL_IRQDISABLE); >> >> -       *new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0); >> -       *(new_state + 1) = __raw_readl(keypad_data->base >> -                                               + OMAP4_KBD_FULLCODE63_32); >> +       *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0); >> +       *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32); >> >>        for (row = 0; row < keypad_data->rows; row++) { >>                changed = key_state[row] ^ keypad_data->key_state[row]; >> @@ -121,12 +153,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) >>                sizeof(keypad_data->key_state)); >> >>        /* clear pending interrupts */ >> -       __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS), >> -                       keypad_data->base + OMAP4_KBD_IRQSTATUS); >> +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, >> +                        kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); >> >>        /* enable interrupts */ >> -       __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY, >> -                       keypad_data->base + OMAP4_KBD_IRQENABLE); >> +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, >> +               OMAP4_DEF_IRQENABLE_EVENTEN | >> +                               OMAP4_DEF_IRQENABLE_LONGKEY); >> >>        return IRQ_HANDLED; >>  } >> @@ -139,16 +172,17 @@ static int omap4_keypad_open(struct input_dev *input) >> >>        disable_irq(keypad_data->irq); >> >> -       __raw_writel(OMAP4_VAL_FUNCTIONALCFG, >> -                       keypad_data->base + OMAP4_KBD_CTRL); >> -       __raw_writel(OMAP4_VAL_DEBOUNCINGTIME, >> -                       keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME); >> -       __raw_writel(OMAP4_VAL_IRQDISABLE, >> -                       keypad_data->base + OMAP4_KBD_IRQSTATUS); >> -       __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY, >> -                       keypad_data->base + OMAP4_KBD_IRQENABLE); >> -       __raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA, >> -                       keypad_data->base + OMAP4_KBD_WAKEUPENABLE); >> +       kbd_writel(keypad_data, OMAP4_KBD_CTRL, >> +                       OMAP4_VAL_FUNCTIONALCFG); >> +       kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME, >> +                       OMAP4_VAL_DEBOUNCINGTIME); >> +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, >> +                       OMAP4_VAL_IRQDISABLE); >> +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, >> +                       OMAP4_DEF_IRQENABLE_EVENTEN | >> +                               OMAP4_DEF_IRQENABLE_LONGKEY); >> +       kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE, >> +                       OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA); >> >>        enable_irq(keypad_data->irq); >> >> @@ -162,12 +196,12 @@ static void omap4_keypad_close(struct input_dev *input) >>        disable_irq(keypad_data->irq); >> >>        /* Disable interrupts */ >> -       __raw_writel(OMAP4_VAL_IRQDISABLE, >> -                    keypad_data->base + OMAP4_KBD_IRQENABLE); >> +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, >> +                        OMAP4_VAL_IRQDISABLE); >> >>        /* clear pending interrupts */ >> -       __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS), >> -                       keypad_data->base + OMAP4_KBD_IRQSTATUS); >> +       kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, >> +                        kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); >> >>        enable_irq(keypad_data->irq); >> >> @@ -182,6 +216,7 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) >>        struct resource *res; >>        resource_size_t size; >>        unsigned int row_shift, max_keys; >> +       int rev; >>        int irq; >>        int error; >> >> @@ -241,11 +276,40 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) >>        keypad_data->rows = pdata->rows; >>        keypad_data->cols = pdata->cols; >> >> +       /* >> +        * Mark device as active (and wake up its parent) so we can read >> +        * revision register. >> +        */ >> +       error = pm_runtime_set_active(&pdev->dev); >> +       if (error) { >> +               dev_err(&pdev->dev, "pm_runtime_set_active() failed\n"); >> +               goto err_unmap; >> +       } >> + >> +       rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); >> +       rev &= 0x03 << 30; >> +       rev >>= 30; >> +       switch (rev) { >> +       case KBD_REVISION_OMAP4: >> +               keypad_data->reg_offset = 0x00; >> +               keypad_data->irqreg_offset = 0x00; >> +               break; >> +       case KBD_REVISION_OMAP5: >> +               keypad_data->reg_offset = 0x10; >> +               keypad_data->irqreg_offset = 0x0c; >> +               break; >> +       default: >> +               dev_err(&pdev->dev, >> +                       "Keypad reports unsupported revision %d", rev); >> +               error = -EINVAL; >> +               goto err_pm_suspended; >> +       } >> + >>        /* input device allocation */ >>        keypad_data->input = input_dev = input_allocate_device(); >>        if (!input_dev) { >>                error = -ENOMEM; >> -               goto err_unmap; >> +               goto err_pm_suspended; >>        } >> >>        input_dev->name = pdev->name; >> @@ -281,6 +345,7 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) >>        } >> >>        pm_runtime_enable(&pdev->dev); >> +       pm_runtime_put_sync(&pdev->dev); >> >>        error = input_register_device(keypad_data->input); >>        if (error < 0) { >> @@ -296,6 +361,8 @@ err_pm_disable: >>        free_irq(keypad_data->irq, keypad_data); >>  err_free_input: >>        input_free_device(input_dev); >> +err_pm_suspended: >> +       pm_runtime_set_suspended(&pdev->dev); >>  err_unmap: >>        iounmap(keypad_data->base); >>  err_release_mem: From: G, Manjunath Kondaiah <manjugk@ti.com> Date: Mon, 10 Oct 2011 20:52:05 +0530 Subject: [PATCH] Input: omap-keypad: dynamically handle register offsets Keypad controller register offsets are different for omap4 and omap5. Handle these offsets through static mapping and assign these mappings during run time. Tested on omap4430 sdp with 3.4-rc3. Tested on omap5430evm with 3.1-custom kernel. Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-23Input: atkbd - fix language in a printed messageJesper Juhl
I believe that "trying to access hardware" is more correct English than "trying access hardware". Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-21Merge commit 'v3.4-rc4' into nextDmitry Torokhov
2012-04-20Input: tc3589x-keypad - remove unnecessary checksDmitry Torokhov
settle_time and debounce_period are u8 and thus can not be greater than TC3589x_MAX_DEBOUNCE_SETTLE which is 255. There also no need to mask out nibbles form board->krow and board->kcol as we validate that they are in correct range. Reported-by: Werner <w.landgraf@ru.ru> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-20Input: matrix-keypad - undo GPIO setup if input_register_device failsDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-20Input: matrix-keypad - allocate keycodes with keypad structureDmitry Torokhov
Instead of allocating and managing keymap separately from the keypad structure stick it at the end as a variable-length array. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-20Input: matrix-keypad - fix 'duplicate const' sparse warningDmitry Torokhov
SIMPLE_DEV_PM_OPS already defines constant dev_pm_ops. Also guard PM methods with CONFIG_PM_SLEEP and get rid of some unneeded #ifdefs. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-11Input: ep93xx_keypad - switch to using dev_pm_opsDmitry Torokhov
Also use CONFIG_PM_SLEEP instead of CONFIG_PM to guard PM methods. Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-04Input: serio - use module_serio_driverAxel Lin
This patch converts the drivers in drivers/input/* to use module_serio_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-04-04Input: add support for LM8333 keypadsWolfram Sang
This driver adds support for the keypad part of the LM8333 and is prepared for possible GPIO/PWM drivers. Note that this is not a MFD because you cannot disable the keypad functionality which, thus, has to be handled by the core anyhow. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-29Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input Pull 2nd round of input updates from Dmitry Torokhov: - update to Wacom driver to support wireless devices - update to Sentelci touchpad driver to support newer hardware - update to gpio-keys driver to support "interrupt-only" keys - fixups to earlier commits * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: wacom - check for allocation failure in probe() Input: tegra-kbc - allocate pdata before using it Input: amijoy - add missing platform check Input: wacom - wireless battery status Input: wacom - create inputs when wireless connect Input: wacom - wireless monitor framework Input: wacom - isolate input registration Input: sentelic - improve packet debugging information Input: sentelic - minor code cleanup Input: sentelic - enabling absolute coordinates output for newer hardware Input: sentelic - refactor code for upcoming new hardware support Input: gpio_keys - add support for interrupt only keys Input: gpio_keys - consolidate key destructor code Input: revert "gpio_keys - switch to using threaded IRQs" Input: gpio_keys - constify platform data Input: spear-keyboard - remove kbd_set_plat_data()
2012-03-27Merge branch 'platforms' of git://git.linaro.org/people/rmk/linux-armLinus Torvalds
Pull ARM platform updates from Russell King: "This covers platform stuff for platforms I have a direct interest in (iow, I have the hardware). Essentially: - as we no longer support any other Acorn platforms other than RiscPC anymore, we can collect all that code into mach-rpc. - convert Acorn expansion card stuff to use IRQ allocation functions, and get rid of NO_IRQ from there. - cleanups to the ebsa110 platform to move some private stuff out of its header files. - large amount of SA11x0 updates: - conversion of private DMA implementation to DMA engine support (this actually gives us greater flexibility in drivers over the old API.) - re-worked ucb1x00 updates - convert to genirq, remove sa11x0 dependencies, fix various minor issues - move platform specific sa11x0 framebuffer data into platform files in arch/arm instead of keeping this in the driver itself - update sa11x0 IrDA driver for DMA engine, and allow it to use DMA for SIR transmissions as well as FIR - rework sa1111 support for genirq, and irq allocation - fix sa1111 IRQ support so it works again - use sparse IRQ support After this, I have one more pull request remaining from my current set, which I think is going to be the most problematical as it generates 8 conflicts." Fixed up the trivial conflict in arch/arm/mach-rpc/Makefile as per Russell. * 'platforms' of git://git.linaro.org/people/rmk/linux-arm: (125 commits) ARM: 7343/1: sa11x0: convert to sparse IRQ ARM: 7342/2: sa1100: prepare for sparse irq conversion ARM: 7341/1: input: prepare jornada720 keyboard and ts for sa11x0 sparse irq ARM: 7340/1: rtc: sa1100: include mach/irqs.h instead of asm/irq.h ARM: sa11x0: remove unused DMA controller definitions ARM: sa11x0: remove old SoC private DMA driver USB: sa1111: add hcd .reset method USB: sa1111: add OHCI shutdown methods USB: sa1111: reorganize ohci-sa1111.c USB: sa1111: get rid of nasty printk(KERN_DEBUG "%s: ...", __FILE__) USB: sa1111: sparse and checkpatch cleanups ARM: sa11x0: don't static map sa1111 ARM: sa1111: use dev_err() rather than printk() ARM: sa1111: cleanup sub-device registration and unregistration ARM: sa1111: only setup DMA for DMA capable devices ARM: sa1111: register sa1111 devices with dmabounce in bus notifier ARM: sa1111: move USB interface register definitions to ohci-sa1111.c ARM: sa1111: move PCMCIA interface register definitions to sa1111_generic.c ARM: sa1111: move PS/2 interface register definitions to sa1111p2.c ARM: sa1111: delete unused physical GPIO register definitions ...
2012-03-27Input: tegra-kbc - allocate pdata before using itViresh Kumar
Following commit broke DT support for tegra-kbc by removing pdata allocation completely: commit 023cea0ecfa2df034096c3f4afa796a0b2d1188a Author: Shridhar Rasal <srasal@nvidia.com> Date: Fri Feb 3 00:27:30 2012 -0800 Input: tegra-kbc - allow skipping setting up some of GPIO pins This patch restores it. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-25ARM: 7341/1: input: prepare jornada720 keyboard and ts for sa11x0 sparse irqRob Herring
In preparation for sa11x0 sparse irq conversion, explicitly include mach/irqs.h as it will not be included for sparse irq. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-19Input: gpio_keys - add support for interrupt only keysLaxman Dewangan
Some of buttons, like power-on key or onkey, may only generate interrupts when pressed and not actually be mapped as gpio in the system. Allow setting gpio to invalid value and specify IRQ instead to support such keys. The debounce timer is used not to debounce but to ignore new IRQs coming while button is kept pressed. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-19Input: gpio_keys - consolidate key destructor codeDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-19Input: revert "gpio_keys - switch to using threaded IRQs"David Jander
request_any_context_irq() should handle the case when using GPIO expanders that themselves use threaded IRQs, and so the premise of change 7e2ecdf438bb479e2b4667fc16b1a84d6348da04 is incorrect. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-19Input: gpio_keys - constify platform dataDmitry Torokhov
The platform data should not be altered and therefore should be accessed through const pointers. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-16Input: convert I2C drivers to use module_i2c_driver()Axel Lin
This patch converts the drivers in drivers/input/* to use the module_i2c_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-16Input: omap4-keypad - move platform_data to <linux/platform_data>Felipe Balbi
This patch allows us to drop the OMAP dependency from the OMAP4 keypad driver. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-13Input: tegra-kbc - revise device tree supportOlof Johansson
This is an incremental patch updating to the revised bindings for matrix keyboards. This includes an optional "linux,fn-keymap" binding that is not yet implemented, that will be used to specify the Fn-key modifier layout if needed. Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-13Input: of_keymap - add device tree bindings for simple key matricesOlof Johansson
This adds a simple device tree binding for simple key matrix data and a helper to fill in the platform data. Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-03-09Merge commit 'v3.3-rc6' into nextDmitry Torokhov
2012-02-28Input: spear-keyboard - provide thaw and poweroff routinesViresh Kumar
Thaw and poweroff routines are missing for spear-keyboard. They are required for: - Error case scenarios during freeze - Using test features, of hibernate. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-02-28Input: spear-keyboard - configure device according to supplied modeRajeev Kumar
Let platform pass mode information to keyboard driver according to which it configures itself. The mode can be - KEYPAD_9x9 0 - KEYPAD_6x6 1 - KEYPAD_2x2 2 Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-02-04Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: i8042 - add Lenovo Ideapad U455 to 'reset' blacklist Input: serio_raw - return proper result when serio_raw_read fails Input: document device properties Input: twl4030_keypad - fix comment (trivial) Input: gpio_keys - fix struct device declared inside parameter list Input: evdev - fix variable initialisation
2012-02-03Input: tegra-kbc - allow skipping setting up some of GPIO pinsShridhar Rasal
Allow marking some of GPIO pins as ignored to to avoid continuously generating KBC input events. Signed-off-by: Shridhar Rasal <srasal@nvidia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-02-01Input: twl4030_keypad - fix comment (trivial)Felipe Contreras
And trivial whitespace fixes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-01-23Input: tegra-kbc - enable key interrupt for wakeupRakesh Iyer
Enable keypress interrupt to support wakeup from low power state. Signed-off-by: Rakesh Iyer <riyer@nvidia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-01-23Input: samsung-keypad - don't synchronise with runtime PM putMark Brown
We don't actually care if the device has been runtime suspended immediately so we can just drop the reference without waiting for any state change to be implemented. This may allow us to avoid some suspend/resume cycles and is a bit more friendly to the rest of the system. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-01-23Input: nomadik-ske-keypad - convert to using SIMPLE_DEV_PM_OPSDmitry Torokhov
Also proper guard for system suspend/resume methods is CONFIG_PM_SLEEP, not CONFIG_PM. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-01-23Input: nomadik-ske-keypad - do not assign driver's probe() methodDmitry Torokhov
Because we are using platform_device_probe() to register the driver we do not need to assign driver's probe method. We also can mark ske_keypad_probe(), together with ske_keypad_chip_init(), as __init instead of __devinit. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-01-12Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: bcm5974 - set BUTTONPAD property Input: serio_raw - return proper result when serio_raw_write fails Input: serio_raw - really signal HUP upon disconnect Input: serio_raw - remove stray semicolon Input: revert some over-zealous conversions to module_platform_driver()
2012-01-10Input: revert some over-zealous conversions to module_platform_driver()Dmitry Torokhov
Recent conversion to module_platform_driver() went a bit too far and converted not only drivers that used platform_driver_register() but also ones using platform_driver_probe(), breaking them in process. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2012-01-10Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (64 commits) Input: tc3589x-keypad - add missing kerneldoc Input: ucb1400-ts - switch to using dev_xxx() for diagnostic messages Input: ucb1400_ts - convert to threaded IRQ Input: ucb1400_ts - drop inline annotations Input: usb1400_ts - add __devinit/__devexit section annotations Input: ucb1400_ts - set driver owner Input: ucb1400_ts - convert to use dev_pm_ops Input: psmouse - make sure we do not use stale methods Input: evdev - do not block waiting for an event if fd is nonblock Input: evdev - if no events and non-block, return EAGAIN not 0 Input: evdev - only allow reading events if a full packet is present Input: add driver for pixcir i2c touchscreens Input: samsung-keypad - implement runtime power management support Input: tegra-kbc - report wakeup key for some platforms Input: tegra-kbc - add device tree bindings Input: add driver for AUO In-Cell touchscreens using pixcir ICs Input: mpu3050 - configure the sampling method Input: mpu3050 - ensure we enable interrupts Input: mpu3050 - add of_match table for device-tree probing Input: sentelic - document the latest hardware ... Fix up fairly trivial conflicts (device tree matching conflicting with some independent cleanups) in drivers/input/keyboard/samsung-keypad.c
2012-01-04Input: tc3589x-keypad - add missing kerneldocNaga Radhesh
This adds two missing kerneldoc entries for the TC3589x keypad driver. Signed-off-by: Naga Radhesh <naga.radheshy@stericsson.com> Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-12-30Input: samsung-keypad - implement runtime power management supportMark Brown
When runtime power management is enabled put the Samsung keypad driver into suspend mode with wakeups disabled whenever the device is open but a key is not actually been pressed. As well as saving a trivial amount of power this will support the use of SoC wide idle modes which put the entire device into a retention mode and use explicit wakeup sources to exit. Since not all of the interrupt controllers used with the driver support set_irq_wake() (though they all do the right thing) and there's a nasty WARN() when we disable wake after failing to enable it keep track of the current wake status from runtime PM and only disable wake if we managed to enable it; I'm not entirely sure why this doesn't affect the existing uses of the API in the driver. System suspend is unaffected as the driver core will runtime resume any suspended devices prior to system suspend. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Conflicts: drivers/input/keyboard/samsung-keypad.c
2011-12-30Input: tegra-kbc - report wakeup key for some platformsRakesh Iyer
Tegra kbc cannot detect exact keypress causing wakeup in interrupt mode. Allow wakeup keypress to be reported for certain platforms. Signed-off-by: Rakesh Iyer <riyer@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-12-30Input: tegra-kbc - add device tree bindingsOlof Johansson
This adds a simple device tree binding to the tegra keyboard controller. Also, mark the default keymap as __devinitdata since it is not referenced after boot. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-12-23input: samsung-keypad: Add device tree supportThomas Abraham
Add device tree based discovery support for Samsung's keypad controller. Cc: Joonyoung Shim <jy0922.shim@samsung.com> Cc: Donghwa Lee <dh09.lee@samsung.com> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
2011-12-12Input: keyboard - staticise non-exported symbolsAxel Lin
These symbols are not used outside it's driver so no need to make the symbol global. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-11-30Input: keyboard - use macro module_platform_driver()JJ Ding
Commit 940ab88962bc1aff3273a8356d64577a6e386736 introduced a new macro to save some platform_driver boilerplate code. Use it. Signed-off-by: JJ Ding <dgdunix@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-11-29Input: samsung-keypad - remove redundant MODULE_ALIASAxel Lin
MODULE_DEVICE_TABLE will setup the module alias for us, thus adding MODULE_ALIAS for an entry already in MODULE_DEVICE_TABLE is redundant. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-11-29Merge commit 'v3.2-rc3' into nextDmitry Torokhov
2011-11-15Input: samsung-keypad - enable compiling on other platformsDmitry Torokhov
There is nothing in keypad platform definitions that requires the driver be complied on Samsung platform only, so let's move them out of the platform subdirectory and relax the dependencies. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-11-09Input: samsung-keypad - switch to using SIMPLE_DEV_PM_OPSDmitry Torokhov
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>