Audio subsystem hardware internals

I wrote an introductory article on how the audio subsystem on SBCs work: CODECs, I2S, DTS, whole nine yards. WordPress editor didn’t seem to be a very convenient tool for this kind of write up so I gave asciidoc a try and so far liked it. Link to the article: https://kernelnomicon.org/texts/sbc-audio.html

July 30, 2020 · 1 min · 51 words · Oleksandr Tymoshenko

yubikey-agent on FreeBSD

Some time ago Filippo Valsorda wrote yubikey-agent, seamless SSH agent for YubiKeys. I really like YubiKeys and worked on the FreeBSD support for U2F in Chromium and pyu2f, getting yubikey-agent ported looked like an interesting project. It took some hacking to make it work but overall it wasn’t hard. Following is the roadmap on how to get it set up on FreeBSD. The actual details depend on your system (as you will see) ...

June 4, 2020 · 3 min · 517 words · Oleksandr Tymoshenko

wpa_supplicant.conf "manager" for coffee shops

Whenever I sit down to work at the coffee shop I’ve never been before my preparation routine looks more or less like this: ifconfig wlan0 list scan, copy SSID, vim /etc/wpa_supplicant.conf, service netif restart. The WM I use, i3, does not have fancy network managers that nicely offer you to join available WiFi networks. It’s mildly annoying but not annoying enough to actually make me open a browser and go looking for ways to automate this procedure. Implementing such a utility, on the other hand, sounds like a nice weekend project. ...

May 12, 2020 · 2 min · 278 words · Oleksandr Tymoshenko

Creating FreeBSD OVA files

If you want to jump right into the action check out freebsd-mkova repo. Below are some technical details on what OVA is and its internals. In addition to installation media like DVD or memstick, FreeBSD RE ships FreeBSD releases as a virtual disk image in a number of formats. This is a convenient way when you start your whole VM using bhyve or qemu, as a single CLI command and pass the image location as an argument. It’s less handy if you try to create VM using GUI-based tools like VMWare or VirtualBox. You need to create VM and then configure it to use the image as a drive. Not an awful lot of work but still. ...

January 19, 2020 · 4 min · 759 words · Oleksandr Tymoshenko

Audio for RK3399

Last two weeks I’ve been working on audio support for Firefly-RK3399. Full support requires a number of things that are not quite there or not available in the mainline FreeBSD kernel. The main low-level hardware functionality consists of two parts: I2S block in the SoC and RT5640 audiocodec that converts digital audio to an analog signal. They talk to each other using the I2S protocol. A little bit higher is FDT virtual “devices” called simple-audio-card. This part is responsible for coordinating the setup of both hardware components: make sure they agree on a number of channels, a number of bits per sample and clock specifics of the I2S protocol. There is no code for it in the FreeBSD kernel, so I had to just hardcode these things in both hardware drivers. ...

November 30, 2019 · 2 min · 371 words · Oleksandr Tymoshenko

Color themes support^Whack for vt(4)

I was updating my laptop to the latest HEAD today and noticed that my bash prompt looks ugly in default console color scheme. So what with one thing and another I ended up writing color themes support for vt(4). Just because it was fun thing to do. The idea is that you can redefine any ANSI color in console using variable in /boot/loader.conf, i.e.: kern.vt.color.0.rgb="0,0,0" # color 0 is black # or kern.vt.color.15.rgb="#ffffff" # color 15 is white Here is how my Tomorrow Night theme looks like: ...

August 19, 2017 · 1 min · 115 words · Oleksandr Tymoshenko

Minnowboard Turbot: GPIO, I2C, and SPI

Last year I got my hands on Minnowboard Turbot (courtesy of Frank H.) and spent some time working on communications protocols support for it. Below is short summary of what works and what doesn’t. Minnowboard Turbot is Atom-base SoC, and standard x86 part (HDMI, network, USB) FreeBSD just works on it. The board has expansion connector that exposes I2C, SPI, and GPIO pins and can be used to talk to peripheral devices. Short summary of header pins can be found on developer.microsoft.com. ...

January 6, 2017 · 2 min · 357 words · Oleksandr Tymoshenko

Accessing I2C and SPI from userland

Over years I accumulated fair number of devices I have no real use for. I ordered them either on impulse, or to add couple of $$$ to the bill to get free delivery. So in order to get at least some value from those purchases I put together goofy demo using two of such devices: I2C temperature sensor breakout from Sparkfun and 128x32 SPI OLED display from Adafruit. I wrote two libraries to talk to TMP102 (chip in which temp sensor is based) over I2C and to SSD1306(OLED display chip) over SPI and several demos simple enough to put together in one day but flashy enough to excite my inner child and bring fond memories of MSDOS days. The SPI chip requires this fix in kernel. Userland SPI API provides only very basic functionality but luckily it was enough to talk to SSD1306. ...

December 17, 2016 · 1 min · 206 words · Oleksandr Tymoshenko

rfkill on Jetson TK1

If you’re trying to install half-sized mini-PCIe wifi card in Jetson TK1, be aware, that the board has rfkill feature that is enabled by default. rfkill is hardware or software controlled switch that enables/disables RF signal on the wifi card itself. In case of mini-PCIe it’s controlled by level on pin 20 of the card. On Jetson TK-1 that pin is connected to GPIO X.7 pin. So to enable wifi on the board you need to run something like: ...

December 11, 2016 · 1 min · 87 words · Oleksandr Tymoshenko

Quest for SMP on Raspberry Pi 3, part II

Update (11/29/2016): DTB overlay no longer required. PSCI monitor will patch in-memory DTB to add psci node. Commit Short version of how to get RPi3 with SMP support Build GENERIC arm64 kernel for your image, not GENERIC-UP Copy https://people.freebsd.org/~gonzo/arm/rpi3-smp/u-boot.bin and https://people.freebsd.org/~gonzo/arm/rpi3-smp/armstub8.bin to FAT partition on SD card. Copy https://people.freebsd.org/~gonzo/arm/rpi3-smp/psci.dtbo to overlays directory on FAT partition Edit config.txt: change value of device_tree_address and add psci overlay. These two lines should be there: device_tree_address=0x4000 Reboot device. It should boot with all four cores enabled and reboot should work too. Long version of what’s in those .bin/.dtbo files Boot sequence for PSCI monitor on RPi3 looks like this: ...

November 25, 2016 · 4 min · 711 words · Oleksandr Tymoshenko