Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Wed, Dec 23, 2015 at 05:21:25PM +, Jonathan Cameron wrote: > > > On 23 December 2015 10:48:33 GMT+00:00, Ludovic Desroches > wrote: > >On Wed, Dec 23, 2015 at 11:27:00AM +0100, Ludovic Desroches wrote: > >> On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: > >> > On 21/12/15 09:24, Ludovic Desroches wrote: > >> > > This driver supports the new version of the Atmel ADC device > >introduced > >> > > with the SAMA5D2 SoC family. > >> > > > > > >[...] > > > >> > > +static irqreturn_t at91_adc_interrupt(int irq, void *private) > >> > > +{ > >> > > + struct iio_dev *indio = private; > >> > > + struct at91_adc_state *st = iio_priv(indio); > >> > > + u32 status = at91_adc_readl(st, ADC_ISR); > >> > > + > >> > > + status &= at91_adc_readl(st, ADC_IMR); > >> > > + if (status & 0xFFF) { > >> > > + st->last_value = at91_adc_readl(st, st->chan->address); > >> > If this is a polled read - is there any reason to read this value > >here > >> > rather than outside the interrupt? > >> > >> No it can be done outside the interrupt. I have taken some parts from > >the > >> previous driver but it was reading a register used by all the > >channels > >> when it has been designed. So yes there is probably no more reason to > >> read it into the interrupt. > >> > > > >Thinking about it. Is it really useful to move reading outside the > >interrupt? > It avoids needing to know the channel in here, hence simplifying the code a > bit. I am not sure it will simplify the code since the interrupt is cleared when reading the conversion not the interrupt status register. > > > >By the way this is not a polled read. > I meant that it is an individually requested conversion rather than a free > running > sampling system where the value read might change before it is read out. > > > >> > > + st->done = true; > >> > > + wake_up_interruptible(>wq_data_available); > >> > > + } > >> > > + > >> > > + return IRQ_HANDLED; > >> > > +} > > > >Ludovic > >-- > >To unsubscribe from this list: send the line "unsubscribe linux-iio" in > >the body of a message to majord...@vger.kernel.org > >More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Wed, Dec 23, 2015 at 05:21:25PM +, Jonathan Cameron wrote: > > > On 23 December 2015 10:48:33 GMT+00:00, Ludovic Desroches >wrote: > >On Wed, Dec 23, 2015 at 11:27:00AM +0100, Ludovic Desroches wrote: > >> On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: > >> > On 21/12/15 09:24, Ludovic Desroches wrote: > >> > > This driver supports the new version of the Atmel ADC device > >introduced > >> > > with the SAMA5D2 SoC family. > >> > > > > > >[...] > > > >> > > +static irqreturn_t at91_adc_interrupt(int irq, void *private) > >> > > +{ > >> > > + struct iio_dev *indio = private; > >> > > + struct at91_adc_state *st = iio_priv(indio); > >> > > + u32 status = at91_adc_readl(st, ADC_ISR); > >> > > + > >> > > + status &= at91_adc_readl(st, ADC_IMR); > >> > > + if (status & 0xFFF) { > >> > > + st->last_value = at91_adc_readl(st, st->chan->address); > >> > If this is a polled read - is there any reason to read this value > >here > >> > rather than outside the interrupt? > >> > >> No it can be done outside the interrupt. I have taken some parts from > >the > >> previous driver but it was reading a register used by all the > >channels > >> when it has been designed. So yes there is probably no more reason to > >> read it into the interrupt. > >> > > > >Thinking about it. Is it really useful to move reading outside the > >interrupt? > It avoids needing to know the channel in here, hence simplifying the code a > bit. I am not sure it will simplify the code since the interrupt is cleared when reading the conversion not the interrupt status register. > > > >By the way this is not a polled read. > I meant that it is an individually requested conversion rather than a free > running > sampling system where the value read might change before it is read out. > > > >> > > + st->done = true; > >> > > + wake_up_interruptible(>wq_data_available); > >> > > + } > >> > > + > >> > > + return IRQ_HANDLED; > >> > > +} > > > >Ludovic > >-- > >To unsubscribe from this list: send the line "unsubscribe linux-iio" in > >the body of a message to majord...@vger.kernel.org > >More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 23/12/15 10:27, Ludovic Desroches wrote: > On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: >> On 21/12/15 09:24, Ludovic Desroches wrote: >>> This driver supports the new version of the Atmel ADC device introduced >>> with the SAMA5D2 SoC family. >>> >>> Signed-off-by: Ludovic Desroches >> A few more bits and bobs from me. Mostly looking good. >> >> Jonathan >>> --- >>> .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ >>> drivers/iio/adc/Kconfig| 11 + >>> drivers/iio/adc/Makefile | 1 + >>> drivers/iio/adc/at91_adc8xx.c | 417 >>> + >>> 4 files changed, 456 insertions(+) >>> create mode 100644 >>> Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> create mode 100644 drivers/iio/adc/at91_adc8xx.c >>> >>> diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> new file mode 100644 >>> index 000..64ad6a5 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> @@ -0,0 +1,27 @@ >>> +* AT91 SAMA5D2 Analog to Digital Converter (ADC) >>> + >>> +Required properties: >>> + - compatible: Should be "atmel,sama5d2-adc". >>> + - reg: Should contain ADC registers location and length. >>> + - interrupts: Should contain the IRQ line for the ADC. >>> + - clocks: phandles to clocks. >>> + - clock-names: tuple listing clock names. >>> + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the >>> peripheral >>> + clock, "adc_clk" is the sampling clock. >>> + - vref-supply: Supply used as reference for conversions. >>> + >>> +Optional properties: >>> + - vddana-supply: Supply for the adc device. >>> + >>> + >>> +Example: >>> + >>> +adc: adc@fc03 { >>> + compatible = "atmel,sama5d2-adc"; >>> + reg = <0xfc03 0x100>; >>> + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; >>> + clocks = <_clk>, <_op_clk>; >>> + clock-names = "adc_clk", "adc_op_clk"; >>> + vddana-supply = <_3v3_lp_reg>; >>> + vref-supply = <_3v3_lp_reg>; >>> +} >>> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig >>> index 9162dfe..5819e41 100644 >>> --- a/drivers/iio/adc/Kconfig >>> +++ b/drivers/iio/adc/Kconfig >>> @@ -131,6 +131,17 @@ config AT91_ADC >>> To compile this driver as a module, choose M here: the module will be >>> called at91_adc. >>> >>> +config AT91_ADC8xx >>> + tristate "Atmel AT91 ADC 8xx" >>> + depends on ARCH_AT91 >>> + depends on INPUT >>> + help >>> + Say yes here to build support for Atmel ADC 8xx which is available >>> + from SAMA5D2 SoC family. >>> + >>> + To compile this driver as a module, choose M here: the module will be >>> + called at91_adc8xx. >>> + >>> config AXP288_ADC >>> tristate "X-Powers AXP288 ADC driver" >>> depends on MFD_AXP20X >>> diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile >>> index 91a65bf..d684a52 100644 >>> --- a/drivers/iio/adc/Makefile >>> +++ b/drivers/iio/adc/Makefile >>> @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o >>> obj-$(CONFIG_AD7887) += ad7887.o >>> obj-$(CONFIG_AD799X) += ad799x.o >>> obj-$(CONFIG_AT91_ADC) += at91_adc.o >>> +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o >>> obj-$(CONFIG_AXP288_ADC) += axp288_adc.o >>> obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o >>> obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o >>> diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c >>> new file mode 100644 >>> index 000..8b4a6e7 >>> --- /dev/null >>> +++ b/drivers/iio/adc/at91_adc8xx.c >>> @@ -0,0 +1,417 @@ >>> +/* >>> + * Atmel ADC driver for SAMA5D2 devices and later. >>> + * >>> + * Copyright (C) 2015 Atmel, >>> + * 2015 Ludovic Desroches >>> + * >>> + * This software is licensed under the terms of the GNU General Public >>> + * License version 2, as published by the Free Software Foundation, and >>> + * may be copied, distributed, and modified under those terms. >>> + * >>> + * This program is distributed in the hope that it will be useful, >>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >>> + * GNU General Public License for more details. >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +#define ADC_CR 0x00/* Control Register */ >>> +#defineADC_CR_SWRSTBIT(0) /* Software >>> Reset */ >>> +#defineADC_CR_STARTBIT(1) /* Start >>> Conversion */ >>> +#defineADC_CR_TSCALIB BIT(2) /* Touchscreen >>> Calibration */ >>> +#defineADC_CR_CMPRST BIT(4) /* Comparison >>> Restart */ >>> +#define ADC_MR
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 23/12/15 10:27, Ludovic Desroches wrote: > On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: >> On 21/12/15 09:24, Ludovic Desroches wrote: >>> This driver supports the new version of the Atmel ADC device introduced >>> with the SAMA5D2 SoC family. >>> >>> Signed-off-by: Ludovic Desroches>> A few more bits and bobs from me. Mostly looking good. >> >> Jonathan >>> --- >>> .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ >>> drivers/iio/adc/Kconfig| 11 + >>> drivers/iio/adc/Makefile | 1 + >>> drivers/iio/adc/at91_adc8xx.c | 417 >>> + >>> 4 files changed, 456 insertions(+) >>> create mode 100644 >>> Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> create mode 100644 drivers/iio/adc/at91_adc8xx.c >>> >>> diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> new file mode 100644 >>> index 000..64ad6a5 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt >>> @@ -0,0 +1,27 @@ >>> +* AT91 SAMA5D2 Analog to Digital Converter (ADC) >>> + >>> +Required properties: >>> + - compatible: Should be "atmel,sama5d2-adc". >>> + - reg: Should contain ADC registers location and length. >>> + - interrupts: Should contain the IRQ line for the ADC. >>> + - clocks: phandles to clocks. >>> + - clock-names: tuple listing clock names. >>> + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the >>> peripheral >>> + clock, "adc_clk" is the sampling clock. >>> + - vref-supply: Supply used as reference for conversions. >>> + >>> +Optional properties: >>> + - vddana-supply: Supply for the adc device. >>> + >>> + >>> +Example: >>> + >>> +adc: adc@fc03 { >>> + compatible = "atmel,sama5d2-adc"; >>> + reg = <0xfc03 0x100>; >>> + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; >>> + clocks = <_clk>, <_op_clk>; >>> + clock-names = "adc_clk", "adc_op_clk"; >>> + vddana-supply = <_3v3_lp_reg>; >>> + vref-supply = <_3v3_lp_reg>; >>> +} >>> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig >>> index 9162dfe..5819e41 100644 >>> --- a/drivers/iio/adc/Kconfig >>> +++ b/drivers/iio/adc/Kconfig >>> @@ -131,6 +131,17 @@ config AT91_ADC >>> To compile this driver as a module, choose M here: the module will be >>> called at91_adc. >>> >>> +config AT91_ADC8xx >>> + tristate "Atmel AT91 ADC 8xx" >>> + depends on ARCH_AT91 >>> + depends on INPUT >>> + help >>> + Say yes here to build support for Atmel ADC 8xx which is available >>> + from SAMA5D2 SoC family. >>> + >>> + To compile this driver as a module, choose M here: the module will be >>> + called at91_adc8xx. >>> + >>> config AXP288_ADC >>> tristate "X-Powers AXP288 ADC driver" >>> depends on MFD_AXP20X >>> diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile >>> index 91a65bf..d684a52 100644 >>> --- a/drivers/iio/adc/Makefile >>> +++ b/drivers/iio/adc/Makefile >>> @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o >>> obj-$(CONFIG_AD7887) += ad7887.o >>> obj-$(CONFIG_AD799X) += ad799x.o >>> obj-$(CONFIG_AT91_ADC) += at91_adc.o >>> +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o >>> obj-$(CONFIG_AXP288_ADC) += axp288_adc.o >>> obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o >>> obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o >>> diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c >>> new file mode 100644 >>> index 000..8b4a6e7 >>> --- /dev/null >>> +++ b/drivers/iio/adc/at91_adc8xx.c >>> @@ -0,0 +1,417 @@ >>> +/* >>> + * Atmel ADC driver for SAMA5D2 devices and later. >>> + * >>> + * Copyright (C) 2015 Atmel, >>> + * 2015 Ludovic Desroches >>> + * >>> + * This software is licensed under the terms of the GNU General Public >>> + * License version 2, as published by the Free Software Foundation, and >>> + * may be copied, distributed, and modified under those terms. >>> + * >>> + * This program is distributed in the hope that it will be useful, >>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >>> + * GNU General Public License for more details. >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +#define ADC_CR 0x00/* Control Register */ >>> +#defineADC_CR_SWRSTBIT(0) /* Software >>> Reset */ >>> +#defineADC_CR_STARTBIT(1) /* Start >>> Conversion */ >>> +#defineADC_CR_TSCALIB BIT(2) /* Touchscreen >>> Calibration */ >>> +#defineADC_CR_CMPRST BIT(4) /*
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 23 December 2015 10:48:33 GMT+00:00, Ludovic Desroches wrote: >On Wed, Dec 23, 2015 at 11:27:00AM +0100, Ludovic Desroches wrote: >> On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: >> > On 21/12/15 09:24, Ludovic Desroches wrote: >> > > This driver supports the new version of the Atmel ADC device >introduced >> > > with the SAMA5D2 SoC family. >> > > > >[...] > >> > > +static irqreturn_t at91_adc_interrupt(int irq, void *private) >> > > +{ >> > > +struct iio_dev *indio = private; >> > > +struct at91_adc_state *st = iio_priv(indio); >> > > +u32 status = at91_adc_readl(st, ADC_ISR); >> > > + >> > > +status &= at91_adc_readl(st, ADC_IMR); >> > > +if (status & 0xFFF) { >> > > +st->last_value = at91_adc_readl(st, st->chan->address); >> > If this is a polled read - is there any reason to read this value >here >> > rather than outside the interrupt? >> >> No it can be done outside the interrupt. I have taken some parts from >the >> previous driver but it was reading a register used by all the >channels >> when it has been designed. So yes there is probably no more reason to >> read it into the interrupt. >> > >Thinking about it. Is it really useful to move reading outside the >interrupt? It avoids needing to know the channel in here, hence simplifying the code a bit. > >By the way this is not a polled read. I meant that it is an individually requested conversion rather than a free running sampling system where the value read might change before it is read out. > >> > > +st->done = true; >> > > +wake_up_interruptible(>wq_data_available); >> > > +} >> > > + >> > > +return IRQ_HANDLED; >> > > +} > >Ludovic >-- >To unsubscribe from this list: send the line "unsubscribe linux-iio" in >the body of a message to majord...@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Wed, Dec 23, 2015 at 11:27:00AM +0100, Ludovic Desroches wrote: > On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: > > On 21/12/15 09:24, Ludovic Desroches wrote: > > > This driver supports the new version of the Atmel ADC device introduced > > > with the SAMA5D2 SoC family. > > > [...] > > > +static irqreturn_t at91_adc_interrupt(int irq, void *private) > > > +{ > > > + struct iio_dev *indio = private; > > > + struct at91_adc_state *st = iio_priv(indio); > > > + u32 status = at91_adc_readl(st, ADC_ISR); > > > + > > > + status &= at91_adc_readl(st, ADC_IMR); > > > + if (status & 0xFFF) { > > > + st->last_value = at91_adc_readl(st, st->chan->address); > > If this is a polled read - is there any reason to read this value here > > rather than outside the interrupt? > > No it can be done outside the interrupt. I have taken some parts from the > previous driver but it was reading a register used by all the channels > when it has been designed. So yes there is probably no more reason to > read it into the interrupt. > Thinking about it. Is it really useful to move reading outside the interrupt? By the way this is not a polled read. > > > + st->done = true; > > > + wake_up_interruptible(>wq_data_available); > > > + } > > > + > > > + return IRQ_HANDLED; > > > +} Ludovic -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Tue, Dec 22, 2015 at 06:51:18PM -0600, Rob Herring wrote: > On Mon, Dec 21, 2015 at 10:24:08AM +0100, Ludovic Desroches wrote: > > This driver supports the new version of the Atmel ADC device introduced > > with the SAMA5D2 SoC family. > > > > Signed-off-by: Ludovic Desroches > > --- > > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > > drivers/iio/adc/Kconfig| 11 + > > drivers/iio/adc/Makefile | 1 + > > drivers/iio/adc/at91_adc8xx.c | 417 > > + > > 4 files changed, 456 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > new file mode 100644 > > index 000..64ad6a5 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > @@ -0,0 +1,27 @@ > > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > > + > > +Required properties: > > + - compatible: Should be "atmel,sama5d2-adc". > > + - reg: Should contain ADC registers location and length. > > + - interrupts: Should contain the IRQ line for the ADC. > > + - clocks: phandles to clocks. > > + - clock-names: tuple listing clock names. > > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the > > peripheral > > + clock, "adc_clk" is the sampling clock. > > + - vref-supply: Supply used as reference for conversions. > > + > > +Optional properties: > > + - vddana-supply: Supply for the adc device. > > What makes a supply optional? If chip dependent, then then you need a > more specific compatible string. > I thought I had read that we can supply an external vddana or having a default one. Double checking the datasheet. I can't find it, I probably read it on a draft version. Will move the vddana supply to required properties. Thanks Ludovic -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: > On 21/12/15 09:24, Ludovic Desroches wrote: > > This driver supports the new version of the Atmel ADC device introduced > > with the SAMA5D2 SoC family. > > > > Signed-off-by: Ludovic Desroches > A few more bits and bobs from me. Mostly looking good. > > Jonathan > > --- > > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > > drivers/iio/adc/Kconfig| 11 + > > drivers/iio/adc/Makefile | 1 + > > drivers/iio/adc/at91_adc8xx.c | 417 > > + > > 4 files changed, 456 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > new file mode 100644 > > index 000..64ad6a5 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > @@ -0,0 +1,27 @@ > > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > > + > > +Required properties: > > + - compatible: Should be "atmel,sama5d2-adc". > > + - reg: Should contain ADC registers location and length. > > + - interrupts: Should contain the IRQ line for the ADC. > > + - clocks: phandles to clocks. > > + - clock-names: tuple listing clock names. > > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the > > peripheral > > + clock, "adc_clk" is the sampling clock. > > + - vref-supply: Supply used as reference for conversions. > > + > > +Optional properties: > > + - vddana-supply: Supply for the adc device. > > + > > + > > +Example: > > + > > +adc: adc@fc03 { > > + compatible = "atmel,sama5d2-adc"; > > + reg = <0xfc03 0x100>; > > + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; > > + clocks = <_clk>, <_op_clk>; > > + clock-names = "adc_clk", "adc_op_clk"; > > + vddana-supply = <_3v3_lp_reg>; > > + vref-supply = <_3v3_lp_reg>; > > +} > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > > index 9162dfe..5819e41 100644 > > --- a/drivers/iio/adc/Kconfig > > +++ b/drivers/iio/adc/Kconfig > > @@ -131,6 +131,17 @@ config AT91_ADC > > To compile this driver as a module, choose M here: the module will be > > called at91_adc. > > > > +config AT91_ADC8xx > > + tristate "Atmel AT91 ADC 8xx" > > + depends on ARCH_AT91 > > + depends on INPUT > > + help > > + Say yes here to build support for Atmel ADC 8xx which is available > > + from SAMA5D2 SoC family. > > + > > + To compile this driver as a module, choose M here: the module will be > > + called at91_adc8xx. > > + > > config AXP288_ADC > > tristate "X-Powers AXP288 ADC driver" > > depends on MFD_AXP20X > > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > > index 91a65bf..d684a52 100644 > > --- a/drivers/iio/adc/Makefile > > +++ b/drivers/iio/adc/Makefile > > @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o > > obj-$(CONFIG_AD7887) += ad7887.o > > obj-$(CONFIG_AD799X) += ad799x.o > > obj-$(CONFIG_AT91_ADC) += at91_adc.o > > +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o > > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > > obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o > > obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o > > diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c > > new file mode 100644 > > index 000..8b4a6e7 > > --- /dev/null > > +++ b/drivers/iio/adc/at91_adc8xx.c > > @@ -0,0 +1,417 @@ > > +/* > > + * Atmel ADC driver for SAMA5D2 devices and later. > > + * > > + * Copyright (C) 2015 Atmel, > > + * 2015 Ludovic Desroches > > + * > > + * This software is licensed under the terms of the GNU General Public > > + * License version 2, as published by the Free Software Foundation, and > > + * may be copied, distributed, and modified under those terms. > > + * > > + * This program is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define ADC_CR 0x00/* Control Register */ > > +#defineADC_CR_SWRSTBIT(0) /* Software > > Reset */ > > +#defineADC_CR_STARTBIT(1) /* Start > > Conversion */ > > +#defineADC_CR_TSCALIB BIT(2) /* Touchscreen > > Calibration */ > > +#defineADC_CR_CMPRST BIT(4) /* Comparison > > Restart */ > > +#define ADC_MR 0x04/* Mode Register */ >
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 21/12/2015 at 10:24:08 +0100, Ludovic Desroches wrote : > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > @@ -0,0 +1,27 @@ > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > + > +Required properties: > + - compatible: Should be "atmel,sama5d2-adc". > + - reg: Should contain ADC registers location and length. > + - interrupts: Should contain the IRQ line for the ADC. > + - clocks: phandles to clocks. > + - clock-names: tuple listing clock names. > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral > + clock, "adc_clk" is the sampling clock. I think we should not have adc_op_clk but rather have a property like vf610 has fsl,adck-max-frequency. Even better, would be the ability to change it with /sys/bus/iio/devices/iio:deviceX/sampling_frequency -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 21/12/2015 at 10:24:08 +0100, Ludovic Desroches wrote : > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > @@ -0,0 +1,27 @@ > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > + > +Required properties: > + - compatible: Should be "atmel,sama5d2-adc". > + - reg: Should contain ADC registers location and length. > + - interrupts: Should contain the IRQ line for the ADC. > + - clocks: phandles to clocks. > + - clock-names: tuple listing clock names. > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral > + clock, "adc_clk" is the sampling clock. I think we should not have adc_op_clk but rather have a property like vf610 has fsl,adck-max-frequency. Even better, would be the ability to change it with /sys/bus/iio/devices/iio:deviceX/sampling_frequency -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: > On 21/12/15 09:24, Ludovic Desroches wrote: > > This driver supports the new version of the Atmel ADC device introduced > > with the SAMA5D2 SoC family. > > > > Signed-off-by: Ludovic Desroches> A few more bits and bobs from me. Mostly looking good. > > Jonathan > > --- > > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > > drivers/iio/adc/Kconfig| 11 + > > drivers/iio/adc/Makefile | 1 + > > drivers/iio/adc/at91_adc8xx.c | 417 > > + > > 4 files changed, 456 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > new file mode 100644 > > index 000..64ad6a5 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > @@ -0,0 +1,27 @@ > > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > > + > > +Required properties: > > + - compatible: Should be "atmel,sama5d2-adc". > > + - reg: Should contain ADC registers location and length. > > + - interrupts: Should contain the IRQ line for the ADC. > > + - clocks: phandles to clocks. > > + - clock-names: tuple listing clock names. > > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the > > peripheral > > + clock, "adc_clk" is the sampling clock. > > + - vref-supply: Supply used as reference for conversions. > > + > > +Optional properties: > > + - vddana-supply: Supply for the adc device. > > + > > + > > +Example: > > + > > +adc: adc@fc03 { > > + compatible = "atmel,sama5d2-adc"; > > + reg = <0xfc03 0x100>; > > + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; > > + clocks = <_clk>, <_op_clk>; > > + clock-names = "adc_clk", "adc_op_clk"; > > + vddana-supply = <_3v3_lp_reg>; > > + vref-supply = <_3v3_lp_reg>; > > +} > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > > index 9162dfe..5819e41 100644 > > --- a/drivers/iio/adc/Kconfig > > +++ b/drivers/iio/adc/Kconfig > > @@ -131,6 +131,17 @@ config AT91_ADC > > To compile this driver as a module, choose M here: the module will be > > called at91_adc. > > > > +config AT91_ADC8xx > > + tristate "Atmel AT91 ADC 8xx" > > + depends on ARCH_AT91 > > + depends on INPUT > > + help > > + Say yes here to build support for Atmel ADC 8xx which is available > > + from SAMA5D2 SoC family. > > + > > + To compile this driver as a module, choose M here: the module will be > > + called at91_adc8xx. > > + > > config AXP288_ADC > > tristate "X-Powers AXP288 ADC driver" > > depends on MFD_AXP20X > > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > > index 91a65bf..d684a52 100644 > > --- a/drivers/iio/adc/Makefile > > +++ b/drivers/iio/adc/Makefile > > @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o > > obj-$(CONFIG_AD7887) += ad7887.o > > obj-$(CONFIG_AD799X) += ad799x.o > > obj-$(CONFIG_AT91_ADC) += at91_adc.o > > +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o > > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > > obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o > > obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o > > diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c > > new file mode 100644 > > index 000..8b4a6e7 > > --- /dev/null > > +++ b/drivers/iio/adc/at91_adc8xx.c > > @@ -0,0 +1,417 @@ > > +/* > > + * Atmel ADC driver for SAMA5D2 devices and later. > > + * > > + * Copyright (C) 2015 Atmel, > > + * 2015 Ludovic Desroches > > + * > > + * This software is licensed under the terms of the GNU General Public > > + * License version 2, as published by the Free Software Foundation, and > > + * may be copied, distributed, and modified under those terms. > > + * > > + * This program is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define ADC_CR 0x00/* Control Register */ > > +#defineADC_CR_SWRSTBIT(0) /* Software > > Reset */ > > +#defineADC_CR_STARTBIT(1) /* Start > > Conversion */ > > +#defineADC_CR_TSCALIB BIT(2) /* Touchscreen > > Calibration */ > > +#defineADC_CR_CMPRST BIT(4) /* Comparison > > Restart */ > > +#define ADC_MR
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 23 December 2015 10:48:33 GMT+00:00, Ludovic Desrocheswrote: >On Wed, Dec 23, 2015 at 11:27:00AM +0100, Ludovic Desroches wrote: >> On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: >> > On 21/12/15 09:24, Ludovic Desroches wrote: >> > > This driver supports the new version of the Atmel ADC device >introduced >> > > with the SAMA5D2 SoC family. >> > > > >[...] > >> > > +static irqreturn_t at91_adc_interrupt(int irq, void *private) >> > > +{ >> > > +struct iio_dev *indio = private; >> > > +struct at91_adc_state *st = iio_priv(indio); >> > > +u32 status = at91_adc_readl(st, ADC_ISR); >> > > + >> > > +status &= at91_adc_readl(st, ADC_IMR); >> > > +if (status & 0xFFF) { >> > > +st->last_value = at91_adc_readl(st, st->chan->address); >> > If this is a polled read - is there any reason to read this value >here >> > rather than outside the interrupt? >> >> No it can be done outside the interrupt. I have taken some parts from >the >> previous driver but it was reading a register used by all the >channels >> when it has been designed. So yes there is probably no more reason to >> read it into the interrupt. >> > >Thinking about it. Is it really useful to move reading outside the >interrupt? It avoids needing to know the channel in here, hence simplifying the code a bit. > >By the way this is not a polled read. I meant that it is an individually requested conversion rather than a free running sampling system where the value read might change before it is read out. > >> > > +st->done = true; >> > > +wake_up_interruptible(>wq_data_available); >> > > +} >> > > + >> > > +return IRQ_HANDLED; >> > > +} > >Ludovic >-- >To unsubscribe from this list: send the line "unsubscribe linux-iio" in >the body of a message to majord...@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Tue, Dec 22, 2015 at 06:51:18PM -0600, Rob Herring wrote: > On Mon, Dec 21, 2015 at 10:24:08AM +0100, Ludovic Desroches wrote: > > This driver supports the new version of the Atmel ADC device introduced > > with the SAMA5D2 SoC family. > > > > Signed-off-by: Ludovic Desroches> > --- > > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > > drivers/iio/adc/Kconfig| 11 + > > drivers/iio/adc/Makefile | 1 + > > drivers/iio/adc/at91_adc8xx.c | 417 > > + > > 4 files changed, 456 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > new file mode 100644 > > index 000..64ad6a5 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > > @@ -0,0 +1,27 @@ > > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > > + > > +Required properties: > > + - compatible: Should be "atmel,sama5d2-adc". > > + - reg: Should contain ADC registers location and length. > > + - interrupts: Should contain the IRQ line for the ADC. > > + - clocks: phandles to clocks. > > + - clock-names: tuple listing clock names. > > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the > > peripheral > > + clock, "adc_clk" is the sampling clock. > > + - vref-supply: Supply used as reference for conversions. > > + > > +Optional properties: > > + - vddana-supply: Supply for the adc device. > > What makes a supply optional? If chip dependent, then then you need a > more specific compatible string. > I thought I had read that we can supply an external vddana or having a default one. Double checking the datasheet. I can't find it, I probably read it on a draft version. Will move the vddana supply to required properties. Thanks Ludovic -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Wed, Dec 23, 2015 at 11:27:00AM +0100, Ludovic Desroches wrote: > On Tue, Dec 22, 2015 at 06:34:00PM +, Jonathan Cameron wrote: > > On 21/12/15 09:24, Ludovic Desroches wrote: > > > This driver supports the new version of the Atmel ADC device introduced > > > with the SAMA5D2 SoC family. > > > [...] > > > +static irqreturn_t at91_adc_interrupt(int irq, void *private) > > > +{ > > > + struct iio_dev *indio = private; > > > + struct at91_adc_state *st = iio_priv(indio); > > > + u32 status = at91_adc_readl(st, ADC_ISR); > > > + > > > + status &= at91_adc_readl(st, ADC_IMR); > > > + if (status & 0xFFF) { > > > + st->last_value = at91_adc_readl(st, st->chan->address); > > If this is a polled read - is there any reason to read this value here > > rather than outside the interrupt? > > No it can be done outside the interrupt. I have taken some parts from the > previous driver but it was reading a register used by all the channels > when it has been designed. So yes there is probably no more reason to > read it into the interrupt. > Thinking about it. Is it really useful to move reading outside the interrupt? By the way this is not a polled read. > > > + st->done = true; > > > + wake_up_interruptible(>wq_data_available); > > > + } > > > + > > > + return IRQ_HANDLED; > > > +} Ludovic -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Mon, Dec 21, 2015 at 10:24:08AM +0100, Ludovic Desroches wrote: > This driver supports the new version of the Atmel ADC device introduced > with the SAMA5D2 SoC family. > > Signed-off-by: Ludovic Desroches > --- > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > drivers/iio/adc/Kconfig| 11 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/at91_adc8xx.c | 417 > + > 4 files changed, 456 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > new file mode 100644 > index 000..64ad6a5 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > @@ -0,0 +1,27 @@ > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > + > +Required properties: > + - compatible: Should be "atmel,sama5d2-adc". > + - reg: Should contain ADC registers location and length. > + - interrupts: Should contain the IRQ line for the ADC. > + - clocks: phandles to clocks. > + - clock-names: tuple listing clock names. > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral > + clock, "adc_clk" is the sampling clock. > + - vref-supply: Supply used as reference for conversions. > + > +Optional properties: > + - vddana-supply: Supply for the adc device. What makes a supply optional? If chip dependent, then then you need a more specific compatible string. Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 21/12/15 09:24, Ludovic Desroches wrote: > This driver supports the new version of the Atmel ADC device introduced > with the SAMA5D2 SoC family. > > Signed-off-by: Ludovic Desroches A few more bits and bobs from me. Mostly looking good. Jonathan > --- > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > drivers/iio/adc/Kconfig| 11 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/at91_adc8xx.c | 417 > + > 4 files changed, 456 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > new file mode 100644 > index 000..64ad6a5 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > @@ -0,0 +1,27 @@ > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > + > +Required properties: > + - compatible: Should be "atmel,sama5d2-adc". > + - reg: Should contain ADC registers location and length. > + - interrupts: Should contain the IRQ line for the ADC. > + - clocks: phandles to clocks. > + - clock-names: tuple listing clock names. > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral > + clock, "adc_clk" is the sampling clock. > + - vref-supply: Supply used as reference for conversions. > + > +Optional properties: > + - vddana-supply: Supply for the adc device. > + > + > +Example: > + > +adc: adc@fc03 { > + compatible = "atmel,sama5d2-adc"; > + reg = <0xfc03 0x100>; > + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; > + clocks = <_clk>, <_op_clk>; > + clock-names = "adc_clk", "adc_op_clk"; > + vddana-supply = <_3v3_lp_reg>; > + vref-supply = <_3v3_lp_reg>; > +} > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index 9162dfe..5819e41 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -131,6 +131,17 @@ config AT91_ADC > To compile this driver as a module, choose M here: the module will be > called at91_adc. > > +config AT91_ADC8xx > + tristate "Atmel AT91 ADC 8xx" > + depends on ARCH_AT91 > + depends on INPUT > + help > + Say yes here to build support for Atmel ADC 8xx which is available > + from SAMA5D2 SoC family. > + > + To compile this driver as a module, choose M here: the module will be > + called at91_adc8xx. > + > config AXP288_ADC > tristate "X-Powers AXP288 ADC driver" > depends on MFD_AXP20X > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > index 91a65bf..d684a52 100644 > --- a/drivers/iio/adc/Makefile > +++ b/drivers/iio/adc/Makefile > @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o > obj-$(CONFIG_AD7887) += ad7887.o > obj-$(CONFIG_AD799X) += ad799x.o > obj-$(CONFIG_AT91_ADC) += at91_adc.o > +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o > obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o > diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c > new file mode 100644 > index 000..8b4a6e7 > --- /dev/null > +++ b/drivers/iio/adc/at91_adc8xx.c > @@ -0,0 +1,417 @@ > +/* > + * Atmel ADC driver for SAMA5D2 devices and later. > + * > + * Copyright (C) 2015 Atmel, > + * 2015 Ludovic Desroches > + * > + * This software is licensed under the terms of the GNU General Public > + * License version 2, as published by the Free Software Foundation, and > + * may be copied, distributed, and modified under those terms. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define ADC_CR 0x00/* Control Register */ > +#define ADC_CR_SWRSTBIT(0) /* Software > Reset */ > +#define ADC_CR_STARTBIT(1) /* Start > Conversion */ > +#define ADC_CR_TSCALIB BIT(2) /* Touchscreen > Calibration */ > +#define ADC_CR_CMPRST BIT(4) /* Comparison > Restart */ > +#define ADC_MR 0x04/* Mode Register */ > +#define ADC_MR_TRGSEL(v)(v << 1)/* Trigger > Selection */ > +#define ADC_MR_TRGSEL_TRIG0 0 /* > ADTRG */ > +#define ADC_MR_TRGSEL_TRIG1 1 /* > TIOA0 */ > +#define
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On 21/12/15 09:24, Ludovic Desroches wrote: > This driver supports the new version of the Atmel ADC device introduced > with the SAMA5D2 SoC family. > > Signed-off-by: Ludovic DesrochesA few more bits and bobs from me. Mostly looking good. Jonathan > --- > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > drivers/iio/adc/Kconfig| 11 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/at91_adc8xx.c | 417 > + > 4 files changed, 456 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > new file mode 100644 > index 000..64ad6a5 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > @@ -0,0 +1,27 @@ > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > + > +Required properties: > + - compatible: Should be "atmel,sama5d2-adc". > + - reg: Should contain ADC registers location and length. > + - interrupts: Should contain the IRQ line for the ADC. > + - clocks: phandles to clocks. > + - clock-names: tuple listing clock names. > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral > + clock, "adc_clk" is the sampling clock. > + - vref-supply: Supply used as reference for conversions. > + > +Optional properties: > + - vddana-supply: Supply for the adc device. > + > + > +Example: > + > +adc: adc@fc03 { > + compatible = "atmel,sama5d2-adc"; > + reg = <0xfc03 0x100>; > + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; > + clocks = <_clk>, <_op_clk>; > + clock-names = "adc_clk", "adc_op_clk"; > + vddana-supply = <_3v3_lp_reg>; > + vref-supply = <_3v3_lp_reg>; > +} > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index 9162dfe..5819e41 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -131,6 +131,17 @@ config AT91_ADC > To compile this driver as a module, choose M here: the module will be > called at91_adc. > > +config AT91_ADC8xx > + tristate "Atmel AT91 ADC 8xx" > + depends on ARCH_AT91 > + depends on INPUT > + help > + Say yes here to build support for Atmel ADC 8xx which is available > + from SAMA5D2 SoC family. > + > + To compile this driver as a module, choose M here: the module will be > + called at91_adc8xx. > + > config AXP288_ADC > tristate "X-Powers AXP288 ADC driver" > depends on MFD_AXP20X > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > index 91a65bf..d684a52 100644 > --- a/drivers/iio/adc/Makefile > +++ b/drivers/iio/adc/Makefile > @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o > obj-$(CONFIG_AD7887) += ad7887.o > obj-$(CONFIG_AD799X) += ad799x.o > obj-$(CONFIG_AT91_ADC) += at91_adc.o > +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o > obj-$(CONFIG_AXP288_ADC) += axp288_adc.o > obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o > obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o > diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c > new file mode 100644 > index 000..8b4a6e7 > --- /dev/null > +++ b/drivers/iio/adc/at91_adc8xx.c > @@ -0,0 +1,417 @@ > +/* > + * Atmel ADC driver for SAMA5D2 devices and later. > + * > + * Copyright (C) 2015 Atmel, > + * 2015 Ludovic Desroches > + * > + * This software is licensed under the terms of the GNU General Public > + * License version 2, as published by the Free Software Foundation, and > + * may be copied, distributed, and modified under those terms. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define ADC_CR 0x00/* Control Register */ > +#define ADC_CR_SWRSTBIT(0) /* Software > Reset */ > +#define ADC_CR_STARTBIT(1) /* Start > Conversion */ > +#define ADC_CR_TSCALIB BIT(2) /* Touchscreen > Calibration */ > +#define ADC_CR_CMPRST BIT(4) /* Comparison > Restart */ > +#define ADC_MR 0x04/* Mode Register */ > +#define ADC_MR_TRGSEL(v)(v << 1)/* Trigger > Selection */ > +#define ADC_MR_TRGSEL_TRIG0 0 /* > ADTRG */ > +#define ADC_MR_TRGSEL_TRIG1
Re: [PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
On Mon, Dec 21, 2015 at 10:24:08AM +0100, Ludovic Desroches wrote: > This driver supports the new version of the Atmel ADC device introduced > with the SAMA5D2 SoC family. > > Signed-off-by: Ludovic Desroches> --- > .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ > drivers/iio/adc/Kconfig| 11 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/at91_adc8xx.c | 417 > + > 4 files changed, 456 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > create mode 100644 drivers/iio/adc/at91_adc8xx.c > > diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > new file mode 100644 > index 000..64ad6a5 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt > @@ -0,0 +1,27 @@ > +* AT91 SAMA5D2 Analog to Digital Converter (ADC) > + > +Required properties: > + - compatible: Should be "atmel,sama5d2-adc". > + - reg: Should contain ADC registers location and length. > + - interrupts: Should contain the IRQ line for the ADC. > + - clocks: phandles to clocks. > + - clock-names: tuple listing clock names. > + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral > + clock, "adc_clk" is the sampling clock. > + - vref-supply: Supply used as reference for conversions. > + > +Optional properties: > + - vddana-supply: Supply for the adc device. What makes a supply optional? If chip dependent, then then you need a more specific compatible string. Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
This driver supports the new version of the Atmel ADC device introduced with the SAMA5D2 SoC family. Signed-off-by: Ludovic Desroches --- .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ drivers/iio/adc/Kconfig| 11 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/at91_adc8xx.c | 417 + 4 files changed, 456 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt create mode 100644 drivers/iio/adc/at91_adc8xx.c diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt new file mode 100644 index 000..64ad6a5 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt @@ -0,0 +1,27 @@ +* AT91 SAMA5D2 Analog to Digital Converter (ADC) + +Required properties: + - compatible: Should be "atmel,sama5d2-adc". + - reg: Should contain ADC registers location and length. + - interrupts: Should contain the IRQ line for the ADC. + - clocks: phandles to clocks. + - clock-names: tuple listing clock names. + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral + clock, "adc_clk" is the sampling clock. + - vref-supply: Supply used as reference for conversions. + +Optional properties: + - vddana-supply: Supply for the adc device. + + +Example: + +adc: adc@fc03 { + compatible = "atmel,sama5d2-adc"; + reg = <0xfc03 0x100>; + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; + clocks = <_clk>, <_op_clk>; + clock-names = "adc_clk", "adc_op_clk"; + vddana-supply = <_3v3_lp_reg>; + vref-supply = <_3v3_lp_reg>; +} diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 9162dfe..5819e41 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -131,6 +131,17 @@ config AT91_ADC To compile this driver as a module, choose M here: the module will be called at91_adc. +config AT91_ADC8xx + tristate "Atmel AT91 ADC 8xx" + depends on ARCH_AT91 + depends on INPUT + help + Say yes here to build support for Atmel ADC 8xx which is available + from SAMA5D2 SoC family. + + To compile this driver as a module, choose M here: the module will be + called at91_adc8xx. + config AXP288_ADC tristate "X-Powers AXP288 ADC driver" depends on MFD_AXP20X diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 91a65bf..d684a52 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o obj-$(CONFIG_AD7887) += ad7887.o obj-$(CONFIG_AD799X) += ad799x.o obj-$(CONFIG_AT91_ADC) += at91_adc.o +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o obj-$(CONFIG_AXP288_ADC) += axp288_adc.o obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c new file mode 100644 index 000..8b4a6e7 --- /dev/null +++ b/drivers/iio/adc/at91_adc8xx.c @@ -0,0 +1,417 @@ +/* + * Atmel ADC driver for SAMA5D2 devices and later. + * + * Copyright (C) 2015 Atmel, + * 2015 Ludovic Desroches + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CR 0x00/* Control Register */ +#defineADC_CR_SWRSTBIT(0) /* Software Reset */ +#defineADC_CR_STARTBIT(1) /* Start Conversion */ +#defineADC_CR_TSCALIB BIT(2) /* Touchscreen Calibration */ +#defineADC_CR_CMPRST BIT(4) /* Comparison Restart */ +#define ADC_MR 0x04/* Mode Register */ +#defineADC_MR_TRGSEL(v)(v << 1)/* Trigger Selection */ +#defineADC_MR_TRGSEL_TRIG0 0 /* ADTRG */ +#defineADC_MR_TRGSEL_TRIG1 1 /* TIOA0 */ +#defineADC_MR_TRGSEL_TRIG2 2 /* TIOA1 */ +#defineADC_MR_TRGSEL_TRIG3 3 /* TIOA2 */ +#defineADC_MR_TRGSEL_TRIG4 4 /* PWM event line 0 */ +#defineADC_MR_TRGSEL_TRIG5 5 /* PWM event line
[PATCH 1/5] iio:adc:at91_adc8xx: introduce new atmel adc driver
This driver supports the new version of the Atmel ADC device introduced with the SAMA5D2 SoC family. Signed-off-by: Ludovic Desroches--- .../devicetree/bindings/iio/adc/at91_adc8xx.txt| 27 ++ drivers/iio/adc/Kconfig| 11 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/at91_adc8xx.c | 417 + 4 files changed, 456 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt create mode 100644 drivers/iio/adc/at91_adc8xx.c diff --git a/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt new file mode 100644 index 000..64ad6a5 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/at91_adc8xx.txt @@ -0,0 +1,27 @@ +* AT91 SAMA5D2 Analog to Digital Converter (ADC) + +Required properties: + - compatible: Should be "atmel,sama5d2-adc". + - reg: Should contain ADC registers location and length. + - interrupts: Should contain the IRQ line for the ADC. + - clocks: phandles to clocks. + - clock-names: tuple listing clock names. + Required elements: "adc_clk", "adc_op_clk". "adc_clk" is the peripheral + clock, "adc_clk" is the sampling clock. + - vref-supply: Supply used as reference for conversions. + +Optional properties: + - vddana-supply: Supply for the adc device. + + +Example: + +adc: adc@fc03 { + compatible = "atmel,sama5d2-adc"; + reg = <0xfc03 0x100>; + interrupts = <40 IRQ_TYPE_LEVEL_HIGH 7>; + clocks = <_clk>, <_op_clk>; + clock-names = "adc_clk", "adc_op_clk"; + vddana-supply = <_3v3_lp_reg>; + vref-supply = <_3v3_lp_reg>; +} diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 9162dfe..5819e41 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -131,6 +131,17 @@ config AT91_ADC To compile this driver as a module, choose M here: the module will be called at91_adc. +config AT91_ADC8xx + tristate "Atmel AT91 ADC 8xx" + depends on ARCH_AT91 + depends on INPUT + help + Say yes here to build support for Atmel ADC 8xx which is available + from SAMA5D2 SoC family. + + To compile this driver as a module, choose M here: the module will be + called at91_adc8xx. + config AXP288_ADC tristate "X-Powers AXP288 ADC driver" depends on MFD_AXP20X diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 91a65bf..d684a52 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7793) += ad7793.o obj-$(CONFIG_AD7887) += ad7887.o obj-$(CONFIG_AD799X) += ad799x.o obj-$(CONFIG_AT91_ADC) += at91_adc.o +obj-$(CONFIG_AT91_ADC8xx) += at91_adc8xx.o obj-$(CONFIG_AXP288_ADC) += axp288_adc.o obj-$(CONFIG_BERLIN2_ADC) += berlin2-adc.o obj-$(CONFIG_CC10001_ADC) += cc10001_adc.o diff --git a/drivers/iio/adc/at91_adc8xx.c b/drivers/iio/adc/at91_adc8xx.c new file mode 100644 index 000..8b4a6e7 --- /dev/null +++ b/drivers/iio/adc/at91_adc8xx.c @@ -0,0 +1,417 @@ +/* + * Atmel ADC driver for SAMA5D2 devices and later. + * + * Copyright (C) 2015 Atmel, + * 2015 Ludovic Desroches + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CR 0x00/* Control Register */ +#defineADC_CR_SWRSTBIT(0) /* Software Reset */ +#defineADC_CR_STARTBIT(1) /* Start Conversion */ +#defineADC_CR_TSCALIB BIT(2) /* Touchscreen Calibration */ +#defineADC_CR_CMPRST BIT(4) /* Comparison Restart */ +#define ADC_MR 0x04/* Mode Register */ +#defineADC_MR_TRGSEL(v)(v << 1)/* Trigger Selection */ +#defineADC_MR_TRGSEL_TRIG0 0 /* ADTRG */ +#defineADC_MR_TRGSEL_TRIG1 1 /* TIOA0 */ +#defineADC_MR_TRGSEL_TRIG2 2 /* TIOA1 */ +#defineADC_MR_TRGSEL_TRIG3 3 /* TIOA2 */ +#defineADC_MR_TRGSEL_TRIG4 4 /* PWM event line 0 */ +#define