Re: [PATCH V1] input: keyboard: gpio: Support for interrupt onlykey

From: Laxman Dewangan
Date: Mon Mar 19 2012 - 03:30:05 EST


Hi Dmitry,

On Monday 19 March 2012 11:36 AM, Dmitry Torokhov wrote:

OK, so I am generally happy with the patch; the only issue is that in
interrupt mode the only event type that makes sense is EV_KEY so we need
to make sure we do not accept anything else.


Thanks for taking care of patch. I am ok with this policy.

Also, I do not think that having button_irq() that is called all the
time is the best solution; I;d rather pulled RQ number up into button
data.


Yes, this is nice cleanups.

I tried doing the above in the patch below. Please let me know if it
still works for you. Note that it depends on some other patches for
gpio_keys that I have; I am attaching them for your reference.


This works fine with one small change.
The function gpio_keys_report_event() is gettign called from probe for initialing the key state. This function should bypass if it is not the gpio based otherwise system crash.
I made following change and after that it works fine.

static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
const struct gpio_keys_button *button = bdata->button;
struct input_dev *input = bdata->input;
unsigned int type = button->type ?: EV_KEY;
int state;

if (!gpio_is_valid(button->gpio))
return;

state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/