blob: 0c00c5fe29733b47b72a99d88521ce771ffbb042 [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{
Johnathan Mantey9b867872020-10-13 15:00:51 -070034 ExportTemplate(const char* params, const char* dev, const char* constructor,
35 const char* destructor, bool createsHWMon) :
36 parameters(params),
37 devicePath(dev), add(constructor), remove(destructor),
38 createsHWMon(createsHWMon){};
James Feista465ccc2019-02-08 12:51:01 -080039 const char* parameters;
Johnathan Mantey9b867872020-10-13 15:00:51 -070040 const char* devicePath;
41 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)},
Hao Jiangf64d4392021-02-23 14:22:03 -080054 {"EEPROM_24C64",
Johnathan Mantey9b867872020-10-13 15:00:51 -070055 ExportTemplate("24c64 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
56 "new_device", "delete_device", false)},
Nan Zhou296667f2021-02-23 09:53:14 -080057 {"ADM1266",
Johnathan Mantey9b867872020-10-13 15:00:51 -070058 ExportTemplate("adm1266 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
59 "new_device", "delete_device", false)},
Josh Lehan079c47f2020-06-18 16:34:31 -070060 {"ADM1272",
Johnathan Mantey9b867872020-10-13 15:00:51 -070061 ExportTemplate("adm1272 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
62 "new_device", "delete_device", false)},
Bruce Mitchellad2b1332021-07-27 14:42:29 -050063 {"DPS310",
64 ExportTemplate("dps310 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
65 "new_device", "delete_device", false)},
66 {"SI7020",
67 ExportTemplate("si7020 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
68 "new_device", "delete_device", false)},
Johnathan Mantey9b867872020-10-13 15:00:51 -070069 {"EEPROM",
70 ExportTemplate("eeprom $Address", "/sys/bus/i2c/devices/i2c-$Bus",
71 "new_device", "delete_device", false)},
Gilbert Chenc61ae352020-11-03 22:32:30 +080072 {"EMC1412",
Johnathan Mantey9b867872020-10-13 15:00:51 -070073 ExportTemplate("emc1412 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
74 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080075 {"EMC1413",
Johnathan Mantey9b867872020-10-13 15:00:51 -070076 ExportTemplate("emc1413 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
77 "new_device", "delete_device", true)},
Gilbert Chenc61ae352020-11-03 22:32:30 +080078 {"EMC1414",
Johnathan Mantey9b867872020-10-13 15:00:51 -070079 ExportTemplate("emc1414 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
80 "new_device", "delete_device", true)},
81 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio", "export",
82 "unexport", false)},
83 {"INA230",
84 ExportTemplate("ina230 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
85 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080086 {"ISL68137",
Johnathan Mantey9b867872020-10-13 15:00:51 -070087 ExportTemplate("isl68137 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
88 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +000089 {"ISL68223",
Johnathan Mantey9b867872020-10-13 15:00:51 -070090 ExportTemplate("isl68223 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
91 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +000092 {"ISL69243",
Johnathan Mantey9b867872020-10-13 15:00:51 -070093 ExportTemplate("isl69243 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
94 "new_device", "delete_device", true)},
Alex Qiuba5424a2020-01-29 13:33:16 -080095 {"MAX16601",
Johnathan Mantey9b867872020-10-13 15:00:51 -070096 ExportTemplate("max16601 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
97 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +000098 {"MAX20710",
Johnathan Mantey9b867872020-10-13 15:00:51 -070099 ExportTemplate("max20710 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
100 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -0800101 {"MAX20730",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700102 ExportTemplate("max20730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
103 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -0800104 {"MAX20734",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700105 ExportTemplate("max20734 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
106 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -0800107 {"MAX20796",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700108 ExportTemplate("max20796 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
109 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800110 {"MAX31725",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700111 ExportTemplate("max31725 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
112 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800113 {"MAX31730",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700114 ExportTemplate("max31730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
115 "new_device", "delete_device", true)},
Nan Zhou296667f2021-02-23 09:53:14 -0800116 {"MAX34440",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700117 ExportTemplate("max34440 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
118 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800119 {"MAX34451",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700120 ExportTemplate("max34451 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
121 "new_device", "delete_device", true)},
Josh Lehanfdef8372020-05-13 17:02:43 -0700122 {"MAX6654",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700123 ExportTemplate("max6654 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
124 "new_device", "delete_device", true)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700125 {"PCA9543Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700126 ExportTemplate("pca9543 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
127 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700128 {"PCA9544Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700129 ExportTemplate("pca9544 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
130 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700131 {"PCA9545Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700132 ExportTemplate("pca9545 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
133 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700134 {"PCA9546Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700135 ExportTemplate("pca9546 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
136 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700137 {"PCA9547Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700138 ExportTemplate("pca9547 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
139 "new_device", "delete_device", false)},
140 {"SBTSI",
141 ExportTemplate("sbtsi $Address", "/sys/bus/i2c/devices/i2c-$Bus",
142 "new_device", "delete_device", true)},
143 {"pmbus",
144 ExportTemplate("pmbus $Address", "/sys/bus/i2c/devices/i2c-$Bus",
145 "new_device", "delete_device", true)},
Lotus Xu93db9bf2021-09-08 13:47:47 +0800146 {"PXE1610",
147 ExportTemplate("pxe1610 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
hsangani33cbfd22021-11-23 18:29:34 +0530148 "new_device", "delete_device", true)},
Lotus Xu93db9bf2021-09-08 13:47:47 +0800149 {"XDPE12284",
150 ExportTemplate("xdpe12284 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
151 "new_device", "delete_device", true)},
Konstantin Aladyshev97353ed2021-04-01 17:24:34 +0300152 {"LM95234",
153 ExportTemplate("lm95234 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
154 "new_device", "delete_device", true)},
Johnathan Mantey9b867872020-10-13 15:00:51 -0700155 {"TMP112",
156 ExportTemplate("tmp112 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
157 "new_device", "delete_device", true)},
158 {"TMP175",
159 ExportTemplate("tmp175 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
160 "new_device", "delete_device", true)},
161 {"TMP421",
162 ExportTemplate("tmp421 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
163 "new_device", "delete_device", true)},
164 {"TMP441",
165 ExportTemplate("tmp441 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
166 "new_device", "delete_device", true)},
Konstantin Aladyshev32ec03a2021-04-01 17:12:28 +0300167 {"LM75A",
168 ExportTemplate("lm75a $Address", "/sys/bus/i2c/devices/i2c-$Bus",
169 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800170 {"TMP75",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700171 ExportTemplate("tmp75 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Zev Weiss756fcae2021-03-24 22:36:19 +0000172 "new_device", "delete_device", true)},
173 {"W83773G",
174 ExportTemplate("w83773g $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Scron Chang2fb84ef2021-07-14 20:32:14 +0800175 "new_device", "delete_device", true)},
176 {"RAA228000",
177 ExportTemplate("raa228000 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
178 "new_device", "delete_device", true)},
179 {"DPS800",
180 ExportTemplate("dps800 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Scron Chang5d11daf2021-07-26 13:38:26 +0800181 "new_device", "delete_device", true)},
182 {"MAX31790",
183 ExportTemplate("max31790 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
hsangani33cbfd22021-11-23 18:29:34 +0530184 "new_device", "delete_device", true)},
185 {"JC42",
186 ExportTemplate("jc42 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700187 "new_device", "delete_device", true)}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -0700188} // namespace devices