Lines Matching refs:cdev
34 struct catpt_dev *cdev = dev_get_drvdata(dev); in catpt_suspend() local
38 chan = catpt_dma_request_config_chan(cdev); in catpt_suspend()
42 memset(&cdev->dx_ctx, 0, sizeof(cdev->dx_ctx)); in catpt_suspend()
43 ret = catpt_ipc_enter_dxstate(cdev, CATPT_DX_STATE_D3, &cdev->dx_ctx); in catpt_suspend()
49 ret = catpt_dsp_stall(cdev, true); in catpt_suspend()
53 ret = catpt_store_memdumps(cdev, chan); in catpt_suspend()
55 dev_err(cdev->dev, "store memdumps failed: %d\n", ret); in catpt_suspend()
59 ret = catpt_store_module_states(cdev, chan); in catpt_suspend()
61 dev_err(cdev->dev, "store module states failed: %d\n", ret); in catpt_suspend()
65 ret = catpt_store_streams_context(cdev, chan); in catpt_suspend()
67 dev_err(cdev->dev, "store streams ctx failed: %d\n", ret); in catpt_suspend()
73 return catpt_dsp_power_down(cdev); in catpt_suspend()
78 struct catpt_dev *cdev = dev_get_drvdata(dev); in catpt_resume() local
81 ret = catpt_dsp_power_up(cdev); in catpt_resume()
91 ret = catpt_boot_firmware(cdev, true); in catpt_resume()
93 dev_err(cdev->dev, "boot firmware failed: %d\n", ret); in catpt_resume()
99 if (cdev->devfmt[i].iface == UINT_MAX) in catpt_resume()
102 ret = catpt_ipc_set_device_format(cdev, &cdev->devfmt[i]); in catpt_resume()
137 static int catpt_register_board(struct catpt_dev *cdev) in catpt_register_board() argument
139 const struct catpt_spec *spec = cdev->spec; in catpt_register_board()
145 dev_info(cdev->dev, "no machines present\n"); in catpt_register_board()
154 dev_err(cdev->dev, "board register failed\n"); in catpt_register_board()
158 return devm_add_action_or_reset(cdev->dev, board_pdev_unregister, in catpt_register_board()
162 static int catpt_probe_components(struct catpt_dev *cdev) in catpt_probe_components() argument
166 ret = catpt_dsp_power_up(cdev); in catpt_probe_components()
170 ret = catpt_dmac_probe(cdev); in catpt_probe_components()
172 dev_err(cdev->dev, "DMAC probe failed: %d\n", ret); in catpt_probe_components()
176 ret = catpt_first_boot_firmware(cdev); in catpt_probe_components()
178 dev_err(cdev->dev, "first fw boot failed: %d\n", ret); in catpt_probe_components()
182 ret = catpt_register_plat_component(cdev); in catpt_probe_components()
184 dev_err(cdev->dev, "register plat comp failed: %d\n", ret); in catpt_probe_components()
188 ret = catpt_register_board(cdev); in catpt_probe_components()
190 dev_err(cdev->dev, "register board failed: %d\n", ret); in catpt_probe_components()
195 pm_runtime_set_active(cdev->dev); in catpt_probe_components()
197 pm_runtime_set_autosuspend_delay(cdev->dev, 2000); in catpt_probe_components()
198 pm_runtime_use_autosuspend(cdev->dev); in catpt_probe_components()
199 pm_runtime_mark_last_busy(cdev->dev); in catpt_probe_components()
200 pm_runtime_enable(cdev->dev); in catpt_probe_components()
204 snd_soc_unregister_component(cdev->dev); in catpt_probe_components()
206 catpt_dmac_remove(cdev); in catpt_probe_components()
208 catpt_dsp_power_down(cdev); in catpt_probe_components()
213 static void catpt_dev_init(struct catpt_dev *cdev, struct device *dev, in catpt_dev_init() argument
216 cdev->dev = dev; in catpt_dev_init()
217 cdev->spec = spec; in catpt_dev_init()
218 init_completion(&cdev->fw_ready); in catpt_dev_init()
219 INIT_LIST_HEAD(&cdev->stream_list); in catpt_dev_init()
220 spin_lock_init(&cdev->list_lock); in catpt_dev_init()
221 mutex_init(&cdev->clk_mutex); in catpt_dev_init()
227 cdev->devfmt[CATPT_SSP_IFACE_0].iface = UINT_MAX; in catpt_dev_init()
228 cdev->devfmt[CATPT_SSP_IFACE_1].iface = UINT_MAX; in catpt_dev_init()
230 catpt_ipc_init(&cdev->ipc, dev); in catpt_dev_init()
232 catpt_sram_init(&cdev->dram, spec->host_dram_offset, in catpt_dev_init()
233 catpt_dram_size(cdev)); in catpt_dev_init()
234 catpt_sram_init(&cdev->iram, spec->host_iram_offset, in catpt_dev_init()
235 catpt_iram_size(cdev)); in catpt_dev_init()
241 struct catpt_dev *cdev; in catpt_acpi_probe() local
261 cdev = devm_kzalloc(dev, sizeof(*cdev), GFP_KERNEL); in catpt_acpi_probe()
262 if (!cdev) in catpt_acpi_probe()
265 catpt_dev_init(cdev, dev, spec); in catpt_acpi_probe()
268 cdev->lpe_ba = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in catpt_acpi_probe()
269 if (IS_ERR(cdev->lpe_ba)) in catpt_acpi_probe()
270 return PTR_ERR(cdev->lpe_ba); in catpt_acpi_probe()
271 cdev->lpe_base = res->start; in catpt_acpi_probe()
274 cdev->pci_ba = devm_platform_ioremap_resource(pdev, 1); in catpt_acpi_probe()
275 if (IS_ERR(cdev->pci_ba)) in catpt_acpi_probe()
276 return PTR_ERR(cdev->pci_ba); in catpt_acpi_probe()
279 cdev->dxbuf_vaddr = dmam_alloc_coherent(dev, catpt_dram_size(cdev), in catpt_acpi_probe()
280 &cdev->dxbuf_paddr, GFP_KERNEL); in catpt_acpi_probe()
281 if (!cdev->dxbuf_vaddr) in catpt_acpi_probe()
287 cdev->irq = ret; in catpt_acpi_probe()
289 platform_set_drvdata(pdev, cdev); in catpt_acpi_probe()
291 ret = devm_request_threaded_irq(dev, cdev->irq, catpt_dsp_irq_handler, in catpt_acpi_probe()
293 IRQF_SHARED, "AudioDSP", cdev); in catpt_acpi_probe()
297 return catpt_probe_components(cdev); in catpt_acpi_probe()
302 struct catpt_dev *cdev = platform_get_drvdata(pdev); in catpt_acpi_remove() local
304 pm_runtime_disable(cdev->dev); in catpt_acpi_remove()
306 snd_soc_unregister_component(cdev->dev); in catpt_acpi_remove()
307 catpt_dmac_remove(cdev); in catpt_acpi_remove()
308 catpt_dsp_power_down(cdev); in catpt_acpi_remove()
310 catpt_sram_free(&cdev->iram); in catpt_acpi_remove()
311 catpt_sram_free(&cdev->dram); in catpt_acpi_remove()