blob: 05d0991445e3a9d6f7d7de8af9d66c8decb0f2df [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{
James Feist98132792019-07-09 13:29:09 -070034 ExportTemplate(const char* params, const char* dev) :
35 parameters(params), device(dev){};
James Feista465ccc2019-02-08 12:51:01 -080036 const char* parameters;
37 const char* device;
James Feist053a6642018-10-15 13:17:09 -070038};
39
James Feista465ccc2019-02-08 12:51:01 -080040const boost::container::flat_map<const char*, ExportTemplate, CmpStr>
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070041 exportTemplates{
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080042 {{"24C02", ExportTemplate("24c02 $Address",
Josh Lehance80db72019-10-09 14:56:35 -070043 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070044 {"24C64", ExportTemplate("24c64 $Address",
45 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehan079c47f2020-06-18 16:34:31 -070046 {"ADM1272",
47 ExportTemplate("adm1272 $Address",
48 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080049 {"EEPROM", ExportTemplate("eeprom $Address",
50 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Gilbert Chenc61ae352020-11-03 22:32:30 +080051 {"EMC1412",
52 ExportTemplate("emc1412 $Address",
53 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080054 {"EMC1413",
55 ExportTemplate("emc1413 $Address",
56 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Gilbert Chenc61ae352020-11-03 22:32:30 +080057 {"EMC1414",
58 ExportTemplate("emc1414 $Address",
59 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070060 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080061 {"INA230", ExportTemplate("ina230 $Address",
62 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
63 {"ISL68137",
64 ExportTemplate("isl68137 $Address",
65 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiuba5424a2020-01-29 13:33:16 -080066 {"MAX16601",
67 ExportTemplate("max16601 $Address",
68 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu9354bf72020-01-22 17:52:32 -080069 {"MAX20730",
70 ExportTemplate("max20730 $Address",
71 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
72 {"MAX20734",
73 ExportTemplate("max20734 $Address",
74 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
75 {"MAX20796",
76 ExportTemplate("max20796 $Address",
77 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080078 {"MAX31725",
79 ExportTemplate("max31725 $Address",
80 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
81 {"MAX31730",
82 ExportTemplate("max31730 $Address",
83 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
84 {"MAX34451",
85 ExportTemplate("max34451 $Address",
86 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehanfdef8372020-05-13 17:02:43 -070087 {"MAX6654",
88 ExportTemplate("max6654 $Address",
89 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070090 {"PCA9543Mux",
91 ExportTemplate("pca9543 $Address",
92 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
93 {"PCA9544Mux",
94 ExportTemplate("pca9544 $Address",
95 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
96 {"PCA9545Mux",
97 ExportTemplate("pca9545 $Address",
98 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
99 {"PCA9546Mux",
100 ExportTemplate("pca9546 $Address",
101 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
102 {"PCA9547Mux",
103 ExportTemplate("pca9547 $Address",
104 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehanac09fe42020-06-26 19:42:10 -0700105 {"SBTSI", ExportTemplate("sbtsi $Address",
106 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700107 {"pmbus", ExportTemplate("pmbus $Address",
108 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800109 {"TMP112", ExportTemplate("tmp112 $Address",
110 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700111 {"TMP175", ExportTemplate("tmp175 $Address",
112 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
113 {"TMP421", ExportTemplate("tmp421 $Address",
114 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
115 {"TMP441", ExportTemplate("tmp441 $Address",
116 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800117 {"TMP75",
118 ExportTemplate("tmp75 $Address",
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700119 "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -0700120} // namespace devices