Lines Matching +full:spk +full:- +full:mute
1 // SPDX-License-Identifier: GPL-2.0-only
104 return -EINVAL; in rtq9128_i2c_write()
108 return i2c_smbus_write_i2c_block_data(i2c, reg, rg_size, data + count - rg_size); in rtq9128_i2c_write()
123 return -EINVAL; in rtq9128_i2c_read()
131 return -EIO; in rtq9128_i2c_read()
133 memset(val_buf, 0, val_size - rg_size); in rtq9128_i2c_read()
134 memcpy(val_buf + val_size - rg_size, data_tmp, rg_size); in rtq9128_i2c_read()
218 static const DECLARE_TLV_DB_SCALE(dig_tlv, -10375, 25, 0);
221 0, 3, TLV_DB_SCALE_ITEM(-600, 600, 0),
270 SOC_SINGLE_TLV("SPK Gain Volume", RTQ9128_REG_MISC, 0, 5, 0, spkgain_tlv),
289 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in rtq9128_dac_power_event()
293 dev_dbg(comp->dev, "%s: %s event %d\n", __func__, w->name, event); in rtq9128_dac_power_event()
395 ret = pm_runtime_resume_and_get(comp->dev); in rtq9128_component_probe()
397 dev_err(comp->dev, "Failed to resume device (%d)\n", ret); in rtq9128_component_probe()
419 ret = snd_soc_component_write(comp, curr->reg, curr->val); in rtq9128_component_probe()
424 pm_runtime_mark_last_busy(comp->dev); in rtq9128_component_probe()
425 pm_runtime_put(comp->dev); in rtq9128_component_probe()
445 struct device *dev = dai->dev; in rtq9128_dai_set_fmt()
452 return -EINVAL; in rtq9128_dai_set_fmt()
456 data->daifmt = fmt; in rtq9128_dai_set_fmt()
465 struct snd_soc_component *comp = dai->component; in rtq9128_dai_set_tdm_slot()
466 struct device *dev = dai->dev; in rtq9128_dai_set_tdm_slot()
475 return -EINVAL; in rtq9128_dai_set_tdm_slot()
482 return -EINVAL; in rtq9128_dai_set_tdm_slot()
488 return -EINVAL; in rtq9128_dai_set_tdm_slot()
492 start_loc = (ffs(mask) - 1) * slot_width / 8; in rtq9128_dai_set_tdm_slot()
493 mask &= ~BIT(ffs(mask) - 1); in rtq9128_dai_set_tdm_slot()
503 start_loc = (ffs(mask) - 1) * slot_width / 8; in rtq9128_dai_set_tdm_slot()
504 mask &= ~BIT(ffs(mask) - 1); in rtq9128_dai_set_tdm_slot()
513 srcin_select = data->tdm_input_data2_select ? RTQ9128_TDMSRCIN_MASK : 0; in rtq9128_dai_set_tdm_slot()
521 data->tdm_slots = slots; in rtq9128_dai_set_tdm_slot()
522 data->tdm_slot_width = slot_width; in rtq9128_dai_set_tdm_slot()
532 struct snd_soc_component *comp = dai->component; in rtq9128_dai_hw_params()
533 struct device *dev = dai->dev; in rtq9128_dai_hw_params()
539 fmtval = FIELD_GET(SND_SOC_DAIFMT_FORMAT_MASK, data->daifmt); in rtq9128_dai_hw_params()
540 if (data->tdm_slots && fmtval != SND_SOC_DAIFMT_DSP_A && fmtval != SND_SOC_DAIFMT_DSP_B) { in rtq9128_dai_hw_params()
542 return -EINVAL; in rtq9128_dai_hw_params()
556 audfmt = data->tdm_slots ? 12 : 11; in rtq9128_dai_hw_params()
559 audfmt = data->tdm_slots ? 4 : 3; in rtq9128_dai_hw_params()
563 return -EINVAL; in rtq9128_dai_hw_params()
582 return -EINVAL; in rtq9128_dai_hw_params()
587 if (data->tdm_slots) { in rtq9128_dai_hw_params()
588 if (slot_width > data->tdm_slot_width) { in rtq9128_dai_hw_params()
590 return -EINVAL; in rtq9128_dai_hw_params()
594 bitrate = data->tdm_slots * data->tdm_slot_width * params_rate(param); in rtq9128_dai_hw_params()
597 return -EINVAL; in rtq9128_dai_hw_params()
601 slot_width = data->tdm_slot_width; in rtq9128_dai_hw_params()
616 return -EINVAL; in rtq9128_dai_hw_params()
631 static int rtq9128_dai_mute_stream(struct snd_soc_dai *dai, int mute, int stream) in rtq9128_dai_mute_stream() argument
633 struct snd_soc_component *comp = dai->component; in rtq9128_dai_mute_stream()
634 struct device *dev = dai->dev; in rtq9128_dai_mute_stream()
637 dev_dbg(dev, "%s: mute (%d), stream (%d)\n", __func__, mute, stream); in rtq9128_dai_mute_stream()
640 mute ? 1 : 0); in rtq9128_dai_mute_stream()
657 .name = "rtq9128-aif",
679 struct device *dev = &i2c->dev; in rtq9128_probe()
687 return -ENOMEM; in rtq9128_probe()
689 data->enable = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH); in rtq9128_probe()
690 if (IS_ERR(data->enable)) in rtq9128_probe()
691 return dev_err_probe(dev, PTR_ERR(data->enable), "Failed to get 'enable' gpio\n"); in rtq9128_probe()
692 else if (data->enable) in rtq9128_probe()
695 data->tdm_input_data2_select = device_property_read_bool(dev, in rtq9128_probe()
696 "richtek,tdm-input-data2-select"); in rtq9128_probe()
721 return dev_err_probe(dev, -ENODEV, "Vendor ID not match (0x%x)\n", venid); in rtq9128_probe()
738 if (!data->enable) in rtq9128_pm_runtime_suspend()
741 gpiod_set_value_cansleep(data->enable, 0); in rtq9128_pm_runtime_suspend()
754 /* If 'enable' gpio not specified, change all channels to default Hi-Z */ in rtq9128_pm_runtime_resume()
755 if (!data->enable) in rtq9128_pm_runtime_resume()
758 gpiod_set_value_cansleep(data->enable, 1); in rtq9128_pm_runtime_resume()