linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] add support for Allwinner SoCs ADC
@ 2016-07-26  7:43 Quentin Schulz
  2016-07-26  7:43 ` [PATCH v3 1/4] hwmon: iio_hwmon: delay probing with late_initcall Quentin Schulz
                   ` (3 more replies)
  0 siblings, 4 replies; 32+ messages in thread
From: Quentin Schulz @ 2016-07-26  7:43 UTC (permalink / raw)
  To: jdelvare, linux, jic23, knaack.h, lars, pmeerw, maxime.ripard,
	wens, lee.jones
  Cc: Quentin Schulz, linux-kernel, linux-hwmon, linux-iio,
	linux-arm-kernel, thomas.petazzoni, antoine.tenart

The Allwinner SoCs all have an ADC that can also act as a touchscreen
controller and a thermal sensor. The first four channels can be used either
for the ADC or the touchscreen and the fifth channel is used for the
thermal sensor. We currently have a driver for the two latter functions in
drivers/input/touchscreen/sun4i-ts.c but we don't have access to the ADC
feature at all. It is meant to replace the current driver by using MFD and
subdrivers.

This adds initial support for Allwinner SoCs ADC with all features. Yet,
the touchscreen is not implemented but will be added later. To switch
between touchscreen and ADC modes, you need to poke a few bits in registers
and (de)activate an interrupt (pen-up).
An MFD is provided to let the input driver activate the pen-up interrupt
through a virtual interrupt, poke a few bits via regmap and read data from
the ADC driver while both (and iio_hwmon) are probed by the MFD.

There are slight variations between the different SoCs ADC like the address
of some registers and the scale and offset to apply to raw thermal sensor
values. These variations are handled by using different platform_device_id,
passed to the sub-drivers when they are probed by the MFD.

Currently when no iio channel is found, the probing of iio-hwmon fails.
This is problematic when iio-hwmon probes before the iio driver could
register iio channels to share. Thus, this modifies iio-hwmon to probe late
with late_initcall making sure all drivers which provides iio channels have
probed before iio_hwmon.

When an MFD cell has an of_compatible (meaning it is present in the Device
Tree), other nodes can reference it using a phandle.
However when the MFD cell is not declared in the Device Tree, the only way
other nodes can reference it are by using a phandle to the MFD. Then when
this MFD cell tries to register itself in one framework, the registration
is denied by the framework because it is not matching the of_node of the
node which is referenced by the phandle in one of the other nodes.
This reattaches the of_node of the MFD to the MFD cell device structure
when the MFD cell has no of_compatible.
We need this modification to register the thermal sensor in the thermal
framework.

Removal of proposed patch for iio_hwmon's iio channel's label in v3. The
patch induces irreversible ABI changes and will be handled as a separate
patch since I think it is not absolutely necessary to have labels yet in
iio_hwmon.

Quentin Schulz (4):
  hwmon: iio_hwmon: delay probing with late_initcall
  mfd: add support for Allwinner SoCs ADC
  mfd: mfd-core: reattach mfd of_node to cells without of_compatible
  iio: adc: add support for Allwinner SoCs ADC

 drivers/hwmon/iio_hwmon.c           |  16 +-
 drivers/iio/adc/Kconfig             |  12 +
 drivers/iio/adc/Makefile            |   1 +
 drivers/iio/adc/sunxi-gpadc-iio.c   | 513 ++++++++++++++++++++++++++++++++++++
 drivers/mfd/Kconfig                 |  15 ++
 drivers/mfd/Makefile                |   2 +
 drivers/mfd/mfd-core.c              |  14 +-
 drivers/mfd/sunxi-gpadc-mfd.c       | 189 +++++++++++++
 include/linux/mfd/sunxi-gpadc-mfd.h |  94 +++++++
 9 files changed, 850 insertions(+), 6 deletions(-)
 create mode 100644 drivers/iio/adc/sunxi-gpadc-iio.c
 create mode 100644 drivers/mfd/sunxi-gpadc-mfd.c
 create mode 100644 include/linux/mfd/sunxi-gpadc-mfd.h

-- 
2.5.0

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2016-09-03 19:33 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-26  7:43 [PATCH v3 0/4] add support for Allwinner SoCs ADC Quentin Schulz
2016-07-26  7:43 ` [PATCH v3 1/4] hwmon: iio_hwmon: delay probing with late_initcall Quentin Schulz
2016-07-26  7:48   ` Thomas Petazzoni
2016-07-26  7:55     ` Quentin Schulz
2016-07-26  8:21   ` Alexander Stein
2016-07-26  8:24     ` Quentin Schulz
2016-07-26  9:05       ` Alexander Stein
2016-07-26  9:33         ` Quentin Schulz
2016-07-26 10:00           ` Alexander Stein
2016-07-26 10:07             ` Quentin Schulz
2016-07-26 16:04             ` Guenter Roeck
2016-08-15 15:40               ` Jonathan Cameron
2016-08-15 17:07                 ` Guenter Roeck
2016-08-15 21:35                   ` Jonathan Cameron
2016-09-01  7:15                     ` Quentin Schulz
2016-09-01  9:03                       ` Quentin Schulz
2016-09-03 19:32                         ` Jonathan Cameron
2016-08-15 15:36           ` Jonathan Cameron
2016-07-26  7:43 ` [PATCH v3 2/4] mfd: add support for Allwinner SoCs ADC Quentin Schulz
2016-07-29  6:49   ` Maxime Ripard
2016-07-26  7:43 ` [PATCH v3 3/4] mfd: mfd-core: reattach mfd of_node to cells without of_compatible Quentin Schulz
2016-08-09 13:48   ` Lee Jones
2016-08-24  6:38     ` Maxime Ripard
2016-08-31 11:56       ` Lee Jones
2016-09-01  8:35         ` Quentin Schulz
2016-07-26  7:43 ` [PATCH v3 4/4] iio: adc: add support for Allwinner SoCs ADC Quentin Schulz
2016-07-29  7:12   ` Maxime Ripard
2016-08-04  8:41     ` Quentin Schulz
2016-08-24  6:41       ` Maxime Ripard
2016-08-04  9:56   ` Russell King - ARM Linux
2016-08-04 10:27     ` Quentin Schulz
2016-08-21 19:27   ` Jonathan Cameron

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).