1.1 --- a/conf/landfall-examples/mips-qi_lb60-fbdrv.cfg Fri May 25 22:13:55 2018 +0200 1.2 +++ b/conf/landfall-examples/mips-qi_lb60-fbdrv.cfg Fri May 25 22:14:36 2018 +0200 1.3 @@ -49,7 +49,7 @@ 1.4 backlight = backlight:svr(), 1.5 }, 1.6 }, 1.7 - "rom/dev_backlight_spi_qi_lb60"); 1.8 + "rom/dev_backlight_spi_ili8960"); 1.9 1.10 -- Expose a display device for the Ben. 1.11
2.1 --- a/conf/landfall-examples/mips-qi_lb60-fbdrv.list Fri May 25 22:13:55 2018 +0200 2.2 +++ b/conf/landfall-examples/mips-qi_lb60-fbdrv.list Fri May 25 22:14:36 2018 +0200 2.3 @@ -13,7 +13,7 @@ 2.4 module ned 2.5 module fb-drv 2.6 module dev_spi_jz4740 2.7 -module dev_backlight_spi_qi_lb60 2.8 +module dev_backlight_spi_ili8960 2.9 module dev_display_qi_lb60 2.10 module dev_panel_qi_lb60 2.11 module dev_cpm_jz4740
3.1 --- a/conf/landfall-examples/mips-qi_lb60-fbterminal.cfg Fri May 25 22:13:55 2018 +0200 3.2 +++ b/conf/landfall-examples/mips-qi_lb60-fbterminal.cfg Fri May 25 22:14:36 2018 +0200 3.3 @@ -50,7 +50,7 @@ 3.4 backlight = backlight:svr(), 3.5 }, 3.6 }, 3.7 - "rom/dev_backlight_spi_qi_lb60"); 3.8 + "rom/dev_backlight_spi_ili8960"); 3.9 3.10 -- Expose a display device for the Ben. 3.11 3.12 @@ -116,6 +116,7 @@ 3.13 fb = fbdrv_fb, 3.14 mag = mag_caps.mag:svr(), 3.15 svc = mag_caps.svc:svr(), 3.16 + ev = ev, 3.17 }, 3.18 }, 3.19 "rom/mag");
4.1 --- a/conf/landfall-examples/mips-qi_lb60-fbterminal.list Fri May 25 22:13:55 2018 +0200 4.2 +++ b/conf/landfall-examples/mips-qi_lb60-fbterminal.list Fri May 25 22:14:36 2018 +0200 4.3 @@ -14,7 +14,7 @@ 4.4 module fb-drv 4.5 module mag 4.6 module dev_spi_jz4740 4.7 -module dev_backlight_spi_qi_lb60 4.8 +module dev_backlight_spi_ili8960 4.9 module dev_display_qi_lb60 4.10 module dev_panel_qi_lb60 4.11 module dev_cpm_jz4740
5.1 --- a/conf/landfall-examples/mips-qi_lb60-input-event-client.cfg Fri May 25 22:13:55 2018 +0200 5.2 +++ b/conf/landfall-examples/mips-qi_lb60-input-event-client.cfg Fri May 25 22:14:36 2018 +0200 5.3 @@ -50,7 +50,7 @@ 5.4 backlight = backlight:svr(), 5.5 }, 5.6 }, 5.7 - "rom/dev_backlight_spi_qi_lb60"); 5.8 + "rom/dev_backlight_spi_ili8960"); 5.9 5.10 -- Expose a display device for the Ben. 5.11
6.1 --- a/conf/landfall-examples/mips-qi_lb60-input-event-client.list Fri May 25 22:13:55 2018 +0200 6.2 +++ b/conf/landfall-examples/mips-qi_lb60-input-event-client.list Fri May 25 22:14:36 2018 +0200 6.3 @@ -14,7 +14,7 @@ 6.4 module fb-drv 6.5 module mag 6.6 module dev_spi_jz4740 6.7 -module dev_backlight_spi_qi_lb60 6.8 +module dev_backlight_spi_ili8960 6.9 module dev_display_qi_lb60 6.10 module dev_panel_qi_lb60 6.11 module dev_cpm_jz4740
7.1 --- a/conf/landfall-examples/mips-qi_lb60-keypad-demo.cfg Fri May 25 22:13:55 2018 +0200 7.2 +++ b/conf/landfall-examples/mips-qi_lb60-keypad-demo.cfg Fri May 25 22:14:36 2018 +0200 7.3 @@ -50,7 +50,7 @@ 7.4 backlight = backlight:svr(), 7.5 }, 7.6 }, 7.7 - "rom/dev_backlight_spi_qi_lb60"); 7.8 + "rom/dev_backlight_spi_ili8960"); 7.9 7.10 -- Expose a display device for the Ben. 7.11
8.1 --- a/conf/landfall-examples/mips-qi_lb60-keypad-demo.list Fri May 25 22:13:55 2018 +0200 8.2 +++ b/conf/landfall-examples/mips-qi_lb60-keypad-demo.list Fri May 25 22:14:36 2018 +0200 8.3 @@ -14,7 +14,7 @@ 8.4 module fb-drv 8.5 module mag 8.6 module dev_spi_jz4740 8.7 -module dev_backlight_spi_qi_lb60 8.8 +module dev_backlight_spi_ili8960 8.9 module dev_display_qi_lb60 8.10 module dev_panel_qi_lb60 8.11 module dev_cpm_jz4740
9.1 --- a/conf/landfall-examples/mips-qi_lb60-keypad-ds.cfg Fri May 25 22:13:55 2018 +0200 9.2 +++ b/conf/landfall-examples/mips-qi_lb60-keypad-ds.cfg Fri May 25 22:14:36 2018 +0200 9.3 @@ -51,7 +51,7 @@ 9.4 backlight = backlight:svr(), 9.5 }, 9.6 }, 9.7 - "rom/dev_backlight_spi_qi_lb60"); 9.8 + "rom/dev_backlight_spi_ili8960"); 9.9 9.10 -- Expose a display device for the Ben. 9.11
10.1 --- a/conf/landfall-examples/mips-qi_lb60-keypad-ds.list Fri May 25 22:13:55 2018 +0200 10.2 +++ b/conf/landfall-examples/mips-qi_lb60-keypad-ds.list Fri May 25 22:14:36 2018 +0200 10.3 @@ -14,7 +14,7 @@ 10.4 module fb-drv 10.5 module mag 10.6 module dev_spi_jz4740 10.7 -module dev_backlight_spi_qi_lb60 10.8 +module dev_backlight_spi_ili8960 10.9 module dev_display_qi_lb60 10.10 module dev_panel_qi_lb60 10.11 module dev_cpm_jz4740
11.1 --- a/conf/landfall-examples/mips-qi_lb60-keypad.cfg Fri May 25 22:13:55 2018 +0200 11.2 +++ b/conf/landfall-examples/mips-qi_lb60-keypad.cfg Fri May 25 22:14:36 2018 +0200 11.3 @@ -50,7 +50,7 @@ 11.4 backlight = backlight:svr(), 11.5 }, 11.6 }, 11.7 - "rom/dev_backlight_spi_qi_lb60"); 11.8 + "rom/dev_backlight_spi_ili8960"); 11.9 11.10 -- Expose a display device for the Ben. 11.11
12.1 --- a/conf/landfall-examples/mips-qi_lb60-keypad.list Fri May 25 22:13:55 2018 +0200 12.2 +++ b/conf/landfall-examples/mips-qi_lb60-keypad.list Fri May 25 22:14:36 2018 +0200 12.3 @@ -14,7 +14,7 @@ 12.4 module fb-drv 12.5 module mag 12.6 module dev_spi_jz4740 12.7 -module dev_backlight_spi_qi_lb60 12.8 +module dev_backlight_spi_ili8960 12.9 module dev_display_qi_lb60 12.10 module dev_panel_qi_lb60 12.11 module dev_cpm_jz4740
13.1 --- a/conf/landfall-examples/mips-qi_lb60-lcd-driver.cfg Fri May 25 22:13:55 2018 +0200 13.2 +++ b/conf/landfall-examples/mips-qi_lb60-lcd-driver.cfg Fri May 25 22:14:36 2018 +0200 13.3 @@ -48,7 +48,7 @@ 13.4 backlight = backlight:svr(), 13.5 }, 13.6 }, 13.7 - "rom/dev_backlight_spi_qi_lb60"); 13.8 + "rom/dev_backlight_spi_ili8960"); 13.9 13.10 -- Expose a display device for the Ben. 13.11
14.1 --- a/conf/landfall-examples/mips-qi_lb60-lcd-driver.list Fri May 25 22:13:55 2018 +0200 14.2 +++ b/conf/landfall-examples/mips-qi_lb60-lcd-driver.list Fri May 25 22:14:36 2018 +0200 14.3 @@ -12,7 +12,7 @@ 14.4 module io 14.5 module ned 14.6 module dev_spi_jz4740 14.7 -module dev_backlight_spi_qi_lb60 14.8 +module dev_backlight_spi_ili8960 14.9 module dev_display_qi_lb60 14.10 module dev_panel_qi_lb60 14.11 module dev_cpm_jz4740
15.1 --- a/conf/landfall-examples/mips-qi_lb60-spectrum.cfg Fri May 25 22:13:55 2018 +0200 15.2 +++ b/conf/landfall-examples/mips-qi_lb60-spectrum.cfg Fri May 25 22:14:36 2018 +0200 15.3 @@ -50,7 +50,7 @@ 15.4 backlight = backlight:svr(), 15.5 }, 15.6 }, 15.7 - "rom/dev_backlight_spi_qi_lb60"); 15.8 + "rom/dev_backlight_spi_ili8960"); 15.9 15.10 -- Expose a display device for the Ben. 15.11
16.1 --- a/conf/landfall-examples/mips-qi_lb60-spectrum.list Fri May 25 22:13:55 2018 +0200 16.2 +++ b/conf/landfall-examples/mips-qi_lb60-spectrum.list Fri May 25 22:14:36 2018 +0200 16.3 @@ -14,7 +14,7 @@ 16.4 module fb-drv 16.5 module mag 16.6 module dev_spi_jz4740 16.7 -module dev_backlight_spi_qi_lb60 16.8 +module dev_backlight_spi_ili8960 16.9 module dev_display_qi_lb60 16.10 module dev_panel_qi_lb60 16.11 module dev_cpm_jz4740
17.1 --- a/pkg/devices/Control Fri May 25 22:13:55 2018 +0200 17.2 +++ b/pkg/devices/Control Fri May 25 22:14:36 2018 +0200 17.3 @@ -1,25 +1,52 @@ 17.4 -provides: libdrivers-common libdrivers-cpm libdrivers-gpio libdrivers-i2c libdrivers-pwm 17.5 -provides: libdrivers-keypad libdrivers-keypad-letux400 libdrivers-keypad-qi_lb60 17.6 -provides: libdrivers-lcd-jz4740 17.7 -provides: devices-backlight-pwm libdevice-backlight-client 17.8 -provides: devices-cpm-jz4730 devices-cpm-jz4740 devices-cpm-jz4780 17.9 -provides: libdevice-cpm-client libdevice-cpm-ops 17.10 -provides: libdevice-cpm-server 17.11 -provides: devices-display-letux400 devices-display-qi_lb60 17.12 -provides: libdevice-display-client libdevice-display-ops 17.13 +provides: devices-backlight-pwm 17.14 +provides: devices-backlight-spi-ili8960 17.15 +provides: devices-cpm-jz4730 17.16 +provides: devices-cpm-jz4740 17.17 +provides: devices-cpm-jz4780 17.18 +provides: devices-display-letux400 17.19 +provides: devices-display-qi_lb60 17.20 provides: devices-fb-jz4740 17.21 -provides: libdevice-fb-client libdevice-fb-ops 17.22 -provides: libdevice-fb-lcd libdevice-fb-server 17.23 +provides: devices-input-keypad-letux400 17.24 +provides: devices-input-keypad-qi_lb60 17.25 +provides: devices-keypad-letux400 17.26 +provides: devices-keypad-qi_lb60 17.27 +provides: devices-panel-letux400 17.28 +provides: devices-panel-qi_lb60 17.29 +provides: devices-pwm-jz4730 17.30 +provides: devices-spi-jz4740 17.31 +provides: libdevice-backlight-client 17.32 +provides: libdevice-cpm-client 17.33 +provides: libdevice-cpm-server 17.34 +provides: libdevice-display-client 17.35 +provides: libdevice-display-ops 17.36 +provides: libdevice-fb-client 17.37 +provides: libdevice-fb-lcd 17.38 +provides: libdevice-fb-ops 17.39 +provides: libdevice-fb-server 17.40 +provides: libdevice-input-event-client 17.41 +provides: libdevice-input-event-ops 17.42 provides: libdevice-input-keypad 17.43 -provides: libdevice-input-event-client libdevice-input-event-ops 17.44 -provides: devices-keypad-letux400 devices-keypad-qi_lb60 17.45 -provides: libdevice-keypad-client libdevice-keypad-ops 17.46 +provides: libdevice-input-keypad-server 17.47 +provides: libdevice-keypad-client 17.48 +provides: libdevice-keypad-ops 17.49 provides: libdevice-keypad-server 17.50 -provides: libdevice-lcd libdevice-lcd-jz4740 17.51 -provides: devices-panel-letux400 devices-panel-qi_lb60 17.52 -provides: libdevice-panel-client libdevice-panel-ops 17.53 -provides: devices-pwm-jz4730 libdevice-pwm-client 17.54 -provides: devices-spi-jz4740 libdevice-spi-client 17.55 +provides: libdevice-lcd 17.56 +provides: libdevice-lcd-jz4740 17.57 +provides: libdevice-panel-client 17.58 +provides: libdevice-panel-ops 17.59 +provides: libdevice-panel-server 17.60 +provides: libdevice-pwm-client 17.61 +provides: libdevice-spi-client 17.62 provides: libdevice-util 17.63 +provides: libdrivers-common 17.64 +provides: libdrivers-cpm 17.65 +provides: libdrivers-gpio 17.66 +provides: libdrivers-i2c 17.67 +provides: libdrivers-keypad 17.68 +provides: libdrivers-keypad-letux400 17.69 +provides: libdrivers-keypad-qi_lb60 17.70 +provides: libdrivers-lcd-headers 17.71 +provides: libdrivers-lcd-jz4740 17.72 +provides: libdrivers-pwm 17.73 requires: libc l4re_c libio 17.74 Maintainer: paul@boddie.org.uk
18.1 --- a/pkg/devices/backlight/src/Makefile Fri May 25 22:13:55 2018 +0200 18.2 +++ b/pkg/devices/backlight/src/Makefile Fri May 25 22:14:36 2018 +0200 18.3 @@ -1,6 +1,6 @@ 18.4 PKGDIR ?= ../.. 18.5 L4DIR ?= $(PKGDIR)/../.. 18.6 18.7 -TARGET := client pwm spi-qi_lb60 18.8 +TARGET := client pwm spi-ili8960 18.9 18.10 include $(L4DIR)/mk/subdir.mk
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/pkg/devices/backlight/src/spi-ili8960/Makefile Fri May 25 22:14:36 2018 +0200 19.3 @@ -0,0 +1,13 @@ 19.4 +PKGDIR ?= ../../.. 19.5 +L4DIR ?= $(PKGDIR)/../.. 19.6 + 19.7 +TARGET = dev_backlight_spi_ili8960 19.8 +PC_FILENAME := devices-backlight-spi-ili8960 19.9 + 19.10 +SRC_CC := backlight-spi-ili8960.cc 19.11 + 19.12 +PRIVATE_INCDIR += $(PKGDIR)/backlight/include 19.13 + 19.14 +REQUIRES_LIBS := l4re_c l4re_c-util libdevice-spi-client 19.15 + 19.16 +include $(L4DIR)/mk/prog.mk
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc Fri May 25 22:14:36 2018 +0200 20.3 @@ -0,0 +1,133 @@ 20.4 +/* 20.5 + * Access a SPI server to update a display panel backlight. 20.6 + * 20.7 + * This server is specific to the Ilitek ili8960 backlight controller, although 20.8 + * the Giantplus GPM940B0 panel datasheet also describes this controller 20.9 + * interface. 20.10 + * 20.11 + * (c) 2018 Paul Boddie <paul@boddie.org.uk> 20.12 + * 20.13 + * This program is free software; you can redistribute it and/or 20.14 + * modify it under the terms of the GNU General Public License as 20.15 + * published by the Free Software Foundation; either version 2 of 20.16 + * the License, or (at your option) any later version. 20.17 + * 20.18 + * This program is distributed in the hope that it will be useful, 20.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 20.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20.21 + * GNU General Public License for more details. 20.22 + * 20.23 + * You should have received a copy of the GNU General Public License 20.24 + * along with this program; if not, write to the Free Software 20.25 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, 20.26 + * Boston, MA 02110-1301, USA 20.27 + */ 20.28 + 20.29 +#include <l4/cxx/ipc_server> 20.30 +#include <l4/re/env> 20.31 +#include <l4/re/util/object_registry> 20.32 +#include <l4/sys/capability> 20.33 + 20.34 +#include <stdlib.h> 20.35 + 20.36 +#include <l4/devices/spi-client.h> 20.37 +#include "backlight-ops.h" 20.38 + 20.39 +/* SPI access abstractions. */ 20.40 + 20.41 +static L4::Cap<Spi_device_interface> spi_device; 20.42 + 20.43 + 20.44 + 20.45 +/* Backlight device. */ 20.46 + 20.47 +class Backlight_device_server : public L4::Server_object_t<L4::Kobject> 20.48 +{ 20.49 + int _min = 55, _max = 90, _start = 70; 20.50 + 20.51 + void set_duty(int level) 20.52 + { 20.53 + level = level < _min ? _min : (level > _max ? _max : level); 20.54 + 20.55 + /* PWM_DUTY = R05h<5:3> = 5% increments from min to max */ 20.56 + 20.57 + int duty = ((level - _min) / 5) << 3; 20.58 + 20.59 + spi_device->send(16, 0x0516 | duty); /* R05h: GRB=0 (reset); PWM_DUTY=duty; SHDB2=1, SHDB1=1 (power-related); STB=0 (standby) */ 20.60 + spi_device->send(16, 0x0546 | duty); /* R05h: GRB=1 (normal operation); ... */ 20.61 + spi_device->send(16, 0x078d); /* R07h: HBLK=141 (horizontal blanking period from start of hsync pulse to data start) */ 20.62 + spi_device->send(16, 0x1301); /* R13h: IN_SEL=1 (alignment mode) */ 20.63 + spi_device->send(16, 0x0547 | duty); /* R05h: ...; STB=1 (not standby) */ 20.64 + } 20.65 + 20.66 +public: 20.67 + /* Dispatch incoming requests. */ 20.68 + 20.69 + int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) 20.70 + { 20.71 + l4_msgtag_t tag; 20.72 + int arg; 20.73 + 20.74 + (void) obj; 20.75 + ios >> tag; 20.76 + 20.77 + switch (tag.label()) 20.78 + { 20.79 + case Backlight_op_disable: 20.80 + disable(); 20.81 + return L4_EOK; 20.82 + 20.83 + case Backlight_op_enable: 20.84 + enable(); 20.85 + return L4_EOK; 20.86 + 20.87 + case Backlight_op_set_brightness: 20.88 + ios >> arg; 20.89 + set_brightness(arg); 20.90 + return L4_EOK; 20.91 + 20.92 + default: 20.93 + return -L4_EBADPROTO; 20.94 + } 20.95 + } 20.96 + 20.97 + void disable() 20.98 + { 20.99 + spi_device->send(16, 0x0546); /* R05h: GRB=1 (normal operation); SHDB2=1, SHDB1=1 (power-related); STB=0 (standby) */ 20.100 + } 20.101 + 20.102 + void enable() 20.103 + { 20.104 + set_duty(_start); 20.105 + } 20.106 + 20.107 + /* Use the SPI device to update the brightness level. */ 20.108 + 20.109 + void set_brightness(int level) 20.110 + { 20.111 + level = level < _min ? _min : (level > _max ? _max : level); 20.112 + spi_device->send(16, 0x0300 | level); /* R03h: brightness */ 20.113 + } 20.114 +}; 20.115 + 20.116 +static L4Re::Util::Registry_server<> server; 20.117 + 20.118 + 20.119 + 20.120 +int main(void) 20.121 +{ 20.122 + /* Obtain a reference to the SPI device. */ 20.123 + 20.124 + spi_device = L4Re::Env::env()->get_cap<Spi_device_interface>("spi"); 20.125 + if (!spi_device.is_valid()) return 1; 20.126 + 20.127 + /* Initialise and register a new server object. */ 20.128 + 20.129 + Backlight_device_server server_obj; 20.130 + server.registry()->register_obj(&server_obj, "backlight"); 20.131 + 20.132 + /* Enter the IPC server loop. */ 20.133 + 20.134 + server.loop(); 20.135 + return 0; 20.136 +}
21.1 --- a/pkg/devices/backlight/src/spi-qi_lb60/Makefile Fri May 25 22:13:55 2018 +0200 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,13 +0,0 @@ 21.4 -PKGDIR ?= ../../.. 21.5 -L4DIR ?= $(PKGDIR)/../.. 21.6 - 21.7 -TARGET = dev_backlight_spi_qi_lb60 21.8 -PC_FILENAME := devices-backlight-spi-qi_lb60 21.9 - 21.10 -SRC_CC := backlight-spi-qi_lb60.cc 21.11 - 21.12 -PRIVATE_INCDIR += $(PKGDIR)/backlight/include 21.13 - 21.14 -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-spi-client 21.15 - 21.16 -include $(L4DIR)/mk/prog.mk
22.1 --- a/pkg/devices/backlight/src/spi-qi_lb60/backlight-spi-qi_lb60.cc Fri May 25 22:13:55 2018 +0200 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,130 +0,0 @@ 22.4 -/* 22.5 - * Access a SPI server to update a display panel backlight. 22.6 - * This server is specific to the Ben NanoNote. 22.7 - * 22.8 - * (c) 2018 Paul Boddie <paul@boddie.org.uk> 22.9 - * 22.10 - * This program is free software; you can redistribute it and/or 22.11 - * modify it under the terms of the GNU General Public License as 22.12 - * published by the Free Software Foundation; either version 2 of 22.13 - * the License, or (at your option) any later version. 22.14 - * 22.15 - * This program is distributed in the hope that it will be useful, 22.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 22.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22.18 - * GNU General Public License for more details. 22.19 - * 22.20 - * You should have received a copy of the GNU General Public License 22.21 - * along with this program; if not, write to the Free Software 22.22 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, 22.23 - * Boston, MA 02110-1301, USA 22.24 - */ 22.25 - 22.26 -#include <l4/cxx/ipc_server> 22.27 -#include <l4/re/env> 22.28 -#include <l4/re/util/object_registry> 22.29 -#include <l4/sys/capability> 22.30 - 22.31 -#include <stdlib.h> 22.32 - 22.33 -#include <l4/devices/spi-client.h> 22.34 -#include "backlight-ops.h" 22.35 - 22.36 -/* SPI access abstractions. */ 22.37 - 22.38 -static L4::Cap<Spi_device_interface> spi_device; 22.39 - 22.40 - 22.41 - 22.42 -/* Backlight device. */ 22.43 - 22.44 -class Backlight_device_server : public L4::Server_object_t<L4::Kobject> 22.45 -{ 22.46 - int _min = 55, _max = 90, _start = 70; 22.47 - 22.48 - void set_duty(int level) 22.49 - { 22.50 - level = level < _min ? _min : (level > _max ? _max : level); 22.51 - 22.52 - /* PWM_DUTY = R05h<5:3> = 5% increments from min to max */ 22.53 - 22.54 - int duty = ((level - _min) / 5) << 3; 22.55 - 22.56 - spi_device->send(16, 0x0516 | duty); /* R05h: GRB=0 (reset); PWM_DUTY=duty; SHDB2=1, SHDB1=1 (power-related); STB=0 (standby) */ 22.57 - spi_device->send(16, 0x0546 | duty); /* R05h: GRB=1 (normal operation); ... */ 22.58 - spi_device->send(16, 0x078d); /* R07h: HBLK=141 (horizontal blanking period from start of hsync pulse to data start) */ 22.59 - spi_device->send(16, 0x1301); /* R13h: IN_SEL=1 (alignment mode) */ 22.60 - spi_device->send(16, 0x0547 | duty); /* R05h: ...; STB=1 (not standby) */ 22.61 - } 22.62 - 22.63 -public: 22.64 - /* Dispatch incoming requests. */ 22.65 - 22.66 - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) 22.67 - { 22.68 - l4_msgtag_t tag; 22.69 - int arg; 22.70 - 22.71 - (void) obj; 22.72 - ios >> tag; 22.73 - 22.74 - switch (tag.label()) 22.75 - { 22.76 - case Backlight_op_disable: 22.77 - disable(); 22.78 - return L4_EOK; 22.79 - 22.80 - case Backlight_op_enable: 22.81 - enable(); 22.82 - return L4_EOK; 22.83 - 22.84 - case Backlight_op_set_brightness: 22.85 - ios >> arg; 22.86 - set_brightness(arg); 22.87 - return L4_EOK; 22.88 - 22.89 - default: 22.90 - return -L4_EBADPROTO; 22.91 - } 22.92 - } 22.93 - 22.94 - void disable() 22.95 - { 22.96 - spi_device->send(16, 0x055e); 22.97 - } 22.98 - 22.99 - void enable() 22.100 - { 22.101 - set_duty(_start); 22.102 - } 22.103 - 22.104 - /* Use the SPI device to update the brightness level. */ 22.105 - 22.106 - void set_brightness(int level) 22.107 - { 22.108 - level = level < _min ? _min : (level > _max ? _max : level); 22.109 - spi_device->send(16, 0x0300 | level); /* R03h: brightness */ 22.110 - } 22.111 -}; 22.112 - 22.113 -static L4Re::Util::Registry_server<> server; 22.114 - 22.115 - 22.116 - 22.117 -int main(void) 22.118 -{ 22.119 - /* Obtain a reference to the SPI device. */ 22.120 - 22.121 - spi_device = L4Re::Env::env()->get_cap<Spi_device_interface>("spi"); 22.122 - if (!spi_device.is_valid()) return 1; 22.123 - 22.124 - /* Initialise and register a new server object. */ 22.125 - 22.126 - Backlight_device_server server_obj; 22.127 - server.registry()->register_obj(&server_obj, "backlight"); 22.128 - 22.129 - /* Enter the IPC server loop. */ 22.130 - 22.131 - server.loop(); 22.132 - return 0; 22.133 -}