Lines Matching refs:drv
57 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_regmap_writeable() local
59 return sdca_regmap_writeable(drv->function, reg); in class_function_regmap_writeable()
65 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_regmap_readable() local
67 return sdca_regmap_readable(drv->function, reg); in class_function_regmap_readable()
73 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_regmap_volatile() local
75 return sdca_regmap_volatile(drv->function, reg); in class_function_regmap_volatile()
99 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_regmap_mbq_size() local
101 return sdca_regmap_mbq_size(drv->function, reg); in class_function_regmap_mbq_size()
107 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_regmap_deferrable() local
109 return sdca_regmap_deferrable(drv->function, reg); in class_function_regmap_deferrable()
122 struct class_function_drv *drv = snd_soc_component_get_drvdata(dai->component); in class_function_startup() local
124 return sdca_asoc_set_constraints(drv->dev, drv->regmap, drv->function, in class_function_startup()
132 struct class_function_drv *drv = snd_soc_component_get_drvdata(dai->component); in class_function_sdw_add_peripheral() local
134 struct sdw_slave *sdw = dev_to_sdw_dev(drv->dev->parent); in class_function_sdw_add_peripheral()
148 ret = sdca_asoc_get_port(drv->dev, drv->regmap, drv->function, dai); in class_function_sdw_add_peripheral()
156 dev_err(drv->dev, "failed to add sdw stream: %d\n", ret); in class_function_sdw_add_peripheral()
160 return sdca_asoc_hw_params(drv->dev, drv->regmap, drv->function, in class_function_sdw_add_peripheral()
167 struct class_function_drv *drv = snd_soc_component_get_drvdata(dai->component); in class_function_sdw_remove_peripheral() local
169 struct sdw_slave *sdw = dev_to_sdw_dev(drv->dev->parent); in class_function_sdw_remove_peripheral()
195 struct class_function_drv *drv = snd_soc_component_get_drvdata(component); in class_function_component_probe() local
196 struct sdca_class_drv *core = drv->core; in class_function_component_probe()
198 return sdca_irq_populate(drv->function, component, core->irq_info); in class_function_component_probe()
203 struct class_function_drv *drv = snd_soc_component_get_drvdata(component); in class_function_component_remove() local
204 struct sdca_class_drv *core = drv->core; in class_function_component_remove()
206 sdca_irq_cleanup(component->dev, drv->function, core->irq_info); in class_function_component_remove()
212 struct class_function_drv *drv = snd_soc_component_get_drvdata(component); in class_function_set_jack() local
213 struct sdca_class_drv *core = drv->core; in class_function_set_jack()
224 static int class_function_init_device(struct class_function_drv *drv, in class_function_init_device() argument
230 dev_dbg(drv->dev, "reset function device\n"); in class_function_init_device()
232 ret = sdca_reset_function(drv->dev, drv->function, drv->regmap); in class_function_init_device()
238 dev_dbg(drv->dev, "write initialisation\n"); in class_function_init_device()
240 ret = sdca_regmap_write_init(drv->dev, drv->core->dev_regmap, in class_function_init_device()
241 drv->function); in class_function_init_device()
249 static int class_function_boot(struct class_function_drv *drv) in class_function_boot() argument
251 unsigned int reg = SDW_SDCA_CTL(drv->function->desc->adr, in class_function_boot()
257 guard(mutex)(&drv->core->init_lock); in class_function_boot()
259 ret = regmap_read(drv->regmap, reg, &val); in class_function_boot()
261 dev_err(drv->dev, "failed to read function status: %d\n", ret); in class_function_boot()
265 ret = class_function_init_device(drv, val); in class_function_boot()
270 ret = sdca_irq_populate_early(drv->dev, drv->regmap, drv->function, in class_function_boot()
271 drv->core->irq_info); in class_function_boot()
275 ret = sdca_fdl_sync(drv->dev, drv->function, drv->core->irq_info); in class_function_boot()
279 ret = sdca_regmap_write_defaults(drv->dev, drv->regmap, drv->function); in class_function_boot()
283 ret = regmap_write(drv->regmap, reg, 0xFF); in class_function_boot()
285 dev_err(drv->dev, "failed to clear function status: %d\n", ret); in class_function_boot()
301 struct class_function_drv *drv; in class_function_probe() local
310 drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); in class_function_probe()
311 if (!drv) in class_function_probe()
329 drv->dev = dev; in class_function_probe()
330 drv->core = core; in class_function_probe()
343 drv->function = &core->functions[i]; in class_function_probe()
345 ret = sdca_parse_function(dev, core->sdw, desc, drv->function); in class_function_probe()
349 ndefaults = sdca_regmap_count_constants(dev, drv->function); in class_function_probe()
357 ret = sdca_regmap_populate_constants(dev, drv->function, defaults); in class_function_probe()
363 auxiliary_set_drvdata(auxdev, drv); in class_function_probe()
369 if (drv->function->busy_max_delay) { in class_function_probe()
370 mbq_config->timeout_us = drv->function->busy_max_delay; in class_function_probe()
371 mbq_config->retry_us = umax(drv->function->busy_max_delay / 10, in class_function_probe()
375 drv->regmap = devm_regmap_init_sdw_mbq_cfg(dev, core->sdw, config, mbq_config); in class_function_probe()
376 if (IS_ERR(drv->regmap)) in class_function_probe()
377 return dev_err_probe(dev, PTR_ERR(drv->regmap), in class_function_probe()
383 ret = sdca_asoc_populate_component(dev, drv->function, cmp_drv, in class_function_probe()
400 ret = class_function_boot(drv); in class_function_probe()
416 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_remove() local
418 sdca_irq_cleanup(drv->dev, drv->function, drv->core->irq_info); in class_function_remove()
424 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_runtime_suspend() local
431 regcache_cache_only(drv->regmap, true); in class_function_runtime_suspend()
439 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_runtime_resume() local
442 guard(mutex)(&drv->core->init_lock); in class_function_runtime_resume()
444 regcache_mark_dirty(drv->regmap); in class_function_runtime_resume()
445 regcache_cache_only(drv->regmap, false); in class_function_runtime_resume()
447 if (drv->suspended) { in class_function_runtime_resume()
448 unsigned int reg = SDW_SDCA_CTL(drv->function->desc->adr, in class_function_runtime_resume()
453 ret = regmap_read(drv->regmap, reg, &val); in class_function_runtime_resume()
455 dev_err(drv->dev, "failed to read function status: %d\n", ret); in class_function_runtime_resume()
459 ret = class_function_init_device(drv, val); in class_function_runtime_resume()
463 sdca_irq_enable_early(drv->function, drv->core->irq_info); in class_function_runtime_resume()
465 ret = sdca_fdl_sync(drv->dev, drv->function, drv->core->irq_info); in class_function_runtime_resume()
469 sdca_irq_enable(drv->function, drv->core->irq_info); in class_function_runtime_resume()
471 ret = regmap_write(drv->regmap, reg, 0xFF); in class_function_runtime_resume()
473 dev_err(drv->dev, "failed to clear function status: %d\n", ret); in class_function_runtime_resume()
477 drv->suspended = false; in class_function_runtime_resume()
480 ret = regcache_sync(drv->regmap); in class_function_runtime_resume()
482 dev_err(drv->dev, "failed to restore register cache: %d\n", ret); in class_function_runtime_resume()
489 regcache_cache_only(drv->regmap, true); in class_function_runtime_resume()
497 struct class_function_drv *drv = auxiliary_get_drvdata(auxdev); in class_function_suspend() local
500 drv->suspended = true; in class_function_suspend()
509 sdca_irq_disable(drv->function, drv->core->irq_info); in class_function_suspend()