mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 00:24:51 +00:00
sculpt: host soc touch and fb drivers in runtime
This patch moves SoC-specific framebuffer and touchscreen drivers (PinePhone) to the runtime subsystem. They are enabled for the phone_manager. Issue #5150
This commit is contained in:
parent
85e020b8e1
commit
d13b8e1937
@ -151,14 +151,15 @@ proc log_route { } {
|
||||
|
||||
|
||||
##
|
||||
# ROM routes that relabel generic NIC driver names to platform-specific binaries
|
||||
# ROM routes that relabel generic driver names to platform-specific binaries
|
||||
#
|
||||
proc nic_driver_routes { } {
|
||||
proc driver_routes { } {
|
||||
|
||||
set result(pc) {
|
||||
<service name="ROM" label="nic_drv"> <parent label="pc_nic_drv"/> </service>
|
||||
<service name="ROM" label="wifi.lib.so"> <parent label="pc_wifi.lib.so"/> </service>
|
||||
<service name="ROM" label="wifi_firmware.tar"> <parent label="pc_wifi_firmware.tar"/> </service>
|
||||
<service name="ROM" label="usb_drv"> <parent label="pc_usb_host_drv"/> </service>
|
||||
}
|
||||
|
||||
set result(mnt_reform2) {
|
||||
@ -177,27 +178,13 @@ proc nic_driver_routes { } {
|
||||
<service name="ROM" label="wifi.lib.so"> <parent label="a64_wifi.lib.so"/> </service>
|
||||
<service name="ROM" label="wifi_drv.dtb"> <parent label="wifi-pinephone.dtb"/> </service>
|
||||
<service name="ROM" label="wifi_firmware.tar"> <parent label="a64_wifi_firmware.tar"/> </service>
|
||||
}
|
||||
|
||||
if {[info exists result([board])]} {
|
||||
return $result([board]); }
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# ROM routes that relabel generic USB driver names to board-specific binaries
|
||||
#
|
||||
proc usb_driver_routes { } {
|
||||
|
||||
set result(pc) {
|
||||
<service name="ROM" label="usb_drv"> <parent label="pc_usb_host_drv"/> </service>
|
||||
}
|
||||
|
||||
set result(pinephone) {
|
||||
<service name="ROM" label="usb_drv"> <parent label="a64_usb_host_drv"/> </service>
|
||||
<service name="ROM" label="usb_drv.dtb"> <parent label="usb-pinephone.dtb"/> </service>
|
||||
<service name="ROM" label="usb_drv"> <parent label="a64_usb_host_drv"/> </service>
|
||||
<service name="ROM" label="usb_drv.dtb"> <parent label="usb-pinephone.dtb"/> </service>
|
||||
<service name="ROM" label="fb_drv"> <parent label="de_fb_drv"/> </service>
|
||||
<service name="ROM" label="fb_drv.dtb"> <parent label="de-pinephone.dtb"/> </service>
|
||||
<service name="ROM" label="touch_drv"> <parent label="goodix_touch_drv"/> </service>
|
||||
<service name="ROM" label="touch_drv.dtb"> <parent label="goodix-pinephone.dtb"/> </service>
|
||||
<service name="IRQ" label_prefix="touch ->"> <child name="drivers" label="runtime -> touch -> PH4"/> </service>
|
||||
}
|
||||
|
||||
if {[info exists result([board])]} {
|
||||
@ -454,6 +441,7 @@ install_config {
|
||||
<service name="Gpu"/>
|
||||
<service name="Pin_state"/>
|
||||
<service name="Pin_control"/>
|
||||
<service name="IRQ"/>
|
||||
</provides>
|
||||
</start>
|
||||
|
||||
@ -711,7 +699,7 @@ install_config {
|
||||
<child name="leitzentrale" label="fonts"/> </service>
|
||||
<service name="Report"> <child name="fs_report"/> </service>
|
||||
<service name="LOG" label="unlogged"> <parent/> </service>
|
||||
} [log_route] [nic_driver_routes] [usb_driver_routes] {
|
||||
} [log_route] [driver_routes] {
|
||||
<service name="Event" label="leitzentrale"> <child name="leitzentrale"/> </service>
|
||||
<service name="Event"> <child name="event_filter"/> </service>
|
||||
<service name="Capture" label="global"> <child name="nitpicker"/> </service>
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <model/screensaver.h>
|
||||
#include <managed_config.h>
|
||||
#include <fb_driver.h>
|
||||
#include <touch_driver.h>
|
||||
#include <usb_driver.h>
|
||||
#include <gui.h>
|
||||
#include <storage.h>
|
||||
@ -139,8 +140,6 @@ struct Sculpt::Main : Input_event_handler,
|
||||
|
||||
unsigned brightness;
|
||||
|
||||
bool display;
|
||||
|
||||
static System from_xml(Xml_node const &node)
|
||||
{
|
||||
return System {
|
||||
@ -148,11 +147,10 @@ struct Sculpt::Main : Input_event_handler,
|
||||
.state = node.attribute_value("state", State()),
|
||||
.power_profile = node.attribute_value("power_profile", Power_profile()),
|
||||
.brightness = node.attribute_value("brightness", 0u),
|
||||
.display = node.attribute_value("display", true)
|
||||
};
|
||||
}
|
||||
|
||||
void generate(Xml_generator &xml) const
|
||||
void generate(Xml_generator &xml, Screensaver const &screensaver) const
|
||||
{
|
||||
if (storage) xml.attribute("storage", "yes");
|
||||
|
||||
@ -160,14 +158,13 @@ struct Sculpt::Main : Input_event_handler,
|
||||
xml.attribute("state", state);
|
||||
|
||||
if (power_profile.length() > 1) {
|
||||
if (power_profile == "performance" && !display)
|
||||
if (power_profile == "performance" && !screensaver.display_enabled())
|
||||
xml.attribute("power_profile", "economic");
|
||||
else
|
||||
xml.attribute("power_profile", power_profile);
|
||||
}
|
||||
|
||||
xml.attribute("brightness", brightness);
|
||||
xml.attribute("display", display ? "yes" : "no");
|
||||
}
|
||||
|
||||
bool operator != (System const &other) const
|
||||
@ -175,8 +172,7 @@ struct Sculpt::Main : Input_event_handler,
|
||||
return (other.storage != storage)
|
||||
|| (other.state != state)
|
||||
|| (other.power_profile != power_profile)
|
||||
|| (other.brightness != brightness)
|
||||
|| (other.display != display);
|
||||
|| (other.brightness != brightness);
|
||||
}
|
||||
|
||||
} _system { };
|
||||
@ -184,8 +180,7 @@ struct Sculpt::Main : Input_event_handler,
|
||||
void _update_managed_system_config()
|
||||
{
|
||||
_system_config.generate([&] (Xml_generator &xml) {
|
||||
_system.generate(xml); });
|
||||
}
|
||||
_system.generate(xml, _screensaver); }); }
|
||||
|
||||
void _handle_system_config(Xml_node node)
|
||||
{
|
||||
@ -212,9 +207,12 @@ struct Sculpt::Main : Input_event_handler,
|
||||
if (_devices.xml().num_sub_nodes() == 0)
|
||||
_board_info.wifi_present = true;
|
||||
|
||||
_board_info.usb_present = true;
|
||||
_board_info.usb_present = true;
|
||||
_board_info.soc_fb_present = true;
|
||||
_board_info.soc_touch_present = true;
|
||||
|
||||
_fb_driver.update(_child_states, _board_info, _platform.xml());
|
||||
_touch_driver.update(_child_states, _board_info);
|
||||
_update_usb_drivers();
|
||||
|
||||
update_network_dialog();
|
||||
@ -239,7 +237,8 @@ struct Sculpt::Main : Input_event_handler,
|
||||
_update_managed_system_config();
|
||||
}
|
||||
|
||||
Fb_driver _fb_driver { };
|
||||
Fb_driver _fb_driver { };
|
||||
Touch_driver _touch_driver { };
|
||||
|
||||
Signal_handler<Main> _gui_mode_handler {
|
||||
_env.ep(), *this, &Main::_handle_gui_mode };
|
||||
@ -279,8 +278,8 @@ struct Sculpt::Main : Input_event_handler,
|
||||
*/
|
||||
void screensaver_changed() override
|
||||
{
|
||||
_system.display = _screensaver.display_enabled();
|
||||
_update_managed_system_config();
|
||||
generate_runtime_config();
|
||||
}
|
||||
|
||||
Attached_rom_dataspace _leitzentrale_rom { _env, "leitzentrale" };
|
||||
@ -2459,7 +2458,10 @@ void Sculpt::Main::_generate_runtime_config(Xml_generator &xml) const
|
||||
xml.attribute("height", _affinity_space.height());
|
||||
});
|
||||
|
||||
_fb_driver.gen_start_nodes(xml);
|
||||
if (_screensaver.display_enabled()) {
|
||||
_fb_driver .gen_start_nodes(xml);
|
||||
_touch_driver.gen_start_node (xml);
|
||||
}
|
||||
|
||||
if (_network._nic_target.type() == Nic_target::Type::MODEM)
|
||||
_usb_driver.gen_start_nodes(xml);
|
||||
|
@ -27,7 +27,8 @@ struct Sculpt::Fb_driver : private Noncopyable
|
||||
Constructible<Child_state> _intel_gpu { },
|
||||
_intel_fb { },
|
||||
_vesa_fb { },
|
||||
_boot_fb { };
|
||||
_boot_fb { },
|
||||
_soc_fb { };
|
||||
|
||||
void gen_start_nodes(Xml_generator &xml) const
|
||||
{
|
||||
@ -101,6 +102,18 @@ struct Sculpt::Fb_driver : private Noncopyable
|
||||
gen_common_routes(xml);
|
||||
});
|
||||
});
|
||||
|
||||
start_node(_soc_fb, "fb_drv", [&] {
|
||||
xml.node("route", [&] {
|
||||
gen_parent_route<Platform::Session> (xml);
|
||||
gen_parent_route<Pin_control::Session>(xml);
|
||||
gen_capture_route(xml);
|
||||
gen_parent_rom_route(xml, "config", "config -> fb_drv");
|
||||
gen_parent_rom_route(xml, "dtb", "fb_drv.dtb");
|
||||
gen_parent_route<Rm_session>(xml);
|
||||
gen_common_routes(xml);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
void update(Registry<Child_state> ®istry, Board_info const &board_info,
|
||||
@ -118,6 +131,10 @@ struct Sculpt::Fb_driver : private Noncopyable
|
||||
registry, "vesa_fb", Priority::MULTIMEDIA,
|
||||
Ram_quota { 8*1024*1024 }, Cap_quota { 110 });
|
||||
|
||||
_soc_fb.conditional(board_info.soc_fb_present,
|
||||
registry, "fb", Priority::MULTIMEDIA,
|
||||
Ram_quota { 16*1024*1024 }, Cap_quota { 250 });
|
||||
|
||||
if (board_info.boot_fb_present && !_boot_fb.constructed())
|
||||
Boot_fb::with_mode(platform, [&] (Boot_fb::Mode mode) {
|
||||
_boot_fb.construct(registry, "boot_fb", Priority::MULTIMEDIA,
|
||||
|
@ -26,10 +26,12 @@ struct Sculpt::Board_info
|
||||
intel_gfx_present,
|
||||
boot_fb_present,
|
||||
vesa_fb_present,
|
||||
soc_fb_present,
|
||||
nvme_present,
|
||||
ahci_present,
|
||||
usb_present,
|
||||
ps2_present;
|
||||
ps2_present,
|
||||
soc_touch_present;
|
||||
|
||||
static Board_info from_xml(Xml_node const &devices, Xml_node const &platform)
|
||||
{
|
||||
|
63
repos/gems/src/app/sculpt_manager/touch_driver.h
Normal file
63
repos/gems/src/app/sculpt_manager/touch_driver.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* \brief Sculpt touchscreen-driver management
|
||||
* \author Norman Feske
|
||||
* \date 2024-03-25
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2024 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _TOUCH_DRIVER_H_
|
||||
#define _TOUCH_DRIVER_H_
|
||||
|
||||
/* local includes */
|
||||
#include <model/child_exit_state.h>
|
||||
#include <model/board_info.h>
|
||||
#include <runtime.h>
|
||||
|
||||
namespace Sculpt { struct Touch_driver; }
|
||||
|
||||
|
||||
struct Sculpt::Touch_driver : private Noncopyable
|
||||
{
|
||||
Constructible<Child_state> _soc { };
|
||||
|
||||
void gen_start_node(Xml_generator &xml) const
|
||||
{
|
||||
if (!_soc.constructed())
|
||||
return;
|
||||
|
||||
xml.node("start", [&] {
|
||||
_soc->gen_start_node_content(xml);
|
||||
gen_named_node(xml, "binary", "touch_drv");
|
||||
xml.node("config", [&] { });
|
||||
xml.node("route", [&] {
|
||||
gen_parent_rom_route(xml, "dtb", "touch_drv.dtb");
|
||||
gen_parent_route<Platform::Session> (xml);
|
||||
gen_parent_route<Pin_control::Session>(xml);
|
||||
gen_parent_route<Irq_session> (xml);
|
||||
gen_parent_route<Rom_session> (xml);
|
||||
gen_parent_route<Cpu_session> (xml);
|
||||
gen_parent_route<Pd_session> (xml);
|
||||
gen_parent_route<Log_session> (xml);
|
||||
gen_parent_route<Timer::Session> (xml);
|
||||
gen_service_node<Event::Session>(xml, [&] {
|
||||
xml.node("parent", [&] {
|
||||
xml.attribute("label", "touch"); }); });
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
void update(Registry<Child_state> ®istry, Board_info const &board_info)
|
||||
{
|
||||
_soc.conditional(board_info.soc_touch_present,
|
||||
registry, "touch", Priority::MULTIMEDIA,
|
||||
Ram_quota { 10*1024*1024 }, Cap_quota { 250 });
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _TOUCH_DRIVER_H_ */
|
Loading…
x
Reference in New Issue
Block a user