linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/4] thermal: rockchip: add driver for thermal
Date: Sat, 30 Aug 2014 10:30:37 +0100	[thread overview]
Message-ID: <540199BD.7000504@kernel.org> (raw)
In-Reply-To: <54006D4C.2070404@rock-chips.com>

On 29/08/14 13:08, Huang Tao wrote:
> Dear Eduardo Bezerra Valentin:
> 
> ? 2014?08?29? 19:39, edubezval at gmail.com ??:
>> Hello Zhao,
>>
>> On Thu, Aug 28, 2014 at 9:54 PM, ??? <zyf@rock-chips.com> wrote:
>>> Hi Heiko?
>>>
>>>    The TS-ADC on RK3288 has two component, a tsadc and a tsadc controller.
>>> The tsadc controller is similar like the thermal manager unit on other SOCs.
>>> We followed the naming of 3066, but not named as the Thermal Manager.
>>>
>>>    Moreover,there is only one set of apb registers to access the tsadc
>>> controller,and the tsadc is controlled by the tsadc controller,could not
>>> access directly. If we write a general tsadc driver by accessed tsadc
>>> controller registers, and it hardly to write a driver for the tsadc
>>> controller.
>> As suggested by Arnd, you can use the generic driver as interface
>> between thermal framework and IIO layer. The driver you are going to
>> write to your ADC is going to be in the IIO subsystem. The only
>> difference is that the generic driver would work for any ADC driver in
>> the IIO subsystem.
>> https://lkml.org/lkml/2014/2/5/810
>>
>> In fact, there is already a generic driver. We just need to get it up
>> to date.  I see some testing has been already done, and results sound
>> promising.
> This iio_thermal driver only support get temperature from the ADC IIO
> channel.
> It dose not support any advanced feature such as configure the
> temperature when system should be reset.
> So if we adapt it, we will access the register form both TSADC IIO
> driver and  thermal driver.
> I don't thank this is a good ideal.

Interesting bit of functionality.  I agree this doesn't fit overwelmingly well
into an iio consumer driver as things currently stand.

Looking briefly at your code, this is basically a threshold interrupt?
If so then we do have threshold type event handling in IIO (simply termed
events).  The snag is that it is the one area that doesn't currently have
any in kernel interfaces.

Such an interface would be similar to that used for the buffered data access (raw
data stream - we should probably rename that as it isn't always buffered anymore).
The nasty bit (as it was with the buffered interface) is writing a reasonably
efficient demux that can split out the data to those devices that have registered
their interest in it. It would involve some additional code in iio_push_event and
some indirection in the code that controls what events are enabled.
Actually, you could probably skip this an just squirt all events recieved out through
the direct IIO to userspace interface (nothing prevents another process turning
more on anyway!).  We could event for now specify that any in kernel users might
get other events and it is up to them to sanity check them.

We'd also need to add some basic access functions to set limits etc.

I'm afraid the 'events' bit of IIO is one of our least developed elements and is
lagging way behind the work done on the main data flows. It's been on the
list for a while, particularly as we need it to finish separating the
userspace interfaces of IIO from the backend.

So, looking at the wider picture, with a few additions to IIO we can support
some ADC based thermal drivers - whether all of them is a bit dependent on
whether they have weird and wonderful domain specific hardware (which I might
have missed here, but does not seem to be present).

Note this is based on a rather brief scan read so I may well have missed some
important details!
> 
> In fact, we should ignore the "ADC" stuff. This sensor use ADC internal,
> but it is transparent to software, especially in automatic mode.
Is this adc ever used for anything else?  If so, then there is your reason to
go through the pain of a generic driver.

Jonathan

p.s. I'd never seen the driver Arnd highlighted.  Could anyone working on
IIO clients cc linux-iio at vger.kernel.org as it's useful to know what people
are using the interfaces for (particularly as they might change so it is
good to know what is in the pipeline).
>>
>>>    So, I do not agree to write a generic adc driver for the rk3288-tsadc.
>>>
>>> ________________________________
>>> Yifeng Zhao
>>>
>>>
> 
> 

  reply	other threads:[~2014-08-30  9:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28  0:59 [PATCH v3 0/4] Rockchip soc theamal driver Caesar Wang
2014-08-28  0:59 ` [PATCH v3 1/4] thermal: rockchip: add driver for thermal Caesar Wang
2014-08-28  8:48   ` Arnd Bergmann
2014-08-28 14:37     ` Eduardo Valentin
2014-08-28 16:11       ` Heiko Stübner
2014-08-28 16:16         ` Arnd Bergmann
2014-08-28 19:36           ` Caesar Wang
2014-08-28 23:01             ` Heiko Stübner
     [not found]         ` <2014082909531345696848@rock-chips.com>
2014-08-29 11:39           ` edubezval at gmail.com
2014-08-29 12:08             ` Huang Tao
2014-08-30  9:30               ` Jonathan Cameron [this message]
2014-08-28  0:59 ` [PATCH v3 2/4] dt-bindings: document Rockchip thermal Caesar Wang
2014-08-28  0:59 ` [PATCH v3 3/4] ARM: dts: add main Thermal info to rk3288 Caesar Wang
2014-08-28  0:59 ` [PATCH v4 4/4] ARM: dts: enable Thermal on rk3288-evb board Caesar Wang

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=540199BD.7000504@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).