* [PATCH v2 0/5] input: Add new sun4i-ts driver for Allwinner sunxi @ 2013-12-27 14:59 Hans de Goede [not found] ` <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 14+ messages in thread From: Hans de Goede @ 2013-12-27 14:59 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi Dimitri et al, Here is v2 of my sun4i-ts patch-set. Changes since v1: -Use devm_kzalloc and devm_hwmon_device_register_with_groups as suggested by Guenter Roeck -Various small cleanups suggested by Thomas Petazzoni -Add open/close methods and enable/disable the input related interrupts from there as suggested by you (Dimitri) Assuming there is no more feedback, can you please add the 1st 2 patches to your tree for 3.14 ? Maxime, can you please add the dts bits to your dts tree for 3.14 ? Thanks & Regards, Hans ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* [PATCH v2 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller [not found] ` <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2013-12-27 14:59 ` Hans de Goede 2013-12-27 14:59 ` [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor Hans de Goede ` (3 subsequent siblings) 4 siblings, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-27 14:59 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Note the sun4i-ts controller is capable of detecting a second touch, but when a second touch is present then the accuracy becomes so bad the reported touch location is not useable. The original android driver contains some complicated heuristics using the aprox. distance between the 2 touches to see if the user is making a pinch open / close movement, and then reports emulated multi-touch events around the last touch coordinate (as the dual-touch coordinates are worthless). These kinds of heuristics are just asking for trouble (and don't belong in the kernel). So this driver offers straight forward, reliable single touch functionality only. Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- .../bindings/input/touchscreen/sun4i.txt | 15 ++ drivers/input/touchscreen/Kconfig | 10 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/sun4i-ts.c | 262 +++++++++++++++++++++ 4 files changed, 288 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/touchscreen/sun4i.txt create mode 100644 drivers/input/touchscreen/sun4i-ts.c diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt new file mode 100644 index 0000000..e45927e --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt @@ -0,0 +1,15 @@ +sun4i resistive touchscreen controller +-------------------------------------- + +Required properties: + - compatible: "allwinner,sun4i-ts" + - reg: mmio address range of the chip + - interrupts: interrupt to which the chip is connected + +Example: + + rtp: rtp@01c25000 { + compatible = "allwinner,sun4i-ts"; + reg = <0x01c25000 0x100>; + interrupts = <29>; + }; diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 961d58d..95023de 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -906,6 +906,16 @@ config TOUCHSCREEN_STMPE To compile this driver as a module, choose M here: the module will be called stmpe-ts. +config TOUCHSCREEN_SUN4I + tristate "Allwinner sun4i resistive touchscreen controller support" + depends on ARCH_SUNXI + help + This selects support for the resistive touchscreen controller + found on Allwinner sunxi SoCs. + + To compile this driver as a module, choose M here: the + module will be called sun4i-ts. + config TOUCHSCREEN_SUR40 tristate "Samsung SUR40 (Surface 2.0/PixelSense) touchscreen" depends on USB diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 62801f2..c8f7375 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -54,6 +54,7 @@ obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o +obj-$(CONFIG_TOUCHSCREEN_SUN4I) += sun4i-ts.o obj-$(CONFIG_TOUCHSCREEN_SUR40) += sur40.o obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC) += ti_am335x_tsc.o obj-$(CONFIG_TOUCHSCREEN_TNETV107X) += tnetv107x-ts.o diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c new file mode 100644 index 0000000..10839d2 --- /dev/null +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -0,0 +1,262 @@ +/* + * Allwinner sunxi resistive touchscreen controller driver + * + * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> + * + * 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. + */ + +/* + * The sun4i-ts controller is capable of detecting a second touch, but when a + * second touch is present then the accuracy becomes so bad the reported touch + * location is not useable. + * + * The original android driver contains some complicated heuristics using the + * aprox. distance between the 2 touches to see if the user is making a pinch + * open / close movement, and then reports emulated multi-touch events around + * the last touch coordinate (as the dual-touch coordinates are worthless). + * + * These kinds of heuristics are just asking for trouble (and don't belong + * in the kernel). So this driver offers straight forward, reliable single + * touch functionality only. + */ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +#define TP_CTRL0 0x00 +#define TP_CTRL1 0x04 +#define TP_CTRL2 0x08 +#define TP_CTRL3 0x0c +#define TP_INT_FIFOC 0x10 +#define TP_INT_FIFOS 0x14 +#define TP_TPR 0x18 +#define TP_CDAT 0x1c +#define TEMP_DATA 0x20 +#define TP_DATA 0x24 + +/* TP_CTRL0 bits */ +#define ADC_FIRST_DLY(x) ((x) << 24) /* 8 bits */ +#define ADC_FIRST_DLY_MODE(x) ((x) << 23) +#define ADC_CLK_SEL(x) ((x) << 22) +#define ADC_CLK_DIV(x) ((x) << 20) /* 3 bits */ +#define FS_DIV(x) ((x) << 16) /* 4 bits */ +#define T_ACQ(x) ((x) << 0) /* 16 bits */ + +/* TP_CTRL1 bits */ +#define STYLUS_UP_DEBOUN(x) ((x) << 12) /* 8 bits */ +#define STYLUS_UP_DEBOUN_EN(x) ((x) << 9) +#define TOUCH_PAN_CALI_EN(x) ((x) << 6) +#define TP_DUAL_EN(x) ((x) << 5) +#define TP_MODE_EN(x) ((x) << 4) +#define TP_ADC_SELECT(x) ((x) << 3) +#define ADC_CHAN_SELECT(x) ((x) << 0) /* 3 bits */ + +/* TP_CTRL2 bits */ +#define TP_SENSITIVE_ADJUST(x) ((x) << 28) /* 4 bits */ +#define TP_MODE_SELECT(x) ((x) << 26) /* 2 bits */ +#define PRE_MEA_EN(x) ((x) << 24) +#define PRE_MEA_THRE_CNT(x) ((x) << 0) /* 24 bits */ + +/* TP_CTRL3 bits */ +#define FILTER_EN(x) ((x) << 2) +#define FILTER_TYPE(x) ((x) << 0) /* 2 bits */ + +/* TP_INT_FIFOC irq and fifo mask / control bits */ +#define TEMP_IRQ_EN(x) ((x) << 18) +#define OVERRUN_IRQ_EN(x) ((x) << 17) +#define DATA_IRQ_EN(x) ((x) << 16) +#define TP_DATA_XY_CHANGE(x) ((x) << 13) +#define FIFO_TRIG(x) ((x) << 8) /* 5 bits */ +#define DATA_DRQ_EN(x) ((x) << 7) +#define FIFO_FLUSH(x) ((x) << 4) +#define TP_UP_IRQ_EN(x) ((x) << 1) +#define TP_DOWN_IRQ_EN(x) ((x) << 0) + +/* TP_INT_FIFOS irq and fifo status bits */ +#define TEMP_DATA_PENDING BIT(18) +#define FIFO_OVERRUN_PENDING BIT(17) +#define FIFO_DATA_PENDING BIT(16) +#define TP_IDLE_FLG BIT(2) +#define TP_UP_PENDING BIT(1) +#define TP_DOWN_PENDING BIT(0) + +/* TP_TPR bits */ +#define TEMP_ENABLE(x) ((x) << 16) +#define TEMP_PERIOD(x) ((x) << 0) /* t = x * 256 * 16 / clkin */ + +struct sun4i_ts_data { + struct device *dev; + struct input_dev *input; + void __iomem *base; + unsigned int irq; + bool ignore_fifo_data; +}; + +static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) +{ + struct sun4i_ts_data *ts = dev_id; + u32 reg_val, x, y; + + reg_val = readl(ts->base + TP_INT_FIFOS); + + if (reg_val & FIFO_DATA_PENDING) { + x = readl(ts->base + TP_DATA); + y = readl(ts->base + TP_DATA); + /* The 1st location reported after an up event is unreliable */ + if (!ts->ignore_fifo_data) { + input_report_abs(ts->input, ABS_X, x); + input_report_abs(ts->input, ABS_Y, y); + /* + * The hardware has a separate down status bit, but + * that gets set before we get the first location, + * resulting in reporting a click on the old location. + */ + input_report_key(ts->input, BTN_TOUCH, 1); + input_sync(ts->input); + } else { + ts->ignore_fifo_data = false; + } + } + + if (reg_val & TP_UP_PENDING) { + ts->ignore_fifo_data = true; + input_report_key(ts->input, BTN_TOUCH, 0); + input_sync(ts->input); + } + + writel(reg_val, ts->base + TP_INT_FIFOS); + + return IRQ_HANDLED; +} + +static int sun4i_ts_open(struct input_dev *dev) +{ + struct sun4i_ts_data *ts = input_get_drvdata(dev); + + /* Flush, set trig level to 1, enable data and up irqs */ + writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) |FIFO_FLUSH(1) | TP_UP_IRQ_EN(1), + ts->base + TP_INT_FIFOC); + + return 0; +} + +static void sun4i_ts_close(struct input_dev *dev) +{ + struct sun4i_ts_data *ts = input_get_drvdata(dev); + + /* Deactivate all IRQs */ + writel(0, ts->base + TP_INT_FIFOC); + synchronize_irq(ts->irq); +} + +static int sun4i_ts_probe(struct platform_device *pdev) +{ + struct sun4i_ts_data *ts; + struct device *dev = &pdev->dev; + int ret; + + ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); + if (!ts) + return -ENOMEM; + + ts->dev = dev; + + ts->input = devm_input_allocate_device(dev); + if (!ts->input) + return -ENOMEM; + + ts->input->name = pdev->name; + ts->input->phys = "sun4i_ts/input0"; + ts->input->open = sun4i_ts_open; + ts->input->close = sun4i_ts_close; + ts->input->id.bustype = BUS_HOST; + ts->input->id.vendor = 0x0001; + ts->input->id.product = 0x0001; + ts->input->id.version = 0x0100; + ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); + set_bit(BTN_TOUCH, ts->input->keybit); + input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); + input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); + input_set_drvdata(ts->input, ts); + + ts->base = devm_ioremap_resource(dev, + platform_get_resource(pdev, IORESOURCE_MEM, 0)); + if (IS_ERR(ts->base)) + return PTR_ERR(ts->base); + + ts->irq = platform_get_irq(pdev, 0); + ret = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts); + if (ret) + return ret; + + /* + * Select HOSC clk, clkin = clk / 6, adc samplefreq = clkin / 8192, + * t_acq = clkin / (16 * 64) + */ + writel(ADC_CLK_SEL(0) | ADC_CLK_DIV(2) | FS_DIV(7) | T_ACQ(63), + ts->base + TP_CTRL0); + + /* + * sensitive_adjust = 15 : max, which is not all that sensitive, + * tp_mode = 0 : only x and y coordinates, as we don't use dual touch + */ + writel(TP_SENSITIVE_ADJUST(15) | TP_MODE_SELECT(0), + ts->base + TP_CTRL2); + + /* Enable median filter, type 1 : 5/3 */ + writel(FILTER_EN(1) | FILTER_TYPE(1), ts->base + TP_CTRL3); + + /* Enable temperature measurement, period 1953 (2 seconds) */ + writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR); + + /* + * Set stylus up debounce to aprox 10 ms, enable debounce, and + * finally enable tp mode. + */ + writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1), + ts->base + TP_CTRL1); + + ret = input_register_device(ts->input); + if (ret) + return ret; + + platform_set_drvdata(pdev, ts); + return 0; +} + +static const struct of_device_id sun4i_ts_of_match[] = { + { .compatible = "allwinner,sun4i-ts", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sun4i_ts_of_match); + +static struct platform_driver sun4i_ts_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "sun4i-ts", + .of_match_table = of_match_ptr(sun4i_ts_of_match), + }, + .probe = sun4i_ts_probe, +}; + +module_platform_driver(sun4i_ts_driver); + +MODULE_DESCRIPTION("Allwinner sun4i resistive touchscreen controller driver"); +MODULE_AUTHOR("Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>"); +MODULE_LICENSE("GPL"); -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2013-12-27 14:59 ` [PATCH v2 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller Hans de Goede @ 2013-12-27 14:59 ` Hans de Goede [not found] ` <1388156399-29677-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2013-12-27 14:59 ` [PATCH v2 3/5] ARM: dts: sun4i: Add rtp controller node Hans de Goede ` (2 subsequent siblings) 4 siblings, 1 reply; 14+ messages in thread From: Hans de Goede @ 2013-12-27 14:59 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede The sun4i resisitive touchscreen controller also comes with a built-in temperature sensor. This commit adds support for it. This commit also introduces a new "ts-attached" device-tree property, when this is not set, the input part of the driver won't register. This way the internal temperature sensor can be used to measure the SoC temperature independent of there actually being a touchscreen attached to the controller. Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- .../bindings/input/touchscreen/sun4i.txt | 6 + drivers/input/touchscreen/sun4i-ts.c | 129 ++++++++++++++++----- 2 files changed, 109 insertions(+), 26 deletions(-) diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt index e45927e..1fffd11 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt @@ -6,10 +6,16 @@ Required properties: - reg: mmio address range of the chip - interrupts: interrupt to which the chip is connected +Optional properties: + - ts-attached: boolean set this to tell the driver that an actual touchscreen + is attached and that it should register an input device, + without this it only registers the builtin temperate sensor + Example: rtp: rtp@01c25000 { compatible = "allwinner,sun4i-ts"; reg = <0x01c25000 0x100>; interrupts = <29>; + ts-attached; }; diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c index 10839d2..2d437f6 100644 --- a/drivers/input/touchscreen/sun4i-ts.c +++ b/drivers/input/touchscreen/sun4i-ts.c @@ -3,6 +3,9 @@ * * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> * + * The hwmon parts are based on work by Corentin LABBE which is: + * Copyright (C) 2013 Corentin LABBE <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> + * * 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 @@ -30,6 +33,7 @@ */ #include <linux/err.h> +#include <linux/hwmon.h> #include <linux/init.h> #include <linux/input.h> #include <linux/interrupt.h> @@ -106,6 +110,7 @@ struct sun4i_ts_data { void __iomem *base; unsigned int irq; bool ignore_fifo_data; + int temp_data; }; static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) @@ -115,6 +120,12 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) reg_val = readl(ts->base + TP_INT_FIFOS); + if (reg_val & TEMP_DATA_PENDING) + ts->temp_data = readl(ts->base + TEMP_DATA); + + if (!ts->input) + goto leave; + if (reg_val & FIFO_DATA_PENDING) { x = readl(ts->base + TP_DATA); y = readl(ts->base + TP_DATA); @@ -140,6 +151,7 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) input_sync(ts->input); } +leave: writel(reg_val, ts->base + TP_INT_FIFOS); return IRQ_HANDLED; @@ -149,9 +161,9 @@ static int sun4i_ts_open(struct input_dev *dev) { struct sun4i_ts_data *ts = input_get_drvdata(dev); - /* Flush, set trig level to 1, enable data and up irqs */ - writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) |FIFO_FLUSH(1) | TP_UP_IRQ_EN(1), - ts->base + TP_INT_FIFOC); + /* Flush, set trig level to 1, enable temp, data and up irqs */ + writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | + TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC); return 0; } @@ -160,40 +172,76 @@ static void sun4i_ts_close(struct input_dev *dev) { struct sun4i_ts_data *ts = input_get_drvdata(dev); - /* Deactivate all IRQs */ - writel(0, ts->base + TP_INT_FIFOC); + /* Deactivate all input IRQs */ + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); synchronize_irq(ts->irq); } +static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, + char *buf) +{ + struct sun4i_ts_data *ts = dev_get_drvdata(dev); + + /* No temp_data until the first irq */ + if (ts->temp_data == -1) + return -EAGAIN; + + return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100); +} + +static ssize_t show_temp_label(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + return sprintf(buf, "SoC temperature\n"); +} + +static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); +static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL); + +static struct attribute *sun4i_ts_attrs[] = { + &dev_attr_temp1_input.attr, + &dev_attr_temp1_label.attr, + NULL +}; +ATTRIBUTE_GROUPS(sun4i_ts); + static int sun4i_ts_probe(struct platform_device *pdev) { struct sun4i_ts_data *ts; struct device *dev = &pdev->dev; + struct device_node *np =dev->of_node; + struct device *hwmon; int ret; + bool ts_attached; + + ts_attached = of_property_read_bool(np, "ts-attached"); ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); if (!ts) return -ENOMEM; ts->dev = dev; - - ts->input = devm_input_allocate_device(dev); - if (!ts->input) - return -ENOMEM; - - ts->input->name = pdev->name; - ts->input->phys = "sun4i_ts/input0"; - ts->input->open = sun4i_ts_open; - ts->input->close = sun4i_ts_close; - ts->input->id.bustype = BUS_HOST; - ts->input->id.vendor = 0x0001; - ts->input->id.product = 0x0001; - ts->input->id.version = 0x0100; - ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); - set_bit(BTN_TOUCH, ts->input->keybit); - input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); - input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); - input_set_drvdata(ts->input, ts); + ts->temp_data = -1; + + if (ts_attached) { + ts->input = devm_input_allocate_device(dev); + if (!ts->input) + return -ENOMEM; + + ts->input->name = pdev->name; + ts->input->phys = "sun4i_ts/input0"; + ts->input->open = sun4i_ts_open; + ts->input->close = sun4i_ts_close; + ts->input->id.bustype = BUS_HOST; + ts->input->id.vendor = 0x0001; + ts->input->id.product = 0x0001; + ts->input->id.version = 0x0100; + ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); + set_bit(BTN_TOUCH, ts->input->keybit); + input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); + input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); + input_set_drvdata(ts->input, ts); + } ts->base = devm_ioremap_resource(dev, platform_get_resource(pdev, IORESOURCE_MEM, 0)); @@ -232,14 +280,42 @@ static int sun4i_ts_probe(struct platform_device *pdev) writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1), ts->base + TP_CTRL1); - ret = input_register_device(ts->input); - if (ret) - return ret; + hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts", + ts, sun4i_ts_groups); + if (IS_ERR(hwmon)) { + return PTR_ERR(hwmon); + } + + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); + + if (ts_attached) { + ret = input_register_device(ts->input); + if (ret) { + writel(0, ts->base + TP_INT_FIFOC); + synchronize_irq(ts->irq); + return ret; + } + } platform_set_drvdata(pdev, ts); return 0; } +static int sun4i_ts_remove(struct platform_device *pdev) +{ + struct sun4i_ts_data *ts = platform_get_drvdata(pdev); + + /* Explicit unregister to avoid open/close changing the imask later */ + if (ts->input) + input_unregister_device(ts->input); + + /* Deactivate all IRQs */ + writel(0, ts->base + TP_INT_FIFOC); + synchronize_irq(ts->irq); + + return 0; +} + static const struct of_device_id sun4i_ts_of_match[] = { { .compatible = "allwinner,sun4i-ts", }, { /* sentinel */ } @@ -253,6 +329,7 @@ static struct platform_driver sun4i_ts_driver = { .of_match_table = of_match_ptr(sun4i_ts_of_match), }, .probe = sun4i_ts_probe, + .remove = sun4i_ts_remove, }; module_platform_driver(sun4i_ts_driver); -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
[parent not found: <1388156399-29677-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [lm-sensors] [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <1388156399-29677-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2013-12-27 16:34 ` Guenter Roeck [not found] ` <20131227163419.GA20135-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> 2013-12-28 1:10 ` Dmitry Torokhov 2013-12-28 1:13 ` Dmitry Torokhov 2 siblings, 1 reply; 14+ messages in thread From: Guenter Roeck @ 2013-12-27 16:34 UTC (permalink / raw) To: Hans de Goede Cc: Dmitry Torokhov, LM Sensors, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Corentin LABBE, linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: > The sun4i resisitive touchscreen controller also comes with a built-in > temperature sensor. This commit adds support for it. > > This commit also introduces a new "ts-attached" device-tree property, > when this is not set, the input part of the driver won't register. This way > the internal temperature sensor can be used to measure the SoC temperature > independent of there actually being a touchscreen attached to the controller. > > Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Hi Hans, Almost good, except for a couple of nitpicks and one moe question. Assuming you fix the nitpicks and the question is not a concern, feel free to add Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> Guenter > --- > .../bindings/input/touchscreen/sun4i.txt | 6 + > drivers/input/touchscreen/sun4i-ts.c | 129 ++++++++++++++++----- > 2 files changed, 109 insertions(+), 26 deletions(-) > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt > index e45927e..1fffd11 100644 > --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt > +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt > @@ -6,10 +6,16 @@ Required properties: > - reg: mmio address range of the chip > - interrupts: interrupt to which the chip is connected > > +Optional properties: > + - ts-attached: boolean set this to tell the driver that an actual touchscreen > + is attached and that it should register an input device, > + without this it only registers the builtin temperate sensor > + > Example: > > rtp: rtp@01c25000 { > compatible = "allwinner,sun4i-ts"; > reg = <0x01c25000 0x100>; > interrupts = <29>; > + ts-attached; > }; > diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c > index 10839d2..2d437f6 100644 > --- a/drivers/input/touchscreen/sun4i-ts.c > +++ b/drivers/input/touchscreen/sun4i-ts.c > @@ -3,6 +3,9 @@ > * > * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > * > + * The hwmon parts are based on work by Corentin LABBE which is: > + * Copyright (C) 2013 Corentin LABBE <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > + * > * 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 > @@ -30,6 +33,7 @@ > */ > > #include <linux/err.h> > +#include <linux/hwmon.h> > #include <linux/init.h> > #include <linux/input.h> > #include <linux/interrupt.h> > @@ -106,6 +110,7 @@ struct sun4i_ts_data { > void __iomem *base; > unsigned int irq; > bool ignore_fifo_data; > + int temp_data; > }; > > static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) > @@ -115,6 +120,12 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) > > reg_val = readl(ts->base + TP_INT_FIFOS); > > + if (reg_val & TEMP_DATA_PENDING) > + ts->temp_data = readl(ts->base + TEMP_DATA); Is this read guaranteed to return 0 in the upper bit, or in other words is it guaranteed to never return 0xffffffff ? Otherwise there might be a problem with the implicit conversion to a negative integer. > + > + if (!ts->input) > + goto leave; > + > if (reg_val & FIFO_DATA_PENDING) { > x = readl(ts->base + TP_DATA); > y = readl(ts->base + TP_DATA); > @@ -140,6 +151,7 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) > input_sync(ts->input); > } > > +leave: > writel(reg_val, ts->base + TP_INT_FIFOS); > > return IRQ_HANDLED; > @@ -149,9 +161,9 @@ static int sun4i_ts_open(struct input_dev *dev) > { > struct sun4i_ts_data *ts = input_get_drvdata(dev); > > - /* Flush, set trig level to 1, enable data and up irqs */ > - writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) |FIFO_FLUSH(1) | TP_UP_IRQ_EN(1), > - ts->base + TP_INT_FIFOC); > + /* Flush, set trig level to 1, enable temp, data and up irqs */ > + writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | > + TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC); > > return 0; > } > @@ -160,40 +172,76 @@ static void sun4i_ts_close(struct input_dev *dev) > { > struct sun4i_ts_data *ts = input_get_drvdata(dev); > > - /* Deactivate all IRQs */ > - writel(0, ts->base + TP_INT_FIFOC); > + /* Deactivate all input IRQs */ > + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); > synchronize_irq(ts->irq); > } > > +static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, > + char *buf) > +{ > + struct sun4i_ts_data *ts = dev_get_drvdata(dev); > + > + /* No temp_data until the first irq */ > + if (ts->temp_data == -1) > + return -EAGAIN; > + > + return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100); > +} > + > +static ssize_t show_temp_label(struct device *dev, > + struct device_attribute *devattr, char *buf) > +{ > + return sprintf(buf, "SoC temperature\n"); > +} > + > +static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); > +static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL); > + > +static struct attribute *sun4i_ts_attrs[] = { > + &dev_attr_temp1_input.attr, > + &dev_attr_temp1_label.attr, > + NULL > +}; > +ATTRIBUTE_GROUPS(sun4i_ts); > + > static int sun4i_ts_probe(struct platform_device *pdev) > { > struct sun4i_ts_data *ts; > struct device *dev = &pdev->dev; > + struct device_node *np =dev->of_node; Missing space after '=' (checkpatch error). > + struct device *hwmon; > int ret; > + bool ts_attached; > + > + ts_attached = of_property_read_bool(np, "ts-attached"); > > ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); > if (!ts) > return -ENOMEM; > > ts->dev = dev; > - > - ts->input = devm_input_allocate_device(dev); > - if (!ts->input) > - return -ENOMEM; > - > - ts->input->name = pdev->name; > - ts->input->phys = "sun4i_ts/input0"; > - ts->input->open = sun4i_ts_open; > - ts->input->close = sun4i_ts_close; > - ts->input->id.bustype = BUS_HOST; > - ts->input->id.vendor = 0x0001; > - ts->input->id.product = 0x0001; > - ts->input->id.version = 0x0100; > - ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); > - set_bit(BTN_TOUCH, ts->input->keybit); > - input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); > - input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); > - input_set_drvdata(ts->input, ts); > + ts->temp_data = -1; > + > + if (ts_attached) { > + ts->input = devm_input_allocate_device(dev); > + if (!ts->input) > + return -ENOMEM; > + > + ts->input->name = pdev->name; > + ts->input->phys = "sun4i_ts/input0"; > + ts->input->open = sun4i_ts_open; > + ts->input->close = sun4i_ts_close; > + ts->input->id.bustype = BUS_HOST; > + ts->input->id.vendor = 0x0001; > + ts->input->id.product = 0x0001; > + ts->input->id.version = 0x0100; > + ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); > + set_bit(BTN_TOUCH, ts->input->keybit); > + input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); > + input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); > + input_set_drvdata(ts->input, ts); > + } > > ts->base = devm_ioremap_resource(dev, > platform_get_resource(pdev, IORESOURCE_MEM, 0)); > @@ -232,14 +280,42 @@ static int sun4i_ts_probe(struct platform_device *pdev) > writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1), > ts->base + TP_CTRL1); > > - ret = input_register_device(ts->input); > - if (ret) > - return ret; > + hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts", > + ts, sun4i_ts_groups); > + if (IS_ERR(hwmon)) { > + return PTR_ERR(hwmon); > + } { } are not needed here (checkpatch warning). > + > + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); > + > + if (ts_attached) { > + ret = input_register_device(ts->input); > + if (ret) { > + writel(0, ts->base + TP_INT_FIFOC); > + synchronize_irq(ts->irq); > + return ret; > + } > + } > > platform_set_drvdata(pdev, ts); > return 0; > } > > +static int sun4i_ts_remove(struct platform_device *pdev) > +{ > + struct sun4i_ts_data *ts = platform_get_drvdata(pdev); > + > + /* Explicit unregister to avoid open/close changing the imask later */ > + if (ts->input) > + input_unregister_device(ts->input); > + > + /* Deactivate all IRQs */ > + writel(0, ts->base + TP_INT_FIFOC); > + synchronize_irq(ts->irq); > + > + return 0; > +} > + > static const struct of_device_id sun4i_ts_of_match[] = { > { .compatible = "allwinner,sun4i-ts", }, > { /* sentinel */ } > @@ -253,6 +329,7 @@ static struct platform_driver sun4i_ts_driver = { > .of_match_table = of_match_ptr(sun4i_ts_of_match), > }, > .probe = sun4i_ts_probe, > + .remove = sun4i_ts_remove, > }; > > module_platform_driver(sun4i_ts_driver); > -- > 1.8.4.2 > > > _______________________________________________ > lm-sensors mailing list > lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org > http://lists.lm-sensors.org/mailman/listinfo/lm-sensors > ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <20131227163419.GA20135-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>]
* Re: [lm-sensors] [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <20131227163419.GA20135-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> @ 2013-12-31 10:57 ` Hans de Goede 0 siblings, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-31 10:57 UTC (permalink / raw) To: Guenter Roeck Cc: Dmitry Torokhov, LM Sensors, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Corentin LABBE, linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Hi, On 12/27/2013 05:34 PM, Guenter Roeck wrote: > On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: >> The sun4i resisitive touchscreen controller also comes with a built-in >> temperature sensor. This commit adds support for it. >> >> This commit also introduces a new "ts-attached" device-tree property, >> when this is not set, the input part of the driver won't register. This way >> the internal temperature sensor can be used to measure the SoC temperature >> independent of there actually being a touchscreen attached to the controller. >> >> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > > Hi Hans, > > Almost good, except for a couple of nitpicks and one moe question. > Assuming you fix the nitpicks and the question is not a concern, > feel free to add > > Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> > > Guenter > >> --- >> .../bindings/input/touchscreen/sun4i.txt | 6 + >> drivers/input/touchscreen/sun4i-ts.c | 129 ++++++++++++++++----- >> 2 files changed, 109 insertions(+), 26 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt >> index e45927e..1fffd11 100644 >> --- a/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt >> +++ b/Documentation/devicetree/bindings/input/touchscreen/sun4i.txt >> @@ -6,10 +6,16 @@ Required properties: >> - reg: mmio address range of the chip >> - interrupts: interrupt to which the chip is connected >> >> +Optional properties: >> + - ts-attached: boolean set this to tell the driver that an actual touchscreen >> + is attached and that it should register an input device, >> + without this it only registers the builtin temperate sensor >> + >> Example: >> >> rtp: rtp@01c25000 { >> compatible = "allwinner,sun4i-ts"; >> reg = <0x01c25000 0x100>; >> interrupts = <29>; >> + ts-attached; >> }; >> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c >> index 10839d2..2d437f6 100644 >> --- a/drivers/input/touchscreen/sun4i-ts.c >> +++ b/drivers/input/touchscreen/sun4i-ts.c >> @@ -3,6 +3,9 @@ >> * >> * Copyright (C) 2013 - 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> * >> + * The hwmon parts are based on work by Corentin LABBE which is: >> + * Copyright (C) 2013 Corentin LABBE <clabbe.montjoie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> + * >> * 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 >> @@ -30,6 +33,7 @@ >> */ >> >> #include <linux/err.h> >> +#include <linux/hwmon.h> >> #include <linux/init.h> >> #include <linux/input.h> >> #include <linux/interrupt.h> >> @@ -106,6 +110,7 @@ struct sun4i_ts_data { >> void __iomem *base; >> unsigned int irq; >> bool ignore_fifo_data; >> + int temp_data; >> }; >> >> static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) >> @@ -115,6 +120,12 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) >> >> reg_val = readl(ts->base + TP_INT_FIFOS); >> >> + if (reg_val & TEMP_DATA_PENDING) >> + ts->temp_data = readl(ts->base + TEMP_DATA); > > Is this read guaranteed to return 0 in the upper bit, or in other words is it > guaranteed to never return 0xffffffff ? Otherwise there might be a problem with > the implicit conversion to a negative integer. Yes what is being read is a 12 bit unsigned value, with all the upper bits set to 0. > >> + >> + if (!ts->input) >> + goto leave; >> + >> if (reg_val & FIFO_DATA_PENDING) { >> x = readl(ts->base + TP_DATA); >> y = readl(ts->base + TP_DATA); >> @@ -140,6 +151,7 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) >> input_sync(ts->input); >> } >> >> +leave: >> writel(reg_val, ts->base + TP_INT_FIFOS); >> >> return IRQ_HANDLED; >> @@ -149,9 +161,9 @@ static int sun4i_ts_open(struct input_dev *dev) >> { >> struct sun4i_ts_data *ts = input_get_drvdata(dev); >> >> - /* Flush, set trig level to 1, enable data and up irqs */ >> - writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) |FIFO_FLUSH(1) | TP_UP_IRQ_EN(1), >> - ts->base + TP_INT_FIFOC); >> + /* Flush, set trig level to 1, enable temp, data and up irqs */ >> + writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | >> + TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC); >> >> return 0; >> } >> @@ -160,40 +172,76 @@ static void sun4i_ts_close(struct input_dev *dev) >> { >> struct sun4i_ts_data *ts = input_get_drvdata(dev); >> >> - /* Deactivate all IRQs */ >> - writel(0, ts->base + TP_INT_FIFOC); >> + /* Deactivate all input IRQs */ >> + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); >> synchronize_irq(ts->irq); >> } >> >> +static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, >> + char *buf) >> +{ >> + struct sun4i_ts_data *ts = dev_get_drvdata(dev); >> + >> + /* No temp_data until the first irq */ >> + if (ts->temp_data == -1) >> + return -EAGAIN; >> + >> + return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100); >> +} >> + >> +static ssize_t show_temp_label(struct device *dev, >> + struct device_attribute *devattr, char *buf) >> +{ >> + return sprintf(buf, "SoC temperature\n"); >> +} >> + >> +static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); >> +static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL); >> + >> +static struct attribute *sun4i_ts_attrs[] = { >> + &dev_attr_temp1_input.attr, >> + &dev_attr_temp1_label.attr, >> + NULL >> +}; >> +ATTRIBUTE_GROUPS(sun4i_ts); >> + >> static int sun4i_ts_probe(struct platform_device *pdev) >> { >> struct sun4i_ts_data *ts; >> struct device *dev = &pdev->dev; >> + struct device_node *np =dev->of_node; > > Missing space after '=' (checkpatch error). > >> + struct device *hwmon; >> int ret; >> + bool ts_attached; >> + >> + ts_attached = of_property_read_bool(np, "ts-attached"); >> >> ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); >> if (!ts) >> return -ENOMEM; >> >> ts->dev = dev; >> - >> - ts->input = devm_input_allocate_device(dev); >> - if (!ts->input) >> - return -ENOMEM; >> - >> - ts->input->name = pdev->name; >> - ts->input->phys = "sun4i_ts/input0"; >> - ts->input->open = sun4i_ts_open; >> - ts->input->close = sun4i_ts_close; >> - ts->input->id.bustype = BUS_HOST; >> - ts->input->id.vendor = 0x0001; >> - ts->input->id.product = 0x0001; >> - ts->input->id.version = 0x0100; >> - ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); >> - set_bit(BTN_TOUCH, ts->input->keybit); >> - input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); >> - input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); >> - input_set_drvdata(ts->input, ts); >> + ts->temp_data = -1; >> + >> + if (ts_attached) { >> + ts->input = devm_input_allocate_device(dev); >> + if (!ts->input) >> + return -ENOMEM; >> + >> + ts->input->name = pdev->name; >> + ts->input->phys = "sun4i_ts/input0"; >> + ts->input->open = sun4i_ts_open; >> + ts->input->close = sun4i_ts_close; >> + ts->input->id.bustype = BUS_HOST; >> + ts->input->id.vendor = 0x0001; >> + ts->input->id.product = 0x0001; >> + ts->input->id.version = 0x0100; >> + ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); >> + set_bit(BTN_TOUCH, ts->input->keybit); >> + input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); >> + input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); >> + input_set_drvdata(ts->input, ts); >> + } >> >> ts->base = devm_ioremap_resource(dev, >> platform_get_resource(pdev, IORESOURCE_MEM, 0)); >> @@ -232,14 +280,42 @@ static int sun4i_ts_probe(struct platform_device *pdev) >> writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1), >> ts->base + TP_CTRL1); >> >> - ret = input_register_device(ts->input); >> - if (ret) >> - return ret; >> + hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts", >> + ts, sun4i_ts_groups); >> + if (IS_ERR(hwmon)) { >> + return PTR_ERR(hwmon); >> + } > > { } are not needed here (checkpatch warning). Oops, should have run checkpatch on v2 too, my bad. Both fixed now. Regards, Hans ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <1388156399-29677-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2013-12-27 16:34 ` [lm-sensors] " Guenter Roeck @ 2013-12-28 1:10 ` Dmitry Torokhov [not found] ` <20131228011007.GA14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 2013-12-28 1:13 ` Dmitry Torokhov 2 siblings, 1 reply; 14+ messages in thread From: Dmitry Torokhov @ 2013-12-28 1:10 UTC (permalink / raw) To: Hans de Goede Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi Hans, On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: > + > + if (!ts->input) > + goto leave; > + > if (reg_val & FIFO_DATA_PENDING) { > x = readl(ts->base + TP_DATA); > y = readl(ts->base + TP_DATA); > @@ -140,6 +151,7 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) > input_sync(ts->input); > } > > +leave: Can we please not introduce gotos where they are not needed? If you concerned about extra indent just split touchscreen handling into a separate function and then do if (ts->input) sun4i_ts_handle_touchscreen_data(...); > writel(reg_val, ts->base + TP_INT_FIFOS); > > return IRQ_HANDLED; > @@ -149,9 +161,9 @@ static int sun4i_ts_open(struct input_dev *dev) > { > struct sun4i_ts_data *ts = input_get_drvdata(dev); > > - /* Flush, set trig level to 1, enable data and up irqs */ > - writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) |FIFO_FLUSH(1) | TP_UP_IRQ_EN(1), > - ts->base + TP_INT_FIFOC); > + /* Flush, set trig level to 1, enable temp, data and up irqs */ > + writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | > + TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC); > > return 0; > } > @@ -160,40 +172,76 @@ static void sun4i_ts_close(struct input_dev *dev) > { > struct sun4i_ts_data *ts = input_get_drvdata(dev); > > - /* Deactivate all IRQs */ > - writel(0, ts->base + TP_INT_FIFOC); > + /* Deactivate all input IRQs */ > + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); > synchronize_irq(ts->irq); Hmm, it would be nice we touchscreen methods only affected touchscreen functionality. Can you read current state and adjust it as needed instead of clobbering it? Then you could do away with remove() method altogether. > } > > +static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, > + char *buf) > +{ > + struct sun4i_ts_data *ts = dev_get_drvdata(dev); > + > + /* No temp_data until the first irq */ > + if (ts->temp_data == -1) > + return -EAGAIN; > + > + return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100); > +} > + > +static ssize_t show_temp_label(struct device *dev, > + struct device_attribute *devattr, char *buf) > +{ > + return sprintf(buf, "SoC temperature\n"); > +} > + > +static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); > +static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL); > + > +static struct attribute *sun4i_ts_attrs[] = { > + &dev_attr_temp1_input.attr, > + &dev_attr_temp1_label.attr, > + NULL > +}; > +ATTRIBUTE_GROUPS(sun4i_ts); > + > static int sun4i_ts_probe(struct platform_device *pdev) > { > struct sun4i_ts_data *ts; > struct device *dev = &pdev->dev; > + struct device_node *np =dev->of_node; > + struct device *hwmon; > int ret; > + bool ts_attached; > + > + ts_attached = of_property_read_bool(np, "ts-attached"); > > ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); > if (!ts) > return -ENOMEM; > > ts->dev = dev; > - > - ts->input = devm_input_allocate_device(dev); > - if (!ts->input) > - return -ENOMEM; > - > - ts->input->name = pdev->name; > - ts->input->phys = "sun4i_ts/input0"; > - ts->input->open = sun4i_ts_open; > - ts->input->close = sun4i_ts_close; > - ts->input->id.bustype = BUS_HOST; > - ts->input->id.vendor = 0x0001; > - ts->input->id.product = 0x0001; > - ts->input->id.version = 0x0100; > - ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); > - set_bit(BTN_TOUCH, ts->input->keybit); > - input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); > - input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); > - input_set_drvdata(ts->input, ts); > + ts->temp_data = -1; > + > + if (ts_attached) { > + ts->input = devm_input_allocate_device(dev); > + if (!ts->input) > + return -ENOMEM; > + > + ts->input->name = pdev->name; > + ts->input->phys = "sun4i_ts/input0"; > + ts->input->open = sun4i_ts_open; > + ts->input->close = sun4i_ts_close; > + ts->input->id.bustype = BUS_HOST; > + ts->input->id.vendor = 0x0001; > + ts->input->id.product = 0x0001; > + ts->input->id.version = 0x0100; > + ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); > + set_bit(BTN_TOUCH, ts->input->keybit); > + input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); > + input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); > + input_set_drvdata(ts->input, ts); > + } > > ts->base = devm_ioremap_resource(dev, > platform_get_resource(pdev, IORESOURCE_MEM, 0)); > @@ -232,14 +280,42 @@ static int sun4i_ts_probe(struct platform_device *pdev) > writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1), > ts->base + TP_CTRL1); > > - ret = input_register_device(ts->input); > - if (ret) > - return ret; > + hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts", > + ts, sun4i_ts_groups); > + if (IS_ERR(hwmon)) { > + return PTR_ERR(hwmon); > + } > + > + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); > + > + if (ts_attached) { > + ret = input_register_device(ts->input); > + if (ret) { > + writel(0, ts->base + TP_INT_FIFOC); > + synchronize_irq(ts->irq); Given that we now can't avoid freeing irq before freeing ts memory or input device I think you can do away with synchronize_irq() here and elsewhere as freeing irq is guaranteed to wait for current interrupt to complete. > + return ret; > + } > + } > > platform_set_drvdata(pdev, ts); > return 0; > } > > +static int sun4i_ts_remove(struct platform_device *pdev) > +{ > + struct sun4i_ts_data *ts = platform_get_drvdata(pdev); > + > + /* Explicit unregister to avoid open/close changing the imask later */ > + if (ts->input) > + input_unregister_device(ts->input); > + > + /* Deactivate all IRQs */ > + writel(0, ts->base + TP_INT_FIFOC); > + synchronize_irq(ts->irq); > + > + return 0; > +} > + > static const struct of_device_id sun4i_ts_of_match[] = { > { .compatible = "allwinner,sun4i-ts", }, > { /* sentinel */ } > @@ -253,6 +329,7 @@ static struct platform_driver sun4i_ts_driver = { > .of_match_table = of_match_ptr(sun4i_ts_of_match), > }, > .probe = sun4i_ts_probe, > + .remove = sun4i_ts_remove, > }; > > module_platform_driver(sun4i_ts_driver); > -- > 1.8.4.2 > Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <20131228011007.GA14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>]
* Re: [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <20131228011007.GA14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> @ 2013-12-31 11:10 ` Hans de Goede 0 siblings, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-31 11:10 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 12/28/2013 02:10 AM, Dmitry Torokhov wrote: > Hi Hans, > > On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: >> + >> + if (!ts->input) >> + goto leave; >> + >> if (reg_val & FIFO_DATA_PENDING) { >> x = readl(ts->base + TP_DATA); >> y = readl(ts->base + TP_DATA); >> @@ -140,6 +151,7 @@ static irqreturn_t sun4i_ts_irq(int irq, void *dev_id) >> input_sync(ts->input); >> } >> >> +leave: > > Can we please not introduce gotos where they are not needed? If you > concerned about extra indent just split touchscreen handling into a > separate function and then do > > if (ts->input) > sun4i_ts_handle_touchscreen_data(...); > Fixed. > >> writel(reg_val, ts->base + TP_INT_FIFOS); >> >> return IRQ_HANDLED; >> @@ -149,9 +161,9 @@ static int sun4i_ts_open(struct input_dev *dev) >> { >> struct sun4i_ts_data *ts = input_get_drvdata(dev); >> >> - /* Flush, set trig level to 1, enable data and up irqs */ >> - writel(DATA_IRQ_EN(1) | FIFO_TRIG(1) |FIFO_FLUSH(1) | TP_UP_IRQ_EN(1), >> - ts->base + TP_INT_FIFOC); >> + /* Flush, set trig level to 1, enable temp, data and up irqs */ >> + writel(TEMP_IRQ_EN(1) | DATA_IRQ_EN(1) | FIFO_TRIG(1) | FIFO_FLUSH(1) | >> + TP_UP_IRQ_EN(1), ts->base + TP_INT_FIFOC); >> >> return 0; >> } >> @@ -160,40 +172,76 @@ static void sun4i_ts_close(struct input_dev *dev) >> { >> struct sun4i_ts_data *ts = input_get_drvdata(dev); >> >> - /* Deactivate all IRQs */ >> - writel(0, ts->base + TP_INT_FIFOC); >> + /* Deactivate all input IRQs */ >> + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); >> synchronize_irq(ts->irq); > > Hmm, it would be nice we touchscreen methods only affected touchscreen > functionality. Can you read current state and adjust it as needed > instead of clobbering it? I could do a read-modify-write of TP_INT_FIFOC here, but I already considered that and I decided not to do it because ... > Then you could do away with remove() method altogether. No it will still be needed to clear the TEMP_IRQ_EN bit in TP_INT_FIFOC. And it will still need to either explicitly deregister the input_dev, or take the input_dev mutex to avoid the modification of TP_INT_FIFOC in _remove racing with the read-modify-write in _close. So I decided to keep this kiss, and simply force _close to run before _remove clears the TEMP_IRQ_EN bit by doing an explicit unregister before this. > >> } >> >> +static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, >> + char *buf) >> +{ >> + struct sun4i_ts_data *ts = dev_get_drvdata(dev); >> + >> + /* No temp_data until the first irq */ >> + if (ts->temp_data == -1) >> + return -EAGAIN; >> + >> + return sprintf(buf, "%d\n", (ts->temp_data - 1447) * 100); >> +} >> + >> +static ssize_t show_temp_label(struct device *dev, >> + struct device_attribute *devattr, char *buf) >> +{ >> + return sprintf(buf, "SoC temperature\n"); >> +} >> + >> +static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL); >> +static DEVICE_ATTR(temp1_label, S_IRUGO, show_temp_label, NULL); >> + >> +static struct attribute *sun4i_ts_attrs[] = { >> + &dev_attr_temp1_input.attr, >> + &dev_attr_temp1_label.attr, >> + NULL >> +}; >> +ATTRIBUTE_GROUPS(sun4i_ts); >> + >> static int sun4i_ts_probe(struct platform_device *pdev) >> { >> struct sun4i_ts_data *ts; >> struct device *dev = &pdev->dev; >> + struct device_node *np =dev->of_node; >> + struct device *hwmon; >> int ret; >> + bool ts_attached; >> + >> + ts_attached = of_property_read_bool(np, "ts-attached"); >> >> ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); >> if (!ts) >> return -ENOMEM; >> >> ts->dev = dev; >> - >> - ts->input = devm_input_allocate_device(dev); >> - if (!ts->input) >> - return -ENOMEM; >> - >> - ts->input->name = pdev->name; >> - ts->input->phys = "sun4i_ts/input0"; >> - ts->input->open = sun4i_ts_open; >> - ts->input->close = sun4i_ts_close; >> - ts->input->id.bustype = BUS_HOST; >> - ts->input->id.vendor = 0x0001; >> - ts->input->id.product = 0x0001; >> - ts->input->id.version = 0x0100; >> - ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); >> - set_bit(BTN_TOUCH, ts->input->keybit); >> - input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); >> - input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); >> - input_set_drvdata(ts->input, ts); >> + ts->temp_data = -1; >> + >> + if (ts_attached) { >> + ts->input = devm_input_allocate_device(dev); >> + if (!ts->input) >> + return -ENOMEM; >> + >> + ts->input->name = pdev->name; >> + ts->input->phys = "sun4i_ts/input0"; >> + ts->input->open = sun4i_ts_open; >> + ts->input->close = sun4i_ts_close; >> + ts->input->id.bustype = BUS_HOST; >> + ts->input->id.vendor = 0x0001; >> + ts->input->id.product = 0x0001; >> + ts->input->id.version = 0x0100; >> + ts->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); >> + set_bit(BTN_TOUCH, ts->input->keybit); >> + input_set_abs_params(ts->input, ABS_X, 0, 4095, 0, 0); >> + input_set_abs_params(ts->input, ABS_Y, 0, 4095, 0, 0); >> + input_set_drvdata(ts->input, ts); >> + } >> >> ts->base = devm_ioremap_resource(dev, >> platform_get_resource(pdev, IORESOURCE_MEM, 0)); >> @@ -232,14 +280,42 @@ static int sun4i_ts_probe(struct platform_device *pdev) >> writel(STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1) | TP_MODE_EN(1), >> ts->base + TP_CTRL1); >> >> - ret = input_register_device(ts->input); >> - if (ret) >> - return ret; >> + hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts", >> + ts, sun4i_ts_groups); >> + if (IS_ERR(hwmon)) { >> + return PTR_ERR(hwmon); >> + } >> + >> + writel(TEMP_IRQ_EN(1), ts->base + TP_INT_FIFOC); >> + >> + if (ts_attached) { >> + ret = input_register_device(ts->input); >> + if (ret) { >> + writel(0, ts->base + TP_INT_FIFOC); >> + synchronize_irq(ts->irq); > > Given that we now can't avoid freeing irq before freeing ts memory or > input device I think you can do away with synchronize_irq() here and > elsewhere as freeing irq is guaranteed to wait for current interrupt to > complete. Ah yes, removed all calls to synchronize_irq. I'll run some tests to ensure I did not accidentally break anything and then I'll send a v3. > >> + return ret; >> + } >> + } >> >> platform_set_drvdata(pdev, ts); >> return 0; >> } >> >> +static int sun4i_ts_remove(struct platform_device *pdev) >> +{ >> + struct sun4i_ts_data *ts = platform_get_drvdata(pdev); >> + >> + /* Explicit unregister to avoid open/close changing the imask later */ >> + if (ts->input) >> + input_unregister_device(ts->input); >> + >> + /* Deactivate all IRQs */ >> + writel(0, ts->base + TP_INT_FIFOC); >> + synchronize_irq(ts->irq); >> + >> + return 0; >> +} >> + >> static const struct of_device_id sun4i_ts_of_match[] = { >> { .compatible = "allwinner,sun4i-ts", }, >> { /* sentinel */ } >> @@ -253,6 +329,7 @@ static struct platform_driver sun4i_ts_driver = { >> .of_match_table = of_match_ptr(sun4i_ts_of_match), >> }, >> .probe = sun4i_ts_probe, >> + .remove = sun4i_ts_remove, >> }; >> >> module_platform_driver(sun4i_ts_driver); >> -- >> 1.8.4.2 >> > > Thanks. > Regards, Hans ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <1388156399-29677-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2013-12-27 16:34 ` [lm-sensors] " Guenter Roeck 2013-12-28 1:10 ` Dmitry Torokhov @ 2013-12-28 1:13 ` Dmitry Torokhov [not found] ` <20131228011304.GB14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 2 siblings, 1 reply; 14+ messages in thread From: Dmitry Torokhov @ 2013-12-28 1:13 UTC (permalink / raw) To: Hans de Goede Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: > > +Optional properties: > + - ts-attached: boolean set this to tell the driver that an actual touchscreen > + is attached and that it should register an input device, > + without this it only registers the builtin temperate sensor I believe the guidance is to avoid describing kernel behavior in DT property so I think it should say: - ts-attached: boolean indicating that an actual touchscreen is attached to the controller. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 14+ messages in thread
[parent not found: <20131228011304.GB14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>]
* Re: [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <20131228011304.GB14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> @ 2013-12-31 11:17 ` Hans de Goede 2013-12-31 13:00 ` Maxime Ripard 1 sibling, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-31 11:17 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 12/28/2013 02:13 AM, Dmitry Torokhov wrote: > On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: >> >> +Optional properties: >> + - ts-attached: boolean set this to tell the driver that an actual touchscreen >> + is attached and that it should register an input device, >> + without this it only registers the builtin temperate sensor > > I believe the guidance is to avoid describing kernel behavior in DT > property so I think it should say: > > - ts-attached: boolean indicating that an actual touchscreen is > attached to the controller. Will also fix for v3. Regards, Hans ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor [not found] ` <20131228011304.GB14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 2013-12-31 11:17 ` Hans de Goede @ 2013-12-31 13:00 ` Maxime Ripard 2013-12-31 15:02 ` Hans de Goede 1 sibling, 1 reply; 14+ messages in thread From: Maxime Ripard @ 2013-12-31 13:00 UTC (permalink / raw) To: Hans de Goede Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 808 bytes --] Hi, On Fri, Dec 27, 2013 at 05:13:04PM -0800, Dmitry Torokhov wrote: > On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: > > > > +Optional properties: > > + - ts-attached: boolean set this to tell the driver that an actual touchscreen > > + is attached and that it should register an input device, > > + without this it only registers the builtin temperate sensor > > I believe the guidance is to avoid describing kernel behavior in DT > property so I think it should say: > > - ts-attached: boolean indicating that an actual touchscreen is > attached to the controller. Custom properties are also supposed to be prefixed by the vendor prefix. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor 2013-12-31 13:00 ` Maxime Ripard @ 2013-12-31 15:02 ` Hans de Goede 0 siblings, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-31 15:02 UTC (permalink / raw) To: Maxime Ripard Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 12/31/2013 02:00 PM, Maxime Ripard wrote: > Hi, > > On Fri, Dec 27, 2013 at 05:13:04PM -0800, Dmitry Torokhov wrote: >> On Fri, Dec 27, 2013 at 03:59:56PM +0100, Hans de Goede wrote: >>> >>> +Optional properties: >>> + - ts-attached: boolean set this to tell the driver that an actual touchscreen >>> + is attached and that it should register an input device, >>> + without this it only registers the builtin temperate sensor >> >> I believe the guidance is to avoid describing kernel behavior in DT >> property so I think it should say: >> >> - ts-attached: boolean indicating that an actual touchscreen is >> attached to the controller. > > Custom properties are also supposed to be prefixed by the vendor prefix. Will fix for v3. Regards, Hans ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 3/5] ARM: dts: sun4i: Add rtp controller node [not found] ` <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2013-12-27 14:59 ` [PATCH v2 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller Hans de Goede 2013-12-27 14:59 ` [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor Hans de Goede @ 2013-12-27 14:59 ` Hans de Goede 2013-12-27 14:59 ` [PATCH v2 4/5] ARM: dts: sun5i: " Hans de Goede 2013-12-27 14:59 ` [PATCH v2 5/5] ARM: dts: sun7i: " Hans de Goede 4 siblings, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-27 14:59 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- arch/arm/boot/dts/sun4i-a10.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi index de1dd73..502f3e2 100644 --- a/arch/arm/boot/dts/sun4i-a10.dtsi +++ b/arch/arm/boot/dts/sun4i-a10.dtsi @@ -452,6 +452,12 @@ reg = <0x01c23800 0x10>; }; + rtp: rtp@01c25000 { + compatible = "allwinner,sun4i-ts"; + reg = <0x01c25000 0x100>; + interrupts = <29>; + }; + uart0: serial@01c28000 { compatible = "snps,dw-apb-uart"; reg = <0x01c28000 0x400>; -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/5] ARM: dts: sun5i: Add rtp controller node [not found] ` <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> ` (2 preceding siblings ...) 2013-12-27 14:59 ` [PATCH v2 3/5] ARM: dts: sun4i: Add rtp controller node Hans de Goede @ 2013-12-27 14:59 ` Hans de Goede 2013-12-27 14:59 ` [PATCH v2 5/5] ARM: dts: sun7i: " Hans de Goede 4 siblings, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-27 14:59 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- arch/arm/boot/dts/sun5i-a10s.dtsi | 6 ++++++ arch/arm/boot/dts/sun5i-a13.dtsi | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi index 948eb10..34dd303 100644 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi @@ -409,6 +409,12 @@ reg = <0x01c23800 0x10>; }; + rtp: rtp@01c25000 { + compatible = "allwinner,sun4i-ts"; + reg = <0x01c25000 0x100>; + interrupts = <29>; + }; + uart0: serial@01c28000 { compatible = "snps,dw-apb-uart"; reg = <0x01c28000 0x400>; diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi index ca15672..264cfa4 100644 --- a/arch/arm/boot/dts/sun5i-a13.dtsi +++ b/arch/arm/boot/dts/sun5i-a13.dtsi @@ -367,6 +367,12 @@ reg = <0x01c23800 0x10>; }; + rtp: rtp@01c25000 { + compatible = "allwinner,sun4i-ts"; + reg = <0x01c25000 0x100>; + interrupts = <29>; + }; + uart1: serial@01c28400 { compatible = "snps,dw-apb-uart"; reg = <0x01c28400 0x400>; -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 5/5] ARM: dts: sun7i: Add rtp controller node [not found] ` <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> ` (3 preceding siblings ...) 2013-12-27 14:59 ` [PATCH v2 4/5] ARM: dts: sun5i: " Hans de Goede @ 2013-12-27 14:59 ` Hans de Goede 4 siblings, 0 replies; 14+ messages in thread From: Hans de Goede @ 2013-12-27 14:59 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, LM Sensors, Maxime Ripard, Corentin LABBE, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- arch/arm/boot/dts/sun7i-a20.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index 3231789..68e825a 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi @@ -536,6 +536,12 @@ reg = <0x01c23800 0x200>; }; + rtp: rtp@01c25000 { + compatible = "allwinner,sun4i-ts"; + reg = <0x01c25000 0x100>; + interrupts = <0 29 4>; + }; + uart0: serial@01c28000 { compatible = "snps,dw-apb-uart"; reg = <0x01c28000 0x400>; -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-12-31 15:02 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-12-27 14:59 [PATCH v2 0/5] input: Add new sun4i-ts driver for Allwinner sunxi Hans de Goede [not found] ` <1388156399-29677-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2013-12-27 14:59 ` [PATCH v2 1/5] input: Add new sun4i-ts driver for Allwinner sunxi SoC's rtp controller Hans de Goede 2013-12-27 14:59 ` [PATCH v2 2/5] input: sun4i-ts: Add support for temperature sensor Hans de Goede [not found] ` <1388156399-29677-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2013-12-27 16:34 ` [lm-sensors] " Guenter Roeck [not found] ` <20131227163419.GA20135-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org> 2013-12-31 10:57 ` Hans de Goede 2013-12-28 1:10 ` Dmitry Torokhov [not found] ` <20131228011007.GA14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 2013-12-31 11:10 ` Hans de Goede 2013-12-28 1:13 ` Dmitry Torokhov [not found] ` <20131228011304.GB14188-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> 2013-12-31 11:17 ` Hans de Goede 2013-12-31 13:00 ` Maxime Ripard 2013-12-31 15:02 ` Hans de Goede 2013-12-27 14:59 ` [PATCH v2 3/5] ARM: dts: sun4i: Add rtp controller node Hans de Goede 2013-12-27 14:59 ` [PATCH v2 4/5] ARM: dts: sun5i: " Hans de Goede 2013-12-27 14:59 ` [PATCH v2 5/5] ARM: dts: sun7i: " Hans de Goede
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).