hwmon: (sun4i-lradc) Add driver for LRADC found on Allwinner A13/A20 SoC
Subsystems (3)
PATCH v3 1/1 hwmon: (sun4i-lradc) Add driver for LRADC found on Allwinner A13/A20 SoC
Some Allwinner SoCs like A13, A20 or T2 are equipped with two-channel low rate (6 bit) ADC that is often used for extra keys. There's a driver for that already implementing standard input device, but it has these
limitations: 1) it cannot be used for general ADC data acquisition, and
2) it uses only one LRADC channel of two available.
This driver provides basic hwmon interface to both channels of LRADC on such Allwinner SoCs.
Signed-off-by Ruslan Zalata <[email protected]>
--- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/sun4i-lradc-hwmon.rst | 36 +++ MAINTAINERS | 6 + drivers/hwmon/Kconfig | 13 + drivers/hwmon/Makefile | 1 + drivers/hwmon/sun4i-lradc-hwmon.c | 327 ++++++++++++++++++++++ 6 files changed, 384 insertions(+) create mode 100644 Documentation/hwmon/sun4i-lradc-hwmon.rst create mode 100644 drivers/hwmon/sun4i-lradc-hwmon.c
Documentation/hwmon/index.rst +1 -0
@@ -189,6 +189,7 @@ Hardware Monitoring Kernel Drivers smsc47m1 sparx5-temp stpddc60 + sun4i-lradc-hwmon sy7636a-hwmon tc654 tc74
Documentation/hwmon/sun4i-lradc-hwmon.rst new file +36 -0
@@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver for sun4i LRADC +============================= + +Supported chips: + + * Allwinner A10/A13/A20 + + Prefix: 'sun4i-lradc' + + Datasheet: https://raw.githubusercontent.com/allwinner-zh/documents/master/A20/A20_Datasheet_v1.5_20150510.pdf + +Author: Ruslan Zalata + +Description +----------- + +This driver implements hwmon interface for low resolution ADC (LRADC) found +in some Allwinner SoCs. LRADC has two channels with the resolution of 6 bits +each and is mostly used in tables for extra keys. This driver allows to use +LRADC as a general purpose ADC to measure input voltage from 0 to 2V. + +LRADC hardware does not provide conversion ready bit, but it can be configured +to generate hardware interrupts continuously, raising a set of flags depending +on configured events. It is possible to catch general data conversion ready +event for both channels. + +LRADC can be configured to one of the four sampling rates: 31.25Hz, 62.5Hz, +125.0Hz and 250Hz, which can be set using update_interval chip option (in ms). + +Voltage sensors (also known as IN sensors) report their values in milivolts. + +This driver is not compatible with drivers/input/keyboard/sun4i-lradc-keys +which provides keyboard input interface based on this same LRADC hardware, so +only one of the drivers must be enabled at a time.
MAINTAINERS +6 -0
@@ -18861,6 +18861,12 @@ S: Maintained F: Documentation/devicetree/bindings/input/allwinner,sun4i-a10-lradc-keys.yaml F: drivers/input/keyboard/sun4i-lradc-keys.c +SUN4I LOW RES ADC HWMON DRIVER +M: Ruslan Zalata <[email protected]> +L: [email protected] +S: Maintained +F: drivers/hwmon/sun4i-lradc-hwmon.c + SUNDANCE NETWORK DRIVER M: Denis Kirjanov <[email protected]> L: [email protected]
drivers/hwmon/Kconfig +13 -0
@@ -1691,6 +1691,19 @@ config SENSORS_SIS5595 This driver can also be built as a module. If so, the module will be called sis5595. +config SENSORS_SUN4I_LRADC + tristate "Allwinner A13/A20 LRADC hwmon" + depends on ARCH_SUNXI && !KEYBOARD_SUN4I_LRADC + help + Say y here to support the LRADC found in Allwinner A13/A20 SoCs. + Both channels are supported. + + This driver can also be built as module. If so, the module + will be called sun4i-lradc-hwmon. + + This option is not compatible with KEYBOARD_SUN4I_LRADC, only one + of these must be used at a time. + config SENSORS_SY7636A tristate "Silergy SY7636A" help
drivers/hwmon/Makefile +1 -0
@@ -187,6 +187,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o obj-$(CONFIG_SENSORS_STTS751) += stts751.o +obj-$(CONFIG_SENSORS_SUN4I_LRADC) += sun4i-lradc-hwmon.o obj-$(CONFIG_SENSORS_SY7636A) += sy7636a-hwmon.o obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o obj-$(CONFIG_SENSORS_TC74) += tc74.o
drivers/hwmon/sun4i-lradc-hwmon.c new file +327 -0
327 lines not on this page · raw message
Signature · 1 line
2.36.0