lkml.org 
[lkml]   [2010]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6 V4] input: STMPE touch controller support
On Thu, Jun 24, 2010 at 13:13:41 +0200, Luotao Fu wrote:
> + adc_ctrl1 = SAMPLE_TIME(ts->sample_time) | MOD_12B(ts->mod_12b) |
> + REF_SEL(ts->ref_sel);
> + ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL1,
> + adc_ctrl1, adc_ctrl1);
> + if (ret) {
> + dev_err(&pdev->dev, "Could not setup ADC\n");
> + goto err_free_irq;
> + }
> +
> + ret = stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2,
> + ADC_FREQ(ts->adc_freq), ADC_FREQ(ts->adc_freq));
> + if (ret) {
> + dev_err(&pdev->dev, "Could not setup ADC\n");
> + goto err_free_irq;
> + }
> +
> + tsc_cfg = AVE_CTRL(ts->ave_ctrl) | DET_DELAY(ts->touch_det_delay) |
> + SETTLING(ts->settling);
> + ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_CFG, tsc_cfg, tsc_cfg);
> + if (ret) {
> + dev_err(&pdev->dev, "Could not config touch\n");
> + goto err_free_irq;
> + }
> +
> + ret = stmpe_set_bits(stmpe, STMPE_REG_TSC_FRACTION_Z,
> + FRACTION_Z(ts->fraction_z),
> + FRACTION_Z(ts->fraction_z));

I think your earlier revisions had this same behaviour, but this only
writes the bits you are trying to set, and it may be a problem if there
are other bits already set in this field. I don't know if this is a
concern with this block, but if it is, you can do something like the
following to clear out the field before writing:

stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2,
ADC_FREQ(0xff), ADC_FREQ(ts->adc_freq));

or perhaps:

stmpe_set_bits(stmpe, STMPE_REG_ADC_CTRL2,
0xff, ADC_FREQ(ts->adc_freq));

Rabin


\
 
 \ /
  Last update: 2010-06-24 14:35    [W:0.187 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site