• Katsuhiro Suzuki's avatar
    arm64: dts: rockchip: enable HDMI sound nodes for rk3328-rock64 · 25572fb5
    Katsuhiro Suzuki authored
    This patch enables HDMI sound (I2S0) and Analog sound (I2S1) which
    are defined in rk3328.dtsi, and replace SPDIF nodes.
    
    We can use SPDIF pass-through with suitable ALSA settings and on
    mpv or other media players.
      - Settings: https://github.com/LibreELEC/LibreELEC.tv/blob/master/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf
      - Ex.: mpv foo.ac3 --audio-spdif=ac3 --audio-device='alsa/SPDIF.pcm.iec958.0:SPDIF'
    
    [Why use simple-audio-card for SPDIF?]
    
    For newly adding nodes, ASoC guys recommend to use audio-graph-card.
    But all other sound nodes for rk3328 have already been defined by
    simple-audio-card. In this time, I chose for consistent sound nodes.
    
    [DMA allocation problem]
    
    After this patch is applied, UART2 will fail to allocate DMA resources
    but UART driver can work fine without DMA.
    
    This error is related to the DMAC of rk3328 (pl330 or compatible).
    DMAC connected to 16 DMA sources. Each sources have ID number that is
    called 'Req number' in rk3328 TRM. After this patch is applied total 7
    of DMA sources will be activated as follows:
    
    | Req number | Source | Required  |
    |            |        | channels  |
    |------------+--------+-----------|
    |  8,  9     | SPI0   | 2ch       |
    | 11, 12     | I2S0   | 2ch       |
    | 14, 15     | I2S1   | 2ch       |
    |     10     | SPDIF  | 1ch       |
    |------------+--------+-----------|
    |            | Total  | 7ch       |
    |------------+--------+-----------|
    |  6,  7     | UART2  | 2ch       | -> cannot get DMA channels
    
    Due to rk3328 DMAC specification we can use max 8 channels at same
    time. If SPI0/I2S0/I2S1/SPDIF will be activated by this patch,
    required DMAC channels reach to 7. So the last two channels (for
    UART2) cannot get DMA resources.
    
    Virt-dma mechanism for pl0330 DMAC driver is needed to fix this
    problem.
    Signed-off-by: default avatarKatsuhiro Suzuki <katsuhiro@katsuster.net>
    Link: https://lore.kernel.org/r/20200802154231.2639186-1-katsuhiro@katsuster.netSigned-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
    25572fb5
rk3328-rock64.dts 7.31 KB