Beispiel #1
0
int fpc1020_write_test_setup(fpc1020_data_t *fpc1020, u16 pattern)
{
	int error = 0;
	u8 config = 0x04;
	fpc1020_reg_access_t reg;

	dev_dbg(&fpc1020->spi->dev, "%s, pattern 0x%x\n", __func__, pattern);

	error = fpc1020_write_sensor_setup(fpc1020);
	if (error)
		goto out;

	FPC1020_MK_REG_WRITE(reg, FPC102X_REG_TST_COL_PATTERN_EN, &pattern);
	error = fpc1020_reg_access(fpc1020, &reg);
	if (error)
		goto out;

	FPC1020_MK_REG_WRITE(reg, FPC102X_REG_FINGER_DRIVE_CONF, &config);
	error = fpc1020_reg_access(fpc1020, &reg);
	if (error)
		goto out;

	error = fpc1020_capture_settings(fpc1020, 0);
	if (error)
		goto out;

out:
	return error;
}
int fpc1020_capture_wait_finger_down(fpc1020_data_t *fpc1020)
{
    int error = 0;
    int thold = 32;
    int addthred = 30;

    if( fpc1020->setup.finger_auto_threshold ){
        error = fpc1020_read_irq(fpc1020, true);
        if (error < 0)
            goto out_error;
        error = fpc1020_cmd(fpc1020,
                FPC1020_CMD_FINGER_PRESENT_QUERY,
                FPC_1020_IRQ_REG_BIT_COMMAND_DONE);
        if (error < 0)
            goto out_error;
        error = fpc1020_capture_set_crop(fpc1020,fpc1020->setup.wakeup_detect_cols[0],1,fpc1020->setup.wakeup_detect_rows[0],8);
        if (error < 0)
            goto out_error;
        error = cal_thredhold(fpc1020);
        if (error < 0)
            goto out_error;
        thold = error;
        error = fpc1020_capture_set_crop(fpc1020,fpc1020->setup.wakeup_detect_cols[1],1,fpc1020->setup.wakeup_detect_rows[1],8);
        if (error < 0)
            goto out_error;
        error = cal_thredhold(fpc1020);
        if (error < 0)
            goto out_error;
        if(error > thold)
            thold = error;
        thold += addthred;
        if(thold < fpc1020->fp_thredhold && thold >= addthred)
            fpc1020->fp_thredhold = thold;
        printk("fingerprint fp_thredhold =%d default_hold=%d det1=[%d,1,%d,8] det2=[%d,1,%d,8]\n",\
                fpc1020->fp_thredhold,fpc1020->setup.finger_detect_threshold,\
                fpc1020->setup.wakeup_detect_cols[0],fpc1020->setup.wakeup_detect_rows[0],\
                fpc1020->setup.wakeup_detect_cols[1],fpc1020->setup.wakeup_detect_rows[1]);
        fpc1020_wake_up(fpc1020);
        fpc1020_write_sensor_setup(fpc1020);
    }

    error = fpc1020_wait_finger_present(fpc1020);

     fpc1020_read_irq(fpc1020, true);

out_error:
    return (error >= 0) ? 0 : error;
}
Beispiel #3
0
int fpc1020_write_capture_setup(fpc1020_data_t *fpc1020)
{
	return fpc1020_write_sensor_setup(fpc1020);
}
/* -------------------------------------------------------------------- */
static int fpc1020_write_nav_setup(fpc1020_data_t* fpc1020)
{
    const int mux = 2;
    int error = 0;
    u16 temp_u16;
    u32 temp_u32;
    u8 temp_u8;
    fpc1020_reg_access_t reg;

    dev_dbg(&fpc1020->spi->dev, "%s %d\n", __func__, mux);
#if 1
    error = fpc1020_wake_up(fpc1020);
    if (error)
    { goto out; }

    error = fpc1020_write_sensor_setup(fpc1020);
    if (error)
    { goto out; }
#endif

#if 0
    temp_u16 = fpc1020->setup.adc_shift[mux];
    temp_u16 <<= 8;
    temp_u16 |= fpc1020->setup.adc_gain[mux];
#else
    temp_u16 = 8;
    temp_u16 <<= 8;
    temp_u16 |= 5;
#endif
    FPC1020_MK_REG_WRITE(reg, FPC102X_REG_ADC_SHIFT_GAIN, &temp_u16);
    error = fpc1020_reg_access(fpc1020, &reg);
    if (error)
    { goto out; }

    //temp_u16 = fpc1020->setup.pxl_ctrl[mux];
    temp_u16 = 0x0f1f;
    FPC1020_MK_REG_WRITE(reg, FPC102X_REG_PXL_CTRL, &temp_u16);
    error = fpc1020_reg_access(fpc1020, &reg);
    if (error)
    { goto out; }

    error = fpc1020_capture_set_crop(fpc1020,
                                     NAV_IMG_CROP_X / fpc1020->chip.adc_group_size,
                                     NAV_IMG_CROP_W / fpc1020->chip.adc_group_size, NAV_IMG_CROP_Y,
                                     NAV_IMG_CROP_H);
    if (error)
    { goto out; }

    // Setup skipping of rows
    switch (NAV_IMG_ROW_SKIP)
    {
        case 1:
            temp_u32 = 0;
            break;
        case 2:
            temp_u32 = 1;
            break;
        case 4:
            temp_u32 = 2;
            break;
        case 8:
            temp_u32 = 3;
            break;
        default:
            error = -EINVAL;
            break;
    }
    if (error)
    { goto out; }

    temp_u32 <<= 8;

    // Setup masking of columns
    switch (NAV_IMG_COL_MASK)
    {
        case 1:
            temp_u32 |= 0xff;
            break;
        case 2:
            temp_u32 |= 0xcc;
            break;
        case 4:
            temp_u32 |= 0x88;
            break;
        case 8:
            temp_u32 |= 0x80;
            break;
        default:
            error = -EINVAL;
            break;
    }
    if (error)
    { goto out; }

    temp_u32 <<= 8;
    temp_u32 |= 0; // No multisampling
    FPC1020_MK_REG_WRITE(reg, FPC102X_REG_IMG_SMPL_SETUP, &temp_u32);
    error = fpc1020_reg_access(fpc1020, &reg);
    if (error)
    { goto out; }

    temp_u8 = 0x08;
    FPC1020_MK_REG_WRITE(reg, FPC1020_REG_FNGR_DET_THRES, &temp_u8);
    error = fpc1020_reg_access(fpc1020, &reg);

    dev_dbg(&fpc1020->spi->dev, "%s, (%d, %d, %d, %d)\n", __func__,
            fpc1020->nav.image_nav_col_start, fpc1020->nav.image_nav_col_groups,
            fpc1020->nav.image_nav_row_start, fpc1020->nav.image_nav_row_count);

out:
    return error;
}