mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
eve_fp: minimalistic fingerprint sensor passthrough
Simple hack to provide a pass-through relaying the fingerprint sensor commands coming from the host. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:35648259 TEST=on Eve, read sensor HWID from the kernel. Change-Id: I04e7641fe4067f8378e0b798c529aded0f708b47 Reviewed-on: https://chromium-review.googlesource.com/452500 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
c5c5a57f90
commit
363407db47
@@ -7,7 +7,9 @@
|
||||
#include "console.h"
|
||||
#include "gpio.h"
|
||||
#include "hooks.h"
|
||||
#include "host_command.h"
|
||||
#include "spi.h"
|
||||
#include "system.h"
|
||||
#include "registers.h"
|
||||
|
||||
#include "gpio_list.h"
|
||||
@@ -41,3 +43,35 @@ static void board_init(void)
|
||||
hook_notify(HOOK_CHIPSET_RESUME);
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
|
||||
|
||||
static int fp_command_passthru(struct host_cmd_handler_args *args)
|
||||
{
|
||||
const struct ec_params_fp_passthru *params = args->params;
|
||||
void *out = args->response;
|
||||
int rc;
|
||||
int ret = EC_RES_SUCCESS;
|
||||
|
||||
if (system_is_locked())
|
||||
return EC_RES_ACCESS_DENIED;
|
||||
|
||||
if (params->len > args->params_size +
|
||||
offsetof(struct ec_params_fp_passthru, data) ||
|
||||
params->len > args->response_max)
|
||||
return EC_RES_INVALID_PARAM;
|
||||
|
||||
rc = spi_transaction_async(&spi_devices[0], params->data,
|
||||
params->len, out, SPI_READBACK_ALL);
|
||||
if (params->flags & EC_FP_FLAG_NOT_COMPLETE)
|
||||
rc |= spi_transaction_wait(&spi_devices[0]);
|
||||
else
|
||||
rc |= spi_transaction_flush(&spi_devices[0]);
|
||||
|
||||
if (rc == EC_ERROR_TIMEOUT)
|
||||
ret = EC_RES_TIMEOUT;
|
||||
else if (rc)
|
||||
ret = EC_RES_ERROR;
|
||||
|
||||
args->response_size = params->len;
|
||||
return ret;
|
||||
}
|
||||
DECLARE_HOST_COMMAND(EC_CMD_FP_PASSTHRU, fp_command_passthru, EC_VER_MASK(0));
|
||||
|
||||
@@ -4039,6 +4039,20 @@ struct __ec_align2 ec_response_pd_chip_info {
|
||||
#define EC_CMD_CR51_BASE 0x0300
|
||||
#define EC_CMD_CR51_LAST 0x03FF
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Fingerprint MCU commands: range 0x0400-0x040x */
|
||||
|
||||
/* Fingerprint SPI sensor passthru command */
|
||||
#define EC_CMD_FP_PASSTHRU 0x0400
|
||||
|
||||
#define EC_FP_FLAG_NOT_COMPLETE 0x1
|
||||
|
||||
struct __ec_align2 ec_params_fp_passthru {
|
||||
uint16_t len; /* Number of bytes to write then read */
|
||||
uint16_t flags; /* EC_FP_FLAG_xxx */
|
||||
uint8_t data[]; /* Data to send */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
* Reserve a range of host commands for board-specific, experimental, or
|
||||
|
||||
Reference in New Issue
Block a user