All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: Eduardo Valentin <edubezval@gmail.com>
Cc: <jic23@kernel.org>, <robh@kernel.org>, <rui.zhang@intel.com>,
	<mark.rutland@arm.com>, <pawel.moll@arm.com>,
	<ijc+devicetree@hellion.org.uk>, <linux-pm@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-iio@vger.kernel.org>
Subject: Re: [PATCH V4 2/2] thermal: generic-adc: Add ADC based thermal sensor driver
Date: Thu, 21 Apr 2016 06:42:16 +0530	[thread overview]
Message-ID: <571828F0.8000101@nvidia.com> (raw)
In-Reply-To: <20160420234322.GA2558@localhost.localdomain>


On Thursday 21 April 2016 05:13 AM, Eduardo Valentin wrote:
> Laxman,
>
> On Tue, Apr 19, 2016 at 12:52:01PM +0530, Laxman Dewangan wrote:
>> In some of platform, thermal sensors like NCT thermistors are
>> connected to the one of ADC channel. The temperature is read by
>> reading the voltage across the sensor resistance via ADC. Lookup
>> table for ADC read value to temperature is referred to get
>> temperature. ADC is read via IIO framework.
>>
>> Add support for thermal sensor driver which read the voltage across
>> sensor resistance from ADC through IIO framework.
>>
>> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> I really like this driver, as I mentioned  before. Just one comment
> though.
>
>> +
>> +	gti->tz_dev = thermal_zone_of_sensor_register(&pdev->dev, 0,
>> +						      gti, &gadc_thermal_ops);
> Why not using the devm_ version you introduced?
>
> Any particular reason?
>

Yaah, the reason is just to maintain the proper sequence in releasing of 
resource during driver unbinding.

Sequence in probe are:
         iio_channel_get()
         thermal_zone_of_sensor_register()

and on release, sensor should be released first before iio channel.
As of now, we do not have devm_iio_channel_get() [I already post patch 
and it is accepted by Jonathan in iio sub system] and hence I can not 
use the devm_ for sensor register to avoid race.

However, once the devm_ for iio channel get available in all subsystem 
(may be in next release), I will post the patch to use devm_.

Currently, we can go with these APIs.

WARNING: multiple messages have this Message-ID (diff)
From: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Eduardo Valentin <edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V4 2/2] thermal: generic-adc: Add ADC based thermal sensor driver
Date: Thu, 21 Apr 2016 06:42:16 +0530	[thread overview]
Message-ID: <571828F0.8000101@nvidia.com> (raw)
In-Reply-To: <20160420234322.GA2558-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>


On Thursday 21 April 2016 05:13 AM, Eduardo Valentin wrote:
> Laxman,
>
> On Tue, Apr 19, 2016 at 12:52:01PM +0530, Laxman Dewangan wrote:
>> In some of platform, thermal sensors like NCT thermistors are
>> connected to the one of ADC channel. The temperature is read by
>> reading the voltage across the sensor resistance via ADC. Lookup
>> table for ADC read value to temperature is referred to get
>> temperature. ADC is read via IIO framework.
>>
>> Add support for thermal sensor driver which read the voltage across
>> sensor resistance from ADC through IIO framework.
>>
>> Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> I really like this driver, as I mentioned  before. Just one comment
> though.
>
>> +
>> +	gti->tz_dev = thermal_zone_of_sensor_register(&pdev->dev, 0,
>> +						      gti, &gadc_thermal_ops);
> Why not using the devm_ version you introduced?
>
> Any particular reason?
>

Yaah, the reason is just to maintain the proper sequence in releasing of 
resource during driver unbinding.

Sequence in probe are:
         iio_channel_get()
         thermal_zone_of_sensor_register()

and on release, sensor should be released first before iio channel.
As of now, we do not have devm_iio_channel_get() [I already post patch 
and it is accepted by Jonathan in iio sub system] and hence I can not 
use the devm_ for sensor register to avoid race.

However, once the devm_ for iio channel get available in all subsystem 
(may be in next release), I will post the patch to use devm_.

Currently, we can go with these APIs.

  reply	other threads:[~2016-04-21  1:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19  7:22 [PATCH V4 1/2] thermal: generic-adc: Add DT binding for ADC based thermal sensor Laxman Dewangan
2016-04-19  7:22 ` Laxman Dewangan
2016-04-19  7:22 ` [PATCH V4 2/2] thermal: generic-adc: Add ADC based thermal sensor driver Laxman Dewangan
2016-04-19  7:22   ` Laxman Dewangan
2016-04-19 19:02   ` Jonathan Cameron
2016-04-19 19:02     ` Jonathan Cameron
2016-04-20 23:43   ` Eduardo Valentin
2016-04-21  1:12     ` Laxman Dewangan [this message]
2016-04-21  1:12       ` Laxman Dewangan
2016-04-21  2:50       ` Eduardo Valentin
2016-04-21  2:50         ` Eduardo Valentin

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=571828F0.8000101@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=devicetree@vger.kernel.org \
    --cc=edubezval@gmail.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    /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.