diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-08-25 16:20:28 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-27 01:27:33 +0000 |
commit | 199a41cadb9e748d65d946b5c9eaf17d5b168260 (patch) | |
tree | 900652fa4ca12fb9edd30164d25fefabfc35857b | |
parent | 4f9ecfc0861ec20e315934bce6e390b9ea4b3a3e (diff) | |
download | chrome-ec-199a41cadb9e748d65d946b5c9eaf17d5b168260.tar.gz |
adc: Include adc_chip.h from adc.h
This reorganizes adc.h and adc_chip.h so that general code only needs to
know about adc.h. adc_chip.h is now included by adc.h directly and does
not need to be included in general code.
BRANCH=none
BUG=b:181271666
TEST=buildall passes (with next patch in series)
Cq-Depend: chromium:3120316
Change-Id: I8bc107c6900e831a57f7a7fb8668eb08bb179d6c
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120315
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | chip/host/adc_chip.h | 16 | ||||
-rw-r--r-- | chip/it83xx/adc.c | 1 | ||||
-rw-r--r-- | chip/it83xx/adc_chip.h | 8 | ||||
-rw-r--r-- | chip/lm4/adc.c | 1 | ||||
-rw-r--r-- | chip/lm4/adc_chip.h | 8 | ||||
-rw-r--r-- | chip/lm4/chip_temp_sensor.c | 1 | ||||
-rw-r--r-- | chip/mchp/adc.c | 1 | ||||
-rw-r--r-- | chip/mchp/adc_chip.h | 6 | ||||
-rw-r--r-- | chip/mec1322/adc.c | 1 | ||||
-rw-r--r-- | chip/mec1322/adc_chip.h | 6 | ||||
-rw-r--r-- | chip/npcx/adc.c | 1 | ||||
-rw-r--r-- | chip/npcx/adc_chip.h | 8 | ||||
-rw-r--r-- | chip/stm32/adc-stm32f0.c | 1 | ||||
-rw-r--r-- | chip/stm32/adc-stm32f3.c | 1 | ||||
-rw-r--r-- | chip/stm32/adc-stm32l.c | 1 | ||||
-rw-r--r-- | chip/stm32/adc-stm32l4.c | 1 | ||||
-rw-r--r-- | chip/stm32/adc_chip.h | 9 | ||||
-rw-r--r-- | common/adc.c | 1 | ||||
-rw-r--r-- | include/adc.h | 7 | ||||
-rw-r--r-- | test/vpd_api.h | 1 |
20 files changed, 28 insertions, 52 deletions
diff --git a/chip/host/adc_chip.h b/chip/host/adc_chip.h new file mode 100644 index 0000000000..8754be266e --- /dev/null +++ b/chip/host/adc_chip.h @@ -0,0 +1,16 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Host-specific ADC module for Chrome EC */ + +#ifndef __CROS_EC_ADC_CHIP_H +#define __CROS_EC_ADC_CHIP_H + +/* Place-holder data structure to define ADC channels. */ +struct adc_t { + int unused; +}; + +#endif /* __CROS_EC_ADC_CHIP_H */ diff --git a/chip/it83xx/adc.c b/chip/it83xx/adc.c index e4999fdae5..2839da5af2 100644 --- a/chip/it83xx/adc.c +++ b/chip/it83xx/adc.c @@ -6,7 +6,6 @@ /* IT83xx ADC module for Chrome EC */ #include "adc.h" -#include "adc_chip.h" #include "clock.h" #include "console.h" #include "common.h" diff --git a/chip/it83xx/adc_chip.h b/chip/it83xx/adc_chip.h index 23cc68fb34..15a8e68e94 100644 --- a/chip/it83xx/adc_chip.h +++ b/chip/it83xx/adc_chip.h @@ -8,6 +8,8 @@ #ifndef __CROS_EC_ADC_CHIP_H #define __CROS_EC_ADC_CHIP_H +#include <stdint.h> + #include "common.h" /* @@ -121,12 +123,6 @@ struct vcmp_t { enum chip_adc_channel adc_ch; }; -/* - * Boards must provide this list of ADC channel definitions. This must match - * the enum adc_channel list provided by the board. - */ -extern const struct adc_t adc_channels[]; - #ifdef CONFIG_ADC_VOLTAGE_COMPARATOR /* * Boards must provide this list of voltage comparator definitions. diff --git a/chip/lm4/adc.c b/chip/lm4/adc.c index 008288e520..13b5ebdebd 100644 --- a/chip/lm4/adc.c +++ b/chip/lm4/adc.c @@ -6,7 +6,6 @@ /* LM4-specific ADC module for Chrome EC */ #include "adc.h" -#include "adc_chip.h" #include "atomic.h" #include "clock.h" #include "console.h" diff --git a/chip/lm4/adc_chip.h b/chip/lm4/adc_chip.h index b43bec2da3..a402c845a1 100644 --- a/chip/lm4/adc_chip.h +++ b/chip/lm4/adc_chip.h @@ -8,6 +8,8 @@ #ifndef __CROS_EC_ADC_CHIP_H #define __CROS_EC_ADC_CHIP_H +#include <stdint.h> + enum lm4_adc_sequencer { LM4_ADC_SEQ0 = 0, LM4_ADC_SEQ1, @@ -29,12 +31,6 @@ struct adc_t { uint8_t gpio_mask; }; -/* - * Boards must provide this list of ADC channel definitions. This must match - * the enum adc_channel list provided by the board. - */ -extern const struct adc_t adc_channels[]; - /* Minimum and maximum values returned by raw ADC read. */ #define ADC_READ_MIN 0 #define ADC_READ_MAX 4095 diff --git a/chip/lm4/chip_temp_sensor.c b/chip/lm4/chip_temp_sensor.c index eb1bc4d133..93b66f5f3f 100644 --- a/chip/lm4/chip_temp_sensor.c +++ b/chip/lm4/chip_temp_sensor.c @@ -6,7 +6,6 @@ /* Temperature sensor module for Chrome EC */ #include "adc.h" -#include "adc_chip.h" #include "common.h" #include "hooks.h" diff --git a/chip/mchp/adc.c b/chip/mchp/adc.c index e8ec10a0e5..d40a8a9d1c 100644 --- a/chip/mchp/adc.c +++ b/chip/mchp/adc.c @@ -4,7 +4,6 @@ */ #include "adc.h" -#include "adc_chip.h" #include "common.h" #include "console.h" #include "gpio.h" diff --git a/chip/mchp/adc_chip.h b/chip/mchp/adc_chip.h index ae29ef1f92..0f14d5a459 100644 --- a/chip/mchp/adc_chip.h +++ b/chip/mchp/adc_chip.h @@ -30,12 +30,6 @@ enum chip_adc_channel { CHIP_ADC_COUNT, }; -/* - * Boards must provide this list of ADC channel definitions. - * This must match the enum adc_channel list provided by the board. - */ -extern const struct adc_t adc_channels[]; - /* Minimum and maximum values returned by adc_read_channel(). */ #define ADC_READ_MIN 0 #ifdef CHIP_FAMILY_MEC172X diff --git a/chip/mec1322/adc.c b/chip/mec1322/adc.c index fd797a7f15..95fe99f891 100644 --- a/chip/mec1322/adc.c +++ b/chip/mec1322/adc.c @@ -4,7 +4,6 @@ */ #include "adc.h" -#include "adc_chip.h" #include "common.h" #include "console.h" #include "hooks.h" diff --git a/chip/mec1322/adc_chip.h b/chip/mec1322/adc_chip.h index bc25344b11..a6425d6872 100644 --- a/chip/mec1322/adc_chip.h +++ b/chip/mec1322/adc_chip.h @@ -17,12 +17,6 @@ struct adc_t { int channel; }; -/* - * Boards must provide this list of ADC channel definitions. This must match - * the enum adc_channel list provided by the board. - */ -extern const struct adc_t adc_channels[]; - /* Minimum and maximum values returned by adc_read_channel(). */ #define ADC_READ_MIN 0 #define ADC_READ_MAX 1023 diff --git a/chip/npcx/adc.c b/chip/npcx/adc.c index 768e7dff27..ea16589d9b 100644 --- a/chip/npcx/adc.c +++ b/chip/npcx/adc.c @@ -6,7 +6,6 @@ /* NPCX-specific ADC module for Chrome EC */ #include "adc.h" -#include "adc_chip.h" #include "atomic.h" #include "clock.h" #include "clock_chip.h" diff --git a/chip/npcx/adc_chip.h b/chip/npcx/adc_chip.h index 9c2de3000d..300447df16 100644 --- a/chip/npcx/adc_chip.h +++ b/chip/npcx/adc_chip.h @@ -8,7 +8,7 @@ #ifndef __CROS_EC_ADC_CHIP_H #define __CROS_EC_ADC_CHIP_H -#include "adc.h" +#include "common.h" /* Minimum and maximum values returned by raw ADC read. */ #define ADC_READ_MIN 0 @@ -46,12 +46,6 @@ struct adc_t { }; /* - * Boards must provide this list of ADC channel definitions. This must match - * the enum adc_channel list provided by the board. - */ -extern const struct adc_t adc_channels[]; - -/* * Boards may configure a ADC channel for use with thershold interrupts. * The threshold levels may be set from 0 to ADC_MAX_VOLT inclusive. */ diff --git a/chip/stm32/adc-stm32f0.c b/chip/stm32/adc-stm32f0.c index d900cbc514..b0654132cd 100644 --- a/chip/stm32/adc-stm32f0.c +++ b/chip/stm32/adc-stm32f0.c @@ -4,7 +4,6 @@ */ #include "adc.h" -#include "adc_chip.h" #include "clock.h" #include "common.h" #include "console.h" diff --git a/chip/stm32/adc-stm32f3.c b/chip/stm32/adc-stm32f3.c index fb3e4604a8..543a44ab1a 100644 --- a/chip/stm32/adc-stm32f3.c +++ b/chip/stm32/adc-stm32f3.c @@ -4,7 +4,6 @@ */ #include "adc.h" -#include "adc_chip.h" #include "clock.h" #include "common.h" #include "console.h" diff --git a/chip/stm32/adc-stm32l.c b/chip/stm32/adc-stm32l.c index 199b64c81f..c1f1cfae4a 100644 --- a/chip/stm32/adc-stm32l.c +++ b/chip/stm32/adc-stm32l.c @@ -4,7 +4,6 @@ */ #include "adc.h" -#include "adc_chip.h" #include "common.h" #include "console.h" #include "clock.h" diff --git a/chip/stm32/adc-stm32l4.c b/chip/stm32/adc-stm32l4.c index 8c6e737588..8609d44f5d 100644 --- a/chip/stm32/adc-stm32l4.c +++ b/chip/stm32/adc-stm32l4.c @@ -4,7 +4,6 @@ */ #include "adc.h" -#include "adc_chip.h" #include "clock.h" #include "common.h" #include "console.h" diff --git a/chip/stm32/adc_chip.h b/chip/stm32/adc_chip.h index 0d6ae7fe51..7e3c688c14 100644 --- a/chip/stm32/adc_chip.h +++ b/chip/stm32/adc_chip.h @@ -8,8 +8,6 @@ #ifndef __CROS_EC_ADC_CHIP_H #define __CROS_EC_ADC_CHIP_H -#include "stdint.h" - #ifdef CHIP_FAMILY_STM32L4 enum stm32_adc_smpr { STM32_ADC_SMPR_DEFAULT = 0, @@ -54,13 +52,6 @@ struct adc_t { #endif }; -/* - * Boards must provide this list of ADC channel definitions. This must match - * the enum adc_channel list provided by the board. Also, for STM32F0, this - * must be ordered by AIN ID. - */ -extern const struct adc_t adc_channels[]; - /* Disable ADC module when we don't need it anymore. */ void adc_disable(void); diff --git a/common/adc.c b/common/adc.c index f367ffed5b..c9e3a36e57 100644 --- a/common/adc.c +++ b/common/adc.c @@ -6,7 +6,6 @@ /* ADC module for Chrome EC */ #include "adc.h" -#include "adc_chip.h" #include "common.h" #include "console.h" #include "ec_commands.h" diff --git a/include/adc.h b/include/adc.h index e3d0692b87..b52798419a 100644 --- a/include/adc.h +++ b/include/adc.h @@ -8,6 +8,7 @@ #ifndef __CROS_EC_ADC_H #define __CROS_EC_ADC_H +#include "adc_chip.h" #include "common.h" #define ADC_READ_ERROR -1 /* Value returned by adc_read_channel() on error */ @@ -17,6 +18,12 @@ #endif /* CONFIG_ZEPHYR */ /* + * Boards must provide this list of ADC channel definitions. This must match + * the enum adc_channel list provided by the board. + */ +extern const struct adc_t adc_channels[]; + +/* * Boards which use the ADC interface must provide enum adc_channel in the * board.h file. See chip/$CHIP/adc_chip.h for additional chip-specific * requirements. diff --git a/test/vpd_api.h b/test/vpd_api.h index 3db4803288..f848138172 100644 --- a/test/vpd_api.h +++ b/test/vpd_api.h @@ -8,7 +8,6 @@ #ifndef __CROS_EC_VPD_API_H #define __CROS_EC_VPD_API_H -#include "adc.h" #include "gpio.h" #include "usb_pd.h" |