]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'staging/staging-next'
authorThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:59:28 +0000 (14:59 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:59:28 +0000 (14:59 +0200)
1  2 
MAINTAINERS
drivers/input/touchscreen/ti_am335x_tsc.c
drivers/staging/et131x/et131x.c
drivers/staging/iio/meter/ade7753.c
drivers/staging/iio/meter/ade7754.c
drivers/staging/iio/meter/ade7759.c
drivers/staging/imx-drm/imx-drm-core.c
drivers/staging/imx-drm/ipuv3-crtc.c
include/linux/mfd/ti_am335x_tscadc.h

diff --combined MAINTAINERS
index 0ffe927dbbd906f52be196a9c36a35d6c286889c,57508c20eafc1a8ede45fbd9455c4791f96e2909..40cf7cd5fa0e6f35368649dee282d802b6b0da92
@@@ -253,20 -253,6 +253,20 @@@ F:       drivers/pci/*acpi
  F:    drivers/pci/*/*acpi*
  F:    drivers/pci/*/*/*acpi*
  
 +ACPI COMPONENT ARCHITECTURE (ACPICA)
 +M:    Robert Moore <robert.moore@intel.com>
 +M:    Lv Zheng <lv.zheng@intel.com>
 +M:    Rafael J. Wysocki <rafael.j.wysocki@intel.com>
 +L:    linux-acpi@vger.kernel.org
 +L:    devel@acpica.org
 +W:    https://acpica.org/
 +W:    https://github.com/acpica/acpica/
 +Q:    https://patchwork.kernel.org/project/linux-acpi/list/
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
 +S:    Supported
 +F:    drivers/acpi/acpica/
 +F:    include/acpi/
 +
  ACPI FAN DRIVER
  M:    Zhang Rui <rui.zhang@intel.com>
  L:    linux-acpi@vger.kernel.org
@@@ -1416,7 -1402,7 +1416,7 @@@ M:      Wolfram Sang <wsa@the-dreams.de
  L:    linux-i2c@vger.kernel.org
  S:    Maintained
  F:    drivers/misc/eeprom/at24.c
 -F:    include/linux/i2c/at24.h
 +F:    include/linux/platform_data/at24.h
  
  ATA OVER ETHERNET (AOE) DRIVER
  M:    "Ed L. Cashin" <ecashin@coraid.com>
@@@ -1672,9 -1658,9 +1672,9 @@@ F:      drivers/video/backlight
  F:    include/linux/backlight.h
  
  BATMAN ADVANCED
 -M:    Marek Lindner <lindner_marek@yahoo.de>
 -M:    Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
 -M:    Antonio Quartulli <ordex@autistici.org>
 +M:    Marek Lindner <mareklindner@neomailbox.ch>
 +M:    Simon Wunderlich <sw@simonwunderlich.de>
 +M:    Antonio Quartulli <antonio@meshcoding.com>
  L:    b.a.t.m.a.n@lists.open-mesh.org
  W:    http://www.open-mesh.org/
  S:    Maintained
@@@ -1805,7 -1791,6 +1805,7 @@@ F:      include/net/bluetooth
  
  BONDING DRIVER
  M:    Jay Vosburgh <fubar@us.ibm.com>
 +M:    Veaceslav Falico <vfalico@redhat.com>
  M:    Andy Gospodarek <andy@greyhouse.net>
  L:    netdev@vger.kernel.org
  W:    http://sourceforge.net/projects/bonding/
@@@ -2733,8 -2718,6 +2733,8 @@@ T:      git git://git.linaro.org/people/sumi
  DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
  M:    Vinod Koul <vinod.koul@intel.com>
  M:    Dan Williams <dan.j.williams@intel.com>
 +L:    dmaengine@vger.kernel.org
 +Q:    https://patchwork.kernel.org/project/linux-dmaengine/list/
  S:    Supported
  F:    drivers/dma/
  F:    include/linux/dma*
@@@ -2839,9 -2822,7 +2839,9 @@@ L:      dri-devel@lists.freedesktop.or
  L:    linux-tegra@vger.kernel.org
  T:    git git://anongit.freedesktop.org/tegra/linux.git
  S:    Maintained
 +F:    drivers/gpu/drm/tegra/
  F:    drivers/gpu/host1x/
 +F:    include/linux/host1x.h
  F:    include/uapi/drm/tegra_drm.h
  F:    Documentation/devicetree/bindings/gpu/nvidia,tegra20-host1x.txt
  
@@@ -3698,14 -3679,6 +3698,14 @@@ S:    Maintaine
  F:    include/asm-generic/
  F:    include/uapi/asm-generic/
  
 +GENERIC PHY FRAMEWORK
 +M:    Kishon Vijay Abraham I <kishon@ti.com>
 +L:    linux-kernel@vger.kernel.org
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git
 +S:    Supported
 +F:    drivers/phy/
 +F:    include/linux/phy/
 +
  GENERIC UIO DRIVER FOR PCI DEVICES
  M:    "Michael S. Tsirkin" <mst@redhat.com>
  L:    kvm@vger.kernel.org
@@@ -4247,7 -4220,7 +4247,7 @@@ S:      Maintaine
  F:    drivers/media/rc/iguanair.c
  
  IIO SUBSYSTEM AND DRIVERS
- M:    Jonathan Cameron <jic23@cam.ac.uk>
+ M:    Jonathan Cameron <jic23@kernel.org>
  L:    linux-iio@vger.kernel.org
  S:    Maintained
  F:    drivers/iio/
@@@ -4384,10 -4357,7 +4384,10 @@@ F:    arch/x86/kernel/microcode_intel.
  
  INTEL I/OAT DMA DRIVER
  M:    Dan Williams <dan.j.williams@intel.com>
 -S:    Maintained
 +M:    Dave Jiang <dave.jiang@intel.com>
 +L:    dmaengine@vger.kernel.org
 +Q:    https://patchwork.kernel.org/project/linux-dmaengine/list/
 +S:    Supported
  F:    drivers/dma/ioat*
  
  INTEL IOMMU (VT-d)
@@@ -4784,6 -4754,13 +4784,13 @@@ S:    Maintaine
  F:    Documentation/hwmon/k8temp
  F:    drivers/hwmon/k8temp.c
  
+ KTAP
+ M:    Jovi Zhangwei <jovi.zhangwei@gmail.com>
+ W:    http://www.ktap.org
+ L:    ktap@freelists.org
+ S:    Maintained
+ F:    drivers/staging/ktap/
  KCONFIG
  M:    Michal Marek <mmarek@suse.cz>
  L:    linux-kbuild@vger.kernel.org
@@@ -6408,12 -6385,6 +6415,12 @@@ S:    Supporte
  F:    Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt
  F:    drivers/pci/host/pci-tegra.c
  
 +PCI DRIVER FOR SAMSUNG EXYNOS
 +M:    Jingoo Han <jg1.han@samsung.com>
 +L:    linux-pci@vger.kernel.org
 +S:    Maintained
 +F:    drivers/pci/host/pci-exynos.c
 +
  PCMCIA SUBSYSTEM
  P:    Linux PCMCIA Team
  L:    linux-pcmcia@lists.infradead.org
@@@ -6884,14 -6855,6 +6891,14 @@@ L:    linux-hexagon@vger.kernel.or
  S:    Supported
  F:    arch/hexagon/
  
 +QUALCOMM WCN36XX WIRELESS DRIVER
 +M:    Eugene Krasnikov <k.eugene.e@gmail.com>
 +L:    wcn36xx@lists.infradead.org
 +W:    http://wireless.kernel.org/en/users/Drivers/wcn36xx
 +T:    git git://github.com/KrasnikovEugene/wcn36xx.git
 +S:    Supported
 +F:    drivers/net/wireless/ath/wcn36xx/
 +
  QUICKCAM PARALLEL PORT WEBCAMS
  M:    Hans Verkuil <hverkuil@xs4all.nl>
  L:    linux-media@vger.kernel.org
@@@ -6979,7 -6942,7 +6986,7 @@@ M:      "Paul E. McKenney" <paulmck@linux.vn
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
  F:    Documentation/RCU/torture.txt
 -F:    kernel/rcutorture.c
 +F:    kernel/rcu/torture.c
  
  RDC R-321X SoC
  M:    Florian Fainelli <florian@openwrt.org>
@@@ -7006,9 -6969,8 +7013,9 @@@ T:      git git://git.kernel.org/pub/scm/lin
  F:    Documentation/RCU/
  X:    Documentation/RCU/torture.txt
  F:    include/linux/rcu*
 -F:    kernel/rcu*
 -X:    kernel/rcutorture.c
 +X:    include/linux/srcu.h
 +F:    kernel/rcu/
 +X:    kernel/rcu/torture.c
  
  REAL TIME CLOCK (RTC) SUBSYSTEM
  M:    Alessandro Zummo <a.zummo@towertech.it>
@@@ -7333,8 -7295,6 +7340,8 @@@ S:      Maintaine
  F:    kernel/sched/
  F:    include/linux/sched.h
  F:    include/uapi/linux/sched.h
 +F:    kernel/wait.c
 +F:    include/linux/wait.h
  
  SCORE ARCHITECTURE
  M:    Chen Liqin <liqin.linux@gmail.com>
@@@ -7469,10 -7429,9 +7476,10 @@@ SELINUX SECURITY MODUL
  M:    Stephen Smalley <sds@tycho.nsa.gov>
  M:    James Morris <james.l.morris@oracle.com>
  M:    Eric Paris <eparis@parisplace.org>
 +M:    Paul Moore <paul@paul-moore.com>
  L:    selinux@tycho.nsa.gov (subscribers-only, general discussion)
  W:    http://selinuxproject.org
 -T:    git git://git.infradead.org/users/eparis/selinux.git
 +T:    git git://git.infradead.org/users/pcmoore/selinux
  S:    Supported
  F:    include/linux/selinux*
  F:    security/selinux/
@@@ -7698,8 -7657,8 +7705,8 @@@ M:      "Paul E. McKenney" <paulmck@linux.vn
  W:    http://www.rdrop.com/users/paulmck/RCU/
  S:    Supported
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 -F:    include/linux/srcu*
 -F:    kernel/srcu*
 +F:    include/linux/srcu.h
 +F:    kernel/rcu/srcu.c
  
  SMACK SECURITY MODULE
  M:    Casey Schaufler <casey@schaufler-ca.com>
@@@ -7870,13 -7829,6 +7877,13 @@@ F:    Documentation/sound/alsa/soc
  F:    sound/soc/
  F:    include/sound/soc*
  
 +SOUND - DMAENGINE HELPERS
 +M:    Lars-Peter Clausen <lars@metafoo.de>
 +S:    Supported
 +F:    include/sound/dmaengine_pcm.h
 +F:    sound/core/pcm_dmaengine.c
 +F:    sound/soc/soc-generic-dmaengine-pcm.c
 +
  SPARC + UltraSPARC (sparc/sparc64)
  M:    "David S. Miller" <davem@davemloft.net>
  L:    sparclinux@vger.kernel.org
@@@ -8034,7 -7986,7 +8041,7 @@@ S:      Maintaine
  F:    drivers/staging/media/go7007/
  
  STAGING - INDUSTRIAL IO
- M:    Jonathan Cameron <jic23@cam.ac.uk>
+ M:    Jonathan Cameron <jic23@kernel.org>
  L:    linux-iio@vger.kernel.org
  S:    Odd Fixes
  F:    drivers/staging/iio/
@@@ -8561,7 -8513,6 +8568,7 @@@ F:      drivers/media/usb/tm6000
  TPM DEVICE DRIVER
  M:    Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>
  M:    Ashley Lai <ashley@ashleylai.com>
 +M:    Peter Huewe <peterhuewe@gmx.de>
  M:    Rajiv Andrade <mail@srajiv.net>
  W:    http://tpmdd.sourceforge.net
  M:    Marcel Selhorst <tpmdd@selhorst.net>
@@@ -8658,6 -8609,14 +8665,6 @@@ S:     Maintaine
  F:    arch/m68k/*/*_no.*
  F:    arch/m68k/include/asm/*_no.*
  
 -UCLINUX FOR RENESAS H8/300 (H8300)
 -M:    Yoshinori Sato <ysato@users.sourceforge.jp>
 -W:    http://uclinux-h8.sourceforge.jp/
 -S:    Supported
 -F:    arch/h8300/
 -F:    drivers/ide/ide-h8300.c
 -F:    drivers/net/ethernet/8390/ne-h8300.c
 -
  UDF FILESYSTEM
  M:    Jan Kara <jack@suse.cz>
  S:    Maintained
index df9b24f7e2cb44efdb18e6b57fe4fa68562858b9,24e625c0b5314217accaee7886f2d05e2652901d..14b7390753ee7ce315780d92631a591158638870
@@@ -52,6 -52,7 +52,7 @@@ struct titsc 
        u32                     config_inp[4];
        u32                     bit_xp, bit_xn, bit_yp, bit_yn;
        u32                     inp_xp, inp_xn, inp_yp, inp_yn;
+       u32                     step_mask;
  };
  
  static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
@@@ -196,7 -197,8 +197,8 @@@ static void titsc_step_config(struct ti
  
        /* The steps1 … end and bit 0 for TS_Charge */
        stepenable = (1 << (end_step + 2)) - 1;
-       am335x_tsc_se_set(ts_dev->mfd_tscadc, stepenable);
+       ts_dev->step_mask = stepenable;
+       am335x_tsc_se_set(ts_dev->mfd_tscadc, ts_dev->step_mask);
  }
  
  static void titsc_read_coordinates(struct titsc *ts_dev,
@@@ -260,6 -262,10 +262,10 @@@ static irqreturn_t titsc_irq(int irq, v
        unsigned int fsm;
  
        status = titsc_readl(ts_dev, REG_IRQSTATUS);
+       /*
+        * ADC and touchscreen share the IRQ line.
+        * FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only
+        */
        if (status & IRQENB_FIFO0THRES) {
  
                titsc_read_coordinates(ts_dev, &x, &y, &z1, &z2);
  
        if (irqclr) {
                titsc_writel(ts_dev, REG_IRQSTATUS, irqclr);
-               am335x_tsc_se_update(ts_dev->mfd_tscadc);
+               am335x_tsc_se_set(ts_dev->mfd_tscadc, ts_dev->step_mask);
                return IRQ_HANDLED;
        }
        return IRQ_NONE;
@@@ -389,7 -395,7 +395,7 @@@ static int titsc_probe(struct platform_
        }
  
        err = request_irq(ts_dev->irq, titsc_irq,
-                         0, pdev->dev.driver->name, ts_dev);
+                         IRQF_SHARED, pdev->dev.driver->name, ts_dev);
        if (err) {
                dev_err(&pdev->dev, "failed to allocate irq.\n");
                goto err_free_mem;
@@@ -505,7 -511,7 +511,7 @@@ static struct platform_driver ti_tsc_dr
                .name   = "TI-am335x-tsc",
                .owner  = THIS_MODULE,
                .pm     = TITSC_PM_OPS,
 -              .of_match_table = of_match_ptr(ti_tsc_dt_ids),
 +              .of_match_table = ti_tsc_dt_ids,
        },
  };
  module_platform_driver(ti_tsc_driver);
index 61da7ee36e458ccd73a634839f5feda5a3d00808,7cd3d34707585c90f9155db6eac3b14ac59f9da8..51a39d55ff665d61816f8c804af6dbd0bbdacf73
@@@ -493,11 -493,8 +493,8 @@@ struct et131x_adapter 
        spinlock_t send_hw_lock;
  
        spinlock_t rcv_lock;
-       spinlock_t rcv_pend_lock;
        spinlock_t fbr_lock;
  
-       spinlock_t phy_lock;
        /* Packet Filter and look ahead size */
        u32 packet_filter;
  
@@@ -2777,10 -2774,9 +2774,9 @@@ static void et131x_handle_recv_interrup
                adapter->net_stats.rx_packets++;
  
                /* Set the status on the packet, either resources or success */
-               if (adapter->rx_ring.num_ready_recv < RFD_LOW_WATER_MARK) {
-                       dev_warn(&adapter->pdev->dev,
-                                   "RFD's are running out\n");
-               }
+               if (adapter->rx_ring.num_ready_recv < RFD_LOW_WATER_MARK)
+                       dev_warn(&adapter->pdev->dev, "RFD's are running out\n");
                count++;
        }
  
@@@ -3100,11 -3096,10 +3096,10 @@@ static int send_packet(struct sk_buff *
                shbufva = (u16 *) skb->data;
  
                if ((shbufva[0] == 0xffff) &&
-                   (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) {
+                   (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff))
                        tcb->flags |= FMP_DEST_BROAD;
-               } else if ((shbufva[0] & 0x3) == 0x0001) {
+               else if ((shbufva[0] & 0x3) == 0x0001)
                        tcb->flags |=  FMP_DEST_MULTI;
-               }
        }
  
        tcb->next = NULL;
@@@ -3926,9 -3921,7 +3921,7 @@@ static struct et131x_adapter *et131x_ad
        spin_lock_init(&adapter->tcb_ready_qlock);
        spin_lock_init(&adapter->send_hw_lock);
        spin_lock_init(&adapter->rcv_lock);
-       spin_lock_init(&adapter->rcv_pend_lock);
        spin_lock_init(&adapter->fbr_lock);
-       spin_lock_init(&adapter->phy_lock);
  
        adapter->registry_jumbo_packet = 1514;  /* 1514-9216 */
  
@@@ -4797,8 -4790,21 +4790,8 @@@ static int et131x_pci_setup(struct pci_
        pci_set_master(pdev);
  
        /* Check the DMA addressing support of this device */
 -      if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
 -              rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64));
 -              if (rc < 0) {
 -                      dev_err(&pdev->dev,
 -                        "Unable to obtain 64 bit DMA for consistent allocations\n");
 -                      goto err_release_res;
 -              }
 -      } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) {
 -              rc = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 -              if (rc < 0) {
 -                      dev_err(&pdev->dev,
 -                        "Unable to obtain 32 bit DMA for consistent allocations\n");
 -                      goto err_release_res;
 -              }
 -      } else {
 +      if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) &&
 +          dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
                dev_err(&pdev->dev, "No usable DMA addressing method\n");
                rc = -EIO;
                goto err_release_res;
index abfc8bd1794d03e4f89e75b1362b40a22d783f17,6200335d12f7171b460c060df7a02dc86235dd3c..00492cad7c57fb9778bc85881bd3fba02e513b3b
@@@ -86,7 -86,7 +86,7 @@@ static int ade7753_spi_read_reg_16(stru
        struct ade7753_state *st = iio_priv(indio_dev);
        ssize_t ret;
  
 -      ret = spi_w8r16(st->us, ADE7753_READ_REG(reg_address));
 +      ret = spi_w8r16be(st->us, ADE7753_READ_REG(reg_address));
        if (ret < 0) {
                dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
                        reg_address);
@@@ -94,6 -94,7 +94,6 @@@
        }
  
        *val = ret;
 -      *val = be16_to_cpup(val);
  
        return 0;
  }
@@@ -185,9 -186,9 +185,9 @@@ static ssize_t ade7753_write_8bit(struc
  {
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
        int ret;
-       long val;
+       u8 val;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou8(buf, 10, &val);
        if (ret)
                goto error_ret;
        ret = ade7753_spi_write_reg_8(dev, this_attr->address, val);
@@@ -203,9 -204,9 +203,9 @@@ static ssize_t ade7753_write_16bit(stru
  {
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
        int ret;
-       long val;
+       u16 val;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou16(buf, 10, &val);
        if (ret)
                goto error_ret;
        ret = ade7753_spi_write_reg_16(dev, this_attr->address, val);
@@@ -398,11 -399,11 +398,11 @@@ static ssize_t ade7753_write_frequency(
  {
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
        struct ade7753_state *st = iio_priv(indio_dev);
-       unsigned long val;
+       u16 val;
        int ret;
        u16 reg, t;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou16(buf, 10, &val);
        if (ret)
                return ret;
        if (val == 0)
@@@ -496,11 -497,9 +496,9 @@@ static int ade7753_probe(struct spi_dev
        struct iio_dev *indio_dev;
  
        /* setup the industrialio driver allocated elements */
-       indio_dev = iio_device_alloc(sizeof(*st));
-       if (indio_dev == NULL) {
-               ret = -ENOMEM;
-               goto error_ret;
-       }
+       indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+       if (!indio_dev)
+               return -ENOMEM;
        /* this is only used for removal purposes */
        spi_set_drvdata(spi, indio_dev);
  
        /* Get the device into a sane initial state */
        ret = ade7753_initial_setup(indio_dev);
        if (ret)
-               goto error_free_dev;
+               return ret;
  
        ret = iio_device_register(indio_dev);
        if (ret)
-               goto error_free_dev;
+               return ret;
  
        return 0;
- error_free_dev:
-       iio_device_free(indio_dev);
- error_ret:
-       return ret;
  }
  
  /* fixme, confirm ordering in this function */
@@@ -538,7 -531,6 +530,6 @@@ static int ade7753_remove(struct spi_de
  
        iio_device_unregister(indio_dev);
        ade7753_stop_device(&indio_dev->dev);
-       iio_device_free(indio_dev);
  
        return 0;
  }
index 3d1c02cd65384db7a9d6fa8e87eaa0542510e0db,2e046f6e4fb4873e1917983ff6c1474ad803dba3..e0aa13ab3657bad3dbd4e1e6424a10fd3ff526ba
@@@ -86,7 -86,7 +86,7 @@@ static int ade7754_spi_read_reg_16(stru
        struct ade7754_state *st = iio_priv(indio_dev);
        int ret;
  
 -      ret = spi_w8r16(st->us, ADE7754_READ_REG(reg_address));
 +      ret = spi_w8r16be(st->us, ADE7754_READ_REG(reg_address));
        if (ret < 0) {
                dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
                        reg_address);
@@@ -94,6 -94,7 +94,6 @@@
        }
  
        *val = ret;
 -      *val = be16_to_cpup(val);
  
        return 0;
  }
@@@ -185,9 -186,9 +185,9 @@@ static ssize_t ade7754_write_8bit(struc
  {
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
        int ret;
-       long val;
+       u8 val;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou8(buf, 10, &val);
        if (ret)
                goto error_ret;
        ret = ade7754_spi_write_reg_8(dev, this_attr->address, val);
@@@ -203,9 -204,9 +203,9 @@@ static ssize_t ade7754_write_16bit(stru
  {
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
        int ret;
-       long val;
+       u16 val;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou16(buf, 10, &val);
        if (ret)
                goto error_ret;
        ret = ade7754_spi_write_reg_16(dev, this_attr->address, val);
@@@ -418,11 -419,11 +418,11 @@@ static ssize_t ade7754_write_frequency(
  {
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
        struct ade7754_state *st = iio_priv(indio_dev);
-       unsigned long val;
+       u16 val;
        int ret;
        u8 reg, t;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou16(buf, 10, &val);
        if (ret)
                return ret;
        if (val == 0)
@@@ -519,11 -520,9 +519,9 @@@ static int ade7754_probe(struct spi_dev
        struct iio_dev *indio_dev;
  
        /* setup the industrialio driver allocated elements */
-       indio_dev = iio_device_alloc(sizeof(*st));
-       if (indio_dev == NULL) {
-               ret = -ENOMEM;
-               goto error_ret;
-       }
+       indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+       if (!indio_dev)
+               return -ENOMEM;
        /* this is only used for removal purposes */
        spi_set_drvdata(spi, indio_dev);
  
        /* Get the device into a sane initial state */
        ret = ade7754_initial_setup(indio_dev);
        if (ret)
-               goto error_free_dev;
+               return ret;
        ret = iio_device_register(indio_dev);
        if (ret)
-               goto error_free_dev;
+               return ret;
  
        return 0;
- error_free_dev:
-       iio_device_free(indio_dev);
- error_ret:
-       return ret;
  }
  
  /* fixme, confirm ordering in this function */
@@@ -560,7 -553,6 +552,6 @@@ static int ade7754_remove(struct spi_de
  
        iio_device_unregister(indio_dev);
        ade7754_stop_device(&indio_dev->dev);
-       iio_device_free(indio_dev);
  
        return 0;
  }
index 7467e51fd42497c4885a953b34e7e644358a5945,145f896aae2b4c38d3663809863f0ff9db2652b6..ea0c9debf8bf90604669ce9ad982a7fa6eac0dd6
@@@ -86,7 -86,7 +86,7 @@@ static int ade7759_spi_read_reg_16(stru
        struct ade7759_state *st = iio_priv(indio_dev);
        int ret;
  
 -      ret = spi_w8r16(st->us, ADE7759_READ_REG(reg_address));
 +      ret = spi_w8r16be(st->us, ADE7759_READ_REG(reg_address));
        if (ret < 0) {
                dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
                        reg_address);
@@@ -94,6 -94,7 +94,6 @@@
        }
  
        *val = ret;
 -      *val = be16_to_cpup(val);
  
        return 0;
  }
@@@ -184,9 -185,9 +184,9 @@@ static ssize_t ade7759_write_8bit(struc
  {
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
        int ret;
-       long val;
+       u8 val;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou8(buf, 10, &val);
        if (ret)
                goto error_ret;
        ret = ade7759_spi_write_reg_8(dev, this_attr->address, val);
@@@ -202,9 -203,9 +202,9 @@@ static ssize_t ade7759_write_16bit(stru
  {
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
        int ret;
-       long val;
+       u16 val;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou16(buf, 10, &val);
        if (ret)
                goto error_ret;
        ret = ade7759_spi_write_reg_16(dev, this_attr->address, val);
@@@ -359,11 -360,11 +359,11 @@@ static ssize_t ade7759_write_frequency(
  {
        struct iio_dev *indio_dev = dev_to_iio_dev(dev);
        struct ade7759_state *st = iio_priv(indio_dev);
-       unsigned long val;
+       u16 val;
        int ret;
        u16 reg, t;
  
-       ret = strict_strtol(buf, 10, &val);
+       ret = kstrtou16(buf, 10, &val);
        if (ret)
                return ret;
        if (val == 0)
@@@ -443,11 -444,9 +443,9 @@@ static int ade7759_probe(struct spi_dev
        struct iio_dev *indio_dev;
  
        /* setup the industrialio driver allocated elements */
-       indio_dev = iio_device_alloc(sizeof(*st));
-       if (indio_dev == NULL) {
-               ret = -ENOMEM;
-               goto error_ret;
-       }
+       indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+       if (!indio_dev)
+               return -ENOMEM;
        /* this is only used for removal purposes */
        spi_set_drvdata(spi, indio_dev);
  
        /* Get the device into a sane initial state */
        ret = ade7759_initial_setup(indio_dev);
        if (ret)
-               goto error_free_dev;
+               return ret;
  
        ret = iio_device_register(indio_dev);
        if (ret)
-               goto error_free_dev;
+               return ret;
  
        return 0;
- error_free_dev:
-       iio_device_free(indio_dev);
- error_ret:
-       return ret;
  }
  
  /* fixme, confirm ordering in this function */
@@@ -483,7 -477,6 +476,6 @@@ static int ade7759_remove(struct spi_de
  
        iio_device_unregister(indio_dev);
        ade7759_stop_device(&indio_dev->dev);
-       iio_device_free(indio_dev);
  
        return 0;
  }
index ad135d3c3281f40f3d45b4148c0538cf05a7cc37,d2fb699c0d1d9ff4a0366934b3062aadd19c8ee7..2828311bf039103afddfb0285b84cfbf8d464e53
@@@ -68,6 -68,11 +68,11 @@@ struct imx_drm_connector 
        struct module                           *owner;
  };
  
+ int imx_drm_crtc_id(struct imx_drm_crtc *crtc)
+ {
+       return crtc->pipe;
+ }
  static void imx_drm_driver_lastclose(struct drm_device *drm)
  {
        struct imx_drm_device *imxdrm = drm->dev_private;
@@@ -110,18 -115,12 +115,12 @@@ int imx_drm_crtc_panel_format_pins(stru
        struct imx_drm_crtc *imx_crtc;
        struct imx_drm_crtc_helper_funcs *helper;
  
-       mutex_lock(&imxdrm->mutex);
        list_for_each_entry(imx_crtc, &imxdrm->crtc_list, list)
                if (imx_crtc->crtc == crtc)
                        goto found;
  
-       mutex_unlock(&imxdrm->mutex);
        return -EINVAL;
  found:
-       mutex_unlock(&imxdrm->mutex);
        helper = &imx_crtc->imx_drm_helper_funcs;
        if (helper->set_interface_pix_fmt)
                return helper->set_interface_pix_fmt(crtc,
@@@ -191,6 -190,18 +190,18 @@@ static void imx_drm_disable_vblank(stru
        imx_drm_crtc->imx_drm_helper_funcs.disable_vblank(imx_drm_crtc->crtc);
  }
  
+ static void imx_drm_driver_preclose(struct drm_device *drm,
+               struct drm_file *file)
+ {
+       int i;
+       if (!file->is_master)
+               return;
+       for (i = 0; i < 4; i++)
+               imx_drm_disable_vblank(drm , i);
+ }
  static const struct file_operations imx_drm_driver_fops = {
        .owner = THIS_MODULE,
        .open = drm_open,
@@@ -396,14 -407,14 +407,14 @@@ static int imx_drm_driver_load(struct d
  
        /*
         * enable drm irq mode.
 -       * - with irq_enabled = 1, we can use the vblank feature.
 +       * - with irq_enabled = true, we can use the vblank feature.
         *
         * P.S. note that we wouldn't use drm irq handler but
         *      just specific driver own one instead because
         *      drm framework supports only one irq handler and
         *      drivers can well take care of their interrupts
         */
 -      drm->irq_enabled = 1;
 +      drm->irq_enabled = true;
  
        drm_mode_config_init(drm);
        imx_drm_mode_config_init(drm);
                goto err_init;
  
        /*
 -       * with vblank_disable_allowed = 1, vblank interrupt will be disabled
 +       * with vblank_disable_allowed = true, vblank interrupt will be disabled
         * by drm timer once a current process gives up ownership of
         * vblank event.(after drm_vblank_put function is called)
         */
 -      imxdrm->drm->vblank_disable_allowed = 1;
 +      imxdrm->drm->vblank_disable_allowed = true;
  
        if (!imx_drm_device_get())
                ret = -EINVAL;
@@@ -647,20 -658,14 +658,14 @@@ int imx_drm_encoder_get_mux_id(struct i
        struct imx_drm_crtc *imx_crtc;
        int i = 0;
  
-       mutex_lock(&imxdrm->mutex);
        list_for_each_entry(imx_crtc, &imxdrm->crtc_list, list) {
                if (imx_crtc->crtc == crtc)
                        goto found;
                i++;
        }
  
-       mutex_unlock(&imxdrm->mutex);
        return -EINVAL;
  found:
-       mutex_unlock(&imxdrm->mutex);
        return i;
  }
  EXPORT_SYMBOL_GPL(imx_drm_encoder_get_mux_id);
@@@ -774,16 -779,26 +779,26 @@@ static const struct drm_ioctl_desc imx_
  };
  
  static struct drm_driver imx_drm_driver = {
-       .driver_features        = DRIVER_MODESET | DRIVER_GEM,
+       .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME,
        .load                   = imx_drm_driver_load,
        .unload                 = imx_drm_driver_unload,
        .lastclose              = imx_drm_driver_lastclose,
+       .preclose               = imx_drm_driver_preclose,
        .gem_free_object        = drm_gem_cma_free_object,
        .gem_vm_ops             = &drm_gem_cma_vm_ops,
        .dumb_create            = drm_gem_cma_dumb_create,
        .dumb_map_offset        = drm_gem_cma_dumb_map_offset,
        .dumb_destroy           = drm_gem_dumb_destroy,
  
+       .prime_handle_to_fd     = drm_gem_prime_handle_to_fd,
+       .prime_fd_to_handle     = drm_gem_prime_fd_to_handle,
+       .gem_prime_import       = drm_gem_prime_import,
+       .gem_prime_export       = drm_gem_prime_export,
+       .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
+       .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,
+       .gem_prime_vmap         = drm_gem_cma_prime_vmap,
+       .gem_prime_vunmap       = drm_gem_cma_prime_vunmap,
+       .gem_prime_mmap         = drm_gem_cma_prime_mmap,
        .get_vblank_counter     = drm_vblank_count,
        .enable_vblank          = imx_drm_enable_vblank,
        .disable_vblank         = imx_drm_disable_vblank,
  
  static int imx_drm_platform_probe(struct platform_device *pdev)
  {
 +      int ret;
 +
 +      ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 +      if (ret)
 +              return ret;
 +
        imx_drm_device->dev = &pdev->dev;
  
        return drm_platform_init(&imx_drm_driver, pdev);
@@@ -848,6 -857,8 +863,6 @@@ static int __init imx_drm_init(void
                goto err_pdev;
        }
  
 -      imx_drm_pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32),
 -
        ret = platform_driver_register(&imx_drm_pdrv);
        if (ret)
                goto err_pdrv;
index 9e73e8d8c9aaa350267ac25f0926a5cd8d7c6416,f1112dfa6bf6b4a861f7306b85d43ebd5b43baa6..794dfc16dca3b937079375d54619c3930b811f51
  #include <drm/drm_crtc_helper.h>
  #include <linux/fb.h>
  #include <linux/clk.h>
+ #include <linux/errno.h>
  #include <drm/drm_gem_cma_helper.h>
  #include <drm/drm_fb_cma_helper.h>
  
  #include "ipu-v3/imx-ipu-v3.h"
  #include "imx-drm.h"
+ #include "ipuv3-plane.h"
  
  #define DRIVER_DESC           "i.MX IPUv3 Graphics"
  
- struct ipu_framebuffer {
-       struct drm_framebuffer  base;
-       void                    *virt;
-       dma_addr_t              phys;
-       size_t                  len;
- };
  struct ipu_crtc {
        struct device           *dev;
        struct drm_crtc         base;
        struct imx_drm_crtc     *imx_crtc;
-       struct ipuv3_channel    *ipu_ch;
+       /* plane[0] is the full plane, plane[1] is the partial plane */
+       struct ipu_plane        *plane[2];
        struct ipu_dc           *dc;
-       struct ipu_dp           *dp;
-       struct dmfc_channel     *dmfc;
        struct ipu_di           *di;
        int                     enabled;
        struct drm_pending_vblank_event *page_flip_event;
  
  #define to_ipu_crtc(x) container_of(x, struct ipu_crtc, base)
  
- static int calc_vref(struct drm_display_mode *mode)
- {
-       unsigned long htotal, vtotal;
-       htotal = mode->htotal;
-       vtotal = mode->vtotal;
-       if (!htotal || !vtotal)
-               return 60;
-       return mode->clock * 1000 / vtotal / htotal;
- }
- static int calc_bandwidth(struct drm_display_mode *mode, unsigned int vref)
- {
-       return mode->hdisplay * mode->vdisplay * vref;
- }
  static void ipu_fb_enable(struct ipu_crtc *ipu_crtc)
  {
        if (ipu_crtc->enabled)
                return;
  
        ipu_di_enable(ipu_crtc->di);
-       ipu_dmfc_enable_channel(ipu_crtc->dmfc);
-       ipu_idmac_enable_channel(ipu_crtc->ipu_ch);
        ipu_dc_enable_channel(ipu_crtc->dc);
-       if (ipu_crtc->dp)
-               ipu_dp_enable_channel(ipu_crtc->dp);
+       ipu_plane_enable(ipu_crtc->plane[0]);
  
        ipu_crtc->enabled = 1;
  }
@@@ -99,11 -74,8 +74,8 @@@ static void ipu_fb_disable(struct ipu_c
        if (!ipu_crtc->enabled)
                return;
  
-       if (ipu_crtc->dp)
-               ipu_dp_disable_channel(ipu_crtc->dp);
+       ipu_plane_disable(ipu_crtc->plane[0]);
        ipu_dc_disable_channel(ipu_crtc->dc);
-       ipu_idmac_disable_channel(ipu_crtc->ipu_ch);
-       ipu_dmfc_disable_channel(ipu_crtc->dmfc);
        ipu_di_disable(ipu_crtc->di);
  
        ipu_crtc->enabled = 0;
@@@ -159,33 -131,6 +131,6 @@@ static const struct drm_crtc_funcs ipu_
        .page_flip = ipu_page_flip,
  };
  
- static int ipu_drm_set_base(struct drm_crtc *crtc, int x, int y)
- {
-       struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
-       struct drm_gem_cma_object *cma_obj;
-       struct drm_framebuffer *fb = crtc->fb;
-       unsigned long phys;
-       cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
-       if (!cma_obj) {
-               DRM_LOG_KMS("entry is null.\n");
-               return -EFAULT;
-       }
-       phys = cma_obj->paddr;
-       phys += x * (fb->bits_per_pixel >> 3);
-       phys += y * fb->pitches[0];
-       dev_dbg(ipu_crtc->dev, "%s: phys: 0x%lx\n", __func__, phys);
-       dev_dbg(ipu_crtc->dev, "%s: xy: %dx%d\n", __func__, x, y);
-       ipu_cpmem_set_stride(ipu_get_cpmem(ipu_crtc->ipu_ch), fb->pitches[0]);
-       ipu_cpmem_set_buffer(ipu_get_cpmem(ipu_crtc->ipu_ch),
-                         0, phys);
-       return 0;
- }
  static int ipu_crtc_mode_set(struct drm_crtc *crtc,
                               struct drm_display_mode *orig_mode,
                               struct drm_display_mode *mode,
                               struct drm_framebuffer *old_fb)
  {
        struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
-       struct drm_framebuffer *fb = ipu_crtc->base.fb;
        int ret;
        struct ipu_di_signal_cfg sig_cfg = {};
        u32 out_pixel_fmt;
-       struct ipu_ch_param __iomem *cpmem = ipu_get_cpmem(ipu_crtc->ipu_ch);
-       int bpp;
-       u32 v4l2_fmt;
  
        dev_dbg(ipu_crtc->dev, "%s: mode->hdisplay: %d\n", __func__,
                        mode->hdisplay);
        dev_dbg(ipu_crtc->dev, "%s: mode->vdisplay: %d\n", __func__,
                        mode->vdisplay);
  
-       ipu_ch_param_zero(cpmem);
-       switch (fb->pixel_format) {
-       case DRM_FORMAT_XRGB8888:
-       case DRM_FORMAT_ARGB8888:
-               v4l2_fmt = V4L2_PIX_FMT_RGB32;
-               bpp = 32;
-               break;
-       case DRM_FORMAT_RGB565:
-               v4l2_fmt = V4L2_PIX_FMT_RGB565;
-               bpp = 16;
-               break;
-       case DRM_FORMAT_RGB888:
-               v4l2_fmt = V4L2_PIX_FMT_RGB24;
-               bpp = 24;
-               break;
-       default:
-               dev_err(ipu_crtc->dev, "unsupported pixel format 0x%08x\n",
-                               fb->pixel_format);
-               return -EINVAL;
-       }
        out_pixel_fmt = ipu_crtc->interface_pix_fmt;
  
        if (mode->flags & DRM_MODE_FLAG_INTERLACE)
        sig_cfg.hsync_pin = ipu_crtc->di_hsync_pin;
        sig_cfg.vsync_pin = ipu_crtc->di_vsync_pin;
  
-       if (ipu_crtc->dp) {
-               ret = ipu_dp_setup_channel(ipu_crtc->dp, IPUV3_COLORSPACE_RGB,
-                               IPUV3_COLORSPACE_RGB);
-               if (ret) {
-                       dev_err(ipu_crtc->dev,
-                               "initializing display processor failed with %d\n",
-                               ret);
-                       return ret;
-               }
-               ipu_dp_set_global_alpha(ipu_crtc->dp, 1, 0, 1);
-       }
        ret = ipu_dc_init_sync(ipu_crtc->dc, ipu_crtc->di, sig_cfg.interlaced,
                        out_pixel_fmt, mode->hdisplay);
        if (ret) {
                return ret;
        }
  
-       ipu_cpmem_set_resolution(cpmem, mode->hdisplay, mode->vdisplay);
-       ipu_cpmem_set_fmt(cpmem, v4l2_fmt);
-       ipu_cpmem_set_high_priority(ipu_crtc->ipu_ch);
-       ret = ipu_dmfc_init_channel(ipu_crtc->dmfc, mode->hdisplay);
-       if (ret) {
-               dev_err(ipu_crtc->dev,
-                               "initializing dmfc channel failed with %d\n",
-                               ret);
-               return ret;
-       }
-       ret = ipu_dmfc_alloc_bandwidth(ipu_crtc->dmfc,
-                       calc_bandwidth(mode, calc_vref(mode)), 64);
-       if (ret) {
-               dev_err(ipu_crtc->dev,
-                               "allocating dmfc bandwidth failed with %d\n",
-                               ret);
-               return ret;
-       }
-       ipu_drm_set_base(crtc, x, y);
-       return 0;
+       return ipu_plane_mode_set(ipu_crtc->plane[0], crtc, mode, crtc->fb,
+                                 0, 0, mode->hdisplay, mode->vdisplay,
+                                 x, y, mode->hdisplay, mode->vdisplay);
  }
  
  static void ipu_crtc_handle_pageflip(struct ipu_crtc *ipu_crtc)
@@@ -332,7 -218,7 +218,7 @@@ static irqreturn_t ipu_irq_handler(int 
  
        if (ipu_crtc->newfb) {
                ipu_crtc->newfb = NULL;
-               ipu_drm_set_base(&ipu_crtc->base, 0, 0);
+               ipu_plane_set_base(ipu_crtc->plane[0], ipu_crtc->base.fb, 0, 0);
                ipu_crtc_handle_pageflip(ipu_crtc);
        }
  
@@@ -370,10 -256,6 +256,6 @@@ static struct drm_crtc_helper_funcs ipu
  
  static int ipu_enable_vblank(struct drm_crtc *crtc)
  {
-       struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
-       enable_irq(ipu_crtc->irq);
        return 0;
  }
  
@@@ -381,7 -263,8 +263,8 @@@ static void ipu_disable_vblank(struct d
  {
        struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
  
-       disable_irq(ipu_crtc->irq);
+       ipu_crtc->page_flip_event = NULL;
+       ipu_crtc->newfb = NULL;
  }
  
  static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc, u32 encoder_type,
@@@ -418,12 -301,8 +301,8 @@@ static const struct imx_drm_crtc_helper
  
  static void ipu_put_resources(struct ipu_crtc *ipu_crtc)
  {
-       if (!IS_ERR_OR_NULL(ipu_crtc->ipu_ch))
-               ipu_idmac_put(ipu_crtc->ipu_ch);
-       if (!IS_ERR_OR_NULL(ipu_crtc->dmfc))
-               ipu_dmfc_put(ipu_crtc->dmfc);
-       if (!IS_ERR_OR_NULL(ipu_crtc->dp))
-               ipu_dp_put(ipu_crtc->dp);
+       if (!IS_ERR_OR_NULL(ipu_crtc->dc))
+               ipu_dc_put(ipu_crtc->dc);
        if (!IS_ERR_OR_NULL(ipu_crtc->di))
                ipu_di_put(ipu_crtc->di);
  }
@@@ -434,32 -313,12 +313,12 @@@ static int ipu_get_resources(struct ipu
        struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
        int ret;
  
-       ipu_crtc->ipu_ch = ipu_idmac_get(ipu, pdata->dma[0]);
-       if (IS_ERR(ipu_crtc->ipu_ch)) {
-               ret = PTR_ERR(ipu_crtc->ipu_ch);
-               goto err_out;
-       }
        ipu_crtc->dc = ipu_dc_get(ipu, pdata->dc);
        if (IS_ERR(ipu_crtc->dc)) {
                ret = PTR_ERR(ipu_crtc->dc);
                goto err_out;
        }
  
-       ipu_crtc->dmfc = ipu_dmfc_get(ipu, pdata->dma[0]);
-       if (IS_ERR(ipu_crtc->dmfc)) {
-               ret = PTR_ERR(ipu_crtc->dmfc);
-               goto err_out;
-       }
-       if (pdata->dp >= 0) {
-               ipu_crtc->dp = ipu_dp_get(ipu, pdata->dp);
-               if (IS_ERR(ipu_crtc->dp)) {
-                       ret = PTR_ERR(ipu_crtc->dp);
-                       goto err_out;
-               }
-       }
        ipu_crtc->di = ipu_di_get(ipu, pdata->di);
        if (IS_ERR(ipu_crtc->di)) {
                ret = PTR_ERR(ipu_crtc->di);
@@@ -477,7 -336,9 +336,9 @@@ static int ipu_crtc_init(struct ipu_crt
                struct ipu_client_platformdata *pdata)
  {
        struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
+       int dp = -EINVAL;
        int ret;
+       int id;
  
        ret = ipu_get_resources(ipu_crtc, pdata);
        if (ret) {
                goto err_put_resources;
        }
  
-       ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch,
-                       IPU_IRQ_EOF);
+       if (pdata->dp >= 0)
+               dp = IPU_DP_FLOW_SYNC_BG;
+       id = imx_drm_crtc_id(ipu_crtc->imx_crtc);
+       ipu_crtc->plane[0] = ipu_plane_init(ipu_crtc->base.dev, ipu,
+                                           pdata->dma[0], dp, BIT(id), true);
+       ret = ipu_plane_get_resources(ipu_crtc->plane[0]);
+       if (ret) {
+               dev_err(ipu_crtc->dev, "getting plane 0 resources failed with %d.\n",
+                       ret);
+               goto err_remove_crtc;
+       }
+       /* If this crtc is using the DP, add an overlay plane */
+       if (pdata->dp >= 0 && pdata->dma[1] > 0) {
+               ipu_crtc->plane[1] = ipu_plane_init(ipu_crtc->base.dev, ipu,
+                                                   pdata->dma[1],
+                                                   IPU_DP_FLOW_SYNC_FG,
+                                                   BIT(id), false);
+               if (IS_ERR(ipu_crtc->plane[1]))
+                       ipu_crtc->plane[1] = NULL;
+       }
+       ipu_crtc->irq = ipu_plane_irq(ipu_crtc->plane[0]);
        ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, ipu_irq_handler, 0,
                        "imx_drm", ipu_crtc);
        if (ret < 0) {
                dev_err(ipu_crtc->dev, "irq request failed with %d.\n", ret);
-               goto err_put_resources;
+               goto err_put_plane_res;
        }
  
-       disable_irq(ipu_crtc->irq);
        return 0;
  
+ err_put_plane_res:
+       ipu_plane_put_resources(ipu_crtc->plane[0]);
+ err_remove_crtc:
+       imx_drm_remove_crtc(ipu_crtc->imx_crtc);
  err_put_resources:
        ipu_put_resources(ipu_crtc);
  
@@@ -523,9 -407,7 +407,9 @@@ static int ipu_drm_probe(struct platfor
        if (!pdata)
                return -EINVAL;
  
 -      pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 +      ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
 +      if (ret)
 +              return ret;
  
        ipu_crtc = devm_kzalloc(&pdev->dev, sizeof(*ipu_crtc), GFP_KERNEL);
        if (!ipu_crtc)
@@@ -548,6 -430,7 +432,7 @@@ static int ipu_drm_remove(struct platfo
  
        imx_drm_remove_crtc(ipu_crtc->imx_crtc);
  
+       ipu_plane_put_resources(ipu_crtc->plane[0]);
        ipu_put_resources(ipu_crtc);
  
        return 0;
index 7b68a061cd60f8df9bf64441576f304870bf660f,08cce7f96ab9365359c30a4726d910022f571be5..d498d98f0c2cbfd3c9076aa439433a23caa80899
  /* Step Enable */
  #define STEPENB_MASK          (0x1FFFF << 0)
  #define STEPENB(val)          ((val) << 0)
+ #define ENB(val)                      (1 << (val))
+ #define STPENB_STEPENB                STEPENB(0x1FFFF)
+ #define STPENB_STEPENB_TC     STEPENB(0x1FFF)
  
  /* IRQ enable */
  #define IRQENB_HW_PEN         BIT(0)
  #define IRQENB_FIFO0THRES     BIT(2)
+ #define IRQENB_FIFO0OVRRUN    BIT(3)
+ #define IRQENB_FIFO0UNDRFLW   BIT(4)
  #define IRQENB_FIFO1THRES     BIT(5)
+ #define IRQENB_FIFO1OVRRUN    BIT(6)
+ #define IRQENB_FIFO1UNDRFLW   BIT(7)
  #define IRQENB_PENUP          BIT(9)
  
  /* Step Configuration */
  #define STEPCONFIG_MODE_MASK  (3 << 0)
  #define STEPCONFIG_MODE(val)  ((val) << 0)
+ #define STEPCONFIG_MODE_SWCNT STEPCONFIG_MODE(1)
  #define STEPCONFIG_MODE_HWSYNC        STEPCONFIG_MODE(2)
  #define STEPCONFIG_AVG_MASK   (7 << 2)
  #define STEPCONFIG_AVG(val)   ((val) << 2)
  #define ADC_CLK                       3000000
  #define TOTAL_STEPS           16
  #define TOTAL_CHANNELS                8
+ #define FIFO1_THRESHOLD               19
  
  /*
 -* ADC runs at 3MHz, and it takes
 -* 15 cycles to latch one data output.
 -* Hence the idle time for ADC to
 -* process one sample data would be
 -* around 5 micro seconds.
 -*/
 -#define IDLE_TIMEOUT 5 /* microsec */
 + * time in us for processing a single channel, calculated as follows:
 + *
 + * num cycles = open delay + (sample delay + conv time) * averaging
 + *
 + * num cycles: 152 + (1 + 13) * 16 = 376
 + *
 + * clock frequency: 26MHz / 8 = 3.25MHz
 + * clock period: 1 / 3.25MHz = 308ns
 + *
 + * processing time: 376 * 308ns = 116us
 + */
 +#define IDLE_TIMEOUT 116 /* microsec */
  
  #define TSCADC_CELLS          2
  
@@@ -151,7 -155,6 +160,7 @@@ struct ti_tscadc_dev 
        struct mfd_cell cells[TSCADC_CELLS];
        u32 reg_se_cache;
        spinlock_t reg_lock;
 +      unsigned int clk_div;
  
        /* tsc device */
        struct titsc *tsc;