WM8650 power button, gpio and keys

179 views
Skip to first unread message

J T Dsouza

unread,
Oct 24, 2012, 2:42:54 AM10/24/12
to vt8500-wm8505...@googlegroups.com
The powerbutton simply switches off power, resulting in fs corruption
every now and then.
How does one get the powebutton event working?.

Afair it wasnt working on the default 2.6.32-9-default source too.

If the powerbutton cannot be set right, I need to get the keys on the
wm8650 working, which I presume are wired to some gpio.
The modules gpio-generic, gpio_keys, gpio_keys_polled is modprobed
without errors.

What other magic do I need.

Google merely throws up patch / kernel source discussions from the
list regulars.

Tony Prisk

unread,
Oct 25, 2012, 1:23:24 PM10/25/12
to vt8500-wm8505...@googlegroups.com

From what I've seen in the hardware schematic I have, the power button is connected to a PWRBTN- pin on the SoC. No idea how to interface with it - haven't even looked.

What other keys are you talking about? keyboard? Do you have a WM8650 netbook?

Regards
Tony P

Alexey Charkov

unread,
Oct 25, 2012, 1:26:07 PM10/25/12
to vt8500-wm8505...@googlegroups.com
2012/10/25 Tony Prisk <sent...@digitalfantasy.co.nz>:
> On Wednesday, October 24, 2012 7:42:55 PM UTC+13, jtd wrote:
>>
>> The powerbutton simply switches off power, resulting in fs corruption
>> every now and then.
>> How does one get the powebutton event working?.
>>
>> Afair it wasnt working on the default 2.6.32-9-default source too.
>>
>> If the powerbutton cannot be set right, I need to get the keys on the
>> wm8650 working, which I presume are wired to some gpio.
>> The modules gpio-generic, gpio_keys, gpio_keys_polled is modprobed
>> without errors.
>>
>> What other magic do I need.
>>
>> Google merely throws up patch / kernel source discussions from the
>> list regulars.
>
>
> From what I've seen in the hardware schematic I have, the power button is
> connected to a PWRBTN- pin on the SoC. No idea how to interface with it -
> haven't even looked.

From what I recall, there's been a register controlling power button
behaviour somewhere in PMC (soft vs. hard power). Not sure whether it
can generate any meaningful userspace events, though...

Best,
Alexey

J T Dsouza

unread,
Oct 25, 2012, 2:33:08 PM10/25/12
to vt8500-wm8505...@googlegroups.com
No the tablet volume keys and the back button. Both generate events
with the 2.6.39-default source - a kpad module.

>
> Regards
> Tony P

J T Dsouza

unread,
Oct 25, 2012, 2:38:25 PM10/25/12
to vt8500-wm8505...@googlegroups.com
With the 2.6.32-9-default kernel, there is a delay of several seconds
before shutdown on power button press.

With the 3.6.0+ it switches off instantly.

So presumably the button does generate some event. Unfortunately my
old microsd is dead, so testing is testing the old stuff is going to
be a pain.


Also are the serial ports useable?

Tony Prisk

unread,
Oct 25, 2012, 11:55:02 PM10/25/12
to vt8500-wm8505...@googlegroups.com
Correct - volume and back are part of the keypad. I haven't seen a
driver for this yet, and to be honest, it's not a vitally important
feature (to me at least) - more of a nicety.

Power button is not (as best I can tell) part of the keypad.

Regards
Tony P

J T Dsouza

unread,
Oct 26, 2012, 2:26:21 AM10/26/12
to vt8500-wm8505...@googlegroups.com
The idea was to use that as a power switch, if implementing a real
power switch is a problem.

Alexey Charkov

unread,
Oct 26, 2012, 2:57:38 AM10/26/12
to vt8500-wm8505...@googlegroups.com
2012/10/26 J T Dsouza <jtd...@gmail.com>:
Can you try writing 1 to PMC register 0xd8130054 (enable soft power)
and report whether behaviour changes in any way? I'm still not sure
how one can catch the button press event, though... It might also make
sense to try monitoring various /dev/event entries under WonderMedia's
kernel for the respective input event, to see how those guys handle
it.

As for the keypad, you'd need a separate driver for that. There's a
dedicated silicon block in wmt chips that controls the keypad.

Best,
Alexey

Tony Prisk

unread,
Oct 26, 2012, 4:49:51 PM10/26/12
to vt8500-wm8505...@googlegroups.com
Looking at the pm.c supplied with wm8650 source, it appears that the
wakeup event fires when you press the power button, and it can thus be
captured.

#ifdef KEYPAD_POWER_SUPPORT
if((status & BIT14) && kpadPower_dev) {

spin_lock_irq(&kpadPower_lock);
if(!powerKey_is_pressed) {
powerKey_is_pressed = 1;
input_report_key(kpadPower_dev, KEY_END, 1); //power key is
pressed
input_sync(kpadPower_dev);
pressed_jiffies = jiffies;
wmt_pwrbtn_debounce_value(power_up_debounce_value);
DPRINTK("\n[%s]power key pressed -->\n",__func__);
} else {
input_event(kpadPower_dev, EV_KEY, KEY_END, 2); // power key
repeat
input_sync(kpadPower_dev);
DPRINTK("\n[%s]power key repeat\n",__func__);

}
//disable_irq(IRQ_PMC_WAKEUP);
spin_unlock_irq(&kpadPower_lock);
mod_timer(&kpadPower_timer, jiffies + power_button_timeout);
}
#endif

I guess part of the keypad driver should be able to capture the power
button as well, and trigger a shutdown event. Guessing it definately
needs to be in soft-power mode for this to work.

Regards
Tony P

Reply all
Reply to author
Forward
0 new messages