summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <devin.lu@quantatw.com>2019-09-06 09:56:25 +0800
committerCommit Bot <commit-bot@chromium.org>2019-09-12 05:15:16 +0000
commit788c0735b35ed5da0587d0fc909618a6b0d42d01 (patch)
tree4820f9a6819f8502fe8b7481293c2660c324f326
parent031c5d2d62dd891622ded885756c03021e934ef2 (diff)
downloadchrome-ec-788c0735b35ed5da0587d0fc909618a6b0d42d01.tar.gz
dratini: Update EC GPIOs for proto and remove unsupport function
1. Correct PP5000_A that just have one pin for proto. 2. Remove ALS support. BUG=none BRANCH=none TEST=make BOARD=dratini Change-Id: I0b5ccc911facb73d5e32ae5d363db0ad1fd94273 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1788764 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r--board/dratini/board.c119
-rw-r--r--board/dratini/board.h11
-rw-r--r--board/dratini/gpio.inc4
3 files changed, 1 insertions, 133 deletions
diff --git a/board/dratini/board.c b/board/dratini/board.c
index 1fede75512..272a5048e4 100644
--- a/board/dratini/board.c
+++ b/board/dratini/board.c
@@ -180,43 +180,6 @@ static struct bmi160_drv_data_t g_bmi160_data;
/* BMA255 private data */
static struct accelgyro_saved_data_t g_bma255_data;
-/* TCS3400 private data */
-static struct als_drv_data_t g_tcs3400_data = {
- .als_cal.scale = 1,
- .als_cal.uscale = 0,
- .als_cal.offset = 0,
- .als_cal.channel_scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc */
- .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */
- },
-};
-
-static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
- .rgb_cal[X] = {
- .offset = 0,
- .scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
- },
- },
- .rgb_cal[Y] = {
- .offset = 0,
- .scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
- },
- },
- .rgb_cal[Z] = {
- .offset = 0,
- .scale = {
- .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
- },
- },
- .saturation.again = TCS_DEFAULT_AGAIN,
- .saturation.atime = TCS_DEFAULT_ATIME,
-};
-
/* Matrix to rotate accelrator into standard reference frame */
static const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
@@ -305,53 +268,9 @@ struct motion_sensor_t motion_sensors[] = {
.min_frequency = BMI160_GYRO_MIN_FREQ,
.max_frequency = BMI160_GYRO_MAX_FREQ,
},
-
- [CLEAR_ALS] = {
- .name = "Clear Light",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_TCS3400,
- .type = MOTIONSENSE_TYPE_LIGHT,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &tcs3400_drv,
- .drv_data = &g_tcs3400_data,
- .port = I2C_PORT_ALS,
- .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
- .rot_standard_ref = NULL,
- .default_range = 0x10000, /* scale = 1x, uscale = 0 */
- .min_frequency = TCS3400_LIGHT_MIN_FREQ,
- .max_frequency = TCS3400_LIGHT_MAX_FREQ,
- .config = {
- /* Run ALS sensor in S0 */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 1000,
- },
- },
- },
-
- [RGB_ALS] = {
- /*
- * RGB channels read by CLEAR_ALS and so the i2c port and
- * address do not need to be defined for RGB_ALS.
- */
- .name = "RGB Light",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_TCS3400,
- .type = MOTIONSENSE_TYPE_LIGHT_RGB,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &tcs3400_rgb_drv,
- .drv_data = &g_tcs3400_rgb_data,
- .rot_standard_ref = NULL,
- .default_range = 0x10000, /* scale = 1x, uscale = 0 */
- },
};
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */
-const struct motion_sensor_t *motion_als_sensors[] = {
- &motion_sensors[CLEAR_ALS],
-};
-BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
-
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
@@ -433,52 +352,14 @@ static void setup_fans(void)
thermal_params[TEMP_SENSOR_2] = thermal_a;
}
-/* Sets the gpio flags correct taking into account warm resets */
-static void reset_gpio_flags(enum gpio_signal signal, int flags)
-{
- /*
- * If the system was already on, we cannot set the value otherwise we
- * may change the value from the previous image which could cause a
- * brownout.
- */
- if (system_is_reboot_warm() || system_jumped_to_this_image())
- flags &= ~(GPIO_LOW | GPIO_HIGH);
-
- gpio_set_flags(signal, flags);
-}
-
-/* Runtime GPIO defaults */
-enum gpio_signal gpio_en_pp5000_a = GPIO_EN_PP5000_A_V1;
-
-static void board_gpio_set_pp5000(void)
-{
- uint32_t board_id = 0;
-
- /* Errors will count as board_id 0 */
- cbi_get_board_version(&board_id);
-
- if (board_id == 0) {
- reset_gpio_flags(GPIO_EN_PP5000_A_V0, GPIO_OUT_LOW);
- /* Change runtime default for V0 */
- gpio_en_pp5000_a = GPIO_EN_PP5000_A_V0;
- } else if (board_id >= 1) {
- reset_gpio_flags(GPIO_EN_PP5000_A_V1, GPIO_OUT_LOW);
- }
-
-}
-
static void board_init(void)
{
/* Initialize Fans */
setup_fans();
/* Enable gpio interrupt for base accelgyro sensor */
gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
- /* Enable interrupt for the TCS3400 color light sensor */
- gpio_enable_interrupt(GPIO_TCS3400_INT_ODL);
/* Enable HDMI HPD interrupt. */
gpio_enable_interrupt(GPIO_HDMI_CONN_HPD);
- /* Select correct gpio signal for PP5000_A control */
- board_gpio_set_pp5000();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/dratini/board.h b/board/dratini/board.h
index c6aaaac68f..fb6946066a 100644
--- a/board/dratini/board.h
+++ b/board/dratini/board.h
@@ -39,13 +39,6 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_LID_ANGLE_UPDATE
-/* TC3400 ALS */
-#define CONFIG_ALS
-#define ALS_COUNT 1
-#define CONFIG_ALS_TCS3400
-#define CONFIG_ALS_TCS3400_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
-#define I2C_PORT_ALS I2C_PORT_SENSOR
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_COMM_LOCKED
@@ -121,10 +114,6 @@
#include "gpio_signal.h"
#include "registers.h"
-/* GPIO signals updated base on board version. */
-#define GPIO_EN_PP5000_A gpio_en_pp5000_a
-extern enum gpio_signal gpio_en_pp5000_a;
-
enum adc_channel {
ADC_TEMP_SENSOR_1, /* ADC0 */
ADC_TEMP_SENSOR_2, /* ADC1 */
diff --git a/board/dratini/gpio.inc b/board/dratini/gpio.inc
index 7789d2c3db..155b823b42 100644
--- a/board/dratini/gpio.inc
+++ b/board/dratini/gpio.inc
@@ -26,7 +26,6 @@ GPIO_INT(PP5000_A_PG_OD, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
/* Sensor Interrupts */
GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING, bmi160_interrupt)
-GPIO_INT(TCS3400_INT_ODL, PIN(F, 1), GPIO_INT_FALLING, tcs3400_interrupt)
/* USB-C interrupts */
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt)
@@ -48,8 +47,7 @@ GPIO(PCH_WAKE_L, PIN(7, 4), GPIO_ODR_HIGH) /* EC_PCH_WAKE_O
GPIO(PCH_PWRBTN_L, PIN(C, 1), GPIO_ODR_HIGH) /* EC_PCH_PWR_BTN_ODL */
/* Power Sequencing Signals */
-GPIO(EN_PP5000_A_V1, PIN(A, 4), GPIO_DEFAULT)
-GPIO(EN_PP5000_A_V0, PIN(7, 3), GPIO_DEFAULT)
+GPIO(EN_PP5000_A, PIN(A, 4), GPIO_OUT_LOW)
GPIO(EN_A_RAILS, PIN(A, 3), GPIO_OUT_LOW)
GPIO(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUT_LOW)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)