blob: 5c8ba150bc8cf010b5a99be6a40143cba6bbe51b [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")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080045 {"EEPROM", ExportTemplate("eeprom $Address",
46 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
47 {"EMC1413",
48 ExportTemplate("emc1413 $Address",
49 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070050 {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080051 {"INA230", ExportTemplate("ina230 $Address",
52 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
53 {"ISL68137",
54 ExportTemplate("isl68137 $Address",
55 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiuba5424a2020-01-29 13:33:16 -080056 {"MAX16601",
57 ExportTemplate("max16601 $Address",
58 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu9354bf72020-01-22 17:52:32 -080059 {"MAX20730",
60 ExportTemplate("max20730 $Address",
61 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
62 {"MAX20734",
63 ExportTemplate("max20734 $Address",
64 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
65 {"MAX20796",
66 ExportTemplate("max20796 $Address",
67 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080068 {"MAX31725",
69 ExportTemplate("max31725 $Address",
70 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
71 {"MAX31730",
72 ExportTemplate("max31730 $Address",
73 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
74 {"MAX34451",
75 ExportTemplate("max34451 $Address",
76 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070077 {"PCA9543Mux",
78 ExportTemplate("pca9543 $Address",
79 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
80 {"PCA9544Mux",
81 ExportTemplate("pca9544 $Address",
82 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
83 {"PCA9545Mux",
84 ExportTemplate("pca9545 $Address",
85 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
86 {"PCA9546Mux",
87 ExportTemplate("pca9546 $Address",
88 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
89 {"PCA9547Mux",
90 ExportTemplate("pca9547 $Address",
91 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070092 {"pmbus", ExportTemplate("pmbus $Address",
93 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -080094 {"TMP112", ExportTemplate("tmp112 $Address",
95 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Devjit Gopalpur4acdc542019-10-10 22:47:46 -070096 {"TMP175", ExportTemplate("tmp175 $Address",
97 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
98 {"TMP421", ExportTemplate("tmp421 $Address",
99 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
100 {"TMP441", ExportTemplate("tmp441 $Address",
101 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
Alex Qiu0cbe6bf2020-01-03 09:20:02 -0800102 {"TMP75",
103 ExportTemplate("tmp75 $Address",
Devjit Gopalpur4acdc542019-10-10 22:47:46 -0700104 "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}};
Jae Hyun Yoo9cdeabb2018-10-16 11:47:09 -0700105} // namespace devices