Commit 06a3c59f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull sound fixes from Takashi Iwai:
 "No surprise here, including only a collection of HD-audio
  device-specific small fixes"

* tag 'sound-6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda: Disable power-save on KONTRON SinglePC
  ALSA: hda/realtek: Add supported ALC257 for ChromeOS
  ALSA: hda/realtek: Headset Mic VREF to 100%
  ALSA: hda: intel-nhlt: Ignore vbps when looking for DMIC 32 bps format
  ALSA: hda: cs35l56: Enable low-power hibernation mode on SPI
  ALSA: cs35l41: Fix for old systems which do not support command
  ALSA: hda: cs35l41: Remove unnecessary boolean state variable firmware_running
  ALSA: hda - Fix speaker and headset mic pin config for CHUWI CoreBook XPro
parents b1e51588 a337c355
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -906,6 +906,6 @@ int cs35l41_init_boost(struct device *dev, struct regmap *regmap,
bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type);
int cs35l41_mdsync_up(struct regmap *regmap);
int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type,
			  int enable, bool firmware_running);
			  int enable, struct cs_dsp *dsp);

#endif /* __CS35L41_H */
+29 −4
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ EXPORT_SYMBOL(intel_nhlt_ssp_mclk_mask);

static struct nhlt_specific_cfg *
nhlt_get_specific_cfg(struct device *dev, struct nhlt_fmt *fmt, u8 num_ch,
		      u32 rate, u8 vbps, u8 bps)
		      u32 rate, u8 vbps, u8 bps, bool ignore_vbps)
{
	struct nhlt_fmt_cfg *cfg = fmt->fmt_config;
	struct wav_fmt *wfmt;
@@ -255,8 +255,12 @@ nhlt_get_specific_cfg(struct device *dev, struct nhlt_fmt *fmt, u8 num_ch,
		dev_dbg(dev, "Endpoint format: ch=%d fmt=%d/%d rate=%d\n",
			wfmt->channels, _vbps, _bps, wfmt->samples_per_sec);

		/*
		 * When looking for exact match of configuration ignore the vbps
		 * from NHLT table when ignore_vbps is true
		 */
		if (wfmt->channels == num_ch && wfmt->samples_per_sec == rate &&
		    vbps == _vbps && bps == _bps)
		    (ignore_vbps || vbps == _vbps) && bps == _bps)
			return &cfg->config;

		cfg = (struct nhlt_fmt_cfg *)(cfg->config.caps + cfg->config.size);
@@ -289,6 +293,7 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
{
	struct nhlt_specific_cfg *cfg;
	struct nhlt_endpoint *epnt;
	bool ignore_vbps = false;
	struct nhlt_fmt *fmt;
	int i;

@@ -298,7 +303,26 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
	dev_dbg(dev, "Looking for configuration:\n");
	dev_dbg(dev, "  vbus_id=%d link_type=%d dir=%d, dev_type=%d\n",
		bus_id, link_type, dir, dev_type);
	if (link_type == NHLT_LINK_DMIC && bps == 32 && (vbps == 24 || vbps == 32)) {
		/*
		 * The DMIC hardware supports only one type of 32 bits sample
		 * size, which is 24 bit sampling on the MSB side and bits[1:0]
		 * are used for indicating the channel number.
		 * It has been observed that some NHLT tables have the vbps
		 * specified as 32 while some uses 24.
		 * The format these variations describe are identical, the
		 * hardware is configured and behaves the same way.
		 * Note: when the samples assumed to be vbps=32 then the 'noise'
		 * introduced by the lower two bits (channel number) have no
		 * real life implication on audio quality.
		 */
		dev_dbg(dev,
			"  ch=%d fmt=%d rate=%d (vbps is ignored for DMIC 32bit format)\n",
			num_ch, bps, rate);
		ignore_vbps = true;
	} else {
		dev_dbg(dev, "  ch=%d fmt=%d/%d rate=%d\n", num_ch, vbps, bps, rate);
	}
	dev_dbg(dev, "Endpoint count=%d\n", nhlt->endpoint_count);

	epnt = (struct nhlt_endpoint *)nhlt->desc;
@@ -307,7 +331,8 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
		if (nhlt_check_ep_match(dev, epnt, bus_id, link_type, dir, dev_type)) {
			fmt = (struct nhlt_fmt *)(epnt->config.caps + epnt->config.size);

			cfg = nhlt_get_specific_cfg(dev, fmt, num_ch, rate, vbps, bps);
			cfg = nhlt_get_specific_cfg(dev, fmt, num_ch, rate,
						    vbps, bps, ignore_vbps);
			if (cfg)
				return cfg;
		}
+12 −16
Original line number Diff line number Diff line
@@ -504,7 +504,6 @@ static void cs35l41_shutdown_dsp(struct cs35l41_hda *cs35l41)

	cs_dsp_stop(dsp);
	cs_dsp_power_down(dsp);
	cs35l41->firmware_running = false;
	dev_dbg(cs35l41->dev, "Unloaded Firmware\n");
}

@@ -550,7 +549,7 @@ static void cs35l41_hda_play_start(struct device *dev)

	cs35l41->playback_started = true;

	if (cs35l41->firmware_running) {
	if (cs35l41->cs_dsp.running) {
		regmap_multi_reg_write(reg, cs35l41_hda_config_dsp,
				       ARRAY_SIZE(cs35l41_hda_config_dsp));
		regmap_update_bits(reg, CS35L41_PWR_CTRL2,
@@ -580,7 +579,7 @@ static void cs35l41_mute(struct device *dev, bool mute)
			regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
		} else {
			dev_dbg(dev, "Unmuting\n");
			if (cs35l41->firmware_running) {
			if (cs35l41->cs_dsp.running) {
				regmap_multi_reg_write(reg, cs35l41_hda_unmute_dsp,
						ARRAY_SIZE(cs35l41_hda_unmute_dsp));
			} else {
@@ -599,7 +598,7 @@ static void cs35l41_hda_play_done(struct device *dev)
	dev_dbg(dev, "Play (Complete)\n");

	cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1,
			      cs35l41->firmware_running);
			      &cs35l41->cs_dsp);
	cs35l41_mute(dev, false);
}

@@ -612,7 +611,7 @@ static void cs35l41_hda_pause_start(struct device *dev)

	cs35l41_mute(dev, true);
	cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0,
			      cs35l41->firmware_running);
			      &cs35l41->cs_dsp);
}

static void cs35l41_hda_pause_done(struct device *dev)
@@ -625,7 +624,7 @@ static void cs35l41_hda_pause_done(struct device *dev)
	regmap_update_bits(reg, CS35L41_PWR_CTRL2, CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT);
	if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
		regmap_write(reg, CS35L41_GPIO1_CTRL1, 0x00000001);
	if (cs35l41->firmware_running) {
	if (cs35l41->cs_dsp.running) {
		cs35l41_set_cspl_mbox_cmd(dev, reg, CSPL_MBOX_CMD_PAUSE);
		regmap_update_bits(reg, CS35L41_PWR_CTRL2,
				   CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK,
@@ -675,7 +674,7 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action)
		break;
	case HDA_GEN_PCM_ACT_CLOSE:
		mutex_lock(&cs35l41->fw_mutex);
		if (!cs35l41->firmware_running && cs35l41->request_fw_load &&
		if (!cs35l41->cs_dsp.running && cs35l41->request_fw_load &&
		    !cs35l41->fw_request_ongoing) {
			dev_info(dev, "Requesting Firmware Load after HDA_GEN_PCM_ACT_CLOSE\n");
			cs35l41->fw_request_ongoing = true;
@@ -761,10 +760,9 @@ static int cs35l41_verify_id(struct cs35l41_hda *cs35l41, unsigned int *regid, u
static int cs35l41_ready_for_reset(struct cs35l41_hda *cs35l41)
{
	mutex_lock(&cs35l41->fw_mutex);
	if (cs35l41->firmware_running) {
	if (cs35l41->cs_dsp.running) {
		cs35l41->cs_dsp.running = false;
		cs35l41->cs_dsp.booted = false;
		cs35l41->firmware_running = false;
	}
	regcache_mark_dirty(cs35l41->regmap);
	mutex_unlock(&cs35l41->fw_mutex);
@@ -925,7 +923,7 @@ static int cs35l41_runtime_suspend(struct device *dev)

	mutex_lock(&cs35l41->fw_mutex);

	if (cs35l41->firmware_running) {
	if (cs35l41->cs_dsp.running) {
		ret = cs35l41_enter_hibernate(cs35l41->dev, cs35l41->regmap,
					      cs35l41->hw_cfg.bst_type);
		if (ret)
@@ -960,7 +958,7 @@ static int cs35l41_runtime_resume(struct device *dev)

	regcache_cache_only(cs35l41->regmap, false);

	if (cs35l41->firmware_running)	{
	if (cs35l41->cs_dsp.running)	{
		ret = cs35l41_exit_hibernate(cs35l41->dev, cs35l41->regmap);
		if (ret) {
			dev_warn(cs35l41->dev, "Unable to exit Hibernate.");
@@ -1052,8 +1050,6 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41)
		goto clean_dsp;
	}

	cs35l41->firmware_running = true;

	return 0;

clean_dsp:
@@ -1063,10 +1059,10 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41)

static void cs35l41_load_firmware(struct cs35l41_hda *cs35l41, bool load)
{
	if (cs35l41->firmware_running && !load) {
	if (cs35l41->cs_dsp.running && !load) {
		dev_dbg(cs35l41->dev, "Unloading Firmware\n");
		cs35l41_shutdown_dsp(cs35l41);
	} else if (!cs35l41->firmware_running && load) {
	} else if (!cs35l41->cs_dsp.running && load) {
		dev_dbg(cs35l41->dev, "Loading Firmware\n");
		cs35l41_smart_amp(cs35l41);
	} else {
@@ -1346,7 +1342,7 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
		 cs35l41->acpi_subsystem_id, cs35l41->hw_cfg.bst_type,
		 cs35l41->hw_cfg.gpio1.func == CS35l41_VSPK_SWITCH,
		 cs35l41->hw_cfg.spk_pos ? 'R' : 'L',
		 cs35l41->firmware_running, cs35l41->speaker_id);
		 cs35l41->cs_dsp.running, cs35l41->speaker_id);

	return ret;
}
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi)
		return -ENOMEM;

	cs35l56->base.dev = &spi->dev;

#ifdef CS35L56_WAKE_HOLD_TIME_US
	cs35l56->base.can_hibernate = true;
#endif
	cs35l56->base.regmap = devm_regmap_init_spi(spi, &cs35l56_regmap_spi);
	if (IS_ERR(cs35l56->base.regmap)) {
		ret = PTR_ERR(cs35l56->base.regmap);
+2 −0
Original line number Diff line number Diff line
@@ -2242,6 +2242,8 @@ static const struct snd_pci_quirk power_save_denylist[] = {
	SND_PCI_QUIRK(0x17aa, 0x36a7, "Lenovo C50 All in one", 0),
	/* https://bugs.launchpad.net/bugs/1821663 */
	SND_PCI_QUIRK(0x1631, 0xe017, "Packard Bell NEC IMEDIA 5204", 0),
	/* KONTRON SinglePC may cause a stall at runtime resume */
	SND_PCI_QUIRK(0x1734, 0x1232, "KONTRON SinglePC", 0),
	{}
};
#endif /* CONFIG_PM */
Loading