Lines Matching refs:cdev
33 struct catpt_dev *cdev = dev_get_drvdata(dev); in catpt_suspend() local
37 chan = catpt_dma_request_config_chan(cdev); in catpt_suspend()
41 memset(&cdev->dx_ctx, 0, sizeof(cdev->dx_ctx)); in catpt_suspend()
42 ret = catpt_ipc_enter_dxstate(cdev, CATPT_DX_STATE_D3, &cdev->dx_ctx); in catpt_suspend()
48 ret = catpt_dsp_stall(cdev, true); in catpt_suspend()
52 ret = catpt_store_memdumps(cdev, chan); in catpt_suspend()
54 dev_err(cdev->dev, "store memdumps failed: %d\n", ret); in catpt_suspend()
58 ret = catpt_store_module_states(cdev, chan); in catpt_suspend()
60 dev_err(cdev->dev, "store module states failed: %d\n", ret); in catpt_suspend()
64 ret = catpt_store_streams_context(cdev, chan); in catpt_suspend()
66 dev_err(cdev->dev, "store streams ctx failed: %d\n", ret); in catpt_suspend()
72 return catpt_dsp_power_down(cdev); in catpt_suspend()
77 struct catpt_dev *cdev = dev_get_drvdata(dev); in catpt_resume() local
80 ret = catpt_dsp_power_up(cdev); in catpt_resume()
90 ret = catpt_boot_firmware(cdev, true); in catpt_resume()
92 dev_err(cdev->dev, "boot firmware failed: %d\n", ret); in catpt_resume()
98 if (cdev->devfmt[i].iface == UINT_MAX) in catpt_resume()
101 ret = catpt_ipc_set_device_format(cdev, &cdev->devfmt[i]); in catpt_resume()
136 static int catpt_register_board(struct catpt_dev *cdev) in catpt_register_board() argument
138 const struct catpt_spec *spec = cdev->spec; in catpt_register_board()
144 dev_info(cdev->dev, "no machines present\n"); in catpt_register_board()
153 dev_err(cdev->dev, "board register failed\n"); in catpt_register_board()
157 return devm_add_action_or_reset(cdev->dev, board_pdev_unregister, in catpt_register_board()
161 static int catpt_probe_components(struct catpt_dev *cdev) in catpt_probe_components() argument
165 ret = catpt_dsp_power_up(cdev); in catpt_probe_components()
169 ret = catpt_dmac_probe(cdev); in catpt_probe_components()
171 dev_err(cdev->dev, "DMAC probe failed: %d\n", ret); in catpt_probe_components()
175 ret = catpt_first_boot_firmware(cdev); in catpt_probe_components()
177 dev_err(cdev->dev, "first fw boot failed: %d\n", ret); in catpt_probe_components()
181 ret = catpt_register_plat_component(cdev); in catpt_probe_components()
183 dev_err(cdev->dev, "register plat comp failed: %d\n", ret); in catpt_probe_components()
187 ret = catpt_register_board(cdev); in catpt_probe_components()
189 dev_err(cdev->dev, "register board failed: %d\n", ret); in catpt_probe_components()
194 pm_runtime_set_active(cdev->dev); in catpt_probe_components()
196 pm_runtime_set_autosuspend_delay(cdev->dev, 2000); in catpt_probe_components()
197 pm_runtime_use_autosuspend(cdev->dev); in catpt_probe_components()
198 pm_runtime_mark_last_busy(cdev->dev); in catpt_probe_components()
199 pm_runtime_enable(cdev->dev); in catpt_probe_components()
203 snd_soc_unregister_component(cdev->dev); in catpt_probe_components()
205 catpt_dmac_remove(cdev); in catpt_probe_components()
207 catpt_dsp_power_down(cdev); in catpt_probe_components()
212 static void catpt_dev_init(struct catpt_dev *cdev, struct device *dev, in catpt_dev_init() argument
215 cdev->dev = dev; in catpt_dev_init()
216 cdev->spec = spec; in catpt_dev_init()
217 init_completion(&cdev->fw_ready); in catpt_dev_init()
218 INIT_LIST_HEAD(&cdev->stream_list); in catpt_dev_init()
219 spin_lock_init(&cdev->list_lock); in catpt_dev_init()
220 mutex_init(&cdev->clk_mutex); in catpt_dev_init()
226 cdev->devfmt[CATPT_SSP_IFACE_0].iface = UINT_MAX; in catpt_dev_init()
227 cdev->devfmt[CATPT_SSP_IFACE_1].iface = UINT_MAX; in catpt_dev_init()
229 catpt_ipc_init(&cdev->ipc, dev); in catpt_dev_init()
231 catpt_sram_init(&cdev->dram, spec->host_dram_offset, in catpt_dev_init()
232 catpt_dram_size(cdev)); in catpt_dev_init()
233 catpt_sram_init(&cdev->iram, spec->host_iram_offset, in catpt_dev_init()
234 catpt_iram_size(cdev)); in catpt_dev_init()
240 struct catpt_dev *cdev; in catpt_acpi_probe() local
256 cdev = devm_kzalloc(dev, sizeof(*cdev), GFP_KERNEL); in catpt_acpi_probe()
257 if (!cdev) in catpt_acpi_probe()
261 catpt_dev_init(cdev, dev, spec); in catpt_acpi_probe()
264 cdev->lpe_ba = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in catpt_acpi_probe()
265 if (IS_ERR(cdev->lpe_ba)) in catpt_acpi_probe()
266 return PTR_ERR(cdev->lpe_ba); in catpt_acpi_probe()
267 cdev->lpe_base = res->start; in catpt_acpi_probe()
270 cdev->pci_ba = devm_platform_ioremap_resource(pdev, 1); in catpt_acpi_probe()
271 if (IS_ERR(cdev->pci_ba)) in catpt_acpi_probe()
272 return PTR_ERR(cdev->pci_ba); in catpt_acpi_probe()
275 cdev->dxbuf_vaddr = dmam_alloc_coherent(dev, catpt_dram_size(cdev), in catpt_acpi_probe()
276 &cdev->dxbuf_paddr, GFP_KERNEL); in catpt_acpi_probe()
277 if (!cdev->dxbuf_vaddr) in catpt_acpi_probe()
283 cdev->irq = ret; in catpt_acpi_probe()
285 platform_set_drvdata(pdev, cdev); in catpt_acpi_probe()
287 ret = devm_request_threaded_irq(dev, cdev->irq, catpt_dsp_irq_handler, in catpt_acpi_probe()
289 IRQF_SHARED, "AudioDSP", cdev); in catpt_acpi_probe()
293 return catpt_probe_components(cdev); in catpt_acpi_probe()
298 struct catpt_dev *cdev = platform_get_drvdata(pdev); in catpt_acpi_remove() local
300 pm_runtime_disable(cdev->dev); in catpt_acpi_remove()
302 snd_soc_unregister_component(cdev->dev); in catpt_acpi_remove()
303 catpt_dmac_remove(cdev); in catpt_acpi_remove()
304 catpt_dsp_power_down(cdev); in catpt_acpi_remove()
306 catpt_sram_free(&cdev->iram); in catpt_acpi_remove()
307 catpt_sram_free(&cdev->dram); in catpt_acpi_remove()