Lines Matching +full:tempmon +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0-only
16 /* These are not reset by a soft-reset, so patch to defaults. */
24 return regmap_register_patch(cs35l56_base->regmap, cs35l56_patch, in cs35l56_set_patch()
219 ret = regmap_read(cs35l56_base->regmap, asp1_regs[i].reg, &asp1_regs[i].def); in cs35l56_force_sync_asp1_registers_from_cache()
224 /* Write the values cache-bypassed so that they will be written to silicon */ in cs35l56_force_sync_asp1_registers_from_cache()
225 ret = regmap_multi_reg_write_bypassed(cs35l56_base->regmap, asp1_regs, in cs35l56_force_sync_asp1_registers_from_cache()
233 dev_err(cs35l56_base->dev, "Failed to sync ASP1 registers: %d\n", ret); in cs35l56_force_sync_asp1_registers_from_cache()
244 regmap_write(cs35l56_base->regmap, CS35L56_DSP_VIRTUAL1_MBOX_1, command); in cs35l56_mbox_send()
245 ret = regmap_read_poll_timeout(cs35l56_base->regmap, CS35L56_DSP_VIRTUAL1_MBOX_1, in cs35l56_mbox_send()
249 dev_warn(cs35l56_base->dev, "MBOX command %#x failed: %d\n", command, ret); in cs35l56_mbox_send()
267 if (cs35l56_base->rev < CS35L56_REVID_B0) in cs35l56_firmware_shutdown()
272 ret = regmap_read_poll_timeout(cs35l56_base->regmap, reg, in cs35l56_firmware_shutdown()
277 dev_err(cs35l56_base->dev, "Failed to poll PM_CUR_STATE to 1 is %d (ret %d)\n", in cs35l56_firmware_shutdown()
289 if (cs35l56_base->rev < CS35L56_REVID_B0) in cs35l56_wait_for_firmware_boot()
303 cs35l56_base->regmap, reg, &val); in cs35l56_wait_for_firmware_boot()
306 dev_err(cs35l56_base->dev, "Firmware boot timed out(%d): HALO_STATE=%#x\n", in cs35l56_wait_for_firmware_boot()
308 return -EIO; in cs35l56_wait_for_firmware_boot()
337 * Must enter cache-only first so there can't be any more register in cs35l56_system_reset()
340 regcache_cache_only(cs35l56_base->regmap, true); in cs35l56_system_reset()
341 regmap_multi_reg_write_bypassed(cs35l56_base->regmap, in cs35l56_system_reset()
345 /* On SoundWire the registers won't be accessible until it re-enumerates. */ in cs35l56_system_reset()
350 regcache_cache_only(cs35l56_base->regmap, false); in cs35l56_system_reset()
361 ret = devm_request_threaded_irq(cs35l56_base->dev, irq, NULL, cs35l56_irq, in cs35l56_irq_request()
365 cs35l56_base->irq = irq; in cs35l56_irq_request()
367 dev_err(cs35l56_base->dev, "Failed to get IRQ: %d\n", ret); in cs35l56_irq_request()
373 irqreturn_t cs35l56_irq(int irq, void *data) in cs35l56_irq() argument
375 struct cs35l56_base *cs35l56_base = data; in cs35l56_irq()
383 if (!cs35l56_base->init_done) in cs35l56_irq()
386 mutex_lock(&cs35l56_base->irq_lock); in cs35l56_irq()
388 rv = pm_runtime_resume_and_get(cs35l56_base->dev); in cs35l56_irq()
390 dev_err(cs35l56_base->dev, "irq: failed to get pm_runtime: %d\n", rv); in cs35l56_irq()
394 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_STATUS, &val); in cs35l56_irq()
396 dev_dbg(cs35l56_base->dev, "Spurious IRQ: no pending interrupt\n"); in cs35l56_irq()
401 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_EINT_1, &status1); in cs35l56_irq()
402 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_MASK_1, &mask1); in cs35l56_irq()
404 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_EINT_1, status1); in cs35l56_irq()
406 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_EINT_8, &status8); in cs35l56_irq()
407 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_MASK_8, &mask8); in cs35l56_irq()
409 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_EINT_8, status8); in cs35l56_irq()
411 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_EINT_20, &status20); in cs35l56_irq()
412 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_MASK_20, &mask20); in cs35l56_irq()
415 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_MASK_20, 0xffffffff); in cs35l56_irq()
417 dev_dbg(cs35l56_base->dev, "%s: %#x %#x\n", __func__, status1, status8); in cs35l56_irq()
424 dev_crit(cs35l56_base->dev, "Amp short error\n"); in cs35l56_irq()
427 dev_crit(cs35l56_base->dev, "Overtemp error\n"); in cs35l56_irq()
432 pm_runtime_put(cs35l56_base->dev); in cs35l56_irq()
434 mutex_unlock(&cs35l56_base->irq_lock); in cs35l56_irq()
445 /* Nothing to re-patch if we haven't done any patching yet. */ in cs35l56_is_fw_reload_needed()
446 if (!cs35l56_base->fw_patched) in cs35l56_is_fw_reload_needed()
451 * will need re-patching. in cs35l56_is_fw_reload_needed()
453 if (cs35l56_base->reset_gpio) in cs35l56_is_fw_reload_needed()
459 * Assume that tuning must be re-loaded. in cs35l56_is_fw_reload_needed()
461 if (cs35l56_base->secured) in cs35l56_is_fw_reload_needed()
464 ret = pm_runtime_resume_and_get(cs35l56_base->dev); in cs35l56_is_fw_reload_needed()
466 dev_err(cs35l56_base->dev, "Failed to runtime_get: %d\n", ret); in cs35l56_is_fw_reload_needed()
470 ret = regmap_read(cs35l56_base->regmap, CS35L56_PROTECTION_STATUS, &val); in cs35l56_is_fw_reload_needed()
472 dev_err(cs35l56_base->dev, "Failed to read PROTECTION_STATUS: %d\n", ret); in cs35l56_is_fw_reload_needed()
476 pm_runtime_put_autosuspend(cs35l56_base->dev); in cs35l56_is_fw_reload_needed()
496 if (!cs35l56_base->init_done) in cs35l56_runtime_suspend_common()
499 /* Firmware must have entered a power-save state */ in cs35l56_runtime_suspend_common()
500 ret = regmap_read_poll_timeout(cs35l56_base->regmap, in cs35l56_runtime_suspend_common()
506 dev_warn(cs35l56_base->dev, "PS3 wait failed: %d\n", ret); in cs35l56_runtime_suspend_common()
509 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_EINT_4, CS35L56_OTP_BOOT_DONE_MASK); in cs35l56_runtime_suspend_common()
511 if (!cs35l56_base->can_hibernate) { in cs35l56_runtime_suspend_common()
512 regcache_cache_only(cs35l56_base->regmap, true); in cs35l56_runtime_suspend_common()
513 dev_dbg(cs35l56_base->dev, "Suspended: no hibernate"); in cs35l56_runtime_suspend_common()
519 * Enable auto-hibernate. If it is woken by some other wake source in cs35l56_runtime_suspend_common()
525 * Must enter cache-only first so there can't be any more register in cs35l56_runtime_suspend_common()
528 regcache_cache_only(cs35l56_base->regmap, true); in cs35l56_runtime_suspend_common()
530 regmap_multi_reg_write_bypassed(cs35l56_base->regmap, in cs35l56_runtime_suspend_common()
534 dev_dbg(cs35l56_base->dev, "Suspended: hibernate"); in cs35l56_runtime_suspend_common()
545 if (!cs35l56_base->init_done) in cs35l56_runtime_resume_common()
548 if (!cs35l56_base->can_hibernate) in cs35l56_runtime_resume_common()
553 * Dummy transaction to trigger I2C/SPI auto-wake. This will NAK on I2C. in cs35l56_runtime_resume_common()
554 * Must be done before releasing cache-only. in cs35l56_runtime_resume_common()
556 regmap_multi_reg_write_bypassed(cs35l56_base->regmap, in cs35l56_runtime_resume_common()
564 regcache_cache_only(cs35l56_base->regmap, false); in cs35l56_runtime_resume_common()
568 dev_err(cs35l56_base->dev, "Hibernate wake failed: %d\n", ret); in cs35l56_runtime_resume_common()
577 regmap_read(cs35l56_base->regmap, CS35L56_IRQ1_EINT_4, &val); in cs35l56_runtime_resume_common()
579 dev_dbg(cs35l56_base->dev, "Registers reset in suspend\n"); in cs35l56_runtime_resume_common()
580 regcache_mark_dirty(cs35l56_base->regmap); in cs35l56_runtime_resume_common()
583 regcache_sync(cs35l56_base->regmap); in cs35l56_runtime_resume_common()
585 dev_dbg(cs35l56_base->dev, "Resumed"); in cs35l56_runtime_resume_common()
590 regmap_write(cs35l56_base->regmap, CS35L56_DSP_VIRTUAL1_MBOX_1, in cs35l56_runtime_resume_common()
593 regcache_cache_only(cs35l56_base->regmap, true); in cs35l56_runtime_resume_common()
609 cs_dsp->num = 1; in cs35l56_init_cs_dsp()
610 cs_dsp->type = WMFW_HALO; in cs35l56_init_cs_dsp()
611 cs_dsp->rev = 0; in cs35l56_init_cs_dsp()
612 cs_dsp->dev = cs35l56_base->dev; in cs35l56_init_cs_dsp()
613 cs_dsp->regmap = cs35l56_base->regmap; in cs35l56_init_cs_dsp()
614 cs_dsp->base = CS35L56_DSP1_CORE_BASE; in cs35l56_init_cs_dsp()
615 cs_dsp->base_sysinfo = CS35L56_DSP1_SYS_INFO_ID; in cs35l56_init_cs_dsp()
616 cs_dsp->mem = cs35l56_dsp1_regions; in cs35l56_init_cs_dsp()
617 cs_dsp->num_mems = ARRAY_SIZE(cs35l56_dsp1_regions); in cs35l56_init_cs_dsp()
618 cs_dsp->no_core_startstop = true; in cs35l56_init_cs_dsp()
631 if (!cs35l56_base->reset_gpio) in cs35l56_hw_init()
632 regmap_read(cs35l56_base->regmap, CS35L56_DSP_VIRTUAL1_MBOX_1, &devid); in cs35l56_hw_init()
641 ret = regmap_read(cs35l56_base->regmap, CS35L56_REVID, &revid); in cs35l56_hw_init()
643 dev_err(cs35l56_base->dev, "Get Revision ID failed\n"); in cs35l56_hw_init()
646 cs35l56_base->rev = revid & (CS35L56_AREVID_MASK | CS35L56_MTLREVID_MASK); in cs35l56_hw_init()
652 ret = regmap_read(cs35l56_base->regmap, CS35L56_DEVID, &devid); in cs35l56_hw_init()
654 dev_err(cs35l56_base->dev, "Get Device ID failed\n"); in cs35l56_hw_init()
663 dev_err(cs35l56_base->dev, "Unknown device %x\n", devid); in cs35l56_hw_init()
667 ret = regmap_read(cs35l56_base->regmap, CS35L56_DSP_RESTRICT_STS1, &secured); in cs35l56_hw_init()
669 dev_err(cs35l56_base->dev, "Get Secure status failed\n"); in cs35l56_hw_init()
675 cs35l56_base->secured = true; in cs35l56_hw_init()
677 ret = regmap_read(cs35l56_base->regmap, CS35L56_OTPID, &otpid); in cs35l56_hw_init()
679 dev_err(cs35l56_base->dev, "Get OTP ID failed\n"); in cs35l56_hw_init()
683 dev_info(cs35l56_base->dev, "Cirrus Logic CS35L56%s Rev %02X OTP%d\n", in cs35l56_hw_init()
684 cs35l56_base->secured ? "s" : "", cs35l56_base->rev, otpid); in cs35l56_hw_init()
687 regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_MASK_20, 0xffffffff); in cs35l56_hw_init()
688 regmap_update_bits(cs35l56_base->regmap, CS35L56_IRQ1_MASK_1, in cs35l56_hw_init()
691 regmap_update_bits(cs35l56_base->regmap, CS35L56_IRQ1_MASK_8, in cs35l56_hw_init()
706 descs = gpiod_get_array_optional(cs35l56_base->dev, "spk-id", GPIOD_IN); in cs35l56_get_speaker_id()
708 return -ENOENT; in cs35l56_get_speaker_id()
711 return dev_err_probe(cs35l56_base->dev, ret, "Failed to get spk-id-gpios\n"); in cs35l56_get_speaker_id()
715 for (i = 0; i < descs->ndescs; i++) { in cs35l56_get_speaker_id()
716 ret = gpiod_get_value_cansleep(descs->desc[i]); in cs35l56_get_speaker_id()
718 dev_err_probe(cs35l56_base->dev, ret, "Failed to read spk-id[%d]\n", i); in cs35l56_get_speaker_id()
725 dev_dbg(cs35l56_base->dev, "Speaker ID = %d\n", speaker_id); in cs35l56_get_speaker_id()
771 return -EINVAL; in cs35l56_get_bclk_freq_id()
779 return -EINVAL; in cs35l56_get_bclk_freq_id()
783 static const char * const cs35l56_supplies[/* auto-sized */] = {
789 void cs35l56_fill_supply_names(struct regulator_bulk_data *data) in cs35l56_fill_supply_names() argument
795 data[i].supply = cs35l56_supplies[i]; in cs35l56_fill_supply_names()
802 "DSP1TX5", "DSP1TX6", "DSP1TX7", "DSP1TX8", "TEMPMON",