blob: 16d1822fe7bacf33e48b24240b5f3d3fdc059bcf [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*/
16
17#pragma once
18#include <boost/container/flat_map.hpp>
19
20namespace devices
21{
22
23struct CmpStr
24{
James Feista465ccc2019-02-08 12:51:01 -080025 bool operator()(const char* a, const char* b) const
James Feist053a6642018-10-15 13:17:09 -070026 {
27 return std::strcmp(a, b) < 0;
28 }
29};
30
31struct ExportTemplate
32{
James Feist98132792019-07-09 13:29:09 -070033 ExportTemplate(const char* params, const char* dev) :
34 parameters(params), device(dev){};
James Feista465ccc2019-02-08 12:51:01 -080035 const char* parameters;
36 const char* device;
James Feist053a6642018-10-15 13:17:09 -070037};
38
James Feista465ccc2019-02-08 12:51:01 -080039const boost::container::flat_map<const char*, ExportTemplate, CmpStr>
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070040 exportTemplates{
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080041 {{"24C02", ExportTemplate("24c02 $Address",
Josh Lehance80db72019-10-09 14:56:35 -070042 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070043 {"24C64", ExportTemplate("24c64 $Address",
44 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehan079c47f2020-06-18 16:34:31 -070045 {"ADM1272",
46 ExportTemplate("adm1272 $Address",
47 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080048 {"EEPROM", ExportTemplate("eeprom $Address",
49 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
50 {"EMC1413",
51 ExportTemplate("emc1413 $Address",
52 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070053 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080054 {"INA230", ExportTemplate("ina230 $Address",
55 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
56 {"ISL68137",
57 ExportTemplate("isl68137 $Address",
58 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiuba5424a2020-01-29 13:33:16 -080059 {"MAX16601",
60 ExportTemplate("max16601 $Address",
61 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu9354bf72020-01-22 17:52:32 -080062 {"MAX20730",
63 ExportTemplate("max20730 $Address",
64 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
65 {"MAX20734",
66 ExportTemplate("max20734 $Address",
67 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
68 {"MAX20796",
69 ExportTemplate("max20796 $Address",
70 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080071 {"MAX31725",
72 ExportTemplate("max31725 $Address",
73 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
74 {"MAX31730",
75 ExportTemplate("max31730 $Address",
76 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
77 {"MAX34451",
78 ExportTemplate("max34451 $Address",
79 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehanfdef8372020-05-13 17:02:43 -070080 {"MAX6654",
81 ExportTemplate("max6654 $Address",
82 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070083 {"PCA9543Mux",
84 ExportTemplate("pca9543 $Address",
85 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
86 {"PCA9544Mux",
87 ExportTemplate("pca9544 $Address",
88 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
89 {"PCA9545Mux",
90 ExportTemplate("pca9545 $Address",
91 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
92 {"PCA9546Mux",
93 ExportTemplate("pca9546 $Address",
94 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
95 {"PCA9547Mux",
96 ExportTemplate("pca9547 $Address",
97 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Josh Lehanac09fe42020-06-26 19:42:10 -070098 {"SBTSI", ExportTemplate("sbtsi $Address",
99 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700100 {"pmbus", ExportTemplate("pmbus $Address",
101 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800102 {"TMP112", ExportTemplate("tmp112 $Address",
103 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700104 {"TMP175", ExportTemplate("tmp175 $Address",
105 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
106 {"TMP421", ExportTemplate("tmp421 $Address",
107 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
108 {"TMP441", ExportTemplate("tmp441 $Address",
109 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800110 {"TMP75",
111 ExportTemplate("tmp75 $Address",
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700112 "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -0700113} // namespace devices