James Feist | 053a664 | 2018-10-15 13:17:09 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | namespace devices |
| 21 | { |
| 22 | |
| 23 | struct CmpStr |
| 24 | { |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 25 | bool operator()(const char* a, const char* b) const |
James Feist | 053a664 | 2018-10-15 13:17:09 -0700 | [diff] [blame] | 26 | { |
| 27 | return std::strcmp(a, b) < 0; |
| 28 | } |
| 29 | }; |
| 30 | |
| 31 | struct ExportTemplate |
| 32 | { |
James Feist | 9813279 | 2019-07-09 13:29:09 -0700 | [diff] [blame] | 33 | ExportTemplate(const char* params, const char* dev) : |
| 34 | parameters(params), device(dev){}; |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 35 | const char* parameters; |
| 36 | const char* device; |
James Feist | 053a664 | 2018-10-15 13:17:09 -0700 | [diff] [blame] | 37 | }; |
| 38 | |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 39 | const boost::container::flat_map<const char*, ExportTemplate, CmpStr> |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 40 | exportTemplates{ |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 41 | {{"24C02", ExportTemplate("24c02 $Address", |
Josh Lehan | ce80db7 | 2019-10-09 14:56:35 -0700 | [diff] [blame] | 42 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 43 | {"24C64", ExportTemplate("24c64 $Address", |
| 44 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Josh Lehan | 079c47f | 2020-06-18 16:34:31 -0700 | [diff] [blame] | 45 | {"ADM1272", |
| 46 | ExportTemplate("adm1272 $Address", |
| 47 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 48 | {"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 Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 53 | {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 54 | {"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 Qiu | ba5424a | 2020-01-29 13:33:16 -0800 | [diff] [blame] | 59 | {"MAX16601", |
| 60 | ExportTemplate("max16601 $Address", |
| 61 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 9354bf7 | 2020-01-22 17:52:32 -0800 | [diff] [blame] | 62 | {"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 Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 71 | {"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 Lehan | fdef837 | 2020-05-13 17:02:43 -0700 | [diff] [blame] | 80 | {"MAX6654", |
| 81 | ExportTemplate("max6654 $Address", |
| 82 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 83 | {"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 Lehan | ac09fe4 | 2020-06-26 19:42:10 -0700 | [diff] [blame] | 98 | {"SBTSI", ExportTemplate("sbtsi $Address", |
| 99 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 100 | {"pmbus", ExportTemplate("pmbus $Address", |
| 101 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 102 | {"TMP112", ExportTemplate("tmp112 $Address", |
| 103 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 104 | {"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 Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 110 | {"TMP75", |
| 111 | ExportTemplate("tmp75 $Address", |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 112 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}}; |
Jae Hyun Yoo | 9cdeabb | 2018-10-16 11:47:09 -0700 | [diff] [blame] | 113 | } // namespace devices |