Re: [PATCH 1/1 try#2] [INPUT] keypad driver: Added support for OpenCores Keyboard Controller

2008-05-11 Thread Bryan Wu
On Tue, Feb 5, 2008 at 7:33 PM, Javier Herrero <[EMAIL PROTECTED]> wrote:
> Vojtech Pavlik escribió:
>>
>> On Tue, Feb 05, 2008 at 12:18:15PM +0100, Javier Herrero wrote:
>>>
>>> Dear Vojtech,
>>>
>>> I think that a 1:1 mapping between linux keycodes and what keyboard sends
>>> is right, because the scan code to key code conversion is already programmed
>>> and done inside the FPGA code.
>>
>> And the FPGA code changes with different keyboards attached?
>>
> The original OpenCores keyboard controller is a 6 rows x 12 cols keyboard
> controller that can be customized for other row/col sizes modifiying
> Constants.vhd VHDL file, in which also the translation table is defined, and
> for different key disposition schemes both the number of rows and cols can
> be changed. We are currently using this controller with a 4x4 key matrix,
> and with a different key mapping values, so I thought that it would be
> preferable to have the driver mapping fixed to 1:1 and do the mapping in the
> VHDL, since in most cases the keyboard using this controller would be
> different to the default keyboard defined in the original Contants.vhd VHDL
> file.
>
> Regards,
>
> Javier
>

Hi Vojtech, Will and Dmitry,

How do you think of this driver from Javier?
It works fine on Blackfin arch, but it can also be shared by other platform.
So this driver is useful of the other developers.
Could you please consider merging this driver?

If you need me to resend this patch, please ping me.

Thanks
-Bryan


Re: [PATCH 1/1 try#2] [INPUT] keypad driver: Added support for OpenCores Keyboard Controller

2008-02-05 Thread Javier Herrero

Vojtech Pavlik escribió:

On Tue, Feb 05, 2008 at 12:18:15PM +0100, Javier Herrero wrote:

Dear Vojtech,

I think that a 1:1 mapping between linux keycodes and what keyboard sends 
is right, because the scan code to key code conversion is already 
programmed and done inside the FPGA code.


And the FPGA code changes with different keyboards attached?

The original OpenCores keyboard controller is a 6 rows x 12 cols 
keyboard controller that can be customized for other row/col sizes 
modifiying Constants.vhd VHDL file, in which also the translation table 
is defined, and for different key disposition schemes both the number of 
rows and cols can be changed. We are currently using this controller 
with a 4x4 key matrix, and with a different key mapping values, so I 
thought that it would be preferable to have the driver mapping fixed to 
1:1 and do the mapping in the VHDL, since in most cases the keyboard 
using this controller would be different to the default keyboard defined 
in the original Contants.vhd VHDL file.


Regards,

Javier


Best regards,

Javier

Vojtech Pavlik escribió:

On Thu, Jan 31, 2008 at 01:18:22AM +0800, Bryan Wu wrote:


+static irqreturn_t opencores_kbd_isr(int irq, void *dev_id)
+{
+   unsigned char c;
+   struct platform_device *pdev = dev_id;
+   struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev);
+   struct input_dev *input = opencores_kbd->input;
+
+   c = readb(opencores_kbd->addr_res->start);
+   input_report_key(input, c & 0x7f, c & 0x80 ? 0 : 1);
+   input_sync(input);
+
+   return IRQ_HANDLED;
+}

 This looks utterly wrong: It assumes 1:1 mapping between Linux keycodes
and what the keyboard sends, which I can't believe is the case.


--

Javier HerreroEMAIL: [EMAIL PROTECTED]
HV Sistemas S.L.  PHONE: +34 949 336 806
Los Charcones, 17AFAX:   +34 949 336 792
19170 El Casar - Guadalajara - Spain  WEB: http://www.hvsistemas.com 




--

Javier HerreroEMAIL: [EMAIL PROTECTED]
HV Sistemas S.L.  PHONE: +34 949 336 806
Los Charcones, 17AFAX:   +34 949 336 792
19170 El Casar - Guadalajara - Spain  WEB: http://www.hvsistemas.com 



Re: [PATCH 1/1 try#2] [INPUT] keypad driver: Added support for OpenCores Keyboard Controller

2008-02-05 Thread Vojtech Pavlik
On Tue, Feb 05, 2008 at 12:18:15PM +0100, Javier Herrero wrote:
> Dear Vojtech,
>
> I think that a 1:1 mapping between linux keycodes and what keyboard sends 
> is right, because the scan code to key code conversion is already 
> programmed and done inside the FPGA code.

And the FPGA code changes with different keyboards attached?

> Best regards,
>
> Javier
>
> Vojtech Pavlik escribió:
>> On Thu, Jan 31, 2008 at 01:18:22AM +0800, Bryan Wu wrote:
>>
>>> +static irqreturn_t opencores_kbd_isr(int irq, void *dev_id)
>>> +{
>>> +   unsigned char c;
>>> +   struct platform_device *pdev = dev_id;
>>> +   struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev);
>>> +   struct input_dev *input = opencores_kbd->input;
>>> +
>>> +   c = readb(opencores_kbd->addr_res->start);
>>> +   input_report_key(input, c & 0x7f, c & 0x80 ? 0 : 1);
>>> +   input_sync(input);
>>> +
>>> +   return IRQ_HANDLED;
>>> +}
>>  This looks utterly wrong: It assumes 1:1 mapping between Linux keycodes
>> and what the keyboard sends, which I can't believe is the case.
>>
>
> -- 
> 
> Javier HerreroEMAIL: [EMAIL PROTECTED]
> HV Sistemas S.L.  PHONE: +34 949 336 806
> Los Charcones, 17AFAX:   +34 949 336 792
> 19170 El Casar - Guadalajara - Spain  WEB: http://www.hvsistemas.com 

-- 
Vojtech Pavlik
Director SuSE Labs


Re: [PATCH 1/1 try#2] [INPUT] keypad driver: Added support for OpenCores Keyboard Controller

2008-02-05 Thread Javier Herrero

Dear Vojtech,

I think that a 1:1 mapping between linux keycodes and what keyboard 
sends is right, because the scan code to key code conversion is already 
programmed and done inside the FPGA code.


Best regards,

Javier

Vojtech Pavlik escribió:

On Thu, Jan 31, 2008 at 01:18:22AM +0800, Bryan Wu wrote:


+static irqreturn_t opencores_kbd_isr(int irq, void *dev_id)
+{
+   unsigned char c;
+   struct platform_device *pdev = dev_id;
+   struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev);
+   struct input_dev *input = opencores_kbd->input;
+
+   c = readb(opencores_kbd->addr_res->start);
+   input_report_key(input, c & 0x7f, c & 0x80 ? 0 : 1);
+   input_sync(input);
+
+   return IRQ_HANDLED;
+}
 
This looks utterly wrong: It assumes 1:1 mapping between Linux keycodes

and what the keyboard sends, which I can't believe is the case.



--

Javier HerreroEMAIL: [EMAIL PROTECTED]
HV Sistemas S.L.  PHONE: +34 949 336 806
Los Charcones, 17AFAX:   +34 949 336 792
19170 El Casar - Guadalajara - Spain  WEB: http://www.hvsistemas.com 



Re: [PATCH 1/1 try#2] [INPUT] keypad driver: Added support for OpenCores Keyboard Controller

2008-02-05 Thread Vojtech Pavlik
On Thu, Jan 31, 2008 at 01:18:22AM +0800, Bryan Wu wrote:

> +static irqreturn_t opencores_kbd_isr(int irq, void *dev_id)
> +{
> + unsigned char c;
> + struct platform_device *pdev = dev_id;
> + struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev);
> + struct input_dev *input = opencores_kbd->input;
> +
> + c = readb(opencores_kbd->addr_res->start);
> + input_report_key(input, c & 0x7f, c & 0x80 ? 0 : 1);
> + input_sync(input);
> +
> + return IRQ_HANDLED;
> +}
 
This looks utterly wrong: It assumes 1:1 mapping between Linux keycodes
and what the keyboard sends, which I can't believe is the case.

-- 
Vojtech Pavlik
Director SuSE Labs


Re: [PATCH 1/1 try#2] [INPUT] keypad driver: Added support for OpenCores Keyboard Controller

2008-01-30 Thread Dmitry Torokhov
Hi Bryan,

On Wednesday 30 January 2008, Bryan Wu wrote:
> +   for (i = 0; i < input->keycodemax; i++) {
> +   opencores_kbd->keycode[i] = i;
> +   __set_bit(opencores_kbd->keycode[i] & KEY_MAX, input->keybit);
> +   }

This looks fishy. The default keymap on the opencores site appears to be 
different...

-- 
Dmitry