From: Trilok Soni <soni.trilok@gmail.com>
To: "Arce, Abraham" <x0066660@ti.com>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [RFC] [PATCH 1/3] OMAP4: Keyboard Controller Support
Date: Wed, 14 Apr 2010 13:04:40 +0530 [thread overview]
Message-ID: <i2x5d5443651004140034mdd11969cg72d4306c77f2bd0f@mail.gmail.com> (raw)
In-Reply-To: <27F9C60D11D683428E133F85D2BB4A53043D9EE7F5@dlee03.ent.ti.com>
Hi Abraham,
On Wed, Apr 14, 2010 at 6:40 AM, Arce, Abraham <x0066660@ti.com> wrote:
> Keyboard controller for OMAP4 with built-in scanning algorithm.
> The following implementations are used:
>
> - matrix_keypac.c logic
> - hwmod framework
Do we have hwmod framework mainlined in the kernel?
>
> +config KEYBOARD_OMAP4
> + tristate "TI OMAP4 keypad support"
> + depends on (ARCH_OMAP4)
No need of brackets.
Could you please provide "default y/n" option too?
> + * linux/drivers/input/keyboard/omap4-keypad.c
Better not to include file paths.
> +
> +struct omap_device_pm_latency omap_keyboard_latency[] = {
static?
> + {
> + .deactivate_func = omap_device_idle_hwmods,
> + .activate_func = omap_device_enable_hwmods,
> + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> + },
> +};
> +static irqreturn_t omap_keypad_threaded(int irq, void *dev_id)
> +{
> + struct omap_keypad *keypad_data = dev_id;
> + struct input_dev *input = keypad_data->input;
> + unsigned char key_state[8];
> + int col, row, code;
> + u32 *new_state = (u32 *) key_state;
> +
> + *new_state = __raw_readl(keypad_data->base +
> + OMAP4_KBD_FULLCODE31_0);
> + *(new_state + 1) = __raw_readl(keypad_data->base +
> + OMAP4_KBD_FULLCODE63_32);
> +
> + for (col = 0; col < keypad_data->cols; col++) {
> + for (row = 0; row < keypad_data->rows; row++) {
> + code = MATRIX_SCAN_CODE(row, col,
> + keypad_data->row_shift);
> + if (code < 0) {
> + printk(KERN_INFO "Spurious key %d-%d\n",
> + col, row);
> + continue;
> + }
> + input_report_key(input, keypad_data->keycodes[code],
> + key_state[col] & (1 << row));
> + }
> + }
where is input_sync(..)?
> +
> + pdata = kzalloc(sizeof(struct matrix_keypad_platform_data),
> + GFP_KERNEL);
Please check error return here, because kzalloc can fail.
> +
> + od = omap_device_build(name, id, oh, pdata,
> + sizeof(struct matrix_keypad_platform_data),
> + omap_keyboard_latency,
> + ARRAY_SIZE(omap_keyboard_latency), 1);
> + WARN(IS_ERR(od), "Could not build omap_device for %s %s\n",
> + name, oh_name);
> +
> + /* platform data */
> + pdata = pdev->dev.platform_data;
> + if (!pdata) {
> + dev_err(&pdev->dev, "no platform data defined\n");
> + kfree(pdata);
> + return -EINVAL;
> + }
> +
> + /* keymap data */
> + keymap_data = pdata->keymap_data;
> + if (!keymap_data) {
> + dev_err(&pdev->dev, "no keymap data defined\n");
> + kfree(keymap_data);
not freeing kfree(pdata)? Please check error return path again in this driver.
> +
> + __set_bit(EV_REP, input_dev->evbit);
> + __set_bit(KEY_OK, input_dev->keybit);
> + __set_bit(EV_KEY, input_dev->evbit);
> +
> + input_set_capability(input_dev, EV_MSC, MSC_SCAN);
> + input_set_drvdata(input_dev, keypad_data);
> +
> + status = input_register_device(keypad_data->input);
> + if (status < 0) {
> + dev_err(&pdev->dev, "failed to register input device\n");
> + goto failed_free_device;
> + }
> +
> + omap_keypad_config(keypad_data);
> +
> + platform_set_drvdata(pdev, keypad_data);
> +
> + return 0;
> +
> +failed_free_device:
> + input_unregister_device(keypad_data->input);
add keypad_data->input = NULL.
--
---Trilok Soni
http://triloksoni.wordpress.com
http://www.linkedin.com/in/triloksoni
--
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
next prev parent reply other threads:[~2010-04-14 7:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-14 1:10 [RFC] [PATCH 1/3] OMAP4: Keyboard Controller Support Arce, Abraham
2010-04-14 7:34 ` Trilok Soni [this message]
2010-04-16 0:04 ` Arce, Abraham
2010-04-20 23:11 ` Kevin Hilman
2010-04-16 5:06 ` Felipe Balbi
2010-05-05 23:17 ` Arce, Abraham
2010-04-20 23:16 ` Kevin Hilman
2010-05-06 2:30 ` Arce, Abraham
2010-04-21 6:55 ` Dmitry Torokhov
2010-05-11 4:13 ` Arce, Abraham
2010-05-11 4:17 ` Arce, Abraham
2010-05-11 4:41 ` Dmitry Torokhov
2010-05-11 5:03 ` Arce, Abraham
2010-05-11 5:45 ` Dmitry Torokhov
2010-05-11 14:53 ` Kevin Hilman
2010-05-11 16:41 ` Dmitry Torokhov
2010-05-11 21:39 ` Kevin Hilman
2010-05-12 5:34 ` Shilimkar, Santosh
2010-05-12 5:40 ` Arce, Abraham
2010-05-12 5:45 ` Shilimkar, Santosh
2010-05-12 6:03 ` Dmitry Torokhov
2010-05-12 6:19 ` Shilimkar, Santosh
2010-05-12 6:35 ` Dmitry Torokhov
2010-05-12 6:54 ` Shilimkar, Santosh
2010-05-12 6:20 ` Arce, Abraham
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=i2x5d5443651004140034mdd11969cg72d4306c77f2bd0f@mail.gmail.com \
--to=soni.trilok@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=x0066660@ti.com \
/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).