summaryrefslogtreecommitdiff
path: root/chip/stm32/power_led.c
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove obsolete board-specific codeRandall Spangler2015-06-101-5/+0
| | | | | | | | | | | | | | | | | Now that we've removed boards from ToT, also delete board-specific code used only by the removed boards. There are still more things to remove (unused charging chips, LED drivers, COMx support). More CLs coming. BUG=chromium:493866 BRANCH=none TEST=make buildall -j Change-Id: Ie6bdeaf96e61cadd77e3f6336c73b9b54ff4eabb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276524 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Rename mixed-case config constantsRandall Spangler2013-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This renames constants used in compiler conditionals to uppercase. BOARD_foo CHIP_foo CHIP_FAMILY_foo CHIP_VARIANT_foo CORE_foo Mixed-case constants are still defined by the makefile, but are now no longer used. I will make one more pass in a week or so to catch any that are part of someone else's CL, since otherwise this change might silently merge correctly but result in incorrect compilation. Then I will remove defining the mixed-case constants. BUG=chromium:322144 BRANCH=none TEST=Build all boards. Also, "git grep 'BOARD_[a-z]'" should return no results (similarly for CHIP, CORE, etc.) Change-Id: I6418412e9f7ec604a35c2d426d12475dd83e7076 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/179206 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Rename pwm_data.h to pwm_chip.hBill Richardson2013-10-281-1/+1
| | | | | | | | | | | | | | To conform to our mutating naming conventions, let's rename the chip-specific PWM header file to have the string "_chip" in it. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; pass unit tests Change-Id: I6584be8e54fd24c8638559817e150c707bc0edb5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/174884 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Refactor PWM moduleVic Yang2013-08-271-82/+9
| | | | | | | | | | | | | | | | | | | | This unifies the PWM module interface for LM4 and STM32. Now PWM channels are defined in board.h/board.c. Instead of calling functions named pwm_set_fan_duty(x), one can now use pwm_set_duty(PWM_CH_FAN, x), which prevents additional functions added when we have a new PWM channel. BUG=chrome-os-partner:18343 TEST=Limit input current on Spring. TEST=Check power LED in S0/S3/S5 on Snow. TEST=Check keyboard backlight functionality on Link. TEST=Check fan speed control/detecting on Link. BRANCH=None Change-Id: Ibac4d79f72e65c94776d503558a7592f7db859dc Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/64450 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clean up configuring GPIO alternate functionsRandall Spangler2013-08-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GPIO alternate functions used to be configured throughout the code, which made it hard to tell which ones you needed to configure yourself in board.c. It also sometimes (chip/lm4/i2c.c) led to GPIOs being configured as alternate functions even if they weren't used on a given board. With this change, every board has a table in board.c which lists ALL GPIOs which have alternate functions. This is now the only place where alternate functions are configured. Each module then calls gpio_init_module() to set up its GPIOs. This also fixes a bug where gpio_set_flags() ignored most of the flags passed to it (only direction and level were actually used). On stm32f, gpio_set_alternate() does not exist, and pins are configured via direct register writes from board.c. Rather than attempt to change that in the same CL, I've stubbed out gpio_set_alternate() for stm32f, and will fix the register writes in a follow-up CL. BUG=chrome-os-partner:21618 BRANCH=peppy (fixes I2C1 being initialized even though those pins are used for other things) TEST=boot link, falco, pit, spring Change-Id: I40f47025d8f767e0723c6b40c80413af9ba8deba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64400
* snow: Snow is the exception for power LED settingsRandall Spangler2013-07-081-14/+14
| | | | | | | | | | | | | | | Instead of #if defined(BOARD_foo) for all new boards, flip around the No functional changes, just rearranging code. BUG=chrome-os-partner:20529 BRANCH=none TEST=keyboard LED still blinks in suspend on pit Change-Id: I185d642a5f412c8b4b0d16e62373c6b2bba71b0f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61108 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* ec: Add Puppy support to generic/common filesYen Lin2013-07-031-3/+3
| | | | | | | | | | | | | | | | add #ifdefs needed to support Puppy board in generic/common files BUG=none TEST=tested on Venice board Change-Id: I46592010cb5dfcc40db312c746f1e0d2886b3758 Signed-off-by: Yen Lin <yelin@nvidia.com> Reviewed-on: https://gerrit.chromium.org/gerrit/60688 Reviewed-by: Andrew Chew <achew@nvidia.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Jimmy Zhang <jimmzhang@nvidia.com> Commit-Queue: Jimmy Zhang <jimmzhang@nvidia.com>
* pit: Clean up timer init codeRandall Spangler2013-06-261-19/+20
| | | | | | | | | | | | Power LED PWM now uses the same functions as the hardware timer. BUG=chrome-os-partner:20414 BRANCH=none TEST=Suspend system. Power button LED pulses smoothly still. Change-Id: Ib5ca6655d815462baaf68600ad14c4c0c680a6af Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59838
* pit: Support changing EC clock frequencyRandall Spangler2013-06-251-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modules which care about system clock frequency now hook HOOK_FREQ_CHANGE. - hwtimer - i2c - uart (which is now also smart enough to use x8 oversampling instead of x16 when the system clock is too slow to support x16) Added 'clock' debug command to set system clock frequency. STM32F platforms don't change clock frequency; on those platforms, clock_get_freq() simply returns CPU_CLOCK, so behavior of those platforms is unchanged. BUG=chrome-os-partner:20414 BRANCH=none TEST=from EC console: - reboot ap-off -> to make sure AP is off during testing - clock msi2 -> reports 2MHz clock - battery -> reports battery info - clock msi1 -> reports 1MHz clock - battery -> reports battery info - clock hsi -> reports 16MHz clock - battery -> reports battery info - power on -> AP powers on and host commands succeed Change-Id: Ib8276bf124727e4fb502297ca8b3d6d4b6170241 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59645
* Fix typo in power_led.cRandall Spangler2013-04-241-1/+1
| | | | | | | | | | | | | Should be BOARD_pit, not BOARD_PIT (Thanks, Doug!) BUG=none BRANCH=pit TEST=build pit Change-Id: I1d7ef9e2347f031aec8f94c7a2da87145aa83c4d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49111 Reviewed-by: Doug Anderson <dianders@chromium.org>
* Support power button LED on pitstabilize-4035.0.BRandall Spangler2013-04-191-11/+32
| | | | | | | | | | | | | | | Pit uses GPIO PA2=TIM2_CH3 instead of Snow's PB3=TIM2_CH2. Other than that, the timer setup is identical (STM32F and STM32L are compatible in this respect, anyway). BUG=chrome-os-partner:18657 BRANCH=none TEST=build snow, pit; no pit boards to test on yet Change-Id: I8ba68f99641038e12c9a9c9dd29e3b64410a5eef Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48403 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Remove _OFF from GPIO register macrosRandall Spangler2013-04-161-2/+2
| | | | | | | | | | | | | | | | | | | This is left over from when we had a pair of macros for each GPIO register, one which concatenated its base address name and one which took a base address. Only the latter has survived, but its naming is longer than it needs to be and isn't consistent with other register banks (USART, TIM, etc.). No code changes, just renaming macros. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I15a282fd01db2a25219970e28ce551d8dc80193f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48226 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move power LED GPIO code from snow board.c into power_led.cRandall Spangler2013-04-081-26/+26
| | | | | | | | | | | | | | | And remove the daisy power button LED task for now. Since daisy didn't have a board.c implementation (or a power button LED), its power LED task did nothing. BUG=chrome-os-partner:18343 BRANCH=none TEST=build daisy, snow, spring Change-Id: I1eb3d0bd038d88685e7caad087eb1a1d1495ef9a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47442 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Use SECOND and MSEC constantsRandall Spangler2012-10-291-2/+2
| | | | | | | | | | | | | | | | | | We'd defined them in a number of different files. This moves definitions to timer.h, and uses them everywhere we have large delays (since 10*SECOND is less typo-prone than 10000000). Also add msleep() and sleep() inline functions. No need for mdelay() or delay(), since any delays that long should use sleep funcs instead of spin-waiting. BUG=chrome-os-partner:15579 BRANCH=none TEST=boot system; taskinfo displays similar numbers to before Change-Id: I2a92a9f10f46b6b7b6571759b1f8ab4ecfbf8259 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36726
* Clean up LED and onewire modulesRandall Spangler2012-10-251-9/+15
| | | | | | | | | | | | | No functional changes. BUG=chrome-os-partner:15579 BRANCH=none TEST=powerled red, then powerled green Change-Id: I595b725c14d94133f7f151d0b92cabe0e0bcf4ca Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36577 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* snow/stm32: re-configure power LED on the fly (input vs. pwm)David Hendricks2012-08-171-7/+44
| | | | | | | | | | | | | | | | | | | | | | | Usually the power LED is driven by the PWM mode so that its nominal brightness can be set to a "soft" on value. However, when the LED is to remain off the LED should be switched to floating input mode. This reduces voltage leakage. This CL updates the power_led_task to configure the LED however is appropriate and adds board functions to re-configure the GPIO. Signed-off-by: David Hendricks <dhendrix@chromium.org> BRANCH=snow BUG=chrome-os-partner:12381 TEST=LED responds as expected in suspend and on/off states, also tested that leakage is reduced with multimeter Change-Id: If90ac78aaffe7358cce80dd02ec1423c2cb4f664 Reviewed-on: https://gerrit.chromium.org/gerrit/29705 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Ready: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
* Daisy/Snow: Drive power LED with PWMDavid Hendricks2012-07-021-0/+161
This drives the power LED for Snow (PB3) using TIM2 in PWM mode. Since timer setup and manipulation is STM32-specific, the power LED logic moved to to chip/stm32/power_led.c. This also adds a "powerled" console command for testing. Signed-off-by: David Hendricks <dhendrix@chromium.org> BUG=chrome-os-partner:10647 TEST=Tested on Snow with powerled command, compiled for Daisy Change-Id: I5a7dc20d201ea058767e3e76d54e7c8567a3b83c Reviewed-on: https://gerrit.chromium.org/gerrit/26267 Commit-Ready: David Hendricks <dhendrix@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>