From: Jae hoon Chung <jh80.chung@gmail.com>
To: jsgood.yang@samsung.com
Cc: dmitry.torokhov@gmail.com, ben-linux@fluff.org,
linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Kyeongil Kim <ki0351.kim@samsung.com>
Subject: Re: [PATCH 1/4] [INPUT][KEYBOARD] Samsung keypad driver support
Date: Mon, 14 Sep 2009 14:22:27 +0900 [thread overview]
Message-ID: <91990fe20909132222t292578abi5d2867312a5be095@mail.gmail.com> (raw)
In-Reply-To: <1252494663-17624-1-git-send-email-jsgood.yang@samsung.com>
Hi...
I have some question to you.
> +static int s3c_keypad_scan(struct s3c_keypad *keypad, u32 *keymask_low,
> + u32 *keymask_high)
> +{
> + struct s3c_platform_keypad *pdata = keypad->pdata;
> + int i, j = 0;
> + u32 cval, rval, cfg;
> +
> + for (i = 0; i < pdata->nr_cols; i++) {
> + cval = readl(keypad->regs + S3C_KEYIFCOL);
> + cval |= S3C_KEYIF_COL_DMASK;
> + cval &= ~(1 << i);
> + writel(cval, keypad->regs + S3C_KEYIFCOL);
> + udelay(pdata->delay);
> +
> + rval = ~(readl(keypad->regs + S3C_KEYIFROW)) &
> + S3C_KEYIF_ROW_DMASK;
> +
> + if ((i * pdata->nr_rows) < pdata->max_masks)
> + *keymask_low |= (rval << (i * pdata->nr_rows));
> + else {
> + *keymask_high |= (rval << (j * pdata->nr_rows));
> + j++;
> + }
> + }
> +
> + cfg = readl(keypad->regs + S3C_KEYIFCOL);
> + cfg &= ~S3C_KEYIF_COL_MASK_ALL;
> + writel(cfg, keypad->regs + S3C_KEYIFCOL);
> +
> + return 0;
> +}
> +
> +static void s3c_keypad_timer_handler(unsigned long data)
> +{
> + struct s3c_keypad *keypad = (struct s3c_keypad *)data;
> + struct s3c_platform_keypad *pdata = keypad->pdata;
> + struct input_dev *input = keypad->dev;
> + u32 keymask_low = 0, keymask_high = 0;
> + u32 press_mask_low, press_mask_high;
> + u32 release_mask_low, release_mask_high, code, cfg;
> + int i;
> +
> + s3c_keypad_scan(keypad, &keymask_low, &keymask_high);
> +
> + if (keymask_low != keypad->prevmask_low) {
> + press_mask_low = ((keymask_low ^ keypad->prevmask_low) &
> + keymask_low);
> + release_mask_low = ((keymask_low ^ keypad->prevmask_low) &
> + keypad->prevmask_low);
> +
> + i = 0;
> + while (press_mask_low) {
> + if (press_mask_low & 1) {
> + code = keypad->keycodes[i];
> + input_report_key(input, code, 1);
> + dev_dbg(&input->dev, "low pressed: %d\n", i);
> + }
> + press_mask_low >>= 1;
> + i++;
> + }
> +
> + i = 0;
> + while (release_mask_low) {
> + if (release_mask_low & 1) {
> + code = keypad->keycodes[i];
> + input_report_key(input, code, 0);
> + dev_dbg(&input->dev, "low released: %d\n", i);
> + }
> + release_mask_low >>= 1;
> + i++;
> + }
> + keypad->prevmask_low = keymask_low;
> + }
> +
> + if (keymask_high != keypad->prevmask_high) {
> + press_mask_high = ((keymask_high ^ keypad->prevmask_high) &
> + keymask_high);
> + release_mask_high = ((keymask_high ^ keypad->prevmask_high) &
> + keypad->prevmask_high);
> +
> + i = 0;
> + while (press_mask_high) {
> + if (press_mask_high & 1) {
> + code = keypad->keycodes[i + pdata->max_masks];
> + input_report_key(input, code, 1);
> + dev_dbg(&input->dev, "high pressed: %d %d\n",
> + keypad->keycodes[i + pdata->max_masks],
> + i);
> + }
> + press_mask_high >>= 1;
> + i++;
> + }
> +
> + i = 0;
> + while (release_mask_high) {
> + if (release_mask_high & 1) {
> + code = keypad->keycodes[i + pdata->max_masks];
> + input_report_key(input, code, 0);
> + dev_dbg(&input->dev, "high released: %d\n",
> + keypad->keycodes[i + pdata->max_masks]);
> + }
> + release_mask_high >>= 1;
> + i++;
> + }
> + keypad->prevmask_high = keymask_high;
> + }
> +
> + if (keymask_low | keymask_high) {
> + mod_timer(&keypad->timer, jiffies + HZ / 10);
> + } else {
> + cfg = readl(keypad->regs + S3C_KEYIFCON);
> + cfg &= ~S3C_KEYIF_CON_MASK_ALL;
> + cfg |= (S3C_KEYIF_INT_F_EN | S3C_KEYIF_INT_R_EN |
> + S3C_KEYIF_DF_EN | S3C_KEYIF_FC_EN);
> + writel(cfg, keypad->regs + S3C_KEYIFCON);
> + }
> +}
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
I understood your code that used the keymask_low & keymask_high.
why did you use to distinguish a keymask_low & keymask_high?
In your code, that variable saved all value of row_val , then you are
searching the value of pressed row_val...
i think it is unnecessary.
next prev parent reply other threads:[~2009-09-14 5:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 11:11 [PATCH 1/4] [INPUT][KEYBOARD] Samsung keypad driver support jsgood.yang
2009-09-09 11:21 ` Kyungmin Park
2009-09-09 11:31 ` Jinsung Yang
2009-09-09 11:52 ` Mark Brown
2009-09-14 5:22 ` Jae hoon Chung [this message]
2009-09-26 9:54 ` Pavel Machek
2009-09-26 17:21 ` Trilok Soni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=91990fe20909132222t292578abi5d2867312a5be095@mail.gmail.com \
--to=jh80.chung@gmail.com \
--cc=ben-linux@fluff.org \
--cc=dmitry.torokhov@gmail.com \
--cc=jsgood.yang@samsung.com \
--cc=ki0351.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).