|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
| 2 | +/* |
| 3 | + * Pisound Micro Linux kernel module. |
| 4 | + * Copyright (C) 2017-2025 Vilniaus Blokas UAB, https://blokas.io/ |
| 5 | + * |
| 6 | + * This program is free software; you can redistribute it and/or |
| 7 | + * modify it under the terms of the GNU General Public License |
| 8 | + * as published by the Free Software Foundation; version 2 of the |
| 9 | + * License. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + */ |
| 16 | + |
| 17 | +/dts-v1/; |
| 18 | +/plugin/; |
| 19 | + |
| 20 | +#include <dt-bindings/gpio/gpio.h> |
| 21 | +#include <dt-bindings/pinctrl/bcm2835.h> |
| 22 | +#include <dt-bindings/interrupt-controller/irq.h> |
| 23 | + |
| 24 | +/ { |
| 25 | + compatible = "brcm,bcm2835"; |
| 26 | + |
| 27 | + fragment@0 { |
| 28 | + target = <&gpio>; |
| 29 | + __overlay__ { |
| 30 | + pisound_micro_pins: pisound_micro_pins { |
| 31 | + brcm,pins = <16 26>; |
| 32 | + brcm,function = <BCM2835_FSEL_GPIO_IN BCM2835_FSEL_GPIO_IN>; |
| 33 | + brcm,pull = <BCM2835_PUD_UP BCM2835_PUD_UP>; |
| 34 | + }; |
| 35 | + }; |
| 36 | + }; |
| 37 | + |
| 38 | + fragment@1 { |
| 39 | + target-path = "/"; |
| 40 | + __overlay__ { |
| 41 | + clk_codec: clk-codec { |
| 42 | + compatible = "fixed-clock"; |
| 43 | + #clock-cells = <0>; |
| 44 | + clock-frequency = <12000000>; |
| 45 | + status = "okay"; |
| 46 | + }; |
| 47 | + }; |
| 48 | + }; |
| 49 | + |
| 50 | + fragment@2 { |
| 51 | + target = <&i2c_arm>; |
| 52 | + __overlay__ { |
| 53 | + status = "okay"; |
| 54 | + |
| 55 | + #address-cells = <1>; |
| 56 | + #size-cells = <0>; |
| 57 | + |
| 58 | + pisound_micro_ctrl: pisound_micro_ctrl@12 { |
| 59 | + compatible = "blokas,upisnd-ctrl"; |
| 60 | + |
| 61 | + pinctrl-names = "default"; |
| 62 | + pinctrl-0 = <&pisound_micro_pins>; |
| 63 | + |
| 64 | + reg = <0x12>; |
| 65 | + status = "okay"; |
| 66 | + |
| 67 | + interrupt-parent = <&gpio>; |
| 68 | + interrupt-controller; |
| 69 | + interrupts = <26 IRQ_TYPE_LEVEL_LOW>; |
| 70 | + interrupt-names = "data_available"; |
| 71 | + |
| 72 | + gpio-controller; |
| 73 | + #gpio-cells = <2>; |
| 74 | + |
| 75 | + data_available-gpios = <&gpio 26 GPIO_ACTIVE_LOW>; |
| 76 | + reset-gpios = <&gpio 16 GPIO_ACTIVE_LOW>; |
| 77 | + }; |
| 78 | + |
| 79 | + pisound_micro_codec: upisnd_codec@3b { |
| 80 | + #sound-dai-cells = <0>; |
| 81 | + compatible = "blokas,upisnd-codec"; |
| 82 | + reg = <0x3b>; |
| 83 | + |
| 84 | + clock-names = "mclk"; |
| 85 | + clocks = <&clk_codec>; |
| 86 | + |
| 87 | + // Additional options with default values and alternative values: |
| 88 | + |
| 89 | + //input-mode = "differential"; // Or "single-ended" |
| 90 | + |
| 91 | + //hp-out-mode = "headphone"; // Or "capless-headphone" |
| 92 | + // Or "line-out" |
| 93 | + |
| 94 | + //line-out-mode = "line-out"; // Or "headphone" |
| 95 | + //mono-out-mode = "line-out"; // Or "headphone" |
| 96 | + |
| 97 | + status = "okay"; |
| 98 | + }; |
| 99 | + }; |
| 100 | + }; |
| 101 | + |
| 102 | + fragment@3 { |
| 103 | + target = <&sound>; |
| 104 | + __overlay__ { |
| 105 | + compatible = "blokas,pisound-micro"; |
| 106 | + codec = <&pisound_micro_codec>; |
| 107 | + ctrl = <&pisound_micro_ctrl>; |
| 108 | + i2s-controller = <&i2s_clk_consumer>; |
| 109 | + status = "okay"; |
| 110 | + }; |
| 111 | + }; |
| 112 | + |
| 113 | + fragment@4 { |
| 114 | + target = <&i2s_clk_consumer>; |
| 115 | + __overlay__ { |
| 116 | + status = "okay"; |
| 117 | + }; |
| 118 | + }; |
| 119 | + |
| 120 | + __overrides__ { |
| 121 | + input-mode=<&pisound_micro_codec>,"input-mode{single-ended,differential}"; |
| 122 | + hp-out-mode=<&pisound_micro_codec>, |
| 123 | + "hp-out-mode{capless-headphone,headphone,line-out}"; |
| 124 | + line-out-mode=<&pisound_micro_codec>,"line-out-mode{line-out,headphone}"; |
| 125 | + mono-out-mode=<&pisound_micro_codec>,"mono-out-mode{line-out,headphone}"; |
| 126 | + }; |
| 127 | + |
| 128 | + __exports__ { |
| 129 | + pisound_micro_ctrl; |
| 130 | + }; |
| 131 | +}; |
| 132 | + |
| 133 | +/* vim: set ts=8 sw=8 noexpandtab: */ |
0 commit comments