From: Jonathan Cameron <jic23@kernel.org>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org,
linux-input@vger.kernel.org,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Gregory Clement <gregory.clement@free-electrons.com>
Subject: Re: [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
Date: Sat, 22 Mar 2014 12:35:25 +0000 [thread overview]
Message-ID: <532D838D.9050603@kernel.org> (raw)
In-Reply-To: <1395064628-644-9-git-send-email-alexandre.belloni@free-electrons.com>
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
>
WARNING: multiple messages have this Message-ID (diff)
From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 08/15] ARM: at91: sam9rl: add at91_adc to support adc and touchscreen
Date: Sat, 22 Mar 2014 12:35:25 +0000 [thread overview]
Message-ID: <532D838D.9050603@kernel.org> (raw)
In-Reply-To: <1395064628-644-9-git-send-email-alexandre.belloni@free-electrons.com>
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
>
next prev parent reply other threads:[~2014-03-22 12:34 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
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
[not found] ` <1395064628-644-7-git-send-email-alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
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
[not found] ` <1395064628-644-8-git-send-email-alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
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 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
[not found] ` <1395064628-644-1-git-send-email-alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
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 [this message]
2014-03-22 12:35 ` Jonathan Cameron
2014-03-17 13:57 ` [PATCH v2 11/15] ARM: at91: sam9rl: switch from atmel_tsadcc to at91_adc 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
[not found] ` <1395064628-644-13-git-send-email-alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-22 12:39 ` Jonathan Cameron
2014-03-22 12:39 ` Jonathan Cameron
2014-03-22 12:39 ` Jonathan Cameron
[not found] ` <532D8474.8020601-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
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
[not found] ` <1395064628-644-16-git-send-email-alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-17 14:00 ` Rodolfo Giometti
2014-03-17 14:00 ` Rodolfo Giometti
2014-03-17 14:00 ` Rodolfo Giometti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532D838D.9050603@kernel.org \
--to=jic23@kernel.org \
--cc=alexandre.belloni@free-electrons.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregory.clement@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.