Re: [PATCHi v3] iio: add support of the max1027
Hi Jonathan, On 30/05/14 18:29, Jonathan Cameron wrote: On May 29, 2014 10:22:00 PM GMT+01:00, Philippe Reynes wrote: This driver add partial support of the maxim 1027/1029/1031. Differential mode is not supported. It was tested on armadeus apf27 board. Signed-off-by: Philippe Reynes One last thing from me. --- .../devicetree/bindings/iio/adc/max1027-adc.txt| 22 + drivers/iio/adc/Kconfig|9 + drivers/iio/adc/Makefile |1 + drivers/iio/adc/max1027.c | 518 4 files changed, 550 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/max1027-adc.txt create mode 100644 drivers/iio/adc/max1027.c Changelog: v3: (thanks Hartmut Knaack, Lars-Peter Clausen and Jonathan Cameron for the feedback) - move to drivers/iio/adc (was in staging) - clean binding doc - drop empty update_scan_mode callback - add a lock around single channel read code - remove useless wrappers around spi_write and spi_read - fix available scan mask (a bit was missing) - remove useless header - some others little cleanp v2: (thanks Hartmut Knaack and Jonathan Cameron for the feedback) - really use devm_* - use demux magic - use spi_read and spi_write (instead of spi_sync) - use define for register (instead of hardcoded value) diff --git a/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt new file mode 100644 index 000..a8770cc --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt @@ -0,0 +1,22 @@ +* Maxim 1027/1029/1031 Analog to Digital Converter (ADC) + +Required properties: + - compatible: Should be "maxim,max1027" or "maxim,max1029" or "maxim,max1031" + - reg: SPI chip select number for the device + - interrupt-parent: phandle to the parent interrupt controller + see: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt + - interrupts: IRQ line for the ADC + see: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt + +Recommended properties: +- spi-max-frequency: Definition as per + Documentation/devicetree/bindings/spi/spi-bus.txt + +Example: +adc@0 { + compatible = "maxim,max1027"; + reg =<0>; + interrupt-parent =<&gpio5>; + interrupts =<15 IRQ_TYPE_EDGE_RISING>; + spi-max-frequency =<100>; +}; diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 24c28e3..517f886 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -119,6 +119,15 @@ config LP8788_ADC help Say yes here to build support for TI LP8788 ADC. +config MAX1027 + tristate "Maxim max1027 ADC driver" + depends on SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for Maxim SPI ADC models + max1027, max1029 and max1031. + config MAX1363 tristate "Maxim max1363 ADC driver" depends on I2C diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index ab346d8..daac784 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_AD7887) += ad7887.o obj-$(CONFIG_AT91_ADC) += at91_adc.o obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o +obj-$(CONFIG_MAX1027) += max1027.o obj-$(CONFIG_MAX1363) += max1363.o obj-$(CONFIG_MCP320X) += mcp320x.o obj-$(CONFIG_MCP3422) += mcp3422.o diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c new file mode 100644 index 000..6323510 --- /dev/null +++ b/drivers/iio/adc/max1027.c @@ -0,0 +1,518 @@ + /* + * iio/adc/max1027.c + * Copyright (C) 2014 Philippe Reynes + * + * based on linux/drivers/iio/ad7923.c + * Copyright 2011 Analog Devices Inc (from AD7923 Driver) + * Copyright 2012 CS Systemes d'Information + * + * 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. + * + * max1027.c + * + * Partial support for max1027 and similar chips. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define MAX1027_CONV_REG 0x80 +#define MAX1027_SETUP_REG 0x40 +#define MAX1027_AVG_REG 0x20 +#define MAX1027_RST_REG 0x10 + +/* conversion register */ +#define MAX1027_TEMP 0x01 +#define MAX1027_SCAN_0_N (0x00<< 1) +#define MAX1027_SCAN_N_M (0x01<< 1) +#define MAX1027_SCAN_N(0x02<< 1) +#define MAX1027_NOSCAN(0x03<< 1) +#define MAX1027_CHAN(n) ((n)<< 3) + +/* setup register */ +#define MAX1027_UNIPOLAR 0x02 +#define MAX1027_BIPOLAR 0x03 +#define MAX1027_REF_MODE0 (0x00<< 2) +#define MAX1027_REF_MODE1 (0x01<< 2) +#define MAX1027_REF_MODE2 (0x02<< 2) +#define MAX1027_REF_MODE3 (0x03<< 2) +#define MAX1027_CKS_MODE0 (0x00<< 4) +#define MAX1027_CKS_MODE1 (0x
Re: [PATCH v2] iio: add support of the max1027
Hi, On 26/05/14 22:27, Lars-Peter Clausen wrote: On 05/20/2014 11:27 PM, Philippe Reynes wrote: This driver add partial support of the maxim 1027/1029/1031. Differential mode is not supported. It was tested on armadeus apf27 board. Signed-off-by: Philippe Reynes --- .../devicetree/bindings/iio/adc/max1027-adc.txt| 21 + drivers/staging/iio/adc/Kconfig|9 + drivers/staging/iio/adc/Makefile |1 + drivers/staging/iio/adc/max1027.c | 553 New drivers should go into drivers/iio/ I'll be pleased to add this driver in drivers/iio/ Everybody agrees ?? 4 files changed, 584 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/max1027-adc.txt create mode 100644 drivers/staging/iio/adc/max1027.c [...] Regards, Philippe -- 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 v2] iio: add support of the max1027
Hi Harmut, On 27/05/14 00:33, Hartmut Knaack wrote: trem schrieb: Hi Hartmut, First, thanks a lot for this feedback, I really appreciate it. On 26/05/14 00:52, Hartmut Knaack wrote: Philippe Reynes schrieb: This driver add partial support of the maxim 1027/1029/1031. Differential mode is not supported. It was tested on armadeus apf27 board. Signed-off-by: Philippe Reynes --- .../devicetree/bindings/iio/adc/max1027-adc.txt| 21 + drivers/staging/iio/adc/Kconfig|9 + drivers/staging/iio/adc/Makefile |1 + drivers/staging/iio/adc/max1027.c | 553 4 files changed, 584 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/max1027-adc.txt create mode 100644 drivers/staging/iio/adc/max1027.c Changelog: v2: (thanks Hartmut Knaack and Jonathan Cameron for the feedback) - really use devm_* - use demux magic - use spi_read and spi_write (instead of spi_sync) - use define for register (instead of hardcoded value) diff --git a/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt new file mode 100644 index 000..2e8b9f3 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt @@ -0,0 +1,21 @@ +* Maxim 1027/1029/1031 Analog to Digital Converter (ADC) + +Required properties: + - compatible: Should be "maxim,max1027" or "maxim,max1029" or "maxim,max1031" + - reg: Should contain the ADC SPI address + - interrupt-parent: the phandle for the gpio controller + - interrupts: (gpio) interrupt to which the chip is connected + +Example: +adc@0 { + compatible = "maxim,max1027"; + reg =<0>; + interrupt-parent =<&gpio5>; + interrupts =<15 IRQ_TYPE_EDGE_RISING>; + pinctrl-names = "default"; + pinctrl-0 =<&pinctrl_max1027>; + /* SPI mode = 0 */ + spi-cpol =<0>; + spi-cpha =<0>; + spi-max-frequency =<100>; +}; diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 3633298..12a78eb 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -112,6 +112,15 @@ config LPC32XX_ADC activate only one via device tree selection. Provides direct access via sysfs. +config MAX1027 + tristate "Maxim max1027 ADC driver" + depends on SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for Maxim SPI ADC models + max1027, max1029 and max1031. + config MXS_LRADC tristate "Freescale i.MX23/i.MX28 LRADC" depends on ARCH_MXS || COMPILE_TEST diff --git a/drivers/staging/iio/adc/Makefile b/drivers/staging/iio/adc/Makefile index 3e9fb14..22fbd0c 100644 --- a/drivers/staging/iio/adc/Makefile +++ b/drivers/staging/iio/adc/Makefile @@ -18,5 +18,6 @@ obj-$(CONFIG_AD7816) += ad7816.o obj-$(CONFIG_AD7192) += ad7192.o obj-$(CONFIG_AD7280) += ad7280a.o obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o +obj-$(CONFIG_MAX1027) += max1027.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_SPEAR_ADC) += spear_adc.o diff --git a/drivers/staging/iio/adc/max1027.c b/drivers/staging/iio/adc/max1027.c new file mode 100644 index 000..c2e5936 --- /dev/null +++ b/drivers/staging/iio/adc/max1027.c @@ -0,0 +1,553 @@ + /* + * iio/adc/max1027.c + * Copyright (C) 2014 Philippe Reynes + * + * based on linux/drivers/iio/ad7923.c + * Copyright 2011 Analog Devices Inc (from AD7923 Driver) + * Copyright 2012 CS Systemes d'Information + * + * 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. + * + * max1027.c + * + * Partial support for max1027 and similar chips. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define MAX1027_CONV_REG 0x80 +#define MAX1027_SETUP_REG 0x40 +#define MAX1027_AVG_REG 0x20 +#define MAX1027_RST_REG 0x10 + +/* conversion register */ +#define MAX1027_TEMP 0x01 +#define MAX1027_SCAN_0_N (0x00<< 1) +#define MAX1027_SCAN_N_M (0x01<< 1) +#define MAX1027_SCAN_N(0x02<< 1) +#define MAX1027_NOSCAN(0x03<< 1) +#define MAX1027_CHAN(n) ((n)<< 3) + +/* setup register */ +#define MAX1027_UNIPOLAR 0x02 +#define MAX1027_BIPOLAR 0x03 +#define MAX1027_REF_MODE0 (0x00<< 2) +#define MAX1027_REF_MODE1 (0x01<< 2) +#define MAX1027_REF_MODE2 (0x02<< 2) +#define MAX1027_REF_MODE3 (0x03<< 2) +#define MAX1027_CKS_MODE0 (0x00<< 4) +#define MAX1027_CKS_MODE1 (0x01<< 4) +#define MAX1027_CKS_
Re: [PATCH v2] iio: add support of the max1027
Hi Hartmut, First, thanks a lot for this feedback, I really appreciate it. On 26/05/14 00:52, Hartmut Knaack wrote: Philippe Reynes schrieb: This driver add partial support of the maxim 1027/1029/1031. Differential mode is not supported. It was tested on armadeus apf27 board. Signed-off-by: Philippe Reynes --- .../devicetree/bindings/iio/adc/max1027-adc.txt| 21 + drivers/staging/iio/adc/Kconfig|9 + drivers/staging/iio/adc/Makefile |1 + drivers/staging/iio/adc/max1027.c | 553 4 files changed, 584 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/max1027-adc.txt create mode 100644 drivers/staging/iio/adc/max1027.c Changelog: v2: (thanks Hartmut Knaack and Jonathan Cameron for the feedback) - really use devm_* - use demux magic - use spi_read and spi_write (instead of spi_sync) - use define for register (instead of hardcoded value) diff --git a/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt new file mode 100644 index 000..2e8b9f3 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/max1027-adc.txt @@ -0,0 +1,21 @@ +* Maxim 1027/1029/1031 Analog to Digital Converter (ADC) + +Required properties: + - compatible: Should be "maxim,max1027" or "maxim,max1029" or "maxim,max1031" + - reg: Should contain the ADC SPI address + - interrupt-parent: the phandle for the gpio controller + - interrupts: (gpio) interrupt to which the chip is connected + +Example: +adc@0 { + compatible = "maxim,max1027"; + reg =<0>; + interrupt-parent =<&gpio5>; + interrupts =<15 IRQ_TYPE_EDGE_RISING>; + pinctrl-names = "default"; + pinctrl-0 =<&pinctrl_max1027>; + /* SPI mode = 0 */ + spi-cpol =<0>; + spi-cpha =<0>; + spi-max-frequency =<100>; +}; diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 3633298..12a78eb 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -112,6 +112,15 @@ config LPC32XX_ADC activate only one via device tree selection. Provides direct access via sysfs. +config MAX1027 + tristate "Maxim max1027 ADC driver" + depends on SPI + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for Maxim SPI ADC models + max1027, max1029 and max1031. + config MXS_LRADC tristate "Freescale i.MX23/i.MX28 LRADC" depends on ARCH_MXS || COMPILE_TEST diff --git a/drivers/staging/iio/adc/Makefile b/drivers/staging/iio/adc/Makefile index 3e9fb14..22fbd0c 100644 --- a/drivers/staging/iio/adc/Makefile +++ b/drivers/staging/iio/adc/Makefile @@ -18,5 +18,6 @@ obj-$(CONFIG_AD7816) += ad7816.o obj-$(CONFIG_AD7192) += ad7192.o obj-$(CONFIG_AD7280) += ad7280a.o obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o +obj-$(CONFIG_MAX1027) += max1027.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_SPEAR_ADC) += spear_adc.o diff --git a/drivers/staging/iio/adc/max1027.c b/drivers/staging/iio/adc/max1027.c new file mode 100644 index 000..c2e5936 --- /dev/null +++ b/drivers/staging/iio/adc/max1027.c @@ -0,0 +1,553 @@ + /* + * iio/adc/max1027.c + * Copyright (C) 2014 Philippe Reynes + * + * based on linux/drivers/iio/ad7923.c + * Copyright 2011 Analog Devices Inc (from AD7923 Driver) + * Copyright 2012 CS Systemes d'Information + * + * 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. + * + * max1027.c + * + * Partial support for max1027 and similar chips. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define MAX1027_CONV_REG 0x80 +#define MAX1027_SETUP_REG 0x40 +#define MAX1027_AVG_REG 0x20 +#define MAX1027_RST_REG 0x10 + +/* conversion register */ +#define MAX1027_TEMP 0x01 +#define MAX1027_SCAN_0_N (0x00<< 1) +#define MAX1027_SCAN_N_M (0x01<< 1) +#define MAX1027_SCAN_N(0x02<< 1) +#define MAX1027_NOSCAN(0x03<< 1) +#define MAX1027_CHAN(n) ((n)<< 3) + +/* setup register */ +#define MAX1027_UNIPOLAR 0x02 +#define MAX1027_BIPOLAR 0x03 +#define MAX1027_REF_MODE0 (0x00<< 2) +#define MAX1027_REF_MODE1 (0x01<< 2) +#define MAX1027_REF_MODE2 (0x02<< 2) +#define MAX1027_REF_MODE3 (0x03<< 2) +#define MAX1027_CKS_MODE0 (0x00<< 4) +#define MAX1027_CKS_MODE1 (0x01<< 4) +#define MAX1027_CKS_MODE2 (0x02<< 4) +#define MAX1027_CKS_MODE3 (0x03<< 4) + +/* averaging register */ +#define MAX1027_NSCAN_4 0x00 +#define MAX1027_NSCAN_8 0x01 +#define MAX1027_NSCAN_12 0x02 +#define MAX1027_NSCAN_16 0x03 +#define MAX1027_NAVG_4(0x00<< 2) +#define MAX1027_NAVG_8(0x01<< 2)
Re: [PATCH][RT] 2.6.24-rc2-rt1 drivers/dma/ioat_dma.c compile fix
Steven Rostedt wrote: > On Fri, 16 Nov 2007, Nelson, Shannon wrote: >> first->async_tx.phys; >>> - __list_splice(&new_chain, ioat_chan->used_desc.prev); >>> + list_splice_tail(&new_chain, ioat_chan->used_desc.prev); >>> >> NAK. >> >> These functions do insertions differently. The 'prev' is pointing to >> the last valid descriptor in the queue and you really want to get the >> new_chain stuck on after this. Your list_splice_tail() will insert the >> new_chain just before it which will muck up the order of the DMA >> requests. >> >> You might have more success with >> list_splice_tail(&new_chain, ioat_chan->used_desc); >> where used_desc points to the whole list, rather than using the .prev >> pointer to a specific node. >> >> Please copy me on future ioatdma related comments. >> > > And people wonder why we post RT related patches to LKML. This is exactly > why! > > Thanks for the response Shannon! > > -- Steve > Hi I've tried this change, but it still don't compile. So I propose this patch. regards, trem Index: linux-2.6.23/drivers/dma/ioat_dma.c === --- linux-2.6.23.orig/drivers/dma/ioat_dma.c +++ linux-2.6.23/drivers/dma/ioat_dma.c @@ -244,7 +244,7 @@ static dma_cookie_t ioat_tx_submit(struc /* write address into NextDescriptor field of last desc in chain */ to_ioat_desc(ioat_chan->used_desc.prev)->hw->next = first->async_tx.phys; - __list_splice(&new_chain, ioat_chan->used_desc.prev); + list_splice_tail(&new_chain, &ioat_chan->used_desc); ioat_chan->pending += desc_count; if (ioat_chan->pending >= 4) { - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.23-rc8-mm1 : wgt634u.c
Hi I've applied the 2.6.23-rc8-mm1 patch, and I've got a new directory "mips" at root of my linux source. This directory only contain : "bcm947xx/wgt634u.c" I think that this directory "bcm947xx" should be added in "arch/mips" subdirectory. regards, trem - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.23-rc6-mm1 -- ipg.c don't compile on i386 with CONFIG_HIGHMEM64G
Hi I've tried to compile 2.6.23-rc6-mm1, but it fails on ipg.c with the error : Setup is 10964 bytes (padded to 11264 bytes). System is 1640 kB Kernel: arch/i386/boot/bzImage is ready (#1) Building modules, stage 2. MODPOST 2030 modules WARNING: Can't handle masks in drivers/mtd/nand/cafe_nand:0 ERROR: "__udivdi3" [drivers/net/ipg.ko] undefined! make[1]: *** [__modpost] Error 1 make: *** [modules] Error 2 error: Bad exit status from /home/trem/rpm/tmp/rpm-tmp.23895 (%build) I've instigated a bit, and I've found this code in ipg.c : static void ipg_nic_txfree(struct net_device *dev) { struct ipg_nic_private *sp = netdev_priv(dev); void __iomem *ioaddr = sp->ioaddr; const unsigned int curr = ipg_r32(TFD_LIST_PTR_0) - (sp->txd_map / sizeof(struct ipg_tx)) - 1; unsigned int released, pending; sp->txd_map is an u64 because : dma_addr_t txd_map; And in asm-i386/types.h, I see : #ifdef CONFIG_HIGHMEM64G typedef u64 dma_addr_t; #else typedef u32 dma_addr_t; #endif I my config, I use CONFIG_HIGHMEM64G sizeof(struct ipg_tx) is an u32 So the div failed on i386 because of u64 / u32. I propose the following patch : --- linux-2.6.22.old/drivers/net/ipg.c 2007-09-21 20:28:57.0 -0400 +++ linux-2.6.22.new/drivers/net/ipg.c 2007-09-21 20:22:15.0 -0400 @@ -837,7 +837,7 @@ static void ipg_nic_txfree(struct net_de struct ipg_nic_private *sp = netdev_priv(dev); void __iomem *ioaddr = sp->ioaddr; const unsigned int curr = ipg_r32(TFD_LIST_PTR_0) - - (sp->txd_map / sizeof(struct ipg_tx)) - 1; + do_div(sp->txd_map , sizeof(struct ipg_tx)) - 1; unsigned int released, pending; IPG_DEBUG_MSG("_nic_txfree\n"); With this patch, it compiles on i386 and x86_64, but I haven't tested if this network card works (I don't have it). regards, trem - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/