[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <540199BD.7000504@kernel.org>
Date: Sat, 30 Aug 2014 10:30:37 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Huang Tao <huangtao@...k-chips.com>,
"edubezval@...il.com" <edubezval@...il.com>,
赵仪峰 <zyf@...k-chips.com>
CC: HeikoStübner <heiko@...ech.de>,
Arnd Bergmann <arnd@...db.de>,
Caesar Wang <caesar.wang@...k-chips.com>,
"rui.zhang" <rui.zhang@...el.com>,
"grant.likely" <grant.likely@...aro.org>,
robh+dt <robh+dt@...nel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-pm <linux-pm@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
devicetree <devicetree@...r.kernel.org>,
linux-doc <linux-doc@...r.kernel.org>,
蔡枫 <cf@...k-chips.com>,
dianders <dianders@...omium.org>, dtor <dtor@...omium.org>,
钟勇汪 <zyw@...k-chips.com>,
"addy.ke@...k-chips.com" <addy.ke@...k-chips.com>,
"dmitry.torokhov" <dmitry.torokhov@...il.com>,
linux-iio <linux-iio@...r.kernel.org>
Subject: Re: [PATCH v3 1/4] thermal: rockchip: add driver for thermal
On 29/08/14 13:08, Huang Tao wrote:
> Dear Eduardo Bezerra Valentin:
>
> 在 2014年08月29日 19:39, edubezval@...il.com 写道:
>> Hello Zhao,
>>
>> On Thu, Aug 28, 2014 at 9:54 PM, 赵仪峰 <zyf@...k-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@...r.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
>>>
>>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists