Hi Michael,
On 08/03/2017 11:33, Michael Weiser wrote:
> Hi Quentin,
>
> On Wed, Mar 08, 2017 at 10:35:54AM +0100, Quentin Schulz wrote:
>
>>> Still no sensor reading though. I guess, I'll wait for 4.12 and see.
>> Hum, no. Let's get that fixed (if it's a bug) before reaching 4.12 :)
>
>> Have you applied this[1] patch as well or enabled CONFIG_OF_THERMAL?
>
>> [1]
https://patchwork.kernel.org/patch/9472443/
>
> Well, the patch is in but the setting didn't make it from the defconfig
> to my config. My bad. Now it's sensoring as expected:
>
> # sensors
> iio_hwmon-isa-0000
> Adapter: ISA adapter
> temp1: +28.4°C
>
> Thanks for your help!
>
Cool!
> On a general note: Am I right in my perception that there's currently a
> trend in the Linux kernel to have things abstracted to such a degree
> and spread across so large a number of independent subsystems that it's
> not possible any more and doesn't make sense to have settings depend on
> each other in a manner that a single switch can enable a whole function?
>
> iio_hwmon-isa-0000 = (SENSORS_IIO_HWMON | MFD_SUN4I_GPADC | SUN4I_GPADC | THERMAL_OF)
>
Not sure I get what you mean, correct me if I don't.
Hardware components tend to be more and more complex with a lot of
different "sub-"components. For example, the AXP20X PMICs have ADCs,
GPIOs, handle different power supplies, handle power buttons, handle
battery fuel gauge, etc... You need to separate all that in different
drivers so you can take the most from each impacted subsystem and have
multiple simple drivers rather than one unmaintainable gigantic driver
doing everything.
The point to have also multiple simple drivers is that some components
have parts or "sub-"components that are almost the same across different
series of components or brands. This allows us to reuse the maximum code
we can, or adapt existing code to add support for a new component. If we
had to write a big driver for it, it would be just tedious and totally
unmaintainable.
This adds a complexity layer on the Kconfig though, as for example,
within the same driver some parts cannot be used for different
components. The driver is still the same, the Kconfig option is still
the same but depending on the hardware, you'll need to add such or such
additional Kconfig option to take the most of your driver.
If we had to say for this driver to work on this SoC or board, you need
to enable such or such options... that would be a huge list and
something to maintain.
> This is the second instance where I had to chase some quite non-obvious
> dependencies with no aid from Kconfig to get something working on my
> Cubieboard. (I think the last one had to do with pinctrl and gpio - not
> sure.)
>
> In the current case: Maybe the help text of SUN4I_GPADC could be
> adjusted to state clearly that THERMAL_OF is required for the sensor to
> work?
>
The patch enables CONFIG_THERMAL_OF by default for all sunxi platforms.
The Kconfig states that you can disable it if you want to get rid of the
thermal sensor. That should be enough IMHO.
> "For the thermal sensor to work, CONFIG_THERMAL_OF needs to be enabled as
> well. The thermal sensor does slow down ADC readings though. This can be
> avoided by not enabling CONFIG_THERMAL_OF. However, the thermal sensor
> should be enabled by default since the SoC temperature is usually more
> critical than ADC readings."
>