Commit dc06e366 authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs

drm/nouveau/subdev/iccsense: add new subdev for power sensors

Signed-off-by: default avatarKarol Herbst <nouveau@karolherbst.de>
Reviewed-by: default avatarMartin Peres <martin.peres@free.fr>
parent 923f1bd2
...@@ -22,6 +22,7 @@ enum nvkm_devidx { ...@@ -22,6 +22,7 @@ enum nvkm_devidx {
NVKM_SUBDEV_BAR, NVKM_SUBDEV_BAR,
NVKM_SUBDEV_PMU, NVKM_SUBDEV_PMU,
NVKM_SUBDEV_VOLT, NVKM_SUBDEV_VOLT,
NVKM_SUBDEV_ICCSENSE,
NVKM_SUBDEV_THERM, NVKM_SUBDEV_THERM,
NVKM_SUBDEV_CLK, NVKM_SUBDEV_CLK,
NVKM_SUBDEV_SECBOOT, NVKM_SUBDEV_SECBOOT,
...@@ -110,6 +111,7 @@ struct nvkm_device { ...@@ -110,6 +111,7 @@ struct nvkm_device {
struct nvkm_gpio *gpio; struct nvkm_gpio *gpio;
struct nvkm_i2c *i2c; struct nvkm_i2c *i2c;
struct nvkm_subdev *ibus; struct nvkm_subdev *ibus;
struct nvkm_iccsense *iccsense;
struct nvkm_instmem *imem; struct nvkm_instmem *imem;
struct nvkm_ltc *ltc; struct nvkm_ltc *ltc;
struct nvkm_mc *mc; struct nvkm_mc *mc;
...@@ -170,12 +172,13 @@ struct nvkm_device_chip { ...@@ -170,12 +172,13 @@ struct nvkm_device_chip {
int (*bios )(struct nvkm_device *, int idx, struct nvkm_bios **); int (*bios )(struct nvkm_device *, int idx, struct nvkm_bios **);
int (*bus )(struct nvkm_device *, int idx, struct nvkm_bus **); int (*bus )(struct nvkm_device *, int idx, struct nvkm_bus **);
int (*clk )(struct nvkm_device *, int idx, struct nvkm_clk **); int (*clk )(struct nvkm_device *, int idx, struct nvkm_clk **);
int (*devinit)(struct nvkm_device *, int idx, struct nvkm_devinit **); int (*devinit )(struct nvkm_device *, int idx, struct nvkm_devinit **);
int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **); int (*fb )(struct nvkm_device *, int idx, struct nvkm_fb **);
int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **); int (*fuse )(struct nvkm_device *, int idx, struct nvkm_fuse **);
int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **); int (*gpio )(struct nvkm_device *, int idx, struct nvkm_gpio **);
int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **); int (*i2c )(struct nvkm_device *, int idx, struct nvkm_i2c **);
int (*ibus )(struct nvkm_device *, int idx, struct nvkm_subdev **); 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 (*imem )(struct nvkm_device *, int idx, struct nvkm_instmem **);
int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **); int (*ltc )(struct nvkm_device *, int idx, struct nvkm_ltc **);
int (*mc )(struct nvkm_device *, int idx, struct nvkm_mc **); int (*mc )(struct nvkm_device *, int idx, struct nvkm_mc **);
...@@ -183,7 +186,7 @@ struct nvkm_device_chip { ...@@ -183,7 +186,7 @@ struct nvkm_device_chip {
int (*mxm )(struct nvkm_device *, int idx, struct nvkm_subdev **); int (*mxm )(struct nvkm_device *, int idx, struct nvkm_subdev **);
int (*pci )(struct nvkm_device *, int idx, struct nvkm_pci **); int (*pci )(struct nvkm_device *, int idx, struct nvkm_pci **);
int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **); int (*pmu )(struct nvkm_device *, int idx, struct nvkm_pmu **);
int (*secboot)(struct nvkm_device *, int idx, struct nvkm_secboot **); int (*secboot )(struct nvkm_device *, int idx, struct nvkm_secboot **);
int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **); int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **);
int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **); int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **);
int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **); int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **);
......
#ifndef __NVKM_ICCSENSE_H__
#define __NVKM_ICCSENSE_H__
#include <core/subdev.h>
struct nvkm_iccsense {
struct nvkm_subdev subdev;
};
#endif
...@@ -33,20 +33,21 @@ nvkm_subdev_name[NVKM_SUBDEV_NR] = { ...@@ -33,20 +33,21 @@ nvkm_subdev_name[NVKM_SUBDEV_NR] = {
[NVKM_SUBDEV_VBIOS ] = "bios", [NVKM_SUBDEV_VBIOS ] = "bios",
[NVKM_SUBDEV_BUS ] = "bus", [NVKM_SUBDEV_BUS ] = "bus",
[NVKM_SUBDEV_CLK ] = "clk", [NVKM_SUBDEV_CLK ] = "clk",
[NVKM_SUBDEV_DEVINIT] = "devinit", [NVKM_SUBDEV_DEVINIT ] = "devinit",
[NVKM_SUBDEV_FB ] = "fb", [NVKM_SUBDEV_FB ] = "fb",
[NVKM_SUBDEV_FUSE ] = "fuse", [NVKM_SUBDEV_FUSE ] = "fuse",
[NVKM_SUBDEV_GPIO ] = "gpio", [NVKM_SUBDEV_GPIO ] = "gpio",
[NVKM_SUBDEV_I2C ] = "i2c", [NVKM_SUBDEV_I2C ] = "i2c",
[NVKM_SUBDEV_IBUS ] = "priv", [NVKM_SUBDEV_IBUS ] = "priv",
[NVKM_SUBDEV_INSTMEM] = "imem", [NVKM_SUBDEV_ICCSENSE] = "iccsense",
[NVKM_SUBDEV_INSTMEM ] = "imem",
[NVKM_SUBDEV_LTC ] = "ltc", [NVKM_SUBDEV_LTC ] = "ltc",
[NVKM_SUBDEV_MC ] = "mc", [NVKM_SUBDEV_MC ] = "mc",
[NVKM_SUBDEV_MMU ] = "mmu", [NVKM_SUBDEV_MMU ] = "mmu",
[NVKM_SUBDEV_MXM ] = "mxm", [NVKM_SUBDEV_MXM ] = "mxm",
[NVKM_SUBDEV_PCI ] = "pci", [NVKM_SUBDEV_PCI ] = "pci",
[NVKM_SUBDEV_PMU ] = "pmu", [NVKM_SUBDEV_PMU ] = "pmu",
[NVKM_SUBDEV_SECBOOT] = "secboot", [NVKM_SUBDEV_SECBOOT ] = "secboot",
[NVKM_SUBDEV_THERM ] = "therm", [NVKM_SUBDEV_THERM ] = "therm",
[NVKM_SUBDEV_TIMER ] = "tmr", [NVKM_SUBDEV_TIMER ] = "tmr",
[NVKM_SUBDEV_VOLT ] = "volt", [NVKM_SUBDEV_VOLT ] = "volt",
......
...@@ -2111,20 +2111,21 @@ nvkm_device_subdev(struct nvkm_device *device, int index) ...@@ -2111,20 +2111,21 @@ nvkm_device_subdev(struct nvkm_device *device, int index)
_(VBIOS , device->bios , &device->bios->subdev); _(VBIOS , device->bios , &device->bios->subdev);
_(BUS , device->bus , &device->bus->subdev); _(BUS , device->bus , &device->bus->subdev);
_(CLK , device->clk , &device->clk->subdev); _(CLK , device->clk , &device->clk->subdev);
_(DEVINIT, device->devinit, &device->devinit->subdev); _(DEVINIT , device->devinit , &device->devinit->subdev);
_(FB , device->fb , &device->fb->subdev); _(FB , device->fb , &device->fb->subdev);
_(FUSE , device->fuse , &device->fuse->subdev); _(FUSE , device->fuse , &device->fuse->subdev);
_(GPIO , device->gpio , &device->gpio->subdev); _(GPIO , device->gpio , &device->gpio->subdev);
_(I2C , device->i2c , &device->i2c->subdev); _(I2C , device->i2c , &device->i2c->subdev);
_(IBUS , device->ibus , device->ibus); _(IBUS , device->ibus , device->ibus);
_(INSTMEM, device->imem , &device->imem->subdev); _(ICCSENSE, device->iccsense, &device->iccsense->subdev);
_(INSTMEM , device->imem , &device->imem->subdev);
_(LTC , device->ltc , &device->ltc->subdev); _(LTC , device->ltc , &device->ltc->subdev);
_(MC , device->mc , &device->mc->subdev); _(MC , device->mc , &device->mc->subdev);
_(MMU , device->mmu , &device->mmu->subdev); _(MMU , device->mmu , &device->mmu->subdev);
_(MXM , device->mxm , device->mxm); _(MXM , device->mxm , device->mxm);
_(PCI , device->pci , &device->pci->subdev); _(PCI , device->pci , &device->pci->subdev);
_(PMU , device->pmu , &device->pmu->subdev); _(PMU , device->pmu , &device->pmu->subdev);
_(SECBOOT, device->secboot, &device->secboot->subdev); _(SECBOOT , device->secboot , &device->secboot->subdev);
_(THERM , device->therm , &device->therm->subdev); _(THERM , device->therm , &device->therm->subdev);
_(TIMER , device->timer , &device->timer->subdev); _(TIMER , device->timer , &device->timer->subdev);
_(VOLT , device->volt , &device->volt->subdev); _(VOLT , device->volt , &device->volt->subdev);
...@@ -2561,20 +2562,21 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -2561,20 +2562,21 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
_(NVKM_SUBDEV_VBIOS , bios); _(NVKM_SUBDEV_VBIOS , bios);
_(NVKM_SUBDEV_BUS , bus); _(NVKM_SUBDEV_BUS , bus);
_(NVKM_SUBDEV_CLK , clk); _(NVKM_SUBDEV_CLK , clk);
_(NVKM_SUBDEV_DEVINIT, devinit); _(NVKM_SUBDEV_DEVINIT , devinit);
_(NVKM_SUBDEV_FB , fb); _(NVKM_SUBDEV_FB , fb);
_(NVKM_SUBDEV_FUSE , fuse); _(NVKM_SUBDEV_FUSE , fuse);
_(NVKM_SUBDEV_GPIO , gpio); _(NVKM_SUBDEV_GPIO , gpio);
_(NVKM_SUBDEV_I2C , i2c); _(NVKM_SUBDEV_I2C , i2c);
_(NVKM_SUBDEV_IBUS , ibus); _(NVKM_SUBDEV_IBUS , ibus);
_(NVKM_SUBDEV_INSTMEM, imem); _(NVKM_SUBDEV_ICCSENSE, iccsense);
_(NVKM_SUBDEV_INSTMEM , imem);
_(NVKM_SUBDEV_LTC , ltc); _(NVKM_SUBDEV_LTC , ltc);
_(NVKM_SUBDEV_MC , mc); _(NVKM_SUBDEV_MC , mc);
_(NVKM_SUBDEV_MMU , mmu); _(NVKM_SUBDEV_MMU , mmu);
_(NVKM_SUBDEV_MXM , mxm); _(NVKM_SUBDEV_MXM , mxm);
_(NVKM_SUBDEV_PCI , pci); _(NVKM_SUBDEV_PCI , pci);
_(NVKM_SUBDEV_PMU , pmu); _(NVKM_SUBDEV_PMU , pmu);
_(NVKM_SUBDEV_SECBOOT, secboot); _(NVKM_SUBDEV_SECBOOT , secboot);
_(NVKM_SUBDEV_THERM , therm); _(NVKM_SUBDEV_THERM , therm);
_(NVKM_SUBDEV_TIMER , timer); _(NVKM_SUBDEV_TIMER , timer);
_(NVKM_SUBDEV_VOLT , volt); _(NVKM_SUBDEV_VOLT , volt);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <subdev/gpio.h> #include <subdev/gpio.h>
#include <subdev/i2c.h> #include <subdev/i2c.h>
#include <subdev/ibus.h> #include <subdev/ibus.h>
#include <subdev/iccsense.h>
#include <subdev/instmem.h> #include <subdev/instmem.h>
#include <subdev/ltc.h> #include <subdev/ltc.h>
#include <subdev/mc.h> #include <subdev/mc.h>
......
...@@ -8,6 +8,7 @@ include $(src)/nvkm/subdev/fuse/Kbuild ...@@ -8,6 +8,7 @@ include $(src)/nvkm/subdev/fuse/Kbuild
include $(src)/nvkm/subdev/gpio/Kbuild include $(src)/nvkm/subdev/gpio/Kbuild
include $(src)/nvkm/subdev/i2c/Kbuild include $(src)/nvkm/subdev/i2c/Kbuild
include $(src)/nvkm/subdev/ibus/Kbuild include $(src)/nvkm/subdev/ibus/Kbuild
include $(src)/nvkm/subdev/iccsense/Kbuild
include $(src)/nvkm/subdev/instmem/Kbuild include $(src)/nvkm/subdev/instmem/Kbuild
include $(src)/nvkm/subdev/ltc/Kbuild include $(src)/nvkm/subdev/ltc/Kbuild
include $(src)/nvkm/subdev/mc/Kbuild include $(src)/nvkm/subdev/mc/Kbuild
......
nvkm-y += nvkm/subdev/iccsense/base.o
/*
* 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 };
void
nvkm_iccsense_ctor(struct nvkm_device *device, int index,
struct nvkm_iccsense *iccsense)
{
nvkm_subdev_ctor(&iccsense_func, device, index, 0, &iccsense->subdev);
}
int
nvkm_iccsense_new_(struct nvkm_device *device, int index,
struct nvkm_iccsense **iccsense)
{
if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL)))
return -ENOMEM;
nvkm_iccsense_ctor(device, index, *iccsense);
return 0;
}
#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>
void nvkm_iccsense_ctor(struct nvkm_device *, int, struct nvkm_iccsense *);
int nvkm_iccsense_new_(struct nvkm_device *, int, struct nvkm_iccsense **);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment