From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-iw0-f174.google.com ([209.85.214.174]:39017 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752441Ab0KJSeH convert rfc822-to-8bit (ORCPT ); Wed, 10 Nov 2010 13:34:07 -0500 MIME-Version: 1.0 In-Reply-To: <1289393281-4459-2-git-send-email-tsoni@codeaurora.org> References: <1289393281-4459-1-git-send-email-tsoni@codeaurora.org> <1289393281-4459-2-git-send-email-tsoni@codeaurora.org> From: Eric Miao Date: Thu, 11 Nov 2010 02:33:45 +0800 Message-ID: Subject: Re: [RFC v1 PATCH 1/6] matrix_keypad: Increase the max limit of rows and columns Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-arm-msm-owner@vger.kernel.org List-ID: To: Trilok Soni Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, rtc-linux@googlegroups.com, linux-arm-msm@vger.kernel.org, Dmitry Torokhov On Wed, Nov 10, 2010 at 8:47 PM, Trilok Soni wrote: > Some keyboard controller have support for more than > 16 columns and rows. > > Cc: Dmitry Torokhov > Cc: Eric Miao > Signed-off-by: Trilok Soni > --- >  include/linux/input/matrix_keypad.h |    8 ++++---- >  1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h > index 80352ad..d80845e 100644 > --- a/include/linux/input/matrix_keypad.h > +++ b/include/linux/input/matrix_keypad.h > @@ -4,11 +4,11 @@ >  #include >  #include > > -#define MATRIX_MAX_ROWS                16 > -#define MATRIX_MAX_COLS                16 > +#define MATRIX_MAX_ROWS                18 > +#define MATRIX_MAX_COLS                18 > > -#define KEY(row, col, val)     ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ > -                                (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ > +#define KEY(row, col, val)     ((((row) % (MATRIX_MAX_ROWS)) << 24) |\ > +                                (((col) % (MATRIX_MAX_COLS)) << 16) |\ >                                 (val & 0xffff)) > Or maybe we can solve this completely by introducing something like: struct matrix_keycode { int row; int col; int value; } And make changes to KEY() macro and other places. You may also want to eliminate the hardcoded MATRIX_MAX_* in matrix_keypad.c. >  #define KEY_ROW(k)             (((k) >> 24) & 0xff) > -- > 1.7.0.2 > >