drm/nouveau/therm: turn on a fan only when crossing threshold in positive direction

+ the same for shutdown threshold - seems impossible, but shutdown can fail.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Martin Peres <martin.peres@labri.fr>
drm/nv40/therm: reset temperature sensor on init

Current uninitialized sensor detection does not work for me on nv4b and
sensor returns crazy values (>190°C). It stabilises later, but it's too
late - therm code shutdowns the machine...

Let's just reset it on init.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Martin Peres <martin.peres@labri.fr>
drm/nouveau/therm: use workqueue to shutdown the machine

orderly_poweroff cannot be called from atomic context.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Martin Peres <martin.peres@labri.fr>
drm/nouveau: add lockdep annotations

1) Lockdep thinks all nouveau subdevs belong to the same class and can be
locked in arbitrary order, which is not true (at least in general case).
Tell it to distinguish subdevs by (o)class type.
2) DRM client can be locked under user client lock - tell lockdep to put DRM
client lock in a separate class.

Reported-by: Arend van Spriel <arend@broadcom.com>
Reported-by: Peter Hurley <peter@hurleysoftware.com>
Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reported-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@vger.kernel.org [3.7, but needs s/const ofuncs/ofuncs/ to build]
drm/nouveau/therm: reduce stack usage of nouveau_therm_ic_ctor

Before: 1496 bytes
After:   152 bytes

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
drm/nouveau: reduce stack usage of nv_printk_

Before: 400 bytes
After:  104 bytes

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
drm/nouveau: restore debugfs support

Restore majority of debugfs support (with an exception of channel info) dropped
in commit ebb945a94bba2ce8dff7b0942ff2b3f2a52a0a69 ("drm/nouveau: port all
engines to new engine module format").

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>