diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2017-11-17 16:23:27 +0100 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-12-06 14:28:56 -0800 |
commit | d757f9bf3b4799b97c57db50ea56735a5b4bcdd1 (patch) | |
tree | e5f84b3b1f1027c740e8fb03cd629f8735921c40 /include | |
parent | 67c31eb10bc1ce6e559562aedd2f641de4243bb8 (diff) | |
download | chrome-ec-d757f9bf3b4799b97c57db50ea56735a5b4bcdd1.tar.gz |
eve_fp: update fingerprint architecture
split the common FP sensor code and use the updated private driver.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=b:69460856
TEST=do a finger capture on Eve EVT.
CQ-DEPEND=CL:*520759
Change-Id: I8b46762218eed0773a4c49a02c2ee6c3966cfa60
Reviewed-on: https://chromium-review.googlesource.com/806166
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/console_channel.inc | 2 | ||||
-rw-r--r-- | include/fpsensor.h | 87 |
2 files changed, 88 insertions, 1 deletions
diff --git a/include/console_channel.inc b/include/console_channel.inc index db5cbcdba9..a5dc6d80ec 100644 --- a/include/console_channel.inc +++ b/include/console_channel.inc @@ -29,7 +29,7 @@ CONSOLE_CHANNEL(CC_CLOCK, "clock") CONSOLE_CHANNEL(CC_DMA, "dma") #endif CONSOLE_CHANNEL(CC_EVENTS, "events") -#ifdef HAS_TASK_FPC1140 +#ifdef HAS_TASK_FPSENSOR CONSOLE_CHANNEL(CC_FP, "fingerprint") #endif #ifdef CONFIG_GESTURE_SW_DETECTION diff --git a/include/fpsensor.h b/include/fpsensor.h new file mode 100644 index 0000000000..66b00b50d9 --- /dev/null +++ b/include/fpsensor.h @@ -0,0 +1,87 @@ +/* Copyright 2017 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. + */ + +/* Fingerprint sensor interface */ + +#ifndef __CROS_EC_FPSENSOR_H +#define __CROS_EC_FPSENSOR_H + +#include <stdint.h> +#include "common.h" +#include "ec_commands.h" + +#ifndef SPI_FP_DEVICE +#define SPI_FP_DEVICE (&spi_devices[0]) +#endif + +/* Four-character-code */ +#define FOURCC(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ + ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) + +/* 8-bit greyscale pixel format as defined by V4L2 headers */ +#define V4L2_PIX_FMT_GREY FOURCC('G', 'R', 'E', 'Y') + +/* --- fonctions provided by the sensor-specific driver --- */ + +/* Initialize the connected sensor hardware and put it in a low power mode. */ +int fp_sensor_init(void); + +/* + * Fill the 'ec_response_fp_info' buffer with the sensor information + * as required by the EC_CMD_FP_INFO host command. + * + * Put both the static information and the ones read from the sensor at runtime. + */ +int fp_sensor_get_info(struct ec_response_fp_info *resp); + +/* + * Put the sensor in its lowest power state. + * + * fp_sensor_configure_detect needs to be called to restore finger detection + * functionality. + */ +void fp_sensor_low_power(void); + +/* + * Configure finger detection. + * + * Send the settings to the sensor, so it is properly configured to detect + * the presence of a finger. + */ +void fp_sensor_configure_detect(void); + +/* + * Returns the status of the finger on the sensor. + * (assumes fp_sensor_configure_detect was called before) + */ +enum finger_state { + FINGER_NONE = 0, + FINGER_PARTIAL = 1, + FINGER_PRESENT = 2, +}; +enum finger_state fp_sensor_finger_status(void); + +/* + * Acquires a fingerprint image. + * + * This function is called once the finger has been detected and cover enough + * area of the sensor (ie fp_sensor_finger_status returned FINGER_PRESENT). + * It does the acquisition immediately. + * The image_data parameter points to an image data buffer of size + * + * FP_SENSOR_IMAGE_SIZE allocated by the caller. + * Returns: + * - 0 on success + * - negative value on error + * - FP_SENSOR_LOW_IMAGE_QUALITY on image captured but quality is too low + * - FP_SENSOR_TOO_FAST on finger removed before image was captured + * - FP_SENSOR_LOW_SENSOR_COVERAGE on sensor not fully covered by finger + */ +#define FP_SENSOR_LOW_IMAGE_QUALITY 1 +#define FP_SENSOR_TOO_FAST 2 +#define FP_SENSOR_LOW_SENSOR_COVERAGE 3 +int fp_sensor_acquire_image(uint8_t *image_data); + +#endif /* __CROS_EC_FPSENSOR_H */ |