بدون توضیح

k4be e6fc6acdfb Hide the S1D13700 cursor, sharpen text, add DRM backlight 2 هفته پیش
app e6fc6acdfb Hide the S1D13700 cursor, sharpen text, add DRM backlight 2 هفته پیش
docs e6fc6acdfb Hide the S1D13700 cursor, sharpen text, add DRM backlight 2 هفته پیش
tests d0931c2515 Add Linux port of the radio front panel 2 هفته پیش
.gitignore d0931c2515 Add Linux port of the radio front panel 2 هفته پیش
Makefile d0931c2515 Add Linux port of the radio front panel 2 هفته پیش
README.md e6fc6acdfb Hide the S1D13700 cursor, sharpen text, add DRM backlight 2 هفته پیش

README.md

Linux port

Replaces the LPC1114 firmware: the panel and keys hang off I²C expanders on the Linux board. The panel runs on real hardware through radio-i2c; the DRM driver, keys and overlay have not run yet.

Path What
driver/s1d13700_core.* Panel core, used by everything: init, 2 bpp conversion, write planner, TCA9539 stream
driver/s1d13700_drm.c DRM driver (6.x kernels)
sim/ Model of the TCA9539 and S1D13700: decodes the I²C bytes and flags bus faults
app/ UI and MPD client, plus the frontends: main_gtk.c, main_i2c.c, main_drm.c
dts/radio-panel.dts Overlay for the keys, backlight and panel
tests/ Panel core tests and a fake MPD server

Building

make test          # panel core tests, no hardware or libraries
make gtk           # needs gtk+-3.0, cairo, pangocairo, libmpdclient
make target        # i2c-dev and DRM frontends; DRM also needs libdrm
make dtbo
make module KDIR=/path/to/kernel

Running

Window with the simulated panel, using a real MPD:

build/radio-gtk --host radio.lo

The window shows the simulator's display memory, and the traffic each update costs. Keys: Z X C V B for prev/play/pause/stop/next, arrows, Enter, Esc, M, L, Space for pause.

Real panel through i2c-dev, for bring-up or on a kernel too old for the driver:

build/radio-i2c --bus N --pattern geometry
build/radio-i2c --bus N --pattern gray
build/radio-i2c --bus N --host radio.lo

--bus must name a known adapter; motherboard and display buses are always refused. Only use the bus number of the adapter the panel is wired to.

Text uses Verdana and Andale Mono (Microsoft core fonts) if installed, otherwise Liberation Sans and Mono, drawn without antialiasing.

Test rig on the development PC

The panel hangs off an ATmega8U2 i2c-tiny-usb bridge. Load the driver for 400 kHz (its default, delay=10, is only 50 kHz), then find the bus number:

sudo modprobe -r i2c_tiny_usb; sudo modprobe i2c_tiny_usb delay=1
grep -l i2c-tiny-usb /sys/bus/i2c/devices/i2c-*/name

To try the keys without touching the real player, run the fake MPD and point the panel at it:

tests/fake_mpd.py 6601 build/mpd-commands.log 5 &
build/radio-i2c --bus 11 --host localhost --port 6601

Never scan or use the other buses on this PC: some reach the CPU regulators.

Simulating keys

The panel frontends read keys from evdev only: the device named radio-keys, or whatever --input names. On the PC without the U2 keypad:

  • PC keyboard: --input /dev/input/by-id/<keyboard>-event-kbd (needs read access, group input). Arrows and Esc map directly; the media keys of a multimedia keyboard map to Prev/Next/Stop if they send KEY_PREVIOUSSONG, KEY_NEXTSONG, KEY_STOPCD. Play, Pause, OK, Menu and List have no ordinary key. The keyboard keeps typing into the focused window too.
  • Virtual device: with CONFIG_INPUT_UINPUT, create a device named radio-keys (for example evemu-device or python-evdev's UInput) and send the codes in app/platform_linux.c. radio-i2c finds it without --input. The development kernel has uinput disabled.
  • Window: build/radio-gtk has every key as a button and shortcut, but draws on the simulated panel only.

Wiring

U1, TCA9539 at 0x74 (A1=L, A0=L), raw I²C client of the panel code

Pin Signal Module pin
P0.0-7 D0-D7 D0-D7
P1.0 Backlight enable (active high, assumed)
P1.1 RES# RST
P1.2 A0 A15
P1.3 WR# WE
P1.4 RD# RE
P1.5 CS# (held low after reset; was hardwired low on the old board) CS0
P1.6-7 spare

U2, TCA9539 at 0x75 (A1=L, A0=H), stock gpio-pca953x

Each key has its own pin to ground and a 10k pull-up (the TCA9539 has no internal ones). INT goes to a host GPIO with a pull-up.

Pin Key Pin Key
P0.0 Esc P1.0 Down
P0.1 Next P1.1 Pause
P0.2 Stop P1.2 OK
P0.3 Menu P1.3 Left
P0.4 List P1.4 Play
P0.5 Up P1.5 Backlight enable (active high, pull-down)
P0.6 Prev P1.6-7 spare
P0.7 Right

To confirm on hardware

  • TC/R (--tcr) for frame rate; 162 comes from the AVR project's 2 bpp setup
  • The DRM driver, keys (evtest) and the overlay