Пример #1
0
int invsens_sm_sync(struct invsens_sm_data_t *sm, const char *key)
{
	int res = 0, i;
	struct invsens_sm_cfg *smcfg = NULL;
	struct invsens_driver_t *drv = NULL;
	struct invsens_ioctl_param_t ioctl;

	if (!sm)
		return -SM_EINVAL;

	INV_DBG_FUNC_NAME;

	smcfg = sm->user_data;

	for( i = 0; i < smcfg->driver_count; i ++) {
		drv = smcfg->driver_list[i];
		if (drv && (drv->sync != NULL))
			res = drv->sync(drv, key);
	}

	/*revise the start address of DMP*/
	if(invsens_sm_ioctl(sm,INV_IOCTL_GET_START_ADDR, 0,
		&ioctl)	== SM_IOCTL_HANDLED) {
		smcfg->sm_ctrl.start_addr = (int) ioctl.u32d[0];
	}
	
	return res;
}
int invsens_sm_resume(struct invsens_sm_data_t *sm)
{
	struct invsens_sm_cfg *smcfg = NULL;
	struct invsens_driver_t *drv = NULL;
	int i = 0;

	smcfg = sm->user_data;

	if (unlikely(!smcfg))
		return -SM_EINVAL;

	if(!smcfg->enabled_mask)
		return SM_SUCCESS;

	pr_info("[INV] %s: enabled_mask was not zero\n", __func__);

	for (i = 0; i < smcfg->driver_count; i++) {
		drv = smcfg->driver_list[i];
		if (drv && drv->resume)
			drv->resume(drv);
	}

	invsens_sm_ioctl(sm, INV_IOCTL_RESET_FIFO, 0, 0);

	return SM_SUCCESS;

}