summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2019-06-20 14:44:12 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-25 08:21:27 +0000
commit71c5056bd1f27b52f99c1ed4cff01bdc8cee032e (patch)
treeab7610c82f8c3fb93178b2a3222a4494e7ee9994
parent734a3ea667ee4503dd2f8caf89c62fb7dd91f9e7 (diff)
downloadchrome-ec-71c5056bd1f27b52f99c1ed4cff01bdc8cee032e.tar.gz
kohaku: Add vsync pin and sync driver
VSYNC pin is added to rev1. We need to hook up driver/pin to enable ARCore. This pin doesn't exist on rev0, so I don't expect this patch to break rev0. BUG=b:135216932 BRANCH=none TEST=build kohaku Change-Id: I700d628f064315693911ec53319960491fe0608a Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1670163 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
-rw-r--r--board/kohaku/board.c15
-rw-r--r--board/kohaku/board.h5
-rw-r--r--board/kohaku/gpio.inc2
3 files changed, 21 insertions, 1 deletions
diff --git a/board/kohaku/board.c b/board/kohaku/board.c
index 23b6124ad7..543c656a52 100644
--- a/board/kohaku/board.c
+++ b/board/kohaku/board.c
@@ -15,6 +15,7 @@
#include "driver/als_bh1730.h"
#include "driver/ppc/sn5s330.h"
#include "driver/bc12/max14637.h"
+#include "driver/sync.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
#include "ec_commands.h"
@@ -279,6 +280,18 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
+
+ [VSYNC] = {
+ .name = "Camera VSYNC",
+ .active_mask = SENSOR_ACTIVE_S0,
+ .chip = MOTIONSENSE_CHIP_GPIO,
+ .type = MOTIONSENSE_TYPE_SYNC,
+ .location = MOTIONSENSE_LOC_CAMERA,
+ .drv = &sync_drv,
+ .default_range = 0,
+ .min_frequency = 0,
+ .max_frequency = 1,
+ },
};
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
@@ -320,6 +333,8 @@ static void board_init(void)
{
/* Enable gpio interrupt for base accelgyro sensor */
gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
+ /* Enable gpio interrupt for camera vsync */
+ gpio_enable_interrupt(GPIO_WFCAM_VSYNC);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/kohaku/board.h b/board/kohaku/board.h
index 8e37e56a0a..58c1b6928f 100644
--- a/board/kohaku/board.h
+++ b/board/kohaku/board.h
@@ -36,6 +36,10 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT
+/* Camera VSYNC */
+#define CONFIG_SYNC
+#define CONFIG_SYNC_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
/* BMA253 Lid accel */
#define CONFIG_ACCEL_BMA255
#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(LID_ALS))
@@ -135,6 +139,7 @@ enum sensor_id {
BASE_ACCEL,
BASE_GYRO,
LID_ALS,
+ VSYNC,
SENSOR_COUNT,
};
diff --git a/board/kohaku/gpio.inc b/board/kohaku/gpio.inc
index 5771e6826e..e47c487ab4 100644
--- a/board/kohaku/gpio.inc
+++ b/board/kohaku/gpio.inc
@@ -26,6 +26,7 @@ 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(WFCAM_VSYNC, PIN(B, 7), GPIO_INT_RISING , sync_interrupt)
/* USB-C interrupts */
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt)
@@ -107,7 +108,6 @@ GPIO(I2C7_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C_EEPROM
GPIO(TP62, PIN(7, 2), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP58, PIN(0, 4), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP73, PIN(8, 2), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP17, PIN(B, 7), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP18, PIN(C, 0), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP54, PIN(4, 0), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP56, PIN(6, 1), GPIO_INPUT | GPIO_PULL_UP)