Lines Matching +full:read +full:- +full:write

1 // SPDX-License-Identifier: GPL-2.0+
27 #define REG_VERSION_LSB REG(0x00, 0x00) /* read */
28 #define REG_MAIN_CNTRL0 REG(0x00, 0x01) /* read/write */
35 #define REG_VERSION_MSB REG(0x00, 0x02) /* read */
36 #define REG_SOFTRESET REG(0x00, 0x0a) /* write */
39 #define REG_DDC_DISABLE REG(0x00, 0x0b) /* read/write */
40 #define REG_I2C_MASTER REG(0x00, 0x0d) /* read/write */
44 #define REG_FEAT_POWERDOWN REG(0x00, 0x0e) /* read/write */
48 #define REG_INT_FLAGS_0 REG(0x00, 0x0f) /* read/write */
49 #define REG_INT_FLAGS_1 REG(0x00, 0x10) /* read/write */
50 #define REG_INT_FLAGS_2 REG(0x00, 0x11) /* read/write */
52 #define REG_ENA_VP_0 REG(0x00, 0x18) /* read/write */
53 #define REG_ENA_VP_1 REG(0x00, 0x19) /* read/write */
54 #define REG_ENA_VP_2 REG(0x00, 0x1a) /* read/write */
55 #define REG_ENA_AP REG(0x00, 0x1e) /* read/write */
56 #define REG_VIP_CNTRL_0 REG(0x00, 0x20) /* write */
61 #define REG_VIP_CNTRL_1 REG(0x00, 0x21) /* write */
66 #define REG_VIP_CNTRL_2 REG(0x00, 0x22) /* write */
71 #define REG_VIP_CNTRL_3 REG(0x00, 0x23) /* write */
80 #define REG_VIP_CNTRL_4 REG(0x00, 0x24) /* write */
87 #define REG_VIP_CNTRL_5 REG(0x00, 0x25) /* write */
90 #define REG_MUX_VP_VIP_OUT REG(0x00, 0x27) /* read/write */
91 #define REG_MAT_CONTRL REG(0x00, 0x80) /* write */
94 #define REG_VIDFORMAT REG(0x00, 0xa0) /* write */
95 #define REG_REFPIX_MSB REG(0x00, 0xa1) /* write */
96 #define REG_REFPIX_LSB REG(0x00, 0xa2) /* write */
97 #define REG_REFLINE_MSB REG(0x00, 0xa3) /* write */
98 #define REG_REFLINE_LSB REG(0x00, 0xa4) /* write */
99 #define REG_NPIX_MSB REG(0x00, 0xa5) /* write */
100 #define REG_NPIX_LSB REG(0x00, 0xa6) /* write */
101 #define REG_NLINE_MSB REG(0x00, 0xa7) /* write */
102 #define REG_NLINE_LSB REG(0x00, 0xa8) /* write */
103 #define REG_VS_LINE_STRT_1_MSB REG(0x00, 0xa9) /* write */
104 #define REG_VS_LINE_STRT_1_LSB REG(0x00, 0xaa) /* write */
105 #define REG_VS_PIX_STRT_1_MSB REG(0x00, 0xab) /* write */
106 #define REG_VS_PIX_STRT_1_LSB REG(0x00, 0xac) /* write */
107 #define REG_VS_LINE_END_1_MSB REG(0x00, 0xad) /* write */
108 #define REG_VS_LINE_END_1_LSB REG(0x00, 0xae) /* write */
109 #define REG_VS_PIX_END_1_MSB REG(0x00, 0xaf) /* write */
110 #define REG_VS_PIX_END_1_LSB REG(0x00, 0xb0) /* write */
111 #define REG_VS_LINE_STRT_2_MSB REG(0x00, 0xb1) /* write */
112 #define REG_VS_LINE_STRT_2_LSB REG(0x00, 0xb2) /* write */
113 #define REG_VS_PIX_STRT_2_MSB REG(0x00, 0xb3) /* write */
114 #define REG_VS_PIX_STRT_2_LSB REG(0x00, 0xb4) /* write */
115 #define REG_VS_LINE_END_2_MSB REG(0x00, 0xb5) /* write */
116 #define REG_VS_LINE_END_2_LSB REG(0x00, 0xb6) /* write */
117 #define REG_VS_PIX_END_2_MSB REG(0x00, 0xb7) /* write */
118 #define REG_VS_PIX_END_2_LSB REG(0x00, 0xb8) /* write */
119 #define REG_HS_PIX_START_MSB REG(0x00, 0xb9) /* write */
120 #define REG_HS_PIX_START_LSB REG(0x00, 0xba) /* write */
121 #define REG_HS_PIX_STOP_MSB REG(0x00, 0xbb) /* write */
122 #define REG_HS_PIX_STOP_LSB REG(0x00, 0xbc) /* write */
123 #define REG_VWIN_START_1_MSB REG(0x00, 0xbd) /* write */
124 #define REG_VWIN_START_1_LSB REG(0x00, 0xbe) /* write */
125 #define REG_VWIN_END_1_MSB REG(0x00, 0xbf) /* write */
126 #define REG_VWIN_END_1_LSB REG(0x00, 0xc0) /* write */
127 #define REG_VWIN_START_2_MSB REG(0x00, 0xc1) /* write */
128 #define REG_VWIN_START_2_LSB REG(0x00, 0xc2) /* write */
129 #define REG_VWIN_END_2_MSB REG(0x00, 0xc3) /* write */
130 #define REG_VWIN_END_2_LSB REG(0x00, 0xc4) /* write */
131 #define REG_DE_START_MSB REG(0x00, 0xc5) /* write */
132 #define REG_DE_START_LSB REG(0x00, 0xc6) /* write */
133 #define REG_DE_STOP_MSB REG(0x00, 0xc7) /* write */
134 #define REG_DE_STOP_LSB REG(0x00, 0xc8) /* write */
135 #define REG_TBG_CNTRL_0 REG(0x00, 0xca) /* write */
143 #define REG_TBG_CNTRL_1 REG(0x00, 0xcb) /* write */
151 #define REG_ENABLE_SPACE REG(0x00, 0xd6) /* write */
152 #define REG_HVF_CNTRL_0 REG(0x00, 0xe4) /* write */
157 #define REG_HVF_CNTRL_1 REG(0x00, 0xe5) /* write */
162 #define REG_RPT_CNTRL REG(0x00, 0xf0) /* write */
163 #define REG_AIP_CLKSEL REG(0x00, 0xfd) /* write */
170 #define REG_PLL_SERIAL_1 REG(0x02, 0x00) /* read/write */
174 #define REG_PLL_SERIAL_2 REG(0x02, 0x01) /* read/write */
177 #define REG_PLL_SERIAL_3 REG(0x02, 0x02) /* read/write */
181 #define REG_SERIALIZER REG(0x02, 0x03) /* read/write */
182 #define REG_BUFFER_OUT REG(0x02, 0x04) /* read/write */
183 #define REG_PLL_SCG1 REG(0x02, 0x05) /* read/write */
184 #define REG_PLL_SCG2 REG(0x02, 0x06) /* read/write */
185 #define REG_PLL_SCGN1 REG(0x02, 0x07) /* read/write */
186 #define REG_PLL_SCGN2 REG(0x02, 0x08) /* read/write */
187 #define REG_PLL_SCGR1 REG(0x02, 0x09) /* read/write */
188 #define REG_PLL_SCGR2 REG(0x02, 0x0a) /* read/write */
189 #define REG_AUDIO_DIV REG(0x02, 0x0e) /* read/write */
196 #define REG_SEL_CLK REG(0x02, 0x11) /* read/write */
200 #define REG_ANA_GENERAL REG(0x02, 0x12) /* read/write */
203 #define REG_EDID_DATA_0 REG(0x09, 0x00) /* read */
205 #define REG_EDID_CTRL REG(0x09, 0xfa) /* read/write */
206 #define REG_DDC_ADDR REG(0x09, 0xfb) /* read/write */
207 #define REG_DDC_OFFS REG(0x09, 0xfc) /* read/write */
208 #define REG_DDC_SEGM_ADDR REG(0x09, 0xfd) /* read/write */
209 #define REG_DDC_SEGM REG(0x09, 0xfe) /* read/write */
212 #define REG_AIP_CNTRL_0 REG(0x11, 0x00) /* read/write */
214 #define REG_ENC_CNTRL REG(0x11, 0x0d) /* read/write */
220 #define REG_TX3 REG(0x12, 0x9a) /* read/write */
221 #define REG_TX4 REG(0x12, 0x9b) /* read/write */
223 #define REG_TX33 REG(0x12, 0xb8) /* read/write */
227 #define REG_CEC_FRO_IM_CLK_CTRL 0xfb /* read/write */
232 #define REG_CEC_RXSHPDINTENA 0xfc /* read/write */
233 #define REG_CEC_RXSHPDINT 0xfd /* read */
236 #define TDA19988_CEC_ENAMODS 0xff /* read/write */
258 if (priv->current_page != page) { in tda19988_register_set()
259 dm_i2c_reg_write(priv->chip, REG_CURRENT_PAGE, page); in tda19988_register_set()
260 priv->current_page = page; in tda19988_register_set()
262 old_val = dm_i2c_reg_read(priv->chip, REG2ADDR(reg)); in tda19988_register_set()
264 dm_i2c_reg_write(priv->chip, REG2ADDR(reg), old_val); in tda19988_register_set()
271 if (priv->current_page != page) { in tda19988_register_clear()
272 dm_i2c_reg_write(priv->chip, REG_CURRENT_PAGE, page); in tda19988_register_clear()
273 priv->current_page = page; in tda19988_register_clear()
275 old_val = dm_i2c_reg_read(priv->chip, REG2ADDR(reg)); in tda19988_register_clear()
277 dm_i2c_reg_write(priv->chip, REG2ADDR(reg), old_val); in tda19988_register_clear()
284 if (priv->current_page != page) { in tda19988_register_write()
285 dm_i2c_reg_write(priv->chip, REG_CURRENT_PAGE, page); in tda19988_register_write()
286 priv->current_page = page; in tda19988_register_write()
288 dm_i2c_reg_write(priv->chip, REG2ADDR(reg), val); in tda19988_register_write()
295 if (priv->current_page != page) { in tda19988_register_read()
296 dm_i2c_reg_write(priv->chip, REG_CURRENT_PAGE, page); in tda19988_register_read()
297 priv->current_page = page; in tda19988_register_read()
299 return dm_i2c_reg_read(priv->chip, REG2ADDR(reg)); in tda19988_register_read()
307 if (priv->current_page != page) { in tda19988_register_write16()
308 dm_i2c_reg_write(priv->chip, REG_CURRENT_PAGE, page); in tda19988_register_write16()
309 priv->current_page = page; in tda19988_register_write16()
311 dm_i2c_write(priv->chip, REG2ADDR(reg), buf, 2); in tda19988_register_write16()
320 * The TDA998x has a problem when trying to read the EDID close to a in tda19988_read_edid()
322 * trying to read EDID data. in tda19988_read_edid()
326 if (priv->revision == TDA19988) in tda19988_read_edid()
341 /* wait for block read to complete */ in tda19988_read_edid()
342 for (i = 300; i > 0; i--) { in tda19988_read_edid()
352 return -ETIMEDOUT; in tda19988_read_edid()
354 priv->current_page = REG2PAGE(REG_EDID_DATA_0); in tda19988_read_edid()
355 dm_i2c_reg_write(priv->chip, in tda19988_read_edid()
357 val = dm_i2c_read(priv->chip, in tda19988_read_edid()
362 if (priv->revision == TDA19988) in tda19988_read_edid()
372 u8 div = 148500000 / timing->pixelclock.typ, reg; in tda19988_enable()
376 div--; in tda19988_enable()
388 line_clocks = timing->hsync_len.typ + timing->hback_porch.typ + in tda19988_enable()
389 timing->hactive.typ + timing->hfront_porch.typ; in tda19988_enable()
390 lines = timing->vsync_len.typ + timing->vback_porch.typ + in tda19988_enable()
391 timing->vactive.typ + timing->vfront_porch.typ; in tda19988_enable()
400 /* no pre-filter or interpolator */ in tda19988_enable()
439 * TDA19988 requires high-active sync at input stage, in tda19988_enable()
440 * so invert low-active sync provided by master encoder here in tda19988_enable()
442 if (timing->flags & DISPLAY_FLAGS_HSYNC_LOW) in tda19988_enable()
444 if (timing->flags & DISPLAY_FLAGS_VSYNC_LOW) in tda19988_enable()
450 timing->hfront_porch.typ + 3); in tda19988_enable()
452 timing->vfront_porch.typ + 1); in tda19988_enable()
456 timing->vfront_porch.typ); in tda19988_enable()
458 timing->hfront_porch.typ); in tda19988_enable()
460 timing->vfront_porch.typ + in tda19988_enable()
461 timing->vsync_len.typ); in tda19988_enable()
463 timing->hfront_porch.typ); in tda19988_enable()
469 timing->hfront_porch.typ); in tda19988_enable()
471 timing->hfront_porch.typ + in tda19988_enable()
472 timing->hsync_len.typ); in tda19988_enable()
474 lines - timing->vactive.typ - 1); in tda19988_enable()
475 tda19988_register_write16(priv, REG_VWIN_END_1_MSB, lines - 1); in tda19988_enable()
479 line_clocks - timing->hactive.typ); in tda19988_enable()
482 if (priv->revision == TDA19988) { in tda19988_enable()
492 if (timing->flags & DISPLAY_FLAGS_HSYNC_LOW) in tda19988_enable()
494 if (timing->flags & DISPLAY_FLAGS_VSYNC_LOW) in tda19988_enable()
544 err = i2c_get_chip_for_busnum(0, cec_addr, 1, &priv->cec_chip); in tda19988_probe()
550 err = i2c_get_chip_for_busnum(0, chip_addr, 1, &priv->chip); in tda19988_probe()
556 priv->current_page = 0xff; in tda19988_probe()
559 dm_i2c_reg_write(priv->cec_chip, TDA19988_CEC_ENAMODS, in tda19988_probe()
590 /* Write the default value MUX register */ in tda19988_probe()
593 /* read version */ in tda19988_probe()
594 rev_lo = dm_i2c_reg_read(priv->chip, REG_VERSION_LSB); in tda19988_probe()
595 rev_hi = dm_i2c_reg_read(priv->chip, REG_VERSION_MSB); in tda19988_probe()
598 priv->revision = ((rev_hi << 8) | rev_lo) & ~0x30; in tda19988_probe()
601 switch (priv->revision) { in tda19988_probe()
615 printf("unknown TDA device: 0x%04x\n", priv->revision); in tda19988_probe()
616 return -ENXIO; in tda19988_probe()
625 /* if necessary, disable multi-master */ in tda19988_probe()
626 if (priv->revision == TDA19989) in tda19988_probe()
629 dm_i2c_reg_write(priv->cec_chip, REG_CEC_FRO_IM_CLK_CTRL, in tda19988_probe()
633 dm_i2c_reg_write(priv->cec_chip, REG_CEC_RXSHPDINTENA, 0); in tda19988_probe()
635 dm_i2c_reg_read(priv->cec_chip, REG_CEC_RXSHPDINT); in tda19988_probe()
640 /* enable EDID read irq */ in tda19988_probe()