blob: 812db3fb18e2bf1e578e83fc355513c1b7c9e5ce [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{
Hao Jiangf64d4392021-02-23 14:22:03 -080048 {{"EEPROM_24C02",
Johnathan Mantey9b867872020-10-13 15:00:51 -070049 ExportTemplate("24c02 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
50 "new_device", "delete_device", false)},
Hao Jiangf64d4392021-02-23 14:22:03 -080051 {"EEPROM_24C64",
Johnathan Mantey9b867872020-10-13 15:00:51 -070052 ExportTemplate("24c64 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
53 "new_device", "delete_device", false)},
Nan Zhou296667f2021-02-23 09:53:14 -080054 {"ADM1266",
Johnathan Mantey9b867872020-10-13 15:00:51 -070055 ExportTemplate("adm1266 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
56 "new_device", "delete_device", false)},
Josh Lehan079c47f2020-06-18 16:34:31 -070057 {"ADM1272",
Johnathan Mantey9b867872020-10-13 15:00:51 -070058 ExportTemplate("adm1272 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
59 "new_device", "delete_device", false)},
60 {"EEPROM",
61 ExportTemplate("eeprom $Address", "/sys/bus/i2c/devices/i2c-$Bus",
62 "new_device", "delete_device", false)},
Gilbert Chenc61ae352020-11-03 22:32:30 +080063 {"EMC1412",
Johnathan Mantey9b867872020-10-13 15:00:51 -070064 ExportTemplate("emc1412 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
65 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080066 {"EMC1413",
Johnathan Mantey9b867872020-10-13 15:00:51 -070067 ExportTemplate("emc1413 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
68 "new_device", "delete_device", true)},
Gilbert Chenc61ae352020-11-03 22:32:30 +080069 {"EMC1414",
Johnathan Mantey9b867872020-10-13 15:00:51 -070070 ExportTemplate("emc1414 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
71 "new_device", "delete_device", true)},
72 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio", "export",
73 "unexport", false)},
74 {"INA230",
75 ExportTemplate("ina230 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
76 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080077 {"ISL68137",
Johnathan Mantey9b867872020-10-13 15:00:51 -070078 ExportTemplate("isl68137 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
79 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +000080 {"ISL68223",
Johnathan Mantey9b867872020-10-13 15:00:51 -070081 ExportTemplate("isl68223 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
82 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +000083 {"ISL69243",
Johnathan Mantey9b867872020-10-13 15:00:51 -070084 ExportTemplate("isl69243 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
85 "new_device", "delete_device", true)},
Alex Qiuba5424a2020-01-29 13:33:16 -080086 {"MAX16601",
Johnathan Mantey9b867872020-10-13 15:00:51 -070087 ExportTemplate("max16601 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
88 "new_device", "delete_device", true)},
Gaurav Gandhibdad9572020-12-29 03:14:48 +000089 {"MAX20710",
Johnathan Mantey9b867872020-10-13 15:00:51 -070090 ExportTemplate("max20710 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
91 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -080092 {"MAX20730",
Johnathan Mantey9b867872020-10-13 15:00:51 -070093 ExportTemplate("max20730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
94 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -080095 {"MAX20734",
Johnathan Mantey9b867872020-10-13 15:00:51 -070096 ExportTemplate("max20734 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
97 "new_device", "delete_device", true)},
Alex Qiu9354bf72020-01-22 17:52:32 -080098 {"MAX20796",
Johnathan Mantey9b867872020-10-13 15:00:51 -070099 ExportTemplate("max20796 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
100 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800101 {"MAX31725",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700102 ExportTemplate("max31725 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
103 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800104 {"MAX31730",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700105 ExportTemplate("max31730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
106 "new_device", "delete_device", true)},
Nan Zhou296667f2021-02-23 09:53:14 -0800107 {"MAX34440",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700108 ExportTemplate("max34440 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
109 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800110 {"MAX34451",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700111 ExportTemplate("max34451 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
112 "new_device", "delete_device", true)},
Josh Lehanfdef8372020-05-13 17:02:43 -0700113 {"MAX6654",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700114 ExportTemplate("max6654 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
115 "new_device", "delete_device", true)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700116 {"PCA9543Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700117 ExportTemplate("pca9543 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
118 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700119 {"PCA9544Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700120 ExportTemplate("pca9544 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
121 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700122 {"PCA9545Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700123 ExportTemplate("pca9545 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
124 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700125 {"PCA9546Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700126 ExportTemplate("pca9546 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
127 "new_device", "delete_device", false)},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700128 {"PCA9547Mux",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700129 ExportTemplate("pca9547 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
130 "new_device", "delete_device", false)},
131 {"SBTSI",
132 ExportTemplate("sbtsi $Address", "/sys/bus/i2c/devices/i2c-$Bus",
133 "new_device", "delete_device", true)},
134 {"pmbus",
135 ExportTemplate("pmbus $Address", "/sys/bus/i2c/devices/i2c-$Bus",
136 "new_device", "delete_device", true)},
137 {"TMP112",
138 ExportTemplate("tmp112 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
139 "new_device", "delete_device", true)},
140 {"TMP175",
141 ExportTemplate("tmp175 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
142 "new_device", "delete_device", true)},
143 {"TMP421",
144 ExportTemplate("tmp421 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
145 "new_device", "delete_device", true)},
146 {"TMP441",
147 ExportTemplate("tmp441 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
148 "new_device", "delete_device", true)},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800149 {"TMP75",
Johnathan Mantey9b867872020-10-13 15:00:51 -0700150 ExportTemplate("tmp75 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
151 "new_device", "delete_device", true)}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -0700152} // namespace devices