1 /* 2 * (C) Copyright 2017 Rockchip Electronics Co., Ltd 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #include <command.h> 8 #include <common.h> 9 #include <dm.h> 10 #include <power/charge_display.h> 11 12 int charge_display_get_power_on_soc(struct udevice *dev) 13 { 14 const struct dm_charge_display_ops *ops = dev_get_driver_ops(dev); 15 16 if (!ops || !ops->get_power_on_soc) 17 return -ENOSYS; 18 19 return ops->get_power_on_soc(dev); 20 } 21 22 int charge_display_get_power_on_voltage(struct udevice *dev) 23 { 24 const struct dm_charge_display_ops *ops = dev_get_driver_ops(dev); 25 26 if (!ops || !ops->get_power_on_voltage) 27 return -ENOSYS; 28 29 return ops->get_power_on_voltage(dev); 30 } 31 32 int charge_display_show(struct udevice *dev) 33 { 34 const struct dm_charge_display_ops *ops = dev_get_driver_ops(dev); 35 36 if (!ops || !ops->show) 37 return -ENOSYS; 38 39 return ops->show(dev); 40 } 41 42 UCLASS_DRIVER(charge_display) = { 43 .id = UCLASS_CHARGE_DISPLAY, 44 .name = "charge_display", 45 }; 46