[PATCH v3 1/4] thermal: rockchip: add driver for thermal

Jonathan Cameron jic23 at kernel.org
Sat Aug 30 02:30:37 PDT 2014


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



More information about the linux-arm-kernel mailing list