Lines Matching defs:tas_priv

80 static int tasdevice_spi_dev_read(struct tasdevice_priv *tas_priv,
93 ret = tasdevice_dev_bulk_read(tas_priv, chn, reg,
97 ret = tasdevice_dev_read(tas_priv, chn, reg, val);
100 dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
105 static int tasdevice_spi_dev_bulk_read(struct tasdevice_priv *tas_priv,
119 ret = tasdevice_dev_bulk_read(tas_priv, chn, reg,
123 ret = tasdevice_dev_bulk_read(tas_priv, chn, reg, data, len);
126 dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
131 static int tasdevice_spi_dev_update_bits(struct tasdevice_priv *tas_priv,
141 ret = tasdevice_dev_read(tas_priv, chn, reg, &val);
143 dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
147 ret = tasdevice_dev_write(tas_priv, chn, TASDEVICE_PAGE_REG(reg),
150 dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
199 static int tascodec_spi_init(struct tasdevice_priv *tas_priv,
209 guard(mutex)(&tas_priv->codec_lock);
211 scnprintf(tas_priv->rca_binaryname,
212 sizeof(tas_priv->rca_binaryname), "%sRCA%d.bin",
213 tas_priv->dev_name, tas_priv->ndev);
214 crc8_populate_msb(tas_priv->crc8_lkp_tbl, TASDEVICE_CRC8_POLYNOMIAL);
215 tas_priv->codec = codec;
217 tas_priv->rca_binaryname, tas_priv->dev, GFP_KERNEL, tas_priv,
220 dev_err(tas_priv->dev, "request_firmware_nowait err:0x%08x\n",
226 static void tasdevice_spi_init(struct tasdevice_priv *tas_priv)
228 tas_priv->tasdevice[tas_priv->index].cur_book = -1;
229 tas_priv->tasdevice[tas_priv->index].cur_conf = -1;
230 tas_priv->tasdevice[tas_priv->index].cur_prog = -1;
232 tas_priv->isspi = true;
234 tas_priv->update_bits = tasdevice_spi_dev_update_bits;
235 tas_priv->change_chn_book = tasdevice_spi_change_chn_book;
236 tas_priv->dev_read = tasdevice_spi_dev_read;
237 tas_priv->dev_bulk_read = tasdevice_spi_dev_bulk_read;
239 mutex_init(&tas_priv->codec_lock);
242 static int tasdevice_spi_amp_putvol(struct tasdevice_priv *tas_priv,
255 ret = tasdevice_spi_dev_update_bits(tas_priv, tas_priv->index,
258 dev_err(tas_priv->dev, "set AMP vol error in dev %d\n",
259 tas_priv->index);
264 static int tasdevice_spi_amp_getvol(struct tasdevice_priv *tas_priv,
272 ret = tasdevice_spi_dev_read(tas_priv, tas_priv->index, mc->reg, &val);
274 dev_err(tas_priv->dev, "%s, get AMP vol error\n", __func__);
392 struct tasdevice_priv *tas_priv = tas_hda->priv;
396 guard(mutex)(&tas_priv->codec_lock);
397 if (tas_priv->fw_state == TASDEVICE_DSP_FW_ALL_OK)
400 guard(mutex)(&tas_priv->codec_lock);
401 if (tas_priv->fw_state == TASDEVICE_DSP_FW_ALL_OK)
402 tasdevice_tuning_switch(tas_priv, 1);
424 struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
428 guard(mutex)(&tas_priv->codec_lock);
429 return tasdevice_spi_digital_getvol(tas_priv, ucontrol, mc);
435 struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
439 guard(mutex)(&tas_priv->codec_lock);
440 return tasdevice_spi_amp_getvol(tas_priv, ucontrol, mc);
446 struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
450 guard(mutex)(&tas_priv->codec_lock);
451 return tasdevice_spi_digital_putvol(tas_priv, ucontrol, mc);
457 struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
461 guard(mutex)(&tas_priv->codec_lock);
462 return tasdevice_spi_amp_putvol(tas_priv, ucontrol, mc);
468 struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
470 ucontrol->value.integer.value[0] = (int)tas_priv->force_fwload_status;
471 dev_dbg(tas_priv->dev, "%s : Force FWload %s\n", __func__,
472 str_on_off(tas_priv->force_fwload_status));
480 struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
483 if (tas_priv->force_fwload_status == val) {
487 tas_priv->force_fwload_status = val;
489 dev_dbg(tas_priv->dev, "%s : Force FWload %s\n", __func__,
490 str_on_off(tas_priv->force_fwload_status));
634 struct tasdevice_priv *tas_priv = context;
635 struct tas2781_hda *tas_hda = dev_get_drvdata(tas_priv->dev);
636 struct hda_codec *codec = tas_priv->codec;
639 pm_runtime_get_sync(tas_priv->dev);
640 guard(mutex)(&tas_priv->codec_lock);
642 ret = tasdevice_rca_parser(tas_priv, fmw);
655 tasdevice_dsp_remove(tas_priv);
657 tas_priv->fw_state = TASDEVICE_DSP_FW_PENDING;
658 scnprintf(tas_priv->coef_binaryname, 64, "TAS2XXX%04X-%01d.bin",
659 lower_16_bits(codec->core.subsystem_id), tas_priv->index);
660 ret = tasdevice_dsp_parser(tas_priv);
662 dev_err(tas_priv->dev, "dspfw load %s error\n",
663 tas_priv->coef_binaryname);
664 tas_priv->fw_state = TASDEVICE_DSP_FW_FAIL;
672 tas2781_spi_reset(tas_priv);
673 tas_priv->rcabin.profile_cfg_id = 0;
675 tas_priv->fw_state = TASDEVICE_DSP_FW_ALL_OK;
676 ret = tasdevice_spi_dev_read(tas_priv, tas_priv->index,
682 ret = tasdevice_prmg_load(tas_priv, 0);
684 dev_err(tas_priv->dev, "FW download failed = %d\n",
688 tas_priv->fw_state = TASDEVICE_DSP_FW_ALL_OK;
690 if (tas_priv->fmw->nr_programs > 0)
691 tas_priv->tasdevice[tas_priv->index].cur_prog = 0;
692 if (tas_priv->fmw->nr_configurations > 0)
693 tas_priv->tasdevice[tas_priv->index].cur_conf = 0;
744 struct tasdevice_priv *tas_priv = tas_hda->priv;
747 comp = hda_component_from_index(parent, tas_priv->index);
756 tasdevice_config_info_remove(tas_priv);
757 tasdevice_dsp_remove(tas_priv);
770 struct tasdevice_priv *tas_priv;
786 tas_priv = devm_kzalloc(&spi->dev, sizeof(*tas_priv), GFP_KERNEL);
787 if (!tas_priv)
789 tas_priv->dev = &spi->dev;
790 tas_hda->priv = tas_priv;
791 tas_priv->regmap = devm_regmap_init_spi(spi, &tasdevice_regmap);
792 if (IS_ERR(tas_priv->regmap)) {
793 ret = PTR_ERR(tas_priv->regmap);
794 dev_err(tas_priv->dev, "Failed to allocate regmap: %d\n",
801 dev_err(tas_priv->dev, "Unmatched spi dev %s\n",
806 tas_priv->irq = spi->irq;
811 return dev_err_probe(tas_priv->dev, ret,
814 tasdevice_spi_init(tas_priv);
816 pm_runtime_set_autosuspend_delay(tas_priv->dev, 3000);
817 pm_runtime_use_autosuspend(tas_priv->dev);
818 pm_runtime_set_active(tas_priv->dev);
819 pm_runtime_get_noresume(tas_priv->dev);
820 pm_runtime_enable(tas_priv->dev);
822 pm_runtime_put_autosuspend(tas_priv->dev);
824 ret = component_add(tas_priv->dev, &tas2781_hda_comp_ops);
826 dev_err(tas_priv->dev, "Register component fail: %d\n", ret);
827 pm_runtime_disable(tas_priv->dev);
842 struct tasdevice_priv *tas_priv = tas_hda->priv;
844 guard(mutex)(&tas_priv->codec_lock);
846 if (tas_priv->fw_state == TASDEVICE_DSP_FW_ALL_OK
847 && tas_priv->playback_started)
848 tasdevice_tuning_switch(tas_priv, 1);
850 tas_priv->tasdevice[tas_priv->index].cur_book = -1;
851 tas_priv->tasdevice[tas_priv->index].cur_conf = -1;
859 struct tasdevice_priv *tas_priv = tas_hda->priv;
861 guard(mutex)(&tas_priv->codec_lock);
863 if (tas_priv->fw_state == TASDEVICE_DSP_FW_ALL_OK
864 && tas_priv->playback_started)
865 tasdevice_tuning_switch(tas_priv, 0);
873 struct tasdevice_priv *tas_priv = tas_hda->priv;
881 if (tas_priv->fw_state == TASDEVICE_DSP_FW_ALL_OK
882 && tas_priv->playback_started)
883 tasdevice_tuning_switch(tas_priv, 1);
891 struct tasdevice_priv *tas_priv = tas_hda->priv;
898 guard(mutex)(&tas_priv->codec_lock);
899 ret = tas_priv->dev_read(tas_priv, tas_priv->index,
905 tas_priv->tasdevice[tas_priv->index].cur_book = -1;
906 tas_priv->tasdevice[tas_priv->index].cur_conf = -1;
907 tas_priv->tasdevice[tas_priv->index].cur_prog = -1;
909 ret = tasdevice_prmg_load(tas_priv, 0);
911 dev_err(tas_priv->dev,
915 tas_priv->fw_state = TASDEVICE_DSP_FW_ALL_OK;
917 if (tas_priv->playback_started)
918 tasdevice_tuning_switch(tas_priv, 0);