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 | */ |
Brad Bishop | 1fb9f3f | 2020-08-28 08:15:13 -0400 | [diff] [blame] | 16 | /// \file devices.hpp |
James Feist | 053a664 | 2018-10-15 13:17:09 -0700 | [diff] [blame] | 17 | |
| 18 | #pragma once |
| 19 | #include <boost/container/flat_map.hpp> |
| 20 | |
| 21 | namespace devices |
| 22 | { |
| 23 | |
| 24 | struct CmpStr |
| 25 | { |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 26 | bool operator()(const char* a, const char* b) const |
James Feist | 053a664 | 2018-10-15 13:17:09 -0700 | [diff] [blame] | 27 | { |
| 28 | return std::strcmp(a, b) < 0; |
| 29 | } |
| 30 | }; |
| 31 | |
| 32 | struct ExportTemplate |
| 33 | { |
James Feist | 9813279 | 2019-07-09 13:29:09 -0700 | [diff] [blame] | 34 | ExportTemplate(const char* params, const char* dev) : |
| 35 | parameters(params), device(dev){}; |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 36 | const char* parameters; |
| 37 | const char* device; |
James Feist | 053a664 | 2018-10-15 13:17:09 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 40 | const boost::container::flat_map<const char*, ExportTemplate, CmpStr> |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 41 | exportTemplates{ |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 42 | {{"24C02", ExportTemplate("24c02 $Address", |
Josh Lehan | ce80db7 | 2019-10-09 14:56:35 -0700 | [diff] [blame] | 43 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 44 | {"24C64", ExportTemplate("24c64 $Address", |
| 45 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Nan Zhou | 296667f | 2021-02-23 09:53:14 -0800 | [diff] [blame] | 46 | {"ADM1266", |
| 47 | ExportTemplate("adm1266 $Address", |
| 48 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Josh Lehan | 079c47f | 2020-06-18 16:34:31 -0700 | [diff] [blame] | 49 | {"ADM1272", |
| 50 | ExportTemplate("adm1272 $Address", |
| 51 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 52 | {"EEPROM", ExportTemplate("eeprom $Address", |
| 53 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Gilbert Chen | c61ae35 | 2020-11-03 22:32:30 +0800 | [diff] [blame] | 54 | {"EMC1412", |
| 55 | ExportTemplate("emc1412 $Address", |
| 56 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 57 | {"EMC1413", |
| 58 | ExportTemplate("emc1413 $Address", |
| 59 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Gilbert Chen | c61ae35 | 2020-11-03 22:32:30 +0800 | [diff] [blame] | 60 | {"EMC1414", |
| 61 | ExportTemplate("emc1414 $Address", |
| 62 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 63 | {"Gpio", ExportTemplate("$Index", "/sys/class/gpio/export")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 64 | {"INA230", ExportTemplate("ina230 $Address", |
| 65 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 66 | {"ISL68137", |
| 67 | ExportTemplate("isl68137 $Address", |
| 68 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Gaurav Gandhi | bdad957 | 2020-12-29 03:14:48 +0000 | [diff] [blame] | 69 | {"ISL68223", |
| 70 | ExportTemplate("isl68223 $Address", |
| 71 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 72 | {"ISL69243", |
| 73 | ExportTemplate("isl69243 $Address", |
| 74 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | ba5424a | 2020-01-29 13:33:16 -0800 | [diff] [blame] | 75 | {"MAX16601", |
| 76 | ExportTemplate("max16601 $Address", |
| 77 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Gaurav Gandhi | bdad957 | 2020-12-29 03:14:48 +0000 | [diff] [blame] | 78 | {"MAX20710", |
| 79 | ExportTemplate("max20710 $Address", |
| 80 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 9354bf7 | 2020-01-22 17:52:32 -0800 | [diff] [blame] | 81 | {"MAX20730", |
| 82 | ExportTemplate("max20730 $Address", |
| 83 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 84 | {"MAX20734", |
| 85 | ExportTemplate("max20734 $Address", |
| 86 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 87 | {"MAX20796", |
| 88 | ExportTemplate("max20796 $Address", |
| 89 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 90 | {"MAX31725", |
| 91 | ExportTemplate("max31725 $Address", |
| 92 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 93 | {"MAX31730", |
| 94 | ExportTemplate("max31730 $Address", |
| 95 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Nan Zhou | 296667f | 2021-02-23 09:53:14 -0800 | [diff] [blame] | 96 | {"MAX34440", |
| 97 | ExportTemplate("max34440 $Address", |
| 98 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 99 | {"MAX34451", |
| 100 | ExportTemplate("max34451 $Address", |
| 101 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Josh Lehan | fdef837 | 2020-05-13 17:02:43 -0700 | [diff] [blame] | 102 | {"MAX6654", |
| 103 | ExportTemplate("max6654 $Address", |
| 104 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 105 | {"PCA9543Mux", |
| 106 | ExportTemplate("pca9543 $Address", |
| 107 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 108 | {"PCA9544Mux", |
| 109 | ExportTemplate("pca9544 $Address", |
| 110 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 111 | {"PCA9545Mux", |
| 112 | ExportTemplate("pca9545 $Address", |
| 113 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 114 | {"PCA9546Mux", |
| 115 | ExportTemplate("pca9546 $Address", |
| 116 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 117 | {"PCA9547Mux", |
| 118 | ExportTemplate("pca9547 $Address", |
| 119 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Josh Lehan | ac09fe4 | 2020-06-26 19:42:10 -0700 | [diff] [blame] | 120 | {"SBTSI", ExportTemplate("sbtsi $Address", |
| 121 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 122 | {"pmbus", ExportTemplate("pmbus $Address", |
| 123 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 124 | {"TMP112", ExportTemplate("tmp112 $Address", |
| 125 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 126 | {"TMP175", ExportTemplate("tmp175 $Address", |
| 127 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 128 | {"TMP421", ExportTemplate("tmp421 $Address", |
| 129 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
| 130 | {"TMP441", ExportTemplate("tmp441 $Address", |
| 131 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 132 | {"TMP75", |
| 133 | ExportTemplate("tmp75 $Address", |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 134 | "/sys/bus/i2c/devices/i2c-$Bus/new_device")}}}; |
Jae Hyun Yoo | 9cdeabb | 2018-10-16 11:47:09 -0700 | [diff] [blame] | 135 | } // namespace devices |