Commit Graph

8 Commits

Author SHA1 Message Date
Aseda Aboagye
e9883124ff gpio: Refactor IRQ handler pointer out of gpio_list
In the gpio_info struct, we had a irq_handler pointer defined even
though a majority of the GPIOs did not have irq handlers associated. By
removing the irq_handler pointer out of the struct, we can save some
space with some targets saving more than others. (For example, ~260
bytes for samus_pd).

This change also brings about a new define:

     GPIO_INT(name, port, pin, flags, signal)

And the existing GPIO macro has had the signal parameter removed since
they were just NULL.

     GPIO(name, port, pin, flags)

In each of the gpio.inc files, all the GPIOs with irq handlers must be
defined at the top of the file. This is because their enum values from
gpio_signal are used as the index to the gpio_irq_handlers table.

BUG=chromium:471331
BRANCH=none
TEST=Flashed ec to samus and samus_pd, verified lightbar tap, lid, power
button, keyboard, charging, all still working.
TEST=Moved a GPIO_INT declaration after a GPIO declaration and watched the build
fail.
TEST=make -j BOARD=peppy tests
TEST=make -j BOARD=auron tests
TEST=make -j BOARD=link tests

Change-Id: Id6e261b0a3cd63223ca92f2e96a80c95e85cdefb
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/263973
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Trybot-Ready: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-04-10 22:08:25 +00:00
Randall Spangler
672057cb7e Split x86 power button logic out of switch.c
Power button logic is common across all platforms and is not
LM4-specific, so move it to its own module.  Switch.c will eventually
be moving to common/ and will common across all platforms (not just
x86), and splitting out the x86 power button logic is needed before
that too.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=manual
     1) power on system with both lid and power button.
     2) power+refresh -> reboots
     3) power+refresh+esc -> recovery mode
     4) power+refresh+downarrow -> reboots, AP stays off
     5) toggling recovery GPIO via servo should generate SW debug output
        showing bit 0x10 toggling

Change-Id: I07714e2c035dceece66f90407983397d2697e7d5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61780
2013-07-17 10:49:48 -07:00
Randall Spangler
eb8920c939 Split wireless power/radio control out of switch.c
Chipset control of wireless power uses the new API instead of overriding
the wireless power itself.

Refactor board-specific support for it to just a few config #defines
instead of board-specific functions.  This makes some assumptions
about the polarity of the enable signals.  Not making those
assumptions would require defining an array of structs or some other
heavier-weight board-specific info.  Since the assumptions hold for
all current boards, let's make them now because this is a step in the
right direction, and reserve doing something more general until we
actually have a use case for it (so we build in just the flexibility
we need).

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; see that link wifi turns on at boot and off at
     shutdown (verify via 'gpioget' from EC console)

Change-Id: Ic036e76158198d2d5e3dd244c3c7b9b1e8d62982
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61608
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-11 16:51:40 -07:00
Duncan Laurie
d6d3b7cbc5 Add wireless switch control for WWAN
Haswell devices have EC control of the WWAN power rail.
Expose a new wireless switch enable flag for this under
the existing wirless enable command.

This change also abstracts the wireless enable function
to call a per-board handler so the different boards can
do the right thing based on their GPIO setup.

The haswell boards will switch WLAN radio and WWAN power
rails based on the switch inputs.  These boards do not have
EC control of bluetooth radio/rail power.

WLAN (power and radio) still defaults to enabled.  Disabling
with ectool will turn off the radio but keep the power enabled
in order to prevent the PCIe device from disappearing.

WWAN (power) still defaults to disabled.  Disabling with
ectool will turn off the power rail.

BUG=chrome-os-partner:19871
BRANCH=none
TEST=manual: boot on slippy

DEFAULT:

> ectool gpioget pp3300_wlan_en
GPIO pp3300_wlan_en = 1
> ectool gpioget wlan_off_l
GPIO wlan_off_l = 1
> ectool gpioget pp3300_lte_en
GPIO pp3300_lte_en = 0

ENABLE WWAN:

> ectool wireless 0x7
Success.
> ectool gpioget pp3300_lte_en
GPIO pp3300_lte_en = 1

DISABLE WLAN (radio):

> ectool wireless 0x7
Success.
> ectool gpioget pp3300_wlan_en
GPIO pp3300_wlan_en = 1
> ectool gpioget wlan_off_l
GPIO wlan_off_l = 0

Change-Id: I6f760b8cf5ab47d8f7f0dd8cd4d3e6563464043e
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57215
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-06-03 14:32:07 -07:00
Bill Richardson
0bfb7ddd07 Replace generated CONFIG_TASK_ macros with HAS_TASK_
CONFIG_ macros should be set directly. Expanding the task names in the same
way made it difficult to tell what was a configuration choice and what was
due to changes in ec.tasklist

BUG=chrome-os-partner:18343
TEST=build all, run link
BRANCH=none

Change-Id: Ib82e34f974238ee2dd216f33b701b6f4c6a4f1f1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49098
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-24 16:32:58 -07:00
Randall Spangler
bdd16f8206 Split lid switch code out of switch.c to its own file
This will allow ARM code to use the same lid switch code (in a subsequent CL).

BUG=chrome-os-partner:18343
BRANCH=none
TEST=open lid; system boots. close lid; system suspends.  open lid; resumes.

Change-Id: I83536a3ad24c4446dccf8a6b6e296756659070a8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47043
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-02 14:12:57 -07:00
ChromeOS Developer
6c285c0994 Move external power detect for link to its own file
Now that it doesn't need to leverage SWITCH_TASK to send the AC_CHANGE
notification, pure GPIO-based external power detection can move from
switch.c to its own file.

BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away

Change-Id: Id495f34185b7d971c241ac6d0a8311a6bf544507
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45789
2013-03-19 10:31:12 -07:00
Randall Spangler
a21ea56e76 Rename power_button module to switch
Since it handles not just power button, but also lid switch, AC
detect, and other switches.

No functional changes; just renaming.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system, power on/off with power button

Change-Id: I51628a52293f7207715f5f6bf368a08fe6c3dbce
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36821
2012-10-30 14:50:03 -07:00