- 29 6月, 2012 15 次提交
-
-
由 Daniel Kurtz 提交于
Make firmware and hardware version strings available to userspace. This is useful, for example, to allow a userspace program to implement a firwmare update policy. Change-Id: I1eddb4bbf5f3f9ae6947a8528598973ddead18cf Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
Print unsigned values as '%u'. Also, parse and print the firmware version in its canonical format, as suggested by Nick Dyer. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
Reading the whole info block in one i2c transaction speeds up driver probe significantly, especially on slower i2c busses. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
Write each object using a single bulk i2c write transfer. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Reviewed-by: NJoonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
The i2c bus requires 4 bytes to do a 1-byte write (1 byte i2c address + 2 byte offset + 1 byte data). By taking a length with writes, the driver can amortize transaction overhead by performing larger transactions where appropriate. This patch just sets up the new API. Later patches refactor writes to take advantage of the larger transactions. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
The i2c layer can report a variety of errors, including -ENXIO for an i2c NAK. Instead of treating them all as -EIO, pass the actual i2c layer error up to the caller. However, still report as -EIO the unlikely case that a transaction was partially completed, and no error message was returned from i2c_*(). Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
For objects with multiple instances, dump them all, prepending each with its "Instance #". [rydberg@euromail.se: break out mxt_show_instance()] Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
Conserve limited (PAGE_SIZE) sysfs output buffer space by only showing readable objects and not printing the object's index, which is not useful to userspace. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
Read each object in a single i2c transaction instead of byte-by-byte Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
Using scnprintf() is a cleaner way to ensure that we don't overwrite the PAGE_SIZE sysfs output buffer. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
T5 is the message processor object. Reading it will only have two outcomes, neither of which is particularly useful: 1) the message count decrements, and a valid message will be lost 2) an invalid message will be read (reportid == 0xff) Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
If sysfs entry creation fails, the driver is still usable, so don't just abort probe. Just warn and continue. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
Hopefully this new code path will never be used, but better safe than sorry... Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
The atmel_mxt_ts driver can support multiple devices simultaneously. Use the i2c_client name instead of the driver name when requesting an interrupt to make the different interrupts distinguishable in /proc/interrupts and top. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
由 Daniel Kurtz 提交于
This allows userspace to more easily distinguish which bus a particular atmel_mxt_ts device is attached to. The resulting phys will be something like: i2c-1-0067/input0 Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
- 04 6月, 2012 1 次提交
-
-
由 Sachin Kamat 提交于
Fixes the following sparse warning: drivers/input/input-mt.c:138:40: warning: Using plain integer as NULL pointer Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org> Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
-
- 30 5月, 2012 1 次提交
-
-
由 Mark Brown 提交于
Since there are uses for I2C_M_NOSTART which are much more sensible and standard than most of the protocol mangling functionality (the main one being gather writes to devices where something like a register address needs to be inserted before a block of data) create a new I2C_FUNC_NOSTART for this feature and update all the users to use it. Also strengthen the disrecommendation of the protocol mangling while we're at it. In the case of regmap-i2c we remove the requirement for mangling as I2C_M_NOSTART is the only mangling feature which is being used. Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: NWolfram Sang <w.sang@pengutronix.de> Signed-off-by: NJean Delvare <khali@linux-fr.org>
-
- 24 5月, 2012 1 次提交
-
-
由 Dmitry Torokhov 提交于
Keymaps used by drivers based on matrix-keymap facilities are arrays of unsigned shorts, not chars. Treating them otherwise produces corrupted keymaps. Reported-by: NSourav Poddar <sourav.poddar@ti.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 20 5月, 2012 1 次提交
-
-
由 Mark Brown 提交于
The modern idiom is to use irq_domain to allocate interrupts. This is useful partly to allow further infrastructure to be based on the domains and partly because it makes it much easier to allocate virtual interrupts to devices as we don't need to allocate a contiguous range of interrupt numbers. Convert the wm831x driver over to this infrastructure, using a legacy IRQ mapping if an irq_base is specified in platform data and otherwise using a linear mapping, always registering the interrupts even if they won't ever be used. Only boards which need to use the GPIOs as interrupts should need to use an irq_base. This means that we can't use the MFD irq_base management since the unless we're using an explicit irq_base from platform data we can't rely on a linear mapping of interrupts. Instead we need to map things via the irq_domain - provide a conveniencem function wm831x_irq() to save a small amount of typing when doing so. Looking at this I couldn't clearly see anything the MFD core could do to make this nicer. Since we're not supporting device tree yet there's no meaningful advantage if we don't do this conversion in one, the fact that the interrupt resources are used for repeated IP blocks makes accessor functions for the irq_domain more trouble to do than they're worth. Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
-
- 14 5月, 2012 1 次提交
-
-
由 Antonio Ospite 提交于
Move drivers/input/fixp-arith.h to include/linux so that the functions defined there can be used by other subsystems, for instance some video devices ISPs can control the output HUE value by setting registers for sin(HUE) and cos(HUE). Signed-off-by: NAntonio Ospite <ospite@studenti.unina.it> Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
-
- 11 5月, 2012 16 次提交
-
-
由 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>
-
由 JJ Ding 提交于
Move synaptics_invert_y() inside CONFIG_MOUSE_PS2_SYNAPTICS to get rid of a compile warning when we don't select synaptics support. drivers/input/mouse/synaptics.c:53:12: warning: ‘synaptics_invert_y’ defined but not used [-Wunused-function] Signed-off-by: NJJ Ding <dgdunix@gmail.com> Reviewed-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Dmitry Torokhov 提交于
Instead of open-coded reporting number of fingers on the touchpad let's use input_mt_report_finger_count() helper. Acked-by: NSeth Forshee <seth.forshee@canonical.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 George Pantalos 提交于
This patch adds semi-MT support for ALPS v4 protocol touchpads. It is based on the work by Seth Forshee for ALPS v3 and v4 protocol support. Three packets are required to assemble and process the MT data. ST events are reported at once to avoid latency. If there were two contacts or more, report MT data instead of ST events. Thanks to Seth Forshee for providing most of the code, guidance and insight for producing this patch. Signed-off-by: NGeorge Pantalos <gpantalos@gmail.com> Acked-by: NSeth Forshee <seth.forshee@canonical.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Paul Parsons 提交于
This driver adds support for the Synaptics NavPoint touchpad connected to a PXA27x SSP port in SPI slave mode. The device emulates a mouse; a tap or tap-and-a-half drag gesture emulates the left mouse button. For example, use the xf86-input-evdev driver for an X pointing device. Signed-off-by: NPaul Parsons <lost.distance@yahoo.com> Tested-by: NPhilipp Zabel <philipp.zabel@gmail.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Daniel Kurtz 提交于
Helps ensure all bytes for a single message together in the system log. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Reviewed-by: NJoonyoung Shim <jy0922.shim@samsung.com> Acked-by: NNick Dyer <nick.dyer@itdev.co.uk> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Daniel Kurtz 提交于
atmel_mxt devices will send a checksum byte at the end of a message if the MSB of the object address is set. However, since this driver does not set this bit, the checksum byte isn't actually sent, so don't even try to read it. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Daniel Kurtz 提交于
Don't allow writing past the length of an object. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Daniel Kurtz 提交于
Restrict permissions on the update_fw sysfs entry to read only for root only. Also, update object permission to use a macro S_IRUGO macro instead of hard coded 0444. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Reviewed-by: NJoonyoung Shim <jy0922.shim@samsung.com> Acked-by: NNick Dyer <nick.dyer@itdev.co.uk> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Daniel Kurtz 提交于
Simple cleanup to use newer PM APIs. Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org> Reviewed-by: NJoonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Tai-hwa Liang 提交于
Hardware since Cx supports an unique identity (used to identify OEM vendors and released lot number) which is very helpful for diagnostic purpose. This revision tries to make it as a part of driver boot up message. Whilst here, also bumping fsp_drv_ver to acknowledge recent addition of absolute coordinates output. Signed-off-by: NTai-hwa Liang <avatar@sentelic.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
由 Peter Ujfalusi 提交于
Enable DT based probing of the vibra driver. Example of dts section to load the twl6040-vibra driver: twl6040: twl6040@4b { ... twl6040_vibra: twl6040@1 { compatible = "ti,twl6040-vibra"; interrupts = <4>; vddvibl-supply = <&vbat>; vddvibr-supply = <&vbat>; vibldrv_res = <8>; vibrdrv_res = <3>; viblmotor_res = <10>; vibrmotor_res = <10>; }; }; [Sasha Levin <levinsasha928@gmail.com>: fixed build error] Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
-
- 05 5月, 2012 4 次提交
-
-
由 Greg Kroah-Hartman 提交于
My last patch fixing up the dev_* messages caused a compiler warning accidentally for an unused variable. Fix this up, as it was my fault. Cc: Alessandro Rubini <rubini@ipvvis.unipv.it> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Greg Kroah-Hartman 提交于
Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: Henrik Rydberg <rydberg@euromail.se> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Viresh Kumar <viresh.kumar@st.com> CC: Armando Visconti <armando.visconti@st.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Greg Kroah-Hartman 提交于
Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: Ping Cheng <pingc@wacom.com> CC: Chris Bagwell <chris@cnpbagwell.com> CC: Eduard Hasenleithner <eduard@hasenleithner.at> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
由 Greg Kroah-Hartman 提交于
Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-