/* * Set current used for pressure measurement. * * Set pil = 2 to use 400uA * pil = 1 to use 200uA and * pil = 0 to disable pressure measurement. * * This is used to increase the range of values returned by the adc * when measureing touchpanel pressure.
*/ staticint pil;
module_param(pil, int, 0);
MODULE_PARM_DESC(pil, "Set current used for pressure measurement.");
/* * Set threshold for pressure measurement. * * Pen down pressure below threshold is ignored.
*/ staticint pressure = DEFAULT_PRESSURE & 0xfff;
module_param(pressure, int, 0);
MODULE_PARM_DESC(pressure, "Set threshold for pressure measurement.");
/* * Set adc sample delay. * * For accurate touchpanel measurements, some settling time may be * required between the switch matrix applying a voltage across the * touchpanel plate and the ADC sampling the signal. * * This delay can be set by setting delay = n, where n is the array * position of the delay in the array delay_table below. * Long delays > 1ms are supported for completeness, but are not * recommended.
*/ staticint delay = 4;
module_param(delay, int, 0);
MODULE_PARM_DESC(delay, "Set adc sample delay.");
/* * Pen detect comparator threshold. * * 0 to Vmid in 15 steps, 0 = use zero power comparator with Vmid threshold * i.e. 1 = Vmid/15 threshold * 15 = Vmid/1 threshold * * Adjust this value if you are having problems with pen detect not * detecting any down events.
*/ staticint pdd = 8;
module_param(pdd, int, 0);
MODULE_PARM_DESC(pdd, "Set pen detect comparator threshold");
/* * Set adc mask function. * * Sources of glitch noise, such as signals driving an LCD display, may feed * through to the touch screen plates and affect measurement accuracy. In * order to minimise this, a signal may be applied to the MASK pin to delay or * synchronise the sampling. * * 0 = No delay or sync * 1 = High on pin stops conversions * 2 = Edge triggered, edge on pin delays conversion by delay param (above) * 3 = Edge triggered, edge on pin starts conversion after delay param
*/ staticint mask;
module_param(mask, int, 0);
MODULE_PARM_DESC(mask, "Set adc mask function.");
/* * Delay after issuing a POLL command. * * The delay is 3 AC97 link frames + the touchpanel settling delay
*/ staticinlinevoid poll_delay(int d)
{
udelay(3 * AC97_LINK_FRAME + delay_table[d]);
}
/* * set up the physical settings of the WM9705
*/ staticvoid wm9705_phy_init(struct wm97xx *wm)
{
u16 dig1 = 0, dig2 = WM97XX_RPR;
/* * mute VIDEO and AUX as they share X and Y touchscreen * inputs on the WM9705
*/
wm97xx_reg_write(wm, AC97_AUX, 0x8000);
wm97xx_reg_write(wm, AC97_VIDEO, 0x8000);
/* touchpanel pressure current*/ if (pil == 2) {
dig2 |= WM9705_PIL;
dev_dbg(wm->dev, "setting pressure measurement current to 400uA.");
} elseif (pil)
dev_dbg(wm->dev, "setting pressure measurement current to 200uA."); if (!pil)
pressure = 0;
/* polling mode sample settling delay */ if (delay != 4) { if (delay < 0 || delay > 15) {
dev_dbg(wm->dev, "supplied delay out of range.");
delay = 4;
}
}
dig1 &= 0xff0f;
dig1 |= WM97XX_DELAY(delay);
dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.",
delay_table[delay]);
/* * Read a sample from the WM9705 adc in polling mode.
*/ staticint wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
{ int timeout = 5 * delay; bool wants_pen = adcsel & WM97XX_PEN_DOWN;
if (wants_pen && !wm->pen_probably_down) {
u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); if (!(data & WM97XX_PEN_DOWN)) return RC_PENUP;
wm->pen_probably_down = 1;
}
/* set up digitiser */ if (wm->mach_ops && wm->mach_ops->pre_sample)
wm->mach_ops->pre_sample(adcsel);
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, (adcsel & WM97XX_ADCSEL_MASK)
| WM97XX_POLL | WM97XX_DELAY(delay));
/* wait 3 AC97 time slots + delay for conversion */
poll_delay(delay);
/* wait for POLL to go low */ while ((wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER1) & WM97XX_POLL)
&& timeout) {
udelay(AC97_LINK_FRAME);
timeout--;
}
if (timeout == 0) { /* If PDEN is set, we can get a timeout when pen goes up */ if (is_pden(wm))
wm->pen_probably_down = 0; else
dev_dbg(wm->dev, "adc sample timeout"); return RC_PENUP;
}
*sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); if (wm->mach_ops && wm->mach_ops->post_sample)
wm->mach_ops->post_sample(adcsel);
/* * Enable WM9705 continuous mode, i.e. touch data is streamed across * an AC97 slot
*/ staticint wm9705_acc_enable(struct wm97xx *wm, int enable)
{
u16 dig1, dig2; int ret = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.