Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84efc837 authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

ASoC: wcd9335: Fix alignment issue for Slimbus-I2S bridge



In bridge loopback WS for TX and RX are not aligned.
This results in shift in data and captured data is noisy.
Fix clock synchronization issue for RX and TX.

CRs-Fixed: 2172613
Change-Id: I75ea9d3d530a0e642c2f72cdeb10e0f41ddeaf39
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent cf044174
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -3982,19 +3982,13 @@ static void tasha_codec_bridge_mclk_enable(struct snd_soc_codec *codec,
		 */
		snd_soc_update_bits(codec,
				    WCD9335_DATA_HUB_DATA_HUB_I2S_CLK,
				    0x02, 0x02);
		snd_soc_update_bits(codec,
				    WCD9335_DATA_HUB_DATA_HUB_I2S_CLK,
				    0x1, 0x0);
				    0x03, 0x02);
	} else {
		snd_soc_update_bits(codec,
				    WCD9335_DATA_HUB_DATA_HUB_I2S_CLK,
				    0x02, 0x00);
		snd_soc_update_bits(codec,
				    WCD9335_DATA_HUB_DATA_HUB_I2S_CLK,
				    0x1, 0x1);
	};
};
				    0x03, 0x01);
	}
}

static int tasha_codec_bridge_tx_mclk_supply(struct snd_soc_dapm_widget *w,
					   struct snd_kcontrol *kcontrol,
@@ -11795,6 +11789,12 @@ static int tasha_hw_params(struct snd_pcm_substream *substream,
			snd_soc_update_bits(codec,
					WCD9335_DATA_HUB_DATA_HUB_RX_I2S_CTL,
					0x1c, (rx_fs_rate << 2));
			snd_soc_update_bits(codec,
					WCD9335_DATA_HUB_DATA_HUB_TX_I2S_CTL,
					0x20, i2s_bit_mode << 5);
			snd_soc_update_bits(codec,
					WCD9335_DATA_HUB_DATA_HUB_TX_I2S_CTL,
					0x1c, (rx_fs_rate << 2));
		}
		break;
	case SNDRV_PCM_STREAM_CAPTURE:
@@ -11913,13 +11913,19 @@ static int tasha_hw_params(struct snd_pcm_substream *substream,
			snd_soc_update_bits(dai->codec,
					WCD9335_DATA_HUB_DATA_HUB_TX_I2S_CTL,
					0x1C, (tx_fs_rate << 2));
		};
			snd_soc_update_bits(codec,
					WCD9335_DATA_HUB_DATA_HUB_RX_I2S_CTL,
					0x20, i2s_bit_mode << 5);
			snd_soc_update_bits(dai->codec,
					WCD9335_DATA_HUB_DATA_HUB_RX_I2S_CTL,
					0x1C, (tx_fs_rate << 2));
		}
		break;
	default:
		pr_err("%s: Invalid stream type %d\n", __func__,
			substream->stream);
		return -EINVAL;
	};
	}
	if (dai->id == AIF4_VIFEED)
		tasha->dai[dai->id].bit_width = 32;