diff options
author | Martin Peres <martin.peres@labri.fr> | 2012-09-02 02:55:58 +0200 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-03 13:13:14 +1000 |
commit | aa1b9b4836a8ab093ec06b0780553566a5430da7 (patch) | |
tree | 26c305c62178ad4f9bf9644b6b7766cb0af87b1f /drivers/gpu/drm/nouveau/nv50_pm.c | |
parent | d46497dce7376e9d3e2e10c59d92e1c3b665b5dd (diff) |
drm/nouveau/therm: move thermal-related functions to the therm subdev
It looks scary because of the size, but I tried to keep the differences minimal.
Further patches will fix the actual "driver" code and add new features.
v2: change filenames, split to submodules
v3: add a missing include
v4: Ben Skeggs <bskeggs@redhat.com>
- fixed set_defaults() to allow min_duty < 30 (thermal table will
override this if it's actually necessary)
- fixed set_defaults() to not provide pwm_freq so nv4x (which only has
pwm_div) can actually work. the boards using pwm_freq will have a
thermal table entry to provide us the value.
- removed unused files
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_pm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_pm.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c index 0036c8c966d..7724eae5db9 100644 --- a/drivers/gpu/drm/nouveau/nv50_pm.c +++ b/drivers/gpu/drm/nouveau/nv50_pm.c @@ -853,61 +853,3 @@ resume: kfree(info); return ret; } - -static int -pwm_info(struct drm_device *dev, int *line, int *ctrl, int *indx) -{ - struct nouveau_drm *drm = nouveau_drm(dev); - - if (*line == 0x04) { - *ctrl = 0x00e100; - *line = 4; - *indx = 0; - } else - if (*line == 0x09) { - *ctrl = 0x00e100; - *line = 9; - *indx = 1; - } else - if (*line == 0x10) { - *ctrl = 0x00e28c; - *line = 0; - *indx = 0; - } else { - NV_ERROR(drm, "unknown pwm ctrl for gpio %d\n", *line); - return -ENODEV; - } - - return 0; -} - -int -nv50_pm_pwm_get(struct drm_device *dev, int line, u32 *divs, u32 *duty) -{ - struct nouveau_device *device = nouveau_dev(dev); - int ctrl, id, ret = pwm_info(dev, &line, &ctrl, &id); - if (ret) - return ret; - - if (nv_rd32(device, ctrl) & (1 << line)) { - *divs = nv_rd32(device, 0x00e114 + (id * 8)); - *duty = nv_rd32(device, 0x00e118 + (id * 8)); - return 0; - } - - return -EINVAL; -} - -int -nv50_pm_pwm_set(struct drm_device *dev, int line, u32 divs, u32 duty) -{ - struct nouveau_device *device = nouveau_dev(dev); - int ctrl, id, ret = pwm_info(dev, &line, &ctrl, &id); - if (ret) - return ret; - - nv_mask(device, ctrl, 0x00010001 << line, 0x00000001 << line); - nv_wr32(device, 0x00e114 + (id * 8), divs); - nv_wr32(device, 0x00e118 + (id * 8), duty | 0x80000000); - return 0; -} |