summaryrefslogtreecommitdiff
path: root/libopie
authorschurig <schurig>2003-06-06 14:32:51 (UTC)
committer schurig <schurig>2003-06-06 14:32:51 (UTC)
commit802e9457b1bc158c61849755215fe2a5bad6231d (patch) (side-by-side diff)
tree81b8a5cdb9d4b5beaee2f18eec6ca995ec8e77d2 /libopie
parent225486a1c3714b4b0c0e60286df13d8ede029768 (diff)
downloadopie-802e9457b1bc158c61849755215fe2a5bad6231d.zip
opie-802e9457b1bc158c61849755215fe2a5bad6231d.tar.gz
opie-802e9457b1bc158c61849755215fe2a5bad6231d.tar.bz2
frequency change works now
Diffstat (limited to 'libopie') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp49
-rw-r--r--libopie/odevice.h2
2 files changed, 30 insertions, 21 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 4b5a54e..4c33a0e 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -781,3 +781,2 @@ QStrList &ODevice::cpuFrequencies ( ) const
{
-qWarning("ODevice::cpuFrequencies: m_cpu_frequencies is %d", (int) d->m_cpu_frequencies);
return *d->m_cpu_frequencies;
@@ -799,15 +798,13 @@ bool ODevice::setCpuFrequency(uint index)
- //TODO: do the change in /proc/sys/cpu/0/speed
-
- return false;
-}
+ int fd;
-/**
- * Returns current frequency index out of d->m_cpu_frequencies
- */
-uint ODevice::cpuFrequency() const
-{
- // TODO: get freq from /proc/sys/cpu/0/speed and return index
+ if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) {
+ char writeCommand[50];
+ const int count = sprintf(writeCommand, "%s\n", freq);
+ int res = (::write(fd, writeCommand, count) != -1);
+ ::close(fd);
+ return res;
+ }
- return 0;
+ return false;
}
@@ -815,3 +812,2 @@ uint ODevice::cpuFrequency() const
-
/**
@@ -1994,7 +1990,22 @@ void Ramses::init()
-qWarning("adding freq");
- d->m_cpu_frequencies->append("100");
- d->m_cpu_frequencies->append("200");
- d->m_cpu_frequencies->append("300");
- d->m_cpu_frequencies->append("400");
+#ifdef QT_QWS_ALLOW_OVERCLOCK
+#warning *** Overclocking enabled - this may fry your hardware - you have been warned ***
+#define OC(x...) x
+#else
+#define OC(x...)
+#endif
+
+
+ // This table is true for a Intel XScale PXA 255
+
+ d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50
+OC( d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem
+ d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99
+OC( d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem
+ d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99
+OC( d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem
+ d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99
+ d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196
+OC( d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus
+
}
@@ -2146,4 +2157,2 @@ bool Ramses::setDisplayContrast(int contr)
::close(fd);
- } else {
- qWarning("no write");
}
diff --git a/libopie/odevice.h b/libopie/odevice.h
index 7f6f856..18ff5f1 100644
--- a/libopie/odevice.h
+++ b/libopie/odevice.h
@@ -202,3 +202,3 @@ public:
bool setCpuFrequency(uint index);
- uint cpuFrequency() const;
+ int cpuFrequency() const;