Changeset 3195


Ignore:
Timestamp:
Aug 17, 2012, 7:29:15 PM (3 years ago)
Author:
wmb
Message:

OLPC ARM - moved the DCON driver out of the screen node into a new node underneath an I2C bus node, for ease of Linux driver binding.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/olpc/1.75/lcdcfg.fth

    r3049 r3195  
    11dev /display
     2new-device
     3   " panel" device-name
     4   " mrvl,dumb-panel" +compatible
     5
     6   " OLPC DCON panel" model
     7   : +i  encode-int encode+  ;
     8
     9   decimal
     10   0 0 encode-bytes
     11   \ xres,  yres, refresh,       clockhz,  left, right,  top, bottom, hsync, vsync, flags, widthmm, heightmm
     12   1200 +i 900 +i    50 +i  56,930,000 +i  24 +i  26 +i  5 +i    4 +i  6 +i    3 +i   0 +i   152 +i   115 +i
     13   hex
     14   " linux,timing-modes" property
     15
     16   " 1200x900@50"  " linux,mode-names" string-property
     17
     18   h# 2000000d " lcd-dumb-ctrl-regval" integer-property
     19   h# 08001100 " lcd-pn-ctrl0-regval" integer-property
     20finish-device
     21device-end   
    222
    323[ifdef] has-dcon
    4    fload ${BP}/dev/olpc/dcon/mmp2dcon.fth        \ DCON control
     24fload ${BP}/dev/olpc/dcon/mmp2dcon.fth        \ DCON control
     25
     26dev /display/panel
     27   " /dcon" encode-phandle  " control-node" property
     28device-end
    529[then]
    630
    7 device-end
  • cpu/arm/olpc/lcd.fth

    r3179 r3195  
    320320
    321321   defer init-panel    ' noop to init-panel
    322    defer bright!       ' drop to bright!
    323    defer backlight-off ' noop to backlight-off
    324    defer backlight-on  ' noop to backlight-on
     322
     323   \ XXX we really should bounce these through the panel node(s)
     324   : bright!  " bright!" $call-dcon  ;
     325   : backlight-off  " backlight-off" $call-dcon  ;
     326   : backlight-on   " backlight-on" $call-dcon  ;
    325327
    326328   : display-on
  • dev/olpc/dcon/mmp2dcon.fth

    r3187 r3195  
    11\ See license at end of file
    2 \ " dcon" device-name
    3 
    4 also forth definitions
     2
    53: has-dcon-ram?  ( -- flag )
    64   board-revision h# 1b18 =  if  true exit  then
     
    86   false
    97;
    10 previous definitions
    11 
    12 new-device
    13    " dcon" device-name
    14    " mrvl,dumb-panel" +compatible
    15    " olpc,xo1-dcon" +compatible
    16    " olpc,xo1.75-dcon" +compatible
    17 
    18    " OLPC DCON panel" model
    19    : +i  encode-int encode+  ;
    20 
    21    0 0 encode-bytes
    22    dcon-stat0-gpio# 0 encode-gpio
    23    dcon-stat1-gpio# 0 encode-gpio
    24    dcon-load-gpio#  0 encode-gpio
    25    dcon-irq-gpio#   0 encode-gpio
    26    " gpios" property
    27 
    28    " stat0" encode-string
    29    " stat1" encode-string encode+
    30    " load"  encode-string encode+
    31    " irq"   encode-string encode+
    32    " gpio-names" property
    33 
    34    " /dcon-i2c" encode-phandle  " i2c-parent" property
    35 
    36    decimal
    37    0 0 encode-bytes
    38    \ xres,  yres, refresh,       clockhz,  left, right,  top, bottom, hsync, vsync, flags, widthmm, heightmm
    39    1200 +i 900 +i    50 +i  56,930,000 +i  24 +i  26 +i  5 +i    4 +i  6 +i    3 +i   0 +i   152 +i   115 +i
    40    hex
    41    " linux,timing-modes" property
    42 
    43    " 1200x900@50"  " linux,mode-names" string-property
    44 
    45    h# 2000000d " lcd-dumb-ctrl-regval" integer-property
    46    h# 08001100 " lcd-pn-ctrl0-regval" integer-property
    47 finish-device
    48 
    49 stand-init:
    50    has-dcon-ram?  0=  if
    51       " /dcon" find-device
    52       0 0 " no-freeze" property
    53       device-end
    54    then
    55 ;
     8
     90 0  " 1a"  " /dcon-i2c" begin-package
     10
     11" dcon" device-name
     12" olpc,xo1-dcon" +compatible
     13" olpc,xo1.75-dcon" +compatible
     14h# 1a 1 reg
     15
     160 0 encode-bytes
     17dcon-stat0-gpio# 0 encode-gpio
     18dcon-stat1-gpio# 0 encode-gpio
     19dcon-load-gpio#  0 encode-gpio
     20dcon-irq-gpio#   0 encode-gpio
     21" gpios" property
     22
     23" stat0" encode-string
     24" stat1" encode-string encode+
     25" load"  encode-string encode+
     26" irq"   encode-string encode+
     27" gpio-names" property
    5628
    5729\ DCON internal registers, accessed via I2C
     
    9062
    9163: smb-init    ( -- )  set-dcon-slave  smb-on  smb-pulses  ;
     64: smb-reset   ( -- )  smb-stop 1 ms  smb-off  1 ms  smb-on   ;
    9265
    9366: dcon@  ( reg# -- word )  set-dcon-slave  smb-word@  ;
     
    162135
    163136: try-dcon!  ( w reg# -- )
    164    ['] dcon!  catch  if  2drop  smb-stop 1 ms  smb-off  1 ms  smb-on  then
     137   ['] dcon!  catch  if  2drop  smb-reset  then
    165138;
    166139
     
    175148: timeout! ( to -- )      8 dcon!  ;  \ def: h# ffff
    176149: scanint! ( si -- )      9 dcon!  ;  \ def: h# 0000
     150[ifdef] old-way
    177151: dcon-bright!  ( level -- ) d# 10 dcon! ; \ def: h# xxxF
    178152' dcon-bright!  to bright!
    179 : bright@  ( -- level ) d# 10 dcon@ ;
    180 : brighter  ( -- )  bright@ 1+  h# f min  bright!  ;
    181 : dimmer    ( -- )  bright@ 1-  0 max  bright!  ;
    182 
    183153: dcon-backlight-off  ( -- )  mode@  8 invert and  mode!  ;
    184154' dcon-backlight-off to backlight-off
    185155: dcon-backlight-on   ( -- )  mode@  8 or  mode!  ;
    186156' dcon-backlight-on to backlight-on
     157[else]
     158: bright!  ( level -- ) d# 10 dcon! ; \ def: h# xxxF
     159: backlight-off  ( -- )  mode@  8 invert and  mode!  ;
     160: backlight-on   ( -- )  mode@  8 or  mode!  ;
     161[then]
     162
     163: bright@  ( -- level ) d# 10 dcon@ ;
     164: brighter  ( -- )  bright@ 1+  h# f min  bright!  ;
     165: dimmer    ( -- )  bright@ 1-  0 max  bright!  ;
    187166
    188167\ Color swizzle, AA, no passthrough, backlight
     
    233212;
    234213
    235 : video-save
    236    0 set-source  \ Freeze image
    237 ;
    238 
    239 : video-restore
    240    smb-init
    241    1 set-source  \ Unfreeze image
    242 ;
    243 
    2442140 value dcon-found?
    245215
    246216: maybe-set-cmos  ( -- )  ;
    247217
     218[ifdef] old-way
    248219: init-dcon  ( -- )
    249220   smb-init
     
    254225;
    255226' init-dcon to init-panel
     227[else]
     228: open  ( -- flag )
     229   smb-init
     230\ Unnecessary because CForth has already done it
     231\   dcon-load  dcon-enable  ( maybe-set-cmos )
     232   \ dcon-enable leaves mode set to 69 - 40:antialias, 20:swizzle, 8:backlight on, 1:passthru off
     233   true
     234;
     235[then]
    256236
    257237: dcon-power-on   ( -- )  1 h# 26 ec-cmd-b!  ;
     
    274254   saved-dcon-mode  mode!
    275255   saved-brightness bright!
     256;
     257
     258end-package
     259
     260stand-init:
     261   has-dcon-ram?  0=  if
     262      " /dcon" find-device
     263      0 0 " no-freeze" property
     264      device-end
     265   then
    276266;
    277267
Note: See TracChangeset for help on using the changeset viewer.