Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau/device: remove pwrsrc notify in favour of a direct call to clk

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Ben Skeggs and committed by
Dave Airlie
0196cc65 6d729184

+11 -48
-3
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
··· 2 2 #ifndef __NVKM_DEVICE_H__ 3 3 #define __NVKM_DEVICE_H__ 4 4 #include <core/oclass.h> 5 - #include <core/event.h> 6 5 enum nvkm_subdev_type; 7 6 8 7 enum nvkm_device_type { ··· 26 27 int refcount; 27 28 28 29 void __iomem *pri; 29 - 30 - struct nvkm_event event; 31 30 32 31 u32 debug; 33 32
+1 -2
drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h
··· 2 2 #ifndef __NVKM_CLK_H__ 3 3 #define __NVKM_CLK_H__ 4 4 #include <core/subdev.h> 5 - #include <core/notify.h> 6 5 #include <subdev/pci.h> 7 6 struct nvbios_pll; 8 7 struct nvkm_pll_vals; ··· 93 94 wait_queue_head_t wait; 94 95 atomic_t waiting; 95 96 96 - struct nvkm_notify pwrsrc_ntfy; 97 97 int pwrsrc; 98 98 int pstate; /* current */ 99 99 int ustate_ac; /* user-requested (-1 disabled, -2 perfmon) */ ··· 122 124 int nvkm_clk_astate(struct nvkm_clk *, int req, int rel, bool wait); 123 125 int nvkm_clk_dstate(struct nvkm_clk *, int req, int rel); 124 126 int nvkm_clk_tstate(struct nvkm_clk *, u8 temperature); 127 + int nvkm_clk_pwrsrc(struct nvkm_device *); 125 128 126 129 int nv04_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **); 127 130 int nv40_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **);
+1
drivers/gpu/drm/nouveau/include/nvkm/subdev/fault.h
··· 1 1 #ifndef __NVKM_FAULT_H__ 2 2 #define __NVKM_FAULT_H__ 3 3 #include <core/subdev.h> 4 + #include <core/event.h> 4 5 #include <core/notify.h> 5 6 6 7 struct nvkm_fault {
+1
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
··· 24 24 #include <core/ioctl.h> 25 25 #include <core/client.h> 26 26 #include <core/engine.h> 27 + #include <core/event.h> 27 28 28 29 #include <nvif/unpack.h> 29 30 #include <nvif/ioctl.h>
+3 -3
drivers/gpu/drm/nouveau/nvkm/engine/device/acpi.c
··· 24 24 #include "acpi.h" 25 25 26 26 #include <core/device.h> 27 + #include <subdev/clk.h> 27 28 28 29 #ifdef CONFIG_ACPI 29 30 static int 30 31 nvkm_acpi_ntfy(struct notifier_block *nb, unsigned long val, void *data) 31 32 { 32 - struct nvkm_device *device = 33 - container_of(nb, typeof(*device), acpi.nb); 33 + struct nvkm_device *device = container_of(nb, typeof(*device), acpi.nb); 34 34 struct acpi_bus_event *info = data; 35 35 36 36 if (!strcmp(info->device_class, "ac_adapter")) 37 - nvkm_event_send(&device->event, 1, 0, NULL, 0); 37 + nvkm_clk_pwrsrc(device); 38 38 39 39 return NOTIFY_DONE; 40 40 }
-25
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
··· 24 24 #include "priv.h" 25 25 #include "acpi.h" 26 26 27 - #include <core/notify.h> 28 27 #include <core/option.h> 29 28 30 29 #include <subdev/bios.h> ··· 2667 2668 .fifo = { 0x00000001, ga102_fifo_new }, 2668 2669 }; 2669 2670 2670 - static int 2671 - nvkm_device_event_ctor(struct nvkm_object *object, void *data, u32 size, 2672 - struct nvkm_notify *notify) 2673 - { 2674 - if (!WARN_ON(size != 0)) { 2675 - notify->size = 0; 2676 - notify->types = 1; 2677 - notify->index = 0; 2678 - return 0; 2679 - } 2680 - return -EINVAL; 2681 - } 2682 - 2683 - static const struct nvkm_event_func 2684 - nvkm_device_event_func = { 2685 - .ctor = nvkm_device_event_ctor, 2686 - }; 2687 - 2688 2671 struct nvkm_subdev * 2689 2672 nvkm_device_subdev(struct nvkm_device *device, int type, int inst) 2690 2673 { ··· 2819 2838 list_for_each_entry_safe_reverse(subdev, subtmp, &device->subdev, head) 2820 2839 nvkm_subdev_del(&subdev); 2821 2840 2822 - nvkm_event_fini(&device->event); 2823 - 2824 2841 if (device->pri) 2825 2842 iounmap(device->pri); 2826 2843 list_del(&device->head); ··· 2892 2913 list_add_tail(&device->head, &nv_devices); 2893 2914 device->debug = nvkm_dbgopt(device->dbgopt, "device"); 2894 2915 INIT_LIST_HEAD(&device->subdev); 2895 - 2896 - ret = nvkm_event_init(&nvkm_device_event_func, 1, 1, &device->event); 2897 - if (ret) 2898 - goto done; 2899 2916 2900 2917 mmio_base = device->func->resource_addr(device, 0); 2901 2918 mmio_size = device->func->resource_size(device, 0);
+5 -15
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
··· 330 330 } 331 331 332 332 wake_up_all(&clk->wait); 333 - nvkm_notify_get(&clk->pwrsrc_ntfy); 334 333 } 335 334 336 335 static int ··· 558 559 return nvkm_pstate_calc(clk, true); 559 560 } 560 561 561 - static int 562 - nvkm_clk_pwrsrc(struct nvkm_notify *notify) 562 + int 563 + nvkm_clk_pwrsrc(struct nvkm_device *device) 563 564 { 564 - struct nvkm_clk *clk = 565 - container_of(notify, typeof(*clk), pwrsrc_ntfy); 566 - nvkm_pstate_calc(clk, false); 567 - return NVKM_NOTIFY_DROP; 565 + if (device->clk) 566 + return nvkm_pstate_calc(device->clk, false); 567 + return 0; 568 568 } 569 569 570 570 /****************************************************************************** ··· 580 582 nvkm_clk_fini(struct nvkm_subdev *subdev, bool suspend) 581 583 { 582 584 struct nvkm_clk *clk = nvkm_clk(subdev); 583 - nvkm_notify_put(&clk->pwrsrc_ntfy); 584 585 flush_work(&clk->work); 585 586 if (clk->func->fini) 586 587 clk->func->fini(clk); ··· 625 628 { 626 629 struct nvkm_clk *clk = nvkm_clk(subdev); 627 630 struct nvkm_pstate *pstate, *temp; 628 - 629 - nvkm_notify_fini(&clk->pwrsrc_ntfy); 630 631 631 632 /* Early return if the pstates have been provided statically */ 632 633 if (clk->func->pstates) ··· 686 691 list_add_tail(&func->pstates[idx].head, &clk->states); 687 692 clk->state_nr = func->nr_pstates; 688 693 } 689 - 690 - ret = nvkm_notify_init(NULL, &device->event, nvkm_clk_pwrsrc, true, 691 - NULL, 0, 0, &clk->pwrsrc_ntfy); 692 - if (ret) 693 - return ret; 694 694 695 695 mode = nvkm_stropt(device->cfgopt, "NvClkMode", &arglen); 696 696 if (mode) {