Commit 0196cc65 authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

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

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 6d729184
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#ifndef __NVKM_DEVICE_H__ #ifndef __NVKM_DEVICE_H__
#define __NVKM_DEVICE_H__ #define __NVKM_DEVICE_H__
#include <core/oclass.h> #include <core/oclass.h>
#include <core/event.h>
enum nvkm_subdev_type; enum nvkm_subdev_type;
enum nvkm_device_type { enum nvkm_device_type {
...@@ -28,8 +27,6 @@ struct nvkm_device { ...@@ -28,8 +27,6 @@ struct nvkm_device {
void __iomem *pri; void __iomem *pri;
struct nvkm_event event;
u32 debug; u32 debug;
const struct nvkm_device_chip *chip; const struct nvkm_device_chip *chip;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#ifndef __NVKM_CLK_H__ #ifndef __NVKM_CLK_H__
#define __NVKM_CLK_H__ #define __NVKM_CLK_H__
#include <core/subdev.h> #include <core/subdev.h>
#include <core/notify.h>
#include <subdev/pci.h> #include <subdev/pci.h>
struct nvbios_pll; struct nvbios_pll;
struct nvkm_pll_vals; struct nvkm_pll_vals;
...@@ -94,7 +93,6 @@ struct nvkm_clk { ...@@ -94,7 +93,6 @@ struct nvkm_clk {
wait_queue_head_t wait; wait_queue_head_t wait;
atomic_t waiting; atomic_t waiting;
struct nvkm_notify pwrsrc_ntfy;
int pwrsrc; int pwrsrc;
int pstate; /* current */ int pstate; /* current */
int ustate_ac; /* user-requested (-1 disabled, -2 perfmon) */ int ustate_ac; /* user-requested (-1 disabled, -2 perfmon) */
...@@ -124,6 +122,7 @@ int nvkm_clk_ustate(struct nvkm_clk *, int req, int pwr); ...@@ -124,6 +122,7 @@ int nvkm_clk_ustate(struct nvkm_clk *, int req, int pwr);
int nvkm_clk_astate(struct nvkm_clk *, int req, int rel, bool wait); int nvkm_clk_astate(struct nvkm_clk *, int req, int rel, bool wait);
int nvkm_clk_dstate(struct nvkm_clk *, int req, int rel); int nvkm_clk_dstate(struct nvkm_clk *, int req, int rel);
int nvkm_clk_tstate(struct nvkm_clk *, u8 temperature); int nvkm_clk_tstate(struct nvkm_clk *, u8 temperature);
int nvkm_clk_pwrsrc(struct nvkm_device *);
int nv04_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **); int nv04_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **);
int nv40_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **); int nv40_clk_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_clk **);
......
#ifndef __NVKM_FAULT_H__ #ifndef __NVKM_FAULT_H__
#define __NVKM_FAULT_H__ #define __NVKM_FAULT_H__
#include <core/subdev.h> #include <core/subdev.h>
#include <core/event.h>
#include <core/notify.h> #include <core/notify.h>
struct nvkm_fault { struct nvkm_fault {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <core/ioctl.h> #include <core/ioctl.h>
#include <core/client.h> #include <core/client.h>
#include <core/engine.h> #include <core/engine.h>
#include <core/event.h>
#include <nvif/unpack.h> #include <nvif/unpack.h>
#include <nvif/ioctl.h> #include <nvif/ioctl.h>
......
...@@ -24,17 +24,17 @@ ...@@ -24,17 +24,17 @@
#include "acpi.h" #include "acpi.h"
#include <core/device.h> #include <core/device.h>
#include <subdev/clk.h>
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static int static int
nvkm_acpi_ntfy(struct notifier_block *nb, unsigned long val, void *data) nvkm_acpi_ntfy(struct notifier_block *nb, unsigned long val, void *data)
{ {
struct nvkm_device *device = struct nvkm_device *device = container_of(nb, typeof(*device), acpi.nb);
container_of(nb, typeof(*device), acpi.nb);
struct acpi_bus_event *info = data; struct acpi_bus_event *info = data;
if (!strcmp(info->device_class, "ac_adapter")) if (!strcmp(info->device_class, "ac_adapter"))
nvkm_event_send(&device->event, 1, 0, NULL, 0); nvkm_clk_pwrsrc(device);
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "priv.h" #include "priv.h"
#include "acpi.h" #include "acpi.h"
#include <core/notify.h>
#include <core/option.h> #include <core/option.h>
#include <subdev/bios.h> #include <subdev/bios.h>
...@@ -2668,24 +2667,6 @@ nv177_chipset = { ...@@ -2668,24 +2667,6 @@ nv177_chipset = {
.fifo = { 0x00000001, ga102_fifo_new }, .fifo = { 0x00000001, ga102_fifo_new },
}; };
static int
nvkm_device_event_ctor(struct nvkm_object *object, void *data, u32 size,
struct nvkm_notify *notify)
{
if (!WARN_ON(size != 0)) {
notify->size = 0;
notify->types = 1;
notify->index = 0;
return 0;
}
return -EINVAL;
}
static const struct nvkm_event_func
nvkm_device_event_func = {
.ctor = nvkm_device_event_ctor,
};
struct nvkm_subdev * struct nvkm_subdev *
nvkm_device_subdev(struct nvkm_device *device, int type, int inst) nvkm_device_subdev(struct nvkm_device *device, int type, int inst)
{ {
...@@ -2838,8 +2819,6 @@ nvkm_device_del(struct nvkm_device **pdevice) ...@@ -2838,8 +2819,6 @@ nvkm_device_del(struct nvkm_device **pdevice)
list_for_each_entry_safe_reverse(subdev, subtmp, &device->subdev, head) list_for_each_entry_safe_reverse(subdev, subtmp, &device->subdev, head)
nvkm_subdev_del(&subdev); nvkm_subdev_del(&subdev);
nvkm_event_fini(&device->event);
if (device->pri) if (device->pri)
iounmap(device->pri); iounmap(device->pri);
list_del(&device->head); list_del(&device->head);
...@@ -2914,10 +2893,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func, ...@@ -2914,10 +2893,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
device->debug = nvkm_dbgopt(device->dbgopt, "device"); device->debug = nvkm_dbgopt(device->dbgopt, "device");
INIT_LIST_HEAD(&device->subdev); INIT_LIST_HEAD(&device->subdev);
ret = nvkm_event_init(&nvkm_device_event_func, 1, 1, &device->event);
if (ret)
goto done;
mmio_base = device->func->resource_addr(device, 0); mmio_base = device->func->resource_addr(device, 0);
mmio_size = device->func->resource_size(device, 0); mmio_size = device->func->resource_size(device, 0);
......
...@@ -330,7 +330,6 @@ nvkm_pstate_work(struct work_struct *work) ...@@ -330,7 +330,6 @@ nvkm_pstate_work(struct work_struct *work)
} }
wake_up_all(&clk->wait); wake_up_all(&clk->wait);
nvkm_notify_get(&clk->pwrsrc_ntfy);
} }
static int static int
...@@ -559,13 +558,12 @@ nvkm_clk_dstate(struct nvkm_clk *clk, int req, int rel) ...@@ -559,13 +558,12 @@ nvkm_clk_dstate(struct nvkm_clk *clk, int req, int rel)
return nvkm_pstate_calc(clk, true); return nvkm_pstate_calc(clk, true);
} }
static int int
nvkm_clk_pwrsrc(struct nvkm_notify *notify) nvkm_clk_pwrsrc(struct nvkm_device *device)
{ {
struct nvkm_clk *clk = if (device->clk)
container_of(notify, typeof(*clk), pwrsrc_ntfy); return nvkm_pstate_calc(device->clk, false);
nvkm_pstate_calc(clk, false); return 0;
return NVKM_NOTIFY_DROP;
} }
/****************************************************************************** /******************************************************************************
...@@ -582,7 +580,6 @@ static int ...@@ -582,7 +580,6 @@ static int
nvkm_clk_fini(struct nvkm_subdev *subdev, bool suspend) nvkm_clk_fini(struct nvkm_subdev *subdev, bool suspend)
{ {
struct nvkm_clk *clk = nvkm_clk(subdev); struct nvkm_clk *clk = nvkm_clk(subdev);
nvkm_notify_put(&clk->pwrsrc_ntfy);
flush_work(&clk->work); flush_work(&clk->work);
if (clk->func->fini) if (clk->func->fini)
clk->func->fini(clk); clk->func->fini(clk);
...@@ -629,8 +626,6 @@ nvkm_clk_dtor(struct nvkm_subdev *subdev) ...@@ -629,8 +626,6 @@ nvkm_clk_dtor(struct nvkm_subdev *subdev)
struct nvkm_clk *clk = nvkm_clk(subdev); struct nvkm_clk *clk = nvkm_clk(subdev);
struct nvkm_pstate *pstate, *temp; struct nvkm_pstate *pstate, *temp;
nvkm_notify_fini(&clk->pwrsrc_ntfy);
/* Early return if the pstates have been provided statically */ /* Early return if the pstates have been provided statically */
if (clk->func->pstates) if (clk->func->pstates)
return clk; return clk;
...@@ -692,11 +687,6 @@ nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device, ...@@ -692,11 +687,6 @@ nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device,
clk->state_nr = func->nr_pstates; clk->state_nr = func->nr_pstates;
} }
ret = nvkm_notify_init(NULL, &device->event, nvkm_clk_pwrsrc, true,
NULL, 0, 0, &clk->pwrsrc_ntfy);
if (ret)
return ret;
mode = nvkm_stropt(device->cfgopt, "NvClkMode", &arglen); mode = nvkm_stropt(device->cfgopt, "NvClkMode", &arglen);
if (mode) { if (mode) {
clk->ustate_ac = nvkm_clk_nstate(clk, mode, arglen); clk->ustate_ac = nvkm_clk_nstate(clk, mode, arglen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment