Suppor for various power sensors on GF100+

Submitted by Karol Herbst on Feb. 19, 2016, 1:01 a.m.

Details

Reviewer None
Submitted Feb. 19, 2016, 1:01 a.m.
Last Updated Feb. 24, 2016, 7:46 p.m.
Revision 4

Cover Letter(s)

Revision 1
      This is a complete rework from the last version I sent out.

Now the implementation is more centered around the power_rails we find in the
SENSE table instead of extdev centered. This makes the implementation a lot
easier and straightforward.

I've added support for the INA219, INA209 and INA3221 sensors found on multiple
Fermi and Kepler cards, but only the INA3221 bits are tested so far.

The power consumption is also exported via hwmon, so "sensors" will be able to
print it in userspace.

I am pretty sure I got the INA2X9 bits right, but somebody should check if it's
working on his card.

This work is based on Martins initial power sensor work and most of the ground
work was just copied from him.

Happy testing

Karol Herbst (2):
  iccsense: implement for ina209, ina219 and ina3221
  hwmon: add power consumption

Martin Peres (2):
  subdev/iccsense: add new subdev for power sensors
  nvbios/iccsense: add parsing of the SENSE table

 drm/nouveau/include/nvif/device.h               |   1 +
 drm/nouveau/include/nvkm/core/device.h          |  83 +++++-----
 drm/nouveau/include/nvkm/subdev/bios/extdev.h   |   3 +
 drm/nouveau/include/nvkm/subdev/bios/iccsense.h |  16 ++
 drm/nouveau/include/nvkm/subdev/i2c.h           |  16 ++
 drm/nouveau/include/nvkm/subdev/iccsense.h      |  15 ++
 drm/nouveau/nouveau_hwmon.c                     |  39 +++++
 drm/nouveau/nvkm/core/subdev.c                  |  83 +++++-----
 drm/nouveau/nvkm/engine/device/base.c           | 143 +++++++++--------
 drm/nouveau/nvkm/engine/device/priv.h           |   1 +
 drm/nouveau/nvkm/subdev/Kbuild                  |   1 +
 drm/nouveau/nvkm/subdev/bios/Kbuild             |   1 +
 drm/nouveau/nvkm/subdev/bios/iccsense.c         |  95 +++++++++++
 drm/nouveau/nvkm/subdev/iccsense/Kbuild         |   2 +
 drm/nouveau/nvkm/subdev/iccsense/base.c         | 200 ++++++++++++++++++++++++
 drm/nouveau/nvkm/subdev/iccsense/gf100.c        |  31 ++++
 drm/nouveau/nvkm/subdev/iccsense/priv.h         |  16 ++
 17 files changed, 604 insertions(+), 142 deletions(-)
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/iccsense.h
 create mode 100644 drm/nouveau/include/nvkm/subdev/iccsense.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/iccsense.c
 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/gf100.c
 create mode 100644 drm/nouveau/nvkm/subdev/iccsense/priv.h
    
Revision 2
      This is a complete rework from the first version I sent out.

Now the implementation is more centered around the power_rails we find in the
SENSE table instead of extdev centered. This makes the implementation a lot
easier and straightforward.

I've added support for the INA219, INA209 and INA3221 sensors found on multiple
Fermi and Kepler cards.

The power consumption is also exported via hwmon, so "sensors" will be able to
print it in userspace.

This work is based on Martins initial power sensor work and most of the ground
work was just copied from him.

Happy testing

changes in v3: fixes ina2x9, rebase on current master

Karol Herbst (2):
  iccsense: implement for ina209, ina219 and ina3221
  hwmon: add power consumption

Martin Peres (2):
  subdev/iccsense: add new subdev for power sensors
  nvbios/iccsense: add parsing of the SENSE table

 drm/nouveau/include/nvif/device.h               |   1 +
 drm/nouveau/include/nvkm/core/device.h          |  83 +++++-----
 drm/nouveau/include/nvkm/subdev/bios/extdev.h   |   3 +
 drm/nouveau/include/nvkm/subdev/bios/iccsense.h |  16 ++
 drm/nouveau/include/nvkm/subdev/i2c.h           |  16 ++
 drm/nouveau/include/nvkm/subdev/iccsense.h      |  15 ++
 drm/nouveau/nouveau_hwmon.c                     |  39 +++++
 drm/nouveau/nvkm/core/subdev.c                  |  83 +++++-----
 drm/nouveau/nvkm/engine/device/base.c           | 144 +++++++++--------
 drm/nouveau/nvkm/engine/device/priv.h           |   1 +
 drm/nouveau/nvkm/subdev/Kbuild                  |   1 +
 drm/nouveau/nvkm/subdev/bios/Kbuild             |   1 +
 drm/nouveau/nvkm/subdev/bios/iccsense.c         |  95 +++++++++++
 drm/nouveau/nvkm/subdev/iccsense/Kbuild         |   2 +
 drm/nouveau/nvkm/subdev/iccsense/base.c         | 200 ++++++++++++++++++++++++
 drm/nouveau/nvkm/subdev/iccsense/gf100.c        |  31 ++++
 drm/nouveau/nvkm/subdev/iccsense/priv.h         |  16 ++
 17 files changed, 605 insertions(+), 142 deletions(-)
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/iccsense.h
 create mode 100644 drm/nouveau/include/nvkm/subdev/iccsense.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/iccsense.c
 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/gf100.c
 create mode 100644 drm/nouveau/nvkm/subdev/iccsense/priv.h
    
Revision 3
      This is a complete rework from the first version I sent out.

Now the implementation is more centered around the power_rails we find in the
SENSE table instead of extdev centered. This makes the implementation a lot
easier and straightforward.

I've added support for the INA219, INA209 and INA3221 sensors found on multiple
Fermi and Kepler cards.

The power consumption is also exported via hwmon, so "sensors" will be able to
print it in userspace.

This work is based on Martins initial power sensor work and most of the ground
work was just copied from him.

Happy testing

changes in v3: fixes ina2x9, rebase on current master
changes in v4: some minor ina2x9 fixes and get it to work on maxwell gen2

Tested-by: Stefan Hühner <stefan@huehner.org> on gm206

Karol Herbst (4):
  iccsense: implement for ina209, ina219 and ina3221
  hwmon: add power consumption
  hwmon: don't require therm to be valid to get any data
  bios/extdev: also parse v4.1 table

Martin Peres (2):
  subdev/iccsense: add new subdev for power sensors
  nvbios/iccsense: add parsing of the SENSE table

 drm/nouveau/include/nvif/device.h               |   1 +
 drm/nouveau/include/nvkm/core/device.h          |  83 +++++-----
 drm/nouveau/include/nvkm/subdev/bios/extdev.h   |   3 +
 drm/nouveau/include/nvkm/subdev/bios/iccsense.h |  16 ++
 drm/nouveau/include/nvkm/subdev/i2c.h           |  31 ++++
 drm/nouveau/include/nvkm/subdev/iccsense.h      |  15 ++
 drm/nouveau/nouveau_hwmon.c                     |  78 +++++++---
 drm/nouveau/nvkm/core/subdev.c                  |  83 +++++-----
 drm/nouveau/nvkm/engine/device/base.c           | 144 ++++++++++--------
 drm/nouveau/nvkm/engine/device/priv.h           |   1 +
 drm/nouveau/nvkm/subdev/Kbuild                  |   1 +
 drm/nouveau/nvkm/subdev/bios/Kbuild             |   1 +
 drm/nouveau/nvkm/subdev/bios/extdev.c           |   2 +-
 drm/nouveau/nvkm/subdev/bios/iccsense.c         |  97 ++++++++++++
 drm/nouveau/nvkm/subdev/iccsense/Kbuild         |   2 +
 drm/nouveau/nvkm/subdev/iccsense/base.c         | 191 ++++++++++++++++++++++++
 drm/nouveau/nvkm/subdev/iccsense/gf100.c        |  31 ++++
 drm/nouveau/nvkm/subdev/iccsense/priv.h         |  16 ++
 18 files changed, 633 insertions(+), 163 deletions(-)
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/iccsense.h
 create mode 100644 drm/nouveau/include/nvkm/subdev/iccsense.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/iccsense.c
 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/gf100.c
 create mode 100644 drm/nouveau/nvkm/subdev/iccsense/priv.h
    
Revision 4
      This is a complete rework from the first version I sent out.

Now the implementation is more centered around the power_rails we find in the
SENSE table instead of extdev centered. This makes the implementation a lot
easier and straightforward.

I've added support for the INA219, INA209 and INA3221 sensors found on multiple
Fermi and Kepler cards.

The power consumption is also exported via hwmon, so "sensors" will be able to
print it in userspace.

This work is based on Martins initial power sensor work and most of the ground
work was just copied from him.

Happy testing

changes in v3: fixes ina2x9, rebase on current master
changes in v4: some minor ina2x9 fixes and get it to work on maxwell gen2
changes in v5: final polishing

Tested-by: Stefan Hühner <stefan@huehner.org> on gm206

Karol Herbst (4):
  iccsense: implement for ina209, ina219 and ina3221
  hwmon: add power consumption
  hwmon: don't require therm to be valid to get any data
  bios/extdev: also parse v4.1 table

Martin Peres (2):
  subdev/iccsense: add new subdev for power sensors
  nvbios/iccsense: add parsing of the SENSE table

 drm/nouveau/include/nvif/device.h               |   1 +
 drm/nouveau/include/nvkm/core/device.h          |  83 +++++----
 drm/nouveau/include/nvkm/subdev/bios/extdev.h   |   3 +
 drm/nouveau/include/nvkm/subdev/bios/iccsense.h |  16 ++
 drm/nouveau/include/nvkm/subdev/i2c.h           |  31 ++++
 drm/nouveau/include/nvkm/subdev/iccsense.h      |  17 ++
 drm/nouveau/nouveau_hwmon.c                     |  75 ++++++--
 drm/nouveau/nvkm/core/subdev.c                  |  83 ++++-----
 drm/nouveau/nvkm/engine/device/base.c           | 144 ++++++++-------
 drm/nouveau/nvkm/engine/device/priv.h           |   1 +
 drm/nouveau/nvkm/subdev/Kbuild                  |   1 +
 drm/nouveau/nvkm/subdev/bios/Kbuild             |   1 +
 drm/nouveau/nvkm/subdev/bios/extdev.c           |   2 +-
 drm/nouveau/nvkm/subdev/bios/iccsense.c         | 100 ++++++++++
 drm/nouveau/nvkm/subdev/iccsense/Kbuild         |   2 +
 drm/nouveau/nvkm/subdev/iccsense/base.c         | 232 ++++++++++++++++++++++++
 drm/nouveau/nvkm/subdev/iccsense/gf100.c        |  31 ++++
 drm/nouveau/nvkm/subdev/iccsense/priv.h         |  16 ++
 18 files changed, 676 insertions(+), 163 deletions(-)
 create mode 100644 drm/nouveau/include/nvkm/subdev/bios/iccsense.h
 create mode 100644 drm/nouveau/include/nvkm/subdev/iccsense.h
 create mode 100644 drm/nouveau/nvkm/subdev/bios/iccsense.c
 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/gf100.c
 create mode 100644 drm/nouveau/nvkm/subdev/iccsense/priv.h
    

Revisions