summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/tools/lua/atj/lcm.lua
diff options
context:
space:
mode:
Diffstat (limited to 'utils/hwstub/tools/lua/atj/lcm.lua')
-rw-r--r--utils/hwstub/tools/lua/atj/lcm.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/atj/lcm.lua b/utils/hwstub/tools/lua/atj/lcm.lua
new file mode 100644
index 0000000000..feaa8b7158
--- /dev/null
+++ b/utils/hwstub/tools/lua/atj/lcm.lua
@@ -0,0 +1,31 @@
+ATJ.lcm = {}
+
+function ATJ.lcm.wait_fifo_empty()
+ while (bit32.band(HW.YUV2RGB.CTL.read(), 0x04) == 0) do
+ end
+end
+
+function ATJ.lcm.rs_command()
+ ATJ.lcm.wait_fifo_empty()
+ HW.YUV2RGB.CTL.write(0x802ae)
+end
+
+function ATJ.lcm.rs_data()
+ ATJ.lcm.wait_fifo_empty()
+ HW.YUV2RGB.CTL.write(0x902ae)
+end
+
+function ATJ.lcm.fb_data()
+ ATJ.lcm.rs_command()
+ HW.YUV2RGB.FIFODATA.write(0x22)
+ HW.YUV2RGB.CTL.write(0xa02ae)
+end
+
+function ATJ.lcm.init()
+ HW.CMU.DEVCLKEN.write(bit32.bor(HW.CMU.DEVCLKEN.read(), 0x102))
+ ATJ.gpio.muxsel("LCM")
+ hwstub.udelay(1)
+ ATJ.lcm.rs_command()
+ HW.YUV2RGB.CLKCTL.write(0x102)
+end
+