* Authors: Ben Skeggs
*/
-#include "drmP.h"
+#include <drm/drmP.h>
#include "nouveau_drm.h"
#include "nouveau_bios.h"
#include "nouveau_hw.h"
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;
-}