aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.h8
-rw-r--r--drivers/gpu/drm/nouveau/nv40_pm.c18
-rw-r--r--drivers/gpu/drm/nouveau/nv50_pm.c21
5 files changed, 25 insertions, 30 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 891c91b14886..909b991416ed 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -556,8 +556,8 @@ struct nouveau_pm_engine {
556 556
557 int (*voltage_get)(struct drm_device *); 557 int (*voltage_get)(struct drm_device *);
558 int (*voltage_set)(struct drm_device *, int voltage); 558 int (*voltage_set)(struct drm_device *, int voltage);
559 int (*pwm_get)(struct drm_device *, struct dcb_gpio_entry*, u32*, u32*); 559 int (*pwm_get)(struct drm_device *, int line, u32*, u32*);
560 int (*pwm_set)(struct drm_device *, struct dcb_gpio_entry*, u32, u32); 560 int (*pwm_set)(struct drm_device *, int line, u32, u32);
561 int (*temp_get)(struct drm_device *); 561 int (*temp_get)(struct drm_device *);
562}; 562};
563 563
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 1442d0673671..788ba33da77c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -49,7 +49,7 @@ nouveau_pwmfan_get(struct drm_device *dev)
49 49
50 gpio = nouveau_bios_gpio_entry(dev, DCB_GPIO_PWM_FAN); 50 gpio = nouveau_bios_gpio_entry(dev, DCB_GPIO_PWM_FAN);
51 if (gpio) { 51 if (gpio) {
52 ret = pm->pwm_get(dev, gpio, &divs, &duty); 52 ret = pm->pwm_get(dev, gpio->line, &divs, &duty);
53 if (ret == 0) { 53 if (ret == 0) {
54 divs = max(divs, duty); 54 divs = max(divs, duty);
55 if (dev_priv->card_type <= NV_40 || 55 if (dev_priv->card_type <= NV_40 ||
@@ -90,7 +90,7 @@ nouveau_pwmfan_set(struct drm_device *dev, int percent)
90 (gpio->state[0] & 1)) 90 (gpio->state[0] & 1))
91 duty = divs - duty; 91 duty = divs - duty;
92 92
93 return pm->pwm_set(dev, gpio, divs, duty); 93 return pm->pwm_set(dev, gpio->line, divs, duty);
94 } 94 }
95 95
96 return -ENODEV; 96 return -ENODEV;
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.h b/drivers/gpu/drm/nouveau/nouveau_pm.h
index 663088d30428..7e0cc2eeb307 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.h
@@ -55,15 +55,15 @@ int nv04_pm_clocks_set(struct drm_device *, void *);
55int nv40_pm_clocks_get(struct drm_device *, struct nouveau_pm_level *); 55int nv40_pm_clocks_get(struct drm_device *, struct nouveau_pm_level *);
56void *nv40_pm_clocks_pre(struct drm_device *, struct nouveau_pm_level *); 56void *nv40_pm_clocks_pre(struct drm_device *, struct nouveau_pm_level *);
57int nv40_pm_clocks_set(struct drm_device *, void *); 57int nv40_pm_clocks_set(struct drm_device *, void *);
58int nv40_pm_pwm_get(struct drm_device *, struct dcb_gpio_entry *, u32*, u32*); 58int nv40_pm_pwm_get(struct drm_device *, int, u32 *, u32 *);
59int nv40_pm_pwm_set(struct drm_device *, struct dcb_gpio_entry *, u32, u32); 59int nv40_pm_pwm_set(struct drm_device *, int, u32, u32);
60 60
61/* nv50_pm.c */ 61/* nv50_pm.c */
62int nv50_pm_clocks_get(struct drm_device *, struct nouveau_pm_level *); 62int nv50_pm_clocks_get(struct drm_device *, struct nouveau_pm_level *);
63void *nv50_pm_clocks_pre(struct drm_device *, struct nouveau_pm_level *); 63void *nv50_pm_clocks_pre(struct drm_device *, struct nouveau_pm_level *);
64int nv50_pm_clocks_set(struct drm_device *, void *); 64int nv50_pm_clocks_set(struct drm_device *, void *);
65int nv50_pm_pwm_get(struct drm_device *, struct dcb_gpio_entry *, u32*, u32*); 65int nv50_pm_pwm_get(struct drm_device *, int, u32 *, u32 *);
66int nv50_pm_pwm_set(struct drm_device *, struct dcb_gpio_entry *, u32, u32); 66int nv50_pm_pwm_set(struct drm_device *, int, u32, u32);
67 67
68/* nva3_pm.c */ 68/* nva3_pm.c */
69int nva3_pm_clocks_get(struct drm_device *, struct nouveau_pm_level *); 69int nva3_pm_clocks_get(struct drm_device *, struct nouveau_pm_level *);
diff --git a/drivers/gpu/drm/nouveau/nv40_pm.c b/drivers/gpu/drm/nouveau/nv40_pm.c
index 3d5a5a7856e6..c7615381c5d9 100644
--- a/drivers/gpu/drm/nouveau/nv40_pm.c
+++ b/drivers/gpu/drm/nouveau/nv40_pm.c
@@ -351,10 +351,9 @@ resume:
351} 351}
352 352
353int 353int
354nv40_pm_pwm_get(struct drm_device *dev, struct dcb_gpio_entry *gpio, 354nv40_pm_pwm_get(struct drm_device *dev, int line, u32 *divs, u32 *duty)
355 u32 *divs, u32 *duty)
356{ 355{
357 if (gpio->line == 2) { 356 if (line == 2) {
358 u32 reg = nv_rd32(dev, 0x0010f0); 357 u32 reg = nv_rd32(dev, 0x0010f0);
359 if (reg & 0x80000000) { 358 if (reg & 0x80000000) {
360 *duty = (reg & 0x7fff0000) >> 16; 359 *duty = (reg & 0x7fff0000) >> 16;
@@ -362,7 +361,7 @@ nv40_pm_pwm_get(struct drm_device *dev, struct dcb_gpio_entry *gpio,
362 return 0; 361 return 0;
363 } 362 }
364 } else 363 } else
365 if (gpio->line == 9) { 364 if (line == 9) {
366 u32 reg = nv_rd32(dev, 0x0015f4); 365 u32 reg = nv_rd32(dev, 0x0015f4);
367 if (reg & 0x80000000) { 366 if (reg & 0x80000000) {
368 *divs = nv_rd32(dev, 0x0015f8); 367 *divs = nv_rd32(dev, 0x0015f8);
@@ -370,7 +369,7 @@ nv40_pm_pwm_get(struct drm_device *dev, struct dcb_gpio_entry *gpio,
370 return 0; 369 return 0;
371 } 370 }
372 } else { 371 } else {
373 NV_ERROR(dev, "unknown pwm ctrl for gpio %d\n", gpio->line); 372 NV_ERROR(dev, "unknown pwm ctrl for gpio %d\n", line);
374 return -ENODEV; 373 return -ENODEV;
375 } 374 }
376 375
@@ -378,17 +377,16 @@ nv40_pm_pwm_get(struct drm_device *dev, struct dcb_gpio_entry *gpio,
378} 377}
379 378
380int 379int
381nv40_pm_pwm_set(struct drm_device *dev, struct dcb_gpio_entry *gpio, 380nv40_pm_pwm_set(struct drm_device *dev, int line, u32 divs, u32 duty)
382 u32 divs, u32 duty)
383{ 381{
384 if (gpio->line == 2) { 382 if (line == 2) {
385 nv_wr32(dev, 0x0010f0, 0x80000000 | (duty << 16) | divs); 383 nv_wr32(dev, 0x0010f0, 0x80000000 | (duty << 16) | divs);
386 } else 384 } else
387 if (gpio->line == 9) { 385 if (line == 9) {
388 nv_wr32(dev, 0x0015f8, divs); 386 nv_wr32(dev, 0x0015f8, divs);
389 nv_wr32(dev, 0x0015f4, duty | 0x80000000); 387 nv_wr32(dev, 0x0015f4, duty | 0x80000000);
390 } else { 388 } else {
391 NV_ERROR(dev, "unknown pwm ctrl for gpio %d\n", gpio->line); 389 NV_ERROR(dev, "unknown pwm ctrl for gpio %d\n", line);
392 return -ENODEV; 390 return -ENODEV;
393 } 391 }
394 392
diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c
index fce1214c3db1..03937212e9d8 100644
--- a/drivers/gpu/drm/nouveau/nv50_pm.c
+++ b/drivers/gpu/drm/nouveau/nv50_pm.c
@@ -715,25 +715,24 @@ resume:
715} 715}
716 716
717static int 717static int
718pwm_info(struct drm_device *dev, struct dcb_gpio_entry *gpio, 718pwm_info(struct drm_device *dev, int *line, int *ctrl, int *indx)
719 int *ctrl, int *line, int *indx)
720{ 719{
721 if (gpio->line == 0x04) { 720 if (*line == 0x04) {
722 *ctrl = 0x00e100; 721 *ctrl = 0x00e100;
723 *line = 4; 722 *line = 4;
724 *indx = 0; 723 *indx = 0;
725 } else 724 } else
726 if (gpio->line == 0x09) { 725 if (*line == 0x09) {
727 *ctrl = 0x00e100; 726 *ctrl = 0x00e100;
728 *line = 9; 727 *line = 9;
729 *indx = 1; 728 *indx = 1;
730 } else 729 } else
731 if (gpio->line == 0x10) { 730 if (*line == 0x10) {
732 *ctrl = 0x00e28c; 731 *ctrl = 0x00e28c;
733 *line = 0; 732 *line = 0;
734 *indx = 0; 733 *indx = 0;
735 } else { 734 } else {
736 NV_ERROR(dev, "unknown pwm ctrl for gpio %d\n", gpio->line); 735 NV_ERROR(dev, "unknown pwm ctrl for gpio %d\n", *line);
737 return -ENODEV; 736 return -ENODEV;
738 } 737 }
739 738
@@ -741,10 +740,9 @@ pwm_info(struct drm_device *dev, struct dcb_gpio_entry *gpio,
741} 740}
742 741
743int 742int
744nv50_pm_pwm_get(struct drm_device *dev, struct dcb_gpio_entry *gpio, 743nv50_pm_pwm_get(struct drm_device *dev, int line, u32 *divs, u32 *duty)
745 u32 *divs, u32 *duty)
746{ 744{
747 int ctrl, line, id, ret = pwm_info(dev, gpio, &ctrl, &line, &id); 745 int ctrl, id, ret = pwm_info(dev, &line, &ctrl, &id);
748 if (ret) 746 if (ret)
749 return ret; 747 return ret;
750 748
@@ -758,10 +756,9 @@ nv50_pm_pwm_get(struct drm_device *dev, struct dcb_gpio_entry *gpio,
758} 756}
759 757
760int 758int
761nv50_pm_pwm_set(struct drm_device *dev, struct dcb_gpio_entry *gpio, 759nv50_pm_pwm_set(struct drm_device *dev, int line, u32 divs, u32 duty)
762 u32 divs, u32 duty)
763{ 760{
764 int ctrl, line, id, ret = pwm_info(dev, gpio, &ctrl, &line, &id); 761 int ctrl, id, ret = pwm_info(dev, &line, &ctrl, &id);
765 if (ret) 762 if (ret)
766 return ret; 763 return ret;
767 764