aboutsummaryrefslogtreecommitdiff
path: root/sys/x86
diff options
context:
space:
mode:
authorHiren Panchasara <hiren@FreeBSD.org>2013-05-10 22:43:27 +0000
committerHiren Panchasara <hiren@FreeBSD.org>2013-05-10 22:43:27 +0000
commit46b29ff94ac9200746320d61a7560e07f687eb9a (patch)
tree1c79166704089de39f22cb3d2ca39b530dbdc663 /sys/x86
parent426275509727f11766820f640976fc2c13fa4f9f (diff)
downloadsrc-46b29ff94ac9200746320d61a7560e07f687eb9a.tar.gz
src-46b29ff94ac9200746320d61a7560e07f687eb9a.zip
Adding a detach method to p4tcc driver.
PR: 118739 Submitted by: Dan Lukes <dan@obluda.cz> (earlier version) Reviewed by: jhb Approved by: sbruno (mentor) MFC after: 1 week
Notes
Notes: svn path=/head/; revision=250487
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/cpufreq/p4tcc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/x86/cpufreq/p4tcc.c b/sys/x86/cpufreq/p4tcc.c
index e11b4a8d499b..d438f6939fd7 100644
--- a/sys/x86/cpufreq/p4tcc.c
+++ b/sys/x86/cpufreq/p4tcc.c
@@ -73,6 +73,7 @@ static int p4tcc_features(driver_t *driver, u_int *features);
static void p4tcc_identify(driver_t *driver, device_t parent);
static int p4tcc_probe(device_t dev);
static int p4tcc_attach(device_t dev);
+static int p4tcc_detach(device_t dev);
static int p4tcc_settings(device_t dev, struct cf_setting *sets,
int *count);
static int p4tcc_set(device_t dev, const struct cf_setting *set);
@@ -84,6 +85,7 @@ static device_method_t p4tcc_methods[] = {
DEVMETHOD(device_identify, p4tcc_identify),
DEVMETHOD(device_probe, p4tcc_probe),
DEVMETHOD(device_attach, p4tcc_attach),
+ DEVMETHOD(device_detach, p4tcc_detach),
/* cpufreq interface */
DEVMETHOD(cpufreq_drv_set, p4tcc_set),
@@ -213,6 +215,24 @@ p4tcc_attach(device_t dev)
}
static int
+p4tcc_detach(device_t dev)
+{
+ struct cf_setting set;
+ int error;
+
+ error = cpufreq_unregister(dev);
+ if (error)
+ return (error);
+
+ /*
+ * Before we finish detach, switch to Automatic mode.
+ */
+ set.freq = 10000;
+ p4tcc_set(dev, &set);
+ return(0);
+}
+
+static int
p4tcc_settings(device_t dev, struct cf_setting *sets, int *count)
{
struct p4tcc_softc *sc;