diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-09-26 16:41:30 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-09-26 16:41:30 +0200 |
commit | 835d740fca64caa40afb867cef4861ab0f23bee7 (patch) | |
tree | f2d43c4b6031bfc1b51e6e18a58f445eef739c92 /utils/hwstub/tools/lua | |
parent | f37f3393c997b775d177424d020bd5b16d43618a (diff) |
hwstub: fix lcd drivers for sony NWZ
Change-Id: I8d581ec906ec2bab0d983aacfb0e8479b77d0c57
Diffstat (limited to 'utils/hwstub/tools/lua')
-rw-r--r-- | utils/hwstub/tools/lua/sonynwze360.lua | 24 | ||||
-rw-r--r-- | utils/hwstub/tools/lua/sonynwze370.lua | 22 | ||||
-rw-r--r-- | utils/hwstub/tools/lua/stmp/lcdif.lua | 2 |
3 files changed, 32 insertions, 16 deletions
diff --git a/utils/hwstub/tools/lua/sonynwze360.lua b/utils/hwstub/tools/lua/sonynwze360.lua index 368cfb498a..669e899f0d 100644 --- a/utils/hwstub/tools/lua/sonynwze360.lua +++ b/utils/hwstub/tools/lua/sonynwze360.lua @@ -5,6 +5,7 @@ NWZE360 = {} function NWZE360.lcd_send(cmd, data) STMP.lcdif.set_data_swizzle(0) + STMP.lcdif.set_word_length(8) STMP.lcdif.set_byte_packing_format(0xf) STMP.lcdif.send_pio(false, {cmd}) if cmd ~= 0x22 then @@ -45,7 +46,6 @@ function NWZE360.lcd_init() STMP.pinctrl.lcdif.setup_system(8, false) STMP.lcdif.init() STMP.lcdif.set_databus_width(8) - STMP.lcdif.set_word_length(8) STMP.lcdif.set_system_timing(1, 1, 1, 1) STMP.lcdif.set_byte_packing_format(0xf) STMP.lcdif.set_reset(1) @@ -118,22 +118,26 @@ function NWZE360.lcd_init() STMP.digctl.udelay(40000) NWZE360.lcd_send(0x28, 0x3C) - --NWZE360.lcd_send(0x36, 0x0) -- experimental + --NWZE360.lcd_send(0x36, 0xc0) -- no effect ? --NWZE360.lcd_send(0x16, 8 + 0x60) -- redraw with landscape orientation + --NWZE360.lcd_send(0x28, 0x34) -- display control + --NWZE360.lcd_send(0x60, 0x8) -- no effect ? + NWZE360.lcd_send(0x16, 0) -- BGR <-> RGB NWZE360.set_backlight(100) NWZE360.lcd_set_update_rect(0, 0, 240, 320) - STMP.lcdif.set_word_length(8) - for i = 0, 240 do - for j = 0, 320 do + STMP.lcdif.set_word_length(16) + for i = 0, 319 do + data = {} + for j = 0, 239 do r = 0x1f - g = 0x3f - b = 0x1f - pix = bit32.bor(r, bit32.bor(bit32.lshift(g, 6), bit32.lshift(b, 11))) - STMP.lcdif.send_pio(true, {bit32.band(pix, 0xff), bit32.rshift(pix, 8)}) - --STMP.lcdif.send_pio(true, {pix}) + g = 0x0 + b = 0x0 + pix = bit32.bor(b, bit32.bor(bit32.lshift(g, 6), bit32.lshift(r, 11))) + data[#data + 1] = pix end + STMP.lcdif.send_pio(true, data) end end diff --git a/utils/hwstub/tools/lua/sonynwze370.lua b/utils/hwstub/tools/lua/sonynwze370.lua index ef9e8cb4e7..111bf6b6eb 100644 --- a/utils/hwstub/tools/lua/sonynwze370.lua +++ b/utils/hwstub/tools/lua/sonynwze370.lua @@ -6,6 +6,7 @@ NWZE370 = {} function NWZE370.lcd_send(cmd, data) STMP.lcdif.set_data_swizzle(0) STMP.lcdif.set_byte_packing_format(0xf) + STMP.lcdif.set_word_length(8) STMP.lcdif.send_pio(false, {cmd}) if #data ~= 0 then STMP.lcdif.send_pio(true, data) @@ -56,12 +57,21 @@ function NWZE370.lcd_init() 0x46, 8, 0x21, 0x29, 0x28, 0x2f, 0x3f}) --negative gamma NWZE370.lcd_send(0x29, {}) -- display on - NWZE370.lcd_set_update_rect(10, 10, 20, 10) - for i = 0, 19 do - for j = 0, 9 do - pix = 0xf800 - STMP.lcdif.send_pio(true, {bit32.band(pix, 0xff), bit32.rshift(pix, 8)}) + NWZE370.lcd_set_update_rect(0, 0, 128, 160) + STMP.lcdif.set_data_swizzle(3) + STMP.lcdif.set_word_length(8) + for i = 0, 10 do + data = {} + for j = 0, 127 do + r = 0x1f + g = 0x0 + b = 0x0 + pix = bit32.bor(b, bit32.bor(bit32.lshift(g, 6), bit32.lshift(r, 11))) + data[#data + 1] = bit32.band(pix, 0xff) + data[#data + 1] = bit32.rshift(pix, 8) + --data[#data + 1] = pix end + STMP.lcdif.send_pio(true, data) end end @@ -72,8 +82,8 @@ function NWZE370.set_backlight(val) end function NWZE370.init() - NWZE370.lcd_init() NWZE370.set_backlight(100) + NWZE370.lcd_init() --[[ HW.LRADC.CTRL0.SFTRST.clr() HW.LRADC.CTRL0.CLKGATE.clr() diff --git a/utils/hwstub/tools/lua/stmp/lcdif.lua b/utils/hwstub/tools/lua/stmp/lcdif.lua index 7d22edb937..ba08de23bb 100644 --- a/utils/hwstub/tools/lua/stmp/lcdif.lua +++ b/utils/hwstub/tools/lua/stmp/lcdif.lua @@ -11,6 +11,8 @@ function STMP.lcdif.setup_clock() end function STMP.lcdif.init() + HW.LCDIF.CTRL.SFTRST.clr() + HW.LCDIF.CTRL.CLKGATE.clr() HW.LCDIF.CTRL.SFTRST.set() HW.LCDIF.CTRL.SFTRST.clr() HW.LCDIF.CTRL.CLKGATE.clr() |