From: Jonathan Cameron <jic23@kernel.org>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
Patrice Vilchez <patrice.vilchez@atmel.com>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: Re: [PATCH 4/6] IIO: AT91: ADC: Add support for the AT91SAM9M10G45-EK board
Date: Wed, 18 Apr 2012 18:57:09 +0100 [thread overview]
Message-ID: <4F8F0075.9010303@kernel.org> (raw)
In-Reply-To: <1334756036-15944-5-git-send-email-maxime.ripard@free-electrons.com>
On 04/18/2012 02:33 PM, Maxime Ripard wrote:
> This patch adds the necessary logic and the required platform_data to
> support the ADC present in the AT91SAM9M10G45-EK board from Atmel. It
> only supports software triggers for now.
Same possible issue as with the other one... Actually, not sure why
I acked that given I know very little about the particular platform.
Hence I'm fine with these, but not really for me to say whether they
are good!
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>
> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> arch/arm/mach-at91/at91sam9g45.c | 2 +
> arch/arm/mach-at91/at91sam9g45_devices.c | 61 ++++++++++++++++++++++++++++++
> arch/arm/mach-at91/board-sam9m10g45ek.c | 11 +++++
> drivers/staging/iio/adc/at91_adc.c | 11 +++++
> 4 files changed, 85 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
> index d222f83..c6c35bc 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -242,6 +242,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
> CLKDEV_CON_ID("pioC", &pioC_clk),
> CLKDEV_CON_ID("pioD", &pioDE_clk),
> CLKDEV_CON_ID("pioE", &pioDE_clk),
> + /* Fake adc clock */
> + CLKDEV_CON_ID("adc_clk", &tsc_clk),
> };
>
> static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index 6b008ae..05bc673 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -19,6 +19,8 @@
> #include <linux/i2c-gpio.h>
> #include <linux/atmel-mci.h>
>
> +#include <linux/platform_data/at91_adc.h>
> +
> #include <linux/fb.h>
> #include <video/atmel_lcdc.h>
>
> @@ -1207,6 +1209,65 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
>
>
> /* --------------------------------------------------------------------
> + * ADC
> + * -------------------------------------------------------------------- */
> +
> +#if defined(CONFIG_AT91_ADC) || defined(CONFIG_AT91_ADC_MODULE)
> +static struct at91_adc_data adc_data;
> +
> +static struct resource adc_resources[] = {
> + [0] = {
> + .start = AT91SAM9G45_BASE_TSC,
> + .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
> + .flags = IORESOURCE_MEM,
> + },
> + [1] = {
> + .start = AT91SAM9G45_ID_TSC,
> + .end = AT91SAM9G45_ID_TSC,
> + .flags = IORESOURCE_IRQ,
> + }
> +};
> +
> +static struct platform_device at91_adc_device = {
> + .name = "at91_adc",
> + .id = -1,
> + .dev = {
> + .platform_data = &adc_data,
> + },
> + .resource = adc_resources,
> + .num_resources = ARRAY_SIZE(adc_resources),
> +};
> +
> +void __init at91_add_device_adc(struct at91_adc_data *data)
> +{
> + if (!data)
> + return;
> +
> + if (test_bit(0, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD20, 0);
> + if (test_bit(1, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD21, 0);
> + if (test_bit(2, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD22, 0);
> + if (test_bit(3, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD23, 0);
> + if (test_bit(4, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD24, 0);
> + if (test_bit(5, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD25, 0);
> + if (test_bit(6, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD26, 0);
> + if (test_bit(7, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD27, 0);
> +
> + adc_data = *data;
> + platform_device_register(&at91_adc_device);
> +}
> +#else
> +void __init at91_add_device_adc(struct at91_adc_data *data) {}
> +#endif
> +
> +/* --------------------------------------------------------------------
> * RTT
> * -------------------------------------------------------------------- */
>
> diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
> index c88e908..fb122ba 100644
> --- a/arch/arm/mach-at91/board-sam9m10g45ek.c
> +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
> @@ -27,6 +27,8 @@
> #include <linux/atmel-mci.h>
> #include <linux/delay.h>
>
> +#include <linux/platform_data/at91_adc.h>
> +
> #include <mach/hardware.h>
> #include <video/atmel_lcdc.h>
> #include <media/soc_camera.h>
> @@ -315,6 +317,13 @@ static struct at91_tsadcc_data ek_tsadcc_data = {
> .ts_sample_hold_time = 0x0a,
> };
>
> +/*
> + * ADCs
> + */
> +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),
> + .vref = 3300,
> +};
>
> /*
> * GPIO Buttons
> @@ -480,6 +489,8 @@ static void __init ek_board_init(void)
> at91_add_device_lcdc(&ek_lcdc_data);
> /* Touch Screen */
> at91_add_device_tsadcc(&ek_tsadcc_data);
> + /* ADC */
> + at91_add_device_adc(&ek_adc_data);
> /* Push Buttons */
> ek_add_device_buttons();
> /* AC97 */
> diff --git a/drivers/staging/iio/adc/at91_adc.c b/drivers/staging/iio/adc/at91_adc.c
> index 9af036a..b3517bb 100644
> --- a/drivers/staging/iio/adc/at91_adc.c
> +++ b/drivers/staging/iio/adc/at91_adc.c
> @@ -54,6 +54,12 @@ struct at91_adc_state {
> wait_queue_head_t wq_data_avail;
> };
>
> +static struct at91_adc_desc at91_adc_desc_sam9g45 = {
> + .clock = 13200000,
> + .num_channels = 8,
> + .startup_time = 40,
> +};
> +
> static struct at91_adc_desc at91_adc_desc_sam9g20 = {
> .clock = 5000000,
> .num_channels = 4,
> @@ -67,6 +73,11 @@ static int at91_adc_select_soc(struct at91_adc_state *st)
> return 0;
> }
>
> + if (cpu_is_at91sam9g45()) {
> + st->desc = &at91_adc_desc_sam9g45;
> + return 0;
> + }
> +
> return -ENODEV;
> }
>
WARNING: multiple messages have this Message-ID (diff)
From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] IIO: AT91: ADC: Add support for the AT91SAM9M10G45-EK board
Date: Wed, 18 Apr 2012 18:57:09 +0100 [thread overview]
Message-ID: <4F8F0075.9010303@kernel.org> (raw)
In-Reply-To: <1334756036-15944-5-git-send-email-maxime.ripard@free-electrons.com>
On 04/18/2012 02:33 PM, Maxime Ripard wrote:
> This patch adds the necessary logic and the required platform_data to
> support the ADC present in the AT91SAM9M10G45-EK board from Atmel. It
> only supports software triggers for now.
Same possible issue as with the other one... Actually, not sure why
I acked that given I know very little about the particular platform.
Hence I'm fine with these, but not really for me to say whether they
are good!
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>
> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> arch/arm/mach-at91/at91sam9g45.c | 2 +
> arch/arm/mach-at91/at91sam9g45_devices.c | 61 ++++++++++++++++++++++++++++++
> arch/arm/mach-at91/board-sam9m10g45ek.c | 11 +++++
> drivers/staging/iio/adc/at91_adc.c | 11 +++++
> 4 files changed, 85 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
> index d222f83..c6c35bc 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -242,6 +242,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
> CLKDEV_CON_ID("pioC", &pioC_clk),
> CLKDEV_CON_ID("pioD", &pioDE_clk),
> CLKDEV_CON_ID("pioE", &pioDE_clk),
> + /* Fake adc clock */
> + CLKDEV_CON_ID("adc_clk", &tsc_clk),
> };
>
> static struct clk_lookup usart_clocks_lookups[] = {
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index 6b008ae..05bc673 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -19,6 +19,8 @@
> #include <linux/i2c-gpio.h>
> #include <linux/atmel-mci.h>
>
> +#include <linux/platform_data/at91_adc.h>
> +
> #include <linux/fb.h>
> #include <video/atmel_lcdc.h>
>
> @@ -1207,6 +1209,65 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}
>
>
> /* --------------------------------------------------------------------
> + * ADC
> + * -------------------------------------------------------------------- */
> +
> +#if defined(CONFIG_AT91_ADC) || defined(CONFIG_AT91_ADC_MODULE)
> +static struct at91_adc_data adc_data;
> +
> +static struct resource adc_resources[] = {
> + [0] = {
> + .start = AT91SAM9G45_BASE_TSC,
> + .end = AT91SAM9G45_BASE_TSC + SZ_16K - 1,
> + .flags = IORESOURCE_MEM,
> + },
> + [1] = {
> + .start = AT91SAM9G45_ID_TSC,
> + .end = AT91SAM9G45_ID_TSC,
> + .flags = IORESOURCE_IRQ,
> + }
> +};
> +
> +static struct platform_device at91_adc_device = {
> + .name = "at91_adc",
> + .id = -1,
> + .dev = {
> + .platform_data = &adc_data,
> + },
> + .resource = adc_resources,
> + .num_resources = ARRAY_SIZE(adc_resources),
> +};
> +
> +void __init at91_add_device_adc(struct at91_adc_data *data)
> +{
> + if (!data)
> + return;
> +
> + if (test_bit(0, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD20, 0);
> + if (test_bit(1, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD21, 0);
> + if (test_bit(2, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD22, 0);
> + if (test_bit(3, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD23, 0);
> + if (test_bit(4, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD24, 0);
> + if (test_bit(5, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD25, 0);
> + if (test_bit(6, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD26, 0);
> + if (test_bit(7, &data->channels_used))
> + at91_set_gpio_input(AT91_PIN_PD27, 0);
> +
> + adc_data = *data;
> + platform_device_register(&at91_adc_device);
> +}
> +#else
> +void __init at91_add_device_adc(struct at91_adc_data *data) {}
> +#endif
> +
> +/* --------------------------------------------------------------------
> * RTT
> * -------------------------------------------------------------------- */
>
> diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
> index c88e908..fb122ba 100644
> --- a/arch/arm/mach-at91/board-sam9m10g45ek.c
> +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
> @@ -27,6 +27,8 @@
> #include <linux/atmel-mci.h>
> #include <linux/delay.h>
>
> +#include <linux/platform_data/at91_adc.h>
> +
> #include <mach/hardware.h>
> #include <video/atmel_lcdc.h>
> #include <media/soc_camera.h>
> @@ -315,6 +317,13 @@ static struct at91_tsadcc_data ek_tsadcc_data = {
> .ts_sample_hold_time = 0x0a,
> };
>
> +/*
> + * ADCs
> + */
> +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),
> + .vref = 3300,
> +};
>
> /*
> * GPIO Buttons
> @@ -480,6 +489,8 @@ static void __init ek_board_init(void)
> at91_add_device_lcdc(&ek_lcdc_data);
> /* Touch Screen */
> at91_add_device_tsadcc(&ek_tsadcc_data);
> + /* ADC */
> + at91_add_device_adc(&ek_adc_data);
> /* Push Buttons */
> ek_add_device_buttons();
> /* AC97 */
> diff --git a/drivers/staging/iio/adc/at91_adc.c b/drivers/staging/iio/adc/at91_adc.c
> index 9af036a..b3517bb 100644
> --- a/drivers/staging/iio/adc/at91_adc.c
> +++ b/drivers/staging/iio/adc/at91_adc.c
> @@ -54,6 +54,12 @@ struct at91_adc_state {
> wait_queue_head_t wq_data_avail;
> };
>
> +static struct at91_adc_desc at91_adc_desc_sam9g45 = {
> + .clock = 13200000,
> + .num_channels = 8,
> + .startup_time = 40,
> +};
> +
> static struct at91_adc_desc at91_adc_desc_sam9g20 = {
> .clock = 5000000,
> .num_channels = 4,
> @@ -67,6 +73,11 @@ static int at91_adc_select_soc(struct at91_adc_state *st)
> return 0;
> }
>
> + if (cpu_is_at91sam9g45()) {
> + st->desc = &at91_adc_desc_sam9g45;
> + return 0;
> + }
> +
> return -ENODEV;
> }
>
next prev parent reply other threads:[~2012-04-18 17:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-18 13:33 [PATCHv2] Add ADC driver for G20 and G45 evaluation boards Maxime Ripard
2012-04-18 13:33 ` Maxime Ripard
2012-04-18 13:33 ` [PATCH 1/6] ARM: AT91: Add platform data for the AT91 ADCs Maxime Ripard
2012-04-18 13:33 ` Maxime Ripard
2012-04-18 13:33 ` [PATCH 2/6] ARM: AT91: IIO: Add AT91 ADC driver Maxime Ripard
2012-04-18 13:33 ` Maxime Ripard
2012-04-18 17:52 ` Jonathan Cameron
2012-04-18 17:52 ` Jonathan Cameron
2012-04-18 13:33 ` [PATCH 3/6] ARM: AT91: Add the ADC to the sam9g20ek board Maxime Ripard
2012-04-18 13:33 ` Maxime Ripard
2012-04-18 17:54 ` Jonathan Cameron
2012-04-18 17:54 ` Jonathan Cameron
2012-04-18 13:33 ` [PATCH 4/6] IIO: AT91: ADC: Add support for the AT91SAM9M10G45-EK board Maxime Ripard
2012-04-18 13:33 ` Maxime Ripard
2012-04-18 17:57 ` Jonathan Cameron [this message]
2012-04-18 17:57 ` Jonathan Cameron
2012-04-18 13:33 ` [PATCH 5/6] IIO: AT91: Add support for hardware triggers for the ADC Maxime Ripard
2012-04-18 13:33 ` Maxime Ripard
2012-04-18 18:46 ` Jonathan Cameron
2012-04-18 18:46 ` Jonathan Cameron
2012-04-19 14:24 ` Maxime Ripard
2012-04-18 13:33 ` [PATCH 6/6] IIO: AT91: Add DT support to at91_adc driver Maxime Ripard
2012-04-18 13:33 ` Maxime Ripard
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=4F8F0075.9010303@kernel.org \
--to=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
--cc=nicolas.ferre@atmel.com \
--cc=patrice.vilchez@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=thomas.petazzoni@free-electrons.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.