diff options
Diffstat (limited to 'daemon/peripheral_manager.cc')
-rw-r--r-- | daemon/peripheral_manager.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/daemon/peripheral_manager.cc b/daemon/peripheral_manager.cc index c946932..ba8c6aa 100644 --- a/daemon/peripheral_manager.cc +++ b/daemon/peripheral_manager.cc @@ -30,6 +30,8 @@ #include "led_manager.h" #include "pin_mux_manager.h" #include "spi_driver_spidev.h" +#include "uart_driver_sysfs.h" +#include "uart_manager.h" namespace android { namespace { @@ -57,6 +59,15 @@ static int RegisterLedSysfs(const char* name, const char* sysfs_name) { return LedManager::GetLedManager()->RegisterLedSysfs(name, sysfs_name); } +// Uart callbacks +static int RegisterUartBus(const char* name, const char* dev_name) { + return UartManager::GetManager()->RegisterUartDevice(name, dev_name); +} + +static int SetUartPinMux(const char* name, const char* source) { + return UartManager::GetManager()->SetPinMux(name, source); +} + // I2c callbacks static int RegisterI2cDevBus(const char* name, uint32_t bus) { return I2cManager::GetI2cManager()->RegisterI2cDevBus(name, bus); @@ -158,6 +169,13 @@ bool PeripheralManager::RegisterDrivers() { LOG(ERROR) << "Failed to load driver: LedDriverSysfs"; return false; } + if (!UartManager::GetManager()->RegisterDriver( + std::unique_ptr<UartDriverInfoBase>( + new UartDriverInfo<UartDriverSysfs, CharDeviceFactory*>( + nullptr)))) { + LOG(ERROR) << "Failed to load driver: UartDriverSysfs"; + return false; + } return true; } @@ -183,6 +201,10 @@ bool PeripheralManager::InitHal() { // Led .register_led_sysfs = RegisterLedSysfs, + // Uart + .register_uart_bus = RegisterUartBus, + .set_uart_pin_mux = SetUartPinMux, + // I2c .register_i2c_dev_bus = RegisterI2cDevBus, .set_i2c_pin_mux = SetI2cPinMux, |