0381-Add-ads1015-overlay.patch 5.1 KB

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