AES1610: driver cleanup, part #2
Remove dead code https://bugs.freedesktop.org/show_bug.cgi?id=56439
This commit is contained in:
parent
f569d0bf44
commit
6b84c6664f
1 changed files with 0 additions and 169 deletions
|
@ -110,103 +110,6 @@ static void generic_ignore_data_cb(struct libusb_transfer *transfer)
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void read_regs_data_cb(struct libusb_transfer *transfer)
|
|
||||||
{
|
|
||||||
struct aes1610_read_regs *rdata = transfer->user_data;
|
|
||||||
unsigned char *retdata = NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
|
||||||
r = -EIO;
|
|
||||||
} else if (transfer->length != transfer->actual_length) {
|
|
||||||
r = -EPROTO;
|
|
||||||
} else {
|
|
||||||
r = 0;
|
|
||||||
retdata = transfer->buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
rdata->callback(rdata->dev, r, retdata, rdata->user_data);
|
|
||||||
g_free(rdata);
|
|
||||||
g_free(transfer->buffer);
|
|
||||||
libusb_free_transfer(transfer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void read_regs_rq_cb(struct fp_img_dev *dev, int result, void *user_data)
|
|
||||||
{
|
|
||||||
struct aes1610_read_regs *rdata = user_data;
|
|
||||||
struct libusb_transfer *transfer;
|
|
||||||
unsigned char *data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
g_free(rdata->regwrite);
|
|
||||||
if (result != 0)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
transfer = libusb_alloc_transfer(0);
|
|
||||||
if (!transfer) {
|
|
||||||
result = -ENOMEM;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
data = g_malloc(126);
|
|
||||||
libusb_fill_bulk_transfer(transfer, dev->udev, EP_IN, data, 126,
|
|
||||||
read_regs_data_cb, rdata, BULK_TIMEOUT);
|
|
||||||
|
|
||||||
r = libusb_submit_transfer(transfer);
|
|
||||||
if (r < 0) {
|
|
||||||
g_free(data);
|
|
||||||
libusb_free_transfer(transfer);
|
|
||||||
result = -EIO;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
err:
|
|
||||||
rdata->callback(dev, result, NULL, rdata->user_data);
|
|
||||||
g_free(rdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// XXX: this comes from aes2501 driver but it is unused here
|
|
||||||
static void read_regs(struct fp_img_dev *dev, aes1610_read_regs_cb callback,
|
|
||||||
void *user_data)
|
|
||||||
{
|
|
||||||
/* FIXME: regwrite is dynamic because of asynchronity. is this really
|
|
||||||
* required? */
|
|
||||||
struct aes_regwrite *regwrite = g_malloc(sizeof(*regwrite));
|
|
||||||
struct aes1610_read_regs *rdata = g_malloc(sizeof(*rdata));
|
|
||||||
|
|
||||||
fp_dbg("");
|
|
||||||
//regwrite->reg = AES1610_REG_CTRL2;
|
|
||||||
//regwrite->value = AES1610_CTRL2_READ_REGS;
|
|
||||||
rdata->dev = dev;
|
|
||||||
rdata->callback = callback;
|
|
||||||
rdata->user_data = user_data;
|
|
||||||
rdata->regwrite = regwrite;
|
|
||||||
|
|
||||||
//aes_write_regv(dev, (const struct aes_regwrite *) regwrite, 1,
|
|
||||||
// read_regs_rq_cb, rdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read the value of a specific register from a register dump */
|
|
||||||
static int regval_from_dump(unsigned char *data, uint8_t target)
|
|
||||||
{
|
|
||||||
if (*data != FIRST_AES1610_REG) {
|
|
||||||
fp_err("not a register dump");
|
|
||||||
return -EILSEQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(FIRST_AES1610_REG <= target && target <= LAST_AES1610_REG)) {
|
|
||||||
fp_err("out of range");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
target -= FIRST_AES1610_REG;
|
|
||||||
target *= 2;
|
|
||||||
return data[target + 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void generic_write_regv_cb(struct fp_img_dev *dev, int result,
|
static void generic_write_regv_cb(struct fp_img_dev *dev, int result,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
@ -217,8 +120,6 @@ static void generic_write_regv_cb(struct fp_img_dev *dev, int result,
|
||||||
fpi_ssm_mark_aborted(ssm, result);
|
fpi_ssm_mark_aborted(ssm, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* read the specified number of bytes from the IN endpoint but throw them
|
/* read the specified number of bytes from the IN endpoint but throw them
|
||||||
* away, then increment the SSM */
|
* away, then increment the SSM */
|
||||||
static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
|
static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
|
||||||
|
@ -246,25 +147,6 @@ static void generic_read_ignore_data(struct fpi_ssm *ssm, size_t bytes)
|
||||||
|
|
||||||
/****** IMAGE PROCESSING ******/
|
/****** IMAGE PROCESSING ******/
|
||||||
|
|
||||||
static int sum_histogram_values(unsigned char *data, uint8_t threshold)
|
|
||||||
{
|
|
||||||
int r = 0;
|
|
||||||
int i;
|
|
||||||
uint16_t *histogram = (uint16_t *)(data + 1);
|
|
||||||
|
|
||||||
if (*data != 0xde)
|
|
||||||
return -EILSEQ;
|
|
||||||
|
|
||||||
if (threshold > 0x0f)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/* FIXME endianness */
|
|
||||||
for (i = threshold; i < 16; i++)
|
|
||||||
r += histogram[i];
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find overlapping parts of frames */
|
/* find overlapping parts of frames */
|
||||||
static unsigned int find_overlap(unsigned char *first_frame,
|
static unsigned int find_overlap(unsigned char *first_frame,
|
||||||
unsigned char *second_frame, unsigned int *min_error)
|
unsigned char *second_frame, unsigned int *min_error)
|
||||||
|
@ -416,15 +298,6 @@ static const struct aes_regwrite finger_det_reqs[] = {
|
||||||
{ 0x81, 0x04 }
|
{ 0x81, 0x04 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct aes_regwrite finger_det_none[] = {
|
|
||||||
{ 0x80, 0x01 },
|
|
||||||
{ 0x82, 0x00 },
|
|
||||||
{ 0x86, 0x00 },
|
|
||||||
{ 0xB1, 0x28 },
|
|
||||||
{ 0x1D, 0x00 }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void start_finger_detection(struct fp_img_dev *dev);
|
static void start_finger_detection(struct fp_img_dev *dev);
|
||||||
|
|
||||||
static void finger_det_data_cb(struct libusb_transfer *transfer)
|
static void finger_det_data_cb(struct libusb_transfer *transfer)
|
||||||
|
@ -461,12 +334,6 @@ out:
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void finger_det_none_cb(struct fp_img_dev *dev, int result, void *user_data) |