summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorMichał Barnaś <mb@semihalf.com>2021-11-30 16:35:56 +0100
committerCommit Bot <commit-bot@chromium.org>2022-01-10 17:21:29 +0000
commit42d03a00128e4be0d149e6142d1987518cfead20 (patch)
treef90472caaeb0ffe85b64afe1b093207f50e8e2d9 /driver
parent6f2db445178f9e682cf8438d8d6b996551ae0eaa (diff)
downloadchrome-ec-42d03a00128e4be0d149e6142d1987518cfead20.tar.gz
config: change temp_sensor_power from config to gpio
Split the temp_sensor_power config to separate config and gpio definition. To match the behavior of other optional gpios, there should be config that enables support for feature that requires gpio and per-board define that assigns custom GPIO name to board specific one. BRANCH=main BUG=b:181983966 TEST=zmake testall, compare_build.sh Change-Id: I57ff2532444960170d7a8a08027f13fbce8f34a2 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3314583 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/temp_sensor/adt7481.c8
-rw-r--r--driver/temp_sensor/g753.c4
-rw-r--r--driver/temp_sensor/g78x.c4
-rw-r--r--driver/temp_sensor/thermistor.c6
-rw-r--r--driver/temp_sensor/tmp006.c4
-rw-r--r--driver/temp_sensor/tmp411.c8
-rw-r--r--driver/temp_sensor/tmp432.c12
7 files changed, 23 insertions, 23 deletions
diff --git a/driver/temp_sensor/adt7481.c b/driver/temp_sensor/adt7481.c
index b10404733c..738fdb776a 100644
--- a/driver/temp_sensor/adt7481.c
+++ b/driver/temp_sensor/adt7481.c
@@ -25,8 +25,8 @@ static uint8_t is_sensor_shutdown;
*/
static int has_power(void)
{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
+#ifdef CONFIG_TEMP_SENSOR_POWER
+ return gpio_get_level(GPIO_TEMP_SENSOR_POWER);
#else
return !is_sensor_shutdown;
#endif
@@ -340,12 +340,12 @@ DECLARE_CONSOLE_COMMAND(adt7481, command_adt7481,
int adt7481_set_power(enum adt7481_power_state power_on)
{
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
+#ifndef CONFIG_TEMP_SENSOR_POWER
uint8_t shutdown = (power_on == ADT7481_POWER_OFF) ? 1 : 0;
return adt7481_shutdown(shutdown);
#else
- gpio_set_level(CONFIG_TEMP_SENSOR_POWER_GPIO, power_on);
+ gpio_set_level(GPIO_TEMP_SENSOR_POWER, power_on);
return EC_SUCCESS;
#endif
}
diff --git a/driver/temp_sensor/g753.c b/driver/temp_sensor/g753.c
index 857263c161..e3946e4f43 100644
--- a/driver/temp_sensor/g753.c
+++ b/driver/temp_sensor/g753.c
@@ -22,8 +22,8 @@ static int temp_val_local;
*/
static int has_power(void)
{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
+#ifdef CONFIG_TEMP_SENSOR_POWER
+ return gpio_get_level(GPIO_TEMP_SENSOR_POWER);
#else
return 1;
#endif
diff --git a/driver/temp_sensor/g78x.c b/driver/temp_sensor/g78x.c
index aef13d3d68..c4fd0ff243 100644
--- a/driver/temp_sensor/g78x.c
+++ b/driver/temp_sensor/g78x.c
@@ -26,8 +26,8 @@ static int temp_val_remote2;
*/
static int has_power(void)
{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
+#ifdef CONFIG_TEMP_SENSOR_POWER
+ return gpio_get_level(GPIO_TEMP_SENSOR_POWER);
#else
return 1;
#endif
diff --git a/driver/temp_sensor/thermistor.c b/driver/temp_sensor/thermistor.c
index ffa780cb07..bef10416b6 100644
--- a/driver/temp_sensor/thermistor.c
+++ b/driver/temp_sensor/thermistor.c
@@ -77,14 +77,14 @@ int thermistor_get_temperature(int idx_adc, int *temp_ptr,
{
int mv;
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
+#ifdef CONFIG_TEMP_SENSOR_POWER
/*
* If the power rail for the thermistor circuit is not enabled, then
* need to ignore any ADC measurments.
*/
- if (!gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO))
+ if (!gpio_get_level(GPIO_TEMP_SENSOR_POWER))
return EC_ERROR_NOT_POWERED;
-#endif /* CONFIG_TEMP_SENSOR_POWER_GPIO */
+#endif /* CONFIG_TEMP_SENSOR_POWER */
mv = adc_read_channel(idx_adc);
if (mv < 0)
return EC_ERROR_UNKNOWN;
diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c
index 22f4402747..96922c857c 100644
--- a/driver/temp_sensor/tmp006.c
+++ b/driver/temp_sensor/tmp006.c
@@ -75,8 +75,8 @@ static const struct tmp006_data_t tmp006_data_default = {
static int tmp006_has_power(int idx)
{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
+#ifdef CONFIG_TEMP_SENSOR_POWER
+ return gpio_get_level(GPIO_TEMP_SENSOR_POWER);
#else
return 1;
#endif
diff --git a/driver/temp_sensor/tmp411.c b/driver/temp_sensor/tmp411.c
index ee50d0a894..8db3f9a8d8 100644
--- a/driver/temp_sensor/tmp411.c
+++ b/driver/temp_sensor/tmp411.c
@@ -24,8 +24,8 @@ static uint8_t is_sensor_shutdown;
*/
static int has_power(void)
{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
+#ifdef CONFIG_TEMP_SENSOR_POWER
+ return gpio_get_level(GPIO_TEMP_SENSOR_POWER);
#else
return !is_sensor_shutdown;
#endif
@@ -318,12 +318,12 @@ DECLARE_CONSOLE_COMMAND(tmp411, command_tmp411,
int tmp411_set_power(enum tmp411_power_state power_on)
{
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
+#ifndef CONFIG_TEMP_SENSOR_POWER
uint8_t shutdown = (power_on == TMP411_POWER_OFF) ? 1 : 0;
return tmp411_shutdown(shutdown);
#else
- gpio_set_level(CONFIG_TEMP_SENSOR_POWER_GPIO, power_on);
+ gpio_set_level(GPIO_TEMP_SENSOR_POWER, power_on);
return EC_SUCCESS;
#endif
}
diff --git a/driver/temp_sensor/tmp432.c b/driver/temp_sensor/tmp432.c
index 4226f51bfd..8db6a99e19 100644
--- a/driver/temp_sensor/tmp432.c
+++ b/driver/temp_sensor/tmp432.c
@@ -16,7 +16,7 @@
static int temp_val_local;
static int temp_val_remote1;
static int temp_val_remote2;
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
+#ifndef CONFIG_TEMP_SENSOR_POWER
static uint8_t is_sensor_shutdown;
#endif
static int fake_temp[TMP432_IDX_COUNT] = {-1, -1, -1};
@@ -28,8 +28,8 @@ static int fake_temp[TMP432_IDX_COUNT] = {-1, -1, -1};
*/
static int has_power(void)
{
-#ifdef CONFIG_TEMP_SENSOR_POWER_GPIO
- return gpio_get_level(CONFIG_TEMP_SENSOR_POWER_GPIO);
+#ifdef CONFIG_TEMP_SENSOR_POWER
+ return gpio_get_level(GPIO_TEMP_SENSOR_POWER);
#else
return !is_sensor_shutdown;
#endif
@@ -92,7 +92,7 @@ int tmp432_get_val(int idx, int *temp_ptr)
return EC_SUCCESS;
}
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
+#ifndef CONFIG_TEMP_SENSOR_POWER
static int tmp432_shutdown(uint8_t want_shutdown)
{
int ret, value;
@@ -388,11 +388,11 @@ DECLARE_CONSOLE_COMMAND(tmp432, command_tmp432,
int tmp432_set_power(enum tmp432_power_state power_on)
{
-#ifndef CONFIG_TEMP_SENSOR_POWER_GPIO
+#ifndef CONFIG_TEMP_SENSOR_POWER
uint8_t shutdown = (power_on == TMP432_POWER_OFF) ? 1 : 0;
return tmp432_shutdown(shutdown);
#else
- gpio_set_level(CONFIG_TEMP_SENSOR_POWER_GPIO, power_on);
+ gpio_set_level(GPIO_TEMP_SENSOR_POWER, power_on);
return EC_SUCCESS;
#endif
}