* [PATCH v2 00/15] iio: adc: at91 cleanups and atmel_tsadcc removal
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
This patch set is a followup of my previous series: iio: adc: at91 fixes
1-3) The first 3 patches are cleaning up the patform_data used for at91_adc.
4-5) Then touchscreen support for older ADCs is added, this allows to use that
for the sam9m10g45ek.
6) Following those modifications, the mach/at91_adc.h is not used anywhere but
in the at91_adc driver so it is remove and its content (register definitions)
placed directly in the driver.
7-9) at91sam9rl support is added to at91_adc and is used for the at91sam9rl
based boards.
10-11) Prepare the atmel_tsadcc removal by switching sam9rl and sam9g45 to use
only at91_adc instead of atmel_tsadcc.
12-15) atmel_tsadcc removal
Changes in v2:
- reworked the IRQ handlers in patch 4 as suggested by Dmitry and Thomas
- ts_bufferedmeasure is now a bool
- the multiline comment is now correctly formatted
- improved commit log for patch 5
Alexandre Belloni (15):
ARM: at91: sam9g45: remove unused platform_data
ARM: at91: sam9260: remove unused platform_data
iio: adc: at91: cleanup platform_data
iio: adc: at91_adc: Add support for touchscreens without TSMR
ARM: at91: sam9m10g45ek: Add touchscreen support through at91_adc
iio: adc: at91: remove unused include from include/mach
iio: adc: at91: add sam9rl support
ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
ARM: at91: sam9rlek add touchscreen support through at91_adc
ARM: at91: sam9g45: switch from atmel_tsadcc to at91_adc
ARM: at91: sam9rl: switch from atmel_tsadcc to at91_adc
ARM: at91: remove atmel_tsadcc platform_data
ARM: at91: remove atmel_tsadcc from sama5_defconfig
Input: atmel_tsadcc: remove driver
ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node
MAINTAINERS | 6 -
arch/arm/boot/dts/at91-cosino_mega2560.dts | 5 -
arch/arm/configs/at91sam9g45_defconfig | 3 +-
arch/arm/configs/at91sam9rl_defconfig | 3 +-
arch/arm/configs/sama5_defconfig | 1 -
arch/arm/mach-at91/at91sam9260_devices.c | 10 -
arch/arm/mach-at91/at91sam9g45.c | 2 +-
arch/arm/mach-at91/at91sam9g45_devices.c | 63 +----
arch/arm/mach-at91/at91sam9rl.c | 7 +
arch/arm/mach-at91/at91sam9rl_devices.c | 83 +++++--
arch/arm/mach-at91/board-sam9m10g45ek.c | 16 +-
arch/arm/mach-at91/board-sam9rlek.c | 16 +-
arch/arm/mach-at91/board.h | 3 -
arch/arm/mach-at91/include/mach/at91_adc.h | 107 ---------
drivers/iio/adc/at91_adc.c | 340 +++++++++++++++++++++++----
drivers/input/touchscreen/Kconfig | 12 -
drivers/input/touchscreen/Makefile | 1 -
drivers/input/touchscreen/atmel_tsadcc.c | 358 -----------------------------
include/linux/platform_data/at91_adc.h | 27 +--
include/linux/platform_data/atmel.h | 7 -
20 files changed, 382 insertions(+), 688 deletions(-)
delete mode 100644 arch/arm/mach-at91/include/mach/at91_adc.h
delete mode 100644 drivers/input/touchscreen/atmel_tsadcc.c
--
1.8.3.2
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 00/15] iio: adc: at91 cleanups and atmel_tsadcc removal
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: linux-arm-kernel
This patch set is a followup of my previous series: iio: adc: at91 fixes
1-3) The first 3 patches are cleaning up the patform_data used for at91_adc.
4-5) Then touchscreen support for older ADCs is added, this allows to use that
for the sam9m10g45ek.
6) Following those modifications, the mach/at91_adc.h is not used anywhere but
in the at91_adc driver so it is remove and its content (register definitions)
placed directly in the driver.
7-9) at91sam9rl support is added to at91_adc and is used for the at91sam9rl
based boards.
10-11) Prepare the atmel_tsadcc removal by switching sam9rl and sam9g45 to use
only at91_adc instead of atmel_tsadcc.
12-15) atmel_tsadcc removal
Changes in v2:
- reworked the IRQ handlers in patch 4 as suggested by Dmitry and Thomas
- ts_bufferedmeasure is now a bool
- the multiline comment is now correctly formatted
- improved commit log for patch 5
Alexandre Belloni (15):
ARM: at91: sam9g45: remove unused platform_data
ARM: at91: sam9260: remove unused platform_data
iio: adc: at91: cleanup platform_data
iio: adc: at91_adc: Add support for touchscreens without TSMR
ARM: at91: sam9m10g45ek: Add touchscreen support through at91_adc
iio: adc: at91: remove unused include from include/mach
iio: adc: at91: add sam9rl support
ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
ARM: at91: sam9rlek add touchscreen support through at91_adc
ARM: at91: sam9g45: switch from atmel_tsadcc to at91_adc
ARM: at91: sam9rl: switch from atmel_tsadcc to at91_adc
ARM: at91: remove atmel_tsadcc platform_data
ARM: at91: remove atmel_tsadcc from sama5_defconfig
Input: atmel_tsadcc: remove driver
ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node
MAINTAINERS | 6 -
arch/arm/boot/dts/at91-cosino_mega2560.dts | 5 -
arch/arm/configs/at91sam9g45_defconfig | 3 +-
arch/arm/configs/at91sam9rl_defconfig | 3 +-
arch/arm/configs/sama5_defconfig | 1 -
arch/arm/mach-at91/at91sam9260_devices.c | 10 -
arch/arm/mach-at91/at91sam9g45.c | 2 +-
arch/arm/mach-at91/at91sam9g45_devices.c | 63 +----
arch/arm/mach-at91/at91sam9rl.c | 7 +
arch/arm/mach-at91/at91sam9rl_devices.c | 83 +++++--
arch/arm/mach-at91/board-sam9m10g45ek.c | 16 +-
arch/arm/mach-at91/board-sam9rlek.c | 16 +-
arch/arm/mach-at91/board.h | 3 -
arch/arm/mach-at91/include/mach/at91_adc.h | 107 ---------
drivers/iio/adc/at91_adc.c | 340 +++++++++++++++++++++++----
drivers/input/touchscreen/Kconfig | 12 -
drivers/input/touchscreen/Makefile | 1 -
drivers/input/touchscreen/atmel_tsadcc.c | 358 -----------------------------
include/linux/platform_data/at91_adc.h | 27 +--
include/linux/platform_data/atmel.h | 7 -
20 files changed, 382 insertions(+), 688 deletions(-)
delete mode 100644 arch/arm/mach-at91/include/mach/at91_adc.h
delete mode 100644 drivers/input/touchscreen/atmel_tsadcc.c
--
1.8.3.2
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 01/15] ARM: at91: sam9g45: remove unused platform_data
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:56 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
num_channels and registers are not used anymore since they are defined inside
the at91_adc driver and assigned by matching the id_table.
Also, remove the mach/at91_adc.h include that is not necessary anymore.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
arch/arm/mach-at91/at91sam9g45_devices.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 88554024eb2d..cd36009c3511 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -25,7 +25,6 @@
#include <linux/fb.h>
#include <video/atmel_lcdc.h>
-#include <mach/at91_adc.h>
#include <mach/at91sam9g45.h>
#include <mach/at91sam9g45_matrix.h>
#include <mach/at91_matrix.h>
@@ -1235,13 +1234,6 @@ static struct at91_adc_trigger at91_adc_triggers[] = {
},
};
-static struct at91_adc_reg_desc at91_adc_register_g45 = {
- .channel_base = AT91_ADC_CHR(0),
- .drdy_mask = AT91_ADC_DRDY,
- .status_register = AT91_ADC_SR,
- .trigger_register = 0x08,
-};
-
void __init at91_add_device_adc(struct at91_adc_data *data)
{
if (!data)
@@ -1267,9 +1259,7 @@ void __init at91_add_device_adc(struct at91_adc_data *data)
if (data->use_external_triggers)
at91_set_A_periph(AT91_PIN_PD28, 0);
- data->num_channels = 8;
data->startup_time = 40;
- data->registers = &at91_adc_register_g45;
data->trigger_number = 4;
data->trigger_list = at91_adc_triggers;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 01/15] ARM: at91: sam9g45: remove unused platform_data
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: linux-arm-kernel
num_channels and registers are not used anymore since they are defined inside
the at91_adc driver and assigned by matching the id_table.
Also, remove the mach/at91_adc.h include that is not necessary anymore.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
arch/arm/mach-at91/at91sam9g45_devices.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 88554024eb2d..cd36009c3511 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -25,7 +25,6 @@
#include <linux/fb.h>
#include <video/atmel_lcdc.h>
-#include <mach/at91_adc.h>
#include <mach/at91sam9g45.h>
#include <mach/at91sam9g45_matrix.h>
#include <mach/at91_matrix.h>
@@ -1235,13 +1234,6 @@ static struct at91_adc_trigger at91_adc_triggers[] = {
},
};
-static struct at91_adc_reg_desc at91_adc_register_g45 = {
- .channel_base = AT91_ADC_CHR(0),
- .drdy_mask = AT91_ADC_DRDY,
- .status_register = AT91_ADC_SR,
- .trigger_register = 0x08,
-};
-
void __init at91_add_device_adc(struct at91_adc_data *data)
{
if (!data)
@@ -1267,9 +1259,7 @@ void __init at91_add_device_adc(struct at91_adc_data *data)
if (data->use_external_triggers)
at91_set_A_periph(AT91_PIN_PD28, 0);
- data->num_channels = 8;
data->startup_time = 40;
- data->registers = &at91_adc_register_g45;
data->trigger_number = 4;
data->trigger_list = at91_adc_triggers;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 02/15] ARM: at91: sam9260: remove unused platform_data
2014-03-17 13:56 ` Alexandre Belloni
(?)
@ 2014-03-17 13:56 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
num_channels and registers are not used anymore since they are defined inside
the at91_adc driver and assigned by matching the id_table.
Also, remove the mach/at91_adc.h include that is not necessary anymore.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
arch/arm/mach-at91/at91sam9260_devices.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 0a0315920963..a299c50512f0 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -24,7 +24,6 @@
#include <mach/at91sam9260_matrix.h>
#include <mach/at91_matrix.h>
#include <mach/at91sam9_smc.h>
-#include <mach/at91_adc.h>
#include "board.h"
#include "generic.h"
@@ -1321,13 +1320,6 @@ static struct at91_adc_trigger at91_adc_triggers[] = {
},
};
-static struct at91_adc_reg_desc at91_adc_register_g20 = {
- .channel_base = AT91_ADC_CHR(0),
- .drdy_mask = AT91_ADC_DRDY,
- .status_register = AT91_ADC_SR,
- .trigger_register = AT91_ADC_MR,
-};
-
void __init at91_add_device_adc(struct at91_adc_data *data)
{
if (!data)
@@ -1345,9 +1337,7 @@ void __init at91_add_device_adc(struct at91_adc_data *data)
if (data->use_external_triggers)
at91_set_A_periph(AT91_PIN_PA22, 0);
- data->num_channels = 4;
data->startup_time = 10;
- data->registers = &at91_adc_register_g20;
data->trigger_number = 4;
data->trigger_list = at91_adc_triggers;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 02/15] ARM: at91: sam9260: remove unused platform_data
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: linux-iio, linux-kernel, Alexandre Belloni, linux-input,
Gregory Clement, Maxime Ripard, Jean-Christophe Plagniol-Villard,
linux-arm-kernel
num_channels and registers are not used anymore since they are defined inside
the at91_adc driver and assigned by matching the id_table.
Also, remove the mach/at91_adc.h include that is not necessary anymore.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
arch/arm/mach-at91/at91sam9260_devices.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 0a0315920963..a299c50512f0 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -24,7 +24,6 @@
#include <mach/at91sam9260_matrix.h>
#include <mach/at91_matrix.h>
#include <mach/at91sam9_smc.h>
-#include <mach/at91_adc.h>
#include "board.h"
#include "generic.h"
@@ -1321,13 +1320,6 @@ static struct at91_adc_trigger at91_adc_triggers[] = {
},
};
-static struct at91_adc_reg_desc at91_adc_register_g20 = {
- .channel_base = AT91_ADC_CHR(0),
- .drdy_mask = AT91_ADC_DRDY,
- .status_register = AT91_ADC_SR,
- .trigger_register = AT91_ADC_MR,
-};
-
void __init at91_add_device_adc(struct at91_adc_data *data)
{
if (!data)
@@ -1345,9 +1337,7 @@ void __init at91_add_device_adc(struct at91_adc_data *data)
if (data->use_external_triggers)
at91_set_A_periph(AT91_PIN_PA22, 0);
- data->num_channels = 4;
data->startup_time = 10;
- data->registers = &at91_adc_register_g20;
data->trigger_number = 4;
data->trigger_list = at91_adc_triggers;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 02/15] ARM: at91: sam9260: remove unused platform_data
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: linux-arm-kernel
num_channels and registers are not used anymore since they are defined inside
the at91_adc driver and assigned by matching the id_table.
Also, remove the mach/at91_adc.h include that is not necessary anymore.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
arch/arm/mach-at91/at91sam9260_devices.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 0a0315920963..a299c50512f0 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -24,7 +24,6 @@
#include <mach/at91sam9260_matrix.h>
#include <mach/at91_matrix.h>
#include <mach/at91sam9_smc.h>
-#include <mach/at91_adc.h>
#include "board.h"
#include "generic.h"
@@ -1321,13 +1320,6 @@ static struct at91_adc_trigger at91_adc_triggers[] = {
},
};
-static struct at91_adc_reg_desc at91_adc_register_g20 = {
- .channel_base = AT91_ADC_CHR(0),
- .drdy_mask = AT91_ADC_DRDY,
- .status_register = AT91_ADC_SR,
- .trigger_register = AT91_ADC_MR,
-};
-
void __init at91_add_device_adc(struct at91_adc_data *data)
{
if (!data)
@@ -1345,9 +1337,7 @@ void __init at91_add_device_adc(struct at91_adc_data *data)
if (data->use_external_triggers)
at91_set_A_periph(AT91_PIN_PA22, 0);
- data->num_channels = 4;
data->startup_time = 10;
- data->registers = &at91_adc_register_g20;
data->trigger_number = 4;
data->trigger_list = at91_adc_triggers;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 03/15] iio: adc: at91: cleanup platform_data
2014-03-17 13:56 ` Alexandre Belloni
(?)
@ 2014-03-17 13:56 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
num_channels and registers are not used anymore since they are defined inside
the driver and assigned by matching the id_table.
Also, struct at91_adc_reg_desc is now only used inside the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
drivers/iio/adc/at91_adc.c | 19 +++++++++++++++++++
include/linux/platform_data/at91_adc.h | 23 -----------------------
2 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 89777ed9abd8..1beae65aef2c 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -46,6 +46,25 @@
#define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
#define TOUCH_PEN_DETECT_DEBOUNCE_US 200
+/**
+ * struct at91_adc_reg_desc - Various informations relative to registers
+ * @channel_base: Base offset for the channel data registers
+ * @drdy_mask: Mask of the DRDY field in the relevant registers
+ (Interruptions registers mostly)
+ * @status_register: Offset of the Interrupt Status Register
+ * @trigger_register: Offset of the Trigger setup register
+ * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
+ * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
+ */
+struct at91_adc_reg_desc {
+ u8 channel_base;
+ u32 drdy_mask;
+ u8 status_register;
+ u8 trigger_register;
+ u32 mr_prescal_mask;
+ u32 mr_startup_mask;
+};
+
struct at91_adc_caps {
bool has_ts; /* Support touch screen */
bool has_tsmr; /* only at91sam9x5, sama5d3 have TSMR reg */
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index b3ca1e94e0c8..fcf73879dbfe 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -8,25 +8,6 @@
#define _AT91_ADC_H_
/**
- * struct at91_adc_reg_desc - Various informations relative to registers
- * @channel_base: Base offset for the channel data registers
- * @drdy_mask: Mask of the DRDY field in the relevant registers
- (Interruptions registers mostly)
- * @status_register: Offset of the Interrupt Status Register
- * @trigger_register: Offset of the Trigger setup register
- * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
- * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
- */
-struct at91_adc_reg_desc {
- u8 channel_base;
- u32 drdy_mask;
- u8 status_register;
- u8 trigger_register;
- u32 mr_prescal_mask;
- u32 mr_startup_mask;
-};
-
-/**
* struct at91_adc_trigger - description of triggers
* @name: name of the trigger advertised to the user
* @value: value to set in the ADC's trigger setup register
@@ -42,8 +23,6 @@ struct at91_adc_trigger {
/**
* struct at91_adc_data - platform data for ADC driver
* @channels_used: channels in use on the board as a bitmask
- * @num_channels: global number of channels available on the board
- * @registers: Registers definition on the board
* @startup_time: startup time of the ADC in microseconds
* @trigger_list: Triggers available in the ADC
* @trigger_number: Number of triggers available in the ADC
@@ -52,8 +31,6 @@ struct at91_adc_trigger {
*/
struct at91_adc_data {
unsigned long channels_used;
- u8 num_channels;
- struct at91_adc_reg_desc *registers;
u8 startup_time;
struct at91_adc_trigger *trigger_list;
u8 trigger_number;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 03/15] iio: adc: at91: cleanup platform_data
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: linux-iio, linux-kernel, Alexandre Belloni, linux-input,
Gregory Clement, Maxime Ripard, Jean-Christophe Plagniol-Villard,
linux-arm-kernel
num_channels and registers are not used anymore since they are defined inside
the driver and assigned by matching the id_table.
Also, struct at91_adc_reg_desc is now only used inside the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
drivers/iio/adc/at91_adc.c | 19 +++++++++++++++++++
include/linux/platform_data/at91_adc.h | 23 -----------------------
2 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 89777ed9abd8..1beae65aef2c 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -46,6 +46,25 @@
#define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
#define TOUCH_PEN_DETECT_DEBOUNCE_US 200
+/**
+ * struct at91_adc_reg_desc - Various informations relative to registers
+ * @channel_base: Base offset for the channel data registers
+ * @drdy_mask: Mask of the DRDY field in the relevant registers
+ (Interruptions registers mostly)
+ * @status_register: Offset of the Interrupt Status Register
+ * @trigger_register: Offset of the Trigger setup register
+ * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
+ * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
+ */
+struct at91_adc_reg_desc {
+ u8 channel_base;
+ u32 drdy_mask;
+ u8 status_register;
+ u8 trigger_register;
+ u32 mr_prescal_mask;
+ u32 mr_startup_mask;
+};
+
struct at91_adc_caps {
bool has_ts; /* Support touch screen */
bool has_tsmr; /* only at91sam9x5, sama5d3 have TSMR reg */
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index b3ca1e94e0c8..fcf73879dbfe 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -8,25 +8,6 @@
#define _AT91_ADC_H_
/**
- * struct at91_adc_reg_desc - Various informations relative to registers
- * @channel_base: Base offset for the channel data registers
- * @drdy_mask: Mask of the DRDY field in the relevant registers
- (Interruptions registers mostly)
- * @status_register: Offset of the Interrupt Status Register
- * @trigger_register: Offset of the Trigger setup register
- * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
- * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
- */
-struct at91_adc_reg_desc {
- u8 channel_base;
- u32 drdy_mask;
- u8 status_register;
- u8 trigger_register;
- u32 mr_prescal_mask;
- u32 mr_startup_mask;
-};
-
-/**
* struct at91_adc_trigger - description of triggers
* @name: name of the trigger advertised to the user
* @value: value to set in the ADC's trigger setup register
@@ -42,8 +23,6 @@ struct at91_adc_trigger {
/**
* struct at91_adc_data - platform data for ADC driver
* @channels_used: channels in use on the board as a bitmask
- * @num_channels: global number of channels available on the board
- * @registers: Registers definition on the board
* @startup_time: startup time of the ADC in microseconds
* @trigger_list: Triggers available in the ADC
* @trigger_number: Number of triggers available in the ADC
@@ -52,8 +31,6 @@ struct at91_adc_trigger {
*/
struct at91_adc_data {
unsigned long channels_used;
- u8 num_channels;
- struct at91_adc_reg_desc *registers;
u8 startup_time;
struct at91_adc_trigger *trigger_list;
u8 trigger_number;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 03/15] iio: adc: at91: cleanup platform_data
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: linux-arm-kernel
num_channels and registers are not used anymore since they are defined inside
the driver and assigned by matching the id_table.
Also, struct at91_adc_reg_desc is now only used inside the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
---
drivers/iio/adc/at91_adc.c | 19 +++++++++++++++++++
include/linux/platform_data/at91_adc.h | 23 -----------------------
2 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 89777ed9abd8..1beae65aef2c 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -46,6 +46,25 @@
#define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
#define TOUCH_PEN_DETECT_DEBOUNCE_US 200
+/**
+ * struct at91_adc_reg_desc - Various informations relative to registers
+ * @channel_base: Base offset for the channel data registers
+ * @drdy_mask: Mask of the DRDY field in the relevant registers
+ (Interruptions registers mostly)
+ * @status_register: Offset of the Interrupt Status Register
+ * @trigger_register: Offset of the Trigger setup register
+ * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
+ * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
+ */
+struct at91_adc_reg_desc {
+ u8 channel_base;
+ u32 drdy_mask;
+ u8 status_register;
+ u8 trigger_register;
+ u32 mr_prescal_mask;
+ u32 mr_startup_mask;
+};
+
struct at91_adc_caps {
bool has_ts; /* Support touch screen */
bool has_tsmr; /* only at91sam9x5, sama5d3 have TSMR reg */
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index b3ca1e94e0c8..fcf73879dbfe 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -8,25 +8,6 @@
#define _AT91_ADC_H_
/**
- * struct at91_adc_reg_desc - Various informations relative to registers
- * @channel_base: Base offset for the channel data registers
- * @drdy_mask: Mask of the DRDY field in the relevant registers
- (Interruptions registers mostly)
- * @status_register: Offset of the Interrupt Status Register
- * @trigger_register: Offset of the Trigger setup register
- * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
- * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
- */
-struct at91_adc_reg_desc {
- u8 channel_base;
- u32 drdy_mask;
- u8 status_register;
- u8 trigger_register;
- u32 mr_prescal_mask;
- u32 mr_startup_mask;
-};
-
-/**
* struct at91_adc_trigger - description of triggers
* @name: name of the trigger advertised to the user
* @value: value to set in the ADC's trigger setup register
@@ -42,8 +23,6 @@ struct at91_adc_trigger {
/**
* struct at91_adc_data - platform data for ADC driver
* @channels_used: channels in use on the board as a bitmask
- * @num_channels: global number of channels available on the board
- * @registers: Registers definition on the board
* @startup_time: startup time of the ADC in microseconds
* @trigger_list: Triggers available in the ADC
* @trigger_number: Number of triggers available in the ADC
@@ -52,8 +31,6 @@ struct at91_adc_trigger {
*/
struct at91_adc_data {
unsigned long channels_used;
- u8 num_channels;
- struct at91_adc_reg_desc *registers;
u8 startup_time;
struct at91_adc_trigger *trigger_list;
u8 trigger_number;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 04/15] iio: adc: at91_adc: Add support for touchscreens without TSMR
2014-03-17 13:56 ` Alexandre Belloni
(?)
@ 2014-03-17 13:56 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
Old ADCs, as present on the sam9rl and the sam9g45 don't have a TSMR register
and the touchscreen support should be handled differently.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/include/mach/at91_adc.h | 13 ++
drivers/iio/adc/at91_adc.c | 200 ++++++++++++++++++++++-------
include/linux/platform_data/at91_adc.h | 8 ++
3 files changed, 174 insertions(+), 47 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
index c287307b9a3b..7d80396346b2 100644
--- a/arch/arm/mach-at91/include/mach/at91_adc.h
+++ b/arch/arm/mach-at91/include/mach/at91_adc.h
@@ -20,6 +20,9 @@
#define AT91_ADC_START (1 << 1) /* Start Conversion */
#define AT91_ADC_MR 0x04 /* Mode Register */
+#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
+#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
+#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
#define AT91_ADC_TRGSEL_TC0 (0 << 1)
@@ -28,6 +31,7 @@
#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
+#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
#define AT91_ADC_PRESCAL_(x) ((x) << 8)
@@ -37,6 +41,12 @@
#define AT91_ADC_STARTUP_(x) ((x) << 16)
#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
#define AT91_ADC_SHTIM_(x) ((x) << 24)
+#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
+#define AT91_ADC_PENDBC_(x) ((x) << 28)
+
+#define AT91_ADC_TSR 0x0C
+#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
+#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
@@ -60,6 +70,8 @@
#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
+#define AT91RL_ADC_IER_PEN (1 << 20)
+#define AT91RL_ADC_IER_NOPEN (1 << 21)
#define AT91_ADC_IER_PEN (1 << 29)
#define AT91_ADC_IER_NOPEN (1 << 30)
#define AT91_ADC_IER_XRDY (1 << 20)
@@ -102,6 +114,7 @@
#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
+#define AT91_ADC_TRGR_NONE (0 << 0)
#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
#endif
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 1beae65aef2c..c0e4206e34e5 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -46,6 +46,10 @@
#define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
#define TOUCH_PEN_DETECT_DEBOUNCE_US 200
+#define MAX_RLPOS_BITS 10
+#define TOUCH_SAMPLE_PERIOD_US_RL 10000 /* 10ms, the SoC can't keep up with 2ms */
+#define TOUCH_SHTIM 0xa
+
/**
* struct at91_adc_reg_desc - Various informations relative to registers
* @channel_base: Base offset for the channel data registers
@@ -83,12 +87,6 @@ struct at91_adc_caps {
struct at91_adc_reg_desc registers;
};
-enum atmel_adc_ts_type {
- ATMEL_ADC_TOUCHSCREEN_NONE = 0,
- ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
- ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
-};
-
struct at91_adc_state {
struct clk *adc_clk;
u16 *buffer;
@@ -133,6 +131,11 @@ struct at91_adc_state {
u16 ts_sample_period_val;
u32 ts_pressure_threshold;
+ u16 ts_pendbc;
+
+ bool ts_bufferedmeasure;
+ u32 ts_prev_absx;
+ u32 ts_prev_absy;
};
static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
@@ -239,7 +242,72 @@ static int at91_ts_sample(struct at91_adc_state *st)
return 0;
}
-static irqreturn_t at91_adc_interrupt(int irq, void *private)
+static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
+{
+ struct iio_dev *idev = private;
+ struct at91_adc_state *st = iio_priv(idev);
+ u32 status = at91_adc_readl(st, st->registers->status_register);
+ unsigned int reg;
+
+ status &= at91_adc_readl(st, AT91_ADC_IMR);
+ if (status & st->registers->drdy_mask)
+ handle_adc_eoc_trigger(irq, idev);
+
+ if (status & AT91RL_ADC_IER_PEN) {
+ /* Disabling pen debounce is required to get a NOPEN irq */
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg &= ~AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_NOPEN
+ | AT91_ADC_EOC(3));
+ /* Set up period trigger for sampling */
+ at91_adc_writel(st, st->registers->trigger_register,
+ AT91_ADC_TRGR_MOD_PERIOD_TRIG |
+ AT91_ADC_TRGR_TRGPER_(st->ts_sample_period_val));
+ } else if (status & AT91RL_ADC_IER_NOPEN) {
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+ at91_adc_writel(st, st->registers->trigger_register,
+ AT91_ADC_TRGR_NONE);
+
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_NOPEN
+ | AT91_ADC_EOC(3));
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
+ st->ts_bufferedmeasure = false;
+ input_report_key(st->ts_input, BTN_TOUCH, 0);
+ input_sync(st->ts_input);
+ } else if (status & AT91_ADC_EOC(3)) {
+ /* Conversion finished */
+ if (st->ts_bufferedmeasure) {
+ /*
+ * Last measurement is always discarded, since it can
+ * be erroneous.
+ * Always report previous measurement
+ */
+ input_report_abs(st->ts_input, ABS_X, st->ts_prev_absx);
+ input_report_abs(st->ts_input, ABS_Y, st->ts_prev_absy);
+ input_report_key(st->ts_input, BTN_TOUCH, 1);
+ input_sync(st->ts_input);
+ } else
+ st->ts_bufferedmeasure = true;
+
+ /* Now make new measurement */
+ st->ts_prev_absx = at91_adc_readl(st, AT91_ADC_CHAN(st, 3))
+ << MAX_RLPOS_BITS;
+ st->ts_prev_absx /= at91_adc_readl(st, AT91_ADC_CHAN(st, 2));
+
+ st->ts_prev_absy = at91_adc_readl(st, AT91_ADC_CHAN(st, 1))
+ << MAX_RLPOS_BITS;
+ st->ts_prev_absy /= at91_adc_readl(st, AT91_ADC_CHAN(st, 0));
+ }
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
{
struct iio_dev *idev = private;
struct at91_adc_state *st = iio_priv(idev);
@@ -672,6 +740,8 @@ static int at91_adc_probe_dt_ts(struct device_node *node,
return -EINVAL;
}
+ if (!st->caps->has_tsmr)
+ return 0;
prop = 0;
of_property_read_u32(node, "atmel,adc-ts-pressure-threshold", &prop);
st->ts_pressure_threshold = prop;
@@ -795,6 +865,7 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st,
st->trigger_number = pdata->trigger_number;
st->trigger_list = pdata->trigger_list;
st->registers = &st->caps->registers;
+ st->touchscreen_type = pdata->touchscreen_type;
return 0;
}
@@ -809,7 +880,10 @@ static int atmel_ts_open(struct input_dev *dev)
{
struct at91_adc_state *st = input_get_drvdata(dev);
- at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
+ if (st->caps->has_tsmr)
+ at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
+ else
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
return 0;
}
@@ -817,45 +891,61 @@ static void atmel_ts_close(struct input_dev *dev)
{
struct at91_adc_state *st = input_get_drvdata(dev);
- at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
+ if (st->caps->has_tsmr)
+ at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
+ else
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
}
static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
{
- u32 reg = 0, pendbc;
+ u32 reg = 0;
int i = 0;
- if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
- reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
- else
- reg = AT91_ADC_TSMR_TSMODE_5WIRE;
-
/* a Pen Detect Debounce Time is necessary for the ADC Touch to avoid
* pen detect noise.
* The formula is : Pen Detect Debounce Time = (2 ^ pendbc) / ADCClock
*/
- pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz / 1000, 1);
+ st->ts_pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz /
+ 1000, 1);
- while (pendbc >> ++i)
+ while (st->ts_pendbc >> ++i)
; /* Empty! Find the shift offset */
- if (abs(pendbc - (1 << i)) < abs(pendbc - (1 << (i - 1))))
- pendbc = i;
+ if (abs(st->ts_pendbc - (1 << i)) < abs(st->ts_pendbc - (1 << (i - 1))))
+ st->ts_pendbc = i;
else
- pendbc = i - 1;
+ st->ts_pendbc = i - 1;
- if (st->caps->has_tsmr) {
- reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
- & AT91_ADC_TSMR_TSAV;
- reg |= AT91_ADC_TSMR_PENDBC_(pendbc) & AT91_ADC_TSMR_PENDBC;
- reg |= AT91_ADC_TSMR_NOTSDMA;
- reg |= AT91_ADC_TSMR_PENDET_ENA;
- reg |= 0x03 << 8; /* TSFREQ, need bigger than TSAV */
-
- at91_adc_writel(st, AT91_ADC_TSMR, reg);
- } else {
- /* TODO: for 9g45 which has no TSMR */
+ if (!st->caps->has_tsmr) {
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg |= AT91_ADC_TSAMOD_TS_ONLY_MODE | AT91_ADC_PENDET;
+
+ reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+
+ reg = AT91_ADC_TSR_SHTIM_(TOUCH_SHTIM) & AT91_ADC_TSR_SHTIM;
+ at91_adc_writel(st, AT91_ADC_TSR, reg);
+
+ st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US_RL *
+ adc_clk_khz / 1000) - 1, 1);
+
+ return 0;
}
+ if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
+ reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
+ else
+ reg = AT91_ADC_TSMR_TSMODE_5WIRE;
+
+ reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
+ & AT91_ADC_TSMR_TSAV;
+ reg |= AT91_ADC_TSMR_PENDBC_(st->ts_pendbc) & AT91_ADC_TSMR_PENDBC;
+ reg |= AT91_ADC_TSMR_NOTSDMA;
+ reg |= AT91_ADC_TSMR_PENDET_ENA;
+ reg |= 0x03 << 8; /* TSFREQ, needs to be bigger than TSAV */
+
+ at91_adc_writel(st, AT91_ADC_TSMR, reg);
+
/* Change adc internal resistor value for better pen detection,
* default value is 100 kOhm.
* 0 = 200 kOhm, 1 = 150 kOhm, 2 = 100 kOhm, 3 = 50 kOhm
@@ -864,7 +954,7 @@ static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
at91_adc_writel(st, AT91_ADC_ACR, st->caps->ts_pen_detect_sensitivity
& AT91_ADC_ACR_PENDETSENS);
- /* Sample Peroid Time = (TRGPER + 1) / ADCClock */
+ /* Sample Period Time = (TRGPER + 1) / ADCClock */
st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US *
adc_clk_khz / 1000) - 1, 1);
@@ -893,17 +983,37 @@ static int at91_ts_register(struct at91_adc_state *st,
__set_bit(EV_ABS, input->evbit);
__set_bit(EV_KEY, input->evbit);
__set_bit(BTN_TOUCH, input->keybit);
- input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
- input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
- input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
+ if (st->caps->has_tsmr) {
+ input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
+ } else {
+ if (st->touchscreen_type != ATMEL_ADC_TOUCHSCREEN_4WIRE) {
+ dev_err(&pdev->dev,
+ "This touchscreen controller only support 4 wires\n");
+ ret = -EINVAL;
+ goto err;
+ }
+
+ input_set_abs_params(input, ABS_X, 0, (1 << MAX_RLPOS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_Y, 0, (1 << MAX_RLPOS_BITS) - 1,
+ 0, 0);
+ }
st->ts_input = input;
input_set_drvdata(input, st);
ret = input_register_device(input);
if (ret)
- input_free_device(st->ts_input);
+ goto err;
+
+ return ret;
+err:
+ input_free_device(st->ts_input);
return ret;
}
@@ -962,11 +1072,13 @@ static int at91_adc_probe(struct platform_device *pdev)
*/
at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_SWRST);
at91_adc_writel(st, AT91_ADC_IDR, 0xFFFFFFFF);
- ret = request_irq(st->irq,
- at91_adc_interrupt,
- 0,
- pdev->dev.driver->name,
- idev);
+
+ if (st->caps->has_tsmr)
+ ret = request_irq(st->irq, at91_adc_9x5_interrupt, 0,
+ pdev->dev.driver->name, idev);
+ else
+ ret = request_irq(st->irq, at91_adc_rl_interrupt, 0,
+ pdev->dev.driver->name, idev);
if (ret) {
dev_err(&pdev->dev, "Failed to allocate IRQ.\n");
return ret;
@@ -1070,12 +1182,6 @@ static int at91_adc_probe(struct platform_device *pdev)
goto error_disable_adc_clk;
}
} else {
- if (!st->caps->has_tsmr) {
- dev_err(&pdev->dev, "We don't support non-TSMR adc\n");
- ret = -ENODEV;
- goto error_disable_adc_clk;
- }
-
ret = at91_ts_register(st, pdev);
if (ret)
goto error_disable_adc_clk;
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index fcf73879dbfe..7819fc787731 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -7,6 +7,12 @@
#ifndef _AT91_ADC_H_
#define _AT91_ADC_H_
+enum atmel_adc_ts_type {
+ ATMEL_ADC_TOUCHSCREEN_NONE = 0,
+ ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
+ ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
+};
+
/**
* struct at91_adc_trigger - description of triggers
* @name: name of the trigger advertised to the user
@@ -28,6 +34,7 @@ struct at91_adc_trigger {
* @trigger_number: Number of triggers available in the ADC
* @use_external_triggers: does the board has external triggers availables
* @vref: Reference voltage for the ADC in millivolts
+ * @touchscreen_type: If a touchscreen is connected, its type (4 or 5 wires)
*/
struct at91_adc_data {
unsigned long channels_used;
@@ -36,6 +43,7 @@ struct at91_adc_data {
u8 trigger_number;
bool use_external_triggers;
u16 vref;
+ enum atmel_adc_ts_type touchscreen_type;
};
extern void __init at91_add_device_adc(struct at91_adc_data *data);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 04/15] iio: adc: at91_adc: Add support for touchscreens without TSMR
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: linux-iio, linux-kernel, Alexandre Belloni, linux-input,
Gregory Clement, Maxime Ripard, Jean-Christophe Plagniol-Villard,
linux-arm-kernel
Old ADCs, as present on the sam9rl and the sam9g45 don't have a TSMR register
and the touchscreen support should be handled differently.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/include/mach/at91_adc.h | 13 ++
drivers/iio/adc/at91_adc.c | 200 ++++++++++++++++++++++-------
include/linux/platform_data/at91_adc.h | 8 ++
3 files changed, 174 insertions(+), 47 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
index c287307b9a3b..7d80396346b2 100644
--- a/arch/arm/mach-at91/include/mach/at91_adc.h
+++ b/arch/arm/mach-at91/include/mach/at91_adc.h
@@ -20,6 +20,9 @@
#define AT91_ADC_START (1 << 1) /* Start Conversion */
#define AT91_ADC_MR 0x04 /* Mode Register */
+#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
+#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
+#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
#define AT91_ADC_TRGSEL_TC0 (0 << 1)
@@ -28,6 +31,7 @@
#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
+#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
#define AT91_ADC_PRESCAL_(x) ((x) << 8)
@@ -37,6 +41,12 @@
#define AT91_ADC_STARTUP_(x) ((x) << 16)
#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
#define AT91_ADC_SHTIM_(x) ((x) << 24)
+#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
+#define AT91_ADC_PENDBC_(x) ((x) << 28)
+
+#define AT91_ADC_TSR 0x0C
+#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
+#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
@@ -60,6 +70,8 @@
#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
+#define AT91RL_ADC_IER_PEN (1 << 20)
+#define AT91RL_ADC_IER_NOPEN (1 << 21)
#define AT91_ADC_IER_PEN (1 << 29)
#define AT91_ADC_IER_NOPEN (1 << 30)
#define AT91_ADC_IER_XRDY (1 << 20)
@@ -102,6 +114,7 @@
#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
+#define AT91_ADC_TRGR_NONE (0 << 0)
#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
#endif
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 1beae65aef2c..c0e4206e34e5 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -46,6 +46,10 @@
#define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
#define TOUCH_PEN_DETECT_DEBOUNCE_US 200
+#define MAX_RLPOS_BITS 10
+#define TOUCH_SAMPLE_PERIOD_US_RL 10000 /* 10ms, the SoC can't keep up with 2ms */
+#define TOUCH_SHTIM 0xa
+
/**
* struct at91_adc_reg_desc - Various informations relative to registers
* @channel_base: Base offset for the channel data registers
@@ -83,12 +87,6 @@ struct at91_adc_caps {
struct at91_adc_reg_desc registers;
};
-enum atmel_adc_ts_type {
- ATMEL_ADC_TOUCHSCREEN_NONE = 0,
- ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
- ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
-};
-
struct at91_adc_state {
struct clk *adc_clk;
u16 *buffer;
@@ -133,6 +131,11 @@ struct at91_adc_state {
u16 ts_sample_period_val;
u32 ts_pressure_threshold;
+ u16 ts_pendbc;
+
+ bool ts_bufferedmeasure;
+ u32 ts_prev_absx;
+ u32 ts_prev_absy;
};
static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
@@ -239,7 +242,72 @@ static int at91_ts_sample(struct at91_adc_state *st)
return 0;
}
-static irqreturn_t at91_adc_interrupt(int irq, void *private)
+static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
+{
+ struct iio_dev *idev = private;
+ struct at91_adc_state *st = iio_priv(idev);
+ u32 status = at91_adc_readl(st, st->registers->status_register);
+ unsigned int reg;
+
+ status &= at91_adc_readl(st, AT91_ADC_IMR);
+ if (status & st->registers->drdy_mask)
+ handle_adc_eoc_trigger(irq, idev);
+
+ if (status & AT91RL_ADC_IER_PEN) {
+ /* Disabling pen debounce is required to get a NOPEN irq */
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg &= ~AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_NOPEN
+ | AT91_ADC_EOC(3));
+ /* Set up period trigger for sampling */
+ at91_adc_writel(st, st->registers->trigger_register,
+ AT91_ADC_TRGR_MOD_PERIOD_TRIG |
+ AT91_ADC_TRGR_TRGPER_(st->ts_sample_period_val));
+ } else if (status & AT91RL_ADC_IER_NOPEN) {
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+ at91_adc_writel(st, st->registers->trigger_register,
+ AT91_ADC_TRGR_NONE);
+
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_NOPEN
+ | AT91_ADC_EOC(3));
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
+ st->ts_bufferedmeasure = false;
+ input_report_key(st->ts_input, BTN_TOUCH, 0);
+ input_sync(st->ts_input);
+ } else if (status & AT91_ADC_EOC(3)) {
+ /* Conversion finished */
+ if (st->ts_bufferedmeasure) {
+ /*
+ * Last measurement is always discarded, since it can
+ * be erroneous.
+ * Always report previous measurement
+ */
+ input_report_abs(st->ts_input, ABS_X, st->ts_prev_absx);
+ input_report_abs(st->ts_input, ABS_Y, st->ts_prev_absy);
+ input_report_key(st->ts_input, BTN_TOUCH, 1);
+ input_sync(st->ts_input);
+ } else
+ st->ts_bufferedmeasure = true;
+
+ /* Now make new measurement */
+ st->ts_prev_absx = at91_adc_readl(st, AT91_ADC_CHAN(st, 3))
+ << MAX_RLPOS_BITS;
+ st->ts_prev_absx /= at91_adc_readl(st, AT91_ADC_CHAN(st, 2));
+
+ st->ts_prev_absy = at91_adc_readl(st, AT91_ADC_CHAN(st, 1))
+ << MAX_RLPOS_BITS;
+ st->ts_prev_absy /= at91_adc_readl(st, AT91_ADC_CHAN(st, 0));
+ }
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
{
struct iio_dev *idev = private;
struct at91_adc_state *st = iio_priv(idev);
@@ -672,6 +740,8 @@ static int at91_adc_probe_dt_ts(struct device_node *node,
return -EINVAL;
}
+ if (!st->caps->has_tsmr)
+ return 0;
prop = 0;
of_property_read_u32(node, "atmel,adc-ts-pressure-threshold", &prop);
st->ts_pressure_threshold = prop;
@@ -795,6 +865,7 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st,
st->trigger_number = pdata->trigger_number;
st->trigger_list = pdata->trigger_list;
st->registers = &st->caps->registers;
+ st->touchscreen_type = pdata->touchscreen_type;
return 0;
}
@@ -809,7 +880,10 @@ static int atmel_ts_open(struct input_dev *dev)
{
struct at91_adc_state *st = input_get_drvdata(dev);
- at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
+ if (st->caps->has_tsmr)
+ at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
+ else
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
return 0;
}
@@ -817,45 +891,61 @@ static void atmel_ts_close(struct input_dev *dev)
{
struct at91_adc_state *st = input_get_drvdata(dev);
- at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
+ if (st->caps->has_tsmr)
+ at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
+ else
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
}
static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
{
- u32 reg = 0, pendbc;
+ u32 reg = 0;
int i = 0;
- if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
- reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
- else
- reg = AT91_ADC_TSMR_TSMODE_5WIRE;
-
/* a Pen Detect Debounce Time is necessary for the ADC Touch to avoid
* pen detect noise.
* The formula is : Pen Detect Debounce Time = (2 ^ pendbc) / ADCClock
*/
- pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz / 1000, 1);
+ st->ts_pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz /
+ 1000, 1);
- while (pendbc >> ++i)
+ while (st->ts_pendbc >> ++i)
; /* Empty! Find the shift offset */
- if (abs(pendbc - (1 << i)) < abs(pendbc - (1 << (i - 1))))
- pendbc = i;
+ if (abs(st->ts_pendbc - (1 << i)) < abs(st->ts_pendbc - (1 << (i - 1))))
+ st->ts_pendbc = i;
else
- pendbc = i - 1;
+ st->ts_pendbc = i - 1;
- if (st->caps->has_tsmr) {
- reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
- & AT91_ADC_TSMR_TSAV;
- reg |= AT91_ADC_TSMR_PENDBC_(pendbc) & AT91_ADC_TSMR_PENDBC;
- reg |= AT91_ADC_TSMR_NOTSDMA;
- reg |= AT91_ADC_TSMR_PENDET_ENA;
- reg |= 0x03 << 8; /* TSFREQ, need bigger than TSAV */
-
- at91_adc_writel(st, AT91_ADC_TSMR, reg);
- } else {
- /* TODO: for 9g45 which has no TSMR */
+ if (!st->caps->has_tsmr) {
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg |= AT91_ADC_TSAMOD_TS_ONLY_MODE | AT91_ADC_PENDET;
+
+ reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+
+ reg = AT91_ADC_TSR_SHTIM_(TOUCH_SHTIM) & AT91_ADC_TSR_SHTIM;
+ at91_adc_writel(st, AT91_ADC_TSR, reg);
+
+ st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US_RL *
+ adc_clk_khz / 1000) - 1, 1);
+
+ return 0;
}
+ if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
+ reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
+ else
+ reg = AT91_ADC_TSMR_TSMODE_5WIRE;
+
+ reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
+ & AT91_ADC_TSMR_TSAV;
+ reg |= AT91_ADC_TSMR_PENDBC_(st->ts_pendbc) & AT91_ADC_TSMR_PENDBC;
+ reg |= AT91_ADC_TSMR_NOTSDMA;
+ reg |= AT91_ADC_TSMR_PENDET_ENA;
+ reg |= 0x03 << 8; /* TSFREQ, needs to be bigger than TSAV */
+
+ at91_adc_writel(st, AT91_ADC_TSMR, reg);
+
/* Change adc internal resistor value for better pen detection,
* default value is 100 kOhm.
* 0 = 200 kOhm, 1 = 150 kOhm, 2 = 100 kOhm, 3 = 50 kOhm
@@ -864,7 +954,7 @@ static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
at91_adc_writel(st, AT91_ADC_ACR, st->caps->ts_pen_detect_sensitivity
& AT91_ADC_ACR_PENDETSENS);
- /* Sample Peroid Time = (TRGPER + 1) / ADCClock */
+ /* Sample Period Time = (TRGPER + 1) / ADCClock */
st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US *
adc_clk_khz / 1000) - 1, 1);
@@ -893,17 +983,37 @@ static int at91_ts_register(struct at91_adc_state *st,
__set_bit(EV_ABS, input->evbit);
__set_bit(EV_KEY, input->evbit);
__set_bit(BTN_TOUCH, input->keybit);
- input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
- input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
- input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
+ if (st->caps->has_tsmr) {
+ input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
+ } else {
+ if (st->touchscreen_type != ATMEL_ADC_TOUCHSCREEN_4WIRE) {
+ dev_err(&pdev->dev,
+ "This touchscreen controller only support 4 wires\n");
+ ret = -EINVAL;
+ goto err;
+ }
+
+ input_set_abs_params(input, ABS_X, 0, (1 << MAX_RLPOS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_Y, 0, (1 << MAX_RLPOS_BITS) - 1,
+ 0, 0);
+ }
st->ts_input = input;
input_set_drvdata(input, st);
ret = input_register_device(input);
if (ret)
- input_free_device(st->ts_input);
+ goto err;
+
+ return ret;
+err:
+ input_free_device(st->ts_input);
return ret;
}
@@ -962,11 +1072,13 @@ static int at91_adc_probe(struct platform_device *pdev)
*/
at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_SWRST);
at91_adc_writel(st, AT91_ADC_IDR, 0xFFFFFFFF);
- ret = request_irq(st->irq,
- at91_adc_interrupt,
- 0,
- pdev->dev.driver->name,
- idev);
+
+ if (st->caps->has_tsmr)
+ ret = request_irq(st->irq, at91_adc_9x5_interrupt, 0,
+ pdev->dev.driver->name, idev);
+ else
+ ret = request_irq(st->irq, at91_adc_rl_interrupt, 0,
+ pdev->dev.driver->name, idev);
if (ret) {
dev_err(&pdev->dev, "Failed to allocate IRQ.\n");
return ret;
@@ -1070,12 +1182,6 @@ static int at91_adc_probe(struct platform_device *pdev)
goto error_disable_adc_clk;
}
} else {
- if (!st->caps->has_tsmr) {
- dev_err(&pdev->dev, "We don't support non-TSMR adc\n");
- ret = -ENODEV;
- goto error_disable_adc_clk;
- }
-
ret = at91_ts_register(st, pdev);
if (ret)
goto error_disable_adc_clk;
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index fcf73879dbfe..7819fc787731 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -7,6 +7,12 @@
#ifndef _AT91_ADC_H_
#define _AT91_ADC_H_
+enum atmel_adc_ts_type {
+ ATMEL_ADC_TOUCHSCREEN_NONE = 0,
+ ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
+ ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
+};
+
/**
* struct at91_adc_trigger - description of triggers
* @name: name of the trigger advertised to the user
@@ -28,6 +34,7 @@ struct at91_adc_trigger {
* @trigger_number: Number of triggers available in the ADC
* @use_external_triggers: does the board has external triggers availables
* @vref: Reference voltage for the ADC in millivolts
+ * @touchscreen_type: If a touchscreen is connected, its type (4 or 5 wires)
*/
struct at91_adc_data {
unsigned long channels_used;
@@ -36,6 +43,7 @@ struct at91_adc_data {
u8 trigger_number;
bool use_external_triggers;
u16 vref;
+ enum atmel_adc_ts_type touchscreen_type;
};
extern void __init at91_add_device_adc(struct at91_adc_data *data);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 04/15] iio: adc: at91_adc: Add support for touchscreens without TSMR
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: linux-arm-kernel
Old ADCs, as present on the sam9rl and the sam9g45 don't have a TSMR register
and the touchscreen support should be handled differently.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/include/mach/at91_adc.h | 13 ++
drivers/iio/adc/at91_adc.c | 200 ++++++++++++++++++++++-------
include/linux/platform_data/at91_adc.h | 8 ++
3 files changed, 174 insertions(+), 47 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
index c287307b9a3b..7d80396346b2 100644
--- a/arch/arm/mach-at91/include/mach/at91_adc.h
+++ b/arch/arm/mach-at91/include/mach/at91_adc.h
@@ -20,6 +20,9 @@
#define AT91_ADC_START (1 << 1) /* Start Conversion */
#define AT91_ADC_MR 0x04 /* Mode Register */
+#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
+#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
+#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
#define AT91_ADC_TRGSEL_TC0 (0 << 1)
@@ -28,6 +31,7 @@
#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
+#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
#define AT91_ADC_PRESCAL_(x) ((x) << 8)
@@ -37,6 +41,12 @@
#define AT91_ADC_STARTUP_(x) ((x) << 16)
#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
#define AT91_ADC_SHTIM_(x) ((x) << 24)
+#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
+#define AT91_ADC_PENDBC_(x) ((x) << 28)
+
+#define AT91_ADC_TSR 0x0C
+#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
+#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
@@ -60,6 +70,8 @@
#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
+#define AT91RL_ADC_IER_PEN (1 << 20)
+#define AT91RL_ADC_IER_NOPEN (1 << 21)
#define AT91_ADC_IER_PEN (1 << 29)
#define AT91_ADC_IER_NOPEN (1 << 30)
#define AT91_ADC_IER_XRDY (1 << 20)
@@ -102,6 +114,7 @@
#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
+#define AT91_ADC_TRGR_NONE (0 << 0)
#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
#endif
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 1beae65aef2c..c0e4206e34e5 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -46,6 +46,10 @@
#define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
#define TOUCH_PEN_DETECT_DEBOUNCE_US 200
+#define MAX_RLPOS_BITS 10
+#define TOUCH_SAMPLE_PERIOD_US_RL 10000 /* 10ms, the SoC can't keep up with 2ms */
+#define TOUCH_SHTIM 0xa
+
/**
* struct at91_adc_reg_desc - Various informations relative to registers
* @channel_base: Base offset for the channel data registers
@@ -83,12 +87,6 @@ struct at91_adc_caps {
struct at91_adc_reg_desc registers;
};
-enum atmel_adc_ts_type {
- ATMEL_ADC_TOUCHSCREEN_NONE = 0,
- ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
- ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
-};
-
struct at91_adc_state {
struct clk *adc_clk;
u16 *buffer;
@@ -133,6 +131,11 @@ struct at91_adc_state {
u16 ts_sample_period_val;
u32 ts_pressure_threshold;
+ u16 ts_pendbc;
+
+ bool ts_bufferedmeasure;
+ u32 ts_prev_absx;
+ u32 ts_prev_absy;
};
static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
@@ -239,7 +242,72 @@ static int at91_ts_sample(struct at91_adc_state *st)
return 0;
}
-static irqreturn_t at91_adc_interrupt(int irq, void *private)
+static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
+{
+ struct iio_dev *idev = private;
+ struct at91_adc_state *st = iio_priv(idev);
+ u32 status = at91_adc_readl(st, st->registers->status_register);
+ unsigned int reg;
+
+ status &= at91_adc_readl(st, AT91_ADC_IMR);
+ if (status & st->registers->drdy_mask)
+ handle_adc_eoc_trigger(irq, idev);
+
+ if (status & AT91RL_ADC_IER_PEN) {
+ /* Disabling pen debounce is required to get a NOPEN irq */
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg &= ~AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_NOPEN
+ | AT91_ADC_EOC(3));
+ /* Set up period trigger for sampling */
+ at91_adc_writel(st, st->registers->trigger_register,
+ AT91_ADC_TRGR_MOD_PERIOD_TRIG |
+ AT91_ADC_TRGR_TRGPER_(st->ts_sample_period_val));
+ } else if (status & AT91RL_ADC_IER_NOPEN) {
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+ at91_adc_writel(st, st->registers->trigger_register,
+ AT91_ADC_TRGR_NONE);
+
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_NOPEN
+ | AT91_ADC_EOC(3));
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
+ st->ts_bufferedmeasure = false;
+ input_report_key(st->ts_input, BTN_TOUCH, 0);
+ input_sync(st->ts_input);
+ } else if (status & AT91_ADC_EOC(3)) {
+ /* Conversion finished */
+ if (st->ts_bufferedmeasure) {
+ /*
+ * Last measurement is always discarded, since it can
+ * be erroneous.
+ * Always report previous measurement
+ */
+ input_report_abs(st->ts_input, ABS_X, st->ts_prev_absx);
+ input_report_abs(st->ts_input, ABS_Y, st->ts_prev_absy);
+ input_report_key(st->ts_input, BTN_TOUCH, 1);
+ input_sync(st->ts_input);
+ } else
+ st->ts_bufferedmeasure = true;
+
+ /* Now make new measurement */
+ st->ts_prev_absx = at91_adc_readl(st, AT91_ADC_CHAN(st, 3))
+ << MAX_RLPOS_BITS;
+ st->ts_prev_absx /= at91_adc_readl(st, AT91_ADC_CHAN(st, 2));
+
+ st->ts_prev_absy = at91_adc_readl(st, AT91_ADC_CHAN(st, 1))
+ << MAX_RLPOS_BITS;
+ st->ts_prev_absy /= at91_adc_readl(st, AT91_ADC_CHAN(st, 0));
+ }
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
{
struct iio_dev *idev = private;
struct at91_adc_state *st = iio_priv(idev);
@@ -672,6 +740,8 @@ static int at91_adc_probe_dt_ts(struct device_node *node,
return -EINVAL;
}
+ if (!st->caps->has_tsmr)
+ return 0;
prop = 0;
of_property_read_u32(node, "atmel,adc-ts-pressure-threshold", &prop);
st->ts_pressure_threshold = prop;
@@ -795,6 +865,7 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st,
st->trigger_number = pdata->trigger_number;
st->trigger_list = pdata->trigger_list;
st->registers = &st->caps->registers;
+ st->touchscreen_type = pdata->touchscreen_type;
return 0;
}
@@ -809,7 +880,10 @@ static int atmel_ts_open(struct input_dev *dev)
{
struct at91_adc_state *st = input_get_drvdata(dev);
- at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
+ if (st->caps->has_tsmr)
+ at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
+ else
+ at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
return 0;
}
@@ -817,45 +891,61 @@ static void atmel_ts_close(struct input_dev *dev)
{
struct at91_adc_state *st = input_get_drvdata(dev);
- at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
+ if (st->caps->has_tsmr)
+ at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
+ else
+ at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
}
static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
{
- u32 reg = 0, pendbc;
+ u32 reg = 0;
int i = 0;
- if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
- reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
- else
- reg = AT91_ADC_TSMR_TSMODE_5WIRE;
-
/* a Pen Detect Debounce Time is necessary for the ADC Touch to avoid
* pen detect noise.
* The formula is : Pen Detect Debounce Time = (2 ^ pendbc) / ADCClock
*/
- pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz / 1000, 1);
+ st->ts_pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz /
+ 1000, 1);
- while (pendbc >> ++i)
+ while (st->ts_pendbc >> ++i)
; /* Empty! Find the shift offset */
- if (abs(pendbc - (1 << i)) < abs(pendbc - (1 << (i - 1))))
- pendbc = i;
+ if (abs(st->ts_pendbc - (1 << i)) < abs(st->ts_pendbc - (1 << (i - 1))))
+ st->ts_pendbc = i;
else
- pendbc = i - 1;
+ st->ts_pendbc = i - 1;
- if (st->caps->has_tsmr) {
- reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
- & AT91_ADC_TSMR_TSAV;
- reg |= AT91_ADC_TSMR_PENDBC_(pendbc) & AT91_ADC_TSMR_PENDBC;
- reg |= AT91_ADC_TSMR_NOTSDMA;
- reg |= AT91_ADC_TSMR_PENDET_ENA;
- reg |= 0x03 << 8; /* TSFREQ, need bigger than TSAV */
-
- at91_adc_writel(st, AT91_ADC_TSMR, reg);
- } else {
- /* TODO: for 9g45 which has no TSMR */
+ if (!st->caps->has_tsmr) {
+ reg = at91_adc_readl(st, AT91_ADC_MR);
+ reg |= AT91_ADC_TSAMOD_TS_ONLY_MODE | AT91_ADC_PENDET;
+
+ reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
+ at91_adc_writel(st, AT91_ADC_MR, reg);
+
+ reg = AT91_ADC_TSR_SHTIM_(TOUCH_SHTIM) & AT91_ADC_TSR_SHTIM;
+ at91_adc_writel(st, AT91_ADC_TSR, reg);
+
+ st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US_RL *
+ adc_clk_khz / 1000) - 1, 1);
+
+ return 0;
}
+ if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
+ reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
+ else
+ reg = AT91_ADC_TSMR_TSMODE_5WIRE;
+
+ reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
+ & AT91_ADC_TSMR_TSAV;
+ reg |= AT91_ADC_TSMR_PENDBC_(st->ts_pendbc) & AT91_ADC_TSMR_PENDBC;
+ reg |= AT91_ADC_TSMR_NOTSDMA;
+ reg |= AT91_ADC_TSMR_PENDET_ENA;
+ reg |= 0x03 << 8; /* TSFREQ, needs to be bigger than TSAV */
+
+ at91_adc_writel(st, AT91_ADC_TSMR, reg);
+
/* Change adc internal resistor value for better pen detection,
* default value is 100 kOhm.
* 0 = 200 kOhm, 1 = 150 kOhm, 2 = 100 kOhm, 3 = 50 kOhm
@@ -864,7 +954,7 @@ static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
at91_adc_writel(st, AT91_ADC_ACR, st->caps->ts_pen_detect_sensitivity
& AT91_ADC_ACR_PENDETSENS);
- /* Sample Peroid Time = (TRGPER + 1) / ADCClock */
+ /* Sample Period Time = (TRGPER + 1) / ADCClock */
st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US *
adc_clk_khz / 1000) - 1, 1);
@@ -893,17 +983,37 @@ static int at91_ts_register(struct at91_adc_state *st,
__set_bit(EV_ABS, input->evbit);
__set_bit(EV_KEY, input->evbit);
__set_bit(BTN_TOUCH, input->keybit);
- input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
- input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
- input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
+ if (st->caps->has_tsmr) {
+ input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
+ } else {
+ if (st->touchscreen_type != ATMEL_ADC_TOUCHSCREEN_4WIRE) {
+ dev_err(&pdev->dev,
+ "This touchscreen controller only support 4 wires\n");
+ ret = -EINVAL;
+ goto err;
+ }
+
+ input_set_abs_params(input, ABS_X, 0, (1 << MAX_RLPOS_BITS) - 1,
+ 0, 0);
+ input_set_abs_params(input, ABS_Y, 0, (1 << MAX_RLPOS_BITS) - 1,
+ 0, 0);
+ }
st->ts_input = input;
input_set_drvdata(input, st);
ret = input_register_device(input);
if (ret)
- input_free_device(st->ts_input);
+ goto err;
+
+ return ret;
+err:
+ input_free_device(st->ts_input);
return ret;
}
@@ -962,11 +1072,13 @@ static int at91_adc_probe(struct platform_device *pdev)
*/
at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_SWRST);
at91_adc_writel(st, AT91_ADC_IDR, 0xFFFFFFFF);
- ret = request_irq(st->irq,
- at91_adc_interrupt,
- 0,
- pdev->dev.driver->name,
- idev);
+
+ if (st->caps->has_tsmr)
+ ret = request_irq(st->irq, at91_adc_9x5_interrupt, 0,
+ pdev->dev.driver->name, idev);
+ else
+ ret = request_irq(st->irq, at91_adc_rl_interrupt, 0,
+ pdev->dev.driver->name, idev);
if (ret) {
dev_err(&pdev->dev, "Failed to allocate IRQ.\n");
return ret;
@@ -1070,12 +1182,6 @@ static int at91_adc_probe(struct platform_device *pdev)
goto error_disable_adc_clk;
}
} else {
- if (!st->caps->has_tsmr) {
- dev_err(&pdev->dev, "We don't support non-TSMR adc\n");
- ret = -ENODEV;
- goto error_disable_adc_clk;
- }
-
ret = at91_ts_register(st, pdev);
if (ret)
goto error_disable_adc_clk;
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index fcf73879dbfe..7819fc787731 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -7,6 +7,12 @@
#ifndef _AT91_ADC_H_
#define _AT91_ADC_H_
+enum atmel_adc_ts_type {
+ ATMEL_ADC_TOUCHSCREEN_NONE = 0,
+ ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
+ ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
+};
+
/**
* struct at91_adc_trigger - description of triggers
* @name: name of the trigger advertised to the user
@@ -28,6 +34,7 @@ struct at91_adc_trigger {
* @trigger_number: Number of triggers available in the ADC
* @use_external_triggers: does the board has external triggers availables
* @vref: Reference voltage for the ADC in millivolts
+ * @touchscreen_type: If a touchscreen is connected, its type (4 or 5 wires)
*/
struct at91_adc_data {
unsigned long channels_used;
@@ -36,6 +43,7 @@ struct at91_adc_data {
u8 trigger_number;
bool use_external_triggers;
u16 vref;
+ enum atmel_adc_ts_type touchscreen_type;
};
extern void __init at91_add_device_adc(struct at91_adc_data *data);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 05/15] ARM: at91: sam9m10g45ek: Add touchscreen support through at91_adc
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:56 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
at91_adc now supports reading a touchscreen for ADCs without a TSMR register.
Enable touchscreen support through at91_adc. This allows to use both a
touchscreen and the remaining ADC channel at the same time.
Also, lower the clock for the ADC as it allows to have more stable reads and
this is the speed used by atmel_tsadcc.
It lowers the maximum throughput rate from 440000 samples per second to 12958
samples per second. It shouldn't be an issue as the CPU is not able to keep up
reading samples at that frequency.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam9g45.c | 2 +-
arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 2f455ce35268..3c519a7a938f 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -181,7 +181,7 @@ static struct clk vdec_clk = {
static struct clk adc_op_clk = {
.name = "adc_op_clk",
.type = CLK_TYPE_PERIPHERAL,
- .rate_hz = 13200000,
+ .rate_hz = 300000,
};
/* AES/TDES/SHA clock - Only for sam9m11/sam9g56 */
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ef39078c8ce2..4d775b796ce4 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -315,6 +315,7 @@ static struct at91_adc_data ek_adc_data = {
.channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
.use_external_triggers = true,
.vref = 3300,
+ .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
};
/*
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 05/15] ARM: at91: sam9m10g45ek: Add touchscreen support through at91_adc
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: linux-arm-kernel
at91_adc now supports reading a touchscreen for ADCs without a TSMR register.
Enable touchscreen support through at91_adc. This allows to use both a
touchscreen and the remaining ADC channel at the same time.
Also, lower the clock for the ADC as it allows to have more stable reads and
this is the speed used by atmel_tsadcc.
It lowers the maximum throughput rate from 440000 samples per second to 12958
samples per second. It shouldn't be an issue as the CPU is not able to keep up
reading samples at that frequency.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam9g45.c | 2 +-
arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 2f455ce35268..3c519a7a938f 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -181,7 +181,7 @@ static struct clk vdec_clk = {
static struct clk adc_op_clk = {
.name = "adc_op_clk",
.type = CLK_TYPE_PERIPHERAL,
- .rate_hz = 13200000,
+ .rate_hz = 300000,
};
/* AES/TDES/SHA clock - Only for sam9m11/sam9g56 */
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ef39078c8ce2..4d775b796ce4 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -315,6 +315,7 @@ static struct at91_adc_data ek_adc_data = {
.channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
.use_external_triggers = true,
.vref = 3300,
+ .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
};
/*
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 06/15] iio: adc: at91: remove unused include from include/mach
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:56 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
That include file is now only used by the at91_adc driver, remove it from
include/mach for better driver separation.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/include/mach/at91_adc.h | 120 -----------------------------
drivers/iio/adc/at91_adc.c | 103 ++++++++++++++++++++++++-
2 files changed, 102 insertions(+), 121 deletions(-)
delete mode 100644 arch/arm/mach-at91/include/mach/at91_adc.h
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
deleted file mode 100644
index 7d80396346b2..000000000000
--- a/arch/arm/mach-at91/include/mach/at91_adc.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/at91_adc.h
- *
- * Copyright (C) SAN People
- *
- * Analog-to-Digital Converter (ADC) registers.
- * Based on AT91SAM9260 datasheet revision D.
- *
- * 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.
- */
-
-#ifndef AT91_ADC_H
-#define AT91_ADC_H
-
-#define AT91_ADC_CR 0x00 /* Control Register */
-#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
-#define AT91_ADC_START (1 << 1) /* Start Conversion */
-
-#define AT91_ADC_MR 0x04 /* Mode Register */
-#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
-#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
-#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
-#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
-#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
-#define AT91_ADC_TRGSEL_TC0 (0 << 1)
-#define AT91_ADC_TRGSEL_TC1 (1 << 1)
-#define AT91_ADC_TRGSEL_TC2 (2 << 1)
-#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
-#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
-#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
-#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
-#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
-#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
-#define AT91_ADC_PRESCAL_(x) ((x) << 8)
-#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
-#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
-#define AT91_ADC_STARTUP_9X5 (0xf << 16)
-#define AT91_ADC_STARTUP_(x) ((x) << 16)
-#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
-#define AT91_ADC_SHTIM_(x) ((x) << 24)
-#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
-#define AT91_ADC_PENDBC_(x) ((x) << 28)
-
-#define AT91_ADC_TSR 0x0C
-#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
-#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
-
-#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
-#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
-#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
-#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
-
-#define AT91_ADC_SR 0x1C /* Status Register */
-#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
-#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
-#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
-#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
-#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
-#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
-
-#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
-#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
-
-#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
-#define AT91_ADC_LDATA (0x3ff)
-
-#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
-#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
-#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
-#define AT91RL_ADC_IER_PEN (1 << 20)
-#define AT91RL_ADC_IER_NOPEN (1 << 21)
-#define AT91_ADC_IER_PEN (1 << 29)
-#define AT91_ADC_IER_NOPEN (1 << 30)
-#define AT91_ADC_IER_XRDY (1 << 20)
-#define AT91_ADC_IER_YRDY (1 << 21)
-#define AT91_ADC_IER_PRDY (1 << 22)
-#define AT91_ADC_ISR_PENS (1 << 31)
-
-#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
-#define AT91_ADC_DATA (0x3ff)
-
-#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
-
-#define AT91_ADC_ACR 0x94 /* Analog Control Register */
-#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
-
-#define AT91_ADC_TSMR 0xB0
-#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
-#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
-#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
-#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
-#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
-#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
-#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
-#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
-#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
-#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
-#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
-#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
-#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
-
-#define AT91_ADC_TSXPOSR 0xB4
-#define AT91_ADC_TSYPOSR 0xB8
-#define AT91_ADC_TSPRESSR 0xBC
-
-#define AT91_ADC_TRGR_9260 AT91_ADC_MR
-#define AT91_ADC_TRGR_9G45 0x08
-#define AT91_ADC_TRGR_9X5 0xC0
-
-/* Trigger Register bit field */
-#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
-#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
-#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
-#define AT91_ADC_TRGR_NONE (0 << 0)
-#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
-
-#endif
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index c0e4206e34e5..a51b8badbf8e 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -31,7 +31,108 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
-#include <mach/at91_adc.h>
+/* Registers */
+#define AT91_ADC_CR 0x00 /* Control Register */
+#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
+#define AT91_ADC_START (1 << 1) /* Start Conversion */
+
+#define AT91_ADC_MR 0x04 /* Mode Register */
+#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
+#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
+#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
+#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
+#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
+#define AT91_ADC_TRGSEL_TC0 (0 << 1)
+#define AT91_ADC_TRGSEL_TC1 (1 << 1)
+#define AT91_ADC_TRGSEL_TC2 (2 << 1)
+#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
+#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
+#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
+#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
+#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
+#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
+#define AT91_ADC_PRESCAL_(x) ((x) << 8)
+#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
+#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
+#define AT91_ADC_STARTUP_9X5 (0xf << 16)
+#define AT91_ADC_STARTUP_(x) ((x) << 16)
+#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
+#define AT91_ADC_SHTIM_(x) ((x) << 24)
+#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
+#define AT91_ADC_PENDBC_(x) ((x) << 28)
+
+#define AT91_ADC_TSR 0x0C
+#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
+#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
+
+#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
+#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
+#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
+#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
+
+#define AT91_ADC_SR 0x1C /* Status Register */
+#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
+#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
+#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
+#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
+#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
+#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
+
+#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
+#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
+
+#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
+#define AT91_ADC_LDATA (0x3ff)
+
+#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
+#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
+#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
+#define AT91RL_ADC_IER_PEN (1 << 20)
+#define AT91RL_ADC_IER_NOPEN (1 << 21)
+#define AT91_ADC_IER_PEN (1 << 29)
+#define AT91_ADC_IER_NOPEN (1 << 30)
+#define AT91_ADC_IER_XRDY (1 << 20)
+#define AT91_ADC_IER_YRDY (1 << 21)
+#define AT91_ADC_IER_PRDY (1 << 22)
+#define AT91_ADC_ISR_PENS (1 << 31)
+
+#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
+#define AT91_ADC_DATA (0x3ff)
+
+#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
+
+#define AT91_ADC_ACR 0x94 /* Analog Control Register */
+#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
+
+#define AT91_ADC_TSMR 0xB0
+#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
+#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
+#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
+#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
+#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
+#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
+#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
+#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
+#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
+#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
+#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
+#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
+#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
+
+#define AT91_ADC_TSXPOSR 0xB4
+#define AT91_ADC_TSYPOSR 0xB8
+#define AT91_ADC_TSPRESSR 0xBC
+
+#define AT91_ADC_TRGR_9260 AT91_ADC_MR
+#define AT91_ADC_TRGR_9G45 0x08
+#define AT91_ADC_TRGR_9X5 0xC0
+
+/* Trigger Register bit field */
+#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
+#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
+#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
+#define AT91_ADC_TRGR_NONE (0 << 0)
+#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
#define AT91_ADC_CHAN(st, ch) \
(st->registers->channel_base + (ch * 4))
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 06/15] iio: adc: at91: remove unused include from include/mach
@ 2014-03-17 13:56 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:56 UTC (permalink / raw)
To: linux-arm-kernel
That include file is now only used by the at91_adc driver, remove it from
include/mach for better driver separation.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/include/mach/at91_adc.h | 120 -----------------------------
drivers/iio/adc/at91_adc.c | 103 ++++++++++++++++++++++++-
2 files changed, 102 insertions(+), 121 deletions(-)
delete mode 100644 arch/arm/mach-at91/include/mach/at91_adc.h
diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
deleted file mode 100644
index 7d80396346b2..000000000000
--- a/arch/arm/mach-at91/include/mach/at91_adc.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/at91_adc.h
- *
- * Copyright (C) SAN People
- *
- * Analog-to-Digital Converter (ADC) registers.
- * Based on AT91SAM9260 datasheet revision D.
- *
- * 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.
- */
-
-#ifndef AT91_ADC_H
-#define AT91_ADC_H
-
-#define AT91_ADC_CR 0x00 /* Control Register */
-#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
-#define AT91_ADC_START (1 << 1) /* Start Conversion */
-
-#define AT91_ADC_MR 0x04 /* Mode Register */
-#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
-#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
-#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
-#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
-#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
-#define AT91_ADC_TRGSEL_TC0 (0 << 1)
-#define AT91_ADC_TRGSEL_TC1 (1 << 1)
-#define AT91_ADC_TRGSEL_TC2 (2 << 1)
-#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
-#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
-#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
-#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
-#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
-#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
-#define AT91_ADC_PRESCAL_(x) ((x) << 8)
-#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
-#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
-#define AT91_ADC_STARTUP_9X5 (0xf << 16)
-#define AT91_ADC_STARTUP_(x) ((x) << 16)
-#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
-#define AT91_ADC_SHTIM_(x) ((x) << 24)
-#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
-#define AT91_ADC_PENDBC_(x) ((x) << 28)
-
-#define AT91_ADC_TSR 0x0C
-#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
-#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
-
-#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
-#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
-#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
-#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
-
-#define AT91_ADC_SR 0x1C /* Status Register */
-#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
-#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
-#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
-#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
-#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
-#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
-
-#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
-#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
-
-#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
-#define AT91_ADC_LDATA (0x3ff)
-
-#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
-#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
-#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
-#define AT91RL_ADC_IER_PEN (1 << 20)
-#define AT91RL_ADC_IER_NOPEN (1 << 21)
-#define AT91_ADC_IER_PEN (1 << 29)
-#define AT91_ADC_IER_NOPEN (1 << 30)
-#define AT91_ADC_IER_XRDY (1 << 20)
-#define AT91_ADC_IER_YRDY (1 << 21)
-#define AT91_ADC_IER_PRDY (1 << 22)
-#define AT91_ADC_ISR_PENS (1 << 31)
-
-#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
-#define AT91_ADC_DATA (0x3ff)
-
-#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
-
-#define AT91_ADC_ACR 0x94 /* Analog Control Register */
-#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
-
-#define AT91_ADC_TSMR 0xB0
-#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
-#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
-#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
-#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
-#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
-#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
-#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
-#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
-#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
-#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
-#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
-#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
-#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
-
-#define AT91_ADC_TSXPOSR 0xB4
-#define AT91_ADC_TSYPOSR 0xB8
-#define AT91_ADC_TSPRESSR 0xBC
-
-#define AT91_ADC_TRGR_9260 AT91_ADC_MR
-#define AT91_ADC_TRGR_9G45 0x08
-#define AT91_ADC_TRGR_9X5 0xC0
-
-/* Trigger Register bit field */
-#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
-#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
-#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
-#define AT91_ADC_TRGR_NONE (0 << 0)
-#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
-
-#endif
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index c0e4206e34e5..a51b8badbf8e 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -31,7 +31,108 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
-#include <mach/at91_adc.h>
+/* Registers */
+#define AT91_ADC_CR 0x00 /* Control Register */
+#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
+#define AT91_ADC_START (1 << 1) /* Start Conversion */
+
+#define AT91_ADC_MR 0x04 /* Mode Register */
+#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
+#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
+#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
+#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
+#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
+#define AT91_ADC_TRGSEL_TC0 (0 << 1)
+#define AT91_ADC_TRGSEL_TC1 (1 << 1)
+#define AT91_ADC_TRGSEL_TC2 (2 << 1)
+#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
+#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
+#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
+#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
+#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
+#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
+#define AT91_ADC_PRESCAL_(x) ((x) << 8)
+#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
+#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
+#define AT91_ADC_STARTUP_9X5 (0xf << 16)
+#define AT91_ADC_STARTUP_(x) ((x) << 16)
+#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
+#define AT91_ADC_SHTIM_(x) ((x) << 24)
+#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
+#define AT91_ADC_PENDBC_(x) ((x) << 28)
+
+#define AT91_ADC_TSR 0x0C
+#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
+#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
+
+#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
+#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
+#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
+#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
+
+#define AT91_ADC_SR 0x1C /* Status Register */
+#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
+#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
+#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
+#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
+#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
+#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
+
+#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
+#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
+
+#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
+#define AT91_ADC_LDATA (0x3ff)
+
+#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
+#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
+#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
+#define AT91RL_ADC_IER_PEN (1 << 20)
+#define AT91RL_ADC_IER_NOPEN (1 << 21)
+#define AT91_ADC_IER_PEN (1 << 29)
+#define AT91_ADC_IER_NOPEN (1 << 30)
+#define AT91_ADC_IER_XRDY (1 << 20)
+#define AT91_ADC_IER_YRDY (1 << 21)
+#define AT91_ADC_IER_PRDY (1 << 22)
+#define AT91_ADC_ISR_PENS (1 << 31)
+
+#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
+#define AT91_ADC_DATA (0x3ff)
+
+#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
+
+#define AT91_ADC_ACR 0x94 /* Analog Control Register */
+#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
+
+#define AT91_ADC_TSMR 0xB0
+#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
+#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
+#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
+#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
+#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
+#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
+#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
+#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
+#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
+#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
+#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
+#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
+#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
+
+#define AT91_ADC_TSXPOSR 0xB4
+#define AT91_ADC_TSYPOSR 0xB8
+#define AT91_ADC_TSPRESSR 0xBC
+
+#define AT91_ADC_TRGR_9260 AT91_ADC_MR
+#define AT91_ADC_TRGR_9G45 0x08
+#define AT91_ADC_TRGR_9X5 0xC0
+
+/* Trigger Register bit field */
+#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
+#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
+#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
+#define AT91_ADC_TRGR_NONE (0 << 0)
+#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
#define AT91_ADC_CHAN(st, ch) \
(st->registers->channel_base + (ch * 4))
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 07/15] iio: adc: at91: add sam9rl support
2014-03-17 13:56 ` Alexandre Belloni
(?)
@ 2014-03-17 13:57 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/iio/adc/at91_adc.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index a51b8badbf8e..3b5bacd4d8da 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1346,6 +1346,20 @@ static struct at91_adc_caps at91sam9260_caps = {
},
};
+static struct at91_adc_caps at91sam9rl_caps = {
+ .has_ts = true,
+ .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
+ .num_channels = 6,
+ .registers = {
+ .channel_base = AT91_ADC_CHR(0),
+ .drdy_mask = AT91_ADC_DRDY,
+ .status_register = AT91_ADC_SR,
+ .trigger_register = AT91_ADC_TRGR_9G45,
+ .mr_prescal_mask = AT91_ADC_PRESCAL_9260,
+ .mr_startup_mask = AT91_ADC_STARTUP_9G45,
+ },
+};
+
static struct at91_adc_caps at91sam9g45_caps = {
.has_ts = true,
.calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
@@ -1380,6 +1394,7 @@ static struct at91_adc_caps at91sam9x5_caps = {
static const struct of_device_id at91_adc_dt_ids[] = {
{ .compatible = "atmel,at91sam9260-adc", .data = &at91sam9260_caps },
+ { .compatible = "atmel,at91sam9rl-adc", .data = &at91sam9rl_caps },
{ .compatible = "atmel,at91sam9g45-adc", .data = &at91sam9g45_caps },
{ .compatible = "atmel,at91sam9x5-adc", .data = &at91sam9x5_caps },
{},
@@ -1391,6 +1406,9 @@ static const struct platform_device_id at91_adc_ids[] = {
.name = "at91sam9260-adc",
.driver_data = (unsigned long)&at91sam9260_caps,
}, {
+ .name = "at91sam9rl-adc",
+ .driver_data = (unsigned long)&at91sam9rl_caps,
+ }, {
.name = "at91sam9g45-adc",
.driver_data = (unsigned long)&at91sam9g45_caps,
}, {
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 07/15] iio: adc: at91: add sam9rl support
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: linux-iio, linux-kernel, Alexandre Belloni, linux-input,
Gregory Clement, Maxime Ripard, Jean-Christophe Plagniol-Villard,
linux-arm-kernel
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/iio/adc/at91_adc.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index a51b8badbf8e..3b5bacd4d8da 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1346,6 +1346,20 @@ static struct at91_adc_caps at91sam9260_caps = {
},
};
+static struct at91_adc_caps at91sam9rl_caps = {
+ .has_ts = true,
+ .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
+ .num_channels = 6,
+ .registers = {
+ .channel_base = AT91_ADC_CHR(0),
+ .drdy_mask = AT91_ADC_DRDY,
+ .status_register = AT91_ADC_SR,
+ .trigger_register = AT91_ADC_TRGR_9G45,
+ .mr_prescal_mask = AT91_ADC_PRESCAL_9260,
+ .mr_startup_mask = AT91_ADC_STARTUP_9G45,
+ },
+};
+
static struct at91_adc_caps at91sam9g45_caps = {
.has_ts = true,
.calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
@@ -1380,6 +1394,7 @@ static struct at91_adc_caps at91sam9x5_caps = {
static const struct of_device_id at91_adc_dt_ids[] = {
{ .compatible = "atmel,at91sam9260-adc", .data = &at91sam9260_caps },
+ { .compatible = "atmel,at91sam9rl-adc", .data = &at91sam9rl_caps },
{ .compatible = "atmel,at91sam9g45-adc", .data = &at91sam9g45_caps },
{ .compatible = "atmel,at91sam9x5-adc", .data = &at91sam9x5_caps },
{},
@@ -1391,6 +1406,9 @@ static const struct platform_device_id at91_adc_ids[] = {
.name = "at91sam9260-adc",
.driver_data = (unsigned long)&at91sam9260_caps,
}, {
+ .name = "at91sam9rl-adc",
+ .driver_data = (unsigned long)&at91sam9rl_caps,
+ }, {
.name = "at91sam9g45-adc",
.driver_data = (unsigned long)&at91sam9g45_caps,
}, {
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 07/15] iio: adc: at91: add sam9rl support
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/iio/adc/at91_adc.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index a51b8badbf8e..3b5bacd4d8da 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -1346,6 +1346,20 @@ static struct at91_adc_caps at91sam9260_caps = {
},
};
+static struct at91_adc_caps at91sam9rl_caps = {
+ .has_ts = true,
+ .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
+ .num_channels = 6,
+ .registers = {
+ .channel_base = AT91_ADC_CHR(0),
+ .drdy_mask = AT91_ADC_DRDY,
+ .status_register = AT91_ADC_SR,
+ .trigger_register = AT91_ADC_TRGR_9G45,
+ .mr_prescal_mask = AT91_ADC_PRESCAL_9260,
+ .mr_startup_mask = AT91_ADC_STARTUP_9G45,
+ },
+};
+
static struct at91_adc_caps at91sam9g45_caps = {
.has_ts = true,
.calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
@@ -1380,6 +1394,7 @@ static struct at91_adc_caps at91sam9x5_caps = {
static const struct of_device_id at91_adc_dt_ids[] = {
{ .compatible = "atmel,at91sam9260-adc", .data = &at91sam9260_caps },
+ { .compatible = "atmel,at91sam9rl-adc", .data = &at91sam9rl_caps },
{ .compatible = "atmel,at91sam9g45-adc", .data = &at91sam9g45_caps },
{ .compatible = "atmel,at91sam9x5-adc", .data = &at91sam9x5_caps },
{},
@@ -1391,6 +1406,9 @@ static const struct platform_device_id at91_adc_ids[] = {
.name = "at91sam9260-adc",
.driver_data = (unsigned long)&at91sam9260_caps,
}, {
+ .name = "at91sam9rl-adc",
+ .driver_data = (unsigned long)&at91sam9rl_caps,
+ }, {
.name = "at91sam9g45-adc",
.driver_data = (unsigned long)&at91sam9g45_caps,
}, {
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
The ADC clock needs to be defined to enable the at91_adc driver. It is defined
to the same speed that is used for atmel_tsadcc.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam9rl.c | 7 +++
arch/arm/mach-at91/at91sam9rl_devices.c | 85 +++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+)
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 3651517abedf..753ba4893836 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -151,6 +151,11 @@ static struct clk ac97_clk = {
.pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
.type = CLK_TYPE_PERIPHERAL,
};
+static struct clk adc_op_clk = {
+ .name = "adc_op_clk",
+ .type = CLK_TYPE_PERIPHERAL,
+ .rate_hz = 1000000,
+};
static struct clk *periph_clocks[] __initdata = {
&pioA_clk,
@@ -176,6 +181,7 @@ static struct clk *periph_clocks[] __initdata = {
&udphs_clk,
&lcdc_clk,
&ac97_clk,
+ &adc_op_clk,
// irq0
};
@@ -196,6 +202,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_ID("pioB", &pioB_clk),
CLKDEV_CON_ID("pioC", &pioC_clk),
CLKDEV_CON_ID("pioD", &pioD_clk),
+ CLKDEV_CON_ID("adc_clk", &tsc_clk),
};
static struct clk_lookup usart_clocks_lookups[] = {
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index a698bdab2cce..b836dada942c 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -22,6 +22,7 @@
#include <mach/at91_matrix.h>
#include <mach/at91sam9_smc.h>
#include <linux/platform_data/dma-atmel.h>
+#include <linux/platform_data/at91_adc.h>
#include "board.h"
#include "generic.h"
@@ -656,6 +657,90 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
#endif
+/* --------------------------------------------------------------------
+ * ADC and Touchscreen
+ * -------------------------------------------------------------------- */
+
+#if IS_ENABLED(CONFIG_AT91_ADC)
+static struct at91_adc_data adc_data;
+
+static struct resource adc_resources[] = {
+ [0] = {
+ .start = AT91SAM9RL_BASE_TSC,
+ .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
+ .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+static struct platform_device at91_adc_device = {
+ .name = "at91sam9rl-adc",
+ .id = -1,
+ .dev = {
+ .platform_data = &adc_data,
+ },
+ .resource = adc_resources,
+ .num_resources = ARRAY_SIZE(adc_resources),
+};
+
+static struct at91_adc_trigger at91_adc_triggers[] = {
+ [0] = {
+ .name = "external-rising",
+ .value = 1,
+ .is_external = true,
+ },
+ [1] = {
+ .name = "external-falling",
+ .value = 2,
+ .is_external = true,
+ },
+ [2] = {
+ .name = "external-any",
+ .value = 3,
+ .is_external = true,
+ },
+ [3] = {
+ .name = "continuous",
+ .value = 6,
+ .is_external = false,
+ },
+};
+
+void __init at91_add_device_adc(struct at91_adc_data *data)
+{
+ if (!data)
+ return;
+
+ if (test_bit(0, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA17, 0);
+ if (test_bit(1, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA18, 0);
+ if (test_bit(2, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA19, 0);
+ if (test_bit(3, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA20, 0);
+ if (test_bit(4, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PD6, 0);
+ if (test_bit(5, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PD7, 0);
+
+ if (data->use_external_triggers)
+ at91_set_A_periph(AT91_PIN_PB15, 0);
+
+ data->startup_time = 40;
+ data->trigger_number = 4;
+ data->trigger_list = at91_adc_triggers;
+
+ adc_data = *data;
+ platform_device_register(&at91_adc_device);
+}
+#else
+void __init at91_add_device_adc(struct at91_adc_data *data) {}
+#endif
/* --------------------------------------------------------------------
* RTC
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement, Alexandre Belloni
The ADC clock needs to be defined to enable the at91_adc driver. It is defined
to the same speed that is used for atmel_tsadcc.
Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
arch/arm/mach-at91/at91sam9rl.c | 7 +++
arch/arm/mach-at91/at91sam9rl_devices.c | 85 +++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+)
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 3651517abedf..753ba4893836 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -151,6 +151,11 @@ static struct clk ac97_clk = {
.pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
.type = CLK_TYPE_PERIPHERAL,
};
+static struct clk adc_op_clk = {
+ .name = "adc_op_clk",
+ .type = CLK_TYPE_PERIPHERAL,
+ .rate_hz = 1000000,
+};
static struct clk *periph_clocks[] __initdata = {
&pioA_clk,
@@ -176,6 +181,7 @@ static struct clk *periph_clocks[] __initdata = {
&udphs_clk,
&lcdc_clk,
&ac97_clk,
+ &adc_op_clk,
// irq0
};
@@ -196,6 +202,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_ID("pioB", &pioB_clk),
CLKDEV_CON_ID("pioC", &pioC_clk),
CLKDEV_CON_ID("pioD", &pioD_clk),
+ CLKDEV_CON_ID("adc_clk", &tsc_clk),
};
static struct clk_lookup usart_clocks_lookups[] = {
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index a698bdab2cce..b836dada942c 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -22,6 +22,7 @@
#include <mach/at91_matrix.h>
#include <mach/at91sam9_smc.h>
#include <linux/platform_data/dma-atmel.h>
+#include <linux/platform_data/at91_adc.h>
#include "board.h"
#include "generic.h"
@@ -656,6 +657,90 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
#endif
+/* --------------------------------------------------------------------
+ * ADC and Touchscreen
+ * -------------------------------------------------------------------- */
+
+#if IS_ENABLED(CONFIG_AT91_ADC)
+static struct at91_adc_data adc_data;
+
+static struct resource adc_resources[] = {
+ [0] = {
+ .start = AT91SAM9RL_BASE_TSC,
+ .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
+ .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+static struct platform_device at91_adc_device = {
+ .name = "at91sam9rl-adc",
+ .id = -1,
+ .dev = {
+ .platform_data = &adc_data,
+ },
+ .resource = adc_resources,
+ .num_resources = ARRAY_SIZE(adc_resources),
+};
+
+static struct at91_adc_trigger at91_adc_triggers[] = {
+ [0] = {
+ .name = "external-rising",
+ .value = 1,
+ .is_external = true,
+ },
+ [1] = {
+ .name = "external-falling",
+ .value = 2,
+ .is_external = true,
+ },
+ [2] = {
+ .name = "external-any",
+ .value = 3,
+ .is_external = true,
+ },
+ [3] = {
+ .name = "continuous",
+ .value = 6,
+ .is_external = false,
+ },
+};
+
+void __init at91_add_device_adc(struct at91_adc_data *data)
+{
+ if (!data)
+ return;
+
+ if (test_bit(0, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA17, 0);
+ if (test_bit(1, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA18, 0);
+ if (test_bit(2, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA19, 0);
+ if (test_bit(3, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA20, 0);
+ if (test_bit(4, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PD6, 0);
+ if (test_bit(5, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PD7, 0);
+
+ if (data->use_external_triggers)
+ at91_set_A_periph(AT91_PIN_PB15, 0);
+
+ data->startup_time = 40;
+ data->trigger_number = 4;
+ data->trigger_list = at91_adc_triggers;
+
+ adc_data = *data;
+ platform_device_register(&at91_adc_device);
+}
+#else
+void __init at91_add_device_adc(struct at91_adc_data *data) {}
+#endif
/* --------------------------------------------------------------------
* RTC
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
The ADC clock needs to be defined to enable the at91_adc driver. It is defined
to the same speed that is used for atmel_tsadcc.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam9rl.c | 7 +++
arch/arm/mach-at91/at91sam9rl_devices.c | 85 +++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+)
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 3651517abedf..753ba4893836 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -151,6 +151,11 @@ static struct clk ac97_clk = {
.pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
.type = CLK_TYPE_PERIPHERAL,
};
+static struct clk adc_op_clk = {
+ .name = "adc_op_clk",
+ .type = CLK_TYPE_PERIPHERAL,
+ .rate_hz = 1000000,
+};
static struct clk *periph_clocks[] __initdata = {
&pioA_clk,
@@ -176,6 +181,7 @@ static struct clk *periph_clocks[] __initdata = {
&udphs_clk,
&lcdc_clk,
&ac97_clk,
+ &adc_op_clk,
// irq0
};
@@ -196,6 +202,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
CLKDEV_CON_ID("pioB", &pioB_clk),
CLKDEV_CON_ID("pioC", &pioC_clk),
CLKDEV_CON_ID("pioD", &pioD_clk),
+ CLKDEV_CON_ID("adc_clk", &tsc_clk),
};
static struct clk_lookup usart_clocks_lookups[] = {
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index a698bdab2cce..b836dada942c 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -22,6 +22,7 @@
#include <mach/at91_matrix.h>
#include <mach/at91sam9_smc.h>
#include <linux/platform_data/dma-atmel.h>
+#include <linux/platform_data/at91_adc.h>
#include "board.h"
#include "generic.h"
@@ -656,6 +657,90 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
#endif
+/* --------------------------------------------------------------------
+ * ADC and Touchscreen
+ * -------------------------------------------------------------------- */
+
+#if IS_ENABLED(CONFIG_AT91_ADC)
+static struct at91_adc_data adc_data;
+
+static struct resource adc_resources[] = {
+ [0] = {
+ .start = AT91SAM9RL_BASE_TSC,
+ .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
+ .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+static struct platform_device at91_adc_device = {
+ .name = "at91sam9rl-adc",
+ .id = -1,
+ .dev = {
+ .platform_data = &adc_data,
+ },
+ .resource = adc_resources,
+ .num_resources = ARRAY_SIZE(adc_resources),
+};
+
+static struct at91_adc_trigger at91_adc_triggers[] = {
+ [0] = {
+ .name = "external-rising",
+ .value = 1,
+ .is_external = true,
+ },
+ [1] = {
+ .name = "external-falling",
+ .value = 2,
+ .is_external = true,
+ },
+ [2] = {
+ .name = "external-any",
+ .value = 3,
+ .is_external = true,
+ },
+ [3] = {
+ .name = "continuous",
+ .value = 6,
+ .is_external = false,
+ },
+};
+
+void __init at91_add_device_adc(struct at91_adc_data *data)
+{
+ if (!data)
+ return;
+
+ if (test_bit(0, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA17, 0);
+ if (test_bit(1, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA18, 0);
+ if (test_bit(2, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA19, 0);
+ if (test_bit(3, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PA20, 0);
+ if (test_bit(4, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PD6, 0);
+ if (test_bit(5, &data->channels_used))
+ at91_set_A_periph(AT91_PIN_PD7, 0);
+
+ if (data->use_external_triggers)
+ at91_set_A_periph(AT91_PIN_PB15, 0);
+
+ data->startup_time = 40;
+ data->trigger_number = 4;
+ data->trigger_list = at91_adc_triggers;
+
+ adc_data = *data;
+ platform_device_register(&at91_adc_device);
+}
+#else
+void __init at91_add_device_adc(struct at91_adc_data *data) {}
+#endif
/* --------------------------------------------------------------------
* RTC
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 09/15] ARM: at91: sam9rlek add touchscreen support through at91_adc
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:57 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
at91_adc now supports reading a touchscreen for ADCs without a TSMR register.
Enable touchscreen support through at91_adc. This allows to use both a
touchscreen and the remaining ADC channel at the same time.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/board-sam9rlek.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 604eecf6cd70..35d420247e25 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -18,6 +18,7 @@
#include <linux/clk.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
+#include <linux/platform_data/at91_adc.h>
#include <video/atmel_lcdc.h>
@@ -239,6 +240,17 @@ static struct at91_tsadcc_data ek_tsadcc_data = {
/*
+ * ADC + Touchscreen
+ */
+static struct at91_adc_data ek_adc_data = {
+ .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5),
+ .use_external_triggers = true,
+ .vref = 3300,
+ .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
+};
+
+
+/*
* GPIO Buttons
*/
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
@@ -312,6 +324,8 @@ static void __init ek_board_init(void)
at91_add_device_ac97(&ek_ac97_data);
/* Touch Screen Controller */
at91_add_device_tsadcc(&ek_tsadcc_data);
+ /* Touch Screen Controller + ADC */
+ at91_add_device_adc(&ek_adc_data);
/* LEDs */
at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
/* Push Buttons */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 09/15] ARM: at91: sam9rlek add touchscreen support through at91_adc
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
at91_adc now supports reading a touchscreen for ADCs without a TSMR register.
Enable touchscreen support through at91_adc. This allows to use both a
touchscreen and the remaining ADC channel at the same time.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/board-sam9rlek.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 604eecf6cd70..35d420247e25 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -18,6 +18,7 @@
#include <linux/clk.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
+#include <linux/platform_data/at91_adc.h>
#include <video/atmel_lcdc.h>
@@ -239,6 +240,17 @@ static struct at91_tsadcc_data ek_tsadcc_data = {
/*
+ * ADC + Touchscreen
+ */
+static struct at91_adc_data ek_adc_data = {
+ .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5),
+ .use_external_triggers = true,
+ .vref = 3300,
+ .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
+};
+
+
+/*
* GPIO Buttons
*/
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
@@ -312,6 +324,8 @@ static void __init ek_board_init(void)
at91_add_device_ac97(&ek_ac97_data);
/* Touch Screen Controller */
at91_add_device_tsadcc(&ek_tsadcc_data);
+ /* Touch Screen Controller + ADC */
+ at91_add_device_adc(&ek_adc_data);
/* LEDs */
at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
/* Push Buttons */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 10/15] ARM: at91: sam9g45: switch from atmel_tsadcc to at91_adc
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:57 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
atmel_tsadcc is not allowing to use the remaining ADC channels while at91_adc
does. Completely switch to at91_adc and remove the tsadcc platform_data for
at91sam9g45 and at91sam9g45 based boards.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/configs/at91sam9g45_defconfig | 3 +-
arch/arm/mach-at91/at91sam9g45_devices.c | 53 +-------------------------------
arch/arm/mach-at91/board-sam9m10g45ek.c | 15 ++-------
3 files changed, 5 insertions(+), 66 deletions(-)
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index e181a50fd65a..c6661a60025d 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -83,7 +83,6 @@ CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ATMEL_MXT=m
-CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
# CONFIG_SERIO is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_ATMEL=y
@@ -146,6 +145,8 @@ CONFIG_DMADEVICES=y
CONFIG_AT_HDMAC=y
CONFIG_DMATEST=m
# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_IIO=y
+CONFIG_AT91_ADC=y
CONFIG_EXT4_FS=y
CONFIG_FANOTIFY=y
CONFIG_VFAT_FS=y
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index cd36009c3511..87135a61357d 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1131,58 +1131,7 @@ static void __init at91_add_device_rtc(void) {}
/* --------------------------------------------------------------------
- * Touchscreen
- * -------------------------------------------------------------------- */
-
-#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
-static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
-static struct at91_tsadcc_data tsadcc_data;
-
-static struct resource tsadcc_resources[] = {
- [0] = {
- .start = AT91SAM9G45_BASE_TSC,
- .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
- .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
- .flags = IORESOURCE_IRQ,
- }
-};
-
-static struct platform_device at91sam9g45_tsadcc_device = {
- .name = "atmel_tsadcc",
- .id = -1,
- .dev = {
- .dma_mask = &tsadcc_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &tsadcc_data,
- },
- .resource = tsadcc_resources,
- .num_resources = ARRAY_SIZE(tsadcc_resources),
-};
-
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
-{
- if (!data)
- return;
-
- at91_set_gpio_input(AT91_PIN_PD20, 0); /* AD0_XR */
- at91_set_gpio_input(AT91_PIN_PD21, 0); /* AD1_XL */
- at91_set_gpio_input(AT91_PIN_PD22, 0); /* AD2_YT */
- at91_set_gpio_input(AT91_PIN_PD23, 0); /* AD3_TB */
-
- tsadcc_data = *data;
- platform_device_register(&at91sam9g45_tsadcc_device);
-}
-#else
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
-#endif
-
-
-/* --------------------------------------------------------------------
- * ADC
+ * ADC and touchscreen
* -------------------------------------------------------------------- */
#if IS_ENABLED(CONFIG_AT91_ADC)
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 4d775b796ce4..f2f7ce9643ce 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -300,16 +300,7 @@ static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
/*
- * Touchscreen
- */
-static struct at91_tsadcc_data ek_tsadcc_data = {
- .adc_clock = 300000,
- .pendet_debounce = 0x0d,
- .ts_sample_hold_time = 0x0a,
-};
-
-/*
- * ADCs
+ * ADCs and touchscreen
*/
static struct at91_adc_data ek_adc_data = {
.channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
@@ -486,9 +477,7 @@ static void __init ek_board_init(void)
at91_add_device_isi(&isi_data, true);
/* LCD Controller */
at91_add_device_lcdc(&ek_lcdc_data);
- /* Touch Screen */
- at91_add_device_tsadcc(&ek_tsadcc_data);
- /* ADC */
+ /* ADC and touchscreen */
at91_add_device_adc(&ek_adc_data);
/* Push Buttons */
ek_add_device_buttons();
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 10/15] ARM: at91: sam9g45: switch from atmel_tsadcc to at91_adc
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
atmel_tsadcc is not allowing to use the remaining ADC channels while at91_adc
does. Completely switch to at91_adc and remove the tsadcc platform_data for
at91sam9g45 and at91sam9g45 based boards.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/configs/at91sam9g45_defconfig | 3 +-
arch/arm/mach-at91/at91sam9g45_devices.c | 53 +-------------------------------
arch/arm/mach-at91/board-sam9m10g45ek.c | 15 ++-------
3 files changed, 5 insertions(+), 66 deletions(-)
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index e181a50fd65a..c6661a60025d 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -83,7 +83,6 @@ CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ATMEL_MXT=m
-CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
# CONFIG_SERIO is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_ATMEL=y
@@ -146,6 +145,8 @@ CONFIG_DMADEVICES=y
CONFIG_AT_HDMAC=y
CONFIG_DMATEST=m
# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_IIO=y
+CONFIG_AT91_ADC=y
CONFIG_EXT4_FS=y
CONFIG_FANOTIFY=y
CONFIG_VFAT_FS=y
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index cd36009c3511..87135a61357d 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1131,58 +1131,7 @@ static void __init at91_add_device_rtc(void) {}
/* --------------------------------------------------------------------
- * Touchscreen
- * -------------------------------------------------------------------- */
-
-#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
-static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
-static struct at91_tsadcc_data tsadcc_data;
-
-static struct resource tsadcc_resources[] = {
- [0] = {
- .start = AT91SAM9G45_BASE_TSC,
- .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
- .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_TSC,
- .flags = IORESOURCE_IRQ,
- }
-};
-
-static struct platform_device at91sam9g45_tsadcc_device = {
- .name = "atmel_tsadcc",
- .id = -1,
- .dev = {
- .dma_mask = &tsadcc_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &tsadcc_data,
- },
- .resource = tsadcc_resources,
- .num_resources = ARRAY_SIZE(tsadcc_resources),
-};
-
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
-{
- if (!data)
- return;
-
- at91_set_gpio_input(AT91_PIN_PD20, 0); /* AD0_XR */
- at91_set_gpio_input(AT91_PIN_PD21, 0); /* AD1_XL */
- at91_set_gpio_input(AT91_PIN_PD22, 0); /* AD2_YT */
- at91_set_gpio_input(AT91_PIN_PD23, 0); /* AD3_TB */
-
- tsadcc_data = *data;
- platform_device_register(&at91sam9g45_tsadcc_device);
-}
-#else
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
-#endif
-
-
-/* --------------------------------------------------------------------
- * ADC
+ * ADC and touchscreen
* -------------------------------------------------------------------- */
#if IS_ENABLED(CONFIG_AT91_ADC)
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 4d775b796ce4..f2f7ce9643ce 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -300,16 +300,7 @@ static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
/*
- * Touchscreen
- */
-static struct at91_tsadcc_data ek_tsadcc_data = {
- .adc_clock = 300000,
- .pendet_debounce = 0x0d,
- .ts_sample_hold_time = 0x0a,
-};
-
-/*
- * ADCs
+ * ADCs and touchscreen
*/
static struct at91_adc_data ek_adc_data = {
.channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
@@ -486,9 +477,7 @@ static void __init ek_board_init(void)
at91_add_device_isi(&isi_data, true);
/* LCD Controller */
at91_add_device_lcdc(&ek_lcdc_data);
- /* Touch Screen */
- at91_add_device_tsadcc(&ek_tsadcc_data);
- /* ADC */
+ /* ADC and touchscreen */
at91_add_device_adc(&ek_adc_data);
/* Push Buttons */
ek_add_device_buttons();
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 11/15] ARM: at91: sam9rl: switch from atmel_tsadcc to at91_adc
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
atmel_tsadcc is not allowing to use the remaining ADC channels while at91_adc
does. Completely switch to at91_adc and remove the tsadcc platform_data for
at91sam9rl and at91sam9rl based boards.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/configs/at91sam9rl_defconfig | 3 +-
arch/arm/mach-at91/at91sam9rl_devices.c | 50 ---------------------------------
arch/arm/mach-at91/board-sam9rlek.c | 12 --------
3 files changed, 2 insertions(+), 63 deletions(-)
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index 85f846ae9ff2..5d7797d43d23 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -45,7 +45,6 @@ CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
# CONFIG_SERIO is not set
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
@@ -65,6 +64,8 @@ CONFIG_MMC=y
CONFIG_MMC_ATMELMCI=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT91SAM9=y
+CONFIG_IIO=y
+CONFIG_AT91_ADC=y
CONFIG_EXT2_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index b836dada942c..9ccae034119c 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -608,56 +608,6 @@ static void __init at91_add_device_tc(void) { }
/* --------------------------------------------------------------------
- * Touchscreen
- * -------------------------------------------------------------------- */
-
-#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
-static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
-static struct at91_tsadcc_data tsadcc_data;
-
-static struct resource tsadcc_resources[] = {
- [0] = {
- .start = AT91SAM9RL_BASE_TSC,
- .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
- .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
- .flags = IORESOURCE_IRQ,
- }
-};
-
-static struct platform_device at91sam9rl_tsadcc_device = {
- .name = "atmel_tsadcc",
- .id = -1,
- .dev = {
- .dma_mask = &tsadcc_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &tsadcc_data,
- },
- .resource = tsadcc_resources,
- .num_resources = ARRAY_SIZE(tsadcc_resources),
-};
-
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
-{
- if (!data)
- return;
-
- at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */
- at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */
- at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */
- at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */
-
- tsadcc_data = *data;
- platform_device_register(&at91sam9rl_tsadcc_device);
-}
-#else
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
-#endif
-
-/* --------------------------------------------------------------------
* ADC and Touchscreen
* -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 35d420247e25..6ae90e312ce0 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -230,16 +230,6 @@ static struct gpio_led ek_leds[] = {
/*
- * Touchscreen
- */
-static struct at91_tsadcc_data ek_tsadcc_data = {
- .adc_clock = 1000000,
- .pendet_debounce = 0x0f,
- .ts_sample_hold_time = 0x03,
-};
-
-
-/*
* ADC + Touchscreen
*/
static struct at91_adc_data ek_adc_data = {
@@ -322,8 +312,6 @@ static void __init ek_board_init(void)
at91_add_device_lcdc(&ek_lcdc_data);
/* AC97 */
at91_add_device_ac97(&ek_ac97_data);
- /* Touch Screen Controller */
- at91_add_device_tsadcc(&ek_tsadcc_data);
/* Touch Screen Controller + ADC */
at91_add_device_adc(&ek_adc_data);
/* LEDs */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 11/15] ARM: at91: sam9rl: switch from atmel_tsadcc to at91_adc
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement, Alexandre Belloni
atmel_tsadcc is not allowing to use the remaining ADC channels while at91_adc
does. Completely switch to at91_adc and remove the tsadcc platform_data for
at91sam9rl and at91sam9rl based boards.
Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
arch/arm/configs/at91sam9rl_defconfig | 3 +-
arch/arm/mach-at91/at91sam9rl_devices.c | 50 ---------------------------------
arch/arm/mach-at91/board-sam9rlek.c | 12 --------
3 files changed, 2 insertions(+), 63 deletions(-)
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index 85f846ae9ff2..5d7797d43d23 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -45,7 +45,6 @@ CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
# CONFIG_SERIO is not set
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
@@ -65,6 +64,8 @@ CONFIG_MMC=y
CONFIG_MMC_ATMELMCI=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT91SAM9=y
+CONFIG_IIO=y
+CONFIG_AT91_ADC=y
CONFIG_EXT2_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index b836dada942c..9ccae034119c 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -608,56 +608,6 @@ static void __init at91_add_device_tc(void) { }
/* --------------------------------------------------------------------
- * Touchscreen
- * -------------------------------------------------------------------- */
-
-#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
-static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
-static struct at91_tsadcc_data tsadcc_data;
-
-static struct resource tsadcc_resources[] = {
- [0] = {
- .start = AT91SAM9RL_BASE_TSC,
- .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
- .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
- .flags = IORESOURCE_IRQ,
- }
-};
-
-static struct platform_device at91sam9rl_tsadcc_device = {
- .name = "atmel_tsadcc",
- .id = -1,
- .dev = {
- .dma_mask = &tsadcc_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &tsadcc_data,
- },
- .resource = tsadcc_resources,
- .num_resources = ARRAY_SIZE(tsadcc_resources),
-};
-
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
-{
- if (!data)
- return;
-
- at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */
- at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */
- at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */
- at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */
-
- tsadcc_data = *data;
- platform_device_register(&at91sam9rl_tsadcc_device);
-}
-#else
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
-#endif
-
-/* --------------------------------------------------------------------
* ADC and Touchscreen
* -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 35d420247e25..6ae90e312ce0 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -230,16 +230,6 @@ static struct gpio_led ek_leds[] = {
/*
- * Touchscreen
- */
-static struct at91_tsadcc_data ek_tsadcc_data = {
- .adc_clock = 1000000,
- .pendet_debounce = 0x0f,
- .ts_sample_hold_time = 0x03,
-};
-
-
-/*
* ADC + Touchscreen
*/
static struct at91_adc_data ek_adc_data = {
@@ -322,8 +312,6 @@ static void __init ek_board_init(void)
at91_add_device_lcdc(&ek_lcdc_data);
/* AC97 */
at91_add_device_ac97(&ek_ac97_data);
- /* Touch Screen Controller */
- at91_add_device_tsadcc(&ek_tsadcc_data);
/* Touch Screen Controller + ADC */
at91_add_device_adc(&ek_adc_data);
/* LEDs */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 11/15] ARM: at91: sam9rl: switch from atmel_tsadcc to at91_adc
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
atmel_tsadcc is not allowing to use the remaining ADC channels while at91_adc
does. Completely switch to at91_adc and remove the tsadcc platform_data for
at91sam9rl and at91sam9rl based boards.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/configs/at91sam9rl_defconfig | 3 +-
arch/arm/mach-at91/at91sam9rl_devices.c | 50 ---------------------------------
arch/arm/mach-at91/board-sam9rlek.c | 12 --------
3 files changed, 2 insertions(+), 63 deletions(-)
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index 85f846ae9ff2..5d7797d43d23 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -45,7 +45,6 @@ CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
# CONFIG_SERIO is not set
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
@@ -65,6 +64,8 @@ CONFIG_MMC=y
CONFIG_MMC_ATMELMCI=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_AT91SAM9=y
+CONFIG_IIO=y
+CONFIG_AT91_ADC=y
CONFIG_EXT2_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index b836dada942c..9ccae034119c 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -608,56 +608,6 @@ static void __init at91_add_device_tc(void) { }
/* --------------------------------------------------------------------
- * Touchscreen
- * -------------------------------------------------------------------- */
-
-#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE)
-static u64 tsadcc_dmamask = DMA_BIT_MASK(32);
-static struct at91_tsadcc_data tsadcc_data;
-
-static struct resource tsadcc_resources[] = {
- [0] = {
- .start = AT91SAM9RL_BASE_TSC,
- .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
- .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
- .flags = IORESOURCE_IRQ,
- }
-};
-
-static struct platform_device at91sam9rl_tsadcc_device = {
- .name = "atmel_tsadcc",
- .id = -1,
- .dev = {
- .dma_mask = &tsadcc_dmamask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- .platform_data = &tsadcc_data,
- },
- .resource = tsadcc_resources,
- .num_resources = ARRAY_SIZE(tsadcc_resources),
-};
-
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
-{
- if (!data)
- return;
-
- at91_set_A_periph(AT91_PIN_PA17, 0); /* AD0_XR */
- at91_set_A_periph(AT91_PIN_PA18, 0); /* AD1_XL */
- at91_set_A_periph(AT91_PIN_PA19, 0); /* AD2_YT */
- at91_set_A_periph(AT91_PIN_PA20, 0); /* AD3_TB */
-
- tsadcc_data = *data;
- platform_device_register(&at91sam9rl_tsadcc_device);
-}
-#else
-void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
-#endif
-
-/* --------------------------------------------------------------------
* ADC and Touchscreen
* -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 35d420247e25..6ae90e312ce0 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -230,16 +230,6 @@ static struct gpio_led ek_leds[] = {
/*
- * Touchscreen
- */
-static struct at91_tsadcc_data ek_tsadcc_data = {
- .adc_clock = 1000000,
- .pendet_debounce = 0x0f,
- .ts_sample_hold_time = 0x03,
-};
-
-
-/*
* ADC + Touchscreen
*/
static struct at91_adc_data ek_adc_data = {
@@ -322,8 +312,6 @@ static void __init ek_board_init(void)
at91_add_device_lcdc(&ek_lcdc_data);
/* AC97 */
at91_add_device_ac97(&ek_ac97_data);
- /* Touch Screen Controller */
- at91_add_device_tsadcc(&ek_tsadcc_data);
/* Touch Screen Controller + ADC */
at91_add_device_adc(&ek_adc_data);
/* LEDs */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/board.h | 3 ---
include/linux/platform_data/atmel.h | 7 -------
2 files changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 6c08b341167d..4e773b55bc2d 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -118,9 +118,6 @@ struct isi_platform_data;
extern void __init at91_add_device_isi(struct isi_platform_data *data,
bool use_pck_as_mck);
- /* Touchscreen Controller */
-extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
-
/* CAN */
extern void __init at91_add_device_can(struct at91_can_data *data);
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index cea9f70133c5..4b452c6a2f7b 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -86,13 +86,6 @@ struct atmel_uart_data {
struct serial_rs485 rs485; /* rs485 settings */
};
- /* Touchscreen Controller */
-struct at91_tsadcc_data {
- unsigned int adc_clock;
- u8 pendet_debounce;
- u8 ts_sample_hold_time;
-};
-
/* CAN */
struct at91_can_data {
void (*transceiver_switch)(int on);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement, Alexandre Belloni
Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
arch/arm/mach-at91/board.h | 3 ---
include/linux/platform_data/atmel.h | 7 -------
2 files changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 6c08b341167d..4e773b55bc2d 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -118,9 +118,6 @@ struct isi_platform_data;
extern void __init at91_add_device_isi(struct isi_platform_data *data,
bool use_pck_as_mck);
- /* Touchscreen Controller */
-extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
-
/* CAN */
extern void __init at91_add_device_can(struct at91_can_data *data);
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index cea9f70133c5..4b452c6a2f7b 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -86,13 +86,6 @@ struct atmel_uart_data {
struct serial_rs485 rs485; /* rs485 settings */
};
- /* Touchscreen Controller */
-struct at91_tsadcc_data {
- unsigned int adc_clock;
- u8 pendet_debounce;
- u8 ts_sample_hold_time;
-};
-
/* CAN */
struct at91_can_data {
void (*transceiver_switch)(int on);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/board.h | 3 ---
include/linux/platform_data/atmel.h | 7 -------
2 files changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 6c08b341167d..4e773b55bc2d 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -118,9 +118,6 @@ struct isi_platform_data;
extern void __init at91_add_device_isi(struct isi_platform_data *data,
bool use_pck_as_mck);
- /* Touchscreen Controller */
-extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
-
/* CAN */
extern void __init at91_add_device_can(struct at91_can_data *data);
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index cea9f70133c5..4b452c6a2f7b 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -86,13 +86,6 @@ struct atmel_uart_data {
struct serial_rs485 rs485; /* rs485 settings */
};
- /* Touchscreen Controller */
-struct at91_tsadcc_data {
- unsigned int adc_clock;
- u8 pendet_debounce;
- u8 ts_sample_hold_time;
-};
-
/* CAN */
struct at91_can_data {
void (*transceiver_switch)(int on);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 13/15] ARM: at91: remove atmel_tsadcc from sama5_defconfig
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:57 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
atmel_tsadcc has been removed, stop selecting it.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/configs/sama5_defconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index dc3881e07630..869fa18ebeb2 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -122,7 +122,6 @@ CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ATMEL_MXT=y
-CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
# CONFIG_SERIO is not set
CONFIG_LEGACY_PTY_COUNT=4
CONFIG_SERIAL_ATMEL=y
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 13/15] ARM: at91: remove atmel_tsadcc from sama5_defconfig
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
atmel_tsadcc has been removed, stop selecting it.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/configs/sama5_defconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index dc3881e07630..869fa18ebeb2 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -122,7 +122,6 @@ CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_ATMEL_MXT=y
-CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
# CONFIG_SERIO is not set
CONFIG_LEGACY_PTY_COUNT=4
CONFIG_SERIAL_ATMEL=y
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 14/15] Input: atmel_tsadcc: remove driver
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:57 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni
The atmel_tsadcc driver is not used anymore, it has been replaced by at91_adc so
remove it.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
MAINTAINERS | 6 -
drivers/input/touchscreen/Kconfig | 12 --
drivers/input/touchscreen/Makefile | 1 -
drivers/input/touchscreen/atmel_tsadcc.c | 358 -------------------------------
4 files changed, 377 deletions(-)
delete mode 100644 drivers/input/touchscreen/atmel_tsadcc.c
diff --git a/MAINTAINERS b/MAINTAINERS
index c6d0e93eff62..134dd63dfa17 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1591,12 +1591,6 @@ S: Supported
F: drivers/misc/atmel_tclib.c
F: drivers/clocksource/tcb_clksrc.c
-ATMEL TSADCC DRIVER
-M: Josh Wu <josh.wu@atmel.com>
-L: linux-input@vger.kernel.org
-S: Supported
-F: drivers/input/touchscreen/atmel_tsadcc.c
-
ATMEL USBA UDC DRIVER
M: Nicolas Ferre <nicolas.ferre@atmel.com>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 07e9e82029d1..4090f69e78af 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -559,18 +559,6 @@ config TOUCHSCREEN_TI_AM335X_TSC
To compile this driver as a module, choose M here: the
module will be called ti_am335x_tsc.
-config TOUCHSCREEN_ATMEL_TSADCC
- tristate "Atmel Touchscreen Interface"
- depends on ARCH_AT91
- help
- Say Y here if you have a 4-wire touchscreen connected to the
- ADC Controller on your Atmel SoC.
-
- If unsure, say N.
-
- To compile this driver as a module, choose M here: the
- module will be called atmel_tsadcc.
-
config TOUCHSCREEN_UCB1400
tristate "Philips UCB1400 touchscreen"
depends on AC97_BUS
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 62801f213346..f326a8290593 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_TOUCHSCREEN_AD7879_I2C) += ad7879-i2c.o
obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o
obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o
-obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o
obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o
obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o
obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c
deleted file mode 100644
index a7c9d6967d1e..000000000000
--- a/drivers/input/touchscreen/atmel_tsadcc.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Atmel Touch Screen Driver
- *
- * Copyright (c) 2008 ATMEL
- * Copyright (c) 2008 Dan Liang
- * Copyright (c) 2008 TimeSys Corporation
- * Copyright (c) 2008 Justin Waters
- *
- * Based on touchscreen code from Atmel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/err.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/input.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/platform_data/atmel.h>
-#include <mach/cpu.h>
-
-/* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */
-
-#define ATMEL_TSADCC_CR 0x00 /* Control register */
-#define ATMEL_TSADCC_SWRST (1 << 0) /* Software Reset*/
-#define ATMEL_TSADCC_START (1 << 1) /* Start conversion */
-
-#define ATMEL_TSADCC_MR 0x04 /* Mode register */
-#define ATMEL_TSADCC_TSAMOD (3 << 0) /* ADC mode */
-#define ATMEL_TSADCC_TSAMOD_ADC_ONLY_MODE (0x0) /* ADC Mode */
-#define ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE (0x1) /* Touch Screen Only Mode */
-#define ATMEL_TSADCC_LOWRES (1 << 4) /* Resolution selection */
-#define ATMEL_TSADCC_SLEEP (1 << 5) /* Sleep mode */
-#define ATMEL_TSADCC_PENDET (1 << 6) /* Pen Detect selection */
-#define ATMEL_TSADCC_PRES (1 << 7) /* Pressure Measurement Selection */
-#define ATMEL_TSADCC_PRESCAL (0x3f << 8) /* Prescalar Rate Selection */
-#define ATMEL_TSADCC_EPRESCAL (0xff << 8) /* Prescalar Rate Selection (Extended) */
-#define ATMEL_TSADCC_STARTUP (0x7f << 16) /* Start Up time */
-#define ATMEL_TSADCC_SHTIM (0xf << 24) /* Sample & Hold time */
-#define ATMEL_TSADCC_PENDBC (0xf << 28) /* Pen Detect debouncing time */
-
-#define ATMEL_TSADCC_TRGR 0x08 /* Trigger register */
-#define ATMEL_TSADCC_TRGMOD (7 << 0) /* Trigger mode */
-#define ATMEL_TSADCC_TRGMOD_NONE (0 << 0)
-#define ATMEL_TSADCC_TRGMOD_EXT_RISING (1 << 0)
-#define ATMEL_TSADCC_TRGMOD_EXT_FALLING (2 << 0)
-#define ATMEL_TSADCC_TRGMOD_EXT_ANY (3 << 0)
-#define ATMEL_TSADCC_TRGMOD_PENDET (4 << 0)
-#define ATMEL_TSADCC_TRGMOD_PERIOD (5 << 0)
-#define ATMEL_TSADCC_TRGMOD_CONTINUOUS (6 << 0)
-#define ATMEL_TSADCC_TRGPER (0xffff << 16) /* Trigger period */
-
-#define ATMEL_TSADCC_TSR 0x0C /* Touch Screen register */
-#define ATMEL_TSADCC_TSFREQ (0xf << 0) /* TS Frequency in Interleaved mode */
-#define ATMEL_TSADCC_TSSHTIM (0xf << 24) /* Sample & Hold time */
-
-#define ATMEL_TSADCC_CHER 0x10 /* Channel Enable register */
-#define ATMEL_TSADCC_CHDR 0x14 /* Channel Disable register */
-#define ATMEL_TSADCC_CHSR 0x18 /* Channel Status register */
-#define ATMEL_TSADCC_CH(n) (1 << (n)) /* Channel number */
-
-#define ATMEL_TSADCC_SR 0x1C /* Status register */
-#define ATMEL_TSADCC_EOC(n) (1 << ((n)+0)) /* End of conversion for channel N */
-#define ATMEL_TSADCC_OVRE(n) (1 << ((n)+8)) /* Overrun error for channel N */
-#define ATMEL_TSADCC_DRDY (1 << 16) /* Data Ready */
-#define ATMEL_TSADCC_GOVRE (1 << 17) /* General Overrun Error */
-#define ATMEL_TSADCC_ENDRX (1 << 18) /* End of RX Buffer */
-#define ATMEL_TSADCC_RXBUFF (1 << 19) /* TX Buffer full */
-#define ATMEL_TSADCC_PENCNT (1 << 20) /* Pen contact */
-#define ATMEL_TSADCC_NOCNT (1 << 21) /* No contact */
-
-#define ATMEL_TSADCC_LCDR 0x20 /* Last Converted Data register */
-#define ATMEL_TSADCC_DATA (0x3ff << 0) /* Channel data */
-
-#define ATMEL_TSADCC_IER 0x24 /* Interrupt Enable register */
-#define ATMEL_TSADCC_IDR 0x28 /* Interrupt Disable register */
-#define ATMEL_TSADCC_IMR 0x2C /* Interrupt Mask register */
-#define ATMEL_TSADCC_CDR0 0x30 /* Channel Data 0 */
-#define ATMEL_TSADCC_CDR1 0x34 /* Channel Data 1 */
-#define ATMEL_TSADCC_CDR2 0x38 /* Channel Data 2 */
-#define ATMEL_TSADCC_CDR3 0x3C /* Channel Data 3 */
-#define ATMEL_TSADCC_CDR4 0x40 /* Channel Data 4 */
-#define ATMEL_TSADCC_CDR5 0x44 /* Channel Data 5 */
-
-#define ATMEL_TSADCC_XPOS 0x50
-#define ATMEL_TSADCC_Z1DAT 0x54
-#define ATMEL_TSADCC_Z2DAT 0x58
-
-#define PRESCALER_VAL(x) ((x) >> 8)
-
-#define ADC_DEFAULT_CLOCK 100000
-
-struct atmel_tsadcc {
- struct input_dev *input;
- char phys[32];
- struct clk *clk;
- int irq;
- unsigned int prev_absx;
- unsigned int prev_absy;
- unsigned char bufferedmeasure;
-};
-
-static void __iomem *tsc_base;
-
-#define atmel_tsadcc_read(reg) __raw_readl(tsc_base + (reg))
-#define atmel_tsadcc_write(reg, val) __raw_writel((val), tsc_base + (reg))
-
-static irqreturn_t atmel_tsadcc_interrupt(int irq, void *dev)
-{
- struct atmel_tsadcc *ts_dev = (struct atmel_tsadcc *)dev;
- struct input_dev *input_dev = ts_dev->input;
-
- unsigned int status;
- unsigned int reg;
-
- status = atmel_tsadcc_read(ATMEL_TSADCC_SR);
- status &= atmel_tsadcc_read(ATMEL_TSADCC_IMR);
-
- if (status & ATMEL_TSADCC_NOCNT) {
- /* Contact lost */
- reg = atmel_tsadcc_read(ATMEL_TSADCC_MR) | ATMEL_TSADCC_PENDBC;
-
- atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
- atmel_tsadcc_write(ATMEL_TSADCC_TRGR, ATMEL_TSADCC_TRGMOD_NONE);
- atmel_tsadcc_write(ATMEL_TSADCC_IDR,
- ATMEL_TSADCC_EOC(3) | ATMEL_TSADCC_NOCNT);
- atmel_tsadcc_write(ATMEL_TSADCC_IER, ATMEL_TSADCC_PENCNT);
-
- input_report_key(input_dev, BTN_TOUCH, 0);
- ts_dev->bufferedmeasure = 0;
- input_sync(input_dev);
-
- } else if (status & ATMEL_TSADCC_PENCNT) {
- /* Pen detected */
- reg = atmel_tsadcc_read(ATMEL_TSADCC_MR);
- reg &= ~ATMEL_TSADCC_PENDBC;
-
- atmel_tsadcc_write(ATMEL_TSADCC_IDR, ATMEL_TSADCC_PENCNT);
- atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
- atmel_tsadcc_write(ATMEL_TSADCC_IER,
- ATMEL_TSADCC_EOC(3) | ATMEL_TSADCC_NOCNT);
- atmel_tsadcc_write(ATMEL_TSADCC_TRGR,
- ATMEL_TSADCC_TRGMOD_PERIOD | (0x0FFF << 16));
-
- } else if (status & ATMEL_TSADCC_EOC(3)) {
- /* Conversion finished */
-
- if (ts_dev->bufferedmeasure) {
- /* Last measurement is always discarded, since it can
- * be erroneous.
- * Always report previous measurement */
- input_report_abs(input_dev, ABS_X, ts_dev->prev_absx);
- input_report_abs(input_dev, ABS_Y, ts_dev->prev_absy);
- input_report_key(input_dev, BTN_TOUCH, 1);
- input_sync(input_dev);
- } else
- ts_dev->bufferedmeasure = 1;
-
- /* Now make new measurement */
- ts_dev->prev_absx = atmel_tsadcc_read(ATMEL_TSADCC_CDR3) << 10;
- ts_dev->prev_absx /= atmel_tsadcc_read(ATMEL_TSADCC_CDR2);
-
- ts_dev->prev_absy = atmel_tsadcc_read(ATMEL_TSADCC_CDR1) << 10;
- ts_dev->prev_absy /= atmel_tsadcc_read(ATMEL_TSADCC_CDR0);
- }
-
- return IRQ_HANDLED;
-}
-
-/*
- * The functions for inserting/removing us as a module.
- */
-
-static int atmel_tsadcc_probe(struct platform_device *pdev)
-{
- struct atmel_tsadcc *ts_dev;
- struct input_dev *input_dev;
- struct resource *res;
- struct at91_tsadcc_data *pdata = dev_get_platdata(&pdev->dev);
- int err;
- unsigned int prsc;
- unsigned int reg;
-
- if (!pdata)
- return -EINVAL;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no mmio resource defined.\n");
- return -ENXIO;
- }
-
- /* Allocate memory for device */
- ts_dev = kzalloc(sizeof(struct atmel_tsadcc), GFP_KERNEL);
- if (!ts_dev) {
- dev_err(&pdev->dev, "failed to allocate memory.\n");
- return -ENOMEM;
- }
- platform_set_drvdata(pdev, ts_dev);
-
- input_dev = input_allocate_device();
- if (!input_dev) {
- dev_err(&pdev->dev, "failed to allocate input device.\n");
- err = -EBUSY;
- goto err_free_mem;
- }
-
- ts_dev->irq = platform_get_irq(pdev, 0);
- if (ts_dev->irq < 0) {
- dev_err(&pdev->dev, "no irq ID is designated.\n");
- err = -ENODEV;
- goto err_free_dev;
- }
-
- if (!request_mem_region(res->start, resource_size(res),
- "atmel tsadcc regs")) {
- dev_err(&pdev->dev, "resources is unavailable.\n");
- err = -EBUSY;
- goto err_free_dev;
- }
-
- tsc_base = ioremap(res->start, resource_size(res));
- if (!tsc_base) {
- dev_err(&pdev->dev, "failed to map registers.\n");
- err = -ENOMEM;
- goto err_release_mem;
- }
-
- err = request_irq(ts_dev->irq, atmel_tsadcc_interrupt, 0,
- pdev->dev.driver->name, ts_dev);
- if (err) {
- dev_err(&pdev->dev, "failed to allocate irq.\n");
- goto err_unmap_regs;
- }
-
- ts_dev->clk = clk_get(&pdev->dev, "tsc_clk");
- if (IS_ERR(ts_dev->clk)) {
- dev_err(&pdev->dev, "failed to get ts_clk\n");
- err = PTR_ERR(ts_dev->clk);
- goto err_free_irq;
- }
-
- ts_dev->input = input_dev;
- ts_dev->bufferedmeasure = 0;
-
- snprintf(ts_dev->phys, sizeof(ts_dev->phys),
- "%s/input0", dev_name(&pdev->dev));
-
- input_dev->name = "atmel touch screen controller";
- input_dev->phys = ts_dev->phys;
- input_dev->dev.parent = &pdev->dev;
-
- __set_bit(EV_ABS, input_dev->evbit);
- input_set_abs_params(input_dev, ABS_X, 0, 0x3FF, 0, 0);
- input_set_abs_params(input_dev, ABS_Y, 0, 0x3FF, 0, 0);
-
- input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
-
- /* clk_enable() always returns 0, no need to check it */
- clk_enable(ts_dev->clk);
-
- prsc = clk_get_rate(ts_dev->clk);
- dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc);
-
- if (!pdata->adc_clock)
- pdata->adc_clock = ADC_DEFAULT_CLOCK;
-
- prsc = (prsc / (2 * pdata->adc_clock)) - 1;
-
- /* saturate if this value is too high */
- if (cpu_is_at91sam9rl()) {
- if (prsc > PRESCALER_VAL(ATMEL_TSADCC_PRESCAL))
- prsc = PRESCALER_VAL(ATMEL_TSADCC_PRESCAL);
- } else {
- if (prsc > PRESCALER_VAL(ATMEL_TSADCC_EPRESCAL))
- prsc = PRESCALER_VAL(ATMEL_TSADCC_EPRESCAL);
- }
-
- dev_info(&pdev->dev, "Prescaler is set at: %d\n", prsc);
-
- reg = ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE |
- ((0x00 << 5) & ATMEL_TSADCC_SLEEP) | /* Normal Mode */
- ((0x01 << 6) & ATMEL_TSADCC_PENDET) | /* Enable Pen Detect */
- (prsc << 8) |
- ((0x26 << 16) & ATMEL_TSADCC_STARTUP) |
- ((pdata->pendet_debounce << 28) & ATMEL_TSADCC_PENDBC);
-
- atmel_tsadcc_write(ATMEL_TSADCC_CR, ATMEL_TSADCC_SWRST);
- atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
- atmel_tsadcc_write(ATMEL_TSADCC_TRGR, ATMEL_TSADCC_TRGMOD_NONE);
- atmel_tsadcc_write(ATMEL_TSADCC_TSR,
- (pdata->ts_sample_hold_time << 24) & ATMEL_TSADCC_TSSHTIM);
-
- atmel_tsadcc_read(ATMEL_TSADCC_SR);
- atmel_tsadcc_write(ATMEL_TSADCC_IER, ATMEL_TSADCC_PENCNT);
-
- /* All went ok, so register to the input system */
- err = input_register_device(input_dev);
- if (err)
- goto err_fail;
-
- return 0;
-
-err_fail:
- clk_disable(ts_dev->clk);
- clk_put(ts_dev->clk);
-err_free_irq:
- free_irq(ts_dev->irq, ts_dev);
-err_unmap_regs:
- iounmap(tsc_base);
-err_release_mem:
- release_mem_region(res->start, resource_size(res));
-err_free_dev:
- input_free_device(input_dev);
-err_free_mem:
- kfree(ts_dev);
- return err;
-}
-
-static int atmel_tsadcc_remove(struct platform_device *pdev)
-{
- struct atmel_tsadcc *ts_dev = platform_get_drvdata(pdev);
- struct resource *res;
-
- free_irq(ts_dev->irq, ts_dev);
-
- input_unregister_device(ts_dev->input);
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- iounmap(tsc_base);
- release_mem_region(res->start, resource_size(res));
-
- clk_disable(ts_dev->clk);
- clk_put(ts_dev->clk);
-
- kfree(ts_dev);
-
- return 0;
-}
-
-static struct platform_driver atmel_tsadcc_driver = {
- .probe = atmel_tsadcc_probe,
- .remove = atmel_tsadcc_remove,
- .driver = {
- .name = "atmel_tsadcc",
- },
-};
-module_platform_driver(atmel_tsadcc_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Atmel TouchScreen Driver");
-MODULE_AUTHOR("Dan Liang <dan.liang@atmel.com>");
-
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 14/15] Input: atmel_tsadcc: remove driver
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
The atmel_tsadcc driver is not used anymore, it has been replaced by at91_adc so
remove it.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
MAINTAINERS | 6 -
drivers/input/touchscreen/Kconfig | 12 --
drivers/input/touchscreen/Makefile | 1 -
drivers/input/touchscreen/atmel_tsadcc.c | 358 -------------------------------
4 files changed, 377 deletions(-)
delete mode 100644 drivers/input/touchscreen/atmel_tsadcc.c
diff --git a/MAINTAINERS b/MAINTAINERS
index c6d0e93eff62..134dd63dfa17 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1591,12 +1591,6 @@ S: Supported
F: drivers/misc/atmel_tclib.c
F: drivers/clocksource/tcb_clksrc.c
-ATMEL TSADCC DRIVER
-M: Josh Wu <josh.wu@atmel.com>
-L: linux-input at vger.kernel.org
-S: Supported
-F: drivers/input/touchscreen/atmel_tsadcc.c
-
ATMEL USBA UDC DRIVER
M: Nicolas Ferre <nicolas.ferre@atmel.com>
L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 07e9e82029d1..4090f69e78af 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -559,18 +559,6 @@ config TOUCHSCREEN_TI_AM335X_TSC
To compile this driver as a module, choose M here: the
module will be called ti_am335x_tsc.
-config TOUCHSCREEN_ATMEL_TSADCC
- tristate "Atmel Touchscreen Interface"
- depends on ARCH_AT91
- help
- Say Y here if you have a 4-wire touchscreen connected to the
- ADC Controller on your Atmel SoC.
-
- If unsure, say N.
-
- To compile this driver as a module, choose M here: the
- module will be called atmel_tsadcc.
-
config TOUCHSCREEN_UCB1400
tristate "Philips UCB1400 touchscreen"
depends on AC97_BUS
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 62801f213346..f326a8290593 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_TOUCHSCREEN_AD7879_I2C) += ad7879-i2c.o
obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o
obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o
-obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o
obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o
obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o
obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c
deleted file mode 100644
index a7c9d6967d1e..000000000000
--- a/drivers/input/touchscreen/atmel_tsadcc.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Atmel Touch Screen Driver
- *
- * Copyright (c) 2008 ATMEL
- * Copyright (c) 2008 Dan Liang
- * Copyright (c) 2008 TimeSys Corporation
- * Copyright (c) 2008 Justin Waters
- *
- * Based on touchscreen code from Atmel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/err.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/input.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/clk.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/platform_data/atmel.h>
-#include <mach/cpu.h>
-
-/* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */
-
-#define ATMEL_TSADCC_CR 0x00 /* Control register */
-#define ATMEL_TSADCC_SWRST (1 << 0) /* Software Reset*/
-#define ATMEL_TSADCC_START (1 << 1) /* Start conversion */
-
-#define ATMEL_TSADCC_MR 0x04 /* Mode register */
-#define ATMEL_TSADCC_TSAMOD (3 << 0) /* ADC mode */
-#define ATMEL_TSADCC_TSAMOD_ADC_ONLY_MODE (0x0) /* ADC Mode */
-#define ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE (0x1) /* Touch Screen Only Mode */
-#define ATMEL_TSADCC_LOWRES (1 << 4) /* Resolution selection */
-#define ATMEL_TSADCC_SLEEP (1 << 5) /* Sleep mode */
-#define ATMEL_TSADCC_PENDET (1 << 6) /* Pen Detect selection */
-#define ATMEL_TSADCC_PRES (1 << 7) /* Pressure Measurement Selection */
-#define ATMEL_TSADCC_PRESCAL (0x3f << 8) /* Prescalar Rate Selection */
-#define ATMEL_TSADCC_EPRESCAL (0xff << 8) /* Prescalar Rate Selection (Extended) */
-#define ATMEL_TSADCC_STARTUP (0x7f << 16) /* Start Up time */
-#define ATMEL_TSADCC_SHTIM (0xf << 24) /* Sample & Hold time */
-#define ATMEL_TSADCC_PENDBC (0xf << 28) /* Pen Detect debouncing time */
-
-#define ATMEL_TSADCC_TRGR 0x08 /* Trigger register */
-#define ATMEL_TSADCC_TRGMOD (7 << 0) /* Trigger mode */
-#define ATMEL_TSADCC_TRGMOD_NONE (0 << 0)
-#define ATMEL_TSADCC_TRGMOD_EXT_RISING (1 << 0)
-#define ATMEL_TSADCC_TRGMOD_EXT_FALLING (2 << 0)
-#define ATMEL_TSADCC_TRGMOD_EXT_ANY (3 << 0)
-#define ATMEL_TSADCC_TRGMOD_PENDET (4 << 0)
-#define ATMEL_TSADCC_TRGMOD_PERIOD (5 << 0)
-#define ATMEL_TSADCC_TRGMOD_CONTINUOUS (6 << 0)
-#define ATMEL_TSADCC_TRGPER (0xffff << 16) /* Trigger period */
-
-#define ATMEL_TSADCC_TSR 0x0C /* Touch Screen register */
-#define ATMEL_TSADCC_TSFREQ (0xf << 0) /* TS Frequency in Interleaved mode */
-#define ATMEL_TSADCC_TSSHTIM (0xf << 24) /* Sample & Hold time */
-
-#define ATMEL_TSADCC_CHER 0x10 /* Channel Enable register */
-#define ATMEL_TSADCC_CHDR 0x14 /* Channel Disable register */
-#define ATMEL_TSADCC_CHSR 0x18 /* Channel Status register */
-#define ATMEL_TSADCC_CH(n) (1 << (n)) /* Channel number */
-
-#define ATMEL_TSADCC_SR 0x1C /* Status register */
-#define ATMEL_TSADCC_EOC(n) (1 << ((n)+0)) /* End of conversion for channel N */
-#define ATMEL_TSADCC_OVRE(n) (1 << ((n)+8)) /* Overrun error for channel N */
-#define ATMEL_TSADCC_DRDY (1 << 16) /* Data Ready */
-#define ATMEL_TSADCC_GOVRE (1 << 17) /* General Overrun Error */
-#define ATMEL_TSADCC_ENDRX (1 << 18) /* End of RX Buffer */
-#define ATMEL_TSADCC_RXBUFF (1 << 19) /* TX Buffer full */
-#define ATMEL_TSADCC_PENCNT (1 << 20) /* Pen contact */
-#define ATMEL_TSADCC_NOCNT (1 << 21) /* No contact */
-
-#define ATMEL_TSADCC_LCDR 0x20 /* Last Converted Data register */
-#define ATMEL_TSADCC_DATA (0x3ff << 0) /* Channel data */
-
-#define ATMEL_TSADCC_IER 0x24 /* Interrupt Enable register */
-#define ATMEL_TSADCC_IDR 0x28 /* Interrupt Disable register */
-#define ATMEL_TSADCC_IMR 0x2C /* Interrupt Mask register */
-#define ATMEL_TSADCC_CDR0 0x30 /* Channel Data 0 */
-#define ATMEL_TSADCC_CDR1 0x34 /* Channel Data 1 */
-#define ATMEL_TSADCC_CDR2 0x38 /* Channel Data 2 */
-#define ATMEL_TSADCC_CDR3 0x3C /* Channel Data 3 */
-#define ATMEL_TSADCC_CDR4 0x40 /* Channel Data 4 */
-#define ATMEL_TSADCC_CDR5 0x44 /* Channel Data 5 */
-
-#define ATMEL_TSADCC_XPOS 0x50
-#define ATMEL_TSADCC_Z1DAT 0x54
-#define ATMEL_TSADCC_Z2DAT 0x58
-
-#define PRESCALER_VAL(x) ((x) >> 8)
-
-#define ADC_DEFAULT_CLOCK 100000
-
-struct atmel_tsadcc {
- struct input_dev *input;
- char phys[32];
- struct clk *clk;
- int irq;
- unsigned int prev_absx;
- unsigned int prev_absy;
- unsigned char bufferedmeasure;
-};
-
-static void __iomem *tsc_base;
-
-#define atmel_tsadcc_read(reg) __raw_readl(tsc_base + (reg))
-#define atmel_tsadcc_write(reg, val) __raw_writel((val), tsc_base + (reg))
-
-static irqreturn_t atmel_tsadcc_interrupt(int irq, void *dev)
-{
- struct atmel_tsadcc *ts_dev = (struct atmel_tsadcc *)dev;
- struct input_dev *input_dev = ts_dev->input;
-
- unsigned int status;
- unsigned int reg;
-
- status = atmel_tsadcc_read(ATMEL_TSADCC_SR);
- status &= atmel_tsadcc_read(ATMEL_TSADCC_IMR);
-
- if (status & ATMEL_TSADCC_NOCNT) {
- /* Contact lost */
- reg = atmel_tsadcc_read(ATMEL_TSADCC_MR) | ATMEL_TSADCC_PENDBC;
-
- atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
- atmel_tsadcc_write(ATMEL_TSADCC_TRGR, ATMEL_TSADCC_TRGMOD_NONE);
- atmel_tsadcc_write(ATMEL_TSADCC_IDR,
- ATMEL_TSADCC_EOC(3) | ATMEL_TSADCC_NOCNT);
- atmel_tsadcc_write(ATMEL_TSADCC_IER, ATMEL_TSADCC_PENCNT);
-
- input_report_key(input_dev, BTN_TOUCH, 0);
- ts_dev->bufferedmeasure = 0;
- input_sync(input_dev);
-
- } else if (status & ATMEL_TSADCC_PENCNT) {
- /* Pen detected */
- reg = atmel_tsadcc_read(ATMEL_TSADCC_MR);
- reg &= ~ATMEL_TSADCC_PENDBC;
-
- atmel_tsadcc_write(ATMEL_TSADCC_IDR, ATMEL_TSADCC_PENCNT);
- atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
- atmel_tsadcc_write(ATMEL_TSADCC_IER,
- ATMEL_TSADCC_EOC(3) | ATMEL_TSADCC_NOCNT);
- atmel_tsadcc_write(ATMEL_TSADCC_TRGR,
- ATMEL_TSADCC_TRGMOD_PERIOD | (0x0FFF << 16));
-
- } else if (status & ATMEL_TSADCC_EOC(3)) {
- /* Conversion finished */
-
- if (ts_dev->bufferedmeasure) {
- /* Last measurement is always discarded, since it can
- * be erroneous.
- * Always report previous measurement */
- input_report_abs(input_dev, ABS_X, ts_dev->prev_absx);
- input_report_abs(input_dev, ABS_Y, ts_dev->prev_absy);
- input_report_key(input_dev, BTN_TOUCH, 1);
- input_sync(input_dev);
- } else
- ts_dev->bufferedmeasure = 1;
-
- /* Now make new measurement */
- ts_dev->prev_absx = atmel_tsadcc_read(ATMEL_TSADCC_CDR3) << 10;
- ts_dev->prev_absx /= atmel_tsadcc_read(ATMEL_TSADCC_CDR2);
-
- ts_dev->prev_absy = atmel_tsadcc_read(ATMEL_TSADCC_CDR1) << 10;
- ts_dev->prev_absy /= atmel_tsadcc_read(ATMEL_TSADCC_CDR0);
- }
-
- return IRQ_HANDLED;
-}
-
-/*
- * The functions for inserting/removing us as a module.
- */
-
-static int atmel_tsadcc_probe(struct platform_device *pdev)
-{
- struct atmel_tsadcc *ts_dev;
- struct input_dev *input_dev;
- struct resource *res;
- struct at91_tsadcc_data *pdata = dev_get_platdata(&pdev->dev);
- int err;
- unsigned int prsc;
- unsigned int reg;
-
- if (!pdata)
- return -EINVAL;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no mmio resource defined.\n");
- return -ENXIO;
- }
-
- /* Allocate memory for device */
- ts_dev = kzalloc(sizeof(struct atmel_tsadcc), GFP_KERNEL);
- if (!ts_dev) {
- dev_err(&pdev->dev, "failed to allocate memory.\n");
- return -ENOMEM;
- }
- platform_set_drvdata(pdev, ts_dev);
-
- input_dev = input_allocate_device();
- if (!input_dev) {
- dev_err(&pdev->dev, "failed to allocate input device.\n");
- err = -EBUSY;
- goto err_free_mem;
- }
-
- ts_dev->irq = platform_get_irq(pdev, 0);
- if (ts_dev->irq < 0) {
- dev_err(&pdev->dev, "no irq ID is designated.\n");
- err = -ENODEV;
- goto err_free_dev;
- }
-
- if (!request_mem_region(res->start, resource_size(res),
- "atmel tsadcc regs")) {
- dev_err(&pdev->dev, "resources is unavailable.\n");
- err = -EBUSY;
- goto err_free_dev;
- }
-
- tsc_base = ioremap(res->start, resource_size(res));
- if (!tsc_base) {
- dev_err(&pdev->dev, "failed to map registers.\n");
- err = -ENOMEM;
- goto err_release_mem;
- }
-
- err = request_irq(ts_dev->irq, atmel_tsadcc_interrupt, 0,
- pdev->dev.driver->name, ts_dev);
- if (err) {
- dev_err(&pdev->dev, "failed to allocate irq.\n");
- goto err_unmap_regs;
- }
-
- ts_dev->clk = clk_get(&pdev->dev, "tsc_clk");
- if (IS_ERR(ts_dev->clk)) {
- dev_err(&pdev->dev, "failed to get ts_clk\n");
- err = PTR_ERR(ts_dev->clk);
- goto err_free_irq;
- }
-
- ts_dev->input = input_dev;
- ts_dev->bufferedmeasure = 0;
-
- snprintf(ts_dev->phys, sizeof(ts_dev->phys),
- "%s/input0", dev_name(&pdev->dev));
-
- input_dev->name = "atmel touch screen controller";
- input_dev->phys = ts_dev->phys;
- input_dev->dev.parent = &pdev->dev;
-
- __set_bit(EV_ABS, input_dev->evbit);
- input_set_abs_params(input_dev, ABS_X, 0, 0x3FF, 0, 0);
- input_set_abs_params(input_dev, ABS_Y, 0, 0x3FF, 0, 0);
-
- input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
-
- /* clk_enable() always returns 0, no need to check it */
- clk_enable(ts_dev->clk);
-
- prsc = clk_get_rate(ts_dev->clk);
- dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc);
-
- if (!pdata->adc_clock)
- pdata->adc_clock = ADC_DEFAULT_CLOCK;
-
- prsc = (prsc / (2 * pdata->adc_clock)) - 1;
-
- /* saturate if this value is too high */
- if (cpu_is_at91sam9rl()) {
- if (prsc > PRESCALER_VAL(ATMEL_TSADCC_PRESCAL))
- prsc = PRESCALER_VAL(ATMEL_TSADCC_PRESCAL);
- } else {
- if (prsc > PRESCALER_VAL(ATMEL_TSADCC_EPRESCAL))
- prsc = PRESCALER_VAL(ATMEL_TSADCC_EPRESCAL);
- }
-
- dev_info(&pdev->dev, "Prescaler is set at: %d\n", prsc);
-
- reg = ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE |
- ((0x00 << 5) & ATMEL_TSADCC_SLEEP) | /* Normal Mode */
- ((0x01 << 6) & ATMEL_TSADCC_PENDET) | /* Enable Pen Detect */
- (prsc << 8) |
- ((0x26 << 16) & ATMEL_TSADCC_STARTUP) |
- ((pdata->pendet_debounce << 28) & ATMEL_TSADCC_PENDBC);
-
- atmel_tsadcc_write(ATMEL_TSADCC_CR, ATMEL_TSADCC_SWRST);
- atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
- atmel_tsadcc_write(ATMEL_TSADCC_TRGR, ATMEL_TSADCC_TRGMOD_NONE);
- atmel_tsadcc_write(ATMEL_TSADCC_TSR,
- (pdata->ts_sample_hold_time << 24) & ATMEL_TSADCC_TSSHTIM);
-
- atmel_tsadcc_read(ATMEL_TSADCC_SR);
- atmel_tsadcc_write(ATMEL_TSADCC_IER, ATMEL_TSADCC_PENCNT);
-
- /* All went ok, so register to the input system */
- err = input_register_device(input_dev);
- if (err)
- goto err_fail;
-
- return 0;
-
-err_fail:
- clk_disable(ts_dev->clk);
- clk_put(ts_dev->clk);
-err_free_irq:
- free_irq(ts_dev->irq, ts_dev);
-err_unmap_regs:
- iounmap(tsc_base);
-err_release_mem:
- release_mem_region(res->start, resource_size(res));
-err_free_dev:
- input_free_device(input_dev);
-err_free_mem:
- kfree(ts_dev);
- return err;
-}
-
-static int atmel_tsadcc_remove(struct platform_device *pdev)
-{
- struct atmel_tsadcc *ts_dev = platform_get_drvdata(pdev);
- struct resource *res;
-
- free_irq(ts_dev->irq, ts_dev);
-
- input_unregister_device(ts_dev->input);
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- iounmap(tsc_base);
- release_mem_region(res->start, resource_size(res));
-
- clk_disable(ts_dev->clk);
- clk_put(ts_dev->clk);
-
- kfree(ts_dev);
-
- return 0;
-}
-
-static struct platform_driver atmel_tsadcc_driver = {
- .probe = atmel_tsadcc_probe,
- .remove = atmel_tsadcc_remove,
- .driver = {
- .name = "atmel_tsadcc",
- },
-};
-module_platform_driver(atmel_tsadcc_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Atmel TouchScreen Driver");
-MODULE_AUTHOR("Dan Liang <dan.liang@atmel.com>");
-
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-17 13:57 ` Alexandre Belloni
-1 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement,
Alexandre Belloni, Rodolfo Giometti
The tsadcc node is useless as it doesn't refer to anything and the touchscreen
is handled by the adc0 node.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Rodolfo Giometti <giometti@linux.it>
---
arch/arm/boot/dts/at91-cosino_mega2560.dts | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/arm/boot/dts/at91-cosino_mega2560.dts b/arch/arm/boot/dts/at91-cosino_mega2560.dts
index f9415dd11f17..cce621239b72 100644
--- a/arch/arm/boot/dts/at91-cosino_mega2560.dts
+++ b/arch/arm/boot/dts/at91-cosino_mega2560.dts
@@ -33,11 +33,6 @@
status = "okay";
};
-
- tsadcc: tsadcc@f804c000 {
- status = "okay";
- };
-
rtc@fffffeb0 {
status = "okay";
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node
@ 2014-03-17 13:57 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-17 13:57 UTC (permalink / raw)
To: linux-arm-kernel
The tsadcc node is useless as it doesn't refer to anything and the touchscreen
is handled by the adc0 node.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Rodolfo Giometti <giometti@linux.it>
---
arch/arm/boot/dts/at91-cosino_mega2560.dts | 5 -----
1 file changed, 5 deletions(-)
diff --git a/arch/arm/boot/dts/at91-cosino_mega2560.dts b/arch/arm/boot/dts/at91-cosino_mega2560.dts
index f9415dd11f17..cce621239b72 100644
--- a/arch/arm/boot/dts/at91-cosino_mega2560.dts
+++ b/arch/arm/boot/dts/at91-cosino_mega2560.dts
@@ -33,11 +33,6 @@
status = "okay";
};
-
- tsadcc: tsadcc at f804c000 {
- status = "okay";
- };
-
rtc at fffffeb0 {
status = "okay";
};
--
1.8.3.2
^ permalink raw reply related [flat|nested] 60+ messages in thread
* Re: [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node
@ 2014-03-17 14:00 ` Rodolfo Giometti
0 siblings, 0 replies; 60+ messages in thread
From: Rodolfo Giometti @ 2014-03-17 14:00 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov,
Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On Mon, Mar 17, 2014 at 02:57:08PM +0100, Alexandre Belloni wrote:
> The tsadcc node is useless as it doesn't refer to anything and the touchscreen
> is handled by the adc0 node.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Rodolfo Giometti <giometti@linux.it>
Acked.
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node
@ 2014-03-17 14:00 ` Rodolfo Giometti
0 siblings, 0 replies; 60+ messages in thread
From: Rodolfo Giometti @ 2014-03-17 14:00 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Nicolas Ferre, Jonathan Cameron, Dmitry Torokhov,
Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement
On Mon, Mar 17, 2014 at 02:57:08PM +0100, Alexandre Belloni wrote:
> The tsadcc node is useless as it doesn't refer to anything and the touchscreen
> is handled by the adc0 node.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> Cc: Rodolfo Giometti <giometti-k2GhghHVRtY@public.gmane.org>
Acked.
Rodolfo
--
GNU/Linux Solutions e-mail: giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org
Linux Device Driver giometti-k2GhghHVRtY@public.gmane.org
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node
@ 2014-03-17 14:00 ` Rodolfo Giometti
0 siblings, 0 replies; 60+ messages in thread
From: Rodolfo Giometti @ 2014-03-17 14:00 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Mar 17, 2014 at 02:57:08PM +0100, Alexandre Belloni wrote:
> The tsadcc node is useless as it doesn't refer to anything and the touchscreen
> is handled by the adc0 node.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Rodolfo Giometti <giometti@linux.it>
Acked.
Rodolfo
--
GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 04/15] iio: adc: at91_adc: Add support for touchscreens without TSMR
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-22 12:33 ` Jonathan Cameron
-1 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:33 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On 17/03/14 13:56, Alexandre Belloni wrote:
> Old ADCs, as present on the sam9rl and the sam9g45 don't have a TSMR register
> and the touchscreen support should be handled differently.
>
You cleared up my one query on this in response to the previous version.
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> arch/arm/mach-at91/include/mach/at91_adc.h | 13 ++
> drivers/iio/adc/at91_adc.c | 200 ++++++++++++++++++++++-------
> include/linux/platform_data/at91_adc.h | 8 ++
> 3 files changed, 174 insertions(+), 47 deletions(-)
>
> diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
> index c287307b9a3b..7d80396346b2 100644
> --- a/arch/arm/mach-at91/include/mach/at91_adc.h
> +++ b/arch/arm/mach-at91/include/mach/at91_adc.h
> @@ -20,6 +20,9 @@
> #define AT91_ADC_START (1 << 1) /* Start Conversion */
>
> #define AT91_ADC_MR 0x04 /* Mode Register */
> +#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> +#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> +#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> #define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> #define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> #define AT91_ADC_TRGSEL_TC0 (0 << 1)
> @@ -28,6 +31,7 @@
> #define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> #define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> #define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> +#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> #define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> #define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> #define AT91_ADC_PRESCAL_(x) ((x) << 8)
> @@ -37,6 +41,12 @@
> #define AT91_ADC_STARTUP_(x) ((x) << 16)
> #define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> #define AT91_ADC_SHTIM_(x) ((x) << 24)
> +#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_PENDBC_(x) ((x) << 28)
> +
> +#define AT91_ADC_TSR 0x0C
> +#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
>
> #define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> #define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> @@ -60,6 +70,8 @@
> #define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> #define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> #define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> +#define AT91RL_ADC_IER_PEN (1 << 20)
> +#define AT91RL_ADC_IER_NOPEN (1 << 21)
> #define AT91_ADC_IER_PEN (1 << 29)
> #define AT91_ADC_IER_NOPEN (1 << 30)
> #define AT91_ADC_IER_XRDY (1 << 20)
> @@ -102,6 +114,7 @@
> #define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> #define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> #define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> +#define AT91_ADC_TRGR_NONE (0 << 0)
> #define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
>
> #endif
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 1beae65aef2c..c0e4206e34e5 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -46,6 +46,10 @@
> #define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
> #define TOUCH_PEN_DETECT_DEBOUNCE_US 200
>
> +#define MAX_RLPOS_BITS 10
> +#define TOUCH_SAMPLE_PERIOD_US_RL 10000 /* 10ms, the SoC can't keep up with 2ms */
> +#define TOUCH_SHTIM 0xa
> +
> /**
> * struct at91_adc_reg_desc - Various informations relative to registers
> * @channel_base: Base offset for the channel data registers
> @@ -83,12 +87,6 @@ struct at91_adc_caps {
> struct at91_adc_reg_desc registers;
> };
>
> -enum atmel_adc_ts_type {
> - ATMEL_ADC_TOUCHSCREEN_NONE = 0,
> - ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
> - ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
> -};
> -
> struct at91_adc_state {
> struct clk *adc_clk;
> u16 *buffer;
> @@ -133,6 +131,11 @@ struct at91_adc_state {
>
> u16 ts_sample_period_val;
> u32 ts_pressure_threshold;
> + u16 ts_pendbc;
> +
> + bool ts_bufferedmeasure;
> + u32 ts_prev_absx;
> + u32 ts_prev_absy;
> };
>
> static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
> @@ -239,7 +242,72 @@ static int at91_ts_sample(struct at91_adc_state *st)
> return 0;
> }
>
> -static irqreturn_t at91_adc_interrupt(int irq, void *private)
> +static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
> +{
> + struct iio_dev *idev = private;
> + struct at91_adc_state *st = iio_priv(idev);
> + u32 status = at91_adc_readl(st, st->registers->status_register);
> + unsigned int reg;
> +
> + status &= at91_adc_readl(st, AT91_ADC_IMR);
> + if (status & st->registers->drdy_mask)
> + handle_adc_eoc_trigger(irq, idev);
> +
> + if (status & AT91RL_ADC_IER_PEN) {
> + /* Disabling pen debounce is required to get a NOPEN irq */
> + reg = at91_adc_readl(st, AT91_ADC_MR);
> + reg &= ~AT91_ADC_PENDBC;
> + at91_adc_writel(st, AT91_ADC_MR, reg);
> +
> + at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
> + at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_NOPEN
> + | AT91_ADC_EOC(3));
> + /* Set up period trigger for sampling */
> + at91_adc_writel(st, st->registers->trigger_register,
> + AT91_ADC_TRGR_MOD_PERIOD_TRIG |
> + AT91_ADC_TRGR_TRGPER_(st->ts_sample_period_val));
> + } else if (status & AT91RL_ADC_IER_NOPEN) {
> + reg = at91_adc_readl(st, AT91_ADC_MR);
> + reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
> + at91_adc_writel(st, AT91_ADC_MR, reg);
> + at91_adc_writel(st, st->registers->trigger_register,
> + AT91_ADC_TRGR_NONE);
> +
> + at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_NOPEN
> + | AT91_ADC_EOC(3));
> + at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
> + st->ts_bufferedmeasure = false;
> + input_report_key(st->ts_input, BTN_TOUCH, 0);
> + input_sync(st->ts_input);
> + } else if (status & AT91_ADC_EOC(3)) {
> + /* Conversion finished */
> + if (st->ts_bufferedmeasure) {
> + /*
> + * Last measurement is always discarded, since it can
> + * be erroneous.
> + * Always report previous measurement
> + */
> + input_report_abs(st->ts_input, ABS_X, st->ts_prev_absx);
> + input_report_abs(st->ts_input, ABS_Y, st->ts_prev_absy);
> + input_report_key(st->ts_input, BTN_TOUCH, 1);
> + input_sync(st->ts_input);
> + } else
> + st->ts_bufferedmeasure = true;
> +
> + /* Now make new measurement */
> + st->ts_prev_absx = at91_adc_readl(st, AT91_ADC_CHAN(st, 3))
> + << MAX_RLPOS_BITS;
> + st->ts_prev_absx /= at91_adc_readl(st, AT91_ADC_CHAN(st, 2));
> +
> + st->ts_prev_absy = at91_adc_readl(st, AT91_ADC_CHAN(st, 1))
> + << MAX_RLPOS_BITS;
> + st->ts_prev_absy /= at91_adc_readl(st, AT91_ADC_CHAN(st, 0));
> + }
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
> {
> struct iio_dev *idev = private;
> struct at91_adc_state *st = iio_priv(idev);
> @@ -672,6 +740,8 @@ static int at91_adc_probe_dt_ts(struct device_node *node,
> return -EINVAL;
> }
>
> + if (!st->caps->has_tsmr)
> + return 0;
> prop = 0;
> of_property_read_u32(node, "atmel,adc-ts-pressure-threshold", &prop);
> st->ts_pressure_threshold = prop;
> @@ -795,6 +865,7 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st,
> st->trigger_number = pdata->trigger_number;
> st->trigger_list = pdata->trigger_list;
> st->registers = &st->caps->registers;
> + st->touchscreen_type = pdata->touchscreen_type;
>
> return 0;
> }
> @@ -809,7 +880,10 @@ static int atmel_ts_open(struct input_dev *dev)
> {
> struct at91_adc_state *st = input_get_drvdata(dev);
>
> - at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
> + if (st->caps->has_tsmr)
> + at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
> + else
> + at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
> return 0;
> }
>
> @@ -817,45 +891,61 @@ static void atmel_ts_close(struct input_dev *dev)
> {
> struct at91_adc_state *st = input_get_drvdata(dev);
>
> - at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
> + if (st->caps->has_tsmr)
> + at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
> + else
> + at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
> }
>
> static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
> {
> - u32 reg = 0, pendbc;
> + u32 reg = 0;
> int i = 0;
>
> - if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
> - reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
> - else
> - reg = AT91_ADC_TSMR_TSMODE_5WIRE;
> -
> /* a Pen Detect Debounce Time is necessary for the ADC Touch to avoid
> * pen detect noise.
> * The formula is : Pen Detect Debounce Time = (2 ^ pendbc) / ADCClock
> */
> - pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz / 1000, 1);
> + st->ts_pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz /
> + 1000, 1);
>
> - while (pendbc >> ++i)
> + while (st->ts_pendbc >> ++i)
> ; /* Empty! Find the shift offset */
> - if (abs(pendbc - (1 << i)) < abs(pendbc - (1 << (i - 1))))
> - pendbc = i;
> + if (abs(st->ts_pendbc - (1 << i)) < abs(st->ts_pendbc - (1 << (i - 1))))
> + st->ts_pendbc = i;
> else
> - pendbc = i - 1;
> + st->ts_pendbc = i - 1;
>
> - if (st->caps->has_tsmr) {
> - reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
> - & AT91_ADC_TSMR_TSAV;
> - reg |= AT91_ADC_TSMR_PENDBC_(pendbc) & AT91_ADC_TSMR_PENDBC;
> - reg |= AT91_ADC_TSMR_NOTSDMA;
> - reg |= AT91_ADC_TSMR_PENDET_ENA;
> - reg |= 0x03 << 8; /* TSFREQ, need bigger than TSAV */
> -
> - at91_adc_writel(st, AT91_ADC_TSMR, reg);
> - } else {
> - /* TODO: for 9g45 which has no TSMR */
> + if (!st->caps->has_tsmr) {
> + reg = at91_adc_readl(st, AT91_ADC_MR);
> + reg |= AT91_ADC_TSAMOD_TS_ONLY_MODE | AT91_ADC_PENDET;
> +
> + reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
> + at91_adc_writel(st, AT91_ADC_MR, reg);
> +
> + reg = AT91_ADC_TSR_SHTIM_(TOUCH_SHTIM) & AT91_ADC_TSR_SHTIM;
> + at91_adc_writel(st, AT91_ADC_TSR, reg);
> +
> + st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US_RL *
> + adc_clk_khz / 1000) - 1, 1);
> +
> + return 0;
> }
>
> + if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
> + reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
> + else
> + reg = AT91_ADC_TSMR_TSMODE_5WIRE;
> +
> + reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
> + & AT91_ADC_TSMR_TSAV;
> + reg |= AT91_ADC_TSMR_PENDBC_(st->ts_pendbc) & AT91_ADC_TSMR_PENDBC;
> + reg |= AT91_ADC_TSMR_NOTSDMA;
> + reg |= AT91_ADC_TSMR_PENDET_ENA;
> + reg |= 0x03 << 8; /* TSFREQ, needs to be bigger than TSAV */
> +
> + at91_adc_writel(st, AT91_ADC_TSMR, reg);
> +
> /* Change adc internal resistor value for better pen detection,
> * default value is 100 kOhm.
> * 0 = 200 kOhm, 1 = 150 kOhm, 2 = 100 kOhm, 3 = 50 kOhm
> @@ -864,7 +954,7 @@ static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
> at91_adc_writel(st, AT91_ADC_ACR, st->caps->ts_pen_detect_sensitivity
> & AT91_ADC_ACR_PENDETSENS);
>
> - /* Sample Peroid Time = (TRGPER + 1) / ADCClock */
> + /* Sample Period Time = (TRGPER + 1) / ADCClock */
> st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US *
> adc_clk_khz / 1000) - 1, 1);
>
> @@ -893,17 +983,37 @@ static int at91_ts_register(struct at91_adc_state *st,
> __set_bit(EV_ABS, input->evbit);
> __set_bit(EV_KEY, input->evbit);
> __set_bit(BTN_TOUCH, input->keybit);
> - input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
> - input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
> - input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
> + if (st->caps->has_tsmr) {
> + input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1,
> + 0, 0);
> + input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1,
> + 0, 0);
> + input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
> + } else {
> + if (st->touchscreen_type != ATMEL_ADC_TOUCHSCREEN_4WIRE) {
> + dev_err(&pdev->dev,
> + "This touchscreen controller only support 4 wires\n");
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + input_set_abs_params(input, ABS_X, 0, (1 << MAX_RLPOS_BITS) - 1,
> + 0, 0);
> + input_set_abs_params(input, ABS_Y, 0, (1 << MAX_RLPOS_BITS) - 1,
> + 0, 0);
> + }
>
> st->ts_input = input;
> input_set_drvdata(input, st);
>
> ret = input_register_device(input);
> if (ret)
> - input_free_device(st->ts_input);
> + goto err;
> +
> + return ret;
>
> +err:
> + input_free_device(st->ts_input);
> return ret;
> }
>
> @@ -962,11 +1072,13 @@ static int at91_adc_probe(struct platform_device *pdev)
> */
> at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_SWRST);
> at91_adc_writel(st, AT91_ADC_IDR, 0xFFFFFFFF);
> - ret = request_irq(st->irq,
> - at91_adc_interrupt,
> - 0,
> - pdev->dev.driver->name,
> - idev);
> +
> + if (st->caps->has_tsmr)
> + ret = request_irq(st->irq, at91_adc_9x5_interrupt, 0,
> + pdev->dev.driver->name, idev);
> + else
> + ret = request_irq(st->irq, at91_adc_rl_interrupt, 0,
> + pdev->dev.driver->name, idev);
> if (ret) {
> dev_err(&pdev->dev, "Failed to allocate IRQ.\n");
> return ret;
> @@ -1070,12 +1182,6 @@ static int at91_adc_probe(struct platform_device *pdev)
> goto error_disable_adc_clk;
> }
> } else {
> - if (!st->caps->has_tsmr) {
> - dev_err(&pdev->dev, "We don't support non-TSMR adc\n");
> - ret = -ENODEV;
> - goto error_disable_adc_clk;
> - }
> -
> ret = at91_ts_register(st, pdev);
> if (ret)
> goto error_disable_adc_clk;
> diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
> index fcf73879dbfe..7819fc787731 100644
> --- a/include/linux/platform_data/at91_adc.h
> +++ b/include/linux/platform_data/at91_adc.h
> @@ -7,6 +7,12 @@
> #ifndef _AT91_ADC_H_
> #define _AT91_ADC_H_
>
> +enum atmel_adc_ts_type {
> + ATMEL_ADC_TOUCHSCREEN_NONE = 0,
> + ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
> + ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
> +};
> +
> /**
> * struct at91_adc_trigger - description of triggers
> * @name: name of the trigger advertised to the user
> @@ -28,6 +34,7 @@ struct at91_adc_trigger {
> * @trigger_number: Number of triggers available in the ADC
> * @use_external_triggers: does the board has external triggers availables
> * @vref: Reference voltage for the ADC in millivolts
> + * @touchscreen_type: If a touchscreen is connected, its type (4 or 5 wires)
> */
> struct at91_adc_data {
> unsigned long channels_used;
> @@ -36,6 +43,7 @@ struct at91_adc_data {
> u8 trigger_number;
> bool use_external_triggers;
> u16 vref;
> + enum atmel_adc_ts_type touchscreen_type;
> };
>
> extern void __init at91_add_device_adc(struct at91_adc_data *data);
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 04/15] iio: adc: at91_adc: Add support for touchscreens without TSMR
@ 2014-03-22 12:33 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:33 UTC (permalink / raw)
To: linux-arm-kernel
On 17/03/14 13:56, Alexandre Belloni wrote:
> Old ADCs, as present on the sam9rl and the sam9g45 don't have a TSMR register
> and the touchscreen support should be handled differently.
>
You cleared up my one query on this in response to the previous version.
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> arch/arm/mach-at91/include/mach/at91_adc.h | 13 ++
> drivers/iio/adc/at91_adc.c | 200 ++++++++++++++++++++++-------
> include/linux/platform_data/at91_adc.h | 8 ++
> 3 files changed, 174 insertions(+), 47 deletions(-)
>
> diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
> index c287307b9a3b..7d80396346b2 100644
> --- a/arch/arm/mach-at91/include/mach/at91_adc.h
> +++ b/arch/arm/mach-at91/include/mach/at91_adc.h
> @@ -20,6 +20,9 @@
> #define AT91_ADC_START (1 << 1) /* Start Conversion */
>
> #define AT91_ADC_MR 0x04 /* Mode Register */
> +#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> +#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> +#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> #define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> #define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> #define AT91_ADC_TRGSEL_TC0 (0 << 1)
> @@ -28,6 +31,7 @@
> #define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> #define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> #define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> +#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> #define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> #define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> #define AT91_ADC_PRESCAL_(x) ((x) << 8)
> @@ -37,6 +41,12 @@
> #define AT91_ADC_STARTUP_(x) ((x) << 16)
> #define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> #define AT91_ADC_SHTIM_(x) ((x) << 24)
> +#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_PENDBC_(x) ((x) << 28)
> +
> +#define AT91_ADC_TSR 0x0C
> +#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
>
> #define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> #define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> @@ -60,6 +70,8 @@
> #define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> #define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> #define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> +#define AT91RL_ADC_IER_PEN (1 << 20)
> +#define AT91RL_ADC_IER_NOPEN (1 << 21)
> #define AT91_ADC_IER_PEN (1 << 29)
> #define AT91_ADC_IER_NOPEN (1 << 30)
> #define AT91_ADC_IER_XRDY (1 << 20)
> @@ -102,6 +114,7 @@
> #define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> #define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> #define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> +#define AT91_ADC_TRGR_NONE (0 << 0)
> #define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
>
> #endif
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 1beae65aef2c..c0e4206e34e5 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -46,6 +46,10 @@
> #define TOUCH_SAMPLE_PERIOD_US 2000 /* 2ms */
> #define TOUCH_PEN_DETECT_DEBOUNCE_US 200
>
> +#define MAX_RLPOS_BITS 10
> +#define TOUCH_SAMPLE_PERIOD_US_RL 10000 /* 10ms, the SoC can't keep up with 2ms */
> +#define TOUCH_SHTIM 0xa
> +
> /**
> * struct at91_adc_reg_desc - Various informations relative to registers
> * @channel_base: Base offset for the channel data registers
> @@ -83,12 +87,6 @@ struct at91_adc_caps {
> struct at91_adc_reg_desc registers;
> };
>
> -enum atmel_adc_ts_type {
> - ATMEL_ADC_TOUCHSCREEN_NONE = 0,
> - ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
> - ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
> -};
> -
> struct at91_adc_state {
> struct clk *adc_clk;
> u16 *buffer;
> @@ -133,6 +131,11 @@ struct at91_adc_state {
>
> u16 ts_sample_period_val;
> u32 ts_pressure_threshold;
> + u16 ts_pendbc;
> +
> + bool ts_bufferedmeasure;
> + u32 ts_prev_absx;
> + u32 ts_prev_absy;
> };
>
> static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
> @@ -239,7 +242,72 @@ static int at91_ts_sample(struct at91_adc_state *st)
> return 0;
> }
>
> -static irqreturn_t at91_adc_interrupt(int irq, void *private)
> +static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
> +{
> + struct iio_dev *idev = private;
> + struct at91_adc_state *st = iio_priv(idev);
> + u32 status = at91_adc_readl(st, st->registers->status_register);
> + unsigned int reg;
> +
> + status &= at91_adc_readl(st, AT91_ADC_IMR);
> + if (status & st->registers->drdy_mask)
> + handle_adc_eoc_trigger(irq, idev);
> +
> + if (status & AT91RL_ADC_IER_PEN) {
> + /* Disabling pen debounce is required to get a NOPEN irq */
> + reg = at91_adc_readl(st, AT91_ADC_MR);
> + reg &= ~AT91_ADC_PENDBC;
> + at91_adc_writel(st, AT91_ADC_MR, reg);
> +
> + at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
> + at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_NOPEN
> + | AT91_ADC_EOC(3));
> + /* Set up period trigger for sampling */
> + at91_adc_writel(st, st->registers->trigger_register,
> + AT91_ADC_TRGR_MOD_PERIOD_TRIG |
> + AT91_ADC_TRGR_TRGPER_(st->ts_sample_period_val));
> + } else if (status & AT91RL_ADC_IER_NOPEN) {
> + reg = at91_adc_readl(st, AT91_ADC_MR);
> + reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
> + at91_adc_writel(st, AT91_ADC_MR, reg);
> + at91_adc_writel(st, st->registers->trigger_register,
> + AT91_ADC_TRGR_NONE);
> +
> + at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_NOPEN
> + | AT91_ADC_EOC(3));
> + at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
> + st->ts_bufferedmeasure = false;
> + input_report_key(st->ts_input, BTN_TOUCH, 0);
> + input_sync(st->ts_input);
> + } else if (status & AT91_ADC_EOC(3)) {
> + /* Conversion finished */
> + if (st->ts_bufferedmeasure) {
> + /*
> + * Last measurement is always discarded, since it can
> + * be erroneous.
> + * Always report previous measurement
> + */
> + input_report_abs(st->ts_input, ABS_X, st->ts_prev_absx);
> + input_report_abs(st->ts_input, ABS_Y, st->ts_prev_absy);
> + input_report_key(st->ts_input, BTN_TOUCH, 1);
> + input_sync(st->ts_input);
> + } else
> + st->ts_bufferedmeasure = true;
> +
> + /* Now make new measurement */
> + st->ts_prev_absx = at91_adc_readl(st, AT91_ADC_CHAN(st, 3))
> + << MAX_RLPOS_BITS;
> + st->ts_prev_absx /= at91_adc_readl(st, AT91_ADC_CHAN(st, 2));
> +
> + st->ts_prev_absy = at91_adc_readl(st, AT91_ADC_CHAN(st, 1))
> + << MAX_RLPOS_BITS;
> + st->ts_prev_absy /= at91_adc_readl(st, AT91_ADC_CHAN(st, 0));
> + }
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
> {
> struct iio_dev *idev = private;
> struct at91_adc_state *st = iio_priv(idev);
> @@ -672,6 +740,8 @@ static int at91_adc_probe_dt_ts(struct device_node *node,
> return -EINVAL;
> }
>
> + if (!st->caps->has_tsmr)
> + return 0;
> prop = 0;
> of_property_read_u32(node, "atmel,adc-ts-pressure-threshold", &prop);
> st->ts_pressure_threshold = prop;
> @@ -795,6 +865,7 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st,
> st->trigger_number = pdata->trigger_number;
> st->trigger_list = pdata->trigger_list;
> st->registers = &st->caps->registers;
> + st->touchscreen_type = pdata->touchscreen_type;
>
> return 0;
> }
> @@ -809,7 +880,10 @@ static int atmel_ts_open(struct input_dev *dev)
> {
> struct at91_adc_state *st = input_get_drvdata(dev);
>
> - at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
> + if (st->caps->has_tsmr)
> + at91_adc_writel(st, AT91_ADC_IER, AT91_ADC_IER_PEN);
> + else
> + at91_adc_writel(st, AT91_ADC_IER, AT91RL_ADC_IER_PEN);
> return 0;
> }
>
> @@ -817,45 +891,61 @@ static void atmel_ts_close(struct input_dev *dev)
> {
> struct at91_adc_state *st = input_get_drvdata(dev);
>
> - at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
> + if (st->caps->has_tsmr)
> + at91_adc_writel(st, AT91_ADC_IDR, AT91_ADC_IER_PEN);
> + else
> + at91_adc_writel(st, AT91_ADC_IDR, AT91RL_ADC_IER_PEN);
> }
>
> static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
> {
> - u32 reg = 0, pendbc;
> + u32 reg = 0;
> int i = 0;
>
> - if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
> - reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
> - else
> - reg = AT91_ADC_TSMR_TSMODE_5WIRE;
> -
> /* a Pen Detect Debounce Time is necessary for the ADC Touch to avoid
> * pen detect noise.
> * The formula is : Pen Detect Debounce Time = (2 ^ pendbc) / ADCClock
> */
> - pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz / 1000, 1);
> + st->ts_pendbc = round_up(TOUCH_PEN_DETECT_DEBOUNCE_US * adc_clk_khz /
> + 1000, 1);
>
> - while (pendbc >> ++i)
> + while (st->ts_pendbc >> ++i)
> ; /* Empty! Find the shift offset */
> - if (abs(pendbc - (1 << i)) < abs(pendbc - (1 << (i - 1))))
> - pendbc = i;
> + if (abs(st->ts_pendbc - (1 << i)) < abs(st->ts_pendbc - (1 << (i - 1))))
> + st->ts_pendbc = i;
> else
> - pendbc = i - 1;
> + st->ts_pendbc = i - 1;
>
> - if (st->caps->has_tsmr) {
> - reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
> - & AT91_ADC_TSMR_TSAV;
> - reg |= AT91_ADC_TSMR_PENDBC_(pendbc) & AT91_ADC_TSMR_PENDBC;
> - reg |= AT91_ADC_TSMR_NOTSDMA;
> - reg |= AT91_ADC_TSMR_PENDET_ENA;
> - reg |= 0x03 << 8; /* TSFREQ, need bigger than TSAV */
> -
> - at91_adc_writel(st, AT91_ADC_TSMR, reg);
> - } else {
> - /* TODO: for 9g45 which has no TSMR */
> + if (!st->caps->has_tsmr) {
> + reg = at91_adc_readl(st, AT91_ADC_MR);
> + reg |= AT91_ADC_TSAMOD_TS_ONLY_MODE | AT91_ADC_PENDET;
> +
> + reg |= AT91_ADC_PENDBC_(st->ts_pendbc) & AT91_ADC_PENDBC;
> + at91_adc_writel(st, AT91_ADC_MR, reg);
> +
> + reg = AT91_ADC_TSR_SHTIM_(TOUCH_SHTIM) & AT91_ADC_TSR_SHTIM;
> + at91_adc_writel(st, AT91_ADC_TSR, reg);
> +
> + st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US_RL *
> + adc_clk_khz / 1000) - 1, 1);
> +
> + return 0;
> }
>
> + if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
> + reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
> + else
> + reg = AT91_ADC_TSMR_TSMODE_5WIRE;
> +
> + reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
> + & AT91_ADC_TSMR_TSAV;
> + reg |= AT91_ADC_TSMR_PENDBC_(st->ts_pendbc) & AT91_ADC_TSMR_PENDBC;
> + reg |= AT91_ADC_TSMR_NOTSDMA;
> + reg |= AT91_ADC_TSMR_PENDET_ENA;
> + reg |= 0x03 << 8; /* TSFREQ, needs to be bigger than TSAV */
> +
> + at91_adc_writel(st, AT91_ADC_TSMR, reg);
> +
> /* Change adc internal resistor value for better pen detection,
> * default value is 100 kOhm.
> * 0 = 200 kOhm, 1 = 150 kOhm, 2 = 100 kOhm, 3 = 50 kOhm
> @@ -864,7 +954,7 @@ static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
> at91_adc_writel(st, AT91_ADC_ACR, st->caps->ts_pen_detect_sensitivity
> & AT91_ADC_ACR_PENDETSENS);
>
> - /* Sample Peroid Time = (TRGPER + 1) / ADCClock */
> + /* Sample Period Time = (TRGPER + 1) / ADCClock */
> st->ts_sample_period_val = round_up((TOUCH_SAMPLE_PERIOD_US *
> adc_clk_khz / 1000) - 1, 1);
>
> @@ -893,17 +983,37 @@ static int at91_ts_register(struct at91_adc_state *st,
> __set_bit(EV_ABS, input->evbit);
> __set_bit(EV_KEY, input->evbit);
> __set_bit(BTN_TOUCH, input->keybit);
> - input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
> - input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1, 0, 0);
> - input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
> + if (st->caps->has_tsmr) {
> + input_set_abs_params(input, ABS_X, 0, (1 << MAX_POS_BITS) - 1,
> + 0, 0);
> + input_set_abs_params(input, ABS_Y, 0, (1 << MAX_POS_BITS) - 1,
> + 0, 0);
> + input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
> + } else {
> + if (st->touchscreen_type != ATMEL_ADC_TOUCHSCREEN_4WIRE) {
> + dev_err(&pdev->dev,
> + "This touchscreen controller only support 4 wires\n");
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + input_set_abs_params(input, ABS_X, 0, (1 << MAX_RLPOS_BITS) - 1,
> + 0, 0);
> + input_set_abs_params(input, ABS_Y, 0, (1 << MAX_RLPOS_BITS) - 1,
> + 0, 0);
> + }
>
> st->ts_input = input;
> input_set_drvdata(input, st);
>
> ret = input_register_device(input);
> if (ret)
> - input_free_device(st->ts_input);
> + goto err;
> +
> + return ret;
>
> +err:
> + input_free_device(st->ts_input);
> return ret;
> }
>
> @@ -962,11 +1072,13 @@ static int at91_adc_probe(struct platform_device *pdev)
> */
> at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_SWRST);
> at91_adc_writel(st, AT91_ADC_IDR, 0xFFFFFFFF);
> - ret = request_irq(st->irq,
> - at91_adc_interrupt,
> - 0,
> - pdev->dev.driver->name,
> - idev);
> +
> + if (st->caps->has_tsmr)
> + ret = request_irq(st->irq, at91_adc_9x5_interrupt, 0,
> + pdev->dev.driver->name, idev);
> + else
> + ret = request_irq(st->irq, at91_adc_rl_interrupt, 0,
> + pdev->dev.driver->name, idev);
> if (ret) {
> dev_err(&pdev->dev, "Failed to allocate IRQ.\n");
> return ret;
> @@ -1070,12 +1182,6 @@ static int at91_adc_probe(struct platform_device *pdev)
> goto error_disable_adc_clk;
> }
> } else {
> - if (!st->caps->has_tsmr) {
> - dev_err(&pdev->dev, "We don't support non-TSMR adc\n");
> - ret = -ENODEV;
> - goto error_disable_adc_clk;
> - }
> -
> ret = at91_ts_register(st, pdev);
> if (ret)
> goto error_disable_adc_clk;
> diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
> index fcf73879dbfe..7819fc787731 100644
> --- a/include/linux/platform_data/at91_adc.h
> +++ b/include/linux/platform_data/at91_adc.h
> @@ -7,6 +7,12 @@
> #ifndef _AT91_ADC_H_
> #define _AT91_ADC_H_
>
> +enum atmel_adc_ts_type {
> + ATMEL_ADC_TOUCHSCREEN_NONE = 0,
> + ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
> + ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
> +};
> +
> /**
> * struct at91_adc_trigger - description of triggers
> * @name: name of the trigger advertised to the user
> @@ -28,6 +34,7 @@ struct at91_adc_trigger {
> * @trigger_number: Number of triggers available in the ADC
> * @use_external_triggers: does the board has external triggers availables
> * @vref: Reference voltage for the ADC in millivolts
> + * @touchscreen_type: If a touchscreen is connected, its type (4 or 5 wires)
> */
> struct at91_adc_data {
> unsigned long channels_used;
> @@ -36,6 +43,7 @@ struct at91_adc_data {
> u8 trigger_number;
> bool use_external_triggers;
> u16 vref;
> + enum atmel_adc_ts_type touchscreen_type;
> };
>
> extern void __init at91_add_device_adc(struct at91_adc_data *data);
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 05/15] ARM: at91: sam9m10g45ek: Add touchscreen support through at91_adc
2014-03-17 13:56 ` Alexandre Belloni
@ 2014-03-22 12:34 ` Jonathan Cameron
-1 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On 17/03/14 13:56, Alexandre Belloni wrote:
> at91_adc now supports reading a touchscreen for ADCs without a TSMR register.
> Enable touchscreen support through at91_adc. This allows to use both a
> touchscreen and the remaining ADC channel at the same time.
>
> Also, lower the clock for the ADC as it allows to have more stable reads and
> this is the speed used by atmel_tsadcc.
> It lowers the maximum throughput rate from 440000 samples per second to 12958
> samples per second. It shouldn't be an issue as the CPU is not able to keep up
> reading samples at that frequency.
Thanks for adding this detail.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> arch/arm/mach-at91/at91sam9g45.c | 2 +-
> arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
> index 2f455ce35268..3c519a7a938f 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -181,7 +181,7 @@ static struct clk vdec_clk = {
> static struct clk adc_op_clk = {
> .name = "adc_op_clk",
> .type = CLK_TYPE_PERIPHERAL,
> - .rate_hz = 13200000,
> + .rate_hz = 300000,
> };
>
> /* AES/TDES/SHA clock - Only for sam9m11/sam9g56 */
> diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
> index ef39078c8ce2..4d775b796ce4 100644
> --- a/arch/arm/mach-at91/board-sam9m10g45ek.c
> +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
> @@ -315,6 +315,7 @@ static struct at91_adc_data ek_adc_data = {
> .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
> .use_external_triggers = true,
> .vref = 3300,
> + .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
> };
>
> /*
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 05/15] ARM: at91: sam9m10g45ek: Add touchscreen support through at91_adc
@ 2014-03-22 12:34 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: linux-arm-kernel
On 17/03/14 13:56, Alexandre Belloni wrote:
> at91_adc now supports reading a touchscreen for ADCs without a TSMR register.
> Enable touchscreen support through at91_adc. This allows to use both a
> touchscreen and the remaining ADC channel at the same time.
>
> Also, lower the clock for the ADC as it allows to have more stable reads and
> this is the speed used by atmel_tsadcc.
> It lowers the maximum throughput rate from 440000 samples per second to 12958
> samples per second. It shouldn't be an issue as the CPU is not able to keep up
> reading samples at that frequency.
Thanks for adding this detail.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> arch/arm/mach-at91/at91sam9g45.c | 2 +-
> arch/arm/mach-at91/board-sam9m10g45ek.c | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
> index 2f455ce35268..3c519a7a938f 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -181,7 +181,7 @@ static struct clk vdec_clk = {
> static struct clk adc_op_clk = {
> .name = "adc_op_clk",
> .type = CLK_TYPE_PERIPHERAL,
> - .rate_hz = 13200000,
> + .rate_hz = 300000,
> };
>
> /* AES/TDES/SHA clock - Only for sam9m11/sam9g56 */
> diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
> index ef39078c8ce2..4d775b796ce4 100644
> --- a/arch/arm/mach-at91/board-sam9m10g45ek.c
> +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
> @@ -315,6 +315,7 @@ static struct at91_adc_data ek_adc_data = {
> .channels_used = BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4) | BIT(5) | BIT(6) | BIT(7),
> .use_external_triggers = true,
> .vref = 3300,
> + .touchscreen_type = ATMEL_ADC_TOUCHSCREEN_4WIRE,
> };
>
> /*
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 06/15] iio: adc: at91: remove unused include from include/mach
@ 2014-03-22 12:34 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On 17/03/14 13:56, Alexandre Belloni wrote:
> That include file is now only used by the at91_adc driver, remove it from
> include/mach for better driver separation.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> arch/arm/mach-at91/include/mach/at91_adc.h | 120 -----------------------------
> drivers/iio/adc/at91_adc.c | 103 ++++++++++++++++++++++++-
> 2 files changed, 102 insertions(+), 121 deletions(-)
> delete mode 100644 arch/arm/mach-at91/include/mach/at91_adc.h
>
> diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
> deleted file mode 100644
> index 7d80396346b2..000000000000
> --- a/arch/arm/mach-at91/include/mach/at91_adc.h
> +++ /dev/null
> @@ -1,120 +0,0 @@
> -/*
> - * arch/arm/mach-at91/include/mach/at91_adc.h
> - *
> - * Copyright (C) SAN People
> - *
> - * Analog-to-Digital Converter (ADC) registers.
> - * Based on AT91SAM9260 datasheet revision D.
> - *
> - * 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.
> - */
> -
> -#ifndef AT91_ADC_H
> -#define AT91_ADC_H
> -
> -#define AT91_ADC_CR 0x00 /* Control Register */
> -#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
> -#define AT91_ADC_START (1 << 1) /* Start Conversion */
> -
> -#define AT91_ADC_MR 0x04 /* Mode Register */
> -#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> -#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> -#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> -#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> -#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> -#define AT91_ADC_TRGSEL_TC0 (0 << 1)
> -#define AT91_ADC_TRGSEL_TC1 (1 << 1)
> -#define AT91_ADC_TRGSEL_TC2 (2 << 1)
> -#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> -#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> -#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> -#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> -#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> -#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> -#define AT91_ADC_PRESCAL_(x) ((x) << 8)
> -#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
> -#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
> -#define AT91_ADC_STARTUP_9X5 (0xf << 16)
> -#define AT91_ADC_STARTUP_(x) ((x) << 16)
> -#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> -#define AT91_ADC_SHTIM_(x) ((x) << 24)
> -#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> -#define AT91_ADC_PENDBC_(x) ((x) << 28)
> -
> -#define AT91_ADC_TSR 0x0C
> -#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> -#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
> -
> -#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> -#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> -#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
> -#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
> -
> -#define AT91_ADC_SR 0x1C /* Status Register */
> -#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
> -#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
> -#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
> -#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
> -#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
> -#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
> -
> -#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
> -#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
> -
> -#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
> -#define AT91_ADC_LDATA (0x3ff)
> -
> -#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> -#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> -#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> -#define AT91RL_ADC_IER_PEN (1 << 20)
> -#define AT91RL_ADC_IER_NOPEN (1 << 21)
> -#define AT91_ADC_IER_PEN (1 << 29)
> -#define AT91_ADC_IER_NOPEN (1 << 30)
> -#define AT91_ADC_IER_XRDY (1 << 20)
> -#define AT91_ADC_IER_YRDY (1 << 21)
> -#define AT91_ADC_IER_PRDY (1 << 22)
> -#define AT91_ADC_ISR_PENS (1 << 31)
> -
> -#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
> -#define AT91_ADC_DATA (0x3ff)
> -
> -#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
> -
> -#define AT91_ADC_ACR 0x94 /* Analog Control Register */
> -#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
> -
> -#define AT91_ADC_TSMR 0xB0
> -#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
> -#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
> -#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
> -#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
> -#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
> -#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
> -#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
> -#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
> -#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
> -#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
> -#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
> -#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
> -#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
> -
> -#define AT91_ADC_TSXPOSR 0xB4
> -#define AT91_ADC_TSYPOSR 0xB8
> -#define AT91_ADC_TSPRESSR 0xBC
> -
> -#define AT91_ADC_TRGR_9260 AT91_ADC_MR
> -#define AT91_ADC_TRGR_9G45 0x08
> -#define AT91_ADC_TRGR_9X5 0xC0
> -
> -/* Trigger Register bit field */
> -#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> -#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> -#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> -#define AT91_ADC_TRGR_NONE (0 << 0)
> -#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
> -
> -#endif
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index c0e4206e34e5..a51b8badbf8e 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -31,7 +31,108 @@
> #include <linux/iio/trigger_consumer.h>
> #include <linux/iio/triggered_buffer.h>
>
> -#include <mach/at91_adc.h>
> +/* Registers */
> +#define AT91_ADC_CR 0x00 /* Control Register */
> +#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
> +#define AT91_ADC_START (1 << 1) /* Start Conversion */
> +
> +#define AT91_ADC_MR 0x04 /* Mode Register */
> +#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> +#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> +#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> +#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> +#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> +#define AT91_ADC_TRGSEL_TC0 (0 << 1)
> +#define AT91_ADC_TRGSEL_TC1 (1 << 1)
> +#define AT91_ADC_TRGSEL_TC2 (2 << 1)
> +#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> +#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> +#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> +#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> +#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> +#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> +#define AT91_ADC_PRESCAL_(x) ((x) << 8)
> +#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
> +#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
> +#define AT91_ADC_STARTUP_9X5 (0xf << 16)
> +#define AT91_ADC_STARTUP_(x) ((x) << 16)
> +#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_SHTIM_(x) ((x) << 24)
> +#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_PENDBC_(x) ((x) << 28)
> +
> +#define AT91_ADC_TSR 0x0C
> +#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
> +
> +#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> +#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> +#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
> +#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
> +
> +#define AT91_ADC_SR 0x1C /* Status Register */
> +#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
> +#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
> +#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
> +#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
> +#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
> +#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
> +
> +#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
> +#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
> +
> +#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
> +#define AT91_ADC_LDATA (0x3ff)
> +
> +#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> +#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> +#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> +#define AT91RL_ADC_IER_PEN (1 << 20)
> +#define AT91RL_ADC_IER_NOPEN (1 << 21)
> +#define AT91_ADC_IER_PEN (1 << 29)
> +#define AT91_ADC_IER_NOPEN (1 << 30)
> +#define AT91_ADC_IER_XRDY (1 << 20)
> +#define AT91_ADC_IER_YRDY (1 << 21)
> +#define AT91_ADC_IER_PRDY (1 << 22)
> +#define AT91_ADC_ISR_PENS (1 << 31)
> +
> +#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
> +#define AT91_ADC_DATA (0x3ff)
> +
> +#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
> +
> +#define AT91_ADC_ACR 0x94 /* Analog Control Register */
> +#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
> +
> +#define AT91_ADC_TSMR 0xB0
> +#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
> +#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
> +#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
> +#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
> +#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
> +#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
> +#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
> +#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
> +#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
> +#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
> +#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
> +#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
> +
> +#define AT91_ADC_TSXPOSR 0xB4
> +#define AT91_ADC_TSYPOSR 0xB8
> +#define AT91_ADC_TSPRESSR 0xBC
> +
> +#define AT91_ADC_TRGR_9260 AT91_ADC_MR
> +#define AT91_ADC_TRGR_9G45 0x08
> +#define AT91_ADC_TRGR_9X5 0xC0
> +
> +/* Trigger Register bit field */
> +#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> +#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> +#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> +#define AT91_ADC_TRGR_NONE (0 << 0)
> +#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
>
> #define AT91_ADC_CHAN(st, ch) \
> (st->registers->channel_base + (ch * 4))
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 06/15] iio: adc: at91: remove unused include from include/mach
@ 2014-03-22 12:34 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement
On 17/03/14 13:56, Alexandre Belloni wrote:
> That include file is now only used by the at91_adc driver, remove it from
> include/mach for better driver separation.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> arch/arm/mach-at91/include/mach/at91_adc.h | 120 -----------------------------
> drivers/iio/adc/at91_adc.c | 103 ++++++++++++++++++++++++-
> 2 files changed, 102 insertions(+), 121 deletions(-)
> delete mode 100644 arch/arm/mach-at91/include/mach/at91_adc.h
>
> diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
> deleted file mode 100644
> index 7d80396346b2..000000000000
> --- a/arch/arm/mach-at91/include/mach/at91_adc.h
> +++ /dev/null
> @@ -1,120 +0,0 @@
> -/*
> - * arch/arm/mach-at91/include/mach/at91_adc.h
> - *
> - * Copyright (C) SAN People
> - *
> - * Analog-to-Digital Converter (ADC) registers.
> - * Based on AT91SAM9260 datasheet revision D.
> - *
> - * 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.
> - */
> -
> -#ifndef AT91_ADC_H
> -#define AT91_ADC_H
> -
> -#define AT91_ADC_CR 0x00 /* Control Register */
> -#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
> -#define AT91_ADC_START (1 << 1) /* Start Conversion */
> -
> -#define AT91_ADC_MR 0x04 /* Mode Register */
> -#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> -#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> -#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> -#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> -#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> -#define AT91_ADC_TRGSEL_TC0 (0 << 1)
> -#define AT91_ADC_TRGSEL_TC1 (1 << 1)
> -#define AT91_ADC_TRGSEL_TC2 (2 << 1)
> -#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> -#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> -#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> -#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> -#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> -#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> -#define AT91_ADC_PRESCAL_(x) ((x) << 8)
> -#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
> -#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
> -#define AT91_ADC_STARTUP_9X5 (0xf << 16)
> -#define AT91_ADC_STARTUP_(x) ((x) << 16)
> -#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> -#define AT91_ADC_SHTIM_(x) ((x) << 24)
> -#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> -#define AT91_ADC_PENDBC_(x) ((x) << 28)
> -
> -#define AT91_ADC_TSR 0x0C
> -#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> -#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
> -
> -#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> -#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> -#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
> -#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
> -
> -#define AT91_ADC_SR 0x1C /* Status Register */
> -#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
> -#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
> -#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
> -#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
> -#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
> -#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
> -
> -#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
> -#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
> -
> -#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
> -#define AT91_ADC_LDATA (0x3ff)
> -
> -#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> -#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> -#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> -#define AT91RL_ADC_IER_PEN (1 << 20)
> -#define AT91RL_ADC_IER_NOPEN (1 << 21)
> -#define AT91_ADC_IER_PEN (1 << 29)
> -#define AT91_ADC_IER_NOPEN (1 << 30)
> -#define AT91_ADC_IER_XRDY (1 << 20)
> -#define AT91_ADC_IER_YRDY (1 << 21)
> -#define AT91_ADC_IER_PRDY (1 << 22)
> -#define AT91_ADC_ISR_PENS (1 << 31)
> -
> -#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
> -#define AT91_ADC_DATA (0x3ff)
> -
> -#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
> -
> -#define AT91_ADC_ACR 0x94 /* Analog Control Register */
> -#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
> -
> -#define AT91_ADC_TSMR 0xB0
> -#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
> -#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
> -#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
> -#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
> -#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
> -#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
> -#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
> -#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
> -#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
> -#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
> -#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
> -#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
> -#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
> -
> -#define AT91_ADC_TSXPOSR 0xB4
> -#define AT91_ADC_TSYPOSR 0xB8
> -#define AT91_ADC_TSPRESSR 0xBC
> -
> -#define AT91_ADC_TRGR_9260 AT91_ADC_MR
> -#define AT91_ADC_TRGR_9G45 0x08
> -#define AT91_ADC_TRGR_9X5 0xC0
> -
> -/* Trigger Register bit field */
> -#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> -#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> -#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> -#define AT91_ADC_TRGR_NONE (0 << 0)
> -#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
> -
> -#endif
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index c0e4206e34e5..a51b8badbf8e 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -31,7 +31,108 @@
> #include <linux/iio/trigger_consumer.h>
> #include <linux/iio/triggered_buffer.h>
>
> -#include <mach/at91_adc.h>
> +/* Registers */
> +#define AT91_ADC_CR 0x00 /* Control Register */
> +#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
> +#define AT91_ADC_START (1 << 1) /* Start Conversion */
> +
> +#define AT91_ADC_MR 0x04 /* Mode Register */
> +#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> +#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> +#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> +#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> +#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> +#define AT91_ADC_TRGSEL_TC0 (0 << 1)
> +#define AT91_ADC_TRGSEL_TC1 (1 << 1)
> +#define AT91_ADC_TRGSEL_TC2 (2 << 1)
> +#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> +#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> +#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> +#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> +#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> +#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> +#define AT91_ADC_PRESCAL_(x) ((x) << 8)
> +#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
> +#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
> +#define AT91_ADC_STARTUP_9X5 (0xf << 16)
> +#define AT91_ADC_STARTUP_(x) ((x) << 16)
> +#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_SHTIM_(x) ((x) << 24)
> +#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_PENDBC_(x) ((x) << 28)
> +
> +#define AT91_ADC_TSR 0x0C
> +#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
> +
> +#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> +#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> +#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
> +#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
> +
> +#define AT91_ADC_SR 0x1C /* Status Register */
> +#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
> +#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
> +#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
> +#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
> +#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
> +#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
> +
> +#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
> +#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
> +
> +#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
> +#define AT91_ADC_LDATA (0x3ff)
> +
> +#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> +#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> +#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> +#define AT91RL_ADC_IER_PEN (1 << 20)
> +#define AT91RL_ADC_IER_NOPEN (1 << 21)
> +#define AT91_ADC_IER_PEN (1 << 29)
> +#define AT91_ADC_IER_NOPEN (1 << 30)
> +#define AT91_ADC_IER_XRDY (1 << 20)
> +#define AT91_ADC_IER_YRDY (1 << 21)
> +#define AT91_ADC_IER_PRDY (1 << 22)
> +#define AT91_ADC_ISR_PENS (1 << 31)
> +
> +#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
> +#define AT91_ADC_DATA (0x3ff)
> +
> +#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
> +
> +#define AT91_ADC_ACR 0x94 /* Analog Control Register */
> +#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
> +
> +#define AT91_ADC_TSMR 0xB0
> +#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
> +#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
> +#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
> +#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
> +#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
> +#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
> +#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
> +#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
> +#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
> +#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
> +#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
> +#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
> +
> +#define AT91_ADC_TSXPOSR 0xB4
> +#define AT91_ADC_TSYPOSR 0xB8
> +#define AT91_ADC_TSPRESSR 0xBC
> +
> +#define AT91_ADC_TRGR_9260 AT91_ADC_MR
> +#define AT91_ADC_TRGR_9G45 0x08
> +#define AT91_ADC_TRGR_9X5 0xC0
> +
> +/* Trigger Register bit field */
> +#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> +#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> +#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> +#define AT91_ADC_TRGR_NONE (0 << 0)
> +#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
>
> #define AT91_ADC_CHAN(st, ch) \
> (st->registers->channel_base + (ch * 4))
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 06/15] iio: adc: at91: remove unused include from include/mach
@ 2014-03-22 12:34 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: linux-arm-kernel
On 17/03/14 13:56, Alexandre Belloni wrote:
> That include file is now only used by the at91_adc driver, remove it from
> include/mach for better driver separation.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> arch/arm/mach-at91/include/mach/at91_adc.h | 120 -----------------------------
> drivers/iio/adc/at91_adc.c | 103 ++++++++++++++++++++++++-
> 2 files changed, 102 insertions(+), 121 deletions(-)
> delete mode 100644 arch/arm/mach-at91/include/mach/at91_adc.h
>
> diff --git a/arch/arm/mach-at91/include/mach/at91_adc.h b/arch/arm/mach-at91/include/mach/at91_adc.h
> deleted file mode 100644
> index 7d80396346b2..000000000000
> --- a/arch/arm/mach-at91/include/mach/at91_adc.h
> +++ /dev/null
> @@ -1,120 +0,0 @@
> -/*
> - * arch/arm/mach-at91/include/mach/at91_adc.h
> - *
> - * Copyright (C) SAN People
> - *
> - * Analog-to-Digital Converter (ADC) registers.
> - * Based on AT91SAM9260 datasheet revision D.
> - *
> - * 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.
> - */
> -
> -#ifndef AT91_ADC_H
> -#define AT91_ADC_H
> -
> -#define AT91_ADC_CR 0x00 /* Control Register */
> -#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
> -#define AT91_ADC_START (1 << 1) /* Start Conversion */
> -
> -#define AT91_ADC_MR 0x04 /* Mode Register */
> -#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> -#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> -#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> -#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> -#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> -#define AT91_ADC_TRGSEL_TC0 (0 << 1)
> -#define AT91_ADC_TRGSEL_TC1 (1 << 1)
> -#define AT91_ADC_TRGSEL_TC2 (2 << 1)
> -#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> -#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> -#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> -#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> -#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> -#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> -#define AT91_ADC_PRESCAL_(x) ((x) << 8)
> -#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
> -#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
> -#define AT91_ADC_STARTUP_9X5 (0xf << 16)
> -#define AT91_ADC_STARTUP_(x) ((x) << 16)
> -#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> -#define AT91_ADC_SHTIM_(x) ((x) << 24)
> -#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> -#define AT91_ADC_PENDBC_(x) ((x) << 28)
> -
> -#define AT91_ADC_TSR 0x0C
> -#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> -#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
> -
> -#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> -#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> -#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
> -#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
> -
> -#define AT91_ADC_SR 0x1C /* Status Register */
> -#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
> -#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
> -#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
> -#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
> -#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
> -#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
> -
> -#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
> -#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
> -
> -#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
> -#define AT91_ADC_LDATA (0x3ff)
> -
> -#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> -#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> -#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> -#define AT91RL_ADC_IER_PEN (1 << 20)
> -#define AT91RL_ADC_IER_NOPEN (1 << 21)
> -#define AT91_ADC_IER_PEN (1 << 29)
> -#define AT91_ADC_IER_NOPEN (1 << 30)
> -#define AT91_ADC_IER_XRDY (1 << 20)
> -#define AT91_ADC_IER_YRDY (1 << 21)
> -#define AT91_ADC_IER_PRDY (1 << 22)
> -#define AT91_ADC_ISR_PENS (1 << 31)
> -
> -#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
> -#define AT91_ADC_DATA (0x3ff)
> -
> -#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
> -
> -#define AT91_ADC_ACR 0x94 /* Analog Control Register */
> -#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
> -
> -#define AT91_ADC_TSMR 0xB0
> -#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
> -#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
> -#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
> -#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
> -#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
> -#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
> -#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
> -#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
> -#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
> -#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
> -#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
> -#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
> -#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
> -
> -#define AT91_ADC_TSXPOSR 0xB4
> -#define AT91_ADC_TSYPOSR 0xB8
> -#define AT91_ADC_TSPRESSR 0xBC
> -
> -#define AT91_ADC_TRGR_9260 AT91_ADC_MR
> -#define AT91_ADC_TRGR_9G45 0x08
> -#define AT91_ADC_TRGR_9X5 0xC0
> -
> -/* Trigger Register bit field */
> -#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> -#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> -#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> -#define AT91_ADC_TRGR_NONE (0 << 0)
> -#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
> -
> -#endif
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index c0e4206e34e5..a51b8badbf8e 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -31,7 +31,108 @@
> #include <linux/iio/trigger_consumer.h>
> #include <linux/iio/triggered_buffer.h>
>
> -#include <mach/at91_adc.h>
> +/* Registers */
> +#define AT91_ADC_CR 0x00 /* Control Register */
> +#define AT91_ADC_SWRST (1 << 0) /* Software Reset */
> +#define AT91_ADC_START (1 << 1) /* Start Conversion */
> +
> +#define AT91_ADC_MR 0x04 /* Mode Register */
> +#define AT91_ADC_TSAMOD (3 << 0) /* ADC mode */
> +#define AT91_ADC_TSAMOD_ADC_ONLY_MODE (0 << 0) /* ADC Mode */
> +#define AT91_ADC_TSAMOD_TS_ONLY_MODE (1 << 0) /* Touch Screen Only Mode */
> +#define AT91_ADC_TRGEN (1 << 0) /* Trigger Enable */
> +#define AT91_ADC_TRGSEL (7 << 1) /* Trigger Selection */
> +#define AT91_ADC_TRGSEL_TC0 (0 << 1)
> +#define AT91_ADC_TRGSEL_TC1 (1 << 1)
> +#define AT91_ADC_TRGSEL_TC2 (2 << 1)
> +#define AT91_ADC_TRGSEL_EXTERNAL (6 << 1)
> +#define AT91_ADC_LOWRES (1 << 4) /* Low Resolution */
> +#define AT91_ADC_SLEEP (1 << 5) /* Sleep Mode */
> +#define AT91_ADC_PENDET (1 << 6) /* Pen contact detection enable */
> +#define AT91_ADC_PRESCAL_9260 (0x3f << 8) /* Prescalar Rate Selection */
> +#define AT91_ADC_PRESCAL_9G45 (0xff << 8)
> +#define AT91_ADC_PRESCAL_(x) ((x) << 8)
> +#define AT91_ADC_STARTUP_9260 (0x1f << 16) /* Startup Up Time */
> +#define AT91_ADC_STARTUP_9G45 (0x7f << 16)
> +#define AT91_ADC_STARTUP_9X5 (0xf << 16)
> +#define AT91_ADC_STARTUP_(x) ((x) << 16)
> +#define AT91_ADC_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_SHTIM_(x) ((x) << 24)
> +#define AT91_ADC_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_PENDBC_(x) ((x) << 28)
> +
> +#define AT91_ADC_TSR 0x0C
> +#define AT91_ADC_TSR_SHTIM (0xf << 24) /* Sample & Hold Time */
> +#define AT91_ADC_TSR_SHTIM_(x) ((x) << 24)
> +
> +#define AT91_ADC_CHER 0x10 /* Channel Enable Register */
> +#define AT91_ADC_CHDR 0x14 /* Channel Disable Register */
> +#define AT91_ADC_CHSR 0x18 /* Channel Status Register */
> +#define AT91_ADC_CH(n) (1 << (n)) /* Channel Number */
> +
> +#define AT91_ADC_SR 0x1C /* Status Register */
> +#define AT91_ADC_EOC(n) (1 << (n)) /* End of Conversion on Channel N */
> +#define AT91_ADC_OVRE(n) (1 << ((n) + 8))/* Overrun Error on Channel N */
> +#define AT91_ADC_DRDY (1 << 16) /* Data Ready */
> +#define AT91_ADC_GOVRE (1 << 17) /* General Overrun Error */
> +#define AT91_ADC_ENDRX (1 << 18) /* End of RX Buffer */
> +#define AT91_ADC_RXFUFF (1 << 19) /* RX Buffer Full */
> +
> +#define AT91_ADC_SR_9X5 0x30 /* Status Register for 9x5 */
> +#define AT91_ADC_SR_DRDY_9X5 (1 << 24) /* Data Ready */
> +
> +#define AT91_ADC_LCDR 0x20 /* Last Converted Data Register */
> +#define AT91_ADC_LDATA (0x3ff)
> +
> +#define AT91_ADC_IER 0x24 /* Interrupt Enable Register */
> +#define AT91_ADC_IDR 0x28 /* Interrupt Disable Register */
> +#define AT91_ADC_IMR 0x2C /* Interrupt Mask Register */
> +#define AT91RL_ADC_IER_PEN (1 << 20)
> +#define AT91RL_ADC_IER_NOPEN (1 << 21)
> +#define AT91_ADC_IER_PEN (1 << 29)
> +#define AT91_ADC_IER_NOPEN (1 << 30)
> +#define AT91_ADC_IER_XRDY (1 << 20)
> +#define AT91_ADC_IER_YRDY (1 << 21)
> +#define AT91_ADC_IER_PRDY (1 << 22)
> +#define AT91_ADC_ISR_PENS (1 << 31)
> +
> +#define AT91_ADC_CHR(n) (0x30 + ((n) * 4)) /* Channel Data Register N */
> +#define AT91_ADC_DATA (0x3ff)
> +
> +#define AT91_ADC_CDR0_9X5 (0x50) /* Channel Data Register 0 for 9X5 */
> +
> +#define AT91_ADC_ACR 0x94 /* Analog Control Register */
> +#define AT91_ADC_ACR_PENDETSENS (0x3 << 0) /* pull-up resistor */
> +
> +#define AT91_ADC_TSMR 0xB0
> +#define AT91_ADC_TSMR_TSMODE (3 << 0) /* Touch Screen Mode */
> +#define AT91_ADC_TSMR_TSMODE_NONE (0 << 0)
> +#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS (1 << 0)
> +#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS (2 << 0)
> +#define AT91_ADC_TSMR_TSMODE_5WIRE (3 << 0)
> +#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
> +#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
> +#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
> +#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
> +#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
> +#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
> +#define AT91_ADC_TSMR_PENDET_DIS (0 << 24) /* Pen contact detection disable */
> +#define AT91_ADC_TSMR_PENDET_ENA (1 << 24) /* Pen contact detection enable */
> +
> +#define AT91_ADC_TSXPOSR 0xB4
> +#define AT91_ADC_TSYPOSR 0xB8
> +#define AT91_ADC_TSPRESSR 0xBC
> +
> +#define AT91_ADC_TRGR_9260 AT91_ADC_MR
> +#define AT91_ADC_TRGR_9G45 0x08
> +#define AT91_ADC_TRGR_9X5 0xC0
> +
> +/* Trigger Register bit field */
> +#define AT91_ADC_TRGR_TRGPER (0xffff << 16)
> +#define AT91_ADC_TRGR_TRGPER_(x) ((x) << 16)
> +#define AT91_ADC_TRGR_TRGMOD (0x7 << 0)
> +#define AT91_ADC_TRGR_NONE (0 << 0)
> +#define AT91_ADC_TRGR_MOD_PERIOD_TRIG (5 << 0)
>
> #define AT91_ADC_CHAN(st, ch) \
> (st->registers->channel_base + (ch * 4))
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 07/15] iio: adc: at91: add sam9rl support
@ 2014-03-22 12:34 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On 17/03/14 13:57, Alexandre Belloni wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/adc/at91_adc.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index a51b8badbf8e..3b5bacd4d8da 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -1346,6 +1346,20 @@ static struct at91_adc_caps at91sam9260_caps = {
> },
> };
>
> +static struct at91_adc_caps at91sam9rl_caps = {
> + .has_ts = true,
> + .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
> + .num_channels = 6,
> + .registers = {
> + .channel_base = AT91_ADC_CHR(0),
> + .drdy_mask = AT91_ADC_DRDY,
> + .status_register = AT91_ADC_SR,
> + .trigger_register = AT91_ADC_TRGR_9G45,
> + .mr_prescal_mask = AT91_ADC_PRESCAL_9260,
> + .mr_startup_mask = AT91_ADC_STARTUP_9G45,
> + },
> +};
> +
> static struct at91_adc_caps at91sam9g45_caps = {
> .has_ts = true,
> .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
> @@ -1380,6 +1394,7 @@ static struct at91_adc_caps at91sam9x5_caps = {
>
> static const struct of_device_id at91_adc_dt_ids[] = {
> { .compatible = "atmel,at91sam9260-adc", .data = &at91sam9260_caps },
> + { .compatible = "atmel,at91sam9rl-adc", .data = &at91sam9rl_caps },
> { .compatible = "atmel,at91sam9g45-adc", .data = &at91sam9g45_caps },
> { .compatible = "atmel,at91sam9x5-adc", .data = &at91sam9x5_caps },
> {},
> @@ -1391,6 +1406,9 @@ static const struct platform_device_id at91_adc_ids[] = {
> .name = "at91sam9260-adc",
> .driver_data = (unsigned long)&at91sam9260_caps,
> }, {
> + .name = "at91sam9rl-adc",
> + .driver_data = (unsigned long)&at91sam9rl_caps,
> + }, {
> .name = "at91sam9g45-adc",
> .driver_data = (unsigned long)&at91sam9g45_caps,
> }, {
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 07/15] iio: adc: at91: add sam9rl support
@ 2014-03-22 12:34 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement
On 17/03/14 13:57, Alexandre Belloni wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Acked-by: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> drivers/iio/adc/at91_adc.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index a51b8badbf8e..3b5bacd4d8da 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -1346,6 +1346,20 @@ static struct at91_adc_caps at91sam9260_caps = {
> },
> };
>
> +static struct at91_adc_caps at91sam9rl_caps = {
> + .has_ts = true,
> + .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
> + .num_channels = 6,
> + .registers = {
> + .channel_base = AT91_ADC_CHR(0),
> + .drdy_mask = AT91_ADC_DRDY,
> + .status_register = AT91_ADC_SR,
> + .trigger_register = AT91_ADC_TRGR_9G45,
> + .mr_prescal_mask = AT91_ADC_PRESCAL_9260,
> + .mr_startup_mask = AT91_ADC_STARTUP_9G45,
> + },
> +};
> +
> static struct at91_adc_caps at91sam9g45_caps = {
> .has_ts = true,
> .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
> @@ -1380,6 +1394,7 @@ static struct at91_adc_caps at91sam9x5_caps = {
>
> static const struct of_device_id at91_adc_dt_ids[] = {
> { .compatible = "atmel,at91sam9260-adc", .data = &at91sam9260_caps },
> + { .compatible = "atmel,at91sam9rl-adc", .data = &at91sam9rl_caps },
> { .compatible = "atmel,at91sam9g45-adc", .data = &at91sam9g45_caps },
> { .compatible = "atmel,at91sam9x5-adc", .data = &at91sam9x5_caps },
> {},
> @@ -1391,6 +1406,9 @@ static const struct platform_device_id at91_adc_ids[] = {
> .name = "at91sam9260-adc",
> .driver_data = (unsigned long)&at91sam9260_caps,
> }, {
> + .name = "at91sam9rl-adc",
> + .driver_data = (unsigned long)&at91sam9rl_caps,
> + }, {
> .name = "at91sam9g45-adc",
> .driver_data = (unsigned long)&at91sam9g45_caps,
> }, {
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 07/15] iio: adc: at91: add sam9rl support
@ 2014-03-22 12:34 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:34 UTC (permalink / raw)
To: linux-arm-kernel
On 17/03/14 13:57, Alexandre Belloni wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/adc/at91_adc.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index a51b8badbf8e..3b5bacd4d8da 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -1346,6 +1346,20 @@ static struct at91_adc_caps at91sam9260_caps = {
> },
> };
>
> +static struct at91_adc_caps at91sam9rl_caps = {
> + .has_ts = true,
> + .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
> + .num_channels = 6,
> + .registers = {
> + .channel_base = AT91_ADC_CHR(0),
> + .drdy_mask = AT91_ADC_DRDY,
> + .status_register = AT91_ADC_SR,
> + .trigger_register = AT91_ADC_TRGR_9G45,
> + .mr_prescal_mask = AT91_ADC_PRESCAL_9260,
> + .mr_startup_mask = AT91_ADC_STARTUP_9G45,
> + },
> +};
> +
> static struct at91_adc_caps at91sam9g45_caps = {
> .has_ts = true,
> .calc_startup_ticks = calc_startup_ticks_9260, /* same as 9260 */
> @@ -1380,6 +1394,7 @@ static struct at91_adc_caps at91sam9x5_caps = {
>
> static const struct of_device_id at91_adc_dt_ids[] = {
> { .compatible = "atmel,at91sam9260-adc", .data = &at91sam9260_caps },
> + { .compatible = "atmel,at91sam9rl-adc", .data = &at91sam9rl_caps },
> { .compatible = "atmel,at91sam9g45-adc", .data = &at91sam9g45_caps },
> { .compatible = "atmel,at91sam9x5-adc", .data = &at91sam9x5_caps },
> {},
> @@ -1391,6 +1406,9 @@ static const struct platform_device_id at91_adc_ids[] = {
> .name = "at91sam9260-adc",
> .driver_data = (unsigned long)&at91sam9260_caps,
> }, {
> + .name = "at91sam9rl-adc",
> + .driver_data = (unsigned long)&at91sam9rl_caps,
> + }, {
> .name = "at91sam9g45-adc",
> .driver_data = (unsigned long)&at91sam9g45_caps,
> }, {
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
2014-03-17 13:57 ` Alexandre Belloni
@ 2014-03-22 12:35 ` Jonathan Cameron
-1 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:35 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On 17/03/14 13:57, Alexandre Belloni wrote:
> The ADC clock needs to be defined to enable the at91_adc driver. It is defined
> to the same speed that is used for atmel_tsadcc.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Looks good to me, but out of my area of expertise so I won't ack it.
> ---
> arch/arm/mach-at91/at91sam9rl.c | 7 +++
> arch/arm/mach-at91/at91sam9rl_devices.c | 85 +++++++++++++++++++++++++++++++++
> 2 files changed, 92 insertions(+)
>
> diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
> index 3651517abedf..753ba4893836 100644
> --- a/arch/arm/mach-at91/at91sam9rl.c
> +++ b/arch/arm/mach-at91/at91sam9rl.c
> @@ -151,6 +151,11 @@ static struct clk ac97_clk = {
> .pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
> .type = CLK_TYPE_PERIPHERAL,
> };
> +static struct clk adc_op_clk = {
> + .name = "adc_op_clk",
> + .type = CLK_TYPE_PERIPHERAL,
> + .rate_hz = 1000000,
> +};
>
> static struct clk *periph_clocks[] __initdata = {
> &pioA_clk,
> @@ -176,6 +181,7 @@ static struct clk *periph_clocks[] __initdata = {
> &udphs_clk,
> &lcdc_clk,
> &ac97_clk,
> + &adc_op_clk,
> // irq0
> };
>
> @@ -196,6 +202,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
> CLKDEV_CON_ID("pioB", &pioB_clk),
> CLKDEV_CON_ID("pioC", &pioC_clk),
> CLKDEV_CON_ID("pioD", &pioD_clk),
> + CLKDEV_CON_ID("adc_clk", &tsc_clk),
> };
>
> static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
> index a698bdab2cce..b836dada942c 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -22,6 +22,7 @@
> #include <mach/at91_matrix.h>
> #include <mach/at91sam9_smc.h>
> #include <linux/platform_data/dma-atmel.h>
> +#include <linux/platform_data/at91_adc.h>
>
> #include "board.h"
> #include "generic.h"
> @@ -656,6 +657,90 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
> void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
> #endif
>
> +/* --------------------------------------------------------------------
> + * ADC and Touchscreen
> + * -------------------------------------------------------------------- */
> +
> +#if IS_ENABLED(CONFIG_AT91_ADC)
> +static struct at91_adc_data adc_data;
> +
> +static struct resource adc_resources[] = {
> + [0] = {
> + .start = AT91SAM9RL_BASE_TSC,
> + .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
> + .flags = IORESOURCE_MEM,
> + },
> + [1] = {
> + .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
> + .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
> + .flags = IORESOURCE_IRQ,
> + }
> +};
> +
> +static struct platform_device at91_adc_device = {
> + .name = "at91sam9rl-adc",
> + .id = -1,
> + .dev = {
> + .platform_data = &adc_data,
> + },
> + .resource = adc_resources,
> + .num_resources = ARRAY_SIZE(adc_resources),
> +};
> +
> +static struct at91_adc_trigger at91_adc_triggers[] = {
> + [0] = {
> + .name = "external-rising",
> + .value = 1,
> + .is_external = true,
> + },
> + [1] = {
> + .name = "external-falling",
> + .value = 2,
> + .is_external = true,
> + },
> + [2] = {
> + .name = "external-any",
> + .value = 3,
> + .is_external = true,
> + },
> + [3] = {
> + .name = "continuous",
> + .value = 6,
> + .is_external = false,
> + },
> +};
> +
> +void __init at91_add_device_adc(struct at91_adc_data *data)
> +{
> + if (!data)
> + return;
> +
> + if (test_bit(0, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA17, 0);
> + if (test_bit(1, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA18, 0);
> + if (test_bit(2, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA19, 0);
> + if (test_bit(3, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA20, 0);
> + if (test_bit(4, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PD6, 0);
> + if (test_bit(5, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PD7, 0);
> +
> + if (data->use_external_triggers)
> + at91_set_A_periph(AT91_PIN_PB15, 0);
> +
> + data->startup_time = 40;
> + data->trigger_number = 4;
> + data->trigger_list = at91_adc_triggers;
> +
> + adc_data = *data;
> + platform_device_register(&at91_adc_device);
> +}
> +#else
> +void __init at91_add_device_adc(struct at91_adc_data *data) {}
> +#endif
>
> /* --------------------------------------------------------------------
> * RTC
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
@ 2014-03-22 12:35 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:35 UTC (permalink / raw)
To: linux-arm-kernel
On 17/03/14 13:57, Alexandre Belloni wrote:
> The ADC clock needs to be defined to enable the at91_adc driver. It is defined
> to the same speed that is used for atmel_tsadcc.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Looks good to me, but out of my area of expertise so I won't ack it.
> ---
> arch/arm/mach-at91/at91sam9rl.c | 7 +++
> arch/arm/mach-at91/at91sam9rl_devices.c | 85 +++++++++++++++++++++++++++++++++
> 2 files changed, 92 insertions(+)
>
> diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
> index 3651517abedf..753ba4893836 100644
> --- a/arch/arm/mach-at91/at91sam9rl.c
> +++ b/arch/arm/mach-at91/at91sam9rl.c
> @@ -151,6 +151,11 @@ static struct clk ac97_clk = {
> .pmc_mask = 1 << AT91SAM9RL_ID_AC97C,
> .type = CLK_TYPE_PERIPHERAL,
> };
> +static struct clk adc_op_clk = {
> + .name = "adc_op_clk",
> + .type = CLK_TYPE_PERIPHERAL,
> + .rate_hz = 1000000,
> +};
>
> static struct clk *periph_clocks[] __initdata = {
> &pioA_clk,
> @@ -176,6 +181,7 @@ static struct clk *periph_clocks[] __initdata = {
> &udphs_clk,
> &lcdc_clk,
> &ac97_clk,
> + &adc_op_clk,
> // irq0
> };
>
> @@ -196,6 +202,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
> CLKDEV_CON_ID("pioB", &pioB_clk),
> CLKDEV_CON_ID("pioC", &pioC_clk),
> CLKDEV_CON_ID("pioD", &pioD_clk),
> + CLKDEV_CON_ID("adc_clk", &tsc_clk),
> };
>
> static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
> index a698bdab2cce..b836dada942c 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -22,6 +22,7 @@
> #include <mach/at91_matrix.h>
> #include <mach/at91sam9_smc.h>
> #include <linux/platform_data/dma-atmel.h>
> +#include <linux/platform_data/at91_adc.h>
>
> #include "board.h"
> #include "generic.h"
> @@ -656,6 +657,90 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data)
> void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
> #endif
>
> +/* --------------------------------------------------------------------
> + * ADC and Touchscreen
> + * -------------------------------------------------------------------- */
> +
> +#if IS_ENABLED(CONFIG_AT91_ADC)
> +static struct at91_adc_data adc_data;
> +
> +static struct resource adc_resources[] = {
> + [0] = {
> + .start = AT91SAM9RL_BASE_TSC,
> + .end = AT91SAM9RL_BASE_TSC + SZ_16K - 1,
> + .flags = IORESOURCE_MEM,
> + },
> + [1] = {
> + .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
> + .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC,
> + .flags = IORESOURCE_IRQ,
> + }
> +};
> +
> +static struct platform_device at91_adc_device = {
> + .name = "at91sam9rl-adc",
> + .id = -1,
> + .dev = {
> + .platform_data = &adc_data,
> + },
> + .resource = adc_resources,
> + .num_resources = ARRAY_SIZE(adc_resources),
> +};
> +
> +static struct at91_adc_trigger at91_adc_triggers[] = {
> + [0] = {
> + .name = "external-rising",
> + .value = 1,
> + .is_external = true,
> + },
> + [1] = {
> + .name = "external-falling",
> + .value = 2,
> + .is_external = true,
> + },
> + [2] = {
> + .name = "external-any",
> + .value = 3,
> + .is_external = true,
> + },
> + [3] = {
> + .name = "continuous",
> + .value = 6,
> + .is_external = false,
> + },
> +};
> +
> +void __init at91_add_device_adc(struct at91_adc_data *data)
> +{
> + if (!data)
> + return;
> +
> + if (test_bit(0, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA17, 0);
> + if (test_bit(1, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA18, 0);
> + if (test_bit(2, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA19, 0);
> + if (test_bit(3, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PA20, 0);
> + if (test_bit(4, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PD6, 0);
> + if (test_bit(5, &data->channels_used))
> + at91_set_A_periph(AT91_PIN_PD7, 0);
> +
> + if (data->use_external_triggers)
> + at91_set_A_periph(AT91_PIN_PB15, 0);
> +
> + data->startup_time = 40;
> + data->trigger_number = 4;
> + data->trigger_list = at91_adc_triggers;
> +
> + adc_data = *data;
> + platform_device_register(&at91_adc_device);
> +}
> +#else
> +void __init at91_add_device_adc(struct at91_adc_data *data) {}
> +#endif
>
> /* --------------------------------------------------------------------
> * RTC
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-22 12:39 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:39 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On 17/03/14 13:57, Alexandre Belloni wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
See below.
> ---
> arch/arm/mach-at91/board.h | 3 ---
> include/linux/platform_data/atmel.h | 7 -------
> 2 files changed, 10 deletions(-)
>
> diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
> index 6c08b341167d..4e773b55bc2d 100644
> --- a/arch/arm/mach-at91/board.h
> +++ b/arch/arm/mach-at91/board.h
> @@ -118,9 +118,6 @@ struct isi_platform_data;
> extern void __init at91_add_device_isi(struct isi_platform_data *data,
> bool use_pck_as_mck);
>
> - /* Touchscreen Controller */
> -extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
> -
> /* CAN */
> extern void __init at91_add_device_can(struct at91_can_data *data);
>
> diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
> index cea9f70133c5..4b452c6a2f7b 100644
> --- a/include/linux/platform_data/atmel.h
> +++ b/include/linux/platform_data/atmel.h
> @@ -86,13 +86,6 @@ struct atmel_uart_data {
> struct serial_rs485 rs485; /* rs485 settings */
> };
>
> - /* Touchscreen Controller */
> -struct at91_tsadcc_data {
> - unsigned int adc_clock;
> - u8 pendet_debounce;
> - u8 ts_sample_hold_time;
> -};
> -
I believe this is still in use in the driver you don't remove until patch 14.
Probably best to reorder the patches...
> /* CAN */
> struct at91_can_data {
> void (*transceiver_switch)(int on);
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-22 12:39 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:39 UTC (permalink / raw)
To: Alexandre Belloni, Nicolas Ferre, Dmitry Torokhov
Cc: Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement
On 17/03/14 13:57, Alexandre Belloni wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
See below.
> ---
> arch/arm/mach-at91/board.h | 3 ---
> include/linux/platform_data/atmel.h | 7 -------
> 2 files changed, 10 deletions(-)
>
> diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
> index 6c08b341167d..4e773b55bc2d 100644
> --- a/arch/arm/mach-at91/board.h
> +++ b/arch/arm/mach-at91/board.h
> @@ -118,9 +118,6 @@ struct isi_platform_data;
> extern void __init at91_add_device_isi(struct isi_platform_data *data,
> bool use_pck_as_mck);
>
> - /* Touchscreen Controller */
> -extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
> -
> /* CAN */
> extern void __init at91_add_device_can(struct at91_can_data *data);
>
> diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
> index cea9f70133c5..4b452c6a2f7b 100644
> --- a/include/linux/platform_data/atmel.h
> +++ b/include/linux/platform_data/atmel.h
> @@ -86,13 +86,6 @@ struct atmel_uart_data {
> struct serial_rs485 rs485; /* rs485 settings */
> };
>
> - /* Touchscreen Controller */
> -struct at91_tsadcc_data {
> - unsigned int adc_clock;
> - u8 pendet_debounce;
> - u8 ts_sample_hold_time;
> -};
> -
I believe this is still in use in the driver you don't remove until patch 14.
Probably best to reorder the patches...
> /* CAN */
> struct at91_can_data {
> void (*transceiver_switch)(int on);
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-22 12:39 ` Jonathan Cameron
0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2014-03-22 12:39 UTC (permalink / raw)
To: linux-arm-kernel
On 17/03/14 13:57, Alexandre Belloni wrote:
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
See below.
> ---
> arch/arm/mach-at91/board.h | 3 ---
> include/linux/platform_data/atmel.h | 7 -------
> 2 files changed, 10 deletions(-)
>
> diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
> index 6c08b341167d..4e773b55bc2d 100644
> --- a/arch/arm/mach-at91/board.h
> +++ b/arch/arm/mach-at91/board.h
> @@ -118,9 +118,6 @@ struct isi_platform_data;
> extern void __init at91_add_device_isi(struct isi_platform_data *data,
> bool use_pck_as_mck);
>
> - /* Touchscreen Controller */
> -extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
> -
> /* CAN */
> extern void __init at91_add_device_can(struct at91_can_data *data);
>
> diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
> index cea9f70133c5..4b452c6a2f7b 100644
> --- a/include/linux/platform_data/atmel.h
> +++ b/include/linux/platform_data/atmel.h
> @@ -86,13 +86,6 @@ struct atmel_uart_data {
> struct serial_rs485 rs485; /* rs485 settings */
> };
>
> - /* Touchscreen Controller */
> -struct at91_tsadcc_data {
> - unsigned int adc_clock;
> - u8 pendet_debounce;
> - u8 ts_sample_hold_time;
> -};
> -
I believe this is still in use in the driver you don't remove until patch 14.
Probably best to reorder the patches...
> /* CAN */
> struct at91_can_data {
> void (*transceiver_switch)(int on);
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-24 9:46 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-24 9:46 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Jonathan Cameron, Dmitry Torokhov,
Jean-Christophe Plagniol-Villard, linux-kernel, linux-arm-kernel,
linux-iio, linux-input, Maxime Ripard, Gregory Clement
On 22/03/2014 at 12:39:16 +0000, Jonathan Cameron wrote :
> On 17/03/14 13:57, Alexandre Belloni wrote:
> >Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> See below.
> >---
> > arch/arm/mach-at91/board.h | 3 ---
> > include/linux/platform_data/atmel.h | 7 -------
> > 2 files changed, 10 deletions(-)
> >
> >diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
> >index 6c08b341167d..4e773b55bc2d 100644
> >--- a/arch/arm/mach-at91/board.h
> >+++ b/arch/arm/mach-at91/board.h
> >@@ -118,9 +118,6 @@ struct isi_platform_data;
> > extern void __init at91_add_device_isi(struct isi_platform_data *data,
> > bool use_pck_as_mck);
> >
> >- /* Touchscreen Controller */
> >-extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
> >-
> > /* CAN */
> > extern void __init at91_add_device_can(struct at91_can_data *data);
> >
> >diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
> >index cea9f70133c5..4b452c6a2f7b 100644
> >--- a/include/linux/platform_data/atmel.h
> >+++ b/include/linux/platform_data/atmel.h
> >@@ -86,13 +86,6 @@ struct atmel_uart_data {
> > struct serial_rs485 rs485; /* rs485 settings */
> > };
> >
> >- /* Touchscreen Controller */
> >-struct at91_tsadcc_data {
> >- unsigned int adc_clock;
> >- u8 pendet_debounce;
> >- u8 ts_sample_hold_time;
> >-};
> >-
> I believe this is still in use in the driver you don't remove until patch 14.
>
> Probably best to reorder the patches...
Indeed, you are right.
Nicolas, do you take care of that or should I send a v3 ?
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-24 9:46 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-24 9:46 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Jonathan Cameron, Dmitry Torokhov,
Jean-Christophe Plagniol-Villard,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard,
Gregory Clement
On 22/03/2014 at 12:39:16 +0000, Jonathan Cameron wrote :
> On 17/03/14 13:57, Alexandre Belloni wrote:
> >Signed-off-by: Alexandre Belloni <alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> See below.
> >---
> > arch/arm/mach-at91/board.h | 3 ---
> > include/linux/platform_data/atmel.h | 7 -------
> > 2 files changed, 10 deletions(-)
> >
> >diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
> >index 6c08b341167d..4e773b55bc2d 100644
> >--- a/arch/arm/mach-at91/board.h
> >+++ b/arch/arm/mach-at91/board.h
> >@@ -118,9 +118,6 @@ struct isi_platform_data;
> > extern void __init at91_add_device_isi(struct isi_platform_data *data,
> > bool use_pck_as_mck);
> >
> >- /* Touchscreen Controller */
> >-extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
> >-
> > /* CAN */
> > extern void __init at91_add_device_can(struct at91_can_data *data);
> >
> >diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
> >index cea9f70133c5..4b452c6a2f7b 100644
> >--- a/include/linux/platform_data/atmel.h
> >+++ b/include/linux/platform_data/atmel.h
> >@@ -86,13 +86,6 @@ struct atmel_uart_data {
> > struct serial_rs485 rs485; /* rs485 settings */
> > };
> >
> >- /* Touchscreen Controller */
> >-struct at91_tsadcc_data {
> >- unsigned int adc_clock;
> >- u8 pendet_debounce;
> >- u8 ts_sample_hold_time;
> >-};
> >-
> I believe this is still in use in the driver you don't remove until patch 14.
>
> Probably best to reorder the patches...
Indeed, you are right.
Nicolas, do you take care of that or should I send a v3 ?
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data
@ 2014-03-24 9:46 ` Alexandre Belloni
0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2014-03-24 9:46 UTC (permalink / raw)
To: linux-arm-kernel
On 22/03/2014 at 12:39:16 +0000, Jonathan Cameron wrote :
> On 17/03/14 13:57, Alexandre Belloni wrote:
> >Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> See below.
> >---
> > arch/arm/mach-at91/board.h | 3 ---
> > include/linux/platform_data/atmel.h | 7 -------
> > 2 files changed, 10 deletions(-)
> >
> >diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
> >index 6c08b341167d..4e773b55bc2d 100644
> >--- a/arch/arm/mach-at91/board.h
> >+++ b/arch/arm/mach-at91/board.h
> >@@ -118,9 +118,6 @@ struct isi_platform_data;
> > extern void __init at91_add_device_isi(struct isi_platform_data *data,
> > bool use_pck_as_mck);
> >
> >- /* Touchscreen Controller */
> >-extern void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data);
> >-
> > /* CAN */
> > extern void __init at91_add_device_can(struct at91_can_data *data);
> >
> >diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
> >index cea9f70133c5..4b452c6a2f7b 100644
> >--- a/include/linux/platform_data/atmel.h
> >+++ b/include/linux/platform_data/atmel.h
> >@@ -86,13 +86,6 @@ struct atmel_uart_data {
> > struct serial_rs485 rs485; /* rs485 settings */
> > };
> >
> >- /* Touchscreen Controller */
> >-struct at91_tsadcc_data {
> >- unsigned int adc_clock;
> >- u8 pendet_debounce;
> >- u8 ts_sample_hold_time;
> >-};
> >-
> I believe this is still in use in the driver you don't remove until patch 14.
>
> Probably best to reorder the patches...
Indeed, you are right.
Nicolas, do you take care of that or should I send a v3 ?
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 60+ messages in thread
end of thread, other threads:[~2014-03-24 9:46 UTC | newest]
Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-17 13:56 [PATCH v2 00/15] iio: adc: at91 cleanups and atmel_tsadcc removal Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-17 13:56 ` [PATCH v2 01/15] ARM: at91: sam9g45: remove unused platform_data Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-17 13:56 ` [PATCH v2 02/15] ARM: at91: sam9260: " Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-17 13:56 ` [PATCH v2 03/15] iio: adc: at91: cleanup platform_data Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-17 13:56 ` [PATCH v2 04/15] iio: adc: at91_adc: Add support for touchscreens without TSMR Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-22 12:33 ` Jonathan Cameron
2014-03-22 12:33 ` Jonathan Cameron
2014-03-17 13:56 ` [PATCH v2 05/15] ARM: at91: sam9m10g45ek: Add touchscreen support through at91_adc Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-22 12:34 ` Jonathan Cameron
2014-03-22 12:34 ` Jonathan Cameron
2014-03-17 13:56 ` [PATCH v2 06/15] iio: adc: at91: remove unused include from include/mach Alexandre Belloni
2014-03-17 13:56 ` Alexandre Belloni
2014-03-22 12:34 ` Jonathan Cameron
2014-03-22 12:34 ` Jonathan Cameron
2014-03-22 12:34 ` Jonathan Cameron
2014-03-17 13:57 ` [PATCH v2 07/15] iio: adc: at91: add sam9rl support Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-22 12:34 ` Jonathan Cameron
2014-03-22 12:34 ` Jonathan Cameron
2014-03-22 12:34 ` Jonathan Cameron
2014-03-17 13:57 ` [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-22 12:35 ` Jonathan Cameron
2014-03-22 12:35 ` Jonathan Cameron
2014-03-17 13:57 ` [PATCH v2 09/15] ARM: at91: sam9rlek add touchscreen support through at91_adc Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` [PATCH v2 10/15] ARM: at91: sam9g45: switch from atmel_tsadcc to at91_adc Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` [PATCH v2 11/15] ARM: at91: sam9rl: " Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` [PATCH v2 12/15] ARM: at91: remove atmel_tsadcc platform_data Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-22 12:39 ` Jonathan Cameron
2014-03-22 12:39 ` Jonathan Cameron
2014-03-22 12:39 ` Jonathan Cameron
2014-03-24 9:46 ` Alexandre Belloni
2014-03-24 9:46 ` Alexandre Belloni
2014-03-24 9:46 ` Alexandre Belloni
2014-03-17 13:57 ` [PATCH v2 13/15] ARM: at91: remove atmel_tsadcc from sama5_defconfig Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` [PATCH v2 14/15] Input: atmel_tsadcc: remove driver Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 13:57 ` [PATCH v2 15/15] ARM: at91/dt: at91-cosino_mega2560 remove useless tsadcc node Alexandre Belloni
2014-03-17 13:57 ` Alexandre Belloni
2014-03-17 14:00 ` Rodolfo Giometti
2014-03-17 14:00 ` Rodolfo Giometti
2014-03-17 14:00 ` Rodolfo Giometti
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.