This patch series enables ADC to be clocked at 24MHz as the
TI AM335x ADC driver has already adopted to use DMA to transfer
ADC samples. Now ADC can generated upto 800K Samples per second
with the patch [1] on AM335x BBB and AM437x GP EVM.
when ADC ref clock is set at 24MHz, I am seeing some issue with
touch screen pointer as the pointer jumps to random locations
with free draw application. The issue is due to increase in ADC
clock and charge delay for the touchscreen ADC line duration
reduced.
So the notation of ti,charge-delay in terms of ADC clock is
wrong, it has to be represented in time and driver has to convert
the charge delay time to ADC clocks based on what ADC clock
frequency is set.
Measured the performance with the iio_generic_buffer with the
patch [2] applied
Verified the touch screen on AM335x GP EVM and AM335x BBB LCD7
cape with [3] dts for display and touch screen to work.
Changes from initial version:
* Removed modification to STEPCONFIG_OPENDLY defined as it
doesn't affect/improve touchscreen performance.
* Changed ti,charge-delay to ti,charge-delay-ns
[1] - http://pastebin.ubuntu.com/23357935/
[2] - http://pastebin.ubuntu.com/23357939/
[3] - http://pastebin.ubuntu.com/23456616/
Mugunthan V N (3):
dt/binding: ti-tsc-adc: deprecate ti,charge-delay and add binding doc
for ti,charge-delay-ns
Input: ti_am335x_tsc: Add support for ti,charge-delay-ns
drivers: mfd: ti_am335x_tscadc: increase ADC ref clock to 24MHz
.../bindings/input/touchscreen/ti-tsc-adc.txt | 32 ++++++++++++++--------
drivers/input/touchscreen/ti_am335x_tsc.c | 31 +++++++++++++++------
include/linux/mfd/ti_am335x_tscadc.h | 2 +-
3 files changed, 45 insertions(+), 20 deletions(-)
--
2.11.0.rc0.7.gbe5a750
ti,charge-delay represents the duration that ADC should wait
before sampling the ADC line to detect the touch location and pen
up/downs. Currently the ADC clock is set at 3MHz. The device-tree
entry for ti,charge-delay is based on assumption of ADC clock at
3MHz, but it can be operated up to 24MHz clock. Representing the
charge delay of touchscreen in terms of ADC clocks is incorrect.
So change this representation to ti,charge-delay-ns, which driver
can convert it to number clock cycles based on ref clock
frequency.
Signed-off-by: Mugunthan V N <[email protected]>
---
.../bindings/input/touchscreen/ti-tsc-adc.txt | 32 ++++++++++++++--------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
index b1163bf97146..83570776c804 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
@@ -30,17 +30,27 @@ Required properties:
Optional properties:
- child "tsc"
- ti,charge-delay: Length of touch screen charge delay step in terms of
- ADC clock cycles. Charge delay value should be large
- in order to avoid false pen-up events. This value
- effects the overall sampling speed, hence need to be
- kept as low as possible, while avoiding false pen-up
- event. Start from a lower value, say 0x400, and
- increase value until false pen-up events are avoided.
- The pen-up detection happens immediately after the
- charge step, so this does in fact function as a
- hardware knob for adjusting the amount of "settling
- time".
+ ti,charge-delay-ns: Length of touch screen charge delay step in terms of
+ nano Seconds. Charge delay value should be large
+ in order to avoid false pen-up events. This value
+ effects the overall sampling speed, hence need to be
+ kept as low as possible, while avoiding false pen-up
+ event. Start from a lower value, say 41000nS, and
+ increase value until false pen-up events are avoided.
+ The pen-up detection happens immediately after the
+ charge step, so this does in fact function as a
+ hardware knob for adjusting the amount of "settling
+ time".
+ ti,charge-delay: Deprecated as representing charge delay should be
+ represented in time as the ADC clock may be different.
+ Currently this value is calculated based on 3MHz ADC
+ ref clock, but ADC clock can operate upto 24MHz clock.
+ ADC clock will be changed to 24MHz to increase the
+ number of ADC samples. So to keep the backward
+ compatibility, driver will consider this value is
+ calculated for 3MHz clock so the value will be
+ multiplied by 8 to compensate the change in reference
+ clock.
- child "adc"
ti,chan-step-opendelay: List of open delays for each channel of
--
2.11.0.rc0.7.gbe5a750
Increase ADC reference clock from 3MHz to 24MHz so that the
sampling rates goes up from 100K samples per second to 800K
samples per second on AM335x and AM437x SoC.
Signed-off-by: Mugunthan V N <[email protected]>
---
include/linux/mfd/ti_am335x_tscadc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index b9a53e013bff..f6c449b96ea5 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -137,7 +137,7 @@
#define SEQ_STATUS BIT(5)
#define CHARGE_STEP 0x11
-#define ADC_CLK 3000000
+#define ADC_CLK 24000000
#define TOTAL_STEPS 16
#define TOTAL_CHANNELS 8
#define FIFO1_THRESHOLD 19
--
2.11.0.rc0.7.gbe5a750
ti,charge-delay will be deprecated as it represents number of
clock cycles and the DT entries are done in assumption of 3MHz
TSCADC clock, but clock can be set upto 24MHz. So driver add
support for ti,charge-delay-ns and do not drop support for
ti,charge-delay to support old dtbs and it will be assumed that
it is for 3MHz TSCADC clock and will be calculated as per current
clock speed.
Signed-off-by: Mugunthan V N <[email protected]>
---
drivers/input/touchscreen/ti_am335x_tsc.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 7953381d939a..104b3640f728 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -379,15 +379,30 @@ static int titsc_parse_dt(struct platform_device *pdev,
ts_dev->coordinate_readouts = 5;
}
- err = of_property_read_u32(node, "ti,charge-delay",
+ err = of_property_read_u32(node, "ti,charge-delay-ns",
&ts_dev->charge_delay);
- /*
- * If ti,charge-delay value is not specified, then use
- * CHARGEDLY_OPENDLY as the default value.
- */
- if (err < 0) {
- ts_dev->charge_delay = CHARGEDLY_OPENDLY;
- dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
+ if (err >= 0) {
+ u64 charge_delay = ts_dev->charge_delay;
+
+ charge_delay *= ADC_CLK;
+ do_div(charge_delay, 1E9);
+ ts_dev->charge_delay = (u32)charge_delay;
+ } else {
+ err = of_property_read_u32(node, "ti,charge-delay",
+ &ts_dev->charge_delay);
+ /*
+ * If ti,charge-delay value is not specified, then use
+ * CHARGEDLY_OPENDLY as the default value.
+ */
+ if (err < 0) {
+ ts_dev->charge_delay = CHARGEDLY_OPENDLY;
+ dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
+ }
+ /*
+ * ti,charge-delay is specified with referrence to 3MHz,
+ * so convert it to in referrence to current clock
+ */
+ ts_dev->charge_delay *= ADC_CLK / 3000000;
}
return of_property_read_u32_array(node, "ti,wire-config",
--
2.11.0.rc0.7.gbe5a750
On Thu, Nov 10, 2016 at 10:05:13PM +0530, Mugunthan V N wrote:
> ti,charge-delay represents the duration that ADC should wait
> before sampling the ADC line to detect the touch location and pen
> up/downs. Currently the ADC clock is set at 3MHz. The device-tree
> entry for ti,charge-delay is based on assumption of ADC clock at
> 3MHz, but it can be operated up to 24MHz clock. Representing the
> charge delay of touchscreen in terms of ADC clocks is incorrect.
> So change this representation to ti,charge-delay-ns, which driver
> can convert it to number clock cycles based on ref clock
> frequency.
>
> Signed-off-by: Mugunthan V N <[email protected]>
> ---
> .../bindings/input/touchscreen/ti-tsc-adc.txt | 32 ++++++++++++++--------
> 1 file changed, 21 insertions(+), 11 deletions(-)
Acked-by: Rob Herring <[email protected]>
Don't make up $SUBJECT line format.
> Increase ADC reference clock from 3MHz to 24MHz so that the
> sampling rates goes up from 100K samples per second to 800K
> samples per second on AM335x and AM437x SoC.
>
> Signed-off-by: Mugunthan V N <[email protected]>
> ---
> include/linux/mfd/ti_am335x_tscadc.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Change looks okay though.
For my own reference:
Acked-for-MFD-by: Lee Jones <[email protected]>
> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index b9a53e013bff..f6c449b96ea5 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -137,7 +137,7 @@
> #define SEQ_STATUS BIT(5)
> #define CHARGE_STEP 0x11
>
> -#define ADC_CLK 3000000
> +#define ADC_CLK 24000000
> #define TOTAL_STEPS 16
> #define TOTAL_CHANNELS 8
> #define FIFO1_THRESHOLD 19
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Hi Dmitry Torokhov,
On Thursday 10 November 2016 10:05 PM, Mugunthan V N wrote:
> This patch series enables ADC to be clocked at 24MHz as the
> TI AM335x ADC driver has already adopted to use DMA to transfer
> ADC samples. Now ADC can generated upto 800K Samples per second
> with the patch [1] on AM335x BBB and AM437x GP EVM.
>
> when ADC ref clock is set at 24MHz, I am seeing some issue with
> touch screen pointer as the pointer jumps to random locations
> with free draw application. The issue is due to increase in ADC
> clock and charge delay for the touchscreen ADC line duration
> reduced.
>
> So the notation of ti,charge-delay in terms of ADC clock is
> wrong, it has to be represented in time and driver has to convert
> the charge delay time to ADC clocks based on what ADC clock
> frequency is set.
>
> Measured the performance with the iio_generic_buffer with the
> patch [2] applied
>
> Verified the touch screen on AM335x GP EVM and AM335x BBB LCD7
> cape with [3] dts for display and touch screen to work.
>
Since there are acks from DT and MFD maintainers, can you pull the patch
series if you do not have any more comments.
Regards
Mugunthan V N
On Fri, 25 Nov 2016, Mugunthan V N wrote:
> Hi Dmitry Torokhov,
>
> On Thursday 10 November 2016 10:05 PM, Mugunthan V N wrote:
> > This patch series enables ADC to be clocked at 24MHz as the
> > TI AM335x ADC driver has already adopted to use DMA to transfer
> > ADC samples. Now ADC can generated upto 800K Samples per second
> > with the patch [1] on AM335x BBB and AM437x GP EVM.
> >
> > when ADC ref clock is set at 24MHz, I am seeing some issue with
> > touch screen pointer as the pointer jumps to random locations
> > with free draw application. The issue is due to increase in ADC
> > clock and charge delay for the touchscreen ADC line duration
> > reduced.
> >
> > So the notation of ti,charge-delay in terms of ADC clock is
> > wrong, it has to be represented in time and driver has to convert
> > the charge delay time to ADC clocks based on what ADC clock
> > frequency is set.
> >
> > Measured the performance with the iio_generic_buffer with the
> > patch [2] applied
> >
> > Verified the touch screen on AM335x GP EVM and AM335x BBB LCD7
> > cape with [3] dts for display and touch screen to work.
> >
>
> Since there are acks from DT and MFD maintainers, can you pull the patch
> series if you do not have any more comments.
Cant do anything without *all* Acks.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
On Friday 25 November 2016 03:29 PM, Lee Jones wrote:
> On Fri, 25 Nov 2016, Mugunthan V N wrote:
>
>> Hi Dmitry Torokhov,
>>
>> On Thursday 10 November 2016 10:05 PM, Mugunthan V N wrote:
>>> This patch series enables ADC to be clocked at 24MHz as the
>>> TI AM335x ADC driver has already adopted to use DMA to transfer
>>> ADC samples. Now ADC can generated upto 800K Samples per second
>>> with the patch [1] on AM335x BBB and AM437x GP EVM.
>>>
>>> when ADC ref clock is set at 24MHz, I am seeing some issue with
>>> touch screen pointer as the pointer jumps to random locations
>>> with free draw application. The issue is due to increase in ADC
>>> clock and charge delay for the touchscreen ADC line duration
>>> reduced.
>>>
>>> So the notation of ti,charge-delay in terms of ADC clock is
>>> wrong, it has to be represented in time and driver has to convert
>>> the charge delay time to ADC clocks based on what ADC clock
>>> frequency is set.
>>>
>>> Measured the performance with the iio_generic_buffer with the
>>> patch [2] applied
>>>
>>> Verified the touch screen on AM335x GP EVM and AM335x BBB LCD7
>>> cape with [3] dts for display and touch screen to work.
>>>
>>
>> Since there are acks from DT and MFD maintainers, can you pull the patch
>> series if you do not have any more comments.
>
> Cant do anything without *all* Acks.
>
Hi Dmitry Torokhov,
Can you provide your inputs on the patch series.
Regards
Mugunthan V N
On Fri, Nov 11, 2016 at 01:28:19PM +0530, Mugunthan V N wrote:
> ti,charge-delay will be deprecated as it represents number of
> clock cycles and the DT entries are done in assumption of 3MHz
> TSCADC clock, but clock can be set upto 24MHz. So driver add
> support for ti,charge-delay-ns and do not drop support for
> ti,charge-delay to support old dtbs and it will be assumed that
> it is for 3MHz TSCADC clock and will be calculated as per current
> clock speed.
>
> Signed-off-by: Mugunthan V N <[email protected]>
Acked-by: Dmitry Torokhov <[email protected]>
> ---
> drivers/input/touchscreen/ti_am335x_tsc.c | 31 +++++++++++++++++++++++--------
> 1 file changed, 23 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> index 7953381d939a..104b3640f728 100644
> --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> @@ -379,15 +379,30 @@ static int titsc_parse_dt(struct platform_device *pdev,
> ts_dev->coordinate_readouts = 5;
> }
>
> - err = of_property_read_u32(node, "ti,charge-delay",
> + err = of_property_read_u32(node, "ti,charge-delay-ns",
> &ts_dev->charge_delay);
> - /*
> - * If ti,charge-delay value is not specified, then use
> - * CHARGEDLY_OPENDLY as the default value.
> - */
> - if (err < 0) {
> - ts_dev->charge_delay = CHARGEDLY_OPENDLY;
> - dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
> + if (err >= 0) {
> + u64 charge_delay = ts_dev->charge_delay;
> +
> + charge_delay *= ADC_CLK;
> + do_div(charge_delay, 1E9);
> + ts_dev->charge_delay = (u32)charge_delay;
> + } else {
> + err = of_property_read_u32(node, "ti,charge-delay",
> + &ts_dev->charge_delay);
> + /*
> + * If ti,charge-delay value is not specified, then use
> + * CHARGEDLY_OPENDLY as the default value.
> + */
> + if (err < 0) {
> + ts_dev->charge_delay = CHARGEDLY_OPENDLY;
> + dev_warn(&pdev->dev, "ti,charge-delay not specified\n");
> + }
> + /*
> + * ti,charge-delay is specified with referrence to 3MHz,
> + * so convert it to in referrence to current clock
> + */
> + ts_dev->charge_delay *= ADC_CLK / 3000000;
> }
>
> return of_property_read_u32_array(node, "ti,wire-config",
> --
> 2.11.0.rc0.7.gbe5a750
>
--
Dmitry
On Tue, Nov 29, 2016 at 11:11:35AM +0530, Mugunthan V N wrote:
> On Friday 25 November 2016 03:29 PM, Lee Jones wrote:
> > On Fri, 25 Nov 2016, Mugunthan V N wrote:
> >
> >> Hi Dmitry Torokhov,
> >>
> >> On Thursday 10 November 2016 10:05 PM, Mugunthan V N wrote:
> >>> This patch series enables ADC to be clocked at 24MHz as the
> >>> TI AM335x ADC driver has already adopted to use DMA to transfer
> >>> ADC samples. Now ADC can generated upto 800K Samples per second
> >>> with the patch [1] on AM335x BBB and AM437x GP EVM.
> >>>
> >>> when ADC ref clock is set at 24MHz, I am seeing some issue with
> >>> touch screen pointer as the pointer jumps to random locations
> >>> with free draw application. The issue is due to increase in ADC
> >>> clock and charge delay for the touchscreen ADC line duration
> >>> reduced.
> >>>
> >>> So the notation of ti,charge-delay in terms of ADC clock is
> >>> wrong, it has to be represented in time and driver has to convert
> >>> the charge delay time to ADC clocks based on what ADC clock
> >>> frequency is set.
> >>>
> >>> Measured the performance with the iio_generic_buffer with the
> >>> patch [2] applied
> >>>
> >>> Verified the touch screen on AM335x GP EVM and AM335x BBB LCD7
> >>> cape with [3] dts for display and touch screen to work.
> >>>
> >>
> >> Since there are acks from DT and MFD maintainers, can you pull the patch
> >> series if you do not have any more comments.
> >
> > Cant do anything without *all* Acks.
> >
> Hi Dmitry Torokhov,
>
> Can you provide your inputs on the patch series.
You have my ack for the input bit.
--
Dmitry
Hi Lee Jones
On Wednesday 30 November 2016 02:39 AM, Dmitry Torokhov wrote:
> On Tue, Nov 29, 2016 at 11:11:35AM +0530, Mugunthan V N wrote:
>> On Friday 25 November 2016 03:29 PM, Lee Jones wrote:
>>> On Fri, 25 Nov 2016, Mugunthan V N wrote:
>>>
>>>> Hi Dmitry Torokhov,
>>>>
>>>> On Thursday 10 November 2016 10:05 PM, Mugunthan V N wrote:
>>>>> This patch series enables ADC to be clocked at 24MHz as the
>>>>> TI AM335x ADC driver has already adopted to use DMA to transfer
>>>>> ADC samples. Now ADC can generated upto 800K Samples per second
>>>>> with the patch [1] on AM335x BBB and AM437x GP EVM.
>>>>>
>>>>> when ADC ref clock is set at 24MHz, I am seeing some issue with
>>>>> touch screen pointer as the pointer jumps to random locations
>>>>> with free draw application. The issue is due to increase in ADC
>>>>> clock and charge delay for the touchscreen ADC line duration
>>>>> reduced.
>>>>>
>>>>> So the notation of ti,charge-delay in terms of ADC clock is
>>>>> wrong, it has to be represented in time and driver has to convert
>>>>> the charge delay time to ADC clocks based on what ADC clock
>>>>> frequency is set.
>>>>>
>>>>> Measured the performance with the iio_generic_buffer with the
>>>>> patch [2] applied
>>>>>
>>>>> Verified the touch screen on AM335x GP EVM and AM335x BBB LCD7
>>>>> cape with [3] dts for display and touch screen to work.
>>>>>
>>>>
>>>> Since there are acks from DT and MFD maintainers, can you pull the patch
>>>> series if you do not have any more comments.
>>>
>>> Cant do anything without *all* Acks.
>>>
>> Hi Dmitry Torokhov,
>>
>> Can you provide your inputs on the patch series.
>
> You have my ack for the input bit.
>
A gentle ping
Regards
Mugunthan V N