From 863981e96738983919de841ec669e157e6bdaeb0 Mon Sep 17 00:00:00 2001 From: AndrĂ© Fabian Silva Delgado Date: Sun, 11 Sep 2016 04:34:46 -0300 Subject: Linux-libre 4.7.1-gnu --- drivers/input/keyboard/adp5588-keys.c | 10 +++---- drivers/input/keyboard/adp5589-keys.c | 12 ++++---- drivers/input/keyboard/omap-keypad.c | 52 +-------------------------------- drivers/input/keyboard/twl4030_keypad.c | 28 ++++++++++-------- 4 files changed, 28 insertions(+), 74 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 21a62d0fa..53fe9a3fb 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -73,7 +73,7 @@ static int adp5588_write(struct i2c_client *client, u8 reg, u8 val) #ifdef CONFIG_GPIOLIB static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); int val; @@ -93,7 +93,7 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) static void adp5588_gpio_set_value(struct gpio_chip *chip, unsigned off, int val) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); @@ -112,7 +112,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip, static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); int ret; @@ -130,7 +130,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) static int adp5588_gpio_direction_output(struct gpio_chip *chip, unsigned off, int val) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); int ret; @@ -210,7 +210,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad) mutex_init(&kpad->gpio_lock); - error = gpiochip_add(&kpad->gc); + error = gpiochip_add_data(&kpad->gc, kpad); if (error) { dev_err(dev, "gpiochip_add failed, err: %d\n", error); return error; diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index c01a1d648..32d94c63d 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -387,7 +387,7 @@ static int adp5589_write(struct i2c_client *client, u8 reg, u8 val) #ifdef CONFIG_GPIOLIB static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); @@ -399,7 +399,7 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off) static void adp5589_gpio_set_value(struct gpio_chip *chip, unsigned off, int val) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); @@ -418,7 +418,7 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip, static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); int ret; @@ -438,7 +438,7 @@ static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off) static int adp5589_gpio_direction_output(struct gpio_chip *chip, unsigned off, int val) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); int ret; @@ -525,9 +525,9 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) mutex_init(&kpad->gpio_lock); - error = gpiochip_add(&kpad->gc); + error = gpiochip_add_data(&kpad->gc, kpad); if (error) { - dev_err(dev, "gpiochip_add failed, err: %d\n", error); + dev_err(dev, "gpiochip_add_data() failed, err: %d\n", error); return error; } diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index e0d72c8c0..146b26f66 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c @@ -64,31 +64,6 @@ static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); static unsigned int *row_gpios; static unsigned int *col_gpios; -#ifdef CONFIG_ARCH_OMAP2 -static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value) -{ - int col; - - for (col = 0; col < omap_kp->cols; col++) - gpio_set_value(col_gpios[col], value & (1 << col)); -} - -static u8 get_row_gpio_val(struct omap_kp *omap_kp) -{ - int row; - u8 value = 0; - - for (row = 0; row < omap_kp->rows; row++) { - if (gpio_get_value(row_gpios[row])) - value |= (1 << row); - } - return value; -} -#else -#define set_col_gpio_val(x, y) do {} while (0) -#define get_row_gpio_val(x) 0 -#endif - static irqreturn_t omap_kp_interrupt(int irq, void *dev_id) { /* disable keyboard interrupt and schedule for handling */ @@ -133,7 +108,6 @@ static void omap_kp_tasklet(unsigned long data) unsigned int row_shift = get_count_order(omap_kp_data->cols); unsigned char new_state[8], changed, key_down = 0; int col, row; - int spurious = 0; /* check for any changes */ omap_kp_scan_keypad(omap_kp_data, new_state); @@ -170,12 +144,9 @@ static void omap_kp_tasklet(unsigned long data) memcpy(keypad_state, new_state, sizeof(keypad_state)); if (key_down) { - int delay = HZ / 20; /* some key is pressed - keep irq disabled and use timer * to poll the keypad */ - if (spurious) - delay = 2 * HZ; - mod_timer(&omap_kp_data->timer, jiffies + delay); + mod_timer(&omap_kp_data->timer, jiffies + HZ / 20); } else { /* enable interrupts */ omap_writew(0, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); @@ -216,25 +187,6 @@ static ssize_t omap_kp_enable_store(struct device *dev, struct device_attribute static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, omap_kp_enable_show, omap_kp_enable_store); -#ifdef CONFIG_PM -static int omap_kp_suspend(struct platform_device *dev, pm_message_t state) -{ - /* Nothing yet */ - - return 0; -} - -static int omap_kp_resume(struct platform_device *dev) -{ - /* Nothing yet */ - - return 0; -} -#else -#define omap_kp_suspend NULL -#define omap_kp_resume NULL -#endif - static int omap_kp_probe(struct platform_device *pdev) { struct omap_kp *omap_kp; @@ -371,8 +323,6 @@ static int omap_kp_remove(struct platform_device *pdev) static struct platform_driver omap_kp_driver = { .probe = omap_kp_probe, .remove = omap_kp_remove, - .suspend = omap_kp_suspend, - .resume = omap_kp_resume, .driver = { .name = "omap-keypad", }, diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index bbcccd672..323a0fb57 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -61,9 +61,9 @@ struct twl4030_keypad { unsigned short keymap[TWL4030_KEYMAP_SIZE]; u16 kp_state[TWL4030_MAX_ROWS]; bool autorepeat; - unsigned n_rows; - unsigned n_cols; - unsigned irq; + unsigned int n_rows; + unsigned int n_cols; + unsigned int irq; struct device *dbg_dev; struct input_dev *input; @@ -110,7 +110,7 @@ struct twl4030_keypad { #define KEYP_CTRL_KBD_ON BIT(6) /* KEYP_DEB, KEYP_LONG_KEY, KEYP_TIMEOUT_x*/ -#define KEYP_PERIOD_US(t, prescale) ((t) / (31 << (prescale + 1)) - 1) +#define KEYP_PERIOD_US(t, prescale) ((t) / (31 << ((prescale) + 1)) - 1) /* KEYP_LK_PTV_REG Fields */ #define KEYP_LK_PTV_PTV_SHIFT 5 @@ -162,9 +162,10 @@ static int twl4030_kpwrite_u8(struct twl4030_keypad *kp, u8 data, u32 reg) static inline u16 twl4030_col_xlate(struct twl4030_keypad *kp, u8 col) { - /* If all bits in a row are active for all coloumns then + /* + * If all bits in a row are active for all columns then * we have that row line connected to gnd. Mark this - * key on as if it was on matrix position n_cols (ie + * key on as if it was on matrix position n_cols (i.e. * one higher than the size of the matrix). */ if (col == 0xFF) @@ -209,9 +210,9 @@ static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all) u16 new_state[TWL4030_MAX_ROWS]; int col, row; - if (release_all) + if (release_all) { memset(new_state, 0, sizeof(new_state)); - else { + } else { /* check for any changes */ int ret = twl4030_read_kp_matrix_state(kp, new_state); @@ -262,8 +263,10 @@ static irqreturn_t do_kp_irq(int irq, void *_kp) /* Read & Clear TWL4030 pending interrupt */ ret = twl4030_kpread(kp, ®, KEYP_ISR1, 1); - /* Release all keys if I2C has gone bad or - * the KEYP has gone to idle state */ + /* + * Release all keys if I2C has gone bad or + * the KEYP has gone to idle state. + */ if (ret >= 0 && (reg & KEYP_IMR1_KP)) twl4030_kp_scan(kp, false); else @@ -283,7 +286,8 @@ static int twl4030_kp_program(struct twl4030_keypad *kp) if (twl4030_kpwrite_u8(kp, reg, KEYP_CTRL) < 0) return -EIO; - /* NOTE: we could use sih_setup() here to package keypad + /* + * NOTE: we could use sih_setup() here to package keypad * event sources as four different IRQs ... but we don't. */ @@ -312,7 +316,7 @@ static int twl4030_kp_program(struct twl4030_keypad *kp) /* * Enable Clear-on-Read; disable remembering events that fire - * after the IRQ but before our handler acks (reads) them, + * after the IRQ but before our handler acks (reads) them. */ reg = TWL4030_SIH_CTRL_COR_MASK | TWL4030_SIH_CTRL_PENDDIS_MASK; if (twl4030_kpwrite_u8(kp, reg, KEYP_SIH_CTRL) < 0) -- cgit v1.2.3-54-g00ecf