blob: 73c363c805cbe5b6532e7bc172b60bb397b5eef3 [file] [log] [blame]
James Feist053a6642018-10-15 13:17:09 -07001/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
Brad Bishop1fb9f3f2020-08-28 08:15:13 -040016/// \file devices.hpp
James Feist053a6642018-10-15 13:17:09 -070017
18#pragma once
19#include <boost/container/flat_map.hpp>
20
21namespace devices
22{
23
24struct CmpStr
25{
James Feista465ccc2019-02-08 12:51:01 -080026 bool operator()(const char* a, const char* b) const
James Feist053a6642018-10-15 13:17:09 -070027 {
28 return std::strcmp(a, b) < 0;
29 }
30};
31
32struct ExportTemplate
33{
Zev Weissc11b5da2022-07-12 16:31:37 -070034 ExportTemplate(const char* params, const char* bus, const char* constructor,
Johnathan Mantey9b867872020-10-13 15:00:51 -070035 const char* destructor, bool createsHWMon) :
36 parameters(params),
Zev Weissc11b5da2022-07-12 16:31:37 -070037 busPath(bus), add(constructor), remove(destructor),
Johnathan Mantey9b867872020-10-13 15:00:51 -070038 createsHWMon(createsHWMon){};
James Feista465ccc2019-02-08 12:51:01 -080039 const char* parameters;
Zev Weissc11b5da2022-07-12 16:31:37 -070040 const char* busPath;
Johnathan Mantey9b867872020-10-13 15:00:51 -070041 const char* add;
42 const char* remove;
43 bool createsHWMon;
James Feist053a6642018-10-15 13:17:09 -070044};
45
James Feista465ccc2019-02-08 12:51:01 -080046const boost::container::flat_map<const char*, ExportTemplate, CmpStr>
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070047 exportTemplates{
Vijay Khemka48328412021-04-12 23:14:53 +000048 {{"EEPROM_24C01",
49 ExportTemplate("24c01 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
50 "new_device", "delete_device", false)},
51 {"EEPROM_24C02",
Johnathan Mantey9b867872020-10-13 15:00:51 -070052 ExportTemplate("24c02 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
53 "new_device", "delete_device", false)},
Jae Hyun Yoo86022012022-04-01 16:04:29 -070054 {"EEPROM_24C04",
55 ExportTemplate("24c04 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
56 "new_device", "delete_device", false)},
57 {"EEPROM_24C08",
58 ExportTemplate("24c08 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
59 "new_device", "delete_device", false)},
60 {"EEPROM_24C16",
61 ExportTemplate("24c16 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
62 "new_device", "delete_device", false)},
63 {"EEPROM_24C32",
64 ExportTemplate("24c32 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
65 "new_device", "delete_device", false)},
Hao Jiangf64d4392021-02-23 14:22:03 -080066 {"EEPROM_24C64",
Johnathan Mantey9b867872020-10-13 15:00:51 -070067 ExportTemplate("24c64 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
68 "new_device", "delete_device", false)},
Jae Hyun Yoo86022012022-04-01 16:04:29 -070069 {"EEPROM_24C128",
70 ExportTemplate("24c128 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
71 "new_device", "delete_device", false)},
72 {"EEPROM_24C256",
73 ExportTemplate("24c256 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
74 "new_device", "delete_device", false)},
Nan Zhou296667f2021-02-23 09:53:14 -080075 {"ADM1266",
Johnathan Mantey9b867872020-10-13 15:00:51 -070076 ExportTemplate("adm1266 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
77 "new_device", "delete_device", false)},
Josh Lehan079c47f2020-06-18 16:34:31 -070078 {"ADM1272",
Johnathan Mantey9b867872020-10-13 15:00:51 -070079 ExportTemplate("adm1272 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
80 "new_device", "delete_device", false)},
Michal Bieleckiff503d82022-04-29 10:20:08 +020081 {"ADS7828",
82 ExportTemplate("ads7828 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
83 "new_device", "delete_device", false)},
Bruce Mitchellad2b1332021-07-27 14:42:29 -050084 {"DPS310",
85 ExportTemplate("dps310 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
86 "new_device", "delete_device", false)},
87 {"SI7020",
88 ExportTemplate("si7020 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
89 "new_device", "delete_device", false)},
Johnathan Mantey9b867872020-10-13 15:00:51 -070090 {"EEPROM",
91 ExportTemplate("eeprom $Address", "/sys/bus/i2c/devices/i2c-$Bus",
92 "new_device", "delete_device", false)},
Gilbert Chenc61ae352020-11-03 22:32:30 +080093 {"EMC1412",
Johnathan Mantey9b867872020-10-13 15:00:51 -070094 ExportTemplate("emc1412 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
95 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080096 {"EMC1413",
Johnathan Mantey9b867872020-10-13 15:00:51 -070097 ExportTemplate("emc1413 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
98 "new_device", "delete_device", true)},
Gilbert Chenc61ae352020-11-03 22:32:30 +080099 {"EMC1414",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700100 ExportTemplate("emc1414 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
101 "new_device", "delete_device", true)},
102 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio", "export",
103 "unexport", false)},
104 {"INA230",
105 ExportTemplate("ina230 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
106 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800107 {"ISL68137",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700108 ExportTemplate("isl68137 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
109 "new_device", "delete_device", true)},
Yung Sheng Huangec5e74e2022-05-06 10:02:18 +0800110 {"ISL68220",
111 ExportTemplate("isl68220 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
112 "new_device", "delete_device", true)},
Khang Kieu20fb4ae2022-02-09 02:04:33 +0000113 {"ISL69225",
114 ExportTemplate("isl69225 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
115 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +0000116 {"ISL68223",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700117 ExportTemplate("isl68223 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
118 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +0000119 {"ISL69243",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700120 ExportTemplate("isl69243 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
121 "new_device", "delete_device", true)},
Zhikui Rened2f07b2022-02-16 14:59:09 -0800122 {"ISL69260",
123 ExportTemplate("isl69260 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
124 "new_device", "delete_device", true)},
Alex Qiuba5424a2020-01-29 13:33:16 -0800125 {"MAX16601",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700126 ExportTemplate("max16601 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
127 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +0000128 {"MAX20710",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700129 ExportTemplate("max20710 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
130 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -0800131 {"MAX20730",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700132 ExportTemplate("max20730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
133 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -0800134 {"MAX20734",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700135 ExportTemplate("max20734 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
136 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -0800137 {"MAX20796",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700138 ExportTemplate("max20796 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
139 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800140 {"MAX31725",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700141 ExportTemplate("max31725 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
142 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800143 {"MAX31730",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700144 ExportTemplate("max31730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
145 "new_device", "delete_device", true)},
Nan Zhou296667f2021-02-23 09:53:14 -0800146 {"MAX34440",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700147 ExportTemplate("max34440 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
148 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800149 {"MAX34451",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700150 ExportTemplate("max34451 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
151 "new_device", "delete_device", true)},
Josh Lehanfdef8372020-05-13 17:02:43 -0700152 {"MAX6654",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700153 ExportTemplate("max6654 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
154 "new_device", "delete_device", true)},
Zev Weissc7612cf2022-05-09 19:22:16 -0700155 {"NCT6779",
156 ExportTemplate("nct6779 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
157 "new_device", "delete_device", true)},
Jan Sowinski50b2e0f2022-05-06 16:47:12 +0200158 {"PCA9542Mux",
159 ExportTemplate("pca9542 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
160 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700161 {"PCA9543Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700162 ExportTemplate("pca9543 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
163 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700164 {"PCA9544Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700165 ExportTemplate("pca9544 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
166 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700167 {"PCA9545Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700168 ExportTemplate("pca9545 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
169 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700170 {"PCA9546Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700171 ExportTemplate("pca9546 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
172 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700173 {"PCA9547Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700174 ExportTemplate("pca9547 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
175 "new_device", "delete_device", false)},
Sujoy Raye4dc1402022-04-15 10:28:34 -0700176 {"PCA9548Mux",
177 ExportTemplate("pca9548 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
178 "new_device", "delete_device", false)},
Jan Sowinski50b2e0f2022-05-06 16:47:12 +0200179 {"PCA9846Mux",
180 ExportTemplate("pca9846 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
181 "new_device", "delete_device", false)},
Jiaqing Zhao88333fe2022-05-06 15:00:15 +0800182 {"PCA9847Mux",
183 ExportTemplate("pca9847 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
184 "new_device", "delete_device", false)},
185 {"PCA9848Mux",
186 ExportTemplate("pca9848 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
187 "new_device", "delete_device", false)},
188 {"PCA9849Mux",
189 ExportTemplate("pca9849 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
190 "new_device", "delete_device", false)},
Johnathan Mantey9b867872020-10-13 15:00:51 -0700191 {"SBTSI",
192 ExportTemplate("sbtsi $Address", "/sys/bus/i2c/devices/i2c-$Bus",
193 "new_device", "delete_device", true)},
Yung Sheng Huang2ca85292022-07-15 09:59:50 +0800194 {"SIC450",
195 ExportTemplate("sic450 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
196 "new_device", "delete_device", true)},
Johnathan Mantey9b867872020-10-13 15:00:51 -0700197 {"pmbus",
198 ExportTemplate("pmbus $Address", "/sys/bus/i2c/devices/i2c-$Bus",
199 "new_device", "delete_device", true)},
Lotus Xu93db9bf2021-09-08 13:47:47 +0800200 {"PXE1610",
201 ExportTemplate("pxe1610 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
hsangani33cbfd22021-11-23 18:29:34 +0530202 "new_device", "delete_device", true)},
Lotus Xu93db9bf2021-09-08 13:47:47 +0800203 {"XDPE12284",
204 ExportTemplate("xdpe12284 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
205 "new_device", "delete_device", true)},
Konstantin Aladyshev97353ed2021-04-01 17:24:34 +0300206 {"LM95234",
207 ExportTemplate("lm95234 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
208 "new_device", "delete_device", true)},
Johnathan Mantey9b867872020-10-13 15:00:51 -0700209 {"TMP112",
210 ExportTemplate("tmp112 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
211 "new_device", "delete_device", true)},
212 {"TMP175",
213 ExportTemplate("tmp175 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
214 "new_device", "delete_device", true)},
215 {"TMP421",
216 ExportTemplate("tmp421 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
217 "new_device", "delete_device", true)},
218 {"TMP441",
219 ExportTemplate("tmp441 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
220 "new_device", "delete_device", true)},
Konstantin Aladyshev32ec03a2021-04-01 17:12:28 +0300221 {"LM75A",
222 ExportTemplate("lm75a $Address", "/sys/bus/i2c/devices/i2c-$Bus",
223 "new_device", "delete_device", true)},
Zev Weiss27adbb72022-04-01 16:17:09 -0700224 {"LM25066",
225 ExportTemplate("lm25066 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
226 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800227 {"TMP75",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700228 ExportTemplate("tmp75 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Zev Weiss756fcae2021-03-24 22:36:19 +0000229 "new_device", "delete_device", true)},
230 {"W83773G",
231 ExportTemplate("w83773g $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Scron Chang2fb84ef2021-07-14 20:32:14 +0800232 "new_device", "delete_device", true)},
233 {"RAA228000",
234 ExportTemplate("raa228000 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
235 "new_device", "delete_device", true)},
236 {"DPS800",
237 ExportTemplate("dps800 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Scron Chang5d11daf2021-07-26 13:38:26 +0800238 "new_device", "delete_device", true)},
239 {"MAX31790",
240 ExportTemplate("max31790 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
hsangani33cbfd22021-11-23 18:29:34 +0530241 "new_device", "delete_device", true)},
242 {"JC42",
243 ExportTemplate("jc42 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Zhikui Rened2f07b2022-02-16 14:59:09 -0800244 "new_device", "delete_device", true)},
245 {"ADM1293",
246 ExportTemplate("adm1293 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Johnathan Manteyf7fc4742022-07-28 13:41:23 -0700247 "new_device", "delete_device", false)},
Zhikui Rened2f07b2022-02-16 14:59:09 -0800248 {"INA219",
249 ExportTemplate("ina219 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Johnathan Manteyf7fc4742022-07-28 13:41:23 -0700250 "new_device", "delete_device", false)},
Zhikui Renec6183c2022-02-26 23:04:34 -0800251 {"RAA229126",
252 ExportTemplate("raa229126 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Shamim Ali3f4527a2022-06-08 23:19:11 +0530253 "new_device", "delete_device", true)},
254 {"MP2971",
255 ExportTemplate("mp2971 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
256 "new_device", "delete_device", true)},
257 {"MP2973",
258 ExportTemplate("mp2973 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Potin Laif51f6af2022-06-28 09:55:19 +0800259 "new_device", "delete_device", true)},
260 {"HDC1080",
261 ExportTemplate("hdc1080 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Potin Laic492ab82022-07-06 00:47:49 +0800262 "new_device", "delete_device", false)}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -0700263} // namespace devices