From: Ben Gardiner <bengardiner@nanometrics.ca>
To: "Nori, Sekhar" <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>,
"davinci-linux-open-source@linux.davincidsp.com"
<davinci-linux-open-source@linux.davincidsp.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
"Govindarajan, Sriramakrishnan" <srk@ti.com>,
Paul Mundt <lethal@linux-sh.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Alexander Clouter <alex@digriz.org.uk>,
Chris Cordahi <christophercordahi@nanometrics.ca>
Subject: Re: [PATCH v2 4/4] da850-evm: add baseboard UI expander buttons, switches and LEDs
Date: Fri, 19 Nov 2010 10:40:50 -0500 [thread overview]
Message-ID: <AANLkTike4sRvptEe9PXLT2u+SrFMOpNC6pvLPSzBfVOX@mail.gmail.com> (raw)
In-Reply-To: <B85A65D85D7EB246BE421B3FB0FBB59302477EAA89@dbde02.ent.ti.com>
Hi Sehkar,
On Fri, Nov 19, 2010 at 7:14 AM, Nori, Sekhar <nsekhar@ti.com> wrote:
> The board patches look good to me overall. Some minor comments below:
Thanks -- and I appreciate your input.
> On Wed, Nov 17, 2010 at 01:09:37, Ben Gardiner wrote:
>> [...]
>> +static const char const *baseboard_expander_names[] = {
>> + "deep_sleep_en", "sw_rst", "tp_23", "tp_22", "tp_21", "user_pb1",
>> + "user_led2", "user_led1", "user_sw_1", "user_sw_2", "user_sw_3",
>> + "user_sw_4", "user_sw_5", "user_sw_6", "user_sw_7", "user_sw_8"
>> +};
>> +
>> +#define DA850_DEEP_SLEEP_EN_OFFSET 0
>> +#define DA850_SW_RST_OFFSET 1
>> +#define DA850_PB1_OFFSET 5
>> +#define DA850_USER_LED2_OFFSET 6
>> +#define DA850_USER_SW_1_OFFSET 8
>
> Again, I think index initialized array will work much
> better here. Currently it is error prone to keep the defines
> and the array of names in sync.
Agreed. Now that I've seen what you did with the previous patch I am
eager to apply that pattern also to the definitions in this patch.
>> [...]
>> +static struct gpio_keys_platform_data user_pb_gpio_key_platform_data = {
>
> Similarly "da850evm_bb_pb_pdata" instead of the long name?
Will do.
>> [...]
>> +static struct gpio_keys_button user_sw_gpio_keys[DA850_N_USER_SW];
>
> You could initialize most static fields here itself using:
>
> static struct gpio_keys_button user_sw_gpio_keys[] = {
> [0 ... DA850_N_USER_SW] = {
> ...
> ...
> ...
> },
> };
>
> This way your runtime initialization will come down.
Indeed; I am eager to extend the pattern you introduced to this
initialization also.
>> +
>> +static struct gpio_keys_platform_data user_sw_gpio_key_platform_data = {
>> + .buttons = user_sw_gpio_keys,
>> + .nbuttons = ARRAY_SIZE(user_sw_gpio_keys),
>> + .rep = 0, /* disable auto-repeat */
>> + .poll_interval = DA850_SW_POLL_MS,
>> +};
>
> I wonder if we really have create to separate platform data
> for switches and push buttons. If it is only the debounce period
> that is different, it can be handled by initializing that field
> differently.
I see. Good idea; we can declare an array of gpio_keys_platform_data.
Note; it is the polling interval which differs, not the debounce interval.
>> +
>> +static struct platform_device user_sw_gpio_key_device = {
>> + .name = "gpio-keys",
>> + .id = 2,
>> + .dev = {
>> + .platform_data = &user_sw_gpio_key_platform_data
>
> End with a ',' here.
Will do.
>> [...]
>> +static void da850_user_switches_init(unsigned gpio)
>> +{
>> + int i;
>> + struct gpio_keys_button *button;
>> +
>> + for (i = 0; i < DA850_N_USER_SW; i++) {
>> + button = &user_sw_gpio_keys[i];
>> +
>> + button->code = SW_LID + i;
>> + button->type = EV_SW;
>> + button->active_low = 1;
>> + button->wakeup = 0;
>> + button->debounce_interval = DA850_PB_DEBOUNCE_MS;
>> + button->desc = (char *)
>> + baseboard_expander_names[DA850_USER_SW_1_OFFSET + i];
>
> You could use some shorter names here. In the context of EVM file, 'bb'
> will fit for "base board", "exp" works for expander. Also, here it is
> clear the macro is used as an array offset, so _OFFSET can be dropped
> altogether. Similarly with _names. Also, the global and static symbols
> should be pre-fixed with da850evm_ so it is easy to look up the symbol
> file or object dump.
I see your points; 1) exp and bb for expander and baseboard variable
names, respectively 2) drop _OFFSET and _names 3) prefix statics and
globals with da850evm.
>> [...]
>
> How does gpio_request prevent sysfs control?
To obtain access to a gpio through the sysfs interface the user must
first write the gpio number to 'export'. When the gpio has been
gpio_request()'d the result of writing to 'export' is nothing; whereas
writing to export would normally result in the appearance of a named
gpio line alongside 'export'.
I hope the following commands and their output illustrate my point:
$ cd /sys/class/gpio/
$ ls
export gpiochip128 gpiochip160 gpiochip64 unexport
gpiochip0 gpiochip144 gpiochip32 gpiochip96
$ echo 160 > export
$ ls
export gpiochip128 gpiochip160 gpiochip64 unexport
gpiochip0 gpiochip144 gpiochip32 gpiochip96
$ echo 163 > export
$ ls
export gpiochip128 gpiochip160 gpiochip64 tp_22
gpiochip0 gpiochip144 gpiochip32 gpiochip96 unexport
Best Regards,
Ben Gardiner
---
Nanometrics Inc.
http://www.nanometrics.ca
next prev parent reply other threads:[~2010-11-19 15:40 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1289835508.git.bengardiner@nanometrics.ca>
2010-11-16 19:39 ` [PATCH v2 0/4] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-16 19:39 ` [PATCH v2 1/4] input: gpio_keys: polling mode support Ben Gardiner
2010-11-16 19:39 ` [PATCH v2 2/4] da850-evm: add UI Expander pushbuttons Ben Gardiner
2010-11-19 9:58 ` Nori, Sekhar
2010-11-19 15:38 ` Ben Gardiner
2010-11-22 11:49 ` Nori, Sekhar
2010-11-22 13:50 ` Ben Gardiner
2010-11-23 12:38 ` Nori, Sekhar
2010-11-23 13:29 ` Ben Gardiner
2010-11-23 15:48 ` Kevin Hilman
2010-11-23 17:58 ` Ben Gardiner
2010-11-24 6:09 ` Paul Mundt
2010-11-24 17:17 ` Ben Gardiner
2010-11-16 19:39 ` [PATCH v2 3/4] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
2010-11-19 11:19 ` [PATCH v2 3/4] da850-evm: extract defines for SEL{A, B, C} " Nori, Sekhar
2010-11-19 15:38 ` Ben Gardiner
2010-11-16 19:39 ` [PATCH v2 4/4] da850-evm: add baseboard UI expander buttons, switches and LEDs Ben Gardiner
2010-11-19 12:14 ` Nori, Sekhar
2010-11-19 15:40 ` Ben Gardiner [this message]
2010-11-19 17:02 ` Dmitry Torokhov
2010-11-19 17:15 ` Ben Gardiner
2010-11-22 12:00 ` Nori, Sekhar
2010-11-22 14:15 ` Ben Gardiner
2010-11-23 12:42 ` Nori, Sekhar
2010-11-23 13:32 ` Ben Gardiner
2010-11-19 21:37 ` [PATCH v3 0/4] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-19 21:37 ` [PATCH v3 1/4] input: gpio_keys: polling mode support Ben Gardiner
2010-11-19 21:37 ` [PATCH v3 2/4] da850-evm: add UI Expander pushbuttons Ben Gardiner
2010-11-19 21:37 ` [PATCH v3 3/4] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
2010-11-19 21:41 ` [PATCH v3 3/4] da850-evm: extract defines for SEL{A, B, C} " Victor Rodriguez
2010-11-19 22:25 ` Ben Gardiner
2010-11-19 21:37 ` [PATCH v3 4/4] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 1/5] input: gpio_keys: polling mode support Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
2010-11-24 13:16 ` Nori, Sekhar
2010-11-24 17:16 ` Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
2010-11-23 19:40 ` [PATCH v4 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
2010-11-23 19:41 ` [PATCH v4 5/5] da850-evm: KEYBOARD_GPIO and INPUT_POLLDEV Kconfig conditionals Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 1/5] [WIP] input: add input driver for polled GPIO buttons Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
2010-11-24 21:59 ` [PATCH v5 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 1/5] Input: add input driver for polled GPIO buttons Ben Gardiner
2010-12-10 15:50 ` Kevin Hilman
2010-12-09 21:51 ` [PATCH v6 2/5] da850-evm: add UI Expander pushbuttons Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 3/5] da850-evm: extract defines for SEL{A,B,C} pins in UI expander Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 4/5] da850-evm: add baseboard GPIO expander buttons, switches and LEDs Ben Gardiner
2010-12-09 21:51 ` [PATCH v6 5/5] da850-evm: KEYBOARD_GPIO_POLLED Kconfig conditional Ben Gardiner
2010-12-10 16:16 ` [PATCH v6 0/5] da850-evm: add gpio-{keys,leds} for UI and BB expanders Kevin Hilman
2010-12-10 16:33 ` Ben Gardiner
2010-12-11 0:04 ` Kevin Hilman
2010-12-13 17:02 ` Ben Gardiner
2010-12-13 21:53 ` Kevin Hilman
2010-12-14 4:31 ` Ben Gardiner
2010-12-14 16:17 ` Ben Gardiner
2010-12-14 17:10 ` Kevin Hilman
2010-12-17 15:15 ` Ben Gardiner
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=AANLkTike4sRvptEe9PXLT2u+SrFMOpNC6pvLPSzBfVOX@mail.gmail.com \
--to=bengardiner@nanometrics.ca \
--cc=alex@digriz.org.uk \
--cc=christophercordahi@nanometrics.ca \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=dmitry.torokhov@gmail.com \
--cc=khilman@deeprootsystems.com \
--cc=lethal@linux-sh.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=srk@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).