# HG changeset patch # User Paul Boddie # Date 1592342672 -7200 # Node ID 4fe040c124eaa9f5ab3ff1065fd84f630bc1c29d # Parent f54524d64fbab6a893b27e2b462da54f51f82042 Added basic JZ4780 HDMI display support, albeit without EDID retrieval. diff -r f54524d64fba -r 4fe040c124ea conf/landfall-examples/mips-ci20-common.io --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/landfall-examples/mips-ci20-common.io Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,25 @@ +-- vim: ft=lua ts=2 et sw=2 + +-- Configuration file for Io. + +local hw = Io.system_bus() + +Io.add_vbus("cpm", Io.Vi.System_bus +{ + CPM = wrap(hw:match("jz4780-cpm")); +}) + +Io.add_vbus("gpio", Io.Vi.System_bus +{ + GPIO = wrap(hw:match("jz4780-gpio")); +}) + +Io.add_vbus("lcd", Io.Vi.System_bus +{ + LCD = wrap(hw:match("jz4780-lcd")); +}) + +Io.add_vbus("hdmi", Io.Vi.System_bus +{ + HDMI = wrap(hw:match("jz4780-hdmi")); +}) diff -r f54524d64fba -r 4fe040c124ea conf/landfall-examples/mips-ci20-fbdrv.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/landfall-examples/mips-ci20-fbdrv.cfg Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,70 @@ +-- vim: ft=lua ts=2 et sw=2 + +-- Start the framebuffer driver with supporting devices. +-- The target platform is the MIPS Creator CI20. + +local L4 = require("L4"); + +local l = L4.default_loader; + +-- Define general access to peripherals. + +local io_buses = { + cpm = l:new_channel(); + gpio = l:new_channel(); + hdmi = l:new_channel(); + lcd = l:new_channel(); + }; + +l:start({ + caps = { + cpm = io_buses.cpm:svr(), + gpio = io_buses.gpio:svr(), + hdmi = io_buses.hdmi:svr(), + lcd = io_buses.lcd:svr(), + + icu = L4.Env.icu, + sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0), + }, + }, + "rom/io rom/hw_devices.io rom/mips-ci20-common.io"); + +-- Expose the CPM peripheral. + +local cpm = l:new_channel(); + +l:start({ + caps = { + vbus = io_buses.cpm, + cpm = cpm:svr(), + }, + }, + "rom/dev_cpm_jz4780"); + +-- Expose a display device for the CI20. + +local display = l:new_channel(); -- exposes display device + +l:start({ + caps = { + cpm = cpm, + display = display:svr(), + icu = L4.Env.icu, + vbus = io_buses.hdmi, -- for HDMI resource access + }, + }, + "rom/dev_display_ci20_hdmi"); + +-- Expose a framebuffer device. + +local fbdrv_fb = l:new_channel(); + +l:start({ + caps = { + vbus = io_buses.lcd, + fb = fbdrv_fb:svr(), + cpm = cpm, + display = display, -- needed by LCD driver + }, + }, + "rom/fb-drv"); diff -r f54524d64fba -r 4fe040c124ea conf/landfall-examples/mips-ci20-fbdrv.list --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/landfall-examples/mips-ci20-fbdrv.list Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,18 @@ + +modaddr 0x1100000 + +entry mips-ci20-fbdrv-example +bootstrap bootstrap -serial +kernel fiasco -serial_esc +roottask moe rom/mips-ci20-fbdrv.cfg +module mips-ci20-fbdrv.cfg +module mips-ci20-common.io +module plat-mips-ci20/hw_devices.io +module l4re +module io +module ned +module fb-drv +module dev_display_ci20_hdmi +module dev_cpm_jz4780 +module libpanel_ci20.so +module mips-jz4740-panel.txt diff -r f54524d64fba -r 4fe040c124ea pkg/devices/Control --- a/pkg/devices/Control Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/Control Tue Jun 16 23:24:32 2020 +0200 @@ -3,6 +3,7 @@ provides: devices-cpm-jz4730 provides: devices-cpm-jz4740 provides: devices-cpm-jz4780 +provides: devices-display-ci20_hdmi provides: devices-display-letux400 provides: devices-display-qi_lb60 provides: devices-fb-jz4740 @@ -42,6 +43,7 @@ provides: libdrivers-keypad-qi_lb60 provides: libdrivers-lcd-headers provides: libdrivers-lcd-jz4740 +provides: libdrivers-panel-ci20 provides: libdrivers-panel-headers provides: libdrivers-panel-letux400 provides: libdrivers-panel-loader diff -r f54524d64fba -r 4fe040c124ea pkg/devices/Makefile --- a/pkg/devices/Makefile Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/Makefile Tue Jun 16 23:24:32 2020 +0200 @@ -11,7 +11,7 @@ backlight: pwm spi cpm: lib util -display: backlight lib util +display: backlight cpm lib util fb: lcd lib util input: keypad lib keypad: lib util diff -r f54524d64fba -r 4fe040c124ea pkg/devices/cpm/include/cpm-client.h --- a/pkg/devices/cpm/include/cpm-client.h Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/cpm/include/cpm-client.h Tue Jun 16 23:24:32 2020 +0200 @@ -1,7 +1,7 @@ /* * CPM client to access CPM servers. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2020 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -31,9 +31,17 @@ L4_KOBJECT(Cpm_device_interface) public: + int get_lcd_pixel_frequency(uint32_t *frequency) throw(); + + int set_hdmi_frequency(uint32_t frequency) throw(); int set_lcd_frequencies(uint32_t pclk, uint8_t multiplier) throw(); + + int start_hdmi() throw(); + int stop_hdmi() throw(); + int start_lcd() throw(); int stop_lcd() throw(); + int update_output_frequency() throw(); }; diff -r f54524d64fba -r 4fe040c124ea pkg/devices/cpm/include/cpm-ops.h --- a/pkg/devices/cpm/include/cpm-ops.h Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/cpm/include/cpm-ops.h Tue Jun 16 23:24:32 2020 +0200 @@ -1,7 +1,7 @@ /* * CPM server operations. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2020 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -26,4 +26,8 @@ Cpm_op_start_lcd, Cpm_op_stop_lcd, Cpm_op_update_output_frequency, + Cpm_op_get_lcd_pixel_frequency, + Cpm_op_set_hdmi_frequency, + Cpm_op_start_hdmi, + Cpm_op_stop_hdmi, }; diff -r f54524d64fba -r 4fe040c124ea pkg/devices/cpm/src/client/cpm-client.cc --- a/pkg/devices/cpm/src/client/cpm-client.cc Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/cpm/src/client/cpm-client.cc Tue Jun 16 23:24:32 2020 +0200 @@ -1,7 +1,7 @@ /* * CPM client to access CPM servers. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2020 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -26,6 +26,47 @@ #include "cpm-ops.h" int +Cpm_device_interface::get_lcd_pixel_frequency(uint32_t *frequency) throw() +{ + L4::Ipc::Iostream s(l4_utcb()); + int err = l4_error(s.call(cap(), Cpm_op_get_lcd_pixel_frequency)); + uint32_t _frequency; + + if (err) + return err; + + s >> _frequency; + *frequency = _frequency; + return L4_EOK; +} + +int +Cpm_device_interface::set_hdmi_frequency(uint32_t frequency) throw() +{ + L4::Ipc::Iostream s(l4_utcb()); + + s << frequency; + + return l4_error(s.call(cap(), Cpm_op_set_hdmi_frequency)); +} + +int +Cpm_device_interface::start_hdmi() throw() +{ + L4::Ipc::Iostream s(l4_utcb()); + + return l4_error(s.call(cap(), Cpm_op_start_hdmi)); +} + +int +Cpm_device_interface::stop_hdmi() throw() +{ + L4::Ipc::Iostream s(l4_utcb()); + + return l4_error(s.call(cap(), Cpm_op_stop_hdmi)); +} + +int Cpm_device_interface::set_lcd_frequencies(uint32_t pclk, uint8_t multiplier) throw() { L4::Ipc::Iostream s(l4_utcb()); diff -r f54524d64fba -r 4fe040c124ea pkg/devices/cpm/src/server/cpm-server.cc --- a/pkg/devices/cpm/src/server/cpm-server.cc Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/cpm/src/server/cpm-server.cc Tue Jun 16 23:24:32 2020 +0200 @@ -1,7 +1,7 @@ /* * Common CPM server functionality. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2020 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -43,6 +43,24 @@ case L4::Meta::Protocol: return L4::Util::handle_meta_request(ios); + case Cpm_op_get_lcd_pixel_frequency: + ios << _chip->get_lcd_pixel_frequency(); + return L4_EOK; + + case Cpm_op_set_hdmi_frequency: + uint32_t frequency; + ios >> frequency; + _chip->set_hdmi_frequency(frequency); + return L4_EOK; + + case Cpm_op_start_hdmi: + _chip->start_hdmi(); + return L4_EOK; + + case Cpm_op_stop_hdmi: + _chip->stop_hdmi(); + return L4_EOK; + case Cpm_op_set_lcd_frequencies: uint32_t pclk; int multiplier; diff -r f54524d64fba -r 4fe040c124ea pkg/devices/display/src/Makefile --- a/pkg/devices/display/src/Makefile Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/display/src/Makefile Tue Jun 16 23:24:32 2020 +0200 @@ -1,6 +1,6 @@ PKGDIR ?= ../.. L4DIR ?= $(PKGDIR)/../.. -TARGET := client letux400 qi_lb60 +TARGET := ci20 client letux400 qi_lb60 include $(L4DIR)/mk/subdir.mk diff -r f54524d64fba -r 4fe040c124ea pkg/devices/display/src/ci20/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/display/src/ci20/Makefile Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,14 @@ +PKGDIR ?= ../../.. +L4DIR ?= $(PKGDIR)/../.. + +TARGET = dev_display_ci20_hdmi +MODE = shared +PC_FILENAME := devices-display-ci20_hdmi + +SRC_CC := display-ci20_hdmi.cc + +PRIVATE_INCDIR += $(PKGDIR)/display/include + +REQUIRES_LIBS := l4re_c l4re_c-util libdevice-cpm-client libdrivers-hdmi-jz4780 libdrivers-lcd-jz4740 libdrivers-panel-loader libdevice-util + +include $(L4DIR)/mk/prog.mk diff -r f54524d64fba -r 4fe040c124ea pkg/devices/display/src/ci20/display-ci20_hdmi.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/display/src/ci20/display-ci20_hdmi.cc Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,168 @@ +/* + * Export MIPS Creator CI20 HDMI display operations as a server. + * + * Copyright (C) 2018, 2020 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "display-ops.h" + +/* Virtual addresses for the HDMI register block plus interrupt capability. */ + +static l4_addr_t hdmi_virt_base = 0, hdmi_virt_base_end = 0; +static l4_uint32_t hdmi_irq_start, hdmi_irq_end; +static L4::Cap hdmi_irq; +static L4::Cap icu; + +/* CPM device abstractions. */ + +static Hdmi_jz4780_chip *hdmi = 0; +static L4::Cap cpm_device; + + + +static int setup_memory(void) +{ + if (get_memory("jz4780-hdmi", &hdmi_virt_base, &hdmi_virt_base_end)) + return 1; + + if (get_irq("jz4780-hdmi", &hdmi_irq_start, &hdmi_irq_end)) + return 1; + + /* Obtain a reference to the CPM device. */ + + cpm_device = L4Re::Env::env()->get_cap("cpm"); + if (!cpm_device.is_valid()) return 1; + + /* Start the HDMI peripheral. */ + + cpm_device->stop_hdmi(); + cpm_device->set_hdmi_frequency(27000000); + cpm_device->start_hdmi(); + + /* Load the panel data from the configured library. */ + + struct Jz4740_lcd_panel *panel = (struct Jz4740_lcd_panel *) load_panel(); + if (!panel) return 1; + + /* Obtain access to the HDMI interrupt using the ICU. */ + + icu = L4Re::Env::env()->get_cap("icu"); + + hdmi_irq = L4Re::Util::cap_alloc.alloc(); + L4Re::Env::env()->factory()->create(hdmi_irq); + + if (!hdmi_irq.is_valid() || !icu.is_valid()) return 1; + + /* Bind the IRQ object to the interrupt in this thread. */ + + int err = l4_error(icu->bind(hdmi_irq_start, hdmi_irq)); + if (err) return err; + + hdmi_irq->bind_thread(L4Re::Env::env()->main_thread(), 0); + + /* Obtain an abstraction for the HDMI peripheral. */ + + hdmi = new Hdmi_jz4780_chip(hdmi_virt_base, hdmi_virt_base_end, hdmi_irq.cap(), panel); + + return 0; +} + + + +/* Display device. */ + +class Display_device_server : public L4::Server_object_t +{ +public: + /* Dispatch incoming requests. */ + + int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) + { + l4_msgtag_t tag; + + (void) obj; + ios >> tag; + + switch (tag.label()) + { + case Display_op_disable: + disable(); + return L4_EOK; + + case Display_op_enable: + enable(); + return L4_EOK; + + default: + return -L4_EBADPROTO; + } + } + + /* Switch the display off. */ + + void disable(void) + { + } + + /* Switch the display on. */ + + void enable(void) + { + uint32_t frequency; + + // NOTE: Should test to see if it is connected. + + if (!cpm_device->get_lcd_pixel_frequency(&frequency)) + { + hdmi->enable(frequency); + } + } +}; + +static L4Re::Util::Registry_server<> server; + + + +int main(void) +{ + if (setup_memory()) return 1; + + /* Initialise and register a new server object. */ + + Display_device_server server_obj; + server.registry()->register_obj(&server_obj, "display"); + + /* Enter the IPC server loop. */ + + server.loop(); + return 0; +} diff -r f54524d64fba -r 4fe040c124ea pkg/devices/lcd/include/lcd-ci20.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lcd/include/lcd-ci20.h Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,43 @@ +/* + * LCD device support for the MIPS Creator CI20. + * + * Copyright (C) 2018, 2020 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#pragma once + +#include "lcd-jz4740-device.h" + +#ifdef __cplusplus + +class Lcd_ci20 : public Lcd_jz4740_device +{ +public: + /* Inherit constructor. */ + + Lcd_ci20(Lcd_chip *chip, L4::Cap display) + : Lcd_jz4740_device(chip, display) + { + } + + /* Common device instance. */ + + static Lcd_ci20 *device; +}; + +#endif diff -r f54524d64fba -r 4fe040c124ea pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc --- a/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/lcd/src/jz4740/lcd-jz4740-device.cc Tue Jun 16 23:24:32 2020 +0200 @@ -1,7 +1,7 @@ /* * Common LCD device support for the JZ4740 and related SoCs. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2020 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "lcd-jz4740-device.h" @@ -88,16 +89,24 @@ { Lcd_jz4740_chip *chip = static_cast(_chip); + // Initialise the clocks for the LCD controller. Without this, the controller + // cannot be operated. + + set_timing(); + + // Configure the controller. + chip->disable(); chip->config((struct Jz4740_lcd_descriptor *) desc_vaddr, (struct Jz4740_lcd_descriptor *) desc_paddr, fb_paddr); - // Initialise the clocks for the LCD controller. + // Activate the display channel. - set_timing(); enable_display(); + // Activate the controller output. + chip->enable(); } @@ -141,10 +150,12 @@ // Allocate memory for the framebuffer at 2**6 == 64 byte == 16 word alignment, // also for the descriptors. + // NOTE: A 64 word burst mode is available on the JZ4780 that would + // NOTE: necessitate 64 word alignment for the framebuffer. const l4_size_t alloc_flags = L4Re::Mem_alloc::Continuous | L4Re::Mem_alloc::Pinned; - if (L4Re::Env::env()->mem_alloc()->alloc(fb_size, _fbmem, alloc_flags, 6) || + if (L4Re::Env::env()->mem_alloc()->alloc(fb_size, _fbmem, alloc_flags, 8) || L4Re::Env::env()->mem_alloc()->alloc(desc_size, descmem, alloc_flags, 6)) return 1; @@ -197,6 +208,15 @@ switch (panel->bpp) { + // NOTE: 24bpp here is actually RGBA or RGB padded. + + case 24: + view_info->pixel_info.bytes_per_pixel = 4; + view_info->pixel_info.r.shift = 16; view_info->pixel_info.r.size = 8; + view_info->pixel_info.g.shift = 8; view_info->pixel_info.g.size = 8; + view_info->pixel_info.b.shift = 0; view_info->pixel_info.b.size = 8; + break; + case 32: view_info->pixel_info.r.shift = 16; view_info->pixel_info.r.size = 8; view_info->pixel_info.g.shift = 8; view_info->pixel_info.g.size = 8; @@ -231,8 +251,15 @@ static int setup_memory() { + bool is_jz4780 = false; + if (get_memory("jz4740-lcd", &lcd_virt_base, &lcd_virt_base_end)) - return 1; + { + if (get_memory("jz4780-lcd", &lcd_virt_base, &lcd_virt_base_end)) + return 1; + else + is_jz4780 = true; + } // Obtain access to the CPM and display devices. @@ -248,7 +275,10 @@ // Initialise the LCD abstraction. - lcd_chip = new Lcd_jz4740_chip(lcd_virt_base, panel); + if (is_jz4780) + lcd_chip = new Lcd_jz4780_chip(lcd_virt_base, panel); + else + lcd_chip = new Lcd_jz4740_chip(lcd_virt_base, panel); return 0; } diff -r f54524d64fba -r 4fe040c124ea pkg/devices/lib/cpm/include/cpm-jz4780.h --- a/pkg/devices/lib/cpm/include/cpm-jz4780.h Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/lib/cpm/include/cpm-jz4780.h Tue Jun 16 23:24:32 2020 +0200 @@ -121,7 +121,8 @@ uint8_t get_hclock0_source(); uint8_t get_hclock2_source(); uint8_t get_hdmi_source(); - uint8_t get_lcd_source(uint8_t controller = 0); + uint8_t get_lcd_source(uint8_t controller); + uint8_t get_lcd_source() { return get_lcd_source(0); } uint8_t get_memory_source(); uint8_t get_pclock_source(); @@ -129,7 +130,8 @@ uint32_t get_hclock0_source_frequency(); uint32_t get_hclock2_source_frequency(); uint32_t get_hdmi_source_frequency(); - uint32_t get_lcd_source_frequency(uint8_t controller = 0); + uint32_t get_lcd_source_frequency(uint8_t controller); + uint32_t get_lcd_source_frequency() { return get_lcd_source_frequency(0); } uint32_t get_memory_source_frequency(); uint32_t get_pclock_source_frequency(); @@ -139,7 +141,8 @@ uint32_t get_hclock0_frequency(); uint32_t get_hclock2_frequency(); uint32_t get_hdmi_frequency(); - uint32_t get_lcd_pixel_frequency(uint8_t controller = 0); + uint32_t get_lcd_pixel_frequency(uint8_t controller); + uint32_t get_lcd_pixel_frequency() { return get_lcd_pixel_frequency(0); } uint32_t get_memory_frequency(); uint32_t get_pclock_frequency(); diff -r f54524d64fba -r 4fe040c124ea pkg/devices/lib/cpm/include/cpm.h --- a/pkg/devices/lib/cpm/include/cpm.h Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/lib/cpm/include/cpm.h Tue Jun 16 23:24:32 2020 +0200 @@ -1,7 +1,7 @@ /* * Clock and power management (CPM) abstractions. * - * Copyright (C) 2017, 2018 Paul Boddie + * Copyright (C) 2017, 2018, 2020 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -33,6 +33,13 @@ class Cpm_chip { public: + virtual uint32_t get_lcd_pixel_frequency() = 0; + + virtual void set_hdmi_frequency(uint32_t) { } + + virtual void start_hdmi() { } + virtual void stop_hdmi() { } + virtual void set_lcd_frequencies(uint32_t pclk, uint8_t ratio) = 0; virtual void start_lcd() = 0; diff -r f54524d64fba -r 4fe040c124ea pkg/devices/lib/panel/src/Makefile --- a/pkg/devices/lib/panel/src/Makefile Sat Jun 13 21:07:58 2020 +0200 +++ b/pkg/devices/lib/panel/src/Makefile Tue Jun 16 23:24:32 2020 +0200 @@ -1,6 +1,6 @@ PKGDIR ?= ../../.. L4DIR ?= $(PKGDIR)/../.. -TARGET := letux400 loader qi_lb60 +TARGET := ci20 letux400 loader qi_lb60 include $(L4DIR)/mk/subdir.mk diff -r f54524d64fba -r 4fe040c124ea pkg/devices/lib/panel/src/ci20/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/panel/src/ci20/Makefile Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,13 @@ +PKGDIR ?= ../../../.. +L4DIR ?= $(PKGDIR)/../.. + +TARGET = libpanel_ci20.so +PC_FILENAME := libdrivers-panel-ci20 + +SRC_C := panel-ci20.c + +PRIVATE_INCDIR += $(PKGDIR)/lib/panel/include + +REQUIRES_LIBS := libdrivers-lcd-headers + +include $(L4DIR)/mk/lib.mk diff -r f54524d64fba -r 4fe040c124ea pkg/devices/lib/panel/src/ci20/panel-ci20.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/panel/src/ci20/panel-ci20.c Tue Jun 16 23:24:32 2020 +0200 @@ -0,0 +1,61 @@ +/* + * Export a panel structure for the MIPS Creator CI20. + * + * Copyright (C) 2018, 2020 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#include +#include + +static struct Jz4740_lcd_panel panel = { + .config = ( + Jz4740_lcd_mode_tft_generic + | Jz4740_lcd_bpp_24 + | Jz4740_lcd_desc_8_word + | Jz4740_lcd_underrun_recover + | Jz4740_lcd_ps_disabled + | Jz4740_lcd_cls_disabled + | Jz4740_lcd_spl_disabled + | Jz4740_lcd_rev_disabled + | Jz4740_lcd_pclock_negative + | Jz4740_lcd_hsync_positive + | Jz4740_lcd_vsync_positive + | Jz4740_lcd_de_positive), + + // NOTE: To be configured using the HDMI DDC mechanism. + + .width = 1280, + .height = 1024, + .bpp = 24, + .frame_rate = 60, + .hsync = 112, + .vsync = 3, + .line_start = 248, // back porch (blanking - hsync - offset) + .line_end = 48, // front porch (sync offset) + .frame_start = 36, // back porch (blanking - vsync - offset) + .frame_end = 3, // front porch (sync offset) +}; + +/* Employ an opaque pointer type. */ + +void *panel_get(void); + +void *panel_get(void) +{ + return &panel; +}