aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Randgaard <matrandg@cisco.com>2013-12-05 08:33:41 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-07 03:09:03 -0500
commit5474b983c679e3df5ee3c2731c0b685915d5250d (patch)
treebbb6dd55d83f6d8fbe8c65855cee83519833ebb9
parent14d03233517001849742e45803219755430a5eed (diff)
[media] adv7604: improve HDMI audio handling
- Mute audio before switching inputs to avoid noise/pops - Mute audio if audio FIFO over-/underflows (AD Recommended setting) - Reset FIFO if it over-/underflows (AD Recommended setting) Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/i2c/adv7604.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 442f70a279a1..b5dcea8dc43f 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1387,14 +1387,12 @@ static void enable_input(struct v4l2_subdev *sd)
1387 struct adv7604_state *state = to_state(sd); 1387 struct adv7604_state *state = to_state(sd);
1388 1388
1389 if (is_analog_input(sd)) { 1389 if (is_analog_input(sd)) {
1390 /* enable */
1391 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ 1390 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */
1392 } else if (is_digital_input(sd)) { 1391 } else if (is_digital_input(sd)) {
1393 /* enable */
1394 hdmi_write_and_or(sd, 0x00, 0xfc, state->selected_input); 1392 hdmi_write_and_or(sd, 0x00, 0xfc, state->selected_input);
1395 hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */
1396 hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */ 1393 hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */
1397 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ 1394 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */
1395 hdmi_write_and_or(sd, 0x1a, 0xef, 0x00); /* Unmute audio */
1398 } else { 1396 } else {
1399 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n", 1397 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n",
1400 __func__, state->selected_input); 1398 __func__, state->selected_input);
@@ -1403,9 +1401,9 @@ static void enable_input(struct v4l2_subdev *sd)
1403 1401
1404static void disable_input(struct v4l2_subdev *sd) 1402static void disable_input(struct v4l2_subdev *sd)
1405{ 1403{
1406 /* disable */ 1404 hdmi_write_and_or(sd, 0x1a, 0xef, 0x10); /* Mute audio */
1405 msleep(16); /* 512 samples with >= 32 kHz sample rate [REF_03, c. 7.16.10] */
1407 io_write(sd, 0x15, 0xbe); /* Tristate all outputs from video core */ 1406 io_write(sd, 0x15, 0xbe); /* Tristate all outputs from video core */
1408 hdmi_write(sd, 0x1a, 0x1a); /* Mute audio */
1409 hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */ 1407 hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */
1410} 1408}
1411 1409
@@ -2044,6 +2042,11 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
2044 cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution 2042 cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run resolution
2045 for digital formats */ 2043 for digital formats */
2046 2044
2045 /* HDMI audio */
2046 hdmi_write_and_or(sd, 0x15, 0xfc, 0x03); /* Mute on FIFO over-/underflow [REF_01, c. 1.2.18] */
2047 hdmi_write_and_or(sd, 0x1a, 0xf1, 0x08); /* Wait 1 s before unmute */
2048 hdmi_write_and_or(sd, 0x68, 0xf9, 0x06); /* FIFO reset on over-/underflow [REF_01, c. 1.2.19] */
2049
2047 /* TODO from platform data */ 2050 /* TODO from platform data */
2048 afe_write(sd, 0xb5, 0x01); /* Setting MCLK to 256Fs */ 2051 afe_write(sd, 0xb5, 0x01); /* Setting MCLK to 256Fs */
2049 2052