aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-01-30 15:17:42 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-25 12:02:05 -0400
commit22d97e561dac6cc90954567a7b4be54680982769 (patch)
tree81d669003e902294456012a95b45f4fd349d662b
parent05cacb176712cbbd3ae0331d92fe57741ef2d2ba (diff)
[media] adv7604: Replace *_and_or() functions with *_clr_set()
The *_and_or() functions take an 'and' bitmask to be ANDed with the register value before ORing it with th 'or' bitmask. As the functions are used to mask and set bits selectively, this requires the caller to invert the 'and' bitmask and is thus error prone. Replace those functions with a *_clr_set() variant that takes a mask of bits to be cleared instead of a mask of bits to be kept. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/i2c/adv7604.c86
1 files changed, 43 insertions, 43 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index fc71c171ea18..7a9c17cf8b66 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -429,9 +429,9 @@ static inline int io_write(struct v4l2_subdev *sd, u8 reg, u8 val)
429 return adv_smbus_write_byte_data(state, ADV7604_PAGE_IO, reg, val); 429 return adv_smbus_write_byte_data(state, ADV7604_PAGE_IO, reg, val);
430} 430}
431 431
432static inline int io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) 432static inline int io_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val)
433{ 433{
434 return io_write(sd, reg, (io_read(sd, reg) & mask) | val); 434 return io_write(sd, reg, (io_read(sd, reg) & ~mask) | val);
435} 435}
436 436
437static inline int avlink_read(struct v4l2_subdev *sd, u8 reg) 437static inline int avlink_read(struct v4l2_subdev *sd, u8 reg)
@@ -462,9 +462,9 @@ static inline int cec_write(struct v4l2_subdev *sd, u8 reg, u8 val)
462 return adv_smbus_write_byte_data(state, ADV7604_PAGE_CEC, reg, val); 462 return adv_smbus_write_byte_data(state, ADV7604_PAGE_CEC, reg, val);
463} 463}
464 464
465static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) 465static inline int cec_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val)
466{ 466{
467 return cec_write(sd, reg, (cec_read(sd, reg) & mask) | val); 467 return cec_write(sd, reg, (cec_read(sd, reg) & ~mask) | val);
468} 468}
469 469
470static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg) 470static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg)
@@ -538,9 +538,9 @@ static inline int rep_write(struct v4l2_subdev *sd, u8 reg, u8 val)
538 return adv_smbus_write_byte_data(state, ADV7604_PAGE_REP, reg, val); 538 return adv_smbus_write_byte_data(state, ADV7604_PAGE_REP, reg, val);
539} 539}
540 540
541static inline int rep_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) 541static inline int rep_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val)
542{ 542{
543 return rep_write(sd, reg, (rep_read(sd, reg) & mask) | val); 543 return rep_write(sd, reg, (rep_read(sd, reg) & ~mask) | val);
544} 544}
545 545
546static inline int edid_read(struct v4l2_subdev *sd, u8 reg) 546static inline int edid_read(struct v4l2_subdev *sd, u8 reg)
@@ -629,9 +629,9 @@ static inline int hdmi_write(struct v4l2_subdev *sd, u8 reg, u8 val)
629 return adv_smbus_write_byte_data(state, ADV7604_PAGE_HDMI, reg, val); 629 return adv_smbus_write_byte_data(state, ADV7604_PAGE_HDMI, reg, val);
630} 630}
631 631
632static inline int hdmi_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) 632static inline int hdmi_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val)
633{ 633{
634 return hdmi_write(sd, reg, (hdmi_read(sd, reg) & mask) | val); 634 return hdmi_write(sd, reg, (hdmi_read(sd, reg) & ~mask) | val);
635} 635}
636 636
637static inline int test_read(struct v4l2_subdev *sd, u8 reg) 637static inline int test_read(struct v4l2_subdev *sd, u8 reg)
@@ -667,9 +667,9 @@ static inline int cp_write(struct v4l2_subdev *sd, u8 reg, u8 val)
667 return adv_smbus_write_byte_data(state, ADV7604_PAGE_CP, reg, val); 667 return adv_smbus_write_byte_data(state, ADV7604_PAGE_CP, reg, val);
668} 668}
669 669
670static inline int cp_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val) 670static inline int cp_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 val)
671{ 671{
672 return cp_write(sd, reg, (cp_read(sd, reg) & mask) | val); 672 return cp_write(sd, reg, (cp_read(sd, reg) & ~mask) | val);
673} 673}
674 674
675static inline int vdp_read(struct v4l2_subdev *sd, u8 reg) 675static inline int vdp_read(struct v4l2_subdev *sd, u8 reg)
@@ -947,7 +947,7 @@ static int configure_predefined_video_timings(struct v4l2_subdev *sd,
947 io_write(sd, 0x17, 0x5a); 947 io_write(sd, 0x17, 0x5a);
948 } 948 }
949 /* disable embedded syncs for auto graphics mode */ 949 /* disable embedded syncs for auto graphics mode */
950 cp_write_and_or(sd, 0x81, 0xef, 0x00); 950 cp_write_clr_set(sd, 0x81, 0x10, 0x00);
951 cp_write(sd, 0x8f, 0x00); 951 cp_write(sd, 0x8f, 0x00);
952 cp_write(sd, 0x90, 0x00); 952 cp_write(sd, 0x90, 0x00);
953 cp_write(sd, 0xa2, 0x00); 953 cp_write(sd, 0xa2, 0x00);
@@ -1005,7 +1005,7 @@ static void configure_custom_video_timings(struct v4l2_subdev *sd,
1005 io_write(sd, 0x00, 0x07); /* video std */ 1005 io_write(sd, 0x00, 0x07); /* video std */
1006 io_write(sd, 0x01, 0x02); /* prim mode */ 1006 io_write(sd, 0x01, 0x02); /* prim mode */
1007 /* enable embedded syncs for auto graphics mode */ 1007 /* enable embedded syncs for auto graphics mode */
1008 cp_write_and_or(sd, 0x81, 0xef, 0x10); 1008 cp_write_clr_set(sd, 0x81, 0x10, 0x10);
1009 1009
1010 /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */ 1010 /* Should only be set in auto-graphics mode [REF_02, p. 91-92] */
1011 /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */ 1011 /* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */
@@ -1115,21 +1115,21 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
1115 if (state->selected_input == ADV7604_PAD_VGA_RGB) { 1115 if (state->selected_input == ADV7604_PAD_VGA_RGB) {
1116 /* Receiving analog RGB signal 1116 /* Receiving analog RGB signal
1117 * Set RGB full range (0-255) */ 1117 * Set RGB full range (0-255) */
1118 io_write_and_or(sd, 0x02, 0x0f, 0x10); 1118 io_write_clr_set(sd, 0x02, 0xf0, 0x10);
1119 break; 1119 break;
1120 } 1120 }
1121 1121
1122 if (state->selected_input == ADV7604_PAD_VGA_COMP) { 1122 if (state->selected_input == ADV7604_PAD_VGA_COMP) {
1123 /* Receiving analog YPbPr signal 1123 /* Receiving analog YPbPr signal
1124 * Set automode */ 1124 * Set automode */
1125 io_write_and_or(sd, 0x02, 0x0f, 0xf0); 1125 io_write_clr_set(sd, 0x02, 0xf0, 0xf0);
1126 break; 1126 break;
1127 } 1127 }
1128 1128
1129 if (hdmi_signal) { 1129 if (hdmi_signal) {
1130 /* Receiving HDMI signal 1130 /* Receiving HDMI signal
1131 * Set automode */ 1131 * Set automode */
1132 io_write_and_or(sd, 0x02, 0x0f, 0xf0); 1132 io_write_clr_set(sd, 0x02, 0xf0, 0xf0);
1133 break; 1133 break;
1134 } 1134 }
1135 1135
@@ -1138,10 +1138,10 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
1138 * input format (CE/IT) in automatic mode */ 1138 * input format (CE/IT) in automatic mode */
1139 if (state->timings.bt.standards & V4L2_DV_BT_STD_CEA861) { 1139 if (state->timings.bt.standards & V4L2_DV_BT_STD_CEA861) {
1140 /* RGB limited range (16-235) */ 1140 /* RGB limited range (16-235) */
1141 io_write_and_or(sd, 0x02, 0x0f, 0x00); 1141 io_write_clr_set(sd, 0x02, 0xf0, 0x00);
1142 } else { 1142 } else {
1143 /* RGB full range (0-255) */ 1143 /* RGB full range (0-255) */
1144 io_write_and_or(sd, 0x02, 0x0f, 0x10); 1144 io_write_clr_set(sd, 0x02, 0xf0, 0x10);
1145 1145
1146 if (is_digital_input(sd) && rgb_output) { 1146 if (is_digital_input(sd) && rgb_output) {
1147 adv7604_set_offset(sd, false, 0x40, 0x40, 0x40); 1147 adv7604_set_offset(sd, false, 0x40, 0x40, 0x40);
@@ -1154,23 +1154,23 @@ static void set_rgb_quantization_range(struct v4l2_subdev *sd)
1154 case V4L2_DV_RGB_RANGE_LIMITED: 1154 case V4L2_DV_RGB_RANGE_LIMITED:
1155 if (state->selected_input == ADV7604_PAD_VGA_COMP) { 1155 if (state->selected_input == ADV7604_PAD_VGA_COMP) {
1156 /* YCrCb limited range (16-235) */ 1156 /* YCrCb limited range (16-235) */
1157 io_write_and_or(sd, 0x02, 0x0f, 0x20); 1157 io_write_clr_set(sd, 0x02, 0xf0, 0x20);
1158 break; 1158 break;
1159 } 1159 }
1160 1160
1161 /* RGB limited range (16-235) */ 1161 /* RGB limited range (16-235) */
1162 io_write_and_or(sd, 0x02, 0x0f, 0x00); 1162 io_write_clr_set(sd, 0x02, 0xf0, 0x00);
1163 1163
1164 break; 1164 break;
1165 case V4L2_DV_RGB_RANGE_FULL: 1165 case V4L2_DV_RGB_RANGE_FULL:
1166 if (state->selected_input == ADV7604_PAD_VGA_COMP) { 1166 if (state->selected_input == ADV7604_PAD_VGA_COMP) {
1167 /* YCrCb full range (0-255) */ 1167 /* YCrCb full range (0-255) */
1168 io_write_and_or(sd, 0x02, 0x0f, 0x60); 1168 io_write_clr_set(sd, 0x02, 0xf0, 0x60);
1169 break; 1169 break;
1170 } 1170 }
1171 1171
1172 /* RGB full range (0-255) */ 1172 /* RGB full range (0-255) */
1173 io_write_and_or(sd, 0x02, 0x0f, 0x10); 1173 io_write_clr_set(sd, 0x02, 0xf0, 0x10);
1174 1174
1175 if (is_analog_input(sd) || hdmi_signal) 1175 if (is_analog_input(sd) || hdmi_signal)
1176 break; 1176 break;
@@ -1222,7 +1222,7 @@ static int adv7604_s_ctrl(struct v4l2_ctrl *ctrl)
1222 case V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL: 1222 case V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL:
1223 /* Use the default blue color for free running mode, 1223 /* Use the default blue color for free running mode,
1224 or supply your own. */ 1224 or supply your own. */
1225 cp_write_and_or(sd, 0xbf, ~0x04, (ctrl->val << 2)); 1225 cp_write_clr_set(sd, 0xbf, 0x04, ctrl->val << 2);
1226 return 0; 1226 return 0;
1227 case V4L2_CID_ADV_RX_FREE_RUN_COLOR: 1227 case V4L2_CID_ADV_RX_FREE_RUN_COLOR:
1228 cp_write(sd, 0xc0, (ctrl->val & 0xff0000) >> 16); 1228 cp_write(sd, 0xc0, (ctrl->val & 0xff0000) >> 16);
@@ -1605,11 +1605,11 @@ static int adv7604_query_dv_timings(struct v4l2_subdev *sd,
1605 v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__); 1605 v4l2_dbg(1, debug, sd, "%s: restart STDI\n", __func__);
1606 /* TODO restart STDI for Sync Channel 2 */ 1606 /* TODO restart STDI for Sync Channel 2 */
1607 /* enter one-shot mode */ 1607 /* enter one-shot mode */
1608 cp_write_and_or(sd, 0x86, 0xf9, 0x00); 1608 cp_write_clr_set(sd, 0x86, 0x06, 0x00);
1609 /* trigger STDI restart */ 1609 /* trigger STDI restart */
1610 cp_write_and_or(sd, 0x86, 0xf9, 0x04); 1610 cp_write_clr_set(sd, 0x86, 0x06, 0x04);
1611 /* reset to continuous mode */ 1611 /* reset to continuous mode */
1612 cp_write_and_or(sd, 0x86, 0xf9, 0x02); 1612 cp_write_clr_set(sd, 0x86, 0x06, 0x02);
1613 state->restart_stdi_once = false; 1613 state->restart_stdi_once = false;
1614 return -ENOLINK; 1614 return -ENOLINK;
1615 } 1615 }
@@ -1668,7 +1668,7 @@ static int adv7604_s_dv_timings(struct v4l2_subdev *sd,
1668 1668
1669 state->timings = *timings; 1669 state->timings = *timings;
1670 1670
1671 cp_write_and_or(sd, 0x91, 0xbf, bt->interlaced ? 0x40 : 0x00); 1671 cp_write_clr_set(sd, 0x91, 0x40, bt->interlaced ? 0x40 : 0x00);
1672 1672
1673 /* Use prim_mode and vid_std when available */ 1673 /* Use prim_mode and vid_std when available */
1674 err = configure_predefined_video_timings(sd, timings); 1674 err = configure_predefined_video_timings(sd, timings);
@@ -1712,10 +1712,10 @@ static void enable_input(struct v4l2_subdev *sd)
1712 if (is_analog_input(sd)) { 1712 if (is_analog_input(sd)) {
1713 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */ 1713 io_write(sd, 0x15, 0xb0); /* Disable Tristate of Pins (no audio) */
1714 } else if (is_digital_input(sd)) { 1714 } else if (is_digital_input(sd)) {
1715 hdmi_write_and_or(sd, 0x00, 0xfc, state->selected_input); 1715 hdmi_write_clr_set(sd, 0x00, 0x03, state->selected_input);
1716 state->info->set_termination(sd, true); 1716 state->info->set_termination(sd, true);
1717 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */ 1717 io_write(sd, 0x15, 0xa0); /* Disable Tristate of Pins */
1718 hdmi_write_and_or(sd, 0x1a, 0xef, 0x00); /* Unmute audio */ 1718 hdmi_write_clr_set(sd, 0x1a, 0x10, 0x00); /* Unmute audio */
1719 } else { 1719 } else {
1720 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n", 1720 v4l2_dbg(2, debug, sd, "%s: Unknown port %d selected\n",
1721 __func__, state->selected_input); 1721 __func__, state->selected_input);
@@ -1726,7 +1726,7 @@ static void disable_input(struct v4l2_subdev *sd)
1726{ 1726{
1727 struct adv7604_state *state = to_state(sd); 1727 struct adv7604_state *state = to_state(sd);
1728 1728
1729 hdmi_write_and_or(sd, 0x1a, 0xef, 0x10); /* Mute audio */ 1729 hdmi_write_clr_set(sd, 0x1a, 0x10, 0x10); /* Mute audio */
1730 msleep(16); /* 512 samples with >= 32 kHz sample rate [REF_03, c. 7.16.10] */ 1730 msleep(16); /* 512 samples with >= 32 kHz sample rate [REF_03, c. 7.16.10] */
1731 io_write(sd, 0x15, 0xbe); /* Tristate all outputs from video core */ 1731 io_write(sd, 0x15, 0xbe); /* Tristate all outputs from video core */
1732 state->info->set_termination(sd, false); 1732 state->info->set_termination(sd, false);
@@ -1857,12 +1857,12 @@ static void adv7604_setup_format(struct adv7604_state *state)
1857{ 1857{
1858 struct v4l2_subdev *sd = &state->sd; 1858 struct v4l2_subdev *sd = &state->sd;
1859 1859
1860 io_write_and_or(sd, 0x02, 0xfd, 1860 io_write_clr_set(sd, 0x02, 0x02,
1861 state->format->rgb_out ? ADV7604_RGB_OUT : 0); 1861 state->format->rgb_out ? ADV7604_RGB_OUT : 0);
1862 io_write(sd, 0x03, state->format->op_format_sel | 1862 io_write(sd, 0x03, state->format->op_format_sel |
1863 state->pdata.op_format_mode_sel); 1863 state->pdata.op_format_mode_sel);
1864 io_write_and_or(sd, 0x04, 0x1f, adv7604_op_ch_sel(state)); 1864 io_write_clr_set(sd, 0x04, 0xe0, adv7604_op_ch_sel(state));
1865 io_write_and_or(sd, 0x05, 0xfe, 1865 io_write_clr_set(sd, 0x05, 0x01,
1866 state->format->swap_cb_cr ? ADV7604_OP_SWAP_CB_CR : 0); 1866 state->format->swap_cb_cr ? ADV7604_OP_SWAP_CB_CR : 0);
1867} 1867}
1868 1868
@@ -2059,7 +2059,7 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
2059 /* Disable hotplug and I2C access to EDID RAM from DDC port */ 2059 /* Disable hotplug and I2C access to EDID RAM from DDC port */
2060 state->edid.present &= ~(1 << edid->pad); 2060 state->edid.present &= ~(1 << edid->pad);
2061 v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)&state->edid.present); 2061 v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)&state->edid.present);
2062 rep_write_and_or(sd, info->edid_enable_reg, 0xf0, state->edid.present); 2062 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, state->edid.present);
2063 2063
2064 /* Fall back to a 16:9 aspect ratio */ 2064 /* Fall back to a 16:9 aspect ratio */
2065 state->aspect_ratio.numerator = 16; 2065 state->aspect_ratio.numerator = 16;
@@ -2083,7 +2083,7 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
2083 /* Disable hotplug and I2C access to EDID RAM from DDC port */ 2083 /* Disable hotplug and I2C access to EDID RAM from DDC port */
2084 cancel_delayed_work_sync(&state->delayed_work_enable_hotplug); 2084 cancel_delayed_work_sync(&state->delayed_work_enable_hotplug);
2085 v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)&tmp); 2085 v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)&tmp);
2086 rep_write_and_or(sd, info->edid_enable_reg, 0xf0, 0x00); 2086 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, 0x00);
2087 2087
2088 spa_loc = get_edid_spa_location(edid->edid); 2088 spa_loc = get_edid_spa_location(edid->edid);
2089 if (spa_loc < 0) 2089 if (spa_loc < 0)
@@ -2112,10 +2112,10 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
2112 2112
2113 if (info->type == ADV7604) { 2113 if (info->type == ADV7604) {
2114 rep_write(sd, 0x76, spa_loc & 0xff); 2114 rep_write(sd, 0x76, spa_loc & 0xff);
2115 rep_write_and_or(sd, 0x77, 0xbf, (spa_loc & 0x100) >> 2); 2115 rep_write_clr_set(sd, 0x77, 0x40, (spa_loc & 0x100) >> 2);
2116 } else { 2116 } else {
2117 /* FIXME: Where is the SPA location LSB register ? */ 2117 /* FIXME: Where is the SPA location LSB register ? */
2118 rep_write_and_or(sd, 0x71, 0xfe, (spa_loc & 0x100) >> 8); 2118 rep_write_clr_set(sd, 0x71, 0x01, (spa_loc & 0x100) >> 8);
2119 } 2119 }
2120 2120
2121 edid->edid[spa_loc] = state->spa_port_a[0]; 2121 edid->edid[spa_loc] = state->spa_port_a[0];
@@ -2135,7 +2135,7 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
2135 2135
2136 /* adv7604 calculates the checksums and enables I2C access to internal 2136 /* adv7604 calculates the checksums and enables I2C access to internal
2137 EDID RAM from DDC port. */ 2137 EDID RAM from DDC port. */
2138 rep_write_and_or(sd, info->edid_enable_reg, 0xf0, state->edid.present); 2138 rep_write_clr_set(sd, info->edid_enable_reg, 0x0f, state->edid.present);
2139 2139
2140 for (i = 0; i < 1000; i++) { 2140 for (i = 0; i < 1000; i++) {
2141 if (rep_read(sd, info->edid_status_reg) & state->edid.present) 2141 if (rep_read(sd, info->edid_status_reg) & state->edid.present)
@@ -2431,11 +2431,11 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
2431 cp_write(sd, 0xcf, 0x01); /* Power down macrovision */ 2431 cp_write(sd, 0xcf, 0x01); /* Power down macrovision */
2432 2432
2433 /* video format */ 2433 /* video format */
2434 io_write_and_or(sd, 0x02, 0xf0, 2434 io_write_clr_set(sd, 0x02, 0x0f,
2435 pdata->alt_gamma << 3 | 2435 pdata->alt_gamma << 3 |
2436 pdata->op_656_range << 2 | 2436 pdata->op_656_range << 2 |
2437 pdata->alt_data_sat << 0); 2437 pdata->alt_data_sat << 0);
2438 io_write_and_or(sd, 0x05, 0xf1, pdata->blank_data << 3 | 2438 io_write_clr_set(sd, 0x05, 0x0e, pdata->blank_data << 3 |
2439 pdata->insert_av_codes << 2 | 2439 pdata->insert_av_codes << 2 |
2440 pdata->replicate_av_codes << 1); 2440 pdata->replicate_av_codes << 1);
2441 adv7604_setup_format(state); 2441 adv7604_setup_format(state);
@@ -2460,16 +2460,16 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
2460 for digital formats */ 2460 for digital formats */
2461 2461
2462 /* HDMI audio */ 2462 /* HDMI audio */
2463 hdmi_write_and_or(sd, 0x15, 0xfc, 0x03); /* Mute on FIFO over-/underflow [REF_01, c. 1.2.18] */ 2463 hdmi_write_clr_set(sd, 0x15, 0x03, 0x03); /* Mute on FIFO over-/underflow [REF_01, c. 1.2.18] */
2464 hdmi_write_and_or(sd, 0x1a, 0xf1, 0x08); /* Wait 1 s before unmute */ 2464 hdmi_write_clr_set(sd, 0x1a, 0x0e, 0x08); /* Wait 1 s before unmute */
2465 hdmi_write_and_or(sd, 0x68, 0xf9, 0x06); /* FIFO reset on over-/underflow [REF_01, c. 1.2.19] */ 2465 hdmi_write_clr_set(sd, 0x68, 0x06, 0x06); /* FIFO reset on over-/underflow [REF_01, c. 1.2.19] */
2466 2466
2467 /* TODO from platform data */ 2467 /* TODO from platform data */
2468 afe_write(sd, 0xb5, 0x01); /* Setting MCLK to 256Fs */ 2468 afe_write(sd, 0xb5, 0x01); /* Setting MCLK to 256Fs */
2469 2469
2470 if (adv7604_has_afe(state)) { 2470 if (adv7604_has_afe(state)) {
2471 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */ 2471 afe_write(sd, 0x02, pdata->ain_sel); /* Select analog input muxing mode */
2472 io_write_and_or(sd, 0x30, ~(1 << 4), pdata->output_bus_lsb_to_msb << 4); 2472 io_write_clr_set(sd, 0x30, 1 << 4, pdata->output_bus_lsb_to_msb << 4);
2473 } 2473 }
2474 2474
2475 /* interrupts */ 2475 /* interrupts */