summaryrefslogtreecommitdiff
path: root/driver/temp_sensor/tmp468.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /driver/temp_sensor/tmp468.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14498.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'driver/temp_sensor/tmp468.c')
-rw-r--r--driver/temp_sensor/tmp468.c101
1 files changed, 0 insertions, 101 deletions
diff --git a/driver/temp_sensor/tmp468.c b/driver/temp_sensor/tmp468.c
deleted file mode 100644
index 46e77ca696..0000000000
--- a/driver/temp_sensor/tmp468.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright 2018 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.
- */
-
-/* TMP468 temperature sensor module for Chrome EC */
-
-#include "common.h"
-#include "console.h"
-#include "tmp432.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "hooks.h"
-#include "util.h"
-
-#include "tmp468.h"
-
-
-static int fake_temp[TMP468_CHANNEL_COUNT] = {-1, -1, -1, -1, -1, -1, -1 , -1, -1};
-static int temp_val[TMP468_CHANNEL_COUNT] = {0, 0, 0, 0, 0, 0, 0 , 0, 0};
-static uint8_t is_sensor_shutdown;
-
-static int has_power(void)
-{
- return !is_sensor_shutdown;
-}
-
-static int raw_read16(const int offset, int *data_ptr)
-{
- return i2c_read16(I2C_PORT_THERMAL, TMP468_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-static int raw_write16(const int offset, int data_ptr)
-{
- return i2c_write16(I2C_PORT_THERMAL, TMP468_I2C_ADDR_FLAGS,
- offset, data_ptr);
-}
-
-static int tmp468_shutdown(uint8_t want_shutdown)
-{
- int ret, value;
-
- if (want_shutdown == is_sensor_shutdown)
- return EC_SUCCESS;
-
- ret = raw_read16(TMP468_CONFIGURATION, &value);
- if (ret < 0) {
- ccprintf("ERROR: Temp sensor I2C read16 error.\n");
- return ret;
- }
-
- if (want_shutdown)
- value |= TMP468_SHUTDOWN;
- else
- value &= ~TMP468_SHUTDOWN;
-
- ret = raw_write16(TMP468_CONFIGURATION, value);
- if (ret == EC_SUCCESS)
- is_sensor_shutdown = want_shutdown;
-
- return EC_SUCCESS;
-}
-
-int tmp468_get_val(int idx, int *temp_ptr)
-{
- if(!has_power())
- return EC_ERROR_NOT_POWERED;
-
- if (idx < TMP468_CHANNEL_COUNT) {
- *temp_ptr = C_TO_K(temp_val[idx]);
- return EC_SUCCESS;
- }
-
- return EC_ERROR_INVAL;
-}
-
-static void temp_sensor_poll(void)
-{
- int i, ret;
-
- if (!has_power())
- return;
-
- for (i = 0; i < TMP468_CHANNEL_COUNT; i++)
- if (fake_temp[i] != -1) {
- temp_val[i] = fake_temp[i];
- } else {
- ret = raw_read16(TMP468_LOCAL + i, &temp_val[i]);
- if (ret < 0)
- return;
- temp_val[i] >>= TMP468_SHIFT1;
- }
-}
-DECLARE_HOOK(HOOK_SECOND, temp_sensor_poll, HOOK_PRIO_TEMP_SENSOR);
-
-int tmp468_set_power(enum tmp468_power_state power_on)
-{
- uint8_t shutdown = (power_on == TMP468_POWER_OFF) ? 1 : 0;
- return tmp468_shutdown(shutdown);
-}