summaryrefslogtreecommitdiff
path: root/include/adc.h
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: Move ADC-shim code into zephyr/shimSimon Glass2021-04-071-18/+1
| | | | | | | | | | | | | | | | | | | Most of the shim code is in zephyr/ rather than in the ECOS code. Move the ADC one as well, to keep it consistent. BUG=b:175881324 BRANCH=none TEST=build Zephyr with lazor and some other CLs and see that the ADC enum is now available and there are not build errors Change-Id: Ib1b31c1b885e3ca5b184f4f708776357ac87cbbf Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801171 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2810052 Tested-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@chromium.org>
* zephyr: Add ADC mul and div factors supportDawid Niedzwiecki2021-03-221-0/+2
| | | | | | | | | | | | | | | | Some boards need to adjust ADC measurements with multiplication and division factors so add support for these also in Zephyr. BUG=b:175881324 BRANCH=none TEST=Add mul and div factors in the dts file and verify measurements with the "adc" console command Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I6b716e20af18623249a4a972b6f3db8eec09a376 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2775487 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* zephyr: add shim ADCDawid Niedzwiecki2021-02-091-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Add ADC shim to connect the platform/ec ADC API to the Zephyr ADC API. Generate needed global variables/types: enum adc_channel and adc_channels from dts. Once ADC_CMD config is enabled, it replaces the "adc" Zephyr console function. The shim assues only ADC_0 module. More specific channel options can be added to named-adc.yaml e.g. shift or gain. BUG=b:175881324 BRANCH=none TEST=build Zephyr TEST=Run "adc" command, it should return current levels in mv of configured channels Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic9c03223e611f916bebc1296cbee614401098994 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2673418 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Define an empty adc.h for nowSimon Glass2020-12-181-0/+7
| | | | | | | | | | | | | | While we wait for an ADC shim, define this enum so that the code at least compiles. BUG=b:175881324 BRANCH=none TEST=build zephyr for volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I688e313afd78a0953c3e03da6a8039ae3112afdd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2595219 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Hook: Define HOOK_PRIO_INIT_ADC as enum hook_priorityDaisuke Nojiri2019-03-261-2/+0
| | | | | | | | | | | | | | | | | | | | Currently HOOK_PRIO_INIT_ADC is defined as a macro in adc.h. This patch moves the definition to enum hook_priority for better visibility and consistency. There will be no functional change. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: I1be65d034993652740d78adc901521621d23b118 Reviewed-on: https://chromium-review.googlesource.com/1520949 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Fix ADC console commandNick Sanders2016-05-261-12/+0
| | | | | | | | | | | | | | | | | | | | | | 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>
* stm32: adc: Add support for DMA continuous modeShawn Nematbakhsh2015-12-211-1/+3
| | | | | | | | | | | | | | | | | | | 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>
* ADC: Add common priority for the ADC initVijay Hiremath2015-07-161-0/+2
| | | | | | | | | | | | | | 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>
* stm32: implement ADC support for STM32F0xxVincent Palatin2014-03-201-0/+11
| | | | | | | | | | | | | | | | | | | | | | 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>
* cleanup: comments in adc modulesRandall Spangler2013-10-251-1/+7
| | | | | | | | | | | | 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
* Fix ADC test for LM4Vic Yang2013-04-301-0/+2
| | | | | | | | | | | | | | | 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>
* stm32f: Add support for ADC watchdogVic Yang2013-03-131-0/+20
| | | | | | | | | | | | | | 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>
* Clean up ADC moduleRandall Spangler2012-10-301-15/+15
| | | | | | | | | | | | | | 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
* stm32f: ADC driverVic Yang2012-09-261-0/+3
| | | | | | | | | | | | | | | 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>
* Added HOOK_INIT for driver module initsRandall Spangler2012-04-191-6/+0
| | | | | | | | | | | | 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
* Clean up chip/board configs for LM4Randall Spangler2012-03-161-2/+1
| | | | | | | | | | | 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>
* Add forward declarations in ADC and temp_sensor headersDavid Hendricks2012-02-061-0/+3
| | | | | | | | | | | | 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
* Fix a bug that ADC input is not correctly configured.Vic Yang2012-02-021-0/+1
| | | | | | | | | | 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
* Refactor ADC code and add Link charger current ADC supportVic Yang2012-02-021-17/+14
| | | | | | | | | | | 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
* Initial sources import 1/3Randall Spangler2011-12-071-0/+35
source files mainly done by Randall. Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: Iaff83a842b17f3350fb6f2a3f1597ad4c29bd12a