[PATCH v15 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v15: - none Changes in v14: - fix checkpatch warnings Changes in v13: - none Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index d777a97..652fca6 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,6 +229,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index b11bb57..ddeac62 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..b0c7d8e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mx
[PATCH v15 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> Acked-by: Lee Jones <lee.jo...@linaro.org> --- Changes in v15: - none Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v15 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v15: - none Changes in v14: - fix checkpatch warnings Changes in v13: - none Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index d777a97..652fca6 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,6 +229,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index b11bb57..ddeac62 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..b0c7d8e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs
[PATCH v15 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic Reviewed-by: Marek Vasut Acked-by: Lee Jones --- Changes in v15: - none Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v15 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v15: - none Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 652fca6..79c16d5 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -436,20 +436,6 @@ config MESON_SARADC To compile this driver as a module, choose M here: the module will be called meson_saradc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index ddeac62..2ba2b4e 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -41,7 +41,6 @@ obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-
[PATCH v15 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v15: - none Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 652fca6..79c16d5 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -436,20 +436,6 @@ config MESON_SARADC To compile this driver as a module, choose M here: the module will be called meson_saradc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index ddeac62..2ba2b4e 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -41,7 +41,6 @@ obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_na
[PATCH v15 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> Acked-by: Lee Jones <lee.jo...@linaro.org> --- Changes in v15: - if hardware doesn't contain touchscreen don't load touchscreen driver. Changes in v14: - none Changes in v13: - none Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 267 ++ include/linux/mfd/mxs-lradc.h | 187 + 4 files changed, 472 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 55ecdfb..8bbc91b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -344,6 +344,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 31ce076..790698a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -215,3 +215,4 @@ obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..630bd19 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,267 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in th
[PATCH v15 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic Reviewed-by: Marek Vasut Acked-by: Lee Jones --- Changes in v15: - if hardware doesn't contain touchscreen don't load touchscreen driver. Changes in v14: - none Changes in v13: - none Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 267 ++ include/linux/mfd/mxs-lradc.h | 187 + 4 files changed, 472 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 55ecdfb..8bbc91b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -344,6 +344,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 31ce076..790698a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -215,3 +215,4 @@ obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..630bd19 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,267 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General
[PATCH v15 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Dmitry Torokhov <dmitry.torok...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v15: - use input_set_capability(input, EV_KEY, BTN_TOUCH) instead of __set_bit()s - use return mxs_lradc_ts_register(ts) instead of return 0. Changes in v14: - none Changes in v13: - use struct state_info instead of using functions for doing conditionals on every operation. - call mxs_lradc_ts_stop() before requesting interrupts. Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 714 +++ 3 files changed, 725 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 0335997..52458cf 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -829,6 +829,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index b622e53..96761ce 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..4b4aebf --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,714 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6",
[PATCH v15 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic Acked-by: Dmitry Torokhov Reviewed-by: Marek Vasut --- Changes in v15: - use input_set_capability(input, EV_KEY, BTN_TOUCH) instead of __set_bit()s - use return mxs_lradc_ts_register(ts) instead of return 0. Changes in v14: - none Changes in v13: - use struct state_info instead of using functions for doing conditionals on every operation. - call mxs_lradc_ts_stop() before requesting interrupts. Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 714 +++ 3 files changed, 725 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 0335997..52458cf 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -829,6 +829,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index b622e53..96761ce 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..4b4aebf --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,714 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, +
[PATCH v15 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 714 drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 267 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2054 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v15 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 714 drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 267 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2054 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v14 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v14: - fix checkpatch warnings Changes in v13: - none Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index dedae7a..97a3803 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,6 +229,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index d001262..38f0e15 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..b0c7d8e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel
[PATCH v14 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v14: - fix checkpatch warnings Changes in v13: - none Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index dedae7a..97a3803 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,6 +229,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index d001262..38f0e15 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..b0c7d8e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", +
[PATCH v14 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v14: - none Changes in v13: - use struct state_info instead of using functions for doing conditionals on every operation. - call mxs_lradc_ts_stop() before requesting interrupts. Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 +++ 3 files changed, 729 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..2cea025 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,718 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +st
[PATCH v14 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic --- Changes in v14: - none Changes in v13: - use struct state_info instead of using functions for doing conditionals on every operation. - call mxs_lradc_ts_stop() before requesting interrupts. Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 +++ 3 files changed, 729 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..2cea025 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,718 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem
[PATCH v14 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 97a3803..5d13405 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -424,20 +424,6 @@ config MESON_SARADC To compile this driver as a module, choose M here: the module will be called meson_saradc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 38f0e15..54b5f72 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -40,7 +40,6 @@ obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", -
[PATCH v14 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 97a3803..5d13405 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -424,20 +424,6 @@ config MESON_SARADC To compile this driver as a module, choose M here: the module will be called meson_saradc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 38f0e15..54b5f72 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -40,7 +40,6 @@ obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - &qu
[PATCH v14 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28. Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2055 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v14 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28. Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2055 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v14 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> Acked-by: Lee Jones <lee.jo...@linaro.org> --- Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v14 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic Reviewed-by: Marek Vasut Acked-by: Lee Jones --- Changes in v14: - none Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v14 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Lee Jones <lee.jo...@linaro.org> --- Changes in v14: - none Changes in v13: - none Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 55ecdfb..8bbc91b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -344,6 +344,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 31ce076..790698a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -215,3 +215,4 @@ obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..2ae8487 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTI
[PATCH v14 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic Acked-by: Lee Jones --- Changes in v14: - none Changes in v13: - none Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 55ecdfb..8bbc91b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -344,6 +344,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 31ce076..790698a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -215,3 +215,4 @@ obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..2ae8487 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#includ
[PATCH v13 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 6784ab7..8ecdcae 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -412,20 +412,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index ad19ba6..fa94669 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -39,7 +39,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -stat
[PATCH v13 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v13: - none Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 1a73e03..6784ab7 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,6 +229,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 9475fd5..ad19ba6 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..cc8d6af --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + &qu
[PATCH v13 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 6784ab7..8ecdcae 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -412,20 +412,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index ad19ba6..fa94669 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -39,7 +39,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", -
[PATCH v13 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v13: - none Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 1a73e03..6784ab7 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,6 +229,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 9475fd5..ad19ba6 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..cc8d6af --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_l
[PATCH v13 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> Acked-by: Lee Jones <lee.jo...@linaro.org> --- Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v13 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Lee Jones <lee.jo...@linaro.org> --- Changes in v13: - none Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 4ce3b6f..1bb80f7 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index dda4d4f..29a8405 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..2ae8487 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public
[PATCH v13 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic Reviewed-by: Marek Vasut Acked-by: Lee Jones --- Changes in v13: - none Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v13 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic Acked-by: Lee Jones --- Changes in v13: - none Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 4ce3b6f..1bb80f7 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index dda4d4f..29a8405 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..2ae8487 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CELL
[PATCH v13 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v13: - use struct state_info instead of using functions for doing conditionals on every operation. - call mxs_lradc_ts_stop() before requesting interrupts. Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 +++ 3 files changed, 729 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..2cea025 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,718 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { +
[PATCH v13 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic --- Changes in v13: - use struct state_info instead of using functions for doing conditionals on every operation. - call mxs_lradc_ts_stop() before requesting interrupts. Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 +++ 3 files changed, 729 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..2cea025 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,718 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +
[PATCH v13 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2055 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v13 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 718 drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2055 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v12 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 819dc0a..e5c1289 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index db39377..90e9f36 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..e29ff55 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more detai
[PATCH v12 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic Reviewed-by: Marek Vasut --- Changes in v12: - use BIT macro Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 819dc0a..e5c1289 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index db39377..90e9f36 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..e29ff55 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CELL
[PATCH v12 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2076 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v12 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2076 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v12 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57ebb99..ad6046a 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -219,6 +219,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 96894b3..4b2cf9b 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..5d7179e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", +
[PATCH v12 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57ebb99..ad6046a 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -219,6 +219,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 96894b3..4b2cf9b 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..5d7179e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { +
[PATCH v12 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 +++ 3 files changed, 750 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a222e35 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,739 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; +
[PATCH v12 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v12 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic Reviewed-by: Marek Vasut --- Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 +++ 3 files changed, 750 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a222e35 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,739 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (inste
[PATCH v12 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic Reviewed-by: Marek Vasut --- Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v12 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> Reviewed-by: Marek Vasut <ma...@denx.de> --- Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index ad6046a..30cdacf 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -374,20 +374,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 4b2cf9b..b691f8a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -36,7 +36,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char *
[PATCH v12 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v12: - none Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index ad6046a..30cdacf 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -374,20 +374,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 4b2cf9b..b691f8a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -36,7 +36,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0"
[PATCH v11 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2076 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v11 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 843 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 264 +++ include/linux/mfd/mxs-lradc.h | 187 +++ 12 files changed, 2076 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v11 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index ad6046a..30cdacf 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -374,20 +374,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 4b2cf9b..b691f8a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -36,7 +36,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", -
[PATCH v11 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron --- Changes in v11: - none Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index ad6046a..30cdacf 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -374,20 +374,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 4b2cf9b..b691f8a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -36,7 +36,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0", - "mxs-lradc-thresh1", - &q
[PATCH v11 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v11 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic --- Changes in v11: - none Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v11 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57ebb99..ad6046a 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -219,6 +219,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 96894b3..4b2cf9b 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..5d7179e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4
[PATCH v11 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 +++ 3 files changed, 750 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a222e35 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,739 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtu
[PATCH v11 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 819dc0a..e5c1289 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index db39377..90e9f36 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..e29ff55 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#inc
[PATCH v11 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron --- Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57ebb99..ad6046a 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -219,6 +219,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 96894b3..4b2cf9b 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..5d7179e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { + "mxs-lradc-thresh0", + "mxs
[PATCH v11 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic --- Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 739 +++ 3 files changed, 750 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a222e35 --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,739 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (instead +* of 8) will be available for buffered c
[PATCH v11 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic --- Changes in v11: - create static struct mfd_cells - don't set platform data in mfd cells, set driver data instead - remove mxs_lradc_reg_* functions, use writel function instead Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 264 ++ include/linux/mfd/mxs-lradc.h | 187 ++ 4 files changed, 469 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 819dc0a..e5c1289 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index db39377..90e9f36 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..e29ff55 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,264 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CELL 0 +#define TSC_CELL 1 +#define RES_MEM
[PATCH v10 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 845 3 files changed, 859 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57ebb99..ad6046a 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -219,6 +219,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 96894b3..4b2cf9b 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..6943220 --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,845 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { +
[PATCH v10 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron --- Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 845 3 files changed, 859 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57ebb99..ad6046a 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -219,6 +219,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 96894b3..4b2cf9b 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..6943220 --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,845 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { + "mxs-lradc-thresh0", + "mxs-lradc-thresh1", + "mxs-lradc-channel0", + "mxs-lradc-channel1", + &quo
[PATCH v10 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 845 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 261 +++ include/linux/mfd/mxs-lradc.h | 203 +++ 12 files changed, 2095 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v10 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28 Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 845 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 261 +++ include/linux/mfd/mxs-lradc.h | 203 +++ 12 files changed, 2095 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v10 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 261 ++ include/linux/mfd/mxs-lradc.h | 203 4 files changed, 482 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 819dc0a..e5c1289 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index db39377..90e9f36 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..8f56cf9 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,261 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CELL 0 +#define TSC_CELL 1 +#define RES_MEM0 + +enum mx23_lradc_irqs { + MX
[PATCH v10 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic --- Changes in v10: - fetch base address from DT - add a NULL check for of_match_device Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 261 ++ include/linux/mfd/mxs-lradc.h | 203 4 files changed, 482 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 819dc0a..e5c1289 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -343,6 +343,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index db39377..90e9f36 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -212,3 +212,4 @@ obj-$(CONFIG_MFD_MT6397)+= mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o obj-$(CONFIG_MFD_SUN4I_GPADC) += sun4i-gpadc.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..8f56cf9 --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,261 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CELL 0 +#define TSC_CELL 1 +#define RES_MEM0 + +enum mx23_lradc_irqs { + MX23_LRADC_TS_IRQ = 0, + MX23_LRADC_CH0_IRQ, + MX23_LRADC_CH1_IRQ, + MX23_LRADC_CH2_IRQ, + MX23_LRADC_CH3_IRQ, +
[PATCH v10 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index ad6046a..30cdacf 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -374,20 +374,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 4b2cf9b..b691f8a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -36,7 +36,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-l
[PATCH v10 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron --- Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index ad6046a..30cdacf 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -374,20 +374,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 4b2cf9b..b691f8a 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -36,7 +36,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0", - "mxs-lradc-thresh1", - "mxs-lradc-channel0&q
[PATCH v10 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v10 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic --- Changes in v10: - none Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v10 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 +++ 3 files changed, 754 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a59102b --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,743 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (instead +* of 8) will be available f
[PATCH v10 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic --- Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 +++ 3 files changed, 754 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a59102b --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,743 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (instead +* of 8) will be available for buffered capture. +*/ +#define TOUCHSCREEN_VCHANNEL1 7 +#define TOUCHSCREEN_VCHANNEL2 6 + +
[PATCH v9 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 845 3 files changed, 859 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7edcf32..6414397 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -207,6 +207,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 7a40c04..e62ebeb 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..6943220 --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,845 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { + "mxs-lradc-thresh0&quo
[PATCH v9 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron --- Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 845 3 files changed, 859 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7edcf32..6414397 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -207,6 +207,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 7a40c04..e62ebeb 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..6943220 --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,845 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { + "mxs-lradc-thresh0", + "mxs-lradc-thresh1", + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-ch
[PATCH v9 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 249 ++ include/linux/mfd/mxs-lradc.h | 203 ++ 4 files changed, 470 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index c6df644..bdd88cf 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -326,6 +326,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9834e66..057ca15 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -211,3 +211,4 @@ obj-$(CONFIG_INTEL_SOC_PMIC)+= intel-soc-pmic.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..ffc8f2e --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,249 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MXS_LRADC_BASE 0x8005 +#define ADC_CELL 0 +#define TSC_CELL 1 + +enum mx23_lradc_irqs { + MX23_LRADC_TS_IRQ = 0, + MX23_LRADC_CH0_IRQ, +
[PATCH v9 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v9 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for low resolution analog-to-digital converter (mxs-lradc) MFD driver. Signed-off-by: Ksenija Stanojevic --- Changes in v9: - improve commit message. Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 249 ++ include/linux/mfd/mxs-lradc.h | 203 ++ 4 files changed, 470 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index c6df644..bdd88cf 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -326,6 +326,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9834e66..057ca15 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -211,3 +211,4 @@ obj-$(CONFIG_INTEL_SOC_PMIC)+= intel-soc-pmic.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..ffc8f2e --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,249 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MXS_LRADC_BASE 0x8005 +#define ADC_CELL 0 +#define TSC_CELL 1 + +enum mx23_lradc_irqs { + MX23_LRADC_TS_IRQ = 0, + MX23_LRADC_CH0_IRQ, + MX23_LRADC_CH1_IRQ, + MX23_LRADC_CH2_IRQ, + MX23_LRADC_CH3_IRQ, + MX23_LRADC_CH4_IRQ, + MX23_LRADC_CH5_IRQ, +
[PATCH v9 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic --- Changes in v9: - format patch using -M option Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt similarity index 100% rename from Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt rename to Documentation/devicetree/bindings/mfd/mxs-lradc.txt -- 1.9.1
[PATCH v9 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 6414397..02c7592 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -362,20 +362,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index e62ebeb..131c466 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,7 +35,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0", - &q
[PATCH v9 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28. Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 845 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 249 +++ include/linux/mfd/mxs-lradc.h | 203 +++ 12 files changed, 2083 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v9 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 +++ 3 files changed, 754 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a59102b --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,743 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (instead +* of 8) will be available for buffer
[PATCH v9 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28. Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../bindings/{iio/adc => mfd}/mxs-lradc.txt|0 drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 845 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 249 +++ include/linux/mfd/mxs-lradc.h | 203 +++ 12 files changed, 2083 insertions(+), 1765 deletions(-) rename Documentation/devicetree/bindings/{iio/adc => mfd}/mxs-lradc.txt (100%) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v9 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic --- Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 +++ 3 files changed, 754 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a59102b --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,743 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (instead +* of 8) will be available for buffered capture. +*/ +#define TOUCHSCREEN_VCHANNEL1 7 +#define TOUCHSCREEN_VCHANNEL2 6 + + struct input_dev
[PATCH v9 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron --- Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 6414397..02c7592 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -362,20 +362,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index e62ebeb..131c466 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,7 +35,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0", - "mxs-lradc-thresh1", - "mxs-lradc-channel0", - &
[PATCH v8 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 6414397..02c7592 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -362,20 +362,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index e62ebeb..131c466 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,7 +35,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0", - "mxs-lradc-thresh1", -
[PATCH v8 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset .../devicetree/bindings/iio/adc/mxs-lradc.txt | 47 -- .../devicetree/bindings/mfd/mxs-lradc.txt | 47 ++ 2 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt create mode 100644 Documentation/devicetree/bindings/mfd/mxs-lradc.txt diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt deleted file mode 100644 index 555fb11..000 --- a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt +++ /dev/null @@ -1,47 +0,0 @@ -* Freescale MXS LRADC device driver - -Required properties: -- compatible: Should be "fsl,imx23-lradc" for i.MX23 SoC and "fsl,imx28-lradc" - for i.MX28 SoC -- reg: Address and length of the register set for the device -- interrupts: Should contain the LRADC interrupts - -Optional properties: -- fsl,lradc-touchscreen-wires: Number of wires used to connect the touchscreen - to LRADC. Valid value is either 4 or 5. If this - property is not present, then the touchscreen is - disabled. 5 wires is valid for i.MX28 SoC only. -- fsl,ave-ctrl: number of samples per direction to calculate an average value. -Allowed value is 1 ... 32, default is 4 -- fsl,ave-delay: delay between consecutive samples. Allowed value is - 2 ... 2048. It is used if 'fsl,ave-ctrl' > 1, counts at - 2 kHz and its default is 2 (= 1 ms) -- fsl,settling: delay between plate switch to next sample. Allowed value is -1 ... 2047. It counts at 2 kHz and its default is -10 (= 5 ms) - -Example for i.MX23 SoC: - - lradc@8005 { - compatible = "fsl,imx23-lradc"; - reg = <0x8005 0x2000>; - interrupts = <36 37 38 39 40 41 42 43 44>; - status = "okay"; - fsl,lradc-touchscreen-wires = <4>; - fsl,ave-ctrl = <4>; - fsl,ave-delay = <2>; - fsl,settling = <10>; - }; - -Example for i.MX28 SoC: - - lradc@8005 { - compatible = "fsl,imx28-lradc"; - reg = <0x8005 0x2000>; - interrupts = <10 14 15 16 17 18 19 20 21 22 23 24 25>; - status = "okay"; - fsl,lradc-touchscreen-wires = <5>; - fsl,ave-ctrl = <4>; - fsl,ave-delay = <2>; - fsl,settling = <10>; - }; diff --git a/Documentation/devicetree/bindings/mfd/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt new file mode 100644 index 000..555fb11 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt @@ -0,0 +1,47 @@ +* Freescale MXS LRADC device driver + +Required properties: +- compatible: Should be "fsl,imx23-lradc" for i.MX23 SoC and "fsl,imx28-lradc" + for i.MX28 SoC +- reg: Address and length of the register set for the device +- interrupts: Should contain the LRADC interrupts + +Optional properties: +- fsl,lradc-touchscreen-wires: Number of wires used to connect the touchscreen + to LRADC. Valid value is either 4 or 5. If this + property is not present, then the touchscreen is + disabled. 5 wires is valid for i.MX28 SoC only. +- fsl,ave-ctrl: number of samples per direction to calculate an average value. +Allowed value is 1 ... 32, default is 4 +- fsl,ave-delay: delay between consecutive samples. Allowed value is + 2 ... 2048. It is used if 'fsl,ave-ctrl' > 1, counts at + 2 kHz and its default is 2 (= 1 ms) +- fsl,settling: delay between plate switch to next sample. Allowed value is +1 ... 2047. It counts at 2 kHz and its default is +10 (= 5 ms) + +Example for i.MX23 SoC: + + lradc@8005 { + compatible = "fsl,imx23-lradc"; + reg = <0x8005 0x2000>; + interrupts = <36 37 38 39 40 41 42 43 44>; + status = "okay"; + fsl,lradc-touchscreen-wires = <4>; + fsl,ave-ctrl = <4>; + fsl,ave-delay = <2>; + fsl,settling = <10>; + }; + +Example for i.MX28 SoC: + + lradc@8005 { + compatible = "fsl,imx28-lradc"; + reg = &
[PATCH v8 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Reviewed-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 845 3 files changed, 859 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7edcf32..6414397 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -207,6 +207,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 7a40c04..e62ebeb 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..6943220 --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,845 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { + "mxs-lradc-thresh0", + "mxs-lradc-th
[PATCH v8 5/5] mfd: Move binding document
The bindings, which are now used in MFD, need also to be documented in the MFD binding document. Signed-off-by: Ksenija Stanojevic --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - add to the patchset .../devicetree/bindings/iio/adc/mxs-lradc.txt | 47 -- .../devicetree/bindings/mfd/mxs-lradc.txt | 47 ++ 2 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt create mode 100644 Documentation/devicetree/bindings/mfd/mxs-lradc.txt diff --git a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt b/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt deleted file mode 100644 index 555fb11..000 --- a/Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt +++ /dev/null @@ -1,47 +0,0 @@ -* Freescale MXS LRADC device driver - -Required properties: -- compatible: Should be "fsl,imx23-lradc" for i.MX23 SoC and "fsl,imx28-lradc" - for i.MX28 SoC -- reg: Address and length of the register set for the device -- interrupts: Should contain the LRADC interrupts - -Optional properties: -- fsl,lradc-touchscreen-wires: Number of wires used to connect the touchscreen - to LRADC. Valid value is either 4 or 5. If this - property is not present, then the touchscreen is - disabled. 5 wires is valid for i.MX28 SoC only. -- fsl,ave-ctrl: number of samples per direction to calculate an average value. -Allowed value is 1 ... 32, default is 4 -- fsl,ave-delay: delay between consecutive samples. Allowed value is - 2 ... 2048. It is used if 'fsl,ave-ctrl' > 1, counts at - 2 kHz and its default is 2 (= 1 ms) -- fsl,settling: delay between plate switch to next sample. Allowed value is -1 ... 2047. It counts at 2 kHz and its default is -10 (= 5 ms) - -Example for i.MX23 SoC: - - lradc@8005 { - compatible = "fsl,imx23-lradc"; - reg = <0x8005 0x2000>; - interrupts = <36 37 38 39 40 41 42 43 44>; - status = "okay"; - fsl,lradc-touchscreen-wires = <4>; - fsl,ave-ctrl = <4>; - fsl,ave-delay = <2>; - fsl,settling = <10>; - }; - -Example for i.MX28 SoC: - - lradc@8005 { - compatible = "fsl,imx28-lradc"; - reg = <0x8005 0x2000>; - interrupts = <10 14 15 16 17 18 19 20 21 22 23 24 25>; - status = "okay"; - fsl,lradc-touchscreen-wires = <5>; - fsl,ave-ctrl = <4>; - fsl,ave-delay = <2>; - fsl,settling = <10>; - }; diff --git a/Documentation/devicetree/bindings/mfd/mxs-lradc.txt b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt new file mode 100644 index 000..555fb11 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/mxs-lradc.txt @@ -0,0 +1,47 @@ +* Freescale MXS LRADC device driver + +Required properties: +- compatible: Should be "fsl,imx23-lradc" for i.MX23 SoC and "fsl,imx28-lradc" + for i.MX28 SoC +- reg: Address and length of the register set for the device +- interrupts: Should contain the LRADC interrupts + +Optional properties: +- fsl,lradc-touchscreen-wires: Number of wires used to connect the touchscreen + to LRADC. Valid value is either 4 or 5. If this + property is not present, then the touchscreen is + disabled. 5 wires is valid for i.MX28 SoC only. +- fsl,ave-ctrl: number of samples per direction to calculate an average value. +Allowed value is 1 ... 32, default is 4 +- fsl,ave-delay: delay between consecutive samples. Allowed value is + 2 ... 2048. It is used if 'fsl,ave-ctrl' > 1, counts at + 2 kHz and its default is 2 (= 1 ms) +- fsl,settling: delay between plate switch to next sample. Allowed value is +1 ... 2047. It counts at 2 kHz and its default is +10 (= 5 ms) + +Example for i.MX23 SoC: + + lradc@8005 { + compatible = "fsl,imx23-lradc"; + reg = <0x8005 0x2000>; + interrupts = <36 37 38 39 40 41 42 43 44>; + status = "okay"; + fsl,lradc-touchscreen-wires = <4>; + fsl,ave-ctrl = <4>; + fsl,ave-delay = <2>; + fsl,settling = <10>; + }; + +Example for i.MX28 SoC: + + lradc@8005 { + compatible = "fsl,imx28-lradc"; + reg = <0x8005 0x2000&
[PATCH v8 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 845 3 files changed, 859 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 7edcf32..6414397 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -207,6 +207,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 7a40c04..e62ebeb 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -34,6 +34,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..6943220 --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,845 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { + "mxs-lradc-thresh0", + "mxs-lradc-thresh1", + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "m
[PATCH v8 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic Acked-by: Jonathan Cameron --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 6414397..02c7592 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -362,20 +362,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index e62ebeb..131c466 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,7 +35,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0", - "mxs-lradc-thresh1", - "mxs-lradc-channel0", - "mxs-lradc-channel1",
[PATCH v8 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for mxs-lradc MFD driver. Note: this patch won't compile in iio/testing without this patch: a8f447be8056 ("mfd: Add resource managed APIs for mfd_add_devices") Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 249 ++ include/linux/mfd/mxs-lradc.h | 203 ++ 4 files changed, 470 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index c6df644..bdd88cf 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -326,6 +326,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9834e66..057ca15 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -211,3 +211,4 @@ obj-$(CONFIG_INTEL_SOC_PMIC)+= intel-soc-pmic.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..ffc8f2e --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,249 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MXS_LRADC_BASE 0x8005 +#define ADC_CELL 0 +#define TSC_CELL 1 + +enum mx23_lradc_irqs { + MX23_LRADC_TS_IRQ =
[PATCH v8 1/5] mfd: mxs-lradc: Add support for mxs-lradc MFD
Add core files for mxs-lradc MFD driver. Note: this patch won't compile in iio/testing without this patch: a8f447be8056 ("mfd: Add resource managed APIs for mfd_add_devices") Signed-off-by: Ksenija Stanojevic --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - define macros ADC_CELL and TSC_CELL - remove one cell and dynamically set them in the switch() - fail in the touchscreen driver instead of mfd driver if hardware doesn't contain a touchscreen Changes in v6: - update copyright - add kernel-doc header for struct mxs-lradc - add error message - change EINVAL to ENODEV - use PLATFORM_DEVID_NONE instead -1 - cosmetic fixes Changes in v5: - use DEFINE_RES_MEM - don't pass ioreammaped adress to platform cells - move comment outside of struct mxs_lradc - change type of argument in mxs_lradc_reg_set, mxs_lradc_reg_clear, mxs_lradc_reg_wrt (struct mxs_lradc * -> void __iomem *) Changes in v4: - update copyright - use DEFINE_RES_IRQ_NAMED - remove mxs_lradc_add_device function - use struct mfd_cell in static form - improve spacing - remove unnecessary comment - remove platform_get_irq - remove touch_ret and use ret instead - rename use_touchscreen to touchscreen_wire - use goto statements - remove irq[13], irq_count and irq_name from struct mxs_lradc - remove all defines from inside the struct definition Changes in v3: - add note to commit message - move switch statement into if(touch_ret == 0) branch - add MODULE_AUTHOR Changes in v2: - do not change spacing in Kconfig - make struct mfd_cell part of struct mxs_lradc - use switch instead of if in mxs_lradc_irq_mask - use only necessary header files in mxs_lradc.h - use devm_mfd_add_device - use separate function to register mfd device - change licence to GPL - add copyright drivers/mfd/Kconfig | 17 +++ drivers/mfd/Makefile | 1 + drivers/mfd/mxs-lradc.c | 249 ++ include/linux/mfd/mxs-lradc.h | 203 ++ 4 files changed, 470 insertions(+) create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index c6df644..bdd88cf 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -326,6 +326,23 @@ config MFD_MC13XXX_I2C help Select this if your MC13xxx is connected via an I2C bus. +config MFD_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC" + depends on ARCH_MXS || COMPILE_TEST + select MFD_CORE + select STMP_DEVICE + help + Say yes here to build support for the Low Resolution + Analog-to-Digital Converter (LRADC) found on the i.MX23 and i.MX28 + processors. This driver provides common support for accessing the + device, additional drivers must be enabled in order to use the + functionality of the device: + mxs-lradc-adc for ADC readings + mxs-lradc-ts for touchscreen support + + This driver can also be built as a module. If so, the module will be + called mxs-lradc. + config MFD_MX25_TSADC tristate "Freescale i.MX25 integrated Touchscreen and ADC unit" select REGMAP_MMIO diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9834e66..057ca15 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -211,3 +211,4 @@ obj-$(CONFIG_INTEL_SOC_PMIC)+= intel-soc-pmic.o obj-$(CONFIG_MFD_MT6397) += mt6397-core.o obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o +obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c new file mode 100644 index 000..ffc8f2e --- /dev/null +++ b/drivers/mfd/mxs-lradc.c @@ -0,0 +1,249 @@ +/* + * Freescale MXS Low Resolution Analog-to-Digital Converter driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MXS_LRADC_BASE 0x8005 +#define ADC_CELL 0 +#define TSC_CELL 1 + +enum mx23_lradc_irqs { + MX23_LRADC_TS_IRQ = 0, + MX23_LRADC_CH0_IRQ, + MX23_LRADC_CH1_IRQ, + MX23_LRADC_CH2_IRQ, + MX23_LRADC_CH
[PATCH v8 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 +++ 3 files changed, 754 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a59102b --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,743 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * Authors: + * Marek Vasut <ma...@denx.de> + * Ksenija Stanojevic <ksenija.stanoje...@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (instead +* of 8) will be available for buffered capture. +*/ +#define
[PATCH v8 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic --- Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig| 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 +++ 3 files changed, 754 insertions(+) create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca013..8ff915e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -841,6 +841,16 @@ config TOUCHSCREEN_USB_COMPOSITE To compile this driver as a module, choose M here: the module will be called usbtouchscreen. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_MX25 tristate "Freescale i.MX25 touchscreen input driver" depends on MFD_MX25_TSADC diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b8645..97e1bb7 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC)+= bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_MX25) += fsl-imx25-tcq.o obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c new file mode 100644 index 000..a59102b --- /dev/null +++ b/drivers/input/touchscreen/mxs-lradc-ts.c @@ -0,0 +1,743 @@ +/* + * Freescale MXS LRADC touchscreen driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2016 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *mxs_lradc_ts_irq_names[] = { + "mxs-lradc-touchscreen", + "mxs-lradc-channel6", + "mxs-lradc-channel7", +}; + +/* + * Touchscreen handling + */ +enum mxs_lradc_ts_plate { + LRADC_TOUCH = 0, + LRADC_SAMPLE_X, + LRADC_SAMPLE_Y, + LRADC_SAMPLE_PRESSURE, + LRADC_SAMPLE_VALID, +}; + +struct mxs_lradc_ts { + struct mxs_lradc*lradc; + struct device *dev; + + void __iomem*base; + /* +* When the touchscreen is enabled, we give it two private virtual +* channels: #6 and #7. This means that only 6 virtual channels (instead +* of 8) will be available for buffered capture. +*/ +#define TOUCHSCREEN_VCHANNEL1 7 +#define TOUCHSCREEN_VCHANNEL2 6 + + struct input_dev*ts_input; + + e
[PATCH v8 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28. Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../devicetree/bindings/iio/adc/mxs-lradc.txt | 47 - .../devicetree/bindings/mfd/mxs-lradc.txt | 47 + drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 845 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 249 +++ include/linux/mfd/mxs-lradc.h | 203 +++ 13 files changed, 2130 insertions(+), 1812 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt create mode 100644 Documentation/devicetree/bindings/mfd/mxs-lradc.txt create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v8 0/5] mxs-lradc: Split driver into MFD
Split existing driver mxs-lradc into MFD with touchscreen and IIO part. Tested on I.MX28. Ksenija Stanojevic (5): mfd: mxs-lradc: Add support for mxs-lradc MFD iio: adc: mxs-lradc: Add support for adc driver input: touchscreen: mxs-lradc: Add support for touchscreen iio: adc: mxs-lradc: Remove driver mfd: Move binding document .../devicetree/bindings/iio/adc/mxs-lradc.txt | 47 - .../devicetree/bindings/mfd/mxs-lradc.txt | 47 + drivers/iio/adc/Kconfig| 27 +- drivers/iio/adc/Makefile |2 +- drivers/iio/adc/mxs-lradc-adc.c| 845 ++ drivers/iio/adc/mxs-lradc.c| 1750 drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile |1 + drivers/input/touchscreen/mxs-lradc-ts.c | 743 + drivers/mfd/Kconfig| 17 + drivers/mfd/Makefile |1 + drivers/mfd/mxs-lradc.c| 249 +++ include/linux/mfd/mxs-lradc.h | 203 +++ 13 files changed, 2130 insertions(+), 1812 deletions(-) delete mode 100644 Documentation/devicetree/bindings/iio/adc/mxs-lradc.txt create mode 100644 Documentation/devicetree/bindings/mfd/mxs-lradc.txt create mode 100644 drivers/iio/adc/mxs-lradc-adc.c delete mode 100644 drivers/iio/adc/mxs-lradc.c create mode 100644 drivers/input/touchscreen/mxs-lradc-ts.c create mode 100644 drivers/mfd/mxs-lradc.c create mode 100644 include/linux/mfd/mxs-lradc.h -- 1.9.1
[PATCH v2] Staging: fbtft: Fix bug in fbtft-core
Commit 367e8560e8d7a62d96e9b1d644028a3816e04206 introduced a bug in fbtft-core where fps is always 0, this is because variable update_time is not assigned correctly. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Fixes: 367e8560e8d7 ("Staging: fbtbt: Replace timespec with ktime_t") --- Changes in v2: - add Fixes tag drivers/staging/fbtft/fbtft-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index d9046162..587f68a 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -391,11 +391,11 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line, if (unlikely(timeit)) { ts_end = ktime_get(); - if (ktime_to_ns(par->update_time)) + if (!ktime_to_ns(par->update_time)) par->update_time = ts_start; - par->update_time = ts_start; fps = ktime_us_delta(ts_start, par->update_time); + par->update_time = ts_start; fps = fps ? 100 / fps : 0; throughput = ktime_us_delta(ts_end, ts_start); -- 1.9.1
[PATCH v2] Staging: fbtft: Fix bug in fbtft-core
Commit 367e8560e8d7a62d96e9b1d644028a3816e04206 introduced a bug in fbtft-core where fps is always 0, this is because variable update_time is not assigned correctly. Signed-off-by: Ksenija Stanojevic Fixes: 367e8560e8d7 ("Staging: fbtbt: Replace timespec with ktime_t") --- Changes in v2: - add Fixes tag drivers/staging/fbtft/fbtft-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index d9046162..587f68a 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -391,11 +391,11 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line, if (unlikely(timeit)) { ts_end = ktime_get(); - if (ktime_to_ns(par->update_time)) + if (!ktime_to_ns(par->update_time)) par->update_time = ts_start; - par->update_time = ts_start; fps = ktime_us_delta(ts_start, par->update_time); + par->update_time = ts_start; fps = fps ? 100 / fps : 0; throughput = ktime_us_delta(ts_end, ts_start); -- 1.9.1
[PATCH v7 3/5] input: touchscreen: mxs-lradc: Add support for touchscreen
Add 4-wire/5-wire touchscreen controller. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> --- Changes in v7: - remove touch_ret variable in probe and use ret instead - make error check on of_property_read_u32 in probe Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/input/touchscreen/Kconfig | 10 ++ drivers/input/touchscreen/Makefile | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 2fb1f43..49ea962 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -305,6 +305,16 @@ config TOUCHSCREEN_EGALAX_SERIAL To compile this driver as a module, choose M here: the module will be called egalax_ts_serial. +config TOUCHSCREEN_MXS_LRADC + tristate "Freescale i.MX23/i.MX28 LRADC touchscreen" + depends on MFD_MXS_LRADC + help + Say Y here if you have a touchscreen connected to the low-resolution + analog-to-digital converter (LRADC) on an i.MX23 or i.MX28 processor. + + To compile this driver as a module, choose M here: the module will be + called mxs-lradc-ts. + config TOUCHSCREEN_FT6236 tristate "FT6236 I2C touchscreen" depends on I2C diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index b4373d6..9f2b76b 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -54,6 +54,7 @@ obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o obj-$(CONFIG_TOUCHSCREEN_MMS114) += mms114.o obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o obj-$(CONFIG_TOUCHSCREEN_MK712)+= mk712.o +obj-$(CONFIG_TOUCHSCREEN_MXS_LRADC) += mxs-lradc-ts.o obj-$(CONFIG_TOUCHSCREEN_HP600)+= hp680_ts_input.o obj-$(CONFIG_TOUCHSCREEN_HP7XX)+= jornada720_ts.o obj-$(CONFIG_TOUCHSCREEN_IPAQ_MICRO) += ipaq-micro-ts.o -- 1.9.1
[PATCH v7 4/5] iio: adc: mxs-lradc: Remove driver
Since the driver has been split into mfd there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanoje...@gmail.com> Acked-by: Jonathan Cameron <ji...@kernel.org> --- Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - add to the patchset drivers/iio/adc/Kconfig | 14 - drivers/iio/adc/Makefile|1 - drivers/iio/adc/mxs-lradc.c | 1750 --- 3 files changed, 1765 deletions(-) delete mode 100644 drivers/iio/adc/mxs-lradc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 6414397..02c7592 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -362,20 +362,6 @@ config MEN_Z188_ADC This driver can also be built as a module. If so, the module will be called men_z188_adc. -config MXS_LRADC -tristate "Freescale i.MX23/i.MX28 LRADC" -depends on (ARCH_MXS || COMPILE_TEST) && HAS_IOMEM -depends on INPUT -select STMP_DEVICE -select IIO_BUFFER -select IIO_TRIGGERED_BUFFER -help - Say yes here to build support for i.MX23/i.MX28 LRADC convertor - built into these chips. - - To compile this driver as a module, choose M here: the - module will be called mxs-lradc. - config NAU7802 tristate "Nuvoton NAU7802 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index e62ebeb..131c466 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -35,7 +35,6 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o -obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c deleted file mode 100644 index b84d37c..000 --- a/drivers/iio/adc/mxs-lradc.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * Freescale MXS LRADC driver - * - * Copyright (c) 2012 DENX Software Engineering, GmbH. - * Marek Vasut <ma...@denx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define DRIVER_NAME"mxs-lradc" - -#define LRADC_MAX_DELAY_CHANS 4 -#define LRADC_MAX_MAPPED_CHANS 8 -#define LRADC_MAX_TOTAL_CHANS 16 - -#define LRADC_DELAY_TIMER_HZ 2000 - -/* - * Make this runtime configurable if necessary. Currently, if the buffered mode - * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before - * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) - * seconds. The result is that the samples arrive every 500mS. - */ -#define LRADC_DELAY_TIMER_PER 200 -#define LRADC_DELAY_TIMER_LOOP 5 - -/* - * Once the pen touches the touchscreen, the touchscreen switches from - * IRQ-driven mode to polling mode to prevent interrupt storm. The polling - * is realized by worker thread, which is called every 20 or so milliseconds. - * This gives the touchscreen enough fluency and does not strain the system - * too much. - */ -#define LRADC_TS_SAMPLE_DELAY_MS 5 - -/* - * The LRADC reads the following amount of samples from each touchscreen - * channel and the driver then computes average of these. - */ -#define LRADC_TS_SAMPLE_AMOUNT 4 - -enum mxs_lradc_id { - IMX23_LRADC, - IMX28_LRADC, -}; - -static const char * const mx23_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-channel0", - "mxs-lradc-channel1", - "mxs-lradc-channel2", - "mxs-lradc-channel3", - "mxs-lradc-channel4", - "mxs-lradc-channel5", - "mxs-lradc-channel6", - "mxs-lradc-channel7", -}; - -static const char * const mx28_lradc_irq_names[] = { - "mxs-lradc-touchscreen", - "mxs-lradc-thresh0", - "mxs-lradc-thresh1", - "mxs-lradc-channel