Commit Graph

15 Commits

Author SHA1 Message Date
Nick Sanders
5cc3cac589 servo_v4: Fix ADC console command
The console adc command prints adc values in the
order they appear in hardware, however they are lableled
in the order they are enumerated in board.h, which is not
necessarily the same.

This prints the correct name and value pairs, and removes
the adc_read_all_channels function which is not otherwise
used.

BUG=chromium:571476
BRANCH=None
TEST="adc" command associates correct values with names now.

Change-Id: I688641953d20082224b4120eaefe0d634ad4c74c
Signed-off-by: Nick Sanders <nsanders@google.com>
Reviewed-on: https://chromium-review.googlesource.com/340892
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-26 16:17:26 -07:00
Shawn Nematbakhsh
8038e5f146 stm32: adc: Add support for DMA continuous mode
Add support for continuously writing ADC samples to a circular buffer.
CONFIG_ADC_PROFILE_FAST_CONTINUOUS should be defined and an
appropriate sized buffer must be passed to adc_read_all_channels().

BUG=chromium:569994
TEST=Manual on snoball. Verify 'adc' continues to function (single
mode). With pending commit, verify that continuous conversion interrupt
is called at appropriate frequency and values look consistent.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I025825d72a698f8f1f4f95a89477df791bd5e67e
Reviewed-on: https://chromium-review.googlesource.com/318505
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-21 14:58:56 -08:00
Vijay Hiremath
e7bebf7c80 ADC: Add common priority for the ADC init
Added common priority for the ADC init to ensure board level
priority is defined for the ADC pre init.

BUG=none
TEST=make buildall -j
BRANCH=none

Change-Id: Id1649df6a68ab53bd110e58a0722bd4c70cbffc5
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/286040
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-07-16 05:15:22 +00:00
Vincent Palatin
b9b5c89c30 stm32: implement ADC support for STM32F0xx
Replace the stubs by an actual implementation for ADC and Analog
watchdog support on STM32F0xx chips.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=none
TEST=manually read ADC values on STM32F072B discovery.
TEST=read all ADC values at once.
TEST=Enable watchdog and check it fires when the voltage goes out of
range.
TEST=read ADC value(s) while watchdog is enabled.
TEST=Disable watchdog and check it's actually disabled.

Change-Id: Ie6fbd1aa95a3d76394fa47803e8cfc24bf5e4562
Reviewed-on: https://chromium-review.googlesource.com/190710
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-03-20 23:51:28 +00:00
Randall Spangler
685c45ef46 cleanup: comments in adc modules
No code changes, other than renaming a couple of static functions.

BUG=none
BRANCH=none
TEST=build falco

Change-Id: I29b835d273aa1aba66d9d40536eae2eb12207f66
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174530
2013-10-25 20:12:54 +00:00
Vic Yang
c08e0ade76 Fix ADC test for LM4
LM4 doesn't have implementation of adc_read_all_channels(). Let's use
adc_read_channel() in this case.

BUG=chrome-os-partner:18598
TEST=Build stress test for link. See no error about
adc_read_all_channels() undefined.
BRANCH=None

Change-Id: I5b13384468667cbd17b83faab9f9d3fdc48de91d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49589
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-30 10:38:43 -07:00
Vic Yang
2823e7e132 stm32f: Add support for ADC watchdog
This makes it possible to have ADC module monitor an input voltage and
trigger interrupt when it goes out of accepted range.

BUG=chrome-os-partner:18171
TEST=Manual
BRANCH=spring

Change-Id: Ia0c981fadd9bcaa40afe30ca2624c2f3644b95fe
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45277
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-13 12:11:59 -07:00
Randall Spangler
fdd3d90bd7 Clean up ADC module
ADC config structs are now chip-specific; this saves code size
(several hundred bytes on LM4, since no need for 24-entry ADC channel
to GPIO mapping table).

BUG=chrome-os-partner:15579
BRANCH=none
TEST='adc' with system on and off; ChargerCurrent should be bigger when on.

Change-Id: Ia88b3f043438bec049f2d2ad39fc42dcf86d9424
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36798
2012-10-30 10:45:07 -07:00
Vic Yang
1b14b2c922 stm32f: ADC driver
This adds basic ADC support for multiple channel conversion.

BUG=chrome-os-partner:14316
BRANCH=none
TEST=1. Boot on snow.
     2. Use keyboard signal as input. Check read value changes as input
        signal changes.

Change-Id: I3c15c37446fa9273d098f6d581573c11ced45b5e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/33883
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-09-26 08:58:59 -07:00
Randall Spangler
f4e772708b Added HOOK_INIT for driver module inits
This covers modules which need to initialize before task_start(), but
don't particularly care in what order they're initialized.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=if it boots, it works

Change-Id: I69829aac8d1c3c14ee04916a794b84bbf03a09eb
2012-04-19 13:08:58 -07:00
Randall Spangler
e68844824b Clean up chip/board configs for LM4
Board-specific features like lightbar should be config'd at the board
level, not at the chip level.

BUG=none
TEST=build link, bds, daisy

Change-Id: If1df2ca0422f7b8bdc172d0df7bd9f6a1af6a9d2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-03-16 14:02:59 -07:00
David Hendricks
af9532d6fe Add forward declarations in ADC and temp_sensor headers
This is a trivial patch to fix compilation for boards that are not
based on LM4 (e.g. Discovery).

Signed-off-by: David Hendricks <dhendrix@chromium.org>

TEST=Compiled for Discovery
BUG=None

Change-Id: Ia1f29c61ff4a1f65fe65c43a8e58def7d1217ab2
2012-02-06 13:36:19 -08:00
Vic Yang
b7f2a18859 Fix a bug that ADC input is not correctly configured.
The ADC input pin was always configured as BDS. Modified it to configure
the correct pin.

BUG=none
TEST=On Link, "rw 0x4002451C" show 0xff instead of 0xf7.

Change-Id: I1efd5cd59ad65f55cd673529afa6153add63ecac
2012-02-02 17:10:40 +08:00
Vic Yang
1e5233a66d Refactor ADC code and add Link charger current ADC support
Refactor ADC code and move board/chip-specific part to corresponding
directories.
Implement function and console command to read Link charger current.

BUG=chrome-os-partner:7527
TEST=Read EC temperature and POT input on BDS.

Change-Id: I7fafd310ea49d9b2781f10c3453f5488da29a08a
2012-02-02 10:24:26 +08:00
Randall Spangler
bdf7da5b08 Initial sources import 1/3
source files mainly done by Randall.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

Change-Id: Iaff83a842b17f3350fb6f2a3f1597ad4c29bd12a
2011-12-07 19:10:02 +00:00