#ifndef __HUI_INTERNAL_H__ #define __HUI_INTERNAL_H__ #include #define AVM_LED_INTERNAL #include #include #include "leds.h" int hui_sysfs_init(void); void hui_sysfs_exit(void); void events_init(void); void events_update(void); void events_exit(void); int leds_init(void); void leds_update(void); void leds_update_output(void); void leds_exit(void); int button_init(void); void button_exit(void); int generic_gpio_init(void); void generic_gpio_exit(void); #if IS_ENABLED(CONFIG_SPI) int stm32_init(void); void stm32_exit(void); #else static inline int stm32_init(void) { return 0; } static inline void stm32_exit(void) { } #endif int device_init(void); extern struct mutex hui_update_mutex; /*! * This function will schedule a hui update cycle. * * This should be called when events are delivered or global parameters are * change. */ extern void hui_schedule_update(void); /*! * Send a button event. * * This function takes the button id and pressed time and sends the * corresponding avm_event containing these values. * * The special value 0 for pressed_time means that the button has just * been pressed down, and a final event with the non-null pressed_time * will be send later. * * @param button_id Button id * @param pressed_time 0 for down otherwise denotes press duration * @returns 0 or -ENOMEM */ extern int avm_hui_send_button_event(unsigned int button_id, unsigned int pressed_time); extern void *event_source; struct hui { struct colored_kobject obj; // 0-100% u8 brightness; }; extern struct hui *hui_kobj; /* * On some (older) platforms the firmware is flashed from within the kernel. * * However the kernel is barley functional at this point, so we need to side * step most of the code. * * One good thing: The flash code only wants to turn the update led on/off. */ #if IS_ENABLED(CONFIG_AVM_FLASH_UPDATE) extern int hui_bare_handle_event(enum _led_event event, int val); #else static inline int hui_bare_handle_event(enum _led_event event, int val) { return 0; } #endif const char *hui_button_event_to_name(int id); #endif