/** * Watchdog interrupt handler * */ static irqreturn_t dsps_wdog_bite_irq(int irq, void *dev_id) { pr_err("%s\n", __func__); dsps_log_sfr(); dsps_restart_handler(); return IRQ_HANDLED; }
static irqreturn_t dsps_wdog_bite_irq(int irq, void *dev_id) { struct dsps_data *drv = dev_id; atomic_set(&drv->wd_crash, 1); dsps_log_sfr(); dsps_restart_handler(drv); return IRQ_HANDLED; }
static void dsps_smsm_state_cb(void *data, uint32_t old_state, uint32_t new_state) { struct dsps_data *drv = data; if (drv->crash == 1) { pr_debug("SMSM_RESET state change ignored\n"); drv->crash = 0; } else if (new_state & SMSM_RESET) { dsps_log_sfr(); dsps_restart_handler(drv); } }
/** * SMSM state change callback * */ static void dsps_smsm_state_cb(void *data, uint32_t old_state, uint32_t new_state) { pr_debug("%s\n", __func__); if (dsps_crash_shutdown_g == 1) { pr_debug("%s: SMSM_RESET state change ignored\n", __func__); dsps_crash_shutdown_g = 0; return; } if (new_state & SMSM_RESET) dsps_restart_handler(NULL); }
/** * IO Control - handle commands from client. * */ static long dsps_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret = 0; u32 val = 0; pr_debug("%s.\n", __func__); switch (cmd) { case DSPS_IOCTL_ON: if (!drv->pdata->dsps_pwr_ctl_en) { ret = dsps_power_on_handler(); dsps_resume(); } break; case DSPS_IOCTL_OFF: if (!drv->pdata->dsps_pwr_ctl_en) { dsps_suspend(); ret = dsps_power_off_handler(); } break; case DSPS_IOCTL_READ_SLOW_TIMER: val = dsps_read_slow_timer(); ret = put_user(val, (u32 __user *) arg); break; case DSPS_IOCTL_READ_FAST_TIMER: val = dsps_read_fast_timer(); ret = put_user(val, (u32 __user *) arg); break; case DSPS_IOCTL_RESET: pr_err("%s: User-initiated DSPS reset.\nResetting DSPS\n", __func__); dsps_restart_handler(); ret = 0; break; default: ret = -EINVAL; break; } return ret; }