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 | { |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 34 | ExportTemplate(const char* params, const char* dev, const char* constructor, |
| 35 | const char* destructor, bool createsHWMon) : |
| 36 | parameters(params), |
| 37 | devicePath(dev), add(constructor), remove(destructor), |
| 38 | createsHWMon(createsHWMon){}; |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 39 | const char* parameters; |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 40 | const char* devicePath; |
| 41 | const char* add; |
| 42 | const char* remove; |
| 43 | bool createsHWMon; |
James Feist | 053a664 | 2018-10-15 13:17:09 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
James Feist | a465ccc | 2019-02-08 12:51:01 -0800 | [diff] [blame] | 46 | const boost::container::flat_map<const char*, ExportTemplate, CmpStr> |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 47 | exportTemplates{ |
Vijay Khemka | 4832841 | 2021-04-12 23:14:53 +0000 | [diff] [blame] | 48 | {{"EEPROM_24C01", |
| 49 | ExportTemplate("24c01 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 50 | "new_device", "delete_device", false)}, |
| 51 | {"EEPROM_24C02", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 52 | ExportTemplate("24c02 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 53 | "new_device", "delete_device", false)}, |
Hao Jiang | f64d439 | 2021-02-23 14:22:03 -0800 | [diff] [blame] | 54 | {"EEPROM_24C64", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 55 | ExportTemplate("24c64 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 56 | "new_device", "delete_device", false)}, |
Nan Zhou | 296667f | 2021-02-23 09:53:14 -0800 | [diff] [blame] | 57 | {"ADM1266", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 58 | ExportTemplate("adm1266 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 59 | "new_device", "delete_device", false)}, |
Josh Lehan | 079c47f | 2020-06-18 16:34:31 -0700 | [diff] [blame] | 60 | {"ADM1272", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 61 | ExportTemplate("adm1272 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 62 | "new_device", "delete_device", false)}, |
Bruce Mitchell | ad2b133 | 2021-07-27 14:42:29 -0500 | [diff] [blame] | 63 | {"DPS310", |
| 64 | ExportTemplate("dps310 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 65 | "new_device", "delete_device", false)}, |
| 66 | {"SI7020", |
| 67 | ExportTemplate("si7020 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 68 | "new_device", "delete_device", false)}, |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 69 | {"EEPROM", |
| 70 | ExportTemplate("eeprom $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 71 | "new_device", "delete_device", false)}, |
Gilbert Chen | c61ae35 | 2020-11-03 22:32:30 +0800 | [diff] [blame] | 72 | {"EMC1412", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 73 | ExportTemplate("emc1412 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 74 | "new_device", "delete_device", true)}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 75 | {"EMC1413", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 76 | ExportTemplate("emc1413 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 77 | "new_device", "delete_device", true)}, |
Gilbert Chen | c61ae35 | 2020-11-03 22:32:30 +0800 | [diff] [blame] | 78 | {"EMC1414", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 79 | ExportTemplate("emc1414 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 80 | "new_device", "delete_device", true)}, |
| 81 | {"Gpio", ExportTemplate("$Index", "/sys/class/gpio", "export", |
| 82 | "unexport", false)}, |
| 83 | {"INA230", |
| 84 | ExportTemplate("ina230 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 85 | "new_device", "delete_device", true)}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 86 | {"ISL68137", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 87 | ExportTemplate("isl68137 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 88 | "new_device", "delete_device", true)}, |
Gaurav Gandhi | bdad957 | 2020-12-29 03:14:48 +0000 | [diff] [blame] | 89 | {"ISL68223", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 90 | ExportTemplate("isl68223 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 91 | "new_device", "delete_device", true)}, |
Gaurav Gandhi | bdad957 | 2020-12-29 03:14:48 +0000 | [diff] [blame] | 92 | {"ISL69243", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 93 | ExportTemplate("isl69243 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 94 | "new_device", "delete_device", true)}, |
Alex Qiu | ba5424a | 2020-01-29 13:33:16 -0800 | [diff] [blame] | 95 | {"MAX16601", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 96 | ExportTemplate("max16601 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 97 | "new_device", "delete_device", true)}, |
Gaurav Gandhi | bdad957 | 2020-12-29 03:14:48 +0000 | [diff] [blame] | 98 | {"MAX20710", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 99 | ExportTemplate("max20710 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 100 | "new_device", "delete_device", true)}, |
Alex Qiu | 9354bf7 | 2020-01-22 17:52:32 -0800 | [diff] [blame] | 101 | {"MAX20730", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 102 | ExportTemplate("max20730 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 103 | "new_device", "delete_device", true)}, |
Alex Qiu | 9354bf7 | 2020-01-22 17:52:32 -0800 | [diff] [blame] | 104 | {"MAX20734", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 105 | ExportTemplate("max20734 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 106 | "new_device", "delete_device", true)}, |
Alex Qiu | 9354bf7 | 2020-01-22 17:52:32 -0800 | [diff] [blame] | 107 | {"MAX20796", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 108 | ExportTemplate("max20796 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 109 | "new_device", "delete_device", true)}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 110 | {"MAX31725", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 111 | ExportTemplate("max31725 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 112 | "new_device", "delete_device", true)}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 113 | {"MAX31730", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 114 | ExportTemplate("max31730 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 115 | "new_device", "delete_device", true)}, |
Nan Zhou | 296667f | 2021-02-23 09:53:14 -0800 | [diff] [blame] | 116 | {"MAX34440", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 117 | ExportTemplate("max34440 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 118 | "new_device", "delete_device", true)}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 119 | {"MAX34451", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 120 | ExportTemplate("max34451 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 121 | "new_device", "delete_device", true)}, |
Josh Lehan | fdef837 | 2020-05-13 17:02:43 -0700 | [diff] [blame] | 122 | {"MAX6654", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 123 | ExportTemplate("max6654 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 124 | "new_device", "delete_device", true)}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 125 | {"PCA9543Mux", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 126 | ExportTemplate("pca9543 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 127 | "new_device", "delete_device", false)}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 128 | {"PCA9544Mux", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 129 | ExportTemplate("pca9544 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 130 | "new_device", "delete_device", false)}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 131 | {"PCA9545Mux", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 132 | ExportTemplate("pca9545 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 133 | "new_device", "delete_device", false)}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 134 | {"PCA9546Mux", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 135 | ExportTemplate("pca9546 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 136 | "new_device", "delete_device", false)}, |
Devjit Gopalpur | 4acdc54 | 2019-10-10 22:47:46 -0700 | [diff] [blame] | 137 | {"PCA9547Mux", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 138 | ExportTemplate("pca9547 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 139 | "new_device", "delete_device", false)}, |
| 140 | {"SBTSI", |
| 141 | ExportTemplate("sbtsi $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 142 | "new_device", "delete_device", true)}, |
| 143 | {"pmbus", |
| 144 | ExportTemplate("pmbus $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 145 | "new_device", "delete_device", true)}, |
Lotus Xu | 93db9bf | 2021-09-08 13:47:47 +0800 | [diff] [blame] | 146 | {"PXE1610", |
| 147 | ExportTemplate("pxe1610 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
hsangani | 33cbfd2 | 2021-11-23 18:29:34 +0530 | [diff] [blame^] | 148 | "new_device", "delete_device", true)}, |
Lotus Xu | 93db9bf | 2021-09-08 13:47:47 +0800 | [diff] [blame] | 149 | {"XDPE12284", |
| 150 | ExportTemplate("xdpe12284 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 151 | "new_device", "delete_device", true)}, |
Konstantin Aladyshev | 97353ed | 2021-04-01 17:24:34 +0300 | [diff] [blame] | 152 | {"LM95234", |
| 153 | ExportTemplate("lm95234 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 154 | "new_device", "delete_device", true)}, |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 155 | {"TMP112", |
| 156 | ExportTemplate("tmp112 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 157 | "new_device", "delete_device", true)}, |
| 158 | {"TMP175", |
| 159 | ExportTemplate("tmp175 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 160 | "new_device", "delete_device", true)}, |
| 161 | {"TMP421", |
| 162 | ExportTemplate("tmp421 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 163 | "new_device", "delete_device", true)}, |
| 164 | {"TMP441", |
| 165 | ExportTemplate("tmp441 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 166 | "new_device", "delete_device", true)}, |
Konstantin Aladyshev | 32ec03a | 2021-04-01 17:12:28 +0300 | [diff] [blame] | 167 | {"LM75A", |
| 168 | ExportTemplate("lm75a $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 169 | "new_device", "delete_device", true)}, |
Alex Qiu | 0cbe6bf | 2020-01-03 09:20:02 -0800 | [diff] [blame] | 170 | {"TMP75", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 171 | ExportTemplate("tmp75 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
Zev Weiss | 756fcae | 2021-03-24 22:36:19 +0000 | [diff] [blame] | 172 | "new_device", "delete_device", true)}, |
| 173 | {"W83773G", |
| 174 | ExportTemplate("w83773g $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
Scron Chang | 2fb84ef | 2021-07-14 20:32:14 +0800 | [diff] [blame] | 175 | "new_device", "delete_device", true)}, |
| 176 | {"RAA228000", |
| 177 | ExportTemplate("raa228000 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
| 178 | "new_device", "delete_device", true)}, |
| 179 | {"DPS800", |
| 180 | ExportTemplate("dps800 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
Scron Chang | 5d11daf | 2021-07-26 13:38:26 +0800 | [diff] [blame] | 181 | "new_device", "delete_device", true)}, |
| 182 | {"MAX31790", |
| 183 | ExportTemplate("max31790 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
hsangani | 33cbfd2 | 2021-11-23 18:29:34 +0530 | [diff] [blame^] | 184 | "new_device", "delete_device", true)}, |
| 185 | {"JC42", |
| 186 | ExportTemplate("jc42 $Address", "/sys/bus/i2c/devices/i2c-$Bus", |
Johnathan Mantey | 9b86787 | 2020-10-13 15:00:51 -0700 | [diff] [blame] | 187 | "new_device", "delete_device", true)}}}; |
Jae Hyun Yoo | 9cdeabb | 2018-10-16 11:47:09 -0700 | [diff] [blame] | 188 | } // namespace devices |