樹莓派聲音︰ dtoverlay

去年初樹莓派官方決定引入 device trees 、 dtparam 以及 dtoverlay  管理裝置資源、模組載入和參數設定。那時作者曾寫一系列文本,介紹 /boot/config.txt 的變遷與 device trees dtc 之編譯/解碼︰

1_180504_2

清代‧居廉‧ 扶桑

山海經‧海外東經

帝命豎亥步,自東極至於西極,五億十選九千八百步。豎亥右手把筭,左手指青丘北。…

黑齒國在其北,為人黑,食稻啖蛇,一赤一青,在其旁。…

下有湯谷。湯谷上有扶桑,十日所浴,在黑齒北。居水中,有大木,九日居下枝,一日居上枝。

參天大木,始於生,終至成。如是遂有日居焉?而後才能水木榮諸??此方謂『扶桑』── 意在春蠶吐絲哉 ── !!

如果用錯了鑰匙,再簡單的鎖也打不開;就算撬開了鎖,難到事物必然一樣的嗎??

曾經人們希望『○』,然後冀盼『□』,接續期待『☆』,祇不濄人類的『科學』也許也僅能專著於『眼見』,那個『精神』卻日漸地虛無飄渺了吧!

現象顯示『意義的消逝』和『快樂之伏藏』是『相同的一面』,那麼所謂『背面』又到底有些什麼的呢?宛如『天下是天下人的天下』,任誰都無法管之天下吧!怎就不該即時行樂的呢?麻煩在於『無所得故』,言及社會未來,世代傳承……。千百萬年之歷史總歸一詞 ── 終究人性 ──!?

無有』沒法整理,『眾集』不耐其繁,『 Know-How 』多了,或許必將會產生『物以類聚』── 物件描述法 ── 的『 What’s What 』之群分的事!!這當真就是『 Device Tree 』自將之興起的道理嗎??

───《大樹底下好乘涼 ︰ 《開場白》

 

滄海桑田不必久,人世變化未必慢。如今 devicetree.org 已換新妝︰

Welcome to devicetree.org

If you are looking for the devicetree specification you’ve come to the right place!

Devicetree.org is a community effort by many companies and individuals to facilitate the future evolution of the Devicetree Standard.

The devicetree is a data structure for describing hardware. Rather than hard coding every detail of a device into an operating system, many aspects of the hardware can be described in a data structure that is passed to the operating system at boot time. The devicetree is used by OpenFirmware, OpenPOWER Abstraction Layer (OPAL), Power Architecture Platform Requirements (PAPR) and in the standalone Flattened Device Tree (FDT) form.

The devicetree specification provides a full technical description of the devicetree data format and best practices.

The devicetree.org technical steering commitee is the group responsible for developing, managing and promoting the devicetree specification. However, everyone is encouraged to get involved and yes there is a GitHub project too! Further information about the devicetree standard and membership opportunities can be found throughout this website.

 

也發行了新版規格書︰

dtspec

The Devicetree Specification

Device Tree Specification Release 0.1
This is the first formal baseline release of the device tree specification. This document is a first iteration of ePAPR 1.1 and picks up where it left off in 2012.

The next release, v1.0 is planned for the end of August, 2016, which will be up to date with current core DT bindings used by the Linux kernel.

If you would like to get involved please fetch the document source from GitHub and join the mailing list. Comments and patches are welcome at any time!

A second major release is planned for December 2016 to cover new features. The timeline for planned future releases are shown here and you can always find the latest release, as well as all older releases, in our GitHub repository: Devicetree Specification release repository

 

終究得與時偕行乎!!??

樹莓派上 I2S 聲卡設定,還請參照︰

Device Trees, overlays, and parameters

Raspberry Pi’s latest kernels and firmware, including Raspbian and NOOBS releases, now by default use Device Tree (DT) to manage some resource allocation and module loading. This change is to alleviate the problem of multiple drivers contending for system resources, and to allow HAT modules to be auto-configured.

The current implementation is not a pure Device Tree system – there is still board support code that creates some platform devices – but the external interfaces (I2C, I2S, SPI), and the audio devices that use them, must now be instantiated using a Device Tree Blob (DTB) passed to the kernel by the loader (start.elf).

The main impact of using Device Tree is to change from everything on, relying on module blacklisting to manage contention, to everything off unless requested by the DTB. In order to continue to use external interfaces and the peripherals that attach to them, you will need to add some new settings to your config.txt. Full details are given in Part 3, but these are a few examples:

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment one of these lines to enable an audio interface
#dtoverlay=hifiberry-amp
#dtoverlay=hifiberry-dac
#dtoverlay=hifiberry-dacplus
#dtoverlay=hifiberry-digi
#dtoverlay=iqaudio-dac
#dtoverlay=iqaudio-dacplus
#dtoverlay=audioinjector-wm8731-audio

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Uncomment this to override the defaults for the lirc-rpi module
#dtparam=gpio_out_pin=16
#dtparam=gpio_in_pin=17
#dtparam=gpio_in_pull=down

 

各個 dtoverlay 之參數與詳細說明,務須仔細閱讀︰

pi@raspberrypi:/boot/overlays $ more README 
Introduction
============

This directory contains Device Tree overlays. Device Tree makes it possible
to support many hardware configurations with a single kernel and without the
need to explicitly load or blacklist kernel modules. Note that this isn't a
"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices
are still configured by the board support code, but the intention is to
eventually reach that goal.

On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By
default, the Raspberry Pi kernel boots with device tree enabled. You can
completely disable DT usage (for now) by adding:

    device_tree=

to your config.txt, which should cause your Pi to revert to the old way of
doing things after a reboot.

In /boot you will find a .dtb for each base platform. This describes the
hardware that is part of the Raspberry Pi board. The loader (start.elf and its
siblings) selects the .dtb file appropriate for the platform by name, and reads
it into memory. At this point, all of the optional interfaces (i2c, i2s, spi)
--More--(1%)