Lines Matching refs:max98396
350 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); in max98396_dai_set_fmt() local
402 ret = regmap_read(max98396->regmap, MAX98396_R210F_GLOBAL_EN, &status); in max98396_dai_set_fmt()
407 ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, ®); in max98396_dai_set_fmt()
413 ret = regmap_read(max98396->regmap, in max98396_dai_set_fmt()
422 max98396_global_enable_onoff(max98396->regmap, false); in max98396_dai_set_fmt()
425 regmap_update_bits(max98396->regmap, in max98396_dai_set_fmt()
429 regmap_update_bits(max98396->regmap, in max98396_dai_set_fmt()
435 max98396_global_enable_onoff(max98396->regmap, true); in max98396_dai_set_fmt()
509 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); in max98396_dai_hw_params() local
579 if (max98396->tdm_mode) { in max98396_dai_hw_params()
580 if (params_rate(params) > max98396->tdm_max_samplerate) { in max98396_dai_hw_params()
606 ret = regmap_read(max98396->regmap, MAX98396_R210F_GLOBAL_EN, &status); in max98396_dai_hw_params()
611 ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, ®); in max98396_dai_hw_params()
617 ret = regmap_read(max98396->regmap, MAX98396_R2043_PCM_SR_SETUP, ®); in max98396_dai_hw_params()
626 max98396_global_enable_onoff(max98396->regmap, false); in max98396_dai_hw_params()
630 regmap_update_bits(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, in max98396_dai_hw_params()
634 regmap_update_bits(max98396->regmap, MAX98396_R2043_PCM_SR_SETUP, in max98396_dai_hw_params()
638 if (max98396->interleave_mode && in max98396_dai_hw_params()
640 regmap_update_bits(max98396->regmap, in max98396_dai_hw_params()
646 regmap_update_bits(max98396->regmap, in max98396_dai_hw_params()
652 regmap_update_bits(max98396->regmap, in max98396_dai_hw_params()
658 max98396_global_enable_onoff(max98396->regmap, true); in max98396_dai_hw_params()
671 struct max98396_priv *max98396 = in max98396_dai_tdm_slot() local
680 max98396->tdm_mode = false; in max98396_dai_tdm_slot()
682 max98396->tdm_mode = true; in max98396_dai_tdm_slot()
693 max98396->tdm_max_samplerate = max98396_pcm_configs[ret].max_sr; in max98396_dai_tdm_slot()
712 ret = regmap_read(max98396->regmap, MAX98396_R210F_GLOBAL_EN, &status); in max98396_dai_tdm_slot()
717 ret = regmap_read(max98396->regmap, MAX98396_R2042_PCM_CLK_SETUP, ®); in max98396_dai_tdm_slot()
723 ret = regmap_read(max98396->regmap, MAX98396_R2041_PCM_MODE_CFG, ®); in max98396_dai_tdm_slot()
732 max98396_global_enable_onoff(max98396->regmap, false); in max98396_dai_tdm_slot()
735 regmap_update_bits(max98396->regmap, in max98396_dai_tdm_slot()
740 regmap_update_bits(max98396->regmap, in max98396_dai_tdm_slot()
745 if (max98396->device_id == CODEC_TYPE_MAX98396) { in max98396_dai_tdm_slot()
746 regmap_update_bits(max98396->regmap, in max98396_dai_tdm_slot()
750 regmap_update_bits(max98396->regmap, in max98396_dai_tdm_slot()
755 regmap_update_bits(max98396->regmap, in max98396_dai_tdm_slot()
759 regmap_update_bits(max98396->regmap, in max98396_dai_tdm_slot()
766 if (max98396->device_id == CODEC_TYPE_MAX98396) { in max98396_dai_tdm_slot()
767 regmap_write(max98396->regmap, in max98396_dai_tdm_slot()
770 regmap_write(max98396->regmap, in max98396_dai_tdm_slot()
774 regmap_write(max98396->regmap, in max98396_dai_tdm_slot()
777 regmap_write(max98396->regmap, in max98396_dai_tdm_slot()
783 max98396_global_enable_onoff(max98396->regmap, true); in max98396_dai_tdm_slot()
804 struct max98396_priv *max98396 = in max98396_dac_event() local
809 max98396_global_enable_onoff(max98396->regmap, true); in max98396_dac_event()
812 max98396_global_enable_onoff(max98396->regmap, false); in max98396_dac_event()
814 max98396->tdm_mode = false; in max98396_dac_event()
958 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); in max98396_mux_get() local
961 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_mux_get()
966 regmap_read(max98396->regmap, reg, &val); in max98396_mux_get()
979 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); in max98396_mux_put() local
990 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_mux_put()
999 regmap_update_bits(max98396->regmap, reg, in max98396_mux_put()
1112 struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); in max98396_adc_value_get() local
1121 if (max98396->device_id == CODEC_TYPE_MAX98397) { in max98396_adc_value_get()
1137 ret = regmap_raw_read(max98396->regmap, reg, &val, 2); in max98396_adc_value_get()
1351 static void max98396_reset(struct max98396_priv *max98396, struct device *dev) in max98396_reset() argument
1356 ret = regmap_write(max98396->regmap, in max98396_reset()
1365 ret = regmap_read(max98396->regmap, in max98396_reset()
1366 GET_REG_ADDR_REV_ID(max98396->device_id), ®); in max98396_reset()
1378 struct max98396_priv *max98396 = in max98396_probe() local
1382 max98396_reset(max98396, component->dev); in max98396_probe()
1385 if (max98396->device_id == CODEC_TYPE_MAX98396) { in max98396_probe()
1386 regmap_write(max98396->regmap, in max98396_probe()
1388 regmap_write(max98396->regmap, in max98396_probe()
1391 regmap_write(max98396->regmap, in max98396_probe()
1393 regmap_write(max98396->regmap, in max98396_probe()
1397 regmap_update_bits(max98396->regmap, in max98396_probe()
1400 (max98396->vbat == NULL) ? in max98396_probe()
1403 regmap_update_bits(max98396->regmap, in max98396_probe()
1406 regmap_update_bits(max98396->regmap, in max98396_probe()
1411 regmap_write(max98396->regmap, in max98396_probe()
1414 regmap_update_bits(max98396->regmap, in max98396_probe()
1417 regmap_update_bits(max98396->regmap, in max98396_probe()
1421 regmap_write(max98396->regmap, in max98396_probe()
1423 max98396->bypass_slot); in max98396_probe()
1425 regmap_write(max98396->regmap, in max98396_probe()
1427 max98396->v_slot); in max98396_probe()
1428 regmap_write(max98396->regmap, in max98396_probe()
1430 max98396->i_slot); in max98396_probe()
1431 regmap_write(max98396->regmap, in max98396_probe()
1433 max98396->spkfb_slot); in max98396_probe()
1435 if (max98396->v_slot < 8) in max98396_probe()
1436 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_probe()
1437 regmap_update_bits(max98396->regmap, in max98396_probe()
1439 1 << max98396->v_slot, 0); in max98396_probe()
1441 regmap_update_bits(max98396->regmap, in max98396_probe()
1443 1 << max98396->v_slot, 0); in max98396_probe()
1445 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_probe()
1446 regmap_update_bits(max98396->regmap, in max98396_probe()
1448 1 << (max98396->v_slot - 8), 0); in max98396_probe()
1450 regmap_update_bits(max98396->regmap, in max98396_probe()
1452 1 << (max98396->v_slot - 8), 0); in max98396_probe()
1454 if (max98396->i_slot < 8) in max98396_probe()
1455 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_probe()
1456 regmap_update_bits(max98396->regmap, in max98396_probe()
1458 1 << max98396->i_slot, 0); in max98396_probe()
1460 regmap_update_bits(max98396->regmap, in max98396_probe()
1462 1 << max98396->i_slot, 0); in max98396_probe()
1464 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_probe()
1465 regmap_update_bits(max98396->regmap, in max98396_probe()
1467 1 << (max98396->i_slot - 8), 0); in max98396_probe()
1469 regmap_update_bits(max98396->regmap, in max98396_probe()
1471 1 << (max98396->i_slot - 8), 0); in max98396_probe()
1474 if (max98396->interleave_mode) in max98396_probe()
1475 regmap_update_bits(max98396->regmap, in max98396_probe()
1480 regmap_update_bits(max98396->regmap, in max98396_probe()
1485 regmap_update_bits(max98396->regmap, in max98396_probe()
1488 max98396->dmon_stuck_enable ? in max98396_probe()
1491 regmap_update_bits(max98396->regmap, in max98396_probe()
1494 max98396->dmon_mag_enable ? in max98396_probe()
1497 switch (max98396->dmon_duration) { in max98396_probe()
1499 regmap_update_bits(max98396->regmap, in max98396_probe()
1504 regmap_update_bits(max98396->regmap, in max98396_probe()
1509 regmap_update_bits(max98396->regmap, in max98396_probe()
1514 regmap_update_bits(max98396->regmap, in max98396_probe()
1520 max98396->dmon_duration); in max98396_probe()
1523 switch (max98396->dmon_stuck_threshold) { in max98396_probe()
1525 regmap_update_bits(max98396->regmap, in max98396_probe()
1531 regmap_update_bits(max98396->regmap, in max98396_probe()
1537 regmap_update_bits(max98396->regmap, in max98396_probe()
1543 regmap_update_bits(max98396->regmap, in max98396_probe()
1550 max98396->dmon_stuck_threshold); in max98396_probe()
1553 switch (max98396->dmon_mag_threshold) { in max98396_probe()
1555 regmap_update_bits(max98396->regmap, in max98396_probe()
1558 (5 - max98396->dmon_mag_threshold) in max98396_probe()
1563 max98396->dmon_mag_threshold); in max98396_probe()
1567 regmap_update_bits(max98396->regmap, in max98396_probe()
1577 struct max98396_priv *max98396 = dev_get_drvdata(dev); in max98396_suspend() local
1579 regcache_cache_only(max98396->regmap, true); in max98396_suspend()
1580 regcache_mark_dirty(max98396->regmap); in max98396_suspend()
1582 max98396->core_supplies); in max98396_suspend()
1583 if (max98396->pvdd) in max98396_suspend()
1584 regulator_disable(max98396->pvdd); in max98396_suspend()
1586 if (max98396->vbat) in max98396_suspend()
1587 regulator_disable(max98396->vbat); in max98396_suspend()
1594 struct max98396_priv *max98396 = dev_get_drvdata(dev); in max98396_resume() local
1598 max98396->core_supplies); in max98396_resume()
1602 if (max98396->pvdd) { in max98396_resume()
1603 ret = regulator_enable(max98396->pvdd); in max98396_resume()
1608 if (max98396->vbat) { in max98396_resume()
1609 ret = regulator_enable(max98396->vbat); in max98396_resume()
1614 regcache_cache_only(max98396->regmap, false); in max98396_resume()
1615 max98396_reset(max98396, dev); in max98396_resume()
1616 regcache_sync(max98396->regmap); in max98396_resume()
1674 struct max98396_priv *max98396) in max98396_read_device_property() argument
1679 max98396->v_slot = value & 0xF; in max98396_read_device_property()
1681 max98396->v_slot = 0; in max98396_read_device_property()
1684 max98396->i_slot = value & 0xF; in max98396_read_device_property()
1686 max98396->i_slot = 1; in max98396_read_device_property()
1689 max98396->spkfb_slot = value & 0xF; in max98396_read_device_property()
1691 max98396->spkfb_slot = 2; in max98396_read_device_property()
1694 max98396->bypass_slot = value & 0xF; in max98396_read_device_property()
1696 max98396->bypass_slot = 0; in max98396_read_device_property()
1698 max98396->dmon_stuck_enable = in max98396_read_device_property()
1702 max98396->dmon_stuck_threshold = value; in max98396_read_device_property()
1704 max98396->dmon_stuck_threshold = 15; in max98396_read_device_property()
1706 max98396->dmon_mag_enable = in max98396_read_device_property()
1710 max98396->dmon_mag_threshold = value; in max98396_read_device_property()
1712 max98396->dmon_mag_threshold = 5; in max98396_read_device_property()
1715 max98396->dmon_duration = value; in max98396_read_device_property()
1717 max98396->dmon_duration = 64; in max98396_read_device_property()
1722 struct max98396_priv *max98396 = priv; in max98396_core_supplies_disable() local
1725 max98396->core_supplies); in max98396_core_supplies_disable()
1736 struct max98396_priv *max98396 = NULL; in max98396_i2c_probe() local
1739 max98396 = devm_kzalloc(&i2c->dev, sizeof(*max98396), GFP_KERNEL); in max98396_i2c_probe()
1741 if (!max98396) { in max98396_i2c_probe()
1745 i2c_set_clientdata(i2c, max98396); in max98396_i2c_probe()
1747 max98396->device_id = id->driver_data; in max98396_i2c_probe()
1750 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_i2c_probe()
1751 max98396->regmap = devm_regmap_init_i2c(i2c, &max98396_regmap); in max98396_i2c_probe()
1754 max98396->regmap = devm_regmap_init_i2c(i2c, &max98397_regmap); in max98396_i2c_probe()
1756 if (IS_ERR(max98396->regmap)) { in max98396_i2c_probe()
1757 ret = PTR_ERR(max98396->regmap); in max98396_i2c_probe()
1765 max98396->core_supplies[i].supply = max98396_core_supplies[i]; in max98396_i2c_probe()
1768 max98396->core_supplies); in max98396_i2c_probe()
1774 max98396->vbat = devm_regulator_get_optional(&i2c->dev, "vbat"); in max98396_i2c_probe()
1775 if (IS_ERR(max98396->vbat)) { in max98396_i2c_probe()
1776 if (PTR_ERR(max98396->vbat) == -EPROBE_DEFER) in max98396_i2c_probe()
1779 max98396->vbat = NULL; in max98396_i2c_probe()
1782 max98396->pvdd = devm_regulator_get_optional(&i2c->dev, "pvdd"); in max98396_i2c_probe()
1783 if (IS_ERR(max98396->pvdd)) { in max98396_i2c_probe()
1784 if (PTR_ERR(max98396->pvdd) == -EPROBE_DEFER) in max98396_i2c_probe()
1787 max98396->pvdd = NULL; in max98396_i2c_probe()
1791 max98396->core_supplies); in max98396_i2c_probe()
1798 max98396); in max98396_i2c_probe()
1802 if (max98396->pvdd) { in max98396_i2c_probe()
1803 ret = regulator_enable(max98396->pvdd); in max98396_i2c_probe()
1809 max98396->pvdd); in max98396_i2c_probe()
1814 if (max98396->vbat) { in max98396_i2c_probe()
1815 ret = regulator_enable(max98396->vbat); in max98396_i2c_probe()
1821 max98396->vbat); in max98396_i2c_probe()
1828 max98396->interleave_mode = true; in max98396_i2c_probe()
1830 max98396->interleave_mode = false; in max98396_i2c_probe()
1833 max98396_read_device_property(&i2c->dev, max98396); in max98396_i2c_probe()
1836 max98396->reset_gpio = devm_gpiod_get_optional(&i2c->dev, in max98396_i2c_probe()
1838 if (IS_ERR(max98396->reset_gpio)) { in max98396_i2c_probe()
1839 ret = PTR_ERR(max98396->reset_gpio); in max98396_i2c_probe()
1844 if (max98396->reset_gpio) { in max98396_i2c_probe()
1846 gpiod_set_value_cansleep(max98396->reset_gpio, 0); in max98396_i2c_probe()
1851 ret = regmap_read(max98396->regmap, in max98396_i2c_probe()
1852 GET_REG_ADDR_REV_ID(max98396->device_id), ®); in max98396_i2c_probe()
1860 if (max98396->device_id == CODEC_TYPE_MAX98396) in max98396_i2c_probe()