summaryrefslogtreecommitdiff
path: root/board
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: rename I2C_PORT_HOST to I2C_PORT_MASTERRandall Spangler2013-10-2514-76/+32
| | | | | | | | | | | | | | | | | Previously, it was really confusing whether I2C_PORT_HOST meant the port where the EC was the master, or the port used to talk to the AP. No functional changes, just a global find/replace and some tidying of unused comments. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; pass unit tests Change-Id: Ia591ba4577d3399729556e0234ba0db3a0e3c5ea Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/174546 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus: Leave WiFi power on in S3Paul Stewart2013-10-241-2/+6
| | | | | | | | | | | | | | | | | | This improves WiFi stability after resume since powering down may erase or otherwise stymy the firmware. Signed-off-by: Paul Stewart <pstew@chromium.org> BUG=chrome-os-partner:22175 BRANCH=none TEST=Suspend and resume samus, make sure WiFi is still operable Change-Id: I91914482c2040abe0feecd94891fca01a176f667 Reviewed-on: https://chromium-review.googlesource.com/174258 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: Paul Stewart <pstew@chromium.org> Commit-Queue: Paul Stewart <pstew@chromium.org>
* cleanup: Rename and move header filesRandall Spangler2013-10-2311-35/+26
| | | | | | | | | | | | | | Device-specific headers belong in driver/ or chip/. The include/ directory should be for common interfaces. Code should not normally need to include driver-specific headers. If it does, it should use the full relative path from the EC project root (for example, drivers/charger/bq24715.h). Change-Id: Id23db37a431e2d802a74ec601db6f69b613352ba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173746 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* bolt: Leave WiFi power on in S3Paul Stewart2013-10-231-2/+6
| | | | | | | | | | | | | | | | | This improves WiFi stability after resume since powering down may erase or otherwise stymy the firmware. Signed-off-by: Paul Stewart <pstew@chromium.org> BUG=chrome-os-partner:22175 BRANCH=none TEST=Suspend and resume bolt, make sure WiFi is still operable Change-Id: Ia9e39464955b373e6f03a36ca5af5c475e957208 Reviewed-on: https://chromium-review.googlesource.com/174257 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Paul Stewart <pstew@chromium.org> Commit-Queue: Paul Stewart <pstew@chromium.org>
* daisy: Clean up pmu initializationRandall Spangler2013-10-231-22/+1
| | | | | | | | | | | | | | CG_CTRL0 is already set to 2 by pmu_init_registers(), and the battery charge rate hack was temporary. BUG=chrome-os-partner:23425 BRANCH=none TEST=build daisy Change-Id: I863c8d6d5d5f30375dce14b7d2a30e9e710ef969 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173915 Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
* cleanup: More detail in todo comments for mccroskeyRandall Spangler2013-10-222-20/+23
| | | | | | | | | | | | | | This dev board hasn't seen much love. Add bug links for the unloved bits and remove an empty interrupt handler. BUG=chrome-os-partner:23494 BRANCH=none TEST=build mccroskey Change-Id: Ic521c6cba4ca438bf54f9ce77eb0cba99be57602 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/174082 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cleanup: update comments with existing bug numbersRandall Spangler2013-10-221-5/+2
| | | | | | | | | | | | | | | Some of the comments no longer apply. Others needed more info. No code changes; just comment changes. BUG=none BRANCH=none TEST=build all platforms Change-Id: I1d52aa9a98427a78c9d9a8cf44934fb04c3c00c8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/174084 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* rambi: Remove internal pullup from write protect pinRandall Spangler2013-10-221-1/+1
| | | | | | | | | | | | | | | The pin has a 100k series resistor, which is overwhelmed by the internal pullup. BUG=chrome-os-partner:23489 BRANCH=none TEST=gpioget wp_l, with screw present and removed. With screw present, signal should read 0; with it removed it should read 1. Change-Id: I35ee867111d0d7e8626dd3ac8010e9a10f46ccf7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/174094 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* samus: Use analog BAT_TEMP as presence indicatorBill Richardson2013-10-222-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | There is an analog temperature line on the Samus battery connector. We don't yet know what it means, but there's a pull-up on it, so if it's reading close to ADC_READ_MAX, we can probably assume there's no battery. This change says that any reading within 90% of ADC_READ_MAX means the battery pack is not present, so we can go ahead and boot without trying to wake it up first. BUG=chrome-os-partner:23449 BRANCH=none TEST=manual Connect the battery, boot. It should happen quickly. Disconnect the battery, boot. It should STILL happen quickly. Running "adc" on the EC console should show an entry for "BatteryTemp". If no battery is connected, it should read somewhere close to 4095. Change-Id: I1e41bccb2a988d34de09192ebb0a68b91b1b0b24 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/174046 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bolt: Implement prochotstabilize-4856.BRandall Spangler2013-10-221-1/+2
| | | | | | | | | | | | | | | | This code is pretty much the same across all x86 chipsets. In the long run, maybe it should be moved to x86_common.c, but for now, simply implement on bolt what we did on samus and all the other haswell systems. BUG=chrome-os-partner:20372 BRANCH=none TEST=build bolt; don't have a bolt to test on Change-Id: I01c2795192fcbd3980ed464c1e3e1dfb64fdb228 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173798 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* cleanup: Remove battery temperature fixmes for falco and slippyRandall Spangler2013-10-222-2/+1
| | | | | | | | | | | | | | | | | | Falco has shipped, so those numbers are evidently good enough. Slippy is not being developed and won't be fixed. Simply note that numbers are estimates. Comment changes only; no code changes. BUG=chrome-os-partner:18343 BRANCH=none TEST=build falco and slippy. Change-Id: I064896235626af8a5b7214b410908bba91434f7f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173911 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lm4: Use low speed clock in deep sleep.Alec Berg2013-10-216-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | Changed the low power idle task to use the low speed clock in deep sleep. The low power idle task is currently only enabled for Peppy, Slippy, and Falco. This change decreases power consumption when the AP is not running. Note that the low speed clock is slow enough that the JTAG cannot be used and the EC console UART cannot be used. To work around that, this commit detects when the JTAG is in use and when the EC console is in use, and will not use the low speed clock if either is in use. The JTAG in use never clears after being set and the console in use clears after a fixed timeout period. BUG=None BRANCH=None TEST=Passes all unit tests. Tested that the EC console works when in deep sleep. Tested that it is possible to run flash_ec when in deep sleep and using the low speed clock. Change-Id: Ia65997eb8e607a5df9b2c7d68e4826bfb1e0194c Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173326 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* rambi: Support USB port power controlRandall Spangler2013-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rambi shares several of the control signals (CTL1, ILIM_SEL) between both ports, and hard-wires some of the others (CTL2, CTL3). It still has separate enable lines for each port. BUG=chrome-os-partner:18343 BRANCH=none TEST=boot system; gpioget shows (in part) 1 USB_CTL1 0 USB_ILIM_SEL 1 USB1_ENABLE 1 USB2_ENABLE Then do 'apshutdown' and gpioget shows 1 USB_CTL1 0 USB_ILIM_SEL 0 USB1_ENABLE 0 USB2_ENABLE Change-Id: Ib3d321ca2b0aa7dce08ddd6633810a75641bc9a8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173737 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org>
* cleanup: Consolidate power interruptsRandall Spangler2013-10-2116-47/+39
| | | | | | | | | | | | | | | | Every chipset had its own header file just to declare a GPIO interrupt handler. Since this seems to be a common feature of the power interface, make a standard power_interrupt() API provided by chipset.h. This lets us get rid of 4 include files, and makes it easier to add more chipsets in the future. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I1fc5612d42625ea46e0a8e16a83085b66d476664 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173745
* Clean up documentation of RCIN# open-drain workaroundRandall Spangler2013-10-214-14/+20
| | | | | | | | | | | | | | | | | | | On many of the Haswell boards, RCIN# was attached to PL6, which is not an open-drain capable GPIO. As a workaround, we toggle it to an input to get it into a high-Z state. Now that we understand the problem, document it and remove the FIXME tag from the comments. Baytrail systems map RCIN# to a different pin, so don't need this workaround at all. BUG=chrome-os-partner:20173 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I545a90a523e2967fad40bd47cb47a51983a37bdb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173796 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* samus: Make RCIN_L be open drainDuncan Laurie2013-10-211-1/+1
| | | | | | | | | | | | | | This pin should not be driven, it is the source of massive leakage from PP3300_EC rail into PP3300_PCH. BUG=chrome-os-partner:23449 BRANCH=samus TEST=emerge-samus chromeos-ec, verifed with scope Change-Id: I8b4ba7e2e842505244b2c7c55cd661ae9363dbad Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173839 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: Add the pause_in_s5 support and fix CPU throttleDuncan Laurie2013-10-211-2/+36
| | | | | | | | | | | | | | | | These are changes ported from other haswell systems that are useful in development. Pause in S5 can be used for power cycle testing and the CPU throttle is important for runin since there is no other active throttle methods. BUG=chrome-os-partner:23449 BRANCH=samus TEST=emerge-samus chromeos-ec Change-Id: I8774a466141f2cdc671a5e14705ae29433f94981 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173838 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: Add hook/hack to enable backlight PWMDuncan Laurie2013-10-213-2/+112
| | | | | | | | | | | | | | | | | | | | | | The backlight controller EEPROM is not enabling PWM mode and it is reloaded every time the backlight state is changed. Since we no longer have signals indicating when the PCH is enabling or disabling backlight this hack will read the controller every second at runtime to determine if it needs to enable PWM mode. This should be removed with the next build when the EEPROM is changed to enable PWM mode by default. BUG=chrome-os-partner:23449 BRANCH=samus TEST=emerge-samus chromeos-ec Change-Id: I5c4acb1115acb7a4a5b04d09c1317778eeb2998d Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173836 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: Add TMP006 sensorsDuncan Laurie2013-10-212-7/+73
| | | | | | | | | | | | | Add the 6 on-board TMP006 sensors and I2C addresses. BUG=chrome-os-partner:23449 BRANCH=samus TEST=emerge-samus chromeos-ec Change-Id: Id7fe37a9dda12c63dfbe5b8e2865902976f4b476 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173835 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: changes from bringup to bootDuncan Laurie2013-10-213-13/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | These were the changes from bringup to get the first boards booting successfully. Mostly minor stuff, some may not be entirely correct still. - disable internal clkrun so it behaves the same as other boards, this can be experiemented with later but is too much extra change during bringup - enable 1.8V internal pullup since it is missing external - wait for 1.5V and 1.2V PGOOD to ensure 5V rail is up - turn on 3.3V DSW rail in S5, it can be disabled later at runtime in theory but it is required for booting - turn on USB in S3 - specific wireless bringup sequencing, WLAN power should be first but the generic wireless function does it in the other order. BUG=chrome-os-partner:23449 BRANCH=samus TEST=emerge-samus chromeos-ec Change-Id: I698438f21651ce001e74790855bb7f7260d8bdaf Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173834 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* nyan: switch chip variant to STM32L100RBT6Vincent Palatin2013-10-191-2/+2
| | | | | | | | | | | | | | | | | | | | | The new boards will be populated with STM32L100RBT6, so let's update the CHIP_VARIANT accordingly. This is backward-compatible with the STM32L151RBT6 which is soldered on older boards (it just doesn't use the full memory). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=boot the system on Nyan reworked with STM32L100RBT6 Change-Id: I73a4c587c7dc3646777166606e06f3dfaed2400c Reviewed-on: https://chromium-review.googlesource.com/173633 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: David James <davidjames@chromium.org>
* ec: add nyan boardYen Lin2013-10-175-0/+402
| | | | | | | | | | | | | | | | | | | This is to add nyan board support: - new files in board/nyan folder, including battery.c - new common/chipset_tegra.c, which is mostly based on chipset_gaia.c - new include/tegra_power.h - modified build.mk and flash_ec for nyan BUG=none BRANCH=nyan TEST=tested on Venice 2 board Change-Id: I36895f34f2f4d144a9440aff358c8274797ebbd6 Signed-off-by: Yen Lin <yelin@nvidia.com> Reviewed-on: https://chromium-review.googlesource.com/168078 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Correct the EC name in the build.mk comments for some boardsDavid Hendricks2013-10-174-4/+4
| | | | | | | | | | | | | | | | | | One of our partners was getting confused by the incorrect comments. Daisy, Snow and Pit use STM32xxxx parts with 128KB flash, but the comments indicated that they use 64KB parts. BUG=none BRANCH=none TEST=locally compiled Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I13035ca9fb0e4cb05f46df250f6b9079a799dd64 Reviewed-on: https://chromium-review.googlesource.com/172663 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: David Hendricks <dhendrix@chromium.org>
* cleanup: Config definesRandall Spangler2013-10-167-5/+7
| | | | | | | | | | | | | | | | Add some missing descriptions in config.h and rename a few defines to be more consistent. No functional changes, just comments and symbol renaming. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; pass unit tests Change-Id: I05a9a2ed6fd7bc8b14a18a0dc57d7d22430de21a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/173111 Reviewed-by: Vic Yang <victoryang@chromium.org>
* rambi: pullup SUS_STAT#Aaron Durbin2013-10-151-1/+2
| | | | | | | | | | | | | | | | The SUS_STAT# from the SoC doesn't have a pullup resistor stuffed on the other side of the FET separating the 1.8V and 3.3V signals. Therefore use the internal pull. BUG=None BRANCH=None TEST=Built and loaded on a rambi. SUS_STAT# doesn't appear to float any more. Change-Id: I7478697b68b4539c17876722a7a913901bf1c0bc Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172851 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lm4: Add a low power idle task.stabilize-4825.BAlec Berg2013-10-156-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First implementation of a low power idle task for the LM4 chip. The low power mode is selected by defining CONFIG_LOW_POWER_IDLE in a board.h file. This commit turns it on for Peppy, Slippy, and Falco only because those are the only boards tested. When using the low power idle task, the chip goes in to deep sleep when it can. Deep sleep disables clocks to most peripherals and puts the onboard flash and RAM into a low power mode. The chip is woken out of deep sleep using the RTC in the hibernate module. Increased the idle task stack size to handle more involved idle task. In board.c, the array of GPIO info can be used to select which GPIO points can wake up the EC from deep sleep. Currenlty selected are the power button, lid open, AC present, PCH_SLP_S3, and PCH_SLP_S5. Additionally the port with the KB scan row GPIO point is also enabled to wake up the EC from deep sleep. Signed-off-by: Alec Berg <alecaberg@chromium.org> BUG=None BRANCH=none TEST=Passes all unit tests. Runs on slippy, peppy, and falco with no noticeable side affects. Verified that the power consumed by the EC is lower when in S3, S5 and G3 by scoping the sense resistor powering the chip. Change-Id: I83fa9a159a4b79201b99f2c32678dc4fc8921726 Reviewed-on: https://chromium-review.googlesource.com/172183 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org> Tested-by: Alec Berg <alecaberg@chromium.org>
* falco: fixed backlight bugAlec Berg2013-10-141-0/+1
| | | | | | | | | | | | | | Fixed backlight bug on Falco. BUG=chrome-os-partner:23270 BRANCH=none TEST=Tested to make sure the backlight comes on for Falco. Change-Id: Ia74801fdae8ce2d96d03223a95cb0704ddc1f4b0 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172940 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add baytrail power sequencingRandall Spangler2013-10-113-6/+6
| | | | | | | | | | | | | | | | | This is an initial version of power sequencing for the rambi rev.1 boards. It has a workaround for a rev.1 board problem; this requires turning on PP5000 early. BUG=chrome-os-partner:22895 BRANCH=none TEST=AP should power on to S0 (PLTRST# deasserts) automatically when EC boots Then 'apshutdown' should drag it back to G3. Then 'powerbtn' should take it back to S0. Change-Id: Id9bc6fe9b55fce3eb46ce1265891724ec7a4ae20 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172675 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* rambi: Keyboard output column 2 must be invertedRandall Spangler2013-10-111-0/+1
| | | | | | | | | | | | | The Silego chip used on Rambi inverts column 2. So the EC should pull the signal low when NOT scanning column 2, and release it at all other times. BUG=chrome-os-partner:23198 BRANCH=none TEST=not yet; need to probe on scope Change-Id: If6a784493533f11ae54d18f27591697e69aa2282 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172674 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* rambi: fix leakage on pp3300_pch_s5 railAaron Durbin2013-10-101-1/+1
| | | | | | | | | | | | | | | | | PWRBTN_L is pulled up to PP3300_PCH_S5 through a 30K resistor. However, the PWRBTN_L pin was configured push-pull. So we are leaking into that rail. Fix this by configuring it to be open drain. BUG=chrome-os-partner:23221 BRANCH=None TEST=Loaded new EC with change and noted the PP3300_PCH_S5_PG is driven low correctly once the PP5000_DSW rail is up an SUSP_VR_EN=0. Change-Id: Id6d5079ca0c11c36b00ed913be378f53b48f27f3 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172520 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: Don't use [N] = {} when initializing arraysBill Richardson2013-10-1012-34/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we do this: enum foo_v { FOO_A, FOO_B, FOO_COUNT }; struct foo_t foo[] = { {...}, {...}, }; BUILD_ASSERT(ARRAY_SIZE(foo) == FOO_COUNT); Then we can be sure we're at least initialized all the elements of foo, although there's no particular guarantee that the order is correct. However, if we use this: struct foo_t foo[] = { [FOO_A] = {...}, [FOO_B] = {...}, }; and we accidentally get one wrong: struct foo_t foo[] = { [FOO_B] = {...}, [FOO_B] = {...}, }; Then the assertion still passes, but we've only initialized one element. Don't do that. BUG=chrome-os-partner:18343 BRANCH=none TEST=manual Refactoring only. Build everything. It should still work. Change-Id: I58f659207990f18c6fb74b1cac2ec1163cdb07ea Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172115 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rambi: Control LEDs using PWMRandall Spangler2013-10-085-5/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | Rambi has a pair of LEDs which are attached to the PWM fan controller. Add support for them. Also add a generic 'pwmduty' command which can be used to get/set the duty cycle for any PWM channel. Also fix rounding errors in pwm module, so that set/get duty doesn't keep rounding down. BUG=chrome-os-partner:22895 BRANCH=none TEST=Boot rambi. LEDs are off. pwmduty -> both are 0% pwmduty 0 10 -> green LED on dimly pwmduty 1 10 -> red LED on dimly pwmduty 0 99 -> green LED on brightly pwmduty 1 100 -> red LED on brightly pwmduty 1 0 -> red LED off pwmduty 1 -1 -> red LED turns back on because fan controller is disabled pwmduty -> channel 0 at 99%, channel 1 disabled Build all platforms. Pass all unit tests. Change-Id: Ib0a6289a757554e696a9a0153a85bdc34e2ee2ae Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/172094
* cleanup: Battery header files and filenamesRandall Spangler2013-10-0714-32/+29
| | | | | | | | | | | | | | | | | | | | battery.h is the high-level interface. battery_smart.h is the low-level interface. Most things don't need the low-level interface, but were including smart_battery.h solely to get at battery.h. Fixed this. Also merged battery_pack.h into battery.h, since it was odd to split that data across multiple header files. Tidied the function comments in battery.h as well. No functional changes, just renaming files and adding comments. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I5ef372f0a5f8f5f36e09a3a1ce24008685c1fd0d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171967 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cleanup: Move board-specific LED state machines to board dirsRandall Spangler2013-10-0711-5/+736
| | | | | | | | | | | | | | | | | | | | | | The LED state machine ends up being very board-specific, as does the specific configuration of LEDs and whether they're PWM'd or just GPIOs. dparker has some clever ideas for how to move more of the functionality to common/led_common.c (used at present only by peppy); that will be done as a follow-on to this CL. There's a unit test for the spring LED implementation. To keep that compiling, just use a symlink to the spring-specific implementation. No code changes; just moving around files. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I5973e701a29a72575db9a161dc146855ab21cca6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171771 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cleanup: Replace awkward I2C_PORTS_USED macro with constantBill Richardson2013-10-0728-36/+14
| | | | | | | | | | | | | | | | | | | | We only used I2C_PORTS_USED to iterate through the list of hardware ports actually in use, but we defined it in board.h at the same place where we matched particular I2C devices to the (possibly shared) buses they're on. This CL makes I2C_PORTS_USED into a global constant, so it can be set automatically where we initialize the ports, and doesn't have to be related to the list of attached devices. BUG=chrome-os-partner:18343 BRANCH=none TEST=manual Build everything, run all tests, should still work. Change-Id: I65f22f5cadfc4b3afe51af48faa5fb369bc3aa09 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171884
* bolt: Make fan min/max be the same as linkDuncan Laurie2013-10-051-2/+2
| | | | | | | | | | | | | | | The fan was not spinning enough to cool the system because it thought the max fan speed was 5000. BUG=none BRANCH=bolt TEST=build and boot on bolt, generate load and see that the fan comes on to a reasonable level to cool the system. Change-Id: Ifa5023534a6be8625abf7df7fa44aed649f4fabc Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171969 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* samus: Add battery_is_connected checkBill Richardson2013-10-042-0/+11
| | | | | | | | | | | | | | | | | | | | | | | Copied from Bolt. This is so the 30-second wait when no battery is installed can be skipped. Note that if we ever decide to monitor the battery temp through the BAT_TEMP line, we'll have to rethink how battery_is_connected() is implemented, since we can't reliably treat that GPIO as both digital and analog simultaneously. BUG=chrome-os-partner:22870 BRANCH=none TEST=manual cd src/platform/ec make BOARD=samus make runtests Change-Id: Ifea952c8f99b2b40c2fab382e949958a2f71d157 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171796 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* samus: alternate functions, chargerBill Richardson2013-10-042-13/+18
| | | | | | | | | | | | | | | | Adding some more board-specific configurations for Samus. BUG=chrome-os-partner:22870 BRANCH=none TEST=manual make runtests Change-Id: I86c909e899fb5bdb6ba75f476ced58bae2c75c29 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171809 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bolt: Add battery_is_connected checkDuncan Laurie2013-10-042-0/+11
| | | | | | | | | | | | | | | | | | | | This is so the 30 second wait when no battery is installed can be skipped. Since Bolt needs a complete AC+Battery disconnect when updating the BIOS this 30 second wait is aggravating. BUG=chrome-os-partner:20448 BRANCH=bolt TEST=disconnect AC+Battery, then connect AC and watch it boot without waiting for 30 seconds. Change-Id: Ibaf42fe1dba9c74aa465aa0a1a5381ba6981f66e Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171689 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cleanup use of config.h macrosBill Richardson2013-10-045-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | include/config.h should have the canonical list of all CONFIG_* macros used everywhere else. This fixes some that weren't included, and some that had been changed in one place but not in others. BUG=chrome-os-partner:18343 BRANCH=none TEST=manual Build everything. It should still work. cd src/plaform/ec make runtests for i in bds bolt daisy discovery falco kirby link mccroskey peppy pit puppy rambi samus slippy snow spring; do make BOARD=$i || touch died.$i; done There shouldn't be any died.* files. Change-Id: I0a1ec2d57668509c514dc5a521e547836a3e9894 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171690 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: First pass at GPIOsBill Richardson2013-10-023-135/+79
| | | | | | | | | | | | | | | | | | | This is the first attempt at wiring the GPIOs for Samus. More to come, of course. BUG=chrome-os-partner:22870 BRANCH=none TEST=manual The only thing we can check is that it compiles and doesn't break anything. cd src/platform/ec make BOARD=samus make runtests Change-Id: Ia9dc94c420c21551c5db3e28e749954cea3055a1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171528
* Fix typo: s/GPOI_/GPIO_/gBill Richardson2013-10-023-3/+3
| | | | | | | | | | | | | | | | Slippy, Peppy, and Falco should learn to spell. BUG=chrome-os-partner:18343 BRANCH=none TEST=manual make runtests Nothing uses this, it's just annoying to look at. Change-Id: I61e09fc6a804c1de972b34520db1db8f0b874dbe Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171567
* Internalize magic numbers for smart USB chargingBill Richardson2013-10-021-3/+0
| | | | | | | | | | | | | | | | | | | | | Link is the only platform that uses smart usb ports. Link's board.h defines USB_CHARGE_PORT_COUNT, yet the usb_port_power_smart.c file is peppered with assumptions that that constant is always 2. This moves the constant into usb_port_power_smart.c where it belongs. BUG=chrome-os-partner:18343 BRANCH=none TEST=manual make runtests Code refactoring only, no visible changes, Change-Id: Id45e11d88585a98348105b1399c7e18c554add50 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171565 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lpc: Clean up processing wake eventsRandall Spangler2013-10-027-114/+0
| | | | | | | | | | | | | | | | | | | | | | Every board other than link does the same thing - filter out the power button event, then set the WAKE_L gpio level based on the remaining events. This code doesn't need to be duplicated 7 times, so make it common. Link didn't filter out the power button wake signal, but works fine with the common implementation. Like the other boards it gets a power button wake event via the dedicated PCH PWRBTN# signal. BUG=chrome-os-partner:18343 BRANCH=none TEST=suspend link, then wake using power button press compile all platforms; pass unit tests Change-Id: Ib3a6d310d0f5e337374b3c331ab2872fe377bdf6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171405 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* bolt: Fix panel power passthruDuncan Laurie2013-10-023-2/+4
| | | | | | | | | | | | | | | | | The Bolt board does not use the standard CHIPSET_HASWELL and with a recent commit that meant haswell_interrupt() was defined to NULL and it would not turn on the panel power. BUG=chrome-os-partner:20372 BRANCH=bolt TEST=build and boot on bolt and see magic working panel Change-Id: I6174e2b4a8337acc2f395b8b2b18a00107661af1 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171112 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* Clean up G781 temperature sensor power detectionRandall Spangler2013-10-019-53/+5
| | | | | | | | | | | | | | | | | | This was previously done in a board-specific function across 4 boards. Except that the board-specific function was identical in all cases (that is, not really board-specific). Put it back in the common implementation to get rid of duplicated code, and use CONFIG_TEMP_SENSOR_POWER_GPIO to indicate which GPIO rail controls the sensor power. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all boards; pass unit tests Change-Id: I29de40001d5d4dc873e5ba8f3abb328c6271f235 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171140 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Emulator support of fake GPIO inputVic Yang2013-10-011-3/+7
| | | | | | | | | | | | | | | | | | For all GPIOs, the current values are recorded. A test can then change the value of a GPIO input by gpio_set_level(). The changed value is recorded and also interrupt is fired if the change fits the interrupt flags defined in board/host/board.c. BUG=chrome-os-partner:19235 TEST=Pass all tests BRANCH=None Change-Id: If8e547e5adf4a20dcb118f5fe2187293005d4ca3 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/170907 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Create samus board configBill Richardson2013-09-305-0/+902
| | | | | | | | | | | | | | | | | | | This just does a copy/rename from Bolt. Tweaking for Samus' peculiarities will come next. BUG=chrome-os-partner:22870 BRANCH=none TEST=manual The only thing we can check is that it compiles: cd src/platform/ec make BOARD=samus Change-Id: Ied95ebdd1137548b21334b4a65a298c68482c517 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/171081 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* basic support for STM32L-Discovery boardVincent Palatin2013-09-284-0/+129
| | | | | | | | | | | | | | | | | | Support for the basic development board built by STmicro with STM32L152 chip. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=none TEST=See that LEDs can be driven from the console, button can be read. With additional print statement, see that button hook is called. BRANCH=none Change-Id: I494ab525f17e08b57595ee49489ade63b3305f2a Reviewed-on: https://chromium-review.googlesource.com/170920 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Jeremy Thorpe <jeremyt@chromium.org> Tested-by: Jeremy Thorpe <jeremyt@chromium.org>
* Support backlight control via lid onlyRandall Spangler2013-09-275-5/+9
| | | | | | | | | | | | | | | | | | | | | The old backlight_x86 code did (backlight enable) = (lid is open) && (GPIO request from AP) Newer systems will AND those signals in hardware. Support those systems by separating CONFIG_BACKLIGHT_LID and CONFIG_BACKLIGHT_REQ_GPIO, and add tests for the case where the enable signal is dependent only on the lid position. BUG=chrome-os-partner:22960 BRANCH=none TEST=pass unit tests Change-Id: I1909426e49f00a8acd5047fd88c801cba1dacd76 Reviewed-on: https://chromium-review.googlesource.com/170925 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>