From 199a41cadb9e748d65d946b5c9eaf17d5b168260 Mon Sep 17 00:00:00 2001 From: Caveh Jalali Date: Wed, 25 Aug 2021 16:20:28 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120315 Reviewed-by: Keith Short --- chip/host/adc_chip.h | 16 ++++++++++++++++ chip/it83xx/adc.c | 1 - chip/it83xx/adc_chip.h | 8 ++------ chip/lm4/adc.c | 1 - chip/lm4/adc_chip.h | 8 ++------ chip/lm4/chip_temp_sensor.c | 1 - chip/mchp/adc.c | 1 - chip/mchp/adc_chip.h | 6 ------ chip/mec1322/adc.c | 1 - chip/mec1322/adc_chip.h | 6 ------ chip/npcx/adc.c | 1 - chip/npcx/adc_chip.h | 8 +------- chip/stm32/adc-stm32f0.c | 1 - chip/stm32/adc-stm32f3.c | 1 - chip/stm32/adc-stm32l.c | 1 - chip/stm32/adc-stm32l4.c | 1 - chip/stm32/adc_chip.h | 9 --------- 17 files changed, 21 insertions(+), 50 deletions(-) create mode 100644 chip/host/adc_chip.h (limited to 'chip') 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 + #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 + 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 @@ -45,12 +45,6 @@ struct adc_t { int shift; }; -/* - * 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); -- cgit v1.2.1