coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
anx7625.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <delay.h>
5 #include <device/i2c_simple.h>
6 #include <edid.h>
7 #include <gpio.h>
8 #include <string.h>
9 #include <types.h>
10 
11 #include "anx7625.h"
12 
13 #define ANXERROR(format, ...) \
14  printk(BIOS_ERR, "%s: " format, __func__, ##__VA_ARGS__)
15 #define ANXINFO(format, ...) \
16  printk(BIOS_INFO, "%s: " format, __func__, ##__VA_ARGS__)
17 #define ANXDEBUG(format, ...) \
18  printk(BIOS_DEBUG, "%s: " format, __func__, ##__VA_ARGS__)
19 
20 /*
21  * There is a sync issue while accessing I2C register between AP(CPU) and
22  * internal firmware(OCM). To avoid the race condition, AP should access the
23  * reserved slave address before slave address changes.
24  */
26 {
28  static uint8_t saddr_backup = 0;
29  int ret = 0;
30 
31  if (saddr == saddr_backup)
32  return ret;
33 
34  saddr_backup = saddr;
35 
36  switch (saddr) {
39  break;
40  case TX_P0_ADDR:
42  break;
43  case TX_P1_ADDR:
45  break;
46  case RX_P0_ADDR:
48  break;
49  case RX_P1_ADDR:
51  break;
52  default:
54  break;
55  }
56 
57  ret = i2c_writeb(bus, saddr, offset, 0x00);
58  if (ret < 0) {
59  ANXERROR("Failed to access %#x:%#x\n", saddr, offset);
60  return ret;
61  }
62  return 0;
63 }
64 
66  uint8_t *val)
67 {
68  int ret;
69 
70  i2c_access_workaround(bus, saddr);
71  ret = i2c_readb(bus, saddr, offset, val);
72  if (ret < 0) {
73  ANXERROR("Failed to read i2c reg=%#x:%#x\n", saddr, offset);
74  return ret;
75  }
76  return 0;
77 }
78 
79 static int anx7625_reg_block_read(uint8_t bus, uint8_t saddr, uint8_t reg_addr,
80  uint8_t len, uint8_t *buf)
81 {
82  int ret;
83 
84  i2c_access_workaround(bus, saddr);
85  ret = i2c_read_bytes(bus, saddr, reg_addr, buf, len);
86  if (ret < 0) {
87  ANXERROR("Failed to read i2c block=%#x:%#x[len=%#x]\n", saddr,
88  reg_addr, len);
89  return ret;
90  }
91  return 0;
92 }
93 
94 static int anx7625_reg_write(uint8_t bus, uint8_t saddr, uint8_t reg_addr,
95  uint8_t reg_val)
96 {
97  int ret;
98 
99  i2c_access_workaround(bus, saddr);
100  ret = i2c_writeb(bus, saddr, reg_addr, reg_val);
101  if (ret < 0) {
102  ANXERROR("Failed to write i2c id=%#x:%#x\n", saddr, reg_addr);
103  return ret;
104  }
105  return 0;
106 }
107 
109  uint8_t mask)
110 {
111  uint8_t val;
112  int ret;
113 
114  ret = anx7625_reg_read(bus, saddr, offset, &val);
115  if (ret < 0)
116  return ret;
117 
118  return anx7625_reg_write(bus, saddr, offset, val | mask);
119 }
120 
122  uint8_t mask)
123 {
124  int ret;
125  uint8_t val;
126 
127  ret = anx7625_reg_read(bus, saddr, offset, &val);
128  if (ret < 0)
129  return ret;
130 
131  return anx7625_reg_write(bus, saddr, offset, val & mask);
132 }
133 
135 {
136  uint8_t val;
137  int ret;
138 
139  if (!retry(150,
141  !(val & AP_AUX_CTRL_OP_EN)), mdelay(2))) {
142  ANXERROR("Timed out waiting aux operation.\n");
143  return -1;
144  }
145 
147  if (ret < 0 || val & 0x0F) {
148  ANXDEBUG("aux status %02x\n", val);
149  return -1;
150  }
151 
152  return 0;
153 }
154 
155 static unsigned long gcd(unsigned long a, unsigned long b)
156 {
157  if (a == 0)
158  return b;
159 
160  while (b != 0) {
161  if (a > b)
162  a = a - b;
163  else
164  b = b - a;
165  }
166 
167  return a;
168 }
169 
170 /* Reduce fraction a/b */
171 static void anx7625_reduction_of_a_fraction(unsigned long *_a,
172  unsigned long *_b)
173 {
174  unsigned long gcd_num;
175  unsigned long a = *_a, b = *_b, old_a, old_b;
176  u32 denom = 1;
177 
178  gcd_num = gcd(a, b);
179  a /= gcd_num;
180  b /= gcd_num;
181 
182  old_a = a;
183  old_b = b;
184 
185  while (a > MAX_UNSIGNED_24BIT || b > MAX_UNSIGNED_24BIT) {
186  denom++;
187  a = old_a / denom;
188  b = old_b / denom;
189  }
190 
191  /* Increase a, b to have higher ODFC PLL output frequency accuracy. */
192  while ((a << 1) < MAX_UNSIGNED_24BIT && (b << 1) < MAX_UNSIGNED_24BIT) {
193  a <<= 1;
194  b <<= 1;
195  }
196 
197  *_a = a;
198  *_b = b;
199 }
200 
201 static int anx7625_calculate_m_n(u32 pixelclock,
202  unsigned long *m, unsigned long *n,
203  uint8_t *pd)
204 {
205  uint8_t post_divider = *pd;
206  if (pixelclock > PLL_OUT_FREQ_ABS_MAX / POST_DIVIDER_MIN) {
207  /* pixel clock frequency is too high */
208  ANXERROR("pixelclock %u higher than %lu, "
209  "output may be unstable\n",
210  pixelclock, PLL_OUT_FREQ_ABS_MAX / POST_DIVIDER_MIN);
211  return -1;
212  }
213 
214  if (pixelclock < PLL_OUT_FREQ_ABS_MIN / POST_DIVIDER_MAX) {
215  /* pixel clock frequency is too low */
216  ANXERROR("pixelclock %u lower than %lu, "
217  "output may be unstable\n",
218  pixelclock, PLL_OUT_FREQ_ABS_MIN / POST_DIVIDER_MAX);
219  return -1;
220  }
221 
222  post_divider = 1;
223 
224  for (post_divider = 1;
225  pixelclock < PLL_OUT_FREQ_MIN / post_divider;
226  post_divider++)
227  ;
228 
229  if (post_divider > POST_DIVIDER_MAX) {
230  for (post_divider = 1;
231  pixelclock < PLL_OUT_FREQ_ABS_MIN / post_divider;
232  post_divider++)
233  ;
234 
235  if (post_divider > POST_DIVIDER_MAX) {
236  ANXERROR("cannot find property post_divider(%d)\n",
237  post_divider);
238  return -1;
239  }
240  }
241 
242  /* Patch to improve the accuracy */
243  if (post_divider == 7) {
244  /* 27,000,000 is not divisible by 7 */
245  post_divider = 8;
246  } else if (post_divider == 11) {
247  /* 27,000,000 is not divisible by 11 */
248  post_divider = 12;
249  } else if (post_divider == 13 || post_divider == 14) {
250  /*27,000,000 is not divisible by 13 or 14*/
251  post_divider = 15;
252  }
253 
254  if (pixelclock * post_divider > PLL_OUT_FREQ_ABS_MAX) {
255  ANXINFO("act clock(%u) large than maximum(%lu)\n",
256  pixelclock * post_divider, PLL_OUT_FREQ_ABS_MAX);
257  return -1;
258  }
259 
260  *m = pixelclock;
261  *n = XTAL_FRQ / post_divider;
262  *pd = post_divider;
263 
265 
266  return 0;
267 }
268 
269 static int anx7625_odfc_config(uint8_t bus, uint8_t post_divider)
270 {
271  int ret;
272 
273  /* config input reference clock frequency 27MHz/19.2MHz */
278  /* post divider */
281  post_divider << 4);
282 
283  /* add patch for MIS2-125 (5pcs ANX7625 fail ATE MBIST test) */
286 
287  /* reset ODFC PLL */
292 
293  if (ret < 0) {
294  ANXERROR("IO error.\n");
295  return ret;
296  }
297 
298  return 0;
299 }
300 
302 {
303  unsigned long m, n;
304  u16 htotal;
305  int ret;
306  uint8_t post_divider = 0;
307 
308  if (anx7625_calculate_m_n(dt->pixelclock * 1000, &m, &n,
309  &post_divider) < 0) {
310  ANXERROR("cannot get property m n value.\n");
311  return -1;
312  }
313 
314  ANXINFO("compute M(%lu), N(%lu), divider(%d).\n", m, n, post_divider);
315 
316  /* configure pixel clock */
318  (dt->pixelclock / 1000) & 0xFF);
320  (dt->pixelclock / 1000) >> 8);
321  /* lane count */
323 
325 
326  /* Htotal */
327  htotal = dt->hactive + dt->hfront_porch +
328  dt->hback_porch + dt->hsync_len;
333  /* Hactive */
335  HORIZONTAL_ACTIVE_PIXELS_L, dt->hactive & 0xFF);
338  /* HFP */
343  dt->hfront_porch >> 8);
344  /* HWS */
349  /* HBP */
354  /* Vactive */
357  dt->vactive >> 8);
358  /* VFP */
361  /* VWS */
364  /* VBP */
367  /* M value */
369  MIPI_PLL_M_NUM_23_16, (m >> 16) & 0xff);
371  MIPI_PLL_M_NUM_15_8, (m >> 8) & 0xff);
373  MIPI_PLL_M_NUM_7_0, (m & 0xff));
374  /* N value */
376  MIPI_PLL_N_NUM_23_16, (n >> 16) & 0xff);
378  MIPI_PLL_N_NUM_15_8, (n >> 8) & 0xff);
380  (n & 0xff));
381  /* diff */
383 
384  ret |= anx7625_odfc_config(bus, post_divider - 1);
385 
386  if (ret < 0) {
387  ANXERROR("mipi dsi setup IO error.\n");
388  return ret;
389  }
390 
391  return 0;
392 }
393 
395 {
396  int ret;
397  uint8_t val;
398 
399  /* swap MIPI-DSI data lane 3 P and N */
401  if (ret < 0) {
402  ANXERROR("IO error: access MIPI_SWAP.\n");
403  return ret;
404  }
405 
406  val |= (1 << MIPI_SWAP_CH3);
408 }
409 
411 
412 {
413  int val, ret;
414 
415  /* swap MIPI-DSI data lane 3 P and N */
417  if (ret < 0) {
418  ANXERROR("IO error: swap dsi lane 3 failed.\n");
419  return ret;
420  }
421 
422  /* DSI clock settings */
423  val = (0 << MIPI_HS_PWD_CLK) |
424  (0 << MIPI_HS_RT_CLK) |
425  (0 << MIPI_PD_CLK) |
426  (1 << MIPI_CLK_RT_MANUAL_PD_EN) |
427  (1 << MIPI_CLK_HS_MANUAL_PD_EN) |
428  (0 << MIPI_CLK_DET_DET_BYPASS) |
429  (0 << MIPI_CLK_MISS_CTRL) |
432 
433  /*
434  * Decreased HS prepare tg delay from 160ns to 80ns work with
435  * a) Dragon board 810 series (Qualcomm AP)
436  * b) Moving Pixel DSI source (PG3A pattern generator +
437  * P332 D-PHY Probe) default D-PHY tg 5ns/step
438  */
440 
441  /* enable DSI mode */
444 
445  ret |= anx7625_dsi_video_config(bus, dt);
446  if (ret < 0) {
447  ANXERROR("dsi video tg config failed\n");
448  return ret;
449  }
450 
451  /* toggle m, n ready */
454  mdelay(1);
457 
458  /* configure integer stable register */
460  /* power on MIPI RX */
463 
464  if (ret < 0) {
465  ANXERROR("IO error: mipi dsi enable init failed.\n");
466  return ret;
467  }
468 
469  return 0;
470 }
471 
473 {
474  int ret;
475 
476  ANXINFO("config dsi.\n");
477 
478  /* DSC disable */
480  ret |= anx7625_api_dsi_config(bus, dt);
481 
482  if (ret < 0) {
483  ANXERROR("IO error: api dsi config error.\n");
484  return ret;
485  }
486 
487  /* set MIPI RX EN */
489  /* clear mute flag */
491 
492  if (ret < 0) {
493  ANXERROR("IO error: enable mipi rx failed.\n");
494  return ret;
495  }
496 
497  ANXINFO("success to config DSI\n");
498  return 0;
499 }
500 
502 {
503  int ret;
504 
507  return ret;
508 }
509 
511 {
512  int ret;
513 
518  return ret | wait_aux_op_finish(bus);
519 }
520 
521 static int sp_tx_aux_rd(uint8_t bus, uint8_t len_cmd)
522 {
523  int ret;
524 
528  return ret | wait_aux_op_finish(bus);
529 }
530 
532 {
533  int ret;
534  uint8_t val = 0;
535 
536  sp_tx_aux_wr(bus, 0x7e);
537  sp_tx_aux_rd(bus, 0x01);
539 
540  if (ret < 0) {
541  ANXERROR("IO error: access AUX BUFF.\n");
542  return -1;
543  }
544 
545  ANXINFO("EDID Block = %d\n", val + 1);
546 
547  if (val > 3)
548  val = 1;
549 
550  return val;
551 }
552 
553 static int edid_read(uint8_t bus, uint8_t offset, uint8_t *pblock_buf)
554 {
555  int ret, cnt;
556 
557  for (cnt = 0; cnt < 3; cnt++) {
559  /* set I2C read com 0x01 mot = 0 and read 16 bytes */
560  ret = sp_tx_aux_rd(bus, 0xf1);
561 
562  if (ret < 0) {
564  ANXERROR("edid read failed, reset!\n");
565  } else {
569  pblock_buf) >= 0)
570  return 0;
571  }
572  }
573 
574  return -1;
575 }
576 
578  uint8_t offset)
579 {
580  int ret, cnt;
581 
582  /* write address only */
587 
588  ret |= wait_aux_op_finish(bus);
589  /* write segment address */
590  ret |= sp_tx_aux_wr(bus, segment);
591  /* data read */
593 
594  if (ret < 0) {
595  ANXERROR("IO error: aux initial failed.\n");
596  return ret;
597  }
598 
599  for (cnt = 0; cnt < 3; cnt++) {
601  /* set I2C read com 0x01 mot = 0 and read 16 bytes */
602  ret = sp_tx_aux_rd(bus, 0xf1);
603 
604  if (ret < 0) {
606  ANXERROR("segment read failed, reset!\n");
607  } else {
611  buf) >= 0)
612  return 0;
613  }
614  }
615 
616  return -1;
617 }
618 
619 static int sp_tx_edid_read(uint8_t bus, uint8_t *pedid_blocks_buf,
620  uint32_t size)
621 {
622  uint8_t offset, edid_pos;
623  int count, blocks_num;
624  uint8_t pblock_buf[MAX_DPCD_BUFFER_SIZE];
625  int i, ret, g_edid_break = 0;
626 
627  /* address initial */
631 
632  if (ret < 0) {
633  ANXERROR("access aux channel IO error.\n");
634  return -1;
635  }
636 
637  blocks_num = sp_tx_get_edid_block(bus);
638  if (blocks_num < 0)
639  return -1;
640 
641  count = 0;
642 
643  do {
644  switch (count) {
645  case 0:
646  case 1:
647  for (i = 0; i < 8; i++) {
648  offset = (i + count * 8) * MAX_DPCD_BUFFER_SIZE;
649  g_edid_break = !!edid_read(bus, offset,
650  pblock_buf);
651 
652  if (g_edid_break)
653  break;
654 
655  if (offset <= size - MAX_DPCD_BUFFER_SIZE)
656  memcpy(&pedid_blocks_buf[offset],
657  pblock_buf,
659  }
660 
661  break;
662  case 2:
663  case 3:
664  offset = (count == 2) ? 0x00 : 0x80;
665 
666  for (i = 0; i < 8; i++) {
667  edid_pos = (i + count * 8) *
669 
670  if (g_edid_break)
671  break;
672 
674  pblock_buf, offset);
675  if (edid_pos <= size - MAX_DPCD_BUFFER_SIZE)
676  memcpy(&pedid_blocks_buf[edid_pos],
677  pblock_buf,
679  offset = offset + 0x10;
680  }
681 
682  break;
683  default:
684  die("%s: count should be <= 3", __func__);
685  break;
686  }
687 
688  count++;
689 
690  } while (blocks_num >= count);
691 
692  /* reset aux channel */
694 
695  return blocks_num;
696 }
697 
699 {
700  int ret;
701 
702  /* reset main ocm */
703  ret = anx7625_reg_write(bus, RX_P0_ADDR, 0x88, 0x40);
704  /* Disable PD */
706  /* release main ocm */
707  ret |= anx7625_reg_write(bus, RX_P0_ADDR, 0x88, 0x00);
708 
709  if (ret < 0)
710  ANXERROR("Failed to disable PD feature.\n");
711  else
712  ANXINFO("Disabled PD feature.\n");
713 }
714 
715 #define FLASH_LOAD_STA 0x05
716 #define FLASH_LOAD_STA_CHK (1 << 7)
717 
719 {
720  int i, ret;
721  uint8_t val, version, revision;
722 
724 
725  for (i = 0; i < OCM_LOADING_TIME; i++) {
726  /* check interface */
728  if (ret < 0) {
729  ANXERROR("Failed to load flash\n");
730  return ret;
731  }
732 
734  mdelay(1);
735  continue;
736  }
737  ANXINFO("Init interface.\n");
738 
742  ANXINFO("Firmware: ver %#02x, rev %#02x.\n", version, revision);
743  return 0;
744  }
745  return -1;
746 }
747 
749 {
750  int ret;
751  uint8_t val;
752 
753  /* not support HDCP */
754  ret = anx7625_write_and(bus, RX_P1_ADDR, 0xee, 0x9f);
755 
756  /* try auth flag */
757  ret |= anx7625_write_or(bus, RX_P1_ADDR, 0xec, 0x10);
758  /* interrupt for DRM */
759  ret |= anx7625_write_or(bus, RX_P1_ADDR, 0xff, 0x01);
760  if (ret < 0)
761  return;
762 
763  ret = anx7625_reg_read(bus, RX_P1_ADDR, 0x86, &val);
764  if (ret < 0)
765  return;
766 
767  ANXINFO("Secure OCM version=%02x\n", val);
768 }
769 
771 {
772  int ret;
773  uint8_t status;
774 
775  ret = anx7625_reg_read(bus, RX_P0_ADDR, SYSTEM_STSTUS, &status);
776  if (ret < 0) {
777  ANXERROR("IO error: Failed to clear interrupt status.\n");
778  return ret;
779  }
780 
781  if (status & HPD_STATUS) {
783  ANXINFO("HPD received 0x7e:0x45=%#x\n", status);
784  return 1;
785  }
786  return 0;
787 }
788 
789 static void anx7625_parse_edid(const struct edid *edid,
790  struct display_timing *dt)
791 {
793 
794  dt->hactive = edid->mode.ha;
795  dt->hsync_len = edid->mode.hspw;
796  dt->hback_porch = (edid->mode.hbl - edid->mode.hso -
797  edid->mode.hborder - edid->mode.hspw);
799 
800  dt->vactive = edid->mode.va;
801  dt->vsync_len = edid->mode.vspw;
803  dt->vback_porch = (edid->mode.vbl - edid->mode.vso -
804  edid->mode.vspw - edid->mode.vborder);
805 
806  /*
807  * The k_val is a ratio to match MIPI input and DP output video clocks.
808  * Most panels can follow the default value (0x3d).
809  * IVO panels have smaller variation than DP CTS spec and need smaller
810  * k_val (0x3b).
811  */
812  if (!strncmp(edid->manufacturer_name, "IVO", 3)) {
813  dt->k_val = 0x3b;
814  ANXINFO("detected IVO panel, use k value 0x3b\n");
815  } else {
816  dt->k_val = 0x3d;
817  ANXINFO("set default k value to 0x3d for panel\n");
818  }
819 
820  ANXINFO("pixelclock(%d).\n"
821  " hactive(%d), hsync(%d), hfp(%d), hbp(%d)\n"
822  " vactive(%d), vsync(%d), vfp(%d), vbp(%d)\n",
823  dt->pixelclock,
824  dt->hactive, dt->hsync_len, dt->hfront_porch, dt->hback_porch,
825  dt->vactive, dt->vsync_len, dt->vfront_porch, dt->vback_porch);
826 }
827 
828 int anx7625_dp_start(uint8_t bus, const struct edid *edid)
829 {
830  int ret;
831  struct display_timing dt;
832 
833  anx7625_parse_edid(edid, &dt);
834 
835  ret = anx7625_dsi_config(bus, &dt);
836  if (ret < 0) {
837  ANXERROR("MIPI phy setup error.\n");
838  return ret;
839  }
840 
841  ANXINFO("MIPI phy setup OK.\n");
842  return 0;
843 }
844 
846 {
847  int block_num;
848  int ret;
850 
851  block_num = sp_tx_edid_read(bus, edid, FOUR_BLOCK_SIZE);
852  if (block_num < 0) {
853  ANXERROR("Failed to get eDP EDID.\n");
854  return -1;
855  }
856 
857  ret = decode_edid(edid, (block_num + 1) * ONE_BLOCK_SIZE, out);
858  if (ret != EDID_CONFORMANT) {
859  ANXERROR("Failed to decode EDID.\n");
860  return -1;
861  }
862 
863  return 0;
864 }
865 
867 {
868  int retry_hpd_change = 50;
869 
870  if (!retry(3, anx7625_power_on_init(bus) >= 0)) {
871  ANXERROR("Failed to power on.\n");
872  return -1;
873  }
874 
875  while (--retry_hpd_change) {
876  mdelay(10);
877  int detected = anx7625_hpd_change_detect(bus);
878  if (detected < 0)
879  return -1;
880  if (detected > 0)
881  return 0;
882  }
883 
884  ANXERROR("Timed out to detect HPD change on bus %d.\n", bus);
885  return -1;
886 }
static int anx7625_calculate_m_n(u32 pixelclock, unsigned long *m, unsigned long *n, uint8_t *pd)
Definition: anx7625.c:201
static int edid_read(uint8_t bus, uint8_t offset, uint8_t *pblock_buf)
Definition: anx7625.c:553
static int anx7625_dsi_config(uint8_t bus, struct display_timing *dt)
Definition: anx7625.c:472
int anx7625_init(uint8_t bus)
Definition: anx7625.c:866
static int anx7625_power_on_init(uint8_t bus)
Definition: anx7625.c:718
#define ANXDEBUG(format,...)
Definition: anx7625.c:17
static int anx7625_dsi_video_config(uint8_t bus, struct display_timing *dt)
Definition: anx7625.c:301
static int anx7625_reg_write(uint8_t bus, uint8_t saddr, uint8_t reg_addr, uint8_t reg_val)
Definition: anx7625.c:94
static int anx7625_swap_dsi_lane3(uint8_t bus)
Definition: anx7625.c:394
static int i2c_access_workaround(uint8_t bus, uint8_t saddr)
Definition: anx7625.c:25
static int anx7625_reg_read(uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t *val)
Definition: anx7625.c:65
static int sp_tx_edid_read(uint8_t bus, uint8_t *pedid_blocks_buf, uint32_t size)
Definition: anx7625.c:619
static int segments_edid_read(uint8_t bus, uint8_t segment, uint8_t *buf, uint8_t offset)
Definition: anx7625.c:577
static int anx7625_api_dsi_config(uint8_t bus, struct display_timing *dt)
Definition: anx7625.c:410
#define ANXERROR(format,...)
Definition: anx7625.c:13
static int anx7625_write_and(uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t mask)
Definition: anx7625.c:121
static int anx7625_hpd_change_detect(uint8_t bus)
Definition: anx7625.c:770
static int sp_tx_aux_wr(uint8_t bus, uint8_t offset)
Definition: anx7625.c:510
static int sp_tx_aux_rd(uint8_t bus, uint8_t len_cmd)
Definition: anx7625.c:521
#define ANXINFO(format,...)
Definition: anx7625.c:15
int anx7625_dp_get_edid(uint8_t bus, struct edid *out)
Definition: anx7625.c:845
static void anx7625_reduction_of_a_fraction(unsigned long *_a, unsigned long *_b)
Definition: anx7625.c:171
static void anx7625_parse_edid(const struct edid *edid, struct display_timing *dt)
Definition: anx7625.c:789
#define FLASH_LOAD_STA
Definition: anx7625.c:715
static void anx7625_disable_pd_protocol(uint8_t bus)
Definition: anx7625.c:698
static int anx7625_write_or(uint8_t bus, uint8_t saddr, uint8_t offset, uint8_t mask)
Definition: anx7625.c:108
static int wait_aux_op_finish(uint8_t bus)
Definition: anx7625.c:134
static int anx7625_odfc_config(uint8_t bus, uint8_t post_divider)
Definition: anx7625.c:269
#define FLASH_LOAD_STA_CHK
Definition: anx7625.c:716
static unsigned long gcd(unsigned long a, unsigned long b)
Definition: anx7625.c:155
int anx7625_dp_start(uint8_t bus, const struct edid *edid)
Definition: anx7625.c:828
static int anx7625_reg_block_read(uint8_t bus, uint8_t saddr, uint8_t reg_addr, uint8_t len, uint8_t *buf)
Definition: anx7625.c:79
static void anx7625_start_dp_work(uint8_t bus)
Definition: anx7625.c:748
static int sp_tx_rst_aux(uint8_t bus)
Definition: anx7625.c:501
static int sp_tx_get_edid_block(uint8_t bus)
Definition: anx7625.c:531
#define TX_P0_ADDR
Definition: anx7625.h:21
#define AP_AUX_CTRL_OP_EN
Definition: anx7625.h:179
#define MIPI_DIGITAL_PLL_8
Definition: anx7625.h:258
#define AP_AUX_CTRL_ADDRONLY
Definition: anx7625.h:180
#define OCM_FW_REVERSION
Definition: anx7625.h:171
#define VERTICAL_BACK_PORCH
Definition: anx7625.h:138
#define MIPI_FREF_D_IND
Definition: anx7625.h:275
#define OCM_LOADING_TIME
Definition: anx7625.h:16
#define AP_AUX_ADDR_15_8
Definition: anx7625.h:174
#define MIPI_LANE_CTRL_10
Definition: anx7625.h:215
#define VERTICAL_SYNC_WIDTH
Definition: anx7625.h:137
#define MIPI_PLL_M_NUM_7_0
Definition: anx7625.h:220
#define MIPI_DIGITAL_PLL_6
Definition: anx7625.h:225
#define PIXEL_CLOCK_H
Definition: anx7625.h:184
#define SYSTEM_STSTUS
Definition: anx7625.h:65
#define MIPI_PD_CLK
Definition: anx7625.h:201
#define MIPI_M_NUM_READY
Definition: anx7625.h:228
#define RSVD_D1_ADDR
Definition: anx7625.h:39
#define MIPI_HS_PWD_CLK
Definition: anx7625.h:199
#define MIPI_SWAP
Definition: anx7625.h:292
#define MIPI_TIME_HS_PRPR
Definition: anx7625.h:209
#define MIPI_DPI_SELECT
Definition: anx7625.h:283
#define AP_AUX_COMMAND
Definition: anx7625.h:186
#define MIPI_PLL_VCO_TUNE_REG_VAL
Definition: anx7625.h:242
#define RSVD_00_ADDR
Definition: anx7625.h:38
#define POST_DIVIDER_MAX
Definition: anx7625.h:48
#define MIPI_CLK_DET_DET_BYPASS
Definition: anx7625.h:204
#define HORIZONTAL_BACK_PORCH_H
Definition: anx7625.h:149
#define ACTIVE_LINES_H
Definition: anx7625.h:135
#define SELECT_DSI
Definition: anx7625.h:284
#define ACTIVE_LINES_L
Definition: anx7625.h:134
#define TX_P2_ADDR
Definition: anx7625.h:23
#define HORIZONTAL_TOTAL_PIXELS_H
Definition: anx7625.h:141
#define AP_AUX_ADDR_19_16
Definition: anx7625.h:175
#define RX_P2_ADDR
Definition: anx7625.h:26
#define ONE_BLOCK_SIZE
Definition: anx7625.h:340
#define MIPI_N_NUM_READY
Definition: anx7625.h:229
#define MIPI_VIDEO_STABLE_CNT
Definition: anx7625.h:213
#define HORIZONTAL_TOTAL_PIXELS_L
Definition: anx7625.h:140
#define RSVD_39_ADDR
Definition: anx7625.h:41
#define RSVD_60_ADDR
Definition: anx7625.h:40
#define AP_MIPI_MUTE
Definition: anx7625.h:192
#define XTAL_FRQ_SEL
Definition: anx7625.h:157
#define MAX_UNSIGNED_24BIT
Definition: anx7625.h:53
#define REF_CLK_27000kHz
Definition: anx7625.h:276
#define MIPI_PLL_N_NUM_15_8
Definition: anx7625.h:222
#define VERTICAL_FRONT_PORCH
Definition: anx7625.h:136
#define HORIZONTAL_SYNC_WIDTH_L
Definition: anx7625.h:146
#define HORIZONTAL_FRONT_PORCH_H
Definition: anx7625.h:145
#define AP_AUX_ADDR_7_0
Definition: anx7625.h:173
#define RSVD_7F_ADDR
Definition: anx7625.h:42
#define HORIZONTAL_FRONT_PORCH_L
Definition: anx7625.h:144
#define MIPI_HS_RT_CLK
Definition: anx7625.h:200
#define MIPI_PLL_M_NUM_15_8
Definition: anx7625.h:219
#define MIPI_DIGITAL_PLL_18
Definition: anx7625.h:280
#define AP_MIPI_RX_EN
Definition: anx7625.h:193
#define AP_AUX_CTRL_STATUS
Definition: anx7625.h:178
#define MIPI_CLK_RT_MANUAL_PD_EN
Definition: anx7625.h:202
#define RX_P0_ADDR
Definition: anx7625.h:24
#define PLL_OUT_FREQ_ABS_MAX
Definition: anx7625.h:52
#define PLL_OUT_FREQ_MIN
Definition: anx7625.h:49
#define MIPI_DIGITAL_PLL_16
Definition: anx7625.h:268
#define POST_DIVIDER_MIN
Definition: anx7625.h:47
#define AUX_RST
Definition: anx7625.h:88
#define XTAL_FRQ_27M
Definition: anx7625.h:162
#define MIPI_DIGITAL_ADJ_1
Definition: anx7625.h:216
#define FOUR_BLOCK_SIZE
Definition: anx7625.h:341
#define MIPI_LANE_CTRL_0
Definition: anx7625.h:208
#define HORIZONTAL_SYNC_WIDTH_H
Definition: anx7625.h:147
#define HORIZONTAL_BACK_PORCH_L
Definition: anx7625.h:148
#define MIPI_PD_LPTX_CH_MANUAL_PD_EN
Definition: anx7625.h:206
#define PLL_OUT_FREQ_ABS_MIN
Definition: anx7625.h:51
#define AP_AUX_BUFF_START
Definition: anx7625.h:182
#define MIPI_PLL_RESET_N
Definition: anx7625.h:247
#define TCPC_INTERFACE_ADDR
Definition: anx7625.h:27
#define MIPI_PLL_N_NUM_7_0
Definition: anx7625.h:223
#define DSC_EN
Definition: anx7625.h:168
#define MAX_DPCD_BUFFER_SIZE
Definition: anx7625.h:338
#define AP_DISABLE_PD
Definition: anx7625.h:194
#define MIPI_PLL_M_NUM_23_16
Definition: anx7625.h:218
#define PIXEL_CLOCK_L
Definition: anx7625.h:183
#define MIPI_SWAP_CH3
Definition: anx7625.h:296
#define MIPI_PHY_CONTROL_3
Definition: anx7625.h:198
#define MIPI_DIGITAL_PLL_7
Definition: anx7625.h:235
#define OCM_FW_VERSION
Definition: anx7625.h:170
#define R_DSC_CTRL_0
Definition: anx7625.h:164
#define MIPI_CLK_MISS_CTRL
Definition: anx7625.h:205
#define AP_AV_STATUS
Definition: anx7625.h:189
#define HORIZONTAL_ACTIVE_PIXELS_H
Definition: anx7625.h:143
#define RST_CTRL2
Definition: anx7625.h:89
#define RX_P1_ADDR
Definition: anx7625.h:25
#define HORIZONTAL_ACTIVE_PIXELS_L
Definition: anx7625.h:142
#define TX_P1_ADDR
Definition: anx7625.h:22
#define XTAL_FRQ
Definition: anx7625.h:45
#define MIPI_CLK_HS_MANUAL_PD_EN
Definition: anx7625.h:203
#define MIPI_PLL_N_NUM_23_16
Definition: anx7625.h:221
#define HPD_STATUS
Definition: anx7625.h:68
void * memcpy(void *dest, const void *src, size_t n)
Definition: memcpy.c:7
#define retry(attempts, condition,...)
Definition: helpers.h:126
void __noreturn die(const char *fmt,...)
Definition: die.c:17
void mdelay(unsigned int msecs)
Definition: delay.c:2
static size_t offset
Definition: flashconsole.c:16
static int i2c_writeb(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t data)
Write a byte with one segment in one frame.
Definition: i2c_simple.h:131
static int i2c_readb(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t *data)
Read a byte with two segments in one frame.
Definition: i2c_simple.h:109
static int i2c_read_bytes(unsigned int bus, uint8_t slave, uint8_t reg, uint8_t *data, int len)
Read multi-bytes with two segments in one frame.
Definition: i2c_simple.h:87
@ EDID_CONFORMANT
Definition: edid.h:90
int decode_edid(unsigned char *edid, int size, struct edid *out)
Definition: edid.c:1104
unsigned int version[2]
Definition: edid.c:55
static uint8_t * buf
Definition: uart.c:7
static const int mask[4]
Definition: gpio.c:308
#define htotal(mode)
Definition: display.h:15
unsigned int uint32_t
Definition: stdint.h:14
uint32_t u32
Definition: stdint.h:51
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
unsigned char uint8_t
Definition: stdint.h:8
int strncmp(const char *s1, const char *s2, int maxlen)
Definition: string.c:114
Definition: device.h:76
unsigned int hfront_porch
Definition: anx7625.h:346
unsigned int hsync_len
Definition: anx7625.h:348
unsigned int pixelclock
Definition: anx7625.h:344
unsigned int vback_porch
Definition: anx7625.h:351
unsigned int hactive
Definition: anx7625.h:345
unsigned int vfront_porch
Definition: anx7625.h:350
unsigned int vsync_len
Definition: anx7625.h:352
unsigned int k_val
Definition: anx7625.h:353
unsigned int hback_porch
Definition: anx7625.h:347
unsigned int vactive
Definition: anx7625.h:349
unsigned int hbl
Definition: edid.h:26
unsigned int va
Definition: edid.h:30
unsigned int vspw
Definition: edid.h:33
unsigned int ha
Definition: edid.h:25
unsigned int hborder
Definition: edid.h:29
unsigned int vso
Definition: edid.h:32
unsigned int hso
Definition: edid.h:27
unsigned int pixel_clock
Definition: edid.h:22
unsigned int hspw
Definition: edid.h:28
unsigned int vbl
Definition: edid.h:31
unsigned int vborder
Definition: edid.h:34
Definition: edid.h:49
char manufacturer_name[3+1]
Definition: edid.h:86
struct edid_mode mode
Definition: edid.h:72
u8 val
Definition: sys.c:300
#define m(clkreg, src_bits, pmcreg, dst_bits)
#define count