[RFC PATCH 3/4] drm/i2c: tda998x: calculate CTS_N directly from the bclk_ratio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sven Van Asbroeck <TheSven73@xxxxxxxxx>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 20 ++++++++++++++------
 include/drm/i2c/tda998x.h         |  1 +
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index a7c39f39793f..caccfaf90dd2 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -893,19 +893,26 @@ tda998x_configure_audio(struct tda998x_priv *priv,
 		reg_write(priv, REG_MUX_AP, MUX_AP_SELECT_I2S);
 		clksel_aip = AIP_CLKSEL_AIP_I2S;
 		clksel_fs = AIP_CLKSEL_FS_ACLK;
-		switch (params->sample_width) {
+		switch (params->bclk_ratio) {
 		case 16:
+			cts_n = CTS_N_M(3) | CTS_N_K(0);
+			break;
+		case 32:
 			cts_n = CTS_N_M(3) | CTS_N_K(1);
 			break;
-		case 18:
-		case 20:
-		case 24:
+		case 48:
 			cts_n = CTS_N_M(3) | CTS_N_K(2);
 			break;
-		default:
-		case 32:
+		case 64:
 			cts_n = CTS_N_M(3) | CTS_N_K(3);
 			break;
+		case 128:
+			cts_n = CTS_N_M(0) | CTS_N_K(0);
+			break;
+		default:
+			dev_err(&priv->hdmi->dev,
+				"unsupported I2S bclk ratio\n");
+			return -EINVAL;
 		}
 		break;
 
@@ -984,6 +991,7 @@ static int tda998x_audio_hw_params(struct device *dev, void *data,
 	struct tda998x_audio_params audio = {
 		.sample_width = params->sample_width,
 		.sample_rate = params->sample_rate,
+		.bclk_ratio = params->bclk_ratio,
 		.cea = params->cea,
 	};
 
diff --git a/include/drm/i2c/tda998x.h b/include/drm/i2c/tda998x.h
index 3cb25ccbe5e6..62d85c662aa1 100644
--- a/include/drm/i2c/tda998x.h
+++ b/include/drm/i2c/tda998x.h
@@ -16,6 +16,7 @@ struct tda998x_audio_params {
 	u8 format;
 	unsigned sample_width;
 	unsigned sample_rate;
+	unsigned int bclk_ratio;
 	struct hdmi_audio_infoframe cea;
 	u8 status[5];
 };
-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux