1
0
Fork 0
forked from len0rd/rockbox

hwstub: fix lcd drivers for sony NWZ

Change-Id: I8d581ec906ec2bab0d983aacfb0e8479b77d0c57
This commit is contained in:
Amaury Pouly 2013-09-26 16:41:30 +02:00
parent f37f3393c9
commit 835d740fca
3 changed files with 32 additions and 16 deletions

View file

@ -5,6 +5,7 @@ NWZE360 = {}
function NWZE360.lcd_send(cmd, data) function NWZE360.lcd_send(cmd, data)
STMP.lcdif.set_data_swizzle(0) STMP.lcdif.set_data_swizzle(0)
STMP.lcdif.set_word_length(8)
STMP.lcdif.set_byte_packing_format(0xf) STMP.lcdif.set_byte_packing_format(0xf)
STMP.lcdif.send_pio(false, {cmd}) STMP.lcdif.send_pio(false, {cmd})
if cmd ~= 0x22 then if cmd ~= 0x22 then
@ -45,7 +46,6 @@ function NWZE360.lcd_init()
STMP.pinctrl.lcdif.setup_system(8, false) STMP.pinctrl.lcdif.setup_system(8, false)
STMP.lcdif.init() STMP.lcdif.init()
STMP.lcdif.set_databus_width(8) STMP.lcdif.set_databus_width(8)
STMP.lcdif.set_word_length(8)
STMP.lcdif.set_system_timing(1, 1, 1, 1) STMP.lcdif.set_system_timing(1, 1, 1, 1)
STMP.lcdif.set_byte_packing_format(0xf) STMP.lcdif.set_byte_packing_format(0xf)
STMP.lcdif.set_reset(1) STMP.lcdif.set_reset(1)
@ -118,22 +118,26 @@ function NWZE360.lcd_init()
STMP.digctl.udelay(40000) STMP.digctl.udelay(40000)
NWZE360.lcd_send(0x28, 0x3C) 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(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.set_backlight(100)
NWZE360.lcd_set_update_rect(0, 0, 240, 320) NWZE360.lcd_set_update_rect(0, 0, 240, 320)
STMP.lcdif.set_word_length(8) STMP.lcdif.set_word_length(16)
for i = 0, 240 do for i = 0, 319 do
for j = 0, 320 do data = {}
for j = 0, 239 do
r = 0x1f r = 0x1f
g = 0x3f g = 0x0
b = 0x1f b = 0x0
pix = bit32.bor(r, bit32.bor(bit32.lshift(g, 6), bit32.lshift(b, 11))) pix = bit32.bor(b, bit32.bor(bit32.lshift(g, 6), bit32.lshift(r, 11)))
STMP.lcdif.send_pio(true, {bit32.band(pix, 0xff), bit32.rshift(pix, 8)}) data[#data + 1] = pix
--STMP.lcdif.send_pio(true, {pix})
end end
STMP.lcdif.send_pio(true, data)
end end
end end

View file

@ -6,6 +6,7 @@ NWZE370 = {}
function NWZE370.lcd_send(cmd, data) function NWZE370.lcd_send(cmd, data)
STMP.lcdif.set_data_swizzle(0) STMP.lcdif.set_data_swizzle(0)
STMP.lcdif.set_byte_packing_format(0xf) STMP.lcdif.set_byte_packing_format(0xf)
STMP.lcdif.set_word_length(8)
STMP.lcdif.send_pio(false, {cmd}) STMP.lcdif.send_pio(false, {cmd})
if #data ~= 0 then if #data ~= 0 then
STMP.lcdif.send_pio(true, data) STMP.lcdif.send_pio(true, data)
@ -56,12 +57,21 @@ function NWZE370.lcd_init()
0x46, 8, 0x21, 0x29, 0x28, 0x2f, 0x3f}) --negative gamma 0x46, 8, 0x21, 0x29, 0x28, 0x2f, 0x3f}) --negative gamma
NWZE370.lcd_send(0x29, {}) -- display on NWZE370.lcd_send(0x29, {}) -- display on
NWZE370.lcd_set_update_rect(10, 10, 20, 10) NWZE370.lcd_set_update_rect(0, 0, 128, 160)
for i = 0, 19 do STMP.lcdif.set_data_swizzle(3)
for j = 0, 9 do STMP.lcdif.set_word_length(8)
pix = 0xf800 for i = 0, 10 do
STMP.lcdif.send_pio(true, {bit32.band(pix, 0xff), bit32.rshift(pix, 8)}) 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 end
STMP.lcdif.send_pio(true, data)
end end
end end
@ -72,8 +82,8 @@ function NWZE370.set_backlight(val)
end end
function NWZE370.init() function NWZE370.init()
NWZE370.lcd_init()
NWZE370.set_backlight(100) NWZE370.set_backlight(100)
NWZE370.lcd_init()
--[[ --[[
HW.LRADC.CTRL0.SFTRST.clr() HW.LRADC.CTRL0.SFTRST.clr()
HW.LRADC.CTRL0.CLKGATE.clr() HW.LRADC.CTRL0.CLKGATE.clr()

View file

@ -11,6 +11,8 @@ function STMP.lcdif.setup_clock()
end end
function STMP.lcdif.init() function STMP.lcdif.init()
HW.LCDIF.CTRL.SFTRST.clr()
HW.LCDIF.CTRL.CLKGATE.clr()
HW.LCDIF.CTRL.SFTRST.set() HW.LCDIF.CTRL.SFTRST.set()
HW.LCDIF.CTRL.SFTRST.clr() HW.LCDIF.CTRL.SFTRST.clr()
HW.LCDIF.CTRL.CLKGATE.clr() HW.LCDIF.CTRL.CLKGATE.clr()