int platform_ipc_init(struct ipc *ipc) { _ipc = ipc; ipc_set_drvdata(_ipc, NULL); /* schedule */ schedule_task_init(&_ipc->ipc_task, SOF_SCHEDULE_EDF, SOF_TASK_PRI_MED, ipc_process_task, _ipc, 0, 0); return 0; }
/** * mid_thermal_probe - mfld thermal initialize * @ipcdev: ipc device structure * * mid thermal probe initializes the hardware and registers * all the sensors with the generic thermal framework. Can sleep. */ static int mid_thermal_probe(struct ipc_device *ipcdev) { int ret; int i; ipcinfo = kzalloc(sizeof(struct ipc_info), GFP_KERNEL); if (!ipcinfo) return -ENOMEM; /* initialize mutex locks */ mutex_init(&ipcinfo->cacheinfo.lock); #ifdef CONFIG_BOARD_CTP /* Allocate ADC channels for all sensors */ ipcinfo->therm_adc_handle = intel_mid_gpadc_alloc(MSIC_THERMAL_SENSORS, 0x04 | CH_NEED_VREF | CH_NEED_VCALIB, 0x04 | CH_NEED_VREF | CH_NEED_VCALIB, 0x03 | CH_NEED_VCALIB, 0x09 | CH_NEED_VREF | CH_NEED_VCALIB); #else /* Allocate ADC channels for all sensors */ ipcinfo->therm_adc_handle = intel_mid_gpadc_alloc(MSIC_THERMAL_SENSORS, 0x08 | CH_NEED_VREF | CH_NEED_VCALIB, 0x08 | CH_NEED_VREF | CH_NEED_VCALIB, 0x0A | CH_NEED_VREF | CH_NEED_VCALIB, 0x03 | CH_NEED_VCALIB); #endif if (!ipcinfo->therm_adc_handle) { ret = -ENOMEM; goto alloc_fail; } /* Register each sensor with the generic thermal framework*/ for (i = 0; i < MSIC_THERMAL_SENSORS; i++) { ipcinfo->tzd[i] = thermal_zone_device_register(name[i], 0, 0, initialize_sensor(i), &tzd_ops, 0, 0, 0, 0); if (IS_ERR(ipcinfo->tzd[i])) goto reg_fail; } ipcinfo->ipcdev = ipcdev; ipc_set_drvdata(ipcdev, ipcinfo); return 0; reg_fail: ret = PTR_ERR(ipcinfo->tzd[i]); while (--i >= 0) thermal_zone_device_unregister(ipcinfo->tzd[i]); alloc_fail: kfree(ipcinfo); return ret; }
/** * mid_thermal_remove - mfld thermal finalize * @dev: ipc device structure * * MLFD thermal remove unregisters all the sensors from the generic * thermal framework. Can sleep. */ static int mid_thermal_remove(struct ipc_device *ipcdev) { int i; for (i = 0; i < MSIC_THERMAL_SENSORS; i++) thermal_zone_device_unregister(ipcinfo->tzd[i]); /* Free the allocated ADC channels */ if (ipcinfo->therm_adc_handle) intel_mid_gpadc_free(ipcinfo->therm_adc_handle); kfree(ipcinfo); ipc_set_drvdata(ipcdev, NULL); return 0; }
int platform_ipc_init(struct ipc *ipc) { struct ipc_data *iipc; _ipc = ipc; /* init ipc data */ iipc = malloc(sizeof(struct ipc_data)); ipc_set_drvdata(_ipc, iipc); /* allocate page table buffer */ iipc->dh_buffer.page_table = malloc(HOST_PAGE_SIZE); if (iipc->dh_buffer.page_table) bzero(iipc->dh_buffer.page_table, HOST_PAGE_SIZE); return 0; }