예제 #1
0
/*
 * Switch to Y plate resistance mode.  Set MY to ground, PY to
 * supply.  Measure current.
 */
static inline unsigned int ucb1400_ts_read_yres(struct ucb1400 *ucb)
{
	ucb1400_reg_write(ucb, UCB_TS_CR,
			UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
			UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
	return ucb1400_adc_read(ucb, 0);
}
/*
 * Switch to X plate resistance mode.  Set MX to ground, PX to
 * supply.  Measure current.
 */
static inline unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb)
{
    ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
                      UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
                      UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
    return ucb1400_adc_read(ucb->ac97, 0, adcsync);
}
예제 #3
0
/*
 * Switch to pressure mode, and read pressure.  We don't need to wait
 * here, since both plates are being driven.
 */
static inline unsigned int ucb1400_ts_read_pressure(struct ucb1400 *ucb)
{
	ucb1400_reg_write(ucb, UCB_TS_CR,
			UCB_TS_CR_TSMX_POW | UCB_TS_CR_TSPX_POW |
			UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND |
			UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
	udelay(ts_delay_pressure);
	return ucb1400_adc_read(ucb, UCB_ADC_INP_TSPY);
}
/*
 * Switch to Y position mode and measure X plate.  We switch the plate
 * configuration in pressure mode, then switch to position mode.  This
 * gives a faster response time.  Even so, we need to wait about 55us
 * for things to stabilise.
 */
static inline unsigned int ucb1400_ts_read_ypos(struct ucb1400_ts *ucb)
{
    ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
                      UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
                      UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
    ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
                      UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
                      UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
    ucb1400_reg_write(ucb->ac97, UCB_TS_CR,
                      UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
                      UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);

    udelay(ts_delay);

    return ucb1400_adc_read(ucb->ac97, UCB_ADC_INP_TSPX, adcsync);
}