summaryrefslogtreecommitdiff
path: root/src/include/device/smbus.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/device/smbus.h')
-rw-r--r--src/include/device/smbus.h63
1 files changed, 21 insertions, 42 deletions
diff --git a/src/include/device/smbus.h b/src/include/device/smbus.h
index 40e49eefae..148c4d7785 100644
--- a/src/include/device/smbus.h
+++ b/src/include/device/smbus.h
@@ -21,50 +21,29 @@ struct smbus_bus_operations {
int (*block_write) (device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer);
};
-static inline int smbus_quick_read(device_t dev)
+static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus)
{
- return dev->bus->dev->ops->ops_smbus_bus->quick_read(dev);
-}
-static inline int smbus_quick_write(device_t dev)
-{
- return dev->bus->dev->ops->ops_smbus_bus->quick_write(dev);
-}
-static inline int smbus_recv_byte(device_t dev)
-{
- return dev->bus->dev->ops->ops_smbus_bus->recv_byte(dev);
-}
-static inline int smbus_send_byte(device_t dev, uint8_t byte)
-{
- return dev->bus->dev->ops->ops_smbus_bus->send_byte(dev, byte);
-}
-static inline int smbus_read_byte(device_t dev, uint8_t addr)
-{
- return dev->bus->dev->ops->ops_smbus_bus->read_byte(dev, addr);
-}
-static inline int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val)
-{
- return dev->bus->dev->ops->ops_smbus_bus->write_byte(dev, addr, val);
-}
-static inline int smbus_read_word(device_t dev, uint8_t addr)
-{
- return dev->bus->dev->ops->ops_smbus_bus->read_word(dev, addr);
-}
-static inline int smbus_write_word(device_t dev, uint8_t addr, uint16_t val)
-{
- return dev->bus->dev->ops->ops_smbus_bus->write_word(dev, addr, val);
-}
-static inline int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data)
-{
- return dev->bus->dev->ops->ops_smbus_bus->process_call(dev, cmd, data);
-}
-static inline int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer)
-{
- return dev->bus->dev->ops->ops_smbus_bus->block_read(dev, cmd, bytes, buffer);
-}
-static inline int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer)
-{
- return dev->bus->dev->ops->ops_smbus_bus->block_write(dev, cmd, bytes, buffer);
+ const struct smbus_bus_operations *bops;
+ bops = 0;
+ if (bus && bus->dev && bus->dev->ops) {
+ bops = bus->dev->ops->ops_smbus_bus;
+ }
+ return bops;
}
+struct bus *get_pbus_smbus(device_t dev);
+int smbus_set_link(device_t dev);
+
+int smbus_quick_read(device_t dev);
+int smbus_quick_write(device_t dev);
+int smbus_recv_byte(device_t dev);
+int smbus_send_byte(device_t dev, uint8_t byte);
+int smbus_read_byte(device_t dev, uint8_t addr);
+int smbus_write_byte(device_t dev, uint8_t addr, uint8_t val);
+int smbus_read_word(device_t dev, uint8_t addr);
+int smbus_write_word(device_t dev, uint8_t addr, uint16_t val);
+int smbus_process_call(device_t dev, uint8_t cmd, uint16_t data);
+int smbus_block_read(device_t dev, uint8_t cmd, uint8_t bytes, uint8_t *buffer);
+int smbus_block_write(device_t dev, uint8_t cmd, uint8_t bytes, const uint8_t *buffer);
#endif /* DEVICE_SMBUS_H */