[openfirmware] [commit] r2226 - in cpu: arm/olpc/1.75 x86/pc/olpc x86/pc/olpc/via
repository service
svn at openfirmware.info
Thu May 26 01:56:39 CEST 2011
Author: wmb
Date: Thu May 26 01:56:39 2011
New Revision: 2226
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2226
Log:
OLPC trac #10896 - Implement persistent volume control for XO-1.75 (in the process, I moved the relevant code, which was duplicated between XO-1 and XO-1.5, into a common file that is used by all versions).
Modified:
cpu/arm/olpc/1.75/fw.bth
cpu/arm/olpc/1.75/sound.fth
cpu/x86/pc/olpc/fw.bth
cpu/x86/pc/olpc/sound.fth
cpu/x86/pc/olpc/via/fw.bth
Modified: cpu/arm/olpc/1.75/fw.bth
==============================================================================
--- cpu/arm/olpc/1.75/fw.bth Thu May 26 01:13:22 2011 (r2225)
+++ cpu/arm/olpc/1.75/fw.bth Thu May 26 01:56:39 2011 (r2226)
@@ -231,6 +231,10 @@
['] $call-method catch if 2drop 3drop then
;
code halt ( -- ) wfi c;
+
+: dimmer ( -- ) screen-ih if " dimmer" screen-ih $call-method then ;
+: brighter ( -- ) screen-ih if " brighter" screen-ih $call-method then ;
+
fload ${BP}/cpu/x86/pc/olpc/sound.fth
fload ${BP}/cpu/x86/pc/olpc/guardrtc.fth
fload ${BP}/cpu/x86/pc/olpc/security.fth
Modified: cpu/arm/olpc/1.75/sound.fth
==============================================================================
--- cpu/arm/olpc/1.75/sound.fth Thu May 26 01:13:22 2011 (r2225)
+++ cpu/arm/olpc/1.75/sound.fth Thu May 26 01:56:39 2011 (r2226)
@@ -1,9 +1,9 @@
-0 0 " d42a0c00" " /" begin-package
+0 0 " d42a0800" " /" begin-package
" audio" name
-my-space h# 40 reg
+my-space h# 800 reg
-h# d42a.0c00 constant sspa-base
-h# d42a.0800 constant adma-base
+0 value sspa-base \ E.g. h# d42a.0c00
+0 value adma-base \ E.g. h# d42a.0800
: sspa! ( n offset -- ) sspa-base + l! ; \ Write a register in SSPA1
: sspa@ ( offset -- n ) sspa-base + l@ ; \ Read a register in SSPA1
: adma! ( n offset -- ) adma-base + l! ;
@@ -170,11 +170,17 @@
my-in-desc 3 la+ l@ to my-in-desc
;
+[ifdef] cl2-a1
+: choose-smbus ( -- ) h# 30 1 set-twsi-target ;
+[else]
+: choose-smbus ( -- ) h# 34 1 set-twsi-target ;
+[then]
+
\ Reset is unconnected on current boards
\ : audio-reset ( -- ) 8 gpio-clr ;
\ : audio-unreset ( -- ) 8 gpio-set ;
-: codec@ ( reg# -- w ) 1 2 twsi-get swap bwjoin ;
-: codec! ( w reg# -- ) >r wbsplit r> 3 twsi-write ;
+: codec@ ( reg# -- w ) choose-smbus 1 2 twsi-get swap bwjoin ;
+: codec! ( w reg# -- ) choose-smbus >r wbsplit r> 3 twsi-write ;
: codec-i@ ( index# -- w ) h# 6a codec! h# 6c codec@ ;
: codec-i! ( w index# -- ) h# 6a codec! h# 6c codec! ;
@@ -346,12 +352,8 @@
[then]
[ifdef] cl2-a1
-: init-smbus ( -- ) h# 30 1 set-twsi-target ;
-
fload ${BP}/cpu/arm/olpc/1.75/alc5624.fth \ Realtek ALC5624 CODEC
[else]
-: init-smbus ( -- ) h# 34 1 set-twsi-target ;
-
: headphones-inserted? ( -- flag ) d# 97 gpio-pin@ ;
: microphone-inserted? ( -- flag ) d# 96 gpio-pin@ ;
@@ -378,20 +380,25 @@
: mono ;
: init-codec ( -- )
- init-smbus
codec-on
set-default-gains
d# 48000 set-sample-rate
;
0 value open-count
: open ( -- flag )
- open-count 0= if audio-clock-on init-codec then
+ open-count 0= if
+ my-space h# 800 " map-in" $call-parent to adma-base
+ adma-base h# 400 + to sspa-base
+ audio-clock-on init-codec
+ then
open-count 1+ to open-count
true
;
: close ( -- )
open-count 1 = if
uninstall-playback-alarm codec-off ( audio-clock-off )
+ adma-base h# 800 " map-out" $call-parent
+ 0 to adma-base 0 to sspa-base
then
open-count 1- 0 max to open-count
;
Modified: cpu/x86/pc/olpc/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/fw.bth Thu May 26 01:13:22 2011 (r2225)
+++ cpu/x86/pc/olpc/fw.bth Thu May 26 01:56:39 2011 (r2226)
@@ -359,6 +359,9 @@
fload ${BP}/cpu/x86/pc/biosints.fth
fload ${BP}/cpu/x86/pc/olpc/biosresume.fth
+: dimmer ( -- ) screen-ih if " dimmer" screen-ih $call-method then ;
+: brighter ( -- ) screen-ih if " brighter" screen-ih $call-method then ;
+
fload ${BP}/cpu/x86/pc/olpc/setwp.fth
fload ${BP}/cpu/x86/pc/olpc/sound.fth
fload ${BP}/cpu/x86/pc/olpc/guardrtc.fth
@@ -388,39 +391,6 @@
\needs ramdisk " " d# 128 config-string ramdisk
" " ' boot-file set-config-string-default \ Let the boot script set the cmdline
-: dimmer ( -- ) screen-ih if " dimmer" screen-ih $call-method then ;
-: brighter ( -- ) screen-ih if " brighter" screen-ih $call-method then ;
-
-dev /8042/keyboard
-0 value waiting-up?
-: olpc-check-abort ( scan-code -- abort? ) \ Square pressed?
- last-scan over to last-scan ( scan-code old-scan-code )
- h# e0 <> if drop false exit then ( scan-code )
-
- check-abort? 0= if drop false exit then ( scan-code )
-
- dup h# 7f and h# 5d <> if drop false exit then ( scan-code )
-
- h# 80 and if \ Up
- false to waiting-up?
- false ( abort? )
- else
- secure? if false else waiting-up? 0= then ( abort? )
- true to waiting-up?
- then
-;
-patch olpc-check-abort check-abort get-scan
-
-: handle-volume? ( scan-code -- scan-code flag )
- dup h# 43 = if dimmer true exit then
- dup h# 44 = if brighter true exit then
- dup h# 57 = if softer true exit then
- dup h# 58 = if louder true exit then
- false
-;
-' handle-volume? to scan-handled?
-dend
-
\ Eliminate 4 second delay in install console for the case where
\ there is no keyboard. The delay is unnecessary because the screen
\ does not go blank when the device is closed.
Modified: cpu/x86/pc/olpc/sound.fth
==============================================================================
--- cpu/x86/pc/olpc/sound.fth Thu May 26 01:13:22 2011 (r2225)
+++ cpu/x86/pc/olpc/sound.fth Thu May 26 01:56:39 2011 (r2226)
@@ -54,6 +54,36 @@
close-audio
;
+dev /keyboard
+0 value waiting-up?
+: olpc-check-abort ( scan-code -- abort? ) \ Square pressed?
+ last-scan over to last-scan ( scan-code old-scan-code )
+ h# e0 <> if drop false exit then ( scan-code )
+
+ check-abort? 0= if drop false exit then ( scan-code )
+
+ dup h# 7f and h# 5d <> if drop false exit then ( scan-code )
+
+ h# 80 and if \ Up
+ false to waiting-up?
+ false ( abort? )
+ else
+ secure? if false else waiting-up? 0= then ( abort? )
+ true to waiting-up?
+ then
+;
+patch olpc-check-abort check-abort get-scan
+
+: handle-volume? ( scan-code -- scan-code flag )
+ dup h# 43 = if dimmer true exit then
+ dup h# 44 = if brighter true exit then
+ dup h# 57 = if softer true exit then
+ dup h# 58 = if louder true exit then
+ false
+;
+' handle-volume? to scan-handled?
+dend
+
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
Modified: cpu/x86/pc/olpc/via/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/via/fw.bth Thu May 26 01:13:22 2011 (r2225)
+++ cpu/x86/pc/olpc/via/fw.bth Thu May 26 01:56:39 2011 (r2226)
@@ -403,6 +403,9 @@
fload ${BP}/cpu/x86/pc/olpc/biosresume.fth
[then]
+: dimmer ( -- ) screen-ih if " dimmer" screen-ih $call-method then ;
+: brighter ( -- ) screen-ih if " brighter" screen-ih $call-method then ;
+
fload ${BP}/cpu/x86/firfilter.fth
fload ${BP}/cpu/x86/pc/olpc/sound.fth
fload ${BP}/cpu/x86/pc/olpc/via/sound.fth
@@ -422,39 +425,6 @@
\needs ramdisk " " d# 128 config-string ramdisk
" " ' boot-file set-config-string-default \ Let the boot script set the cmdline
-: dimmer ( -- ) screen-ih if " dimmer" screen-ih $call-method then ;
-: brighter ( -- ) screen-ih if " brighter" screen-ih $call-method then ;
-
-dev /8042/keyboard
-0 value waiting-up?
-: olpc-check-abort ( scan-code -- abort? ) \ Square pressed?
- last-scan over to last-scan ( scan-code old-scan-code )
- h# e0 <> if drop false exit then ( scan-code )
-
- check-abort? 0= if drop false exit then ( scan-code )
-
- dup h# 7f and h# 5d <> if drop false exit then ( scan-code )
-
- h# 80 and if \ Up
- false to waiting-up?
- false ( abort? )
- else
- secure? if false else waiting-up? 0= then ( abort? )
- true to waiting-up?
- then
-;
-patch olpc-check-abort check-abort get-scan
-
-: handle-volume? ( scan-code -- scan-code flag )
- dup h# 43 = if dimmer true exit then
- dup h# 44 = if brighter true exit then
- dup h# 57 = if softer true exit then
- dup h# 58 = if louder true exit then
- false
-;
-' handle-volume? to scan-handled?
-dend
-
\ Eliminate 4 second delay in install console for the case where
\ there is no keyboard. The delay is unnecessary because the screen
\ does not go blank when the device is closed.
More information about the openfirmware
mailing list