diff options
author | Bobby Casey <bobbycasey@google.com> | 2023-02-17 15:06:05 -0500 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-03 17:45:35 +0000 |
commit | 628d66d14cc15e23ee4e3a83212d57bea17aac19 (patch) | |
tree | 58d7c052f8179ec21bdfdd6a3fd470e1e4c64a5b /driver | |
parent | 40fe88e208aa14be889adbb1457175908f5c7c60 (diff) | |
download | chrome-ec-628d66d14cc15e23ee4e3a83212d57bea17aac19.tar.gz |
driver/fingerprint: Add _FPC suffix to FPC macros
This commit is based on http://crrev.com/c/2727971, which was reverted
in http://crrev.com/c/2810517
BRANCH=none
BUG=b:264457390
TEST=test/run_device_tests.py -b bloonchipper
TEST=test/run_device_tests.py -b dartmonkey
Signed-off-by: Bobby Casey <bobbycasey@google.com>
Change-Id: Ife7373d366228a7940b87b036be1bb7c2a1cf770
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4273187
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc1025_private.h | 25 | ||||
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc1035_private.h | 23 | ||||
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc_private.c | 19 | ||||
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc_private.h | 7 | ||||
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc_sensor_spi.c | 2 | ||||
-rw-r--r-- | driver/fingerprint/fpc/libfp/fpc1145_private.h | 28 | ||||
-rw-r--r-- | driver/fingerprint/fpc/libfp/fpc_private.c | 20 | ||||
-rw-r--r-- | driver/fingerprint/fpsensor.h | 5 |
8 files changed, 70 insertions, 59 deletions
diff --git a/driver/fingerprint/fpc/bep/fpc1025_private.h b/driver/fingerprint/fpc/bep/fpc1025_private.h index 35745c3119..3024a5ac39 100644 --- a/driver/fingerprint/fpc/bep/fpc1025_private.h +++ b/driver/fingerprint/fpc/bep/fpc1025_private.h @@ -7,32 +7,33 @@ #define __CROS_EC_FPC1025_PRIVATE_H /* The 16-bit hardware ID is 0x021y */ -#define FP_SENSOR_HWID 0x021 +#define FP_SENSOR_HWID_FPC 0x021 /* Sensor type name */ -#define FP_SENSOR_NAME "FPC1025" +#define FP_SENSOR_NAME_FPC "FPC1025" /* Sensor pixel resolution */ -#define FP_SENSOR_RES_X (160) /**< Sensor width */ -#define FP_SENSOR_RES_Y (160) /**< Sensor height */ -#define FP_SENSOR_RES_BPP (8) /**< Resolution bits per pixel */ +#define FP_SENSOR_RES_X_FPC (160) /**< Sensor width */ +#define FP_SENSOR_RES_Y_FPC (160) /**< Sensor height */ +#define FP_SENSOR_RES_BPP_FPC (8) /**< Resolution bits per pixel */ /* * Sensor image size * * Value from fpc_bep_image_get_buffer_size(): (160*160)+660 */ -#define FP_SENSOR_IMAGE_SIZE (26260) -#define FP_SENSOR_REAL_IMAGE_SIZE (FP_SENSOR_RES_X * FP_SENSOR_RES_Y) +#define FP_SENSOR_IMAGE_SIZE_FPC (26260) +#define FP_SENSOR_REAL_IMAGE_SIZE_FPC \ + (FP_SENSOR_RES_X_FPC * FP_SENSOR_RES_Y_FPC) /* Offset of image data in fp_buffer */ -#define FP_SENSOR_IMAGE_OFFSET (400) +#define FP_SENSOR_IMAGE_OFFSET_FPC (400) /* * Constant value for the enrollment data size * * Size of private fp_bio_enrollment_t */ -#define FP_ALGORITHM_ENROLLMENT_SIZE (4) +#define FP_ALGORITHM_ENROLLMENT_SIZE_FPC (4) /* * Constant value corresponding to the maximum template size @@ -41,9 +42,11 @@ * * Template size + alignment padding + size of template size variable */ -#define FP_ALGORITHM_TEMPLATE_SIZE (5088 + 0 + 4) +#define FP_ALGORITHM_TEMPLATE_SIZE_FPC (5088 + 0 + 4) /* Max number of templates stored / matched against */ -#define FP_MAX_FINGER_COUNT (5) +#ifndef FP_MAX_FINGER_COUNT_FPC +#define FP_MAX_FINGER_COUNT_FPC (5) +#endif #endif /* __CROS_EC_FPC1025_PRIVATE_H */ diff --git a/driver/fingerprint/fpc/bep/fpc1035_private.h b/driver/fingerprint/fpc/bep/fpc1035_private.h index 41112b96c2..2bf14f9ca2 100644 --- a/driver/fingerprint/fpc/bep/fpc1035_private.h +++ b/driver/fingerprint/fpc/bep/fpc1035_private.h @@ -7,32 +7,33 @@ #define __CROS_EC_FPC1035_PRIVATE_H /* The 16-bit hardware ID is 0x011y */ -#define FP_SENSOR_HWID 0x011 +#define FP_SENSOR_HWID_FPC 0x011 /* Sensor type name */ -#define FP_SENSOR_NAME "FPC1035" +#define FP_SENSOR_NAME_FPC "FPC1035" /* Sensor pixel resolution */ -#define FP_SENSOR_RES_X (112) /**< Sensor width */ -#define FP_SENSOR_RES_Y (88) /**< Sensor height */ -#define FP_SENSOR_RES_BPP (8) /**< Resolution bits per pixel */ +#define FP_SENSOR_RES_X_FPC (112) /**< Sensor width */ +#define FP_SENSOR_RES_Y_FPC (88) /**< Sensor height */ +#define FP_SENSOR_RES_BPP_FPC (8) /**< Resolution bits per pixel */ /* * Sensor image size * * Value from fpc_bep_image_get_buffer_size(): (112*88)+660 */ -#define FP_SENSOR_IMAGE_SIZE (10516) -#define FP_SENSOR_REAL_IMAGE_SIZE (FP_SENSOR_RES_X * FP_SENSOR_RES_Y) +#define FP_SENSOR_IMAGE_SIZE_FPC (10516) +#define FP_SENSOR_REAL_IMAGE_SIZE_FPC \ + (FP_SENSOR_RES_X_FPC * FP_SENSOR_RES_Y_FPC) /* Offset of image data in fp_buffer */ -#define FP_SENSOR_IMAGE_OFFSET (400) +#define FP_SENSOR_IMAGE_OFFSET_FPC (400) /* * Constant value for the enrollment data size * * Size of private fp_bio_enrollment_t */ -#define FP_ALGORITHM_ENROLLMENT_SIZE (4) +#define FP_ALGORITHM_ENROLLMENT_SIZE_FPC (4) /* * Constant value corresponding to the maximum template size @@ -41,9 +42,9 @@ * * Template size + alignment padding + size of template size variable */ -#define FP_ALGORITHM_TEMPLATE_SIZE (14373 + 3 + 4) +#define FP_ALGORITHM_TEMPLATE_SIZE_FPC (14373 + 3 + 4) /* Max number of templates stored / matched against */ -#define FP_MAX_FINGER_COUNT (5) +#define FP_MAX_FINGER_COUNT_FPC (5) #endif /* __CROS_EC_FPC1035_PRIVATE_H */ diff --git a/driver/fingerprint/fpc/bep/fpc_private.c b/driver/fingerprint/fpc/bep/fpc_private.c index 70aa8fe8c5..9480854ef1 100644 --- a/driver/fingerprint/fpc/bep/fpc_private.c +++ b/driver/fingerprint/fpc/bep/fpc_private.c @@ -18,7 +18,8 @@ #define CPRINTF(format, args...) cprintf(CC_FP, format, ##args) #define CPRINTS(format, args...) cprints(CC_FP, format, ##args) -static uint8_t enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE] __aligned(4) = { 0 }; +static uint8_t + enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE_FPC] __aligned(4) = { 0 }; /* Recorded error flags */ static uint16_t errors; @@ -41,11 +42,11 @@ static struct ec_response_fp_info ec_fp_sensor_info = { .model_id = 1, .version = 1, /* Image frame characteristics */ - .frame_size = FP_SENSOR_IMAGE_SIZE, + .frame_size = FP_SENSOR_IMAGE_SIZE_FPC, .pixel_format = V4L2_PIX_FMT_GREY, - .width = FP_SENSOR_RES_X, - .height = FP_SENSOR_RES_Y, - .bpp = FP_SENSOR_RES_BPP, + .width = FP_SENSOR_RES_X_FPC, + .height = FP_SENSOR_RES_Y_FPC, + .bpp = FP_SENSOR_RES_BPP_FPC, }; typedef struct fpc_bep_sensor fpc_bep_sensor_t; @@ -62,12 +63,12 @@ extern const fpc_bep_algorithm_t fpc_bep_algorithm_pfe_1025; const fpc_sensor_info_t fpc_sensor_info = { .sensor = &fpc_bep_sensor_1025, - .image_buffer_size = FP_SENSOR_IMAGE_SIZE, + .image_buffer_size = FP_SENSOR_IMAGE_SIZE_FPC, }; const fpc_bio_info_t fpc_bio_info = { .algorithm = &fpc_bep_algorithm_pfe_1025, - .template_size = FP_ALGORITHM_TEMPLATE_SIZE, + .template_size = FP_ALGORITHM_TEMPLATE_SIZE_FPC, }; #elif defined(CONFIG_FP_SENSOR_FPC1035) @@ -142,12 +143,12 @@ int fpc_check_hwid(void) int status; status = fpc_get_hwid(&id); - if ((id >> 4) != FP_SENSOR_HWID) { + if ((id >> 4) != FP_SENSOR_HWID_FPC) { CPRINTS("FPC unknown silicon 0x%04x", id); return FP_ERROR_BAD_HWID; } if (status == EC_SUCCESS) - CPRINTS(FP_SENSOR_NAME " id 0x%04x", id); + CPRINTS(FP_SENSOR_NAME_FPC " id 0x%04x", id); return status; } diff --git a/driver/fingerprint/fpc/bep/fpc_private.h b/driver/fingerprint/fpc/bep/fpc_private.h index df8b8eeea6..d80fe83378 100644 --- a/driver/fingerprint/fpc/bep/fpc_private.h +++ b/driver/fingerprint/fpc/bep/fpc_private.h @@ -28,7 +28,8 @@ typedef struct { * the finger detect zones are covered. A client can call * fp_sensor_finger_status to determine the current status. * - * @param[in] image_data pointer to FP_SENSOR_IMAGE_SIZE bytes of memory + * @param[in] image_data pointer to a buffer containing at least + * FP_SENSOR_IMAGE_SIZE_FPC bytes of memory * @param[out] fp_sensor_info Structure containing output data. * * @return @@ -42,8 +43,8 @@ int fp_sensor_maintenance(uint8_t *image_data, * Get the HWID of the sensor. * * @param id Pointer to where to store the HWID value. The HWID value here is - * the full 16 bits (contrast to FP_SENSOR_HWID where the lower four bits, which - * are a manufacturing id, are truncated). + * the full 16 bits (contrast to FP_SENSOR_HWID_FPC where the lower four bits, + * which are a manufacturing id, are truncated). * @return * - EC_SUCCESS on success * - EC_ERROR_INVAL or FP_ERROR_SPI_COMM on error diff --git a/driver/fingerprint/fpc/bep/fpc_sensor_spi.c b/driver/fingerprint/fpc/bep/fpc_sensor_spi.c index 565b29c69d..2380637a61 100644 --- a/driver/fingerprint/fpc/bep/fpc_sensor_spi.c +++ b/driver/fingerprint/fpc/bep/fpc_sensor_spi.c @@ -33,7 +33,7 @@ int __unused fpc_sensor_spi_write_read(uint8_t *write, uint8_t *read, { int rc = 0; - if (size == FP_SENSOR_REAL_IMAGE_SIZE) { + if (size == FP_SENSOR_REAL_IMAGE_SIZE_FPC) { rc |= spi_transaction(SPI_FP_DEVICE, write, size, read, SPI_READBACK_ALL); spi_transaction_flush(SPI_FP_DEVICE); diff --git a/driver/fingerprint/fpc/libfp/fpc1145_private.h b/driver/fingerprint/fpc/libfp/fpc1145_private.h index 993d1e1ea9..392665607d 100644 --- a/driver/fingerprint/fpc/libfp/fpc1145_private.h +++ b/driver/fingerprint/fpc/libfp/fpc1145_private.h @@ -15,37 +15,37 @@ * 1140 family with identical functionality. * See http://b/150407388 for additional details. */ -#define FP_SENSOR_HWID 0x140 +#define FP_SENSOR_HWID_FPC 0x140 /* Sensor type name */ -#define FP_SENSOR_NAME "FPC1145" +#define FP_SENSOR_NAME_FPC "FPC1145" /* Sensor pixel resolution */ -#define FP_SENSOR_RES_Y 192 -#define FP_SENSOR_RES_X 56 -#define FP_SENSOR_RES_BPP 8 +#define FP_SENSOR_RES_Y_FPC 192 +#define FP_SENSOR_RES_X_FPC 56 +#define FP_SENSOR_RES_BPP_FPC 8 /* Acquired finger frame definitions */ -#define FP_SENSOR_IMAGE_SIZE_MODE_VENDOR (35460) -#define FP_SENSOR_IMAGE_SIZE_MODE_SIMPLE (13356) +#define FP_SENSOR_IMAGE_SIZE_MODE_VENDOR_FPC (35460) +#define FP_SENSOR_IMAGE_SIZE_MODE_SIMPLE_FPC (13356) /* * Size of the captured image in MQT mode. If you this is modified the * corresponding value in the MQT tool fputils.py must be changed too. * See b/111443750 for context. */ -#define FP_SENSOR_IMAGE_SIZE_MODE_QUAL (24408) +#define FP_SENSOR_IMAGE_SIZE_MODE_QUAL_FPC (24408) -#define FP_SENSOR_IMAGE_SIZE FP_SENSOR_IMAGE_SIZE_MODE_VENDOR -#define FP_SENSOR_IMAGE_OFFSET 2340 +#define FP_SENSOR_IMAGE_SIZE_FPC FP_SENSOR_IMAGE_SIZE_MODE_VENDOR_FPC +#define FP_SENSOR_IMAGE_OFFSET_FPC 2340 /* Opaque FPC context */ -#define FP_SENSOR_CONTEXT_SIZE 4944 +#define FP_SENSOR_CONTEXT_SIZE_FPC 4944 /* Algorithm buffer sizes */ -#define FP_ALGORITHM_ENROLLMENT_SIZE 28 -#define FP_ALGORITHM_TEMPLATE_SIZE 47552 +#define FP_ALGORITHM_ENROLLMENT_SIZE_FPC 28 +#define FP_ALGORITHM_TEMPLATE_SIZE_FPC 47552 /* Max number of templates stored / matched against */ -#define FP_MAX_FINGER_COUNT 5 +#define FP_MAX_FINGER_COUNT_FPC 5 #endif /* __CROS_EC_FPC1145_PRIVATE_H */ diff --git a/driver/fingerprint/fpc/libfp/fpc_private.c b/driver/fingerprint/fpc/libfp/fpc_private.c index 8b1ceff405..07d08fb6d4 100644 --- a/driver/fingerprint/fpc/libfp/fpc_private.c +++ b/driver/fingerprint/fpc/libfp/fpc_private.c @@ -41,9 +41,9 @@ * The sensor context is uncached as it contains the SPI buffers, * the binary library assumes that it is aligned. */ -static uint8_t ctx[FP_SENSOR_CONTEXT_SIZE] __uncached __aligned(4); +static uint8_t ctx[FP_SENSOR_CONTEXT_SIZE_FPC] __uncached __aligned(4); static bio_sensor_t bio_sensor; -static uint8_t enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE] __aligned(4); +static uint8_t enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE_FPC] __aligned(4); /* recorded error flags */ static uint16_t errors; @@ -56,11 +56,11 @@ static struct ec_response_fp_info fpc1145_info = { .model_id = 1, .version = 1, /* Image frame characteristics */ - .frame_size = FP_SENSOR_IMAGE_SIZE, + .frame_size = FP_SENSOR_IMAGE_SIZE_FPC, .pixel_format = V4L2_PIX_FMT_GREY, - .width = FP_SENSOR_RES_X, - .height = FP_SENSOR_RES_Y, - .bpp = FP_SENSOR_RES_BPP, + .width = FP_SENSOR_RES_X_FPC, + .height = FP_SENSOR_RES_Y_FPC, + .bpp = FP_SENSOR_RES_BPP_FPC, }; /* Sensor IC commands */ @@ -130,13 +130,13 @@ int fpc_check_hwid(void) int status; status = fpc_get_hwid(&id); - if ((id >> 4) != FP_SENSOR_HWID) { + if ((id >> 4) != FP_SENSOR_HWID_FPC) { CPRINTS("FPC unknown silicon 0x%04x", id); errors |= FP_ERROR_BAD_HWID; return EC_ERROR_HW_INTERNAL; } if (status == EC_SUCCESS) - CPRINTS(FP_SENSOR_NAME " id 0x%04x", id); + CPRINTS(FP_SENSOR_NAME_FPC " id 0x%04x", id); return status; } @@ -230,9 +230,9 @@ int fp_sensor_init(void) * Ensure that any previous context data is obliterated in case * of a sensor reset. */ - memset(ctx, 0, FP_SENSOR_CONTEXT_SIZE); + memset(ctx, 0, FP_SENSOR_CONTEXT_SIZE_FPC); - res = fp_sensor_open(ctx, FP_SENSOR_CONTEXT_SIZE); + res = fp_sensor_open(ctx, FP_SENSOR_CONTEXT_SIZE_FPC); /* Flush messages from the PAL if any */ cflush(); CPRINTS("Sensor init (attempt %d): 0x%x", attempt, res); diff --git a/driver/fingerprint/fpsensor.h b/driver/fingerprint/fpsensor.h index 83e3143a55..219d182ea1 100644 --- a/driver/fingerprint/fpsensor.h +++ b/driver/fingerprint/fpsensor.h @@ -12,6 +12,11 @@ #include "elan/elan_sensor.h" #else #include "fpc/fpc_sensor.h" +#define FP_SENSOR_IMAGE_SIZE (FP_SENSOR_IMAGE_SIZE_FPC) +#define FP_SENSOR_RES_X (FP_SENSOR_RES_X_FPC) +#define FP_SENSOR_RES_Y (FP_SENSOR_RES_Y_FPC) +#define FP_ALGORITHM_TEMPLATE_SIZE (FP_ALGORITHM_TEMPLATE_SIZE_FPC) +#define FP_MAX_FINGER_COUNT (FP_MAX_FINGER_COUNT_FPC) #endif #else /* These values are used by the host (emulator) tests. */ |