brcm2708: add kernel 4.14 support
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0289-overlays-Add-ltc294x-battery-gauge.patch
1 From 585ea300fa44cdf3c3259af68c49518bb85e4af2 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 1 May 2018 09:35:56 +0100
4 Subject: [PATCH 289/454] overlays: Add ltc294x (battery gauge)
5
6 Support the LTC294x range of I2C-connected battery monitors.
7
8 See: https://github.com/raspberrypi/linux/issues/2537
9
10 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
11 ---
12 arch/arm/boot/dts/overlays/Makefile | 1 +
13 arch/arm/boot/dts/overlays/README | 25 ++++++
14 .../arm/boot/dts/overlays/ltc294x-overlay.dts | 86 +++++++++++++++++++
15 3 files changed, 112 insertions(+)
16 create mode 100644 arch/arm/boot/dts/overlays/ltc294x-overlay.dts
17
18 --- a/arch/arm/boot/dts/overlays/Makefile
19 +++ b/arch/arm/boot/dts/overlays/Makefile
20 @@ -60,6 +60,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
21 justboom-dac.dtbo \
22 justboom-digi.dtbo \
23 lirc-rpi.dtbo \
24 + ltc294x.dtbo \
25 mbed-dac.dtbo \
26 mcp23017.dtbo \
27 mcp23s17.dtbo \
28 --- a/arch/arm/boot/dts/overlays/README
29 +++ b/arch/arm/boot/dts/overlays/README
30 @@ -1020,6 +1020,31 @@ Params: gpio_out_pin GPIO for
31 (default "off")
32
33
34 +Name: ltc294x
35 +Info: Adds support for the ltc294x family of battery gauges
36 +Load: dtoverlay=ltc294x,<param>=<val>
37 +Params: ltc2941 Select the ltc2941 device
38 +
39 + ltc2942 Select the ltc2942 device
40 +
41 + ltc2943 Select the ltc2943 device
42 +
43 + ltc2944 Select the ltc2944 device
44 +
45 + resistor-sense The sense resistor value in milli-ohms.
46 + Can be a 32-bit negative value when the battery
47 + has been connected to the wrong end of the
48 + resistor.
49 +
50 + prescaler-exponent Range and accuracy of the gauge. The value is
51 + programmed into the chip only if it differs
52 + from the current setting.
53 + For LTC2941 only:
54 + - Default value is 128
55 + - the exponent is in the range 0-7 (default 7)
56 + See the datasheet for more information.
57 +
58 +
59 Name: mbed-dac
60 Info: Configures the mbed AudioCODEC (TLV320AIC23B)
61 Load: dtoverlay=mbed-dac
62 --- /dev/null
63 +++ b/arch/arm/boot/dts/overlays/ltc294x-overlay.dts
64 @@ -0,0 +1,86 @@
65 +/dts-v1/;
66 +/plugin/;
67 +
68 +
69 +/ {
70 + compatible = "brcm,bcm2835";
71 +
72 + fragment@0 {
73 + target = <&i2c_arm>;
74 + __dormant__ {
75 + #address-cells = <1>;
76 + #size-cells = <0>;
77 + status = "okay";
78 +
79 + ltc2941: ltc2941@64 {
80 + compatible = "lltc,ltc2941";
81 + reg = <0x64>;
82 + lltc,resistor-sense = <50>;
83 + lltc,prescaler-exponent = <7>;
84 + };
85 + };
86 + };
87 +
88 + fragment@1 {
89 + target = <&i2c_arm>;
90 + __dormant__ {
91 + #address-cells = <1>;
92 + #size-cells = <0>;
93 + status = "okay";
94 +
95 + ltc2942: ltc2942@64 {
96 + compatible = "lltc,ltc2942";
97 + reg = <0x64>;
98 + lltc,resistor-sense = <50>;
99 + lltc,prescaler-exponent = <7>;
100 + };
101 + };
102 + };
103 +
104 + fragment@2 {
105 + target = <&i2c_arm>;
106 + __dormant__ {
107 + #address-cells = <1>;
108 + #size-cells = <0>;
109 + status = "okay";
110 +
111 + ltc2943: ltc2943@64 {
112 + compatible = "lltc,ltc2943";
113 + reg = <0x64>;
114 + lltc,resistor-sense = <50>;
115 + lltc,prescaler-exponent = <7>;
116 + };
117 + };
118 + };
119 +
120 + fragment@3 {
121 + target = <&i2c_arm>;
122 + __dormant__ {
123 + #address-cells = <1>;
124 + #size-cells = <0>;
125 + status = "okay";
126 +
127 + ltc2944: ltc2944@64 {
128 + compatible = "lltc,ltc2944";
129 + reg = <0x64>;
130 + lltc,resistor-sense = <50>;
131 + lltc,prescaler-exponent = <7>;
132 + };
133 + };
134 + };
135 +
136 + __overrides__ {
137 + ltc2941 = <0>,"+0";
138 + ltc2942 = <0>,"+1";
139 + ltc2943 = <0>,"+2";
140 + ltc2944 = <0>,"+3";
141 + resistor-sense = <&ltc2941>, "lltc,resistor-sense:0",
142 + <&ltc2942>, "lltc,resistor-sense:0",
143 + <&ltc2943>, "lltc,resistor-sense:0",
144 + <&ltc2944>, "lltc,resistor-sense:0";
145 + prescaler-exponent = <&ltc2941>, "lltc,prescaler-exponent:0",
146 + <&ltc2942>, "lltc,prescaler-exponent:0",
147 + <&ltc2943>, "lltc,prescaler-exponent:0",
148 + <&ltc2944>, "lltc,prescaler-exponent:0";
149 + };
150 +};