From: Martin Peres <martin.pe...@free.fr>

Signed-off-by: Karol Herbst <nouv...@karolherbst.de>
---
 drm/nouveau/include/nvkm/core/device.h     |  83 +++++++++----------
 drm/nouveau/include/nvkm/subdev/iccsense.h |  10 +++
 drm/nouveau/nvkm/core/subdev.c             |  83 +++++++++----------
 drm/nouveau/nvkm/engine/device/base.c      | 124 +++++++++++++++--------------
 drm/nouveau/nvkm/engine/device/priv.h      |   1 +
 drm/nouveau/nvkm/subdev/Kbuild             |   1 +
 drm/nouveau/nvkm/subdev/iccsense/Kbuild    |   1 +
 drm/nouveau/nvkm/subdev/iccsense/base.c    |  43 ++++++++++
 drm/nouveau/nvkm/subdev/iccsense/priv.h    |   8 ++
 9 files changed, 212 insertions(+), 142 deletions(-)
 create mode 100644 drm/nouveau/include/nvkm/subdev/iccsense.h
 create mode 100644 drm/nouveau/nvkm/subdev/iccsense/Kbuild
 create mode 100644 drm/nouveau/nvkm/subdev/iccsense/base.c
 create mode 100644 drm/nouveau/nvkm/subdev/iccsense/priv.h

diff --git a/drm/nouveau/include/nvkm/core/device.h 
b/drm/nouveau/include/nvkm/core/device.h
index 913192c..0940442 100644
--- a/drm/nouveau/include/nvkm/core/device.h
+++ b/drm/nouveau/include/nvkm/core/device.h
@@ -22,6 +22,7 @@ enum nvkm_devidx {
        NVKM_SUBDEV_BAR,
        NVKM_SUBDEV_PMU,
        NVKM_SUBDEV_VOLT,
+       NVKM_SUBDEV_ICCSENSE,
        NVKM_SUBDEV_THERM,
        NVKM_SUBDEV_CLK,
 
@@ -109,6 +110,7 @@ struct nvkm_device {
        struct nvkm_gpio *gpio;
        struct nvkm_i2c *i2c;
        struct nvkm_subdev *ibus;
+       struct nvkm_iccsense *iccsense;
        struct nvkm_instmem *imem;
        struct nvkm_ltc *ltc;
        struct nvkm_mc *mc;
@@ -164,46 +166,47 @@ struct nvkm_device_quirk {
 struct nvkm_device_chip {
        const char *name;
 
-       int (*bar    )(struct nvkm_device *, int idx, struct nvkm_bar **);
-       int (*bios   )(struct nvkm_device *, int idx, struct nvkm_bios **);
-       int (*bus    )(struct nvkm_device *, int idx, struct nvkm_bus **);
-       int (*clk    )(struct nvkm_device *, int idx, struct nvkm_clk **);
-       int (*devinit)(struct nvkm_device *, int idx, struct nvkm_devinit **);
-       int (*fb     )(struct nvkm_device *, int idx, struct nvkm_fb **);
-       int (*fuse   )(struct nvkm_device *, int idx, struct nvkm_fuse **);
-       int (*gpio   )(struct nvkm_device *, int idx, struct nvkm_gpio **);
-       int (*i2c    )(struct nvkm_device *, int idx, struct nvkm_i2c **);
-       int (*ibus   )(struct nvkm_device *, int idx, struct nvkm_subdev **);
-       int (*imem   )(struct nvkm_device *, int idx, struct nvkm_instmem **);
-       int (*ltc    )(struct nvkm_device *, int idx, struct nvkm_ltc **);
-       int (*mc     )(struct nvkm_device *, int idx, struct nvkm_mc **);
-       int (*mmu    )(struct nvkm_device *, int idx, struct nvkm_mmu **);
-       int (*mxm    )(struct nvkm_device *, int idx, struct nvkm_subdev **);
-       int (*pci    )(struct nvkm_device *, int idx, struct nvkm_pci **);
-       int (*pmu    )(struct nvkm_device *, int idx, struct nvkm_pmu **);
-       int (*therm  )(struct nvkm_device *, int idx, struct nvkm_therm **);
-       int (*timer  )(struct nvkm_device *, int idx, struct nvkm_timer **);
-       int (*volt   )(struct nvkm_device *, int idx, struct nvkm_volt **);
-
-       int (*bsp    )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*ce[3]  )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*cipher )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*disp   )(struct nvkm_device *, int idx, struct nvkm_disp **);
-       int (*dma    )(struct nvkm_device *, int idx, struct nvkm_dma **);
-       int (*fifo   )(struct nvkm_device *, int idx, struct nvkm_fifo **);
-       int (*gr     )(struct nvkm_device *, int idx, struct nvkm_gr **);
-       int (*ifb    )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*me     )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*mpeg   )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*msenc  )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*mspdec )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*msppp  )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*msvld  )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*pm     )(struct nvkm_device *, int idx, struct nvkm_pm **);
-       int (*sec    )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*sw     )(struct nvkm_device *, int idx, struct nvkm_sw **);
-       int (*vic    )(struct nvkm_device *, int idx, struct nvkm_engine **);
-       int (*vp     )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*bar     )(struct nvkm_device *, int idx, struct nvkm_bar **);
+       int (*bios    )(struct nvkm_device *, int idx, struct nvkm_bios **);
+       int (*bus     )(struct nvkm_device *, int idx, struct nvkm_bus **);
+       int (*clk     )(struct nvkm_device *, int idx, struct nvkm_clk **);
+       int (*devinit )(struct nvkm_device *, int idx, struct nvkm_devinit **);
+       int (*fb      )(struct nvkm_device *, int idx, struct nvkm_fb **);
+       int (*fuse    )(struct nvkm_device *, int idx, struct nvkm_fuse **);
+       int (*gpio    )(struct nvkm_device *, int idx, struct nvkm_gpio **);
+       int (*i2c     )(struct nvkm_device *, int idx, struct nvkm_i2c **);
+       int (*ibus    )(struct nvkm_device *, int idx, struct nvkm_subdev **);
+       int (*iccsense)(struct nvkm_device *, int idx, struct nvkm_iccsense **);
+       int (*imem    )(struct nvkm_device *, int idx, struct nvkm_instmem **);
+       int (*ltc     )(struct nvkm_device *, int idx, struct nvkm_ltc **);
+       int (*mc      )(struct nvkm_device *, int idx, struct nvkm_mc **);
+       int (*mmu     )(struct nvkm_device *, int idx, struct nvkm_mmu **);
+       int (*mxm     )(struct nvkm_device *, int idx, struct nvkm_subdev **);
+       int (*pci     )(struct nvkm_device *, int idx, struct nvkm_pci **);
+       int (*pmu     )(struct nvkm_device *, int idx, struct nvkm_pmu **);
+       int (*therm   )(struct nvkm_device *, int idx, struct nvkm_therm **);
+       int (*timer   )(struct nvkm_device *, int idx, struct nvkm_timer **);
+       int (*volt    )(struct nvkm_device *, int idx, struct nvkm_volt **);
+
+       int (*bsp     )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*ce[3]   )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*cipher  )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*disp    )(struct nvkm_device *, int idx, struct nvkm_disp **);
+       int (*dma     )(struct nvkm_device *, int idx, struct nvkm_dma **);
+       int (*fifo    )(struct nvkm_device *, int idx, struct nvkm_fifo **);
+       int (*gr      )(struct nvkm_device *, int idx, struct nvkm_gr **);
+       int (*ifb     )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*me      )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*mpeg    )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*msenc   )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*mspdec  )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*msppp   )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*msvld   )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*pm      )(struct nvkm_device *, int idx, struct nvkm_pm **);
+       int (*sec     )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*sw      )(struct nvkm_device *, int idx, struct nvkm_sw **);
+       int (*vic     )(struct nvkm_device *, int idx, struct nvkm_engine **);
+       int (*vp      )(struct nvkm_device *, int idx, struct nvkm_engine **);
 };
 
 struct nvkm_device *nvkm_device_find(u64 name);
diff --git a/drm/nouveau/include/nvkm/subdev/iccsense.h 
b/drm/nouveau/include/nvkm/subdev/iccsense.h
new file mode 100644
index 0000000..7fee41d
--- /dev/null
+++ b/drm/nouveau/include/nvkm/subdev/iccsense.h
@@ -0,0 +1,10 @@
+#ifndef __NVKM_ICCSENSE_H__
+#define __NVKM_ICCSENSE_H__
+
+#include <core/subdev.h>
+
+struct nvkm_iccsense {
+       struct nvkm_subdev subdev;
+};
+
+#endif
diff --git a/drm/nouveau/nvkm/core/subdev.c b/drm/nouveau/nvkm/core/subdev.c
index 7de9847..370041f 100644
--- a/drm/nouveau/nvkm/core/subdev.c
+++ b/drm/nouveau/nvkm/core/subdev.c
@@ -29,47 +29,48 @@ static struct lock_class_key 
nvkm_subdev_lock_class[NVKM_SUBDEV_NR];
 
 const char *
 nvkm_subdev_name[NVKM_SUBDEV_NR] = {
-       [NVKM_SUBDEV_BAR    ] = "bar",
-       [NVKM_SUBDEV_VBIOS  ] = "bios",
-       [NVKM_SUBDEV_BUS    ] = "bus",
-       [NVKM_SUBDEV_CLK    ] = "clk",
-       [NVKM_SUBDEV_DEVINIT] = "devinit",
-       [NVKM_SUBDEV_FB     ] = "fb",
-       [NVKM_SUBDEV_FUSE   ] = "fuse",
-       [NVKM_SUBDEV_GPIO   ] = "gpio",
-       [NVKM_SUBDEV_I2C    ] = "i2c",
-       [NVKM_SUBDEV_IBUS   ] = "priv",
-       [NVKM_SUBDEV_INSTMEM] = "imem",
-       [NVKM_SUBDEV_LTC    ] = "ltc",
-       [NVKM_SUBDEV_MC     ] = "mc",
-       [NVKM_SUBDEV_MMU    ] = "mmu",
-       [NVKM_SUBDEV_MXM    ] = "mxm",
-       [NVKM_SUBDEV_PCI    ] = "pci",
-       [NVKM_SUBDEV_PMU    ] = "pmu",
-       [NVKM_SUBDEV_THERM  ] = "therm",
-       [NVKM_SUBDEV_TIMER  ] = "tmr",
-       [NVKM_SUBDEV_VOLT   ] = "volt",
-       [NVKM_ENGINE_BSP    ] = "bsp",
-       [NVKM_ENGINE_CE0    ] = "ce0",
-       [NVKM_ENGINE_CE1    ] = "ce1",
-       [NVKM_ENGINE_CE2    ] = "ce2",
-       [NVKM_ENGINE_CIPHER ] = "cipher",
-       [NVKM_ENGINE_DISP   ] = "disp",
-       [NVKM_ENGINE_DMAOBJ ] = "dma",
-       [NVKM_ENGINE_FIFO   ] = "fifo",
-       [NVKM_ENGINE_GR     ] = "gr",
-       [NVKM_ENGINE_IFB    ] = "ifb",
-       [NVKM_ENGINE_ME     ] = "me",
-       [NVKM_ENGINE_MPEG   ] = "mpeg",
-       [NVKM_ENGINE_MSENC  ] = "msenc",
-       [NVKM_ENGINE_MSPDEC ] = "mspdec",
-       [NVKM_ENGINE_MSPPP  ] = "msppp",
-       [NVKM_ENGINE_MSVLD  ] = "msvld",
-       [NVKM_ENGINE_PM     ] = "pm",
-       [NVKM_ENGINE_SEC    ] = "sec",
-       [NVKM_ENGINE_SW     ] = "sw",
-       [NVKM_ENGINE_VIC    ] = "vic",
-       [NVKM_ENGINE_VP     ] = "vp",
+       [NVKM_SUBDEV_BAR     ] = "bar",
+       [NVKM_SUBDEV_VBIOS   ] = "bios",
+       [NVKM_SUBDEV_BUS     ] = "bus",
+       [NVKM_SUBDEV_CLK     ] = "clk",
+       [NVKM_SUBDEV_DEVINIT ] = "devinit",
+       [NVKM_SUBDEV_FB      ] = "fb",
+       [NVKM_SUBDEV_FUSE    ] = "fuse",
+       [NVKM_SUBDEV_GPIO    ] = "gpio",
+       [NVKM_SUBDEV_I2C     ] = "i2c",
+       [NVKM_SUBDEV_IBUS    ] = "priv",
+       [NVKM_SUBDEV_ICCSENSE] = "iccsense",
+       [NVKM_SUBDEV_INSTMEM ] = "imem",
+       [NVKM_SUBDEV_LTC     ] = "ltc",
+       [NVKM_SUBDEV_MC      ] = "mc",
+       [NVKM_SUBDEV_MMU     ] = "mmu",
+       [NVKM_SUBDEV_MXM     ] = "mxm",
+       [NVKM_SUBDEV_PCI     ] = "pci",
+       [NVKM_SUBDEV_PMU     ] = "pmu",
+       [NVKM_SUBDEV_THERM   ] = "therm",
+       [NVKM_SUBDEV_TIMER   ] = "tmr",
+       [NVKM_SUBDEV_VOLT    ] = "volt",
+       [NVKM_ENGINE_BSP     ] = "bsp",
+       [NVKM_ENGINE_CE0     ] = "ce0",
+       [NVKM_ENGINE_CE1     ] = "ce1",
+       [NVKM_ENGINE_CE2     ] = "ce2",
+       [NVKM_ENGINE_CIPHER  ] = "cipher",
+       [NVKM_ENGINE_DISP    ] = "disp",
+       [NVKM_ENGINE_DMAOBJ  ] = "dma",
+       [NVKM_ENGINE_FIFO    ] = "fifo",
+       [NVKM_ENGINE_GR      ] = "gr",
+       [NVKM_ENGINE_IFB     ] = "ifb",
+       [NVKM_ENGINE_ME      ] = "me",
+       [NVKM_ENGINE_MPEG    ] = "mpeg",
+       [NVKM_ENGINE_MSENC   ] = "msenc",
+       [NVKM_ENGINE_MSPDEC  ] = "mspdec",
+       [NVKM_ENGINE_MSPPP   ] = "msppp",
+       [NVKM_ENGINE_MSVLD   ] = "msvld",
+       [NVKM_ENGINE_PM      ] = "pm",
+       [NVKM_ENGINE_SEC     ] = "sec",
+       [NVKM_ENGINE_SW      ] = "sw",
+       [NVKM_ENGINE_VIC     ] = "vic",
+       [NVKM_ENGINE_VP      ] = "vp",
 };
 
 void
diff --git a/drm/nouveau/nvkm/engine/device/base.c 
b/drm/nouveau/nvkm/engine/device/base.c
index 3f4b868..a239e49 100644
--- a/drm/nouveau/nvkm/engine/device/base.c
+++ b/drm/nouveau/nvkm/engine/device/base.c
@@ -2102,26 +2102,27 @@ nvkm_device_subdev(struct nvkm_device *device, int 
index)
 
        switch (index) {
 #define _(n,p,m) case NVKM_SUBDEV_##n: if (p) return (m); break
-       _(BAR    , device->bar    , &device->bar->subdev);
-       _(VBIOS  , device->bios   , &device->bios->subdev);
-       _(BUS    , device->bus    , &device->bus->subdev);
-       _(CLK    , device->clk    , &device->clk->subdev);
-       _(DEVINIT, device->devinit, &device->devinit->subdev);
-       _(FB     , device->fb     , &device->fb->subdev);
-       _(FUSE   , device->fuse   , &device->fuse->subdev);
-       _(GPIO   , device->gpio   , &device->gpio->subdev);
-       _(I2C    , device->i2c    , &device->i2c->subdev);
-       _(IBUS   , device->ibus   ,  device->ibus);
-       _(INSTMEM, device->imem   , &device->imem->subdev);
-       _(LTC    , device->ltc    , &device->ltc->subdev);
-       _(MC     , device->mc     , &device->mc->subdev);
-       _(MMU    , device->mmu    , &device->mmu->subdev);
-       _(MXM    , device->mxm    ,  device->mxm);
-       _(PCI    , device->pci    , &device->pci->subdev);
-       _(PMU    , device->pmu    , &device->pmu->subdev);
-       _(THERM  , device->therm  , &device->therm->subdev);
-       _(TIMER  , device->timer  , &device->timer->subdev);
-       _(VOLT   , device->volt   , &device->volt->subdev);
+       _(BAR     , device->bar     , &device->bar->subdev);
+       _(VBIOS   , device->bios    , &device->bios->subdev);
+       _(BUS     , device->bus     , &device->bus->subdev);
+       _(CLK     , device->clk     , &device->clk->subdev);
+       _(DEVINIT , device->devinit , &device->devinit->subdev);
+       _(FB      , device->fb      , &device->fb->subdev);
+       _(FUSE    , device->fuse    , &device->fuse->subdev);
+       _(GPIO    , device->gpio    , &device->gpio->subdev);
+       _(I2C     , device->i2c     , &device->i2c->subdev);
+       _(IBUS    , device->ibus    ,  device->ibus);
+       _(ICCSENSE, device->iccsense, &device->iccsense->subdev);
+       _(INSTMEM , device->imem    , &device->imem->subdev);
+       _(LTC     , device->ltc     , &device->ltc->subdev);
+       _(MC      , device->mc      , &device->mc->subdev);
+       _(MMU     , device->mmu     , &device->mmu->subdev);
+       _(MXM     , device->mxm     ,  device->mxm);
+       _(PCI     , device->pci     , &device->pci->subdev);
+       _(PMU     , device->pmu     , &device->pmu->subdev);
+       _(THERM   , device->therm   , &device->therm->subdev);
+       _(TIMER   , device->timer   , &device->timer->subdev);
+       _(VOLT    , device->volt    , &device->volt->subdev);
 #undef _
        default:
                engine = nvkm_device_engine(device, index);
@@ -2551,47 +2552,48 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
        }                                                                      \
        break
                switch (i) {
-               _(NVKM_SUBDEV_BAR    ,     bar);
-               _(NVKM_SUBDEV_VBIOS  ,    bios);
-               _(NVKM_SUBDEV_BUS    ,     bus);
-               _(NVKM_SUBDEV_CLK    ,     clk);
-               _(NVKM_SUBDEV_DEVINIT, devinit);
-               _(NVKM_SUBDEV_FB     ,      fb);
-               _(NVKM_SUBDEV_FUSE   ,    fuse);
-               _(NVKM_SUBDEV_GPIO   ,    gpio);
-               _(NVKM_SUBDEV_I2C    ,     i2c);
-               _(NVKM_SUBDEV_IBUS   ,    ibus);
-               _(NVKM_SUBDEV_INSTMEM,    imem);
-               _(NVKM_SUBDEV_LTC    ,     ltc);
-               _(NVKM_SUBDEV_MC     ,      mc);
-               _(NVKM_SUBDEV_MMU    ,     mmu);
-               _(NVKM_SUBDEV_MXM    ,     mxm);
-               _(NVKM_SUBDEV_PCI    ,     pci);
-               _(NVKM_SUBDEV_PMU    ,     pmu);
-               _(NVKM_SUBDEV_THERM  ,   therm);
-               _(NVKM_SUBDEV_TIMER  ,   timer);
-               _(NVKM_SUBDEV_VOLT   ,    volt);
-               _(NVKM_ENGINE_BSP    ,     bsp);
-               _(NVKM_ENGINE_CE0    ,   ce[0]);
-               _(NVKM_ENGINE_CE1    ,   ce[1]);
-               _(NVKM_ENGINE_CE2    ,   ce[2]);
-               _(NVKM_ENGINE_CIPHER ,  cipher);
-               _(NVKM_ENGINE_DISP   ,    disp);
-               _(NVKM_ENGINE_DMAOBJ ,     dma);
-               _(NVKM_ENGINE_FIFO   ,    fifo);
-               _(NVKM_ENGINE_GR     ,      gr);
-               _(NVKM_ENGINE_IFB    ,     ifb);
-               _(NVKM_ENGINE_ME     ,      me);
-               _(NVKM_ENGINE_MPEG   ,    mpeg);
-               _(NVKM_ENGINE_MSENC  ,   msenc);
-               _(NVKM_ENGINE_MSPDEC ,  mspdec);
-               _(NVKM_ENGINE_MSPPP  ,   msppp);
-               _(NVKM_ENGINE_MSVLD  ,   msvld);
-               _(NVKM_ENGINE_PM     ,      pm);
-               _(NVKM_ENGINE_SEC    ,     sec);
-               _(NVKM_ENGINE_SW     ,      sw);
-               _(NVKM_ENGINE_VIC    ,     vic);
-               _(NVKM_ENGINE_VP     ,      vp);
+               _(NVKM_SUBDEV_BAR     ,      bar);
+               _(NVKM_SUBDEV_VBIOS   ,     bios);
+               _(NVKM_SUBDEV_BUS     ,      bus);
+               _(NVKM_SUBDEV_CLK     ,      clk);
+               _(NVKM_SUBDEV_DEVINIT ,  devinit);
+               _(NVKM_SUBDEV_FB      ,       fb);
+               _(NVKM_SUBDEV_FUSE    ,     fuse);
+               _(NVKM_SUBDEV_GPIO    ,     gpio);
+               _(NVKM_SUBDEV_I2C     ,      i2c);
+               _(NVKM_SUBDEV_IBUS    ,     ibus);
+               _(NVKM_SUBDEV_ICCSENSE, iccsense);
+               _(NVKM_SUBDEV_INSTMEM ,     imem);
+               _(NVKM_SUBDEV_LTC     ,      ltc);
+               _(NVKM_SUBDEV_MC      ,       mc);
+               _(NVKM_SUBDEV_MMU     ,      mmu);
+               _(NVKM_SUBDEV_MXM     ,      mxm);
+               _(NVKM_SUBDEV_PCI     ,      pci);
+               _(NVKM_SUBDEV_PMU     ,      pmu);
+               _(NVKM_SUBDEV_THERM   ,    therm);
+               _(NVKM_SUBDEV_TIMER   ,    timer);
+               _(NVKM_SUBDEV_VOLT    ,     volt);
+               _(NVKM_ENGINE_BSP     ,      bsp);
+               _(NVKM_ENGINE_CE0     ,    ce[0]);
+               _(NVKM_ENGINE_CE1     ,    ce[1]);
+               _(NVKM_ENGINE_CE2     ,    ce[2]);
+               _(NVKM_ENGINE_CIPHER  ,   cipher);
+               _(NVKM_ENGINE_DISP    ,     disp);
+               _(NVKM_ENGINE_DMAOBJ  ,      dma);
+               _(NVKM_ENGINE_FIFO    ,     fifo);
+               _(NVKM_ENGINE_GR      ,       gr);
+               _(NVKM_ENGINE_IFB     ,      ifb);
+               _(NVKM_ENGINE_ME      ,       me);
+               _(NVKM_ENGINE_MPEG    ,     mpeg);
+               _(NVKM_ENGINE_MSENC   ,    msenc);
+               _(NVKM_ENGINE_MSPDEC  ,   mspdec);
+               _(NVKM_ENGINE_MSPPP   ,    msppp);
+               _(NVKM_ENGINE_MSVLD   ,    msvld);
+               _(NVKM_ENGINE_PM      ,       pm);
+               _(NVKM_ENGINE_SEC     ,      sec);
+               _(NVKM_ENGINE_SW      ,       sw);
+               _(NVKM_ENGINE_VIC     ,      vic);
+               _(NVKM_ENGINE_VP      ,       vp);
                default:
                        WARN_ON(1);
                        continue;
diff --git a/drm/nouveau/nvkm/engine/device/priv.h 
b/drm/nouveau/nvkm/engine/device/priv.h
index ed3ad2c..49981a1 100644
--- a/drm/nouveau/nvkm/engine/device/priv.h
+++ b/drm/nouveau/nvkm/engine/device/priv.h
@@ -12,6 +12,7 @@
 #include <subdev/gpio.h>
 #include <subdev/i2c.h>
 #include <subdev/ibus.h>
+#include <subdev/iccsense.h>
 #include <subdev/instmem.h>
 #include <subdev/ltc.h>
 #include <subdev/mc.h>
diff --git a/drm/nouveau/nvkm/subdev/Kbuild b/drm/nouveau/nvkm/subdev/Kbuild
index ee2c38f..63d0587 100644
--- a/drm/nouveau/nvkm/subdev/Kbuild
+++ b/drm/nouveau/nvkm/subdev/Kbuild
@@ -8,6 +8,7 @@ include $(src)/nvkm/subdev/fuse/Kbuild
 include $(src)/nvkm/subdev/gpio/Kbuild
 include $(src)/nvkm/subdev/i2c/Kbuild
 include $(src)/nvkm/subdev/ibus/Kbuild
+include $(src)/nvkm/subdev/iccsense/Kbuild
 include $(src)/nvkm/subdev/instmem/Kbuild
 include $(src)/nvkm/subdev/ltc/Kbuild
 include $(src)/nvkm/subdev/mc/Kbuild
diff --git a/drm/nouveau/nvkm/subdev/iccsense/Kbuild 
b/drm/nouveau/nvkm/subdev/iccsense/Kbuild
new file mode 100644
index 0000000..b6863da
--- /dev/null
+++ b/drm/nouveau/nvkm/subdev/iccsense/Kbuild
@@ -0,0 +1 @@
+nvkm-y += nvkm/subdev/iccsense/base.o
diff --git a/drm/nouveau/nvkm/subdev/iccsense/base.c 
b/drm/nouveau/nvkm/subdev/iccsense/base.c
new file mode 100644
index 0000000..5dfa2fd
--- /dev/null
+++ b/drm/nouveau/nvkm/subdev/iccsense/base.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2015 Martin Peres
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Martin Peres
+ */
+#include "priv.h"
+
+struct nvkm_subdev_func iccsense_func = { 0 };
+
+int
+nvkm_iccsense_ctor(struct nvkm_device *device, int index,
+                  struct nvkm_iccsense *iccsense)
+{
+       nvkm_subdev_ctor(&iccsense_func, device, index, 0, &iccsense->subdev);
+       return 0;
+}
+
+int
+nvkm_iccsense_new_(struct nvkm_device *device, int index,
+                  struct nvkm_iccsense **iccsense)
+{
+       if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL)))
+               return -ENOMEM;
+       return nvkm_iccsense_ctor(device, index, *iccsense);
+}
diff --git a/drm/nouveau/nvkm/subdev/iccsense/priv.h 
b/drm/nouveau/nvkm/subdev/iccsense/priv.h
new file mode 100644
index 0000000..f0aa17a
--- /dev/null
+++ b/drm/nouveau/nvkm/subdev/iccsense/priv.h
@@ -0,0 +1,8 @@
+#ifndef __NVKM_ICCSENSE_PRIV_H__
+#define __NVKM_ICCSENSE_PRIV_H__
+#define nvkm_iccsense(p) container_of((p), struct nvkm_iccsense, subdev)
+#include <subdev/iccsense.h>
+
+int nvkm_iccsense_ctor(struct nvkm_device *, int, struct nvkm_iccsense *);
+int nvkm_iccsense_new_(struct nvkm_device *, int, struct nvkm_iccsense **);
+#endif
-- 
2.7.1

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to