- 22 8月, 2012 6 次提交
-
-
由 Tobias Klauser 提交于
Use of_get_child_count() instead of custom implementation. Signed-off-by: NTobias Klauser <tklauser@distanz.ch> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Tobias Klauser 提交于
Instead of having to define the match table to NULL if CONFIG_OF isn't set, use the of_match_ptr() macro which will do this for us. Signed-off-by: NTobias Klauser <tklauser@distanz.ch> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
Signed-off-by: NAlexandre Pereira da Silva <aletes.xgr@gmail.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Dmitry Torokhov 提交于
Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 NeilBrown 提交于
In order to avoid races with suspend, a wakeup event must register as such by calling pm_wakeup_event() or pm_stay_awake(). This will ensure that the current suspend cycle aborts. When the user-space visible event is created in the interrupt handler (gpio_keys_irq_isr), a simple pm_wakeup_event() with no delay is sufficient as suspend will synchronise with all interrupt delivery. When the user-space visible event is created later (gpio_keys_gpio_isr), we need to bracket the event with pm_stay_awake() and pm_relax(). Signed-off-by: NNeilBrown <neilb@suse.de> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
- fix sizeof in memset; - clean up dt properties extraction; - use for_each_chil_of_node macro; - use of_get_child_count(); - use of_match_ptr macro. Signed-off-by: NAlexandre Pereira da Silva <aletes.xgr@gmail.com> Acked-by: NRob Herring <rob.herring@calxeda.com> [Fabio Estevam <fabio.estevam@freescale.com>: fix fix NULL pointer dereference for dt case - pdata->buttons wasn't initialized] Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 18 7月, 2012 2 次提交
-
-
由 Roland Stigge 提交于
This is a driver for the key scan interface of the LPC32xx SoC Signed-off-by: NRoland Stigge <stigge@antcom.de> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Sourav Poddar 提交于
Add device tree support for omap4 keypad driver and update the Documentation with omap4 keypad device tree binding information. Tested on omap4430 sdp. Signed-off-by: NSourav Poddar <sourav.poddar@ti.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
- 13 7月, 2012 2 次提交
-
-
由 Shiraz Hashim 提交于
On some platform it may happen that the input clock to keyboard may change during suspend, thus impacting its wakeup capability. There is no means for keyboard driver to know this frequency before hand. Hence introduce a platform data 'suspended_rate' which indicates the frequency during suspend at which keyboard operates. Accordingly reprogram keyboard while going into suspend and restore original configuration at the time of resume. Signed-off-by: NShiraz Hashim <shiraz.hashim@st.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Shiraz Hashim 提交于
SPEAr keyboard should normally disable clock during suspend and enable it during resume. For cases where it is expected to act as a wakeup source the clock can remain in the same state i.e. kept enabled if it is being used. Signed-off-by: NShiraz Hashim <shiraz.hashim@st.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
- 08 7月, 2012 4 次提交
-
-
由 Shiraz Hashim 提交于
Current implementation hard coded keyboard frequency configuration assuming input clock as fixed APB (83 MHz). Generalize the configuration using clock framework APIs. Signed-off-by: NShiraz Hashim <shiraz.hashim@st.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Shiraz Hashim 提交于
Rename bit definition macros to reflect keyboard registers clearly thus being more readable. Signed-off-by: NShiraz Hashim <shiraz.hashim@st.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Shiraz Hashim 提交于
All SPEAr keyboard registers are 32 bit wide and are word aligned. This patch aligns all io access to be word size using relaxed version of readl/writel. Signed-off-by: NShiraz Hashim <shiraz.hashim@st.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Vipul Kumar Samar 提交于
This patch is to disable device wakeup while removing keyboard. Signed-off-by: NVipul Kumar Samar <vipulkumar.samar@st.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
- 07 7月, 2012 3 次提交
-
-
由 Fabio Estevam 提交于
Check error returned by clk_prepare_enable(). Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Fabio Estevam 提交于
With the new i.mx clock framework we should pass NULL as the keypad clock name. Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
由 Fabio Estevam 提交于
Adapt clock handling to the new i.mx clock framework and fix the following warning: input: imx-keypad as /devices/platform/imx-keypad/input/input0 ------------[ cut here ]------------ WARNING: at drivers/clk/clk.c:511 __clk_enable+0x98/0xa8() Modules linked in: [<c001a680>] (unwind_backtrace+0x0/0xf4) from [<c002452c>] (warn_slowpath_commo) [<c002452c>] (warn_slowpath_common+0x48/0x60) from [<c0024560>] (warn_slowpath_) [<c0024560>] (warn_slowpath_null+0x1c/0x24) from [<c02c4ec4>] (__clk_enable+0x9) [<c02c4ec4>] (__clk_enable+0x98/0xa8) from [<c02c4ef8>] (clk_enable+0x24/0x5c) [<c02c4ef8>] (clk_enable+0x24/0x5c) from [<c027ac6c>] (imx_keypad_open+0x28/0xc) [<c027ac6c>] (imx_keypad_open+0x28/0xc8) from [<c0274b14>] (input_open_device+0) [<c0274b14>] (input_open_device+0x78/0xa8) from [<c01ec884>] (kbd_connect+0x60/) [<c01ec884>] (kbd_connect+0x60/0x80) from [<c0273b94>] (input_attach_handler+0x) [<c0273b94>] (input_attach_handler+0x220/0x258) from [<c02755d4>] (input_regist) [<c02755d4>] (input_register_device+0x31c/0x390) from [<c038da1c>] (imx_keypad_) [<c038da1c>] (imx_keypad_probe+0x2e4/0x3b8) from [<c020326c>] (platform_drv_pro) [<c020326c>] (platform_drv_probe+0x18/0x1c) from [<c0201f64>] (driver_probe_dev) [<c0201f64>] (driver_probe_device+0x84/0x210) from [<c020217c>] (__driver_attac) [<c020217c>] (__driver_attach+0x8c/0x90) from [<c02008f8>] (bus_for_each_dev+0x) [<c02008f8>] (bus_for_each_dev+0x68/0x90) from [<c0201064>] (bus_add_driver+0xa) [<c0201064>] (bus_add_driver+0xa4/0x23c) from [<c020275c>] (driver_register+0x7) [<c020275c>] (driver_register+0x78/0x12c) from [<c00087c0>] (do_one_initcall+0x) [<c00087c0>] (do_one_initcall+0x34/0x188) from [<c04b9310>] (kernel_init+0xe4/0) [<c04b9310>] (kernel_init+0xe4/0x1a8) from [<c0015bd8>] (kernel_thread_exit+0x0) ---[ end trace 1d550e891d03d7ce ]--- Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
- 05 7月, 2012 1 次提交
-
-
由 Lars-Peter Clausen 提交于
Since commit 1c6c6952 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. This patch adds the IRQF_ONESHOT to input drivers where it is missing. Not modified by this patch are those drivers where the requested IRQ will always be a nested IRQ (e.g. because it's part of an MFD), since for this special case IRQF_ONESHOT is not required to be specified when requesting the IRQ. Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
-
- 25 6月, 2012 2 次提交
-
-
由 Naveen Kumar Gaddipati 提交于
The keypad could cause multiple interrupts to be fired in succession since we weren't waiting for the IRQs to clear properly in the interrupt handler. We wait for a number of bus iterations (the readl():s from the peripheral bus will stall, so these are quite long) before giving up on getting keys ready to read, then we sleep until the IRQ is deasserted (this is OK since the interrupt is threaded). Also use the debounce platform data for another hardcoded wait loop. Signed-off-by: NNaveen Kumar Gaddipati <naveen.gaddipati@stericsson.com> Reviewed-by: NRikard Olsson <rikard.p.olsson@stericsson.com> Reviewed-by: NSrinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Naveen Kumar Gaddipati 提交于
Added the multi key press support for SKE keypad by modifying the irq function for handling the two different keys on the same column and also pressing the two different keys of different columns on the same ASR register. Signed-off-by: NNaveen Kumar Gaddipati <naveen.gaddipati@stericsson.com> Reviewed-by: NSrinidhi Kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 12 6月, 2012 1 次提交
-
-
由 Tobias Klauser 提交于
pdata is zeroed using memset just a few lines before, so there is no need to set the nbuttons member to 0 again. Signed-off-by: NTobias Klauser <tklauser@distanz.ch> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 11 5月, 2012 5 次提交
-
-
由 Viresh Kumar 提交于
This adds simple DT bindings for spear-keyboard controller. Signed-off-by: NViresh Kumar <viresh.kumar@st.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Dmitry 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: NDmitry Torokhov <dtor@mail.ru>
-
由 Dmitry 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: NDmitry Torokhov <dtor@mail.ru>
-
由 Jean-François Dagenais 提交于
Signed-off-by: NJean-François Dagenais <jeff.dagenais@gmail.com> Acked-by: NMichael Hennerich <michael.hennerich@analog.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Poddar, 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: NFelipe Balbi <balbi@ti.com> Signed-off-by: NG, Manjunath Kondaiah <manjugk@ti.com> Signed-off-by: NSourav Poddar <sourav.poddar@ti.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 27 4月, 2012 4 次提交
-
-
由 Chao Xie 提交于
Direct keys usage may not start from KP_DKIN0, add a msk option to configure the specifics for platforms that can skip some keys. Signed-off-by: NChao Xie <chao.xie@marvell.com> Signed-off-by: NHaojian Zhuang <haojian.zhuang@gmail.com>
-
由 Chao Xie 提交于
KPDK_DK only indicates the pin level of direct key. So it is related to board, and low level may be active which indicates that a key is pressed. Signed-off-by: NChao Xie <chao.xie@marvell.com> Signed-off-by: NHaojian Zhuang <haojian.zhuang@gmail.com>
-
由 Chao Xie 提交于
When direcct_key_num is 0, the mask should be 0. When direcct_key_num is 1, the mask should be 0b1. Signed-off-by: NChao Xie <chao.xie@marvell.com> Signed-off-by: NHaojian Zhuang <haojian.zhuang@gmail.com>
-
由 Chao Xie 提交于
When the keypad is used as wake up source, the clock can not be disabled. Or it can not detect key pressing. If the keypad is used as wake up source, when resume back, do not enable the clock and configure it again because the register content is retained. Signed-off-by: NChao Xie <chao.xie@marvell.com> Signed-off-by: NHaojian Zhuang <haojian.zhuang@gmail.com>
-
- 24 4月, 2012 1 次提交
-
-
由 Jesper Juhl 提交于
I believe that "trying to access hardware" is more correct English than "trying access hardware". Signed-off-by: NJesper Juhl <jj@chaosbits.net> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 21 4月, 2012 4 次提交
-
-
由 Dmitry 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: NWerner <w.landgraf@ru.ru> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Dmitry Torokhov 提交于
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Dmitry 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: NDmitry Torokhov <dtor@mail.ru>
-
由 Dmitry 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: NDmitry Torokhov <dtor@mail.ru>
-
- 11 4月, 2012 1 次提交
-
-
由 Dmitry Torokhov 提交于
Also use CONFIG_PM_SLEEP instead of CONFIG_PM to guard PM methods. Acked-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 05 4月, 2012 2 次提交
-
-
由 Axel 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: NAxel Lin <axel.lin@gmail.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Wolfram 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: NWolfram Sang <w.sang@pengutronix.de> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 27 3月, 2012 1 次提交
-
-
由 Viresh Kumar 提交于
Following commit broke DT support for tegra-kbc by removing pdata allocation completely: commit 023cea0e 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: NViresh Kumar <viresh.kumar@st.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 26 3月, 2012 1 次提交
-
-
由 Rob 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: NRob Herring <rob.herring@calxeda.com> Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
-