Message ID | 1415694844-11230-4-git-send-email-vigneshr@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, 11 Nov 2014, Vignesh R wrote: > In one shot mode, sequencer automatically disables all enabled steps at > the end of each cycle. (both ADC steps and TSC steps) Hence these steps > need not be saved in reg_se_cache for clearing these steps at a later > stage. > Also, when ADC wakes up Sequencer should not be busy executing any of the > config steps except for the charge step. Previously charge step was 1 ADC > clock cycle and hence it was ignored. > > Signed-off-by: Vignesh R <vigneshr@ti.com> > --- You need to provide a changelog here when submitting new versions. > drivers/mfd/ti_am335x_tscadc.c | 7 +++++-- > include/linux/mfd/ti_am335x_tscadc.h | 1 + > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c > index d877e777cce6..110038859a8d 100644 > --- a/drivers/mfd/ti_am335x_tscadc.c > +++ b/drivers/mfd/ti_am335x_tscadc.c > @@ -86,8 +86,12 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc) > spin_lock_irq(&tsadc->reg_lock); > finish_wait(&tsadc->reg_se_wait, &wait); > > + /* > + * Sequencer should either be idle or > + * busy applying the charge step. > + */ > reg = tscadc_readl(tsadc, REG_ADCFSM); > - WARN_ON(reg & SEQ_STATUS); > + WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP)); > tsadc->adc_waiting = false; > } > tsadc->adc_in_use = true; > @@ -96,7 +100,6 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc) > void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val) > { > spin_lock_irq(&tsadc->reg_lock); > - tsadc->reg_se_cache |= val; You didn't answer my question about this? > am335x_tscadc_need_adc(tsadc); > > tscadc_writel(tsadc, REG_SE, val); > diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h > index c99be5dc0f5c..fcce182e4a35 100644 > --- a/include/linux/mfd/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XaXRoIA0KdGhpcyBzZXJpZXMgb2YgcGF0Y2hlcywgVFNDIGlycSBoYW5kbGVyIGlz IHZlcnkgcmVsaWFibGUgYW5kIHRoZSB3b3JrYXJvdW5kIGlzIG5vIGxvbmdlciByZXF1aXJlZC4N Cg0KPiAgCWFtMzM1eF90c2NhZGNfbmVlZF9hZGModHNhZGMpOw0KPiAgDQo+ICAJdHNjYWRjX3dy aXRlbCh0c2FkYywgUkVHX1NFLCB2YWwpOw0KPiBkaWZmIC0tZ2l0IGEvaW5jbHVkZS9saW51eC9t ZmQvdGlfYW0zMzV4X3RzY2FkYy5oIA0KPiBiL2luY2x1ZGUvbGludXgvbWZkL3RpX2FtMzM1eF90 c2NhZGMuaA0KPiBpbmRleCBjOTliZTVkYzBmNWMuLmZjY2UxODJlNGEzNSAxMDA2NDQNCj4gLS0t IGEvaW5jbHVkZS9saW51eC9tZmQvdGlfYW0zMzV4X3RzY2FkYy5oDQo+ICsrKyBiL2luY2x1ZGUv bGludXgvbWZkL3RpX2FtMzM1eF90c2NhZGMuaA0KPiBAQCAtMTI4LDYgKzEyOCw3IEBADQo+ICAN Cj4gIC8qIFNlcXVlbmNlciBTdGF0dXMgKi8NCj4gICNkZWZpbmUgU0VRX1NUQVRVUyBCSVQoNSkN Cj4gKyNkZWZpbmUgQ0hBUkdFX1NURVAJCTB4MTENCj4gIA0KPiAgI2RlZmluZSBBRENfQ0xLCQkJ MzAwMDAwMA0KPiAgI2RlZmluZSBUT1RBTF9TVEVQUwkJMTYNCg0KLS0NCkxlZSBKb25lcw0KTGlu YXJvIFNUTWljcm9lbGVjdHJvbmljcyBMYW5kaW5nIFRlYW0gTGVhZCBMaW5hcm8ub3JnIOKUgiBP cGVuIHNvdXJjZSBzb2Z0d2FyZSBmb3IgQVJNIFNvQ3MgRm9sbG93IExpbmFybzogRmFjZWJvb2sg fCBUd2l0dGVyIHwgQmxvZw0K -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 11 Nov 2014, R, Vignesh wrote: > On Tue, 11 Nov 2014, Vignesh R wrote: > > In one shot mode, sequencer automatically disables all enabled steps > > at the end of each cycle. (both ADC steps and TSC steps) Hence these > > steps need not be saved in reg_se_cache for clearing these steps at a > > later stage. > > Also, when ADC wakes up Sequencer should not be busy executing any of > > the config steps except for the charge step. Previously charge step > > was 1 ADC clock cycle and hence it was ignored. > > > > Signed-off-by: Vignesh R <vigneshr@ti.com> > > --- [...] > > - tsadc->reg_se_cache |= val; > > You didn't answer my question about this? > I did reply to the question in the previous thread. > > Previously, TSC did not reliably re-enable its steps as the TSC irq handler received > false pen up events. Hence, in order to use TSC after ADC operation, it was necessary to > save and re-enable TSC steps (basically, to keep TSC steps enabled always). > The change was more of a workaround to overcome limitation of TSC irq handler. With > this series of patches, TSC irq handler is very reliable and the workaround is no longer required. Okay, thanks for the explanation. By the way, your mailer doesn't appear to quote previous messages. Is there any way to fix that? > > am335x_tscadc_need_adc(tsadc); > > > > tscadc_writel(tsadc, REG_SE, val); > > diff --git a/include/linux/mfd/ti_am335x_tscadc.h > > b/include/linux/mfd/ti_am335x_tscadc.h > > index c99be5dc0f5c..fcce182e4a35 100644 > > --- a/include/linux/mfd/ti_am335x_tscadc.h > > +++ b/include/linux/mfd/ti_am335x_tscadc.h > > @@ -128,6 +128,7 @@ > > > > /* Sequencer Status */ > > #define SEQ_STATUS BIT(5) > > +#define CHARGE_STEP 0x11 > > > > #define ADC_CLK 3000000 > > #define TOTAL_STEPS 16 >
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c index d877e777cce6..110038859a8d 100644 --- a/drivers/mfd/ti_am335x_tscadc.c +++ b/drivers/mfd/ti_am335x_tscadc.c @@ -86,8 +86,12 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc) spin_lock_irq(&tsadc->reg_lock); finish_wait(&tsadc->reg_se_wait, &wait); + /* + * Sequencer should either be idle or + * busy applying the charge step. + */ reg = tscadc_readl(tsadc, REG_ADCFSM); - WARN_ON(reg & SEQ_STATUS); + WARN_ON((reg & SEQ_STATUS) && !(reg & CHARGE_STEP)); tsadc->adc_waiting = false; } tsadc->adc_in_use = true; @@ -96,7 +100,6 @@ static void am335x_tscadc_need_adc(struct ti_tscadc_dev *tsadc) void am335x_tsc_se_set_once(struct ti_tscadc_dev *tsadc, u32 val) { spin_lock_irq(&tsadc->reg_lock); - tsadc->reg_se_cache |= val; am335x_tscadc_need_adc(tsadc); tscadc_writel(tsadc, REG_SE, val); diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h index c99be5dc0f5c..fcce182e4a35 100644 --- a/include/linux/mfd/ti_am335x_tscadc.h +++ b/include/linux/mfd/ti_am335x_tscadc.h @@ -128,6 +128,7 @@ /* Sequencer Status */ #define SEQ_STATUS BIT(5) +#define CHARGE_STEP 0x11 #define ADC_CLK 3000000 #define TOTAL_STEPS 16
In one shot mode, sequencer automatically disables all enabled steps at the end of each cycle. (both ADC steps and TSC steps) Hence these steps need not be saved in reg_se_cache for clearing these steps at a later stage. Also, when ADC wakes up Sequencer should not be busy executing any of the config steps except for the charge step. Previously charge step was 1 ADC clock cycle and hence it was ignored. Signed-off-by: Vignesh R <vigneshr@ti.com> --- drivers/mfd/ti_am335x_tscadc.c | 7 +++++-- include/linux/mfd/ti_am335x_tscadc.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-)