All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Mugunthan V N <mugunthanvnm-l0cyMroinI0@public.gmane.org>
Cc: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>,
	Vignesh R <vigneshr-l0cyMroinI0@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 2/3] Input: ti_am335x_tsc: Add support for ti,charge-delay-ns
Date: Tue, 29 Nov 2016 13:09:17 -0800	[thread overview]
Message-ID: <20161129210917.GA20680@dtor-ws> (raw)
In-Reply-To: <20161111075819.5760-1-mugunthanvnm-l0cyMroinI0@public.gmane.org>

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 <mugunthanvnm-l0cyMroinI0@public.gmane.org>

Acked-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Mugunthan V N <mugunthanvnm@ti.com>
Cc: linux-input@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Lee Jones <lee.jones@linaro.org>, Sekhar Nori <nsekhar@ti.com>,
	Vignesh R <vigneshr@ti.com>,
	devicetree@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] Input: ti_am335x_tsc: Add support for ti,charge-delay-ns
Date: Tue, 29 Nov 2016 13:09:17 -0800	[thread overview]
Message-ID: <20161129210917.GA20680@dtor-ws> (raw)
In-Reply-To: <20161111075819.5760-1-mugunthanvnm@ti.com>

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 <mugunthanvnm@ti.com>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
>  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

  parent reply	other threads:[~2016-11-29 21:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 16:35 [PATCH v2 0/3] increase TSCADC clock to 24MHz and fix ti,charge-delay to represent in nS Mugunthan V N
2016-11-10 16:35 ` Mugunthan V N
     [not found] ` <20161110163515.27598-1-mugunthanvnm-l0cyMroinI0@public.gmane.org>
2016-11-10 16:35   ` [PATCH v2 1/3] dt/binding: ti-tsc-adc: deprecate ti,charge-delay and add binding doc for ti,charge-delay-ns Mugunthan V N
2016-11-10 16:35     ` Mugunthan V N
2016-11-15  1:54     ` Rob Herring
2016-11-11  7:58   ` [PATCH v2 2/3] Input: ti_am335x_tsc: Add support " Mugunthan V N
2016-11-11  7:58     ` Mugunthan V N
     [not found]     ` <20161111075819.5760-1-mugunthanvnm-l0cyMroinI0@public.gmane.org>
2016-11-29 21:09       ` Dmitry Torokhov [this message]
2016-11-29 21:09         ` Dmitry Torokhov
2016-11-11  7:58   ` [PATCH v2 3/3] drivers: mfd: ti_am335x_tscadc: increase ADC ref clock to 24MHz Mugunthan V N
2016-11-11  7:58     ` Mugunthan V N
     [not found]     ` <20161111075838.5815-1-mugunthanvnm-l0cyMroinI0@public.gmane.org>
2016-11-22 13:04       ` Lee Jones
2016-11-22 13:04         ` Lee Jones
2016-11-25  4:57 ` [PATCH v2 0/3] increase TSCADC clock to 24MHz and fix ti,charge-delay to represent in nS Mugunthan V N
2016-11-25  4:57   ` Mugunthan V N
2016-11-25  9:59   ` Lee Jones
     [not found]     ` <20161125095918.GZ10134-Re9dqnLqz4GzQB+pC5nmwQ@public.gmane.org>
2016-11-29  5:41       ` Mugunthan V N
2016-11-29  5:41         ` Mugunthan V N
2016-11-29 21:09         ` Dmitry Torokhov
2016-12-05  3:54           ` Mugunthan V N
2016-12-05  3:54             ` Mugunthan V N

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161129210917.GA20680@dtor-ws \
    --to=dmitry.torokhov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mugunthanvnm-l0cyMroinI0@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vigneshr-l0cyMroinI0@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.