| // Copyright 2022 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.hardware.i2c.businfo; |
| |
| using fuchsia.hardware.i2c; |
| |
| const MAX_I2C_CHANNEL uint32 = 128; // Enough for every address to be used in 7-bit mode. |
| |
| /// Used to inform the i2c driver about an attached i2c device. |
| type I2CChannel = table { |
| /// Address of the device. |
| 1: address uint16; |
| /// Class of the device. |
| /// TODO(https://fxbug.dev/42158297): remove this once x86 uses ACPI properly. |
| 2: i2c_class uint32; |
| |
| /// Vendor ID. Used when binding via platform bus device IDs. |
| 3: vid uint32; |
| /// Product ID. Used when binding via platform bus device IDs. |
| 4: pid uint32; |
| /// Device ID. Used when binding via platform bus device IDs. |
| 5: did uint32; |
| |
| // Bus configuration. |
| /// Are we in charge of the bus? |
| 6: is_bus_controller bool; |
| /// Is this device using 10-bit addressing mode (if false, use 7-bit). |
| 7: is_ten_bit bool; |
| /// Speed of the bus. |
| 8: bus_speed uint32; |
| |
| /// Friendly name for this bus. Will default to the empty string if not |
| /// specified. |
| 9: name string:fuchsia.hardware.i2c.MAX_I2C_NAME_LEN; |
| }; |
| |
| /// Passed to the i2c driver in metadata as DEVICE_METADATA_I2C_CHANNELS. |
| type I2CBusMetadata = table { |
| 1: channels vector<I2CChannel>:MAX_I2C_CHANNEL; |
| /// ID of the bus that these devices are on. Set as a bind property on the |
| /// devices added by the I2C core driver. |
| 2: bus_id uint32; |
| }; |