brcm2708: update linux 4.4 patches to latest version
[oweals/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0386-Add-ads1015-overlay.patch
1 From 940b863512662c2da10729fbb6d57fe072c9b887 Mon Sep 17 00:00:00 2001
2 From: Erik Sejr <erik@eriks.ssimicro.com>
3 Date: Tue, 7 Jun 2016 20:58:17 -0400
4 Subject: [PATCH] Add ads1015 overlay
5
6 See: https://github.com/raspberrypi/linux/pull/1520
7 ---
8  arch/arm/boot/dts/overlays/Makefile            |  1 +
9  arch/arm/boot/dts/overlays/README              | 22 ++++++
10  arch/arm/boot/dts/overlays/ads1015-overlay.dts | 98 ++++++++++++++++++++++++++
11  3 files changed, 121 insertions(+)
12  create mode 100644 arch/arm/boot/dts/overlays/ads1015-overlay.dts
13
14 --- a/arch/arm/boot/dts/overlays/Makefile
15 +++ b/arch/arm/boot/dts/overlays/Makefile
16 @@ -13,6 +13,7 @@ ifeq ($(CONFIG_ARCH_BCM2835),y)
17  endif
18  
19  dtbo-$(RPI_DT_OVERLAYS) += adau1977-adc.dtbo
20 +dtbo-$(RPI_DT_OVERLAYS) += ads1015.dtbo
21  dtbo-$(RPI_DT_OVERLAYS) += ads7846.dtbo
22  dtbo-$(RPI_DT_OVERLAYS) += akkordion-iqdacplus.dtbo
23  dtbo-$(RPI_DT_OVERLAYS) += at86rf233.dtbo
24 --- a/arch/arm/boot/dts/overlays/README
25 +++ b/arch/arm/boot/dts/overlays/README
26 @@ -168,6 +168,28 @@ Load:   dtoverlay=adau1977-adc
27  Params: <None>
28  
29  
30 +Name:   ads1015
31 +Info:   Overlay for activation of Texas Instruments ADS1015 ADC over I2C
32 +Load:   dtoverlay=ads1015,<param>=<val>
33 +Params: addr                    I2C bus address of device. Set based on how the
34 +                                addr pin is wired. (default=0x48 assumes addr
35 +                                is pulled to GND)
36 +        cha_enable              Enable virtual channel a. (default=true)
37 +        cha_cfg                 Set the configuration for virtual channel a.
38 +                                (default=4 configures this channel for the
39 +                                voltage at A0 with respect to GND)
40 +        cha_datarate            Set the datarate (samples/sec) for this channel.
41 +                                (default=4 sets 1600 sps)
42 +        cha_gain                Set the gain of the Programmable Gain
43 +                                Amplifier for this channel. (default=2 sets the
44 +                                full scale of the channel to 2.048 Volts)
45 +
46 +        Channel (ch) parameters can be set for each enabled channel.
47 +        A maximum of 4 channels can be enabled (letters a thru d).
48 +        For more information refer to the device datasheet at:
49 +        http://www.ti.com/lit/ds/symlink/ads1015.pdf
50 +
51 +
52  Name:   ads7846
53  Info:   ADS7846 Touch controller
54  Load:   dtoverlay=ads7846,<param>=<val>
55 --- /dev/null
56 +++ b/arch/arm/boot/dts/overlays/ads1015-overlay.dts
57 @@ -0,0 +1,98 @@
58 +/*
59 + * 2016 - Erik Sejr
60 + */
61 +/dts-v1/;
62 +/plugin/;
63 +
64 +/ {
65 +    compatible = "brcm,bcm2708";
66 +    /* ----------- ADS1015 ------------ */
67 +    fragment@0 {
68 +        target = <&i2c_arm>;
69 +        __overlay__ {
70 +            #address-cells = <1>;
71 +            #size-cells = <0>;
72 +            status = "okay";
73 +            ads1015: ads1015 {
74 +                compatible = "ti,ads1015";
75 +                status = "okay";
76 +                #address-cells = <1>;
77 +                #size-cells = <0>;
78 +                reg = <0x48>;
79 +            };
80 +        };
81 +    };
82 +
83 +    fragment@1 {
84 +        target-path = "i2c_arm/ads1015";
85 +        __overlay__ {
86 +            #address-cells = <1>;
87 +            #size-cells = <0>;
88 +            channel_a: channel_a {
89 +                reg = <4>;
90 +                ti,gain = <2>;
91 +                ti,datarate = <4>;
92 +            };
93 +        };
94 +    };
95 +
96 +    fragment@2 {
97 +        target-path = "i2c_arm/ads1015";
98 +        __dormant__ {
99 +            #address-cells = <1>;
100 +            #size-cells = <0>;
101 +            channel_b: channel_b {
102 +                reg = <5>;
103 +                ti,gain = <2>;
104 +                ti,datarate = <4>;
105 +            };
106 +        };
107 +    };
108 +
109 +    fragment@3 {
110 +        target-path = "i2c_arm/ads1015";
111 +        __dormant__ {
112 +            #address-cells = <1>;
113 +            #size-cells = <0>;
114 +            channel_c: channel_c {
115 +                reg = <6>;
116 +                ti,gain = <2>;
117 +                ti,datarate = <4>;
118 +            };
119 +        };
120 +    };
121 +
122 +    fragment@4 {
123 +        target-path = "i2c_arm/ads1015";
124 +        __dormant__ {
125 +            #address-cells = <1>;
126 +            #size-cells = <0>;
127 +            channel_d: channel_d {
128 +                reg = <7>;
129 +                ti,gain = <2>;
130 +                ti,datarate = <4>;
131 +            };
132 +        };
133 +    };
134 +
135 +    __overrides__ {
136 +        addr =            <&ads1015>,"reg:0";
137 +        cha_enable =      <0>,"=1";
138 +        cha_cfg =         <&channel_a>,"reg:0";
139 +        cha_gain =        <&channel_a>,"ti,gain:0";
140 +        cha_datarate =    <&channel_a>,"ti,datarate:0";
141 +        chb_enable =      <0>,"=2";
142 +        chb_cfg =         <&channel_b>,"reg:0";
143 +        chb_gain =        <&channel_b>,"ti,gain:0";
144 +        chb_datarate =    <&channel_b>,"ti,datarate:0";
145 +        chc_enable =      <0>,"=3";
146 +        chc_cfg =         <&channel_c>,"reg:0";
147 +        chc_gain =        <&channel_c>,"ti,gain:0";
148 +        chc_datarate =    <&channel_c>,"ti,datarate:0";
149 +        chd_enable =      <0>,"=4";
150 +        chd_cfg =         <&channel_d>,"reg:0";
151 +        chd_gain =        <&channel_d>,"ti,gain:0";
152 +        chd_datarate =    <&channel_d>,"ti,datarate:0";
153 +   };
154 +
155 +};