static void HAL_HW_DONE(bool full) { if ( hal_ops.hal_hw_done && (EINKFB_SUCCESS == EINKFB_LOCK_ENTRY()) ) { hal_ops.hal_hw_done(full); EINKFB_LOCK_EXIT(); } }
static void broadsheet_watchdog_thread_body(void) { // Repair us in one way or another if we still should. // if ( broadsheet_watchdog_timer_active && broadsheet_watchdog_timer_primed ) { broadsheet_watchdog_timer_primed = false; // Reset Broadsheet if it's not still ready. // if ( !BS_STILL_READY() && (EINKFB_SUCCESS == EINKFB_LOCK_ENTRY()) ) { // If we were forcing the hardware not to be ready, unforce it now. // Forcing the hardware not to be ready is for debugging purposes, // and we treat it as a one-shot. // controller_set_force_hw_not_ready(false); bs_sw_init(FULL_BRINGUP_CONTROLLER, DONT_BRINGUP_PANEL); bs_cmd_ld_img_upd_data(fx_update_partial, UPD_DATA_RESTORE); EINKFB_LOCK_EXIT(); // If Broadsheet's still not ready after we've tried to bring it // back up, tell the eInk HAL that we're in real trouble. // if ( !BS_STILL_READY() ) EINKFB_NEEDS_RESET(); } // Do a panel update repair if it hasn't already been done. // if ( !BS_UPD_REPAIR() && (EINKFB_SUCCESS == EINKFB_LOCK_ENTRY()) ) { bs_cmd_upd_repair(); EINKFB_LOCK_EXIT(); } } wait_for_completion_interruptible(&broadsheet_watchdog_thread_complete); }
static unsigned long einkfb_set_byte_alignment_y(unsigned long byte_alignment) { if ( hal_ops.hal_byte_alignment_y ) { if ( EINKFB_SUCCESS == EINKFB_LOCK_ENTRY() ) { byte_alignment = hal_ops.hal_byte_alignment_y(); EINKFB_LOCK_EXIT(); } } return ( byte_alignment ); }
static int hardwarefb_read(char *page, char **start, off_t off, int count, int *eof, void *data) { // Upon first access, dump the hardware's buffer into scratchfb. // if ( 0 == off ) { if ( EINKFB_SUCCESS == EINKFB_LOCK_ENTRY() ) { broadsheet_read_from_ram(bs_cmd_get_sdr_img_base(), scratchfb, scratchfb_size); EINKFB_LOCK_EXIT(); } } return ( EINKFB_PROC_SYSFS_RW_NO_LOCK(page, start, off, count, eof, scratchfb_size, read_hardwarefb) ); }
static int eink_ram_write(struct file *file, const char __user *buf, unsigned long count, void *data) { int result = EINKFB_FAILURE; if ( EINKFB_SUCCESS == EINKFB_LOCK_ENTRY() ) { eink_ram_select_locked = true; result = EINKFB_PROC_SYSFS_RW_NO_LOCK((char *)buf, NULL, count, 0, NULL, 0, write_eink_ram); eink_ram_select_locked = false; EINKFB_LOCK_EXIT(); } return ( result ); }
static int eink_ram_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int result = EINKFB_FAILURE; if ( EINKFB_SUCCESS == EINKFB_LOCK_ENTRY() ) { eink_ram_select_locked = true; result = EINKFB_PROC_SYSFS_RW_NO_LOCK(page, start, off, count, eof, BROADSHEET_RAM_BANK_SIZE, read_eink_ram); eink_ram_select_locked = false; EINKFB_LOCK_EXIT(); } return ( result ); }
static int eink_rom_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int result = EINKFB_FAILURE; if ( EINKFB_SUCCESS == EINKFB_LOCK_ENTRY() ) { eink_rom_select_locked = true; result = EINKFB_PROC_SYSFS_RW_NO_LOCK(page, start, off, count, eof, broadsheet_flash_size, read_eink_rom); eink_rom_select_locked = false; EINKFB_LOCK_EXIT(); } return ( result ); }
static bool HAL_HW_INIT(struct fb_info *info, bool bringup_mode) { einkfb_set_reboot_behavior(reboot_screen_clear); einkfb_set_sleep_behavior(sleep_behavior_allow_sleep); if ( hal_ops.hal_hw_init ) { if ( EINKFB_SUCCESS == EINKFB_LOCK_ENTRY() ) { bringup_mode = hal_ops.hal_hw_init(info, bringup_mode); EINKFB_LOCK_EXIT(); } } else bringup_mode = FULL_BRINGUP; return ( bringup_mode ); }
static int einkfb_reboot(struct notifier_block *self, unsigned long u, void *v) { // Override any power lock-out behavior for reboot. // POWER_OVERRIDE_BEGIN(); // Force the display back into portrait mode before rebooting. // EINKFB_IOCTL(FBIO_EINK_SET_DISPLAY_ORIENTATION, orientation_portrait); // Ensure that sleep/off is allowed if applicable. // einkfb_set_sleep_behavior(sleep_behavior_allow_sleep); // Override the requested reboot behavior if we must. // switch ( u ) { // If we're truly restarting, leave the reboot behavior alone. // case SYS_RESTART: break; // On actual shutdowns (or halts), don't put up the splash screen // if it's been requested; just clear the screen instead. // default: if ( reboot_screen_splash == einkfb_reboot_behavior ) einkfb_reboot_behavior = reboot_screen_clear; break; } // If there are hooks, give them a call now. // if ( einkfb_reboot_hook ) (*einkfb_reboot_hook)(einkfb_reboot_behavior); if ( hal_ops.hal_reboot_hook && (EINKFB_SUCCESS == EINKFB_LOCK_ENTRY()) ) { (*hal_ops.hal_reboot_hook)(einkfb_reboot_behavior); EINKFB_LOCK_EXIT(); } // Let any screen updates we've done here complete. // EINKFB_FSYNC(); // If getting/setting the power-level is supported, get us either // powered off in the screen-clearing case or just suspended in // the cases where we're not supposed to clear the screen. // if ( hal_ops.hal_get_power_level ) { switch ( einkfb_reboot_behavior ) { case reboot_screen_asis: case reboot_screen_splash: EINKFB_BLANK(FB_BLANK_HSYNC_SUSPEND); break; case reboot_screen_clear: EINKFB_BLANK(FB_BLANK_POWERDOWN); break; } } else { // Otherwise, only clear the screen if we're supposed to. // if ( einkfb_reboot_behavior ) einkfb_clear_display(fx_update_full); } POWER_OVERRIDE_END(); // Clear all of our hooks, note that the framebuffer is // no longer initialized, and clear the ioctl callbacks. // einkfb_set_reboot_hook(NULL); einkfb_set_ioctl_hook(NULL); einkfb_set_info_hook(NULL); set_fb_init_flag(0); set_fb_ioctl(NULL); return ( NOTIFY_DONE ); }