Lines Matching refs:cs35l56
241 static int cs35l56_sdw_set_cal_index(struct cs35l56_private *cs35l56) in cs35l56_sdw_set_cal_index() argument
246 ret = sdw_read_no_pm(cs35l56->sdw_peripheral, SDW_SCP_DEVID_0); in cs35l56_sdw_set_cal_index()
250 cs35l56->base.cal_index = ret & 0xf; in cs35l56_sdw_set_cal_index()
257 struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev); in cs35l56_sdw_init() local
260 pm_runtime_get_noresume(cs35l56->base.dev); in cs35l56_sdw_init()
262 if (cs35l56->base.cal_index < 0) { in cs35l56_sdw_init()
263 ret = cs35l56_sdw_set_cal_index(cs35l56); in cs35l56_sdw_init()
268 ret = cs35l56_init(cs35l56); in cs35l56_sdw_init()
270 regcache_cache_only(cs35l56->base.regmap, true); in cs35l56_sdw_init()
278 if (cs35l56->base.init_done) { in cs35l56_sdw_init()
285 pm_runtime_mark_last_busy(cs35l56->base.dev); in cs35l56_sdw_init()
286 pm_runtime_put_autosuspend(cs35l56->base.dev); in cs35l56_sdw_init()
292 struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev); in cs35l56_sdw_interrupt() local
296 dev_dbg(cs35l56->base.dev, "int control_port=%#x\n", status->control_port); in cs35l56_sdw_interrupt()
305 pm_runtime_get_noresume(cs35l56->base.dev); in cs35l56_sdw_interrupt()
317 queue_work(system_power_efficient_wq, &cs35l56->sdw_irq_work); in cs35l56_sdw_interrupt()
324 struct cs35l56_private *cs35l56 = container_of(work, in cs35l56_sdw_irq_work() local
328 cs35l56_irq(-1, &cs35l56->base); in cs35l56_sdw_irq_work()
331 if (!cs35l56->sdw_irq_no_unmask) in cs35l56_sdw_irq_work()
332 sdw_write_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_MASK_1, in cs35l56_sdw_irq_work()
335 pm_runtime_put_autosuspend(cs35l56->base.dev); in cs35l56_sdw_irq_work()
340 struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev); in cs35l56_sdw_read_prop() local
344 ports = devm_kcalloc(cs35l56->base.dev, 2, sizeof(*ports), GFP_KERNEL); in cs35l56_sdw_read_prop()
372 struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev); in cs35l56_sdw_update_status() local
376 dev_dbg(cs35l56->base.dev, "%s: ATTACHED\n", __func__); in cs35l56_sdw_update_status()
377 if (cs35l56->sdw_attached) in cs35l56_sdw_update_status()
380 if (!cs35l56->base.init_done || cs35l56->soft_resetting) in cs35l56_sdw_update_status()
383 cs35l56->sdw_attached = true; in cs35l56_sdw_update_status()
386 dev_dbg(cs35l56->base.dev, "%s: UNATTACHED\n", __func__); in cs35l56_sdw_update_status()
387 cs35l56->sdw_attached = false; in cs35l56_sdw_update_status()
400 struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev); in cs35l56_sdw_clk_stop() local
402 dev_dbg(cs35l56->base.dev, "%s: mode:%d type:%d\n", __func__, mode, type); in cs35l56_sdw_clk_stop()
416 static int __maybe_unused cs35l56_sdw_handle_unattach(struct cs35l56_private *cs35l56) in cs35l56_sdw_handle_unattach() argument
418 struct sdw_slave *peripheral = cs35l56->sdw_peripheral; in cs35l56_sdw_handle_unattach()
422 dev_dbg(cs35l56->base.dev, "Wait for initialization_complete\n"); in cs35l56_sdw_handle_unattach()
425 dev_err(cs35l56->base.dev, "initialization_complete timed out\n"); in cs35l56_sdw_handle_unattach()
442 struct cs35l56_private *cs35l56 = dev_get_drvdata(dev); in cs35l56_sdw_runtime_suspend() local
444 if (!cs35l56->base.init_done) in cs35l56_sdw_runtime_suspend()
447 return cs35l56_runtime_suspend_common(&cs35l56->base); in cs35l56_sdw_runtime_suspend()
452 struct cs35l56_private *cs35l56 = dev_get_drvdata(dev); in cs35l56_sdw_runtime_resume() local
457 if (!cs35l56->base.init_done) in cs35l56_sdw_runtime_resume()
460 ret = cs35l56_sdw_handle_unattach(cs35l56); in cs35l56_sdw_runtime_resume()
464 ret = cs35l56_runtime_resume_common(&cs35l56->base, true); in cs35l56_sdw_runtime_resume()
469 sdw_write_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_MASK_1, in cs35l56_sdw_runtime_resume()
477 struct cs35l56_private *cs35l56 = dev_get_drvdata(dev); in cs35l56_sdw_system_suspend() local
479 if (!cs35l56->base.init_done) in cs35l56_sdw_system_suspend()
486 cs35l56->sdw_irq_no_unmask = true; in cs35l56_sdw_system_suspend()
487 flush_work(&cs35l56->sdw_irq_work); in cs35l56_sdw_system_suspend()
490 sdw_write_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_MASK_1, 0); in cs35l56_sdw_system_suspend()
491 sdw_read_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_STAT_1); in cs35l56_sdw_system_suspend()
492 sdw_write_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_STAT_1, 0xFF); in cs35l56_sdw_system_suspend()
493 flush_work(&cs35l56->sdw_irq_work); in cs35l56_sdw_system_suspend()
500 struct cs35l56_private *cs35l56 = dev_get_drvdata(dev); in cs35l56_sdw_system_resume() local
502 cs35l56->sdw_irq_no_unmask = false; in cs35l56_sdw_system_resume()
511 struct cs35l56_private *cs35l56; in cs35l56_sdw_probe() local
514 cs35l56 = devm_kzalloc(dev, sizeof(*cs35l56), GFP_KERNEL); in cs35l56_sdw_probe()
515 if (!cs35l56) in cs35l56_sdw_probe()
518 cs35l56->base.dev = dev; in cs35l56_sdw_probe()
519 cs35l56->sdw_peripheral = peripheral; in cs35l56_sdw_probe()
520 INIT_WORK(&cs35l56->sdw_irq_work, cs35l56_sdw_irq_work); in cs35l56_sdw_probe()
522 dev_set_drvdata(dev, cs35l56); in cs35l56_sdw_probe()
524 cs35l56->base.regmap = devm_regmap_init(dev, &cs35l56_regmap_bus_sdw, in cs35l56_sdw_probe()
526 if (IS_ERR(cs35l56->base.regmap)) { in cs35l56_sdw_probe()
527 ret = PTR_ERR(cs35l56->base.regmap); in cs35l56_sdw_probe()
532 regcache_cache_only(cs35l56->base.regmap, true); in cs35l56_sdw_probe()
534 ret = cs35l56_common_probe(cs35l56); in cs35l56_sdw_probe()
543 struct cs35l56_private *cs35l56 = dev_get_drvdata(&peripheral->dev); in cs35l56_sdw_remove() local
546 cs35l56->sdw_irq_no_unmask = true; in cs35l56_sdw_remove()
547 cancel_work_sync(&cs35l56->sdw_irq_work); in cs35l56_sdw_remove()
552 cs35l56_remove(cs35l56); in cs35l56_sdw_remove()