Lines Matching +full:16 +full:- +full:17

1 // SPDX-License-Identifier: GPL-2.0+
5 * Guochun Huang <hero.huang@rock-chips.com>
19 #include <media/v4l2-ctrls.h>
20 #include <media/v4l2-fwnode.h>
21 #include <media/v4l2-subdev.h>
22 #include <media/v4l2-device.h>
23 #include "phy-rockchip-csi2-dphy-common.h"
24 #include "phy-rockchip-samsung-dcphy.h"
27 #define HIWORD_UPDATE(v, h, l) (((v) << (l)) | (GENMASK((h), (l)) << 16))
415 {4800, 23, 86, 22, 21, 22, 41, 20, 17, 32, 27},
416 {4790, 23, 86, 22, 21, 22, 41, 20, 17, 32, 27},
417 {4780, 23, 85, 22, 21, 22, 41, 20, 17, 32, 27},
418 {4770, 23, 85, 22, 21, 22, 41, 20, 17, 32, 27},
419 {4760, 23, 85, 22, 20, 22, 40, 20, 17, 32, 27},
420 {4750, 23, 85, 22, 20, 22, 40, 20, 17, 32, 27},
421 {4740, 23, 84, 22, 20, 22, 40, 20, 17, 32, 26},
422 {4730, 23, 84, 22, 20, 22, 40, 19, 17, 32, 26},
423 {4720, 23, 84, 22, 20, 22, 40, 19, 17, 32, 26},
424 {4710, 23, 84, 22, 20, 22, 40, 19, 17, 32, 26},
425 {4700, 23, 83, 22, 20, 22, 40, 19, 17, 32, 26},
426 {4690, 23, 83, 22, 20, 22, 39, 19, 17, 32, 26},
427 {4680, 23, 83, 22, 20, 22, 39, 19, 17, 32, 26},
428 {4670, 23, 83, 22, 20, 22, 39, 19, 17, 32, 26},
429 {4660, 23, 82, 22, 20, 22, 39, 19, 17, 32, 26},
430 {4650, 22, 83, 22, 20, 22, 39, 19, 17, 31, 26},
431 {4640, 22, 83, 22, 20, 22, 39, 19, 17, 31, 26},
432 {4630, 22, 83, 22, 20, 22, 39, 19, 17, 31, 26},
433 {4620, 22, 83, 22, 20, 21, 39, 19, 17, 31, 26},
434 {4610, 22, 82, 22, 20, 21, 39, 19, 17, 31, 26},
435 {4600, 22, 82, 21, 20, 21, 39, 19, 17, 31, 26},
436 {4590, 22, 82, 21, 20, 21, 39, 19, 17, 31, 26},
437 {4580, 22, 82, 21, 20, 21, 39, 19, 17, 31, 26},
438 {4570, 22, 81, 21, 20, 21, 39, 19, 17, 31, 25},
439 {4560, 22, 81, 21, 20, 21, 39, 19, 17, 31, 25},
440 {4550, 22, 81, 21, 20, 21, 38, 19, 17, 31, 25},
441 {4540, 22, 81, 21, 20, 21, 38, 19, 17, 31, 25},
442 {4530, 22, 80, 21, 19, 21, 38, 19, 16, 31, 25},
443 {4520, 22, 80, 21, 19, 21, 38, 19, 16, 31, 25},
444 {4510, 22, 80, 21, 19, 21, 38, 19, 16, 31, 25},
445 {4500, 22, 80, 21, 19, 21, 38, 19, 16, 30, 25},
446 {4490, 22, 80, 21, 19, 21, 38, 18, 16, 30, 25},
447 {4480, 22, 79, 21, 19, 21, 38, 18, 16, 30, 25},
448 {4470, 22, 79, 21, 19, 21, 37, 18, 16, 30, 25},
449 {4460, 22, 79, 21, 19, 21, 37, 18, 16, 30, 25},
450 {4450, 21, 80, 21, 19, 21, 37, 18, 16, 30, 25},
451 {4440, 21, 79, 21, 19, 21, 37, 18, 16, 30, 25},
452 {4430, 21, 79, 21, 19, 21, 37, 18, 16, 30, 25},
453 {4420, 21, 79, 21, 19, 21, 37, 18, 16, 30, 25},
454 {4410, 21, 79, 21, 19, 20, 38, 18, 16, 30, 25},
455 {4400, 21, 78, 20, 19, 20, 37, 18, 16, 30, 24},
456 {4390, 21, 78, 20, 19, 20, 37, 18, 16, 30, 24},
457 {4380, 21, 78, 20, 19, 20, 37, 18, 16, 30, 24},
458 {4370, 21, 78, 20, 19, 20, 37, 18, 16, 30, 24},
459 {4360, 21, 77, 20, 19, 20, 37, 18, 16, 29, 24},
460 {4350, 21, 77, 20, 19, 20, 37, 18, 16, 29, 24},
461 {4340, 21, 77, 20, 19, 20, 37, 18, 16, 29, 24},
462 {4330, 21, 77, 20, 19, 20, 36, 18, 16, 29, 24},
463 {4320, 21, 77, 20, 19, 20, 36, 18, 16, 29, 24},
464 {4310, 21, 76, 20, 19, 20, 36, 18, 16, 29, 24},
465 {4300, 21, 76, 20, 18, 20, 36, 18, 16, 29, 24},
466 {4290, 21, 76, 20, 18, 20, 36, 18, 16, 29, 24},
467 {4280, 21, 76, 20, 18, 20, 36, 18, 16, 29, 24},
468 {4270, 21, 75, 20, 18, 20, 36, 18, 16, 29, 24},
469 {4260, 21, 75, 20, 18, 20, 35, 17, 15, 29, 24},
470 {4250, 20, 76, 20, 18, 20, 35, 17, 15, 29, 24},
471 {4240, 20, 76, 20, 18, 20, 35, 17, 15, 29, 23},
472 {4230, 20, 75, 20, 18, 20, 35, 17, 15, 29, 23},
473 {4220, 20, 75, 20, 18, 20, 35, 17, 15, 29, 23},
474 {4210, 20, 75, 20, 18, 20, 35, 17, 15, 28, 23},
475 {4200, 20, 75, 19, 18, 19, 36, 17, 15, 28, 23},
476 {4190, 20, 74, 19, 18, 19, 36, 17, 15, 28, 23},
477 {4180, 20, 74, 19, 18, 19, 35, 17, 15, 28, 23},
478 {4170, 20, 74, 19, 18, 19, 35, 17, 15, 28, 23},
479 {4160, 20, 74, 19, 18, 19, 35, 17, 15, 28, 23},
480 {4150, 20, 74, 19, 18, 19, 35, 17, 15, 28, 23},
481 {4140, 20, 73, 19, 18, 19, 35, 17, 15, 28, 23},
482 {4130, 20, 73, 19, 18, 19, 35, 17, 15, 28, 23},
483 {4120, 20, 73, 19, 18, 19, 35, 17, 15, 28, 23},
484 {4110, 20, 73, 19, 18, 19, 34, 17, 15, 28, 23},
485 {4100, 20, 72, 19, 18, 19, 34, 17, 15, 28, 23},
486 {4090, 20, 72, 19, 18, 19, 34, 17, 15, 28, 23},
487 {4080, 20, 72, 19, 18, 19, 34, 17, 15, 28, 23},
488 {4070, 20, 72, 19, 18, 19, 34, 17, 15, 27, 22},
489 {4060, 19, 72, 19, 17, 19, 34, 17, 15, 27, 22},
490 {4050, 19, 72, 19, 17, 19, 34, 17, 15, 27, 22},
491 {4040, 19, 72, 19, 17, 19, 33, 17, 15, 27, 22},
492 {4030, 19, 72, 19, 17, 19, 33, 17, 15, 27, 22},
493 {4020, 19, 71, 19, 17, 19, 33, 16, 15, 27, 22},
494 {4010, 19, 71, 19, 17, 19, 33, 16, 15, 27, 22},
495 {4000, 19, 71, 18, 17, 19, 33, 16, 14, 27, 22},
496 {3990, 19, 71, 18, 17, 18, 34, 16, 14, 27, 22},
497 {3980, 19, 71, 18, 17, 18, 34, 16, 14, 27, 22},
498 {3970, 19, 70, 18, 17, 18, 33, 16, 14, 27, 22},
499 {3960, 19, 70, 18, 17, 18, 33, 16, 14, 27, 22},
500 {3950, 19, 70, 18, 17, 18, 33, 16, 14, 27, 22},
501 {3940, 19, 70, 18, 17, 18, 33, 16, 14, 27, 22},
502 {3930, 19, 69, 18, 17, 18, 33, 16, 14, 27, 22},
503 {3920, 19, 69, 18, 17, 18, 33, 16, 14, 26, 22},
504 {3910, 19, 69, 18, 17, 18, 33, 16, 14, 26, 22},
505 {3900, 19, 69, 18, 17, 18, 33, 16, 14, 26, 21},
506 {3890, 19, 68, 18, 17, 18, 32, 16, 14, 26, 21},
507 {3880, 19, 68, 18, 17, 18, 32, 16, 14, 26, 21},
508 {3870, 19, 68, 18, 17, 18, 32, 16, 14, 26, 21},
509 {3860, 18, 69, 18, 17, 18, 32, 16, 14, 26, 21},
510 {3850, 18, 68, 18, 17, 18, 32, 16, 14, 26, 21},
511 {3840, 18, 68, 18, 17, 18, 32, 16, 14, 26, 21},
512 {3830, 18, 68, 18, 16, 18, 32, 16, 14, 26, 21},
513 {3820, 18, 68, 18, 16, 18, 31, 16, 14, 26, 21},
514 {3810, 18, 68, 18, 16, 18, 31, 16, 14, 26, 21},
515 {3800, 18, 67, 17, 16, 18, 31, 16, 14, 26, 21},
516 {3790, 18, 67, 17, 16, 17, 32, 15, 14, 26, 21},
517 {3780, 18, 67, 17, 16, 17, 32, 15, 14, 25, 21},
518 {3770, 18, 67, 17, 16, 17, 32, 15, 14, 25, 21},
519 {3760, 18, 66, 17, 16, 17, 32, 15, 14, 25, 21},
520 {3750, 18, 66, 17, 16, 17, 31, 15, 14, 25, 21},
521 {3740, 18, 66, 17, 16, 17, 31, 15, 14, 25, 20},
522 {3730, 18, 66, 17, 16, 17, 31, 15, 13, 25, 20},
523 {3720, 18, 65, 17, 16, 17, 31, 15, 13, 25, 20},
524 {3710, 18, 65, 17, 16, 17, 31, 15, 13, 25, 20},
525 {3700, 18, 65, 17, 16, 17, 31, 15, 13, 25, 20},
526 {3690, 18, 65, 17, 16, 17, 31, 15, 13, 25, 20},
527 {3680, 18, 64, 17, 16, 17, 31, 15, 13, 25, 20},
528 {3670, 18, 64, 17, 16, 17, 30, 15, 13, 25, 20},
529 {3660, 17, 65, 17, 16, 17, 30, 15, 13, 25, 20},
530 {3650, 17, 65, 17, 16, 17, 30, 15, 13, 25, 20},
531 {3640, 17, 65, 17, 16, 17, 30, 15, 13, 25, 20},
532 {3630, 17, 64, 17, 16, 17, 30, 15, 13, 24, 20},
533 {3620, 17, 64, 17, 16, 17, 30, 15, 13, 24, 20},
534 {3610, 17, 64, 17, 16, 17, 30, 15, 13, 24, 20},
535 {3600, 17, 64, 16, 16, 17, 29, 15, 13, 24, 20},
536 {3590, 17, 63, 16, 15, 17, 29, 15, 13, 24, 20},
537 {3580, 17, 63, 16, 15, 16, 30, 15, 13, 24, 20},
538 {3570, 17, 63, 16, 15, 16, 30, 15, 13, 24, 19},
539 {3560, 17, 63, 16, 15, 16, 30, 14, 13, 24, 19},
540 {3550, 17, 62, 16, 15, 16, 30, 14, 13, 24, 19},
541 {3540, 17, 62, 16, 15, 16, 30, 14, 13, 24, 19},
542 {3530, 17, 62, 16, 15, 16, 29, 14, 13, 24, 19},
543 {3520, 17, 62, 16, 15, 16, 29, 14, 13, 24, 19},
544 {3510, 17, 62, 16, 15, 16, 29, 14, 13, 24, 19},
545 {3500, 17, 61, 16, 15, 16, 29, 14, 13, 24, 19},
546 {3490, 17, 61, 16, 15, 16, 29, 14, 13, 23, 19},
547 {3480, 17, 61, 16, 15, 16, 29, 14, 13, 23, 19},
548 {3470, 17, 61, 16, 15, 16, 29, 14, 13, 23, 19},
549 {3460, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
550 {3450, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
551 {3440, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
552 {3430, 16, 61, 16, 15, 16, 28, 14, 12, 23, 19},
553 {3420, 16, 60, 16, 15, 16, 28, 14, 12, 23, 19},
554 {3410, 16, 60, 16, 15, 16, 28, 14, 12, 23, 18},
555 {3400, 16, 60, 15, 15, 16, 28, 14, 12, 23, 18},
556 {3390, 16, 60, 15, 15, 16, 28, 14, 12, 23, 18},
557 {3380, 16, 59, 15, 15, 16, 27, 14, 12, 23, 18},
558 {3370, 16, 59, 15, 15, 15, 28, 14, 12, 23, 18},
559 {3360, 16, 59, 15, 14, 15, 28, 14, 12, 23, 18},
560 {3350, 16, 59, 15, 14, 15, 28, 14, 12, 23, 18},
561 {3340, 16, 59, 15, 14, 15, 28, 14, 12, 22, 18},
562 {3330, 16, 58, 15, 14, 15, 28, 14, 12, 22, 18},
563 {3320, 16, 58, 15, 14, 15, 28, 13, 12, 22, 18},
564 {3310, 16, 58, 15, 14, 15, 27, 13, 12, 22, 18},
565 {3300, 16, 58, 15, 14, 15, 27, 13, 12, 22, 18},
566 {3290, 16, 57, 15, 14, 15, 27, 13, 12, 22, 18},
567 {3280, 16, 57, 15, 14, 15, 27, 13, 12, 22, 18},
568 {3270, 16, 57, 15, 14, 15, 27, 13, 12, 22, 18},
571 {3240, 15, 57, 15, 14, 15, 26, 13, 12, 22, 17},
572 {3230, 15, 57, 15, 14, 15, 26, 13, 12, 22, 17},
573 {3220, 15, 57, 15, 14, 15, 26, 13, 12, 22, 17},
574 {3210, 15, 56, 15, 14, 15, 26, 13, 12, 22, 17},
575 {3200, 15, 56, 14, 14, 15, 26, 13, 11, 21, 17},
576 {3190, 15, 56, 14, 14, 15, 26, 13, 11, 21, 17},
577 {3180, 15, 56, 14, 14, 15, 26, 13, 11, 21, 17},
578 {3170, 15, 56, 14, 14, 15, 25, 13, 11, 21, 17},
579 {3160, 15, 55, 14, 14, 14, 26, 13, 11, 21, 17},
580 {3150, 15, 55, 14, 14, 14, 26, 13, 11, 21, 17},
581 {3140, 15, 55, 14, 14, 14, 26, 13, 11, 21, 17},
582 {3130, 15, 55, 14, 14, 14, 26, 13, 11, 21, 17},
583 {3120, 15, 54, 14, 13, 14, 26, 13, 11, 21, 17},
584 {3110, 15, 54, 14, 13, 14, 26, 13, 11, 21, 17},
585 {3100, 15, 54, 14, 13, 14, 26, 13, 11, 21, 17},
586 {3090, 15, 54, 14, 13, 14, 25, 12, 11, 21, 17},
587 {3080, 15, 53, 14, 13, 14, 25, 12, 11, 21, 17},
588 {3070, 14, 54, 14, 13, 14, 25, 12, 11, 21, 16},
589 {3060, 14, 54, 14, 13, 14, 25, 12, 11, 21, 16},
590 {3050, 14, 54, 14, 13, 14, 25, 12, 11, 20, 16},
591 {3040, 14, 53, 14, 13, 14, 25, 12, 11, 20, 16},
592 {3030, 14, 53, 14, 13, 14, 25, 12, 11, 20, 16},
593 {3020, 14, 53, 14, 13, 14, 24, 12, 11, 20, 16},
594 {3010, 14, 53, 14, 13, 14, 24, 12, 11, 20, 16},
595 {3000, 14, 53, 13, 13, 14, 24, 12, 11, 20, 16},
596 {2990, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
597 {2980, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
598 {2970, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
599 {2960, 14, 52, 13, 13, 14, 24, 12, 11, 20, 16},
600 {2950, 14, 51, 13, 13, 13, 24, 12, 11, 20, 16},
601 {2940, 14, 51, 13, 13, 13, 24, 12, 11, 20, 16},
602 {2930, 14, 51, 13, 13, 13, 24, 12, 10, 20, 16},
603 {2920, 14, 51, 13, 13, 13, 24, 12, 10, 20, 16},
634 {2610, 12, 45, 12, 11, 12, 21, 10, 9, 17, 14},
635 {2600, 12, 45, 11, 11, 12, 21, 10, 9, 17, 14},
636 {2590, 12, 45, 11, 11, 12, 20, 10, 9, 17, 14},
637 {2580, 12, 45, 11, 11, 12, 20, 10, 9, 17, 14},
638 {2570, 12, 44, 11, 11, 12, 20, 10, 9, 17, 13},
639 {2560, 12, 44, 11, 11, 12, 20, 10, 9, 17, 13},
640 {2550, 12, 44, 11, 11, 12, 20, 10, 9, 17, 13},
641 {2540, 12, 44, 11, 11, 11, 21, 10, 9, 17, 13},
642 {2530, 12, 44, 11, 11, 11, 21, 10, 9, 17, 13},
643 {2520, 12, 43, 11, 11, 11, 21, 10, 9, 17, 13},
644 {2510, 12, 43, 11, 11, 11, 20, 10, 9, 17, 13},
645 {2500, 12, 43, 11, 11, 11, 20, 10, 9, 17, 13},
646 {2490, 12, 43, 11, 11, 11, 20, 10, 9, 17, 13},
647 {2480, 12, 42, 11, 11, 11, 20, 10, 9, 17, 13},
648 {2470, 11, 43, 11, 11, 11, 20, 10, 9, 16, 13},
649 {2460, 11, 43, 11, 11, 11, 20, 10, 9, 16, 13},
650 {2450, 11, 43, 11, 11, 11, 20, 10, 9, 16, 13},
651 {2440, 11, 42, 11, 11, 11, 19, 10, 9, 16, 13},
652 {2430, 11, 42, 11, 11, 11, 19, 10, 9, 16, 13},
653 {2420, 11, 42, 11, 10, 11, 19, 10, 9, 16, 13},
654 {2410, 11, 42, 11, 10, 11, 19, 10, 9, 16, 12},
655 {2400, 11, 41, 10, 10, 11, 19, 10, 8, 16, 12},
656 {2390, 11, 41, 10, 10, 11, 19, 10, 8, 16, 12},
657 {2380, 11, 41, 10, 10, 11, 19, 9, 8, 16, 12},
658 {2370, 11, 41, 10, 10, 11, 18, 9, 8, 16, 12},
659 {2360, 11, 41, 10, 10, 11, 18, 9, 8, 16, 12},
660 {2350, 11, 40, 10, 10, 11, 18, 9, 8, 16, 12},
661 {2340, 11, 40, 10, 10, 11, 18, 9, 8, 16, 12},
662 {2330, 11, 40, 10, 10, 10, 19, 9, 8, 16, 12},
673 {2220, 10, 38, 10, 10, 10, 17, 9, 8, 15, 11},
674 {2210, 10, 38, 10, 10, 10, 17, 9, 8, 15, 11},
675 {2200, 10, 38, 9, 10, 10, 17, 9, 8, 15, 11},
676 {2190, 10, 38, 9, 9, 10, 17, 9, 8, 15, 11},
677 {2180, 10, 37, 9, 9, 10, 17, 9, 8, 14, 11},
678 {2170, 10, 37, 9, 9, 10, 17, 9, 8, 14, 11},
679 {2160, 10, 37, 9, 9, 10, 17, 9, 8, 14, 11},
680 {2150, 10, 37, 9, 9, 10, 16, 8, 8, 14, 11},
681 {2140, 10, 36, 9, 9, 10, 16, 8, 8, 14, 11},
682 {2130, 10, 36, 9, 9, 10, 16, 8, 7, 14, 11},
683 {2120, 10, 36, 9, 9, 9, 17, 8, 7, 14, 11},
684 {2110, 10, 36, 9, 9, 9, 17, 8, 7, 14, 11},
685 {2100, 10, 35, 9, 9, 9, 17, 8, 7, 14, 11},
686 {2090, 10, 35, 9, 9, 9, 17, 8, 7, 14, 11},
687 {2080, 9, 36, 9, 9, 9, 16, 8, 7, 14, 11},
688 {2070, 9, 36, 9, 9, 9, 16, 8, 7, 14, 10},
689 {2060, 9, 35, 9, 9, 9, 16, 8, 7, 14, 10},
690 {2050, 9, 35, 9, 9, 9, 16, 8, 7, 14, 10},
691 {2040, 9, 35, 9, 9, 9, 16, 8, 7, 14, 10},
692 {2030, 9, 35, 9, 9, 9, 16, 8, 7, 13, 10},
693 {2020, 9, 35, 9, 9, 9, 16, 8, 7, 13, 10},
785 {1100, 43, 17, 4, 63, 44, 6, 57, 32, 6, 54},
786 {1090, 43, 17, 4, 63, 44, 6, 56, 33, 6, 54},
787 {1080, 43, 17, 4, 63, 44, 6, 56, 33, 6, 53},
788 {1070, 42, 17, 4, 62, 44, 6, 56, 33, 6, 53},
789 {1060, 42, 17, 4, 62, 42, 6, 55, 31, 6, 52},
790 {1050, 41, 17, 4, 62, 42, 6, 55, 31, 6, 52},
791 {1040, 41, 16, 4, 61, 41, 6, 54, 31, 6, 52},
792 {1030, 41, 16, 4, 61, 41, 6, 54, 30, 6, 51},
793 {1020, 40, 16, 4, 61, 41, 6, 54, 30, 6, 51},
794 {1010, 40, 16, 4, 60, 40, 6, 53, 30, 6, 50},
795 {1000, 39, 16, 3, 60, 40, 6, 53, 29, 5, 50},
836 { 590, 23, 8, 1, 46, 24, 2, 39, 17, 3, 30},
837 { 580, 22, 8, 1, 46, 24, 2, 39, 17, 3, 29},
838 { 570, 22, 8, 1, 45, 23, 2, 38, 17, 3, 29},
839 { 560, 22, 7, 1, 45, 23, 2, 38, 16, 2, 28},
840 { 550, 21, 7, 1, 45, 23, 2, 38, 16, 2, 28},
841 { 540, 21, 7, 1, 44, 22, 2, 37, 16, 2, 27},
850 { 450, 17, 5, 1, 41, 19, 1, 34, 13, 2, 23},
851 { 440, 17, 5, 1, 41, 18, 1, 34, 13, 2, 23},
852 { 430, 16, 5, 1, 40, 18, 0, 34, 12, 2, 22},
853 { 420, 16, 5, 1, 40, 18, 0, 33, 12, 2, 22},
854 { 410, 16, 5, 1, 40, 17, 0, 33, 12, 1, 21},
855 { 400, 15, 5, 0, 39, 17, 0, 33, 11, 1, 21},
856 { 390, 15, 4, 0, 39, 17, 0, 32, 12, 1, 20},
857 { 380, 14, 4, 0, 39, 17, 0, 32, 12, 1, 20},
858 { 370, 14, 4, 0, 38, 17, 0, 32, 12, 1, 19},
862 { 330, 12, 3, 0, 37, 14, 0, 30, 9, 1, 17},
863 { 320, 12, 3, 0, 37, 14, 0, 30, 9, 1, 17},
864 { 310, 12, 3, 0, 36, 13, 0, 30, 9, 1, 16},
865 { 300, 11, 3, 0, 36, 13, 0, 29, 8, 1, 16},
1032 { 2100, 23, 50, 25, 17, 32, 1 },
1033 { 2090, 23, 50, 25, 17, 32, 1 },
1034 { 2080, 23, 50, 25, 17, 32, 1 },
1035 { 2070, 23, 50, 25, 17, 32, 1 },
1036 { 2060, 22, 50, 25, 17, 32, 1 },
1037 { 2050, 22, 50, 25, 17, 32, 1 },
1038 { 2040, 22, 50, 25, 17, 32, 1 },
1039 { 2030, 22, 50, 25, 17, 31, 1 },
1040 { 2020, 22, 50, 25, 17, 31, 1 },
1041 { 2010, 22, 50, 25, 17, 31, 1 },
1042 { 2000, 22, 50, 25, 17, 31, 1 },
1043 { 1990, 22, 50, 25, 17, 31, 1 },
1044 { 1980, 22, 50, 25, 16, 31, 1 },
1045 { 1970, 21, 50, 25, 16, 30, 1 },
1046 { 1960, 21, 50, 25, 16, 30, 1 },
1047 { 1950, 21, 50, 25, 16, 30, 1 },
1048 { 1940, 21, 50, 25, 16, 30, 1 },
1049 { 1930, 21, 50, 25, 16, 30, 1 },
1050 { 1920, 21, 50, 25, 16, 30, 1 },
1051 { 1910, 21, 50, 25, 16, 30, 1 },
1052 { 1900, 21, 50, 25, 16, 29, 1 },
1053 { 1890, 21, 50, 25, 16, 29, 1 },
1054 { 1880, 20, 50, 25, 16, 29, 1 },
1055 { 1870, 20, 50, 25, 16, 29, 1 },
1080 { 1620, 17, 50, 25, 13, 25, 1 },
1081 { 1610, 17, 50, 25, 13, 25, 1 },
1082 { 1600, 17, 50, 25, 13, 25, 1 },
1083 { 1590, 17, 50, 25, 13, 24, 1 },
1084 { 1580, 17, 50, 25, 13, 24, 1 },
1085 { 1570, 17, 50, 25, 13, 24, 1 },
1086 { 1560, 17, 50, 25, 13, 24, 1 },
1087 { 1550, 17, 50, 25, 13, 24, 1 },
1088 { 1540, 16, 50, 25, 13, 24, 1 },
1089 { 1530, 16, 50, 25, 13, 24, 1 },
1090 { 1520, 16, 50, 25, 13, 23, 1 },
1091 { 1510, 16, 50, 25, 12, 23, 1 },
1092 { 1500, 16, 50, 25, 12, 23, 1 },
1093 { 1490, 16, 50, 25, 12, 23, 1 },
1094 { 1480, 16, 50, 25, 12, 23, 1 },
1095 { 1470, 16, 50, 25, 12, 23, 1 },
1096 { 1460, 16, 50, 25, 12, 22, 1 },
1128 { 1140, 12, 50, 25, 9, 17, 1 },
1129 { 1130, 12, 50, 25, 9, 17, 1 },
1130 { 1120, 12, 50, 25, 9, 17, 1 },
1131 { 1110, 12, 50, 25, 9, 17, 1 },
1132 { 1100, 11, 50, 25, 9, 17, 1 },
1133 { 1090, 11, 50, 25, 9, 17, 1 },
1134 { 1080, 11, 50, 25, 9, 16, 1 },
1135 { 1070, 11, 50, 25, 9, 16, 1 },
1136 { 1060, 11, 50, 25, 9, 16, 1 },
1137 { 1050, 11, 50, 25, 8, 16, 1 },
1138 { 1040, 11, 50, 25, 8, 16, 1 },
1139 { 1030, 11, 50, 25, 8, 16, 1 },
1140 { 1020, 10, 50, 25, 8, 16, 1 },
1194 { 480, 17, 50, 25, 14, 6, 2 },
1195 { 470, 17, 50, 25, 14, 6, 2 },
1196 { 460, 17, 50, 25, 13, 6, 2 },
1197 { 450, 16, 50, 25, 13, 6, 2 },
1198 { 440, 16, 50, 25, 13, 6, 2 },
1278 csi_dphy->dphy_param.lp_vol_ref != 3 && in samsung_mipi_dcphy_bias_block_enable()
1279 csi_dphy->dphy_param.lp_vol_ref < 0x7) { in samsung_mipi_dcphy_bias_block_enable()
1281 bias_con2 |= csi_dphy->dphy_param.lp_vol_ref; in samsung_mipi_dcphy_bias_block_enable()
1282 dev_info(samsung->dev, in samsung_mipi_dcphy_bias_block_enable()
1284 csi_dphy->dphy_param.lp_vol_ref); in samsung_mipi_dcphy_bias_block_enable()
1286 regmap_write(samsung->regmap, BIAS_CON0, 0x0010); in samsung_mipi_dcphy_bias_block_enable()
1287 regmap_write(samsung->regmap, BIAS_CON1, 0x0110); in samsung_mipi_dcphy_bias_block_enable()
1288 regmap_write(samsung->regmap, BIAS_CON2, bias_con2); in samsung_mipi_dcphy_bias_block_enable()
1294 if (samsung->c_option) in samsung_mipi_dcphy_bias_block_enable()
1295 regmap_update_bits(samsung->regmap, BIAS_CON4, in samsung_mipi_dcphy_bias_block_enable()
1305 regmap_write(samsung->regmap, DPHY_MC_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_dphy_lane_enable()
1306 regmap_update_bits(samsung->regmap, DPHY_MC_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1309 switch (samsung->lanes) { in samsung_mipi_dphy_lane_enable()
1311 regmap_write(samsung->regmap, DPHY_MD3_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1313 regmap_update_bits(samsung->regmap, DPHY_MD3_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1317 regmap_write(samsung->regmap, COMBO_MD2_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1319 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1323 regmap_write(samsung->regmap, COMBO_MD1_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1325 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1330 regmap_write(samsung->regmap, COMBO_MD0_GNR_CON1, in samsung_mipi_dphy_lane_enable()
1332 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, in samsung_mipi_dphy_lane_enable()
1340 regmap_write(samsung->regmap, COMBO_MD0_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_cphy_lane_enable()
1341 regmap_write(samsung->regmap, COMBO_MD1_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_cphy_lane_enable()
1342 regmap_write(samsung->regmap, COMBO_MD2_GNR_CON1, T_PHY_READY(0x2000)); in samsung_mipi_cphy_lane_enable()
1344 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, in samsung_mipi_cphy_lane_enable()
1346 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, in samsung_mipi_cphy_lane_enable()
1348 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, in samsung_mipi_cphy_lane_enable()
1354 regmap_update_bits(samsung->regmap, DPHY_MC_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1355 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1356 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1357 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1358 regmap_update_bits(samsung->regmap, DPHY_MD3_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_dphy_lane_disable()
1363 regmap_update_bits(samsung->regmap, COMBO_MD0_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_cphy_lane_disable()
1364 regmap_update_bits(samsung->regmap, COMBO_MD1_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_cphy_lane_disable()
1365 regmap_update_bits(samsung->regmap, COMBO_MD2_GNR_CON0, PHY_ENABLE, 0); in samsung_mipi_cphy_lane_disable()
1370 regmap_update_bits(samsung->regmap, PLL_CON0, S_MASK | P_MASK, in samsung_mipi_dcphy_pll_configure()
1371 S(samsung->pll.scaler) | P(samsung->pll.prediv)); in samsung_mipi_dcphy_pll_configure()
1373 if (samsung->pll.dsm < 0) { in samsung_mipi_dcphy_pll_configure()
1377 dsm_tmp = abs(samsung->pll.dsm); in samsung_mipi_dcphy_pll_configure()
1378 dsm_tmp = dsm_tmp - 1; in samsung_mipi_dcphy_pll_configure()
1380 regmap_write(samsung->regmap, PLL_CON1, dsm_tmp); in samsung_mipi_dcphy_pll_configure()
1382 regmap_write(samsung->regmap, PLL_CON1, samsung->pll.dsm); in samsung_mipi_dcphy_pll_configure()
1385 regmap_update_bits(samsung->regmap, PLL_CON2, in samsung_mipi_dcphy_pll_configure()
1386 M_MASK, M(samsung->pll.fbdiv)); in samsung_mipi_dcphy_pll_configure()
1388 if (samsung->pll.ssc_en) { in samsung_mipi_dcphy_pll_configure()
1389 regmap_write(samsung->regmap, PLL_CON3, in samsung_mipi_dcphy_pll_configure()
1390 MRR(samsung->pll.mrr) | MFR(samsung->pll.mfr)); in samsung_mipi_dcphy_pll_configure()
1391 regmap_update_bits(samsung->regmap, PLL_CON4, SSCG_EN, SSCG_EN); in samsung_mipi_dcphy_pll_configure()
1394 regmap_write(samsung->regmap, PLL_CON5, RESET_N_SEL | PLL_ENABLE_SEL); in samsung_mipi_dcphy_pll_configure()
1395 regmap_write(samsung->regmap, PLL_CON7, PLL_LOCK_CNT(0xf000)); in samsung_mipi_dcphy_pll_configure()
1396 regmap_write(samsung->regmap, PLL_CON8, PLL_STB_CNT(0xf000)); in samsung_mipi_dcphy_pll_configure()
1404 regmap_update_bits(samsung->regmap, PLL_CON0, PLL_EN, PLL_EN); in samsung_mipi_dcphy_pll_enable()
1406 ret = regmap_read_poll_timeout(samsung->regmap, PLL_STAT0, in samsung_mipi_dcphy_pll_enable()
1409 dev_err(samsung->dev, "DC-PHY pll is not locked\n"); in samsung_mipi_dcphy_pll_enable()
1414 regmap_update_bits(samsung->regmap, PLL_CON0, PLL_EN, 0); in samsung_mipi_dcphy_pll_disable()
1422 unsigned int lane_mbps = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_dphy_get_timing()
1428 for (i = num_timings; i > 0; i--) in samsung_mipi_dphy_get_timing()
1429 if (lane_mbps <= timings[i - 1].max_lane_mbps) in samsung_mipi_dphy_get_timing()
1435 return &timings[i - 1]; in samsung_mipi_dphy_get_timing()
1443 unsigned int lane_msps = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_cphy_get_timing()
1449 for (i = num_timings; i > 0; i--) in samsung_mipi_cphy_get_timing()
1450 if (lane_msps <= timings[i - 1].max_lane_msps) in samsung_mipi_cphy_get_timing()
1456 return &timings[i - 1]; in samsung_mipi_cphy_get_timing()
1462 unsigned int lane_hs_rate = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_cphy_timing_init()
1468 * Divide-by-2 Clock from Serial Clock. Use this when data rate is under in samsung_mipi_cphy_timing_init()
1469 * 500Msps, otherwise divide-by-16 Clock from Serial Clock in samsung_mipi_cphy_timing_init()
1474 val |= T_LPX(timing->lpx); in samsung_mipi_cphy_timing_init()
1476 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON0, val); in samsung_mipi_cphy_timing_init()
1477 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON0, val); in samsung_mipi_cphy_timing_init()
1478 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON0, val); in samsung_mipi_cphy_timing_init()
1480 val = T_HS_ZERO(timing->prebegin_3) | T_HS_PREPARE(timing->prepare_3); in samsung_mipi_cphy_timing_init()
1481 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON1, val); in samsung_mipi_cphy_timing_init()
1482 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON1, val); in samsung_mipi_cphy_timing_init()
1483 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON1, val); in samsung_mipi_cphy_timing_init()
1485 val = T_HS_EXIT(timing->hs_exit) | T_HS_TRAIL(timing->post_3); in samsung_mipi_cphy_timing_init()
1486 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON2, val); in samsung_mipi_cphy_timing_init()
1487 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON2, val); in samsung_mipi_cphy_timing_init()
1488 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON2, val); in samsung_mipi_cphy_timing_init()
1490 /* TTA-GET/TTA-GO Timing Counter register use default value */ in samsung_mipi_cphy_timing_init()
1492 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON3, val); in samsung_mipi_cphy_timing_init()
1493 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON3, val); in samsung_mipi_cphy_timing_init()
1494 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON3, val); in samsung_mipi_cphy_timing_init()
1497 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON4, 0x1f4); in samsung_mipi_cphy_timing_init()
1498 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON4, 0x1f4); in samsung_mipi_cphy_timing_init()
1499 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON4, 0x1f4); in samsung_mipi_cphy_timing_init()
1509 u64 max_fout = samsung->c_option ? MAX_CPHY_BW : MAX_DPHY_BW; in samsung_mipi_dcphy_pll_round_rate()
1554 /* -32767 ≤ K[15:0] ≤ 32767 */ in samsung_mipi_dcphy_pll_round_rate()
1555 _dsm = ((_prediv * fvco) - (2 * _fbdiv * fin)); in samsung_mipi_dcphy_pll_round_rate()
1563 delta = abs(fvco * MSEC_PER_SEC - tmp); in samsung_mipi_dcphy_pll_round_rate()
1582 dev_dbg(samsung->dev, "p: %d, m: %d, dsm:%ld, scaler: %d\n", in samsung_mipi_dcphy_pll_round_rate()
1592 unsigned int lane_hs_rate = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_dphy_clk_lane_timing_init()
1596 regmap_write(samsung->regmap, DPHY_MC_GNR_CON0, 0xf000); in samsung_mipi_dphy_clk_lane_timing_init()
1597 regmap_write(samsung->regmap, DPHY_MC_ANA_CON0, 0x7133); in samsung_mipi_dphy_clk_lane_timing_init()
1600 regmap_write(samsung->regmap, DPHY_MC_ANA_CON1, 0x0001); in samsung_mipi_dphy_clk_lane_timing_init()
1603 * Divide-by-2 Clock from Serial Clock. Use this when data rate is under in samsung_mipi_dphy_clk_lane_timing_init()
1604 * 1500Mbps, otherwise divide-by-16 Clock from Serial Clock in samsung_mipi_dphy_clk_lane_timing_init()
1609 val |= T_LPX(timing->lpx); in samsung_mipi_dphy_clk_lane_timing_init()
1611 regmap_write(samsung->regmap, DPHY_MC_TIME_CON0, val); in samsung_mipi_dphy_clk_lane_timing_init()
1613 val = T_CLK_ZERO(timing->clk_zero) | T_CLK_PREPARE(timing->clk_prepare); in samsung_mipi_dphy_clk_lane_timing_init()
1614 regmap_write(samsung->regmap, DPHY_MC_TIME_CON1, val); in samsung_mipi_dphy_clk_lane_timing_init()
1616 val = T_HS_EXIT(timing->hs_exit) | T_CLK_TRAIL(timing->clk_trail_eot); in samsung_mipi_dphy_clk_lane_timing_init()
1617 regmap_write(samsung->regmap, DPHY_MC_TIME_CON2, val); in samsung_mipi_dphy_clk_lane_timing_init()
1619 val = T_CLK_POST(timing->clk_post); in samsung_mipi_dphy_clk_lane_timing_init()
1620 regmap_write(samsung->regmap, DPHY_MC_TIME_CON3, val); in samsung_mipi_dphy_clk_lane_timing_init()
1623 regmap_write(samsung->regmap, DPHY_MC_TIME_CON4, 0x1f4); in samsung_mipi_dphy_clk_lane_timing_init()
1630 regmap_write(samsung->regmap, DPHY_MC_DESKEW_CON0, 0x9cb1); in samsung_mipi_dphy_clk_lane_timing_init()
1637 unsigned int lane_hs_rate = div64_ul(samsung->pll.rate, USEC_PER_SEC); in samsung_mipi_dphy_data_lane_timing_init()
1642 regmap_write(samsung->regmap, COMBO_MD0_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1643 regmap_write(samsung->regmap, COMBO_MD1_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1644 regmap_write(samsung->regmap, COMBO_MD2_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1645 regmap_write(samsung->regmap, DPHY_MD3_ANA_CON0, 0x7133); in samsung_mipi_dphy_data_lane_timing_init()
1648 regmap_write(samsung->regmap, COMBO_MD0_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1649 regmap_write(samsung->regmap, COMBO_MD1_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1650 regmap_write(samsung->regmap, COMBO_MD2_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1651 regmap_write(samsung->regmap, DPHY_MD3_ANA_CON1, 0x0001); in samsung_mipi_dphy_data_lane_timing_init()
1655 * Divide-by-2 Clock from Serial Clock. Use this when data rate is under in samsung_mipi_dphy_data_lane_timing_init()
1656 * 1500Mbps, otherwise divide-by-16 Clock from Serial Clock in samsung_mipi_dphy_data_lane_timing_init()
1661 val |= T_LPX(timing->lpx); in samsung_mipi_dphy_data_lane_timing_init()
1663 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1664 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1665 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1666 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON0, val); in samsung_mipi_dphy_data_lane_timing_init()
1668 val = T_HS_ZERO(timing->hs_zero) | T_HS_PREPARE(timing->hs_prepare); in samsung_mipi_dphy_data_lane_timing_init()
1669 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1670 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1671 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1672 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON1, val); in samsung_mipi_dphy_data_lane_timing_init()
1674 val = T_HS_EXIT(timing->hs_exit) | T_HS_TRAIL(timing->hs_trail_eot); in samsung_mipi_dphy_data_lane_timing_init()
1675 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1676 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1677 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1678 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON2, val); in samsung_mipi_dphy_data_lane_timing_init()
1680 /* TTA-GET/TTA-GO Timing Counter register use default value */ in samsung_mipi_dphy_data_lane_timing_init()
1682 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1683 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1684 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1685 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON3, val); in samsung_mipi_dphy_data_lane_timing_init()
1688 regmap_write(samsung->regmap, COMBO_MD0_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1689 regmap_write(samsung->regmap, COMBO_MD1_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1690 regmap_write(samsung->regmap, COMBO_MD2_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1691 regmap_write(samsung->regmap, DPHY_MD3_TIME_CON4, 0x1f4); in samsung_mipi_dphy_data_lane_timing_init()
1697 regmap_write(samsung->regmap, DPHY_MC_ANA_CON2, HS_VREG_AMP_ICON(2)); in samsung_mipi_dcphy_hs_vreg_amp_configure()
1702 reset_control_assert(samsung->m_phy_rst); in samsung_mipi_dphy_power_on()
1711 reset_control_deassert(samsung->m_phy_rst); in samsung_mipi_dphy_power_on()
1721 regmap_write(samsung->grf_regmap, MIPI_DCPHY_GRF_CON0, M_CPHY_MODE); in samsung_mipi_cphy_power_on()
1722 reset_control_assert(samsung->m_phy_rst); in samsung_mipi_cphy_power_on()
1731 reset_control_deassert(samsung->m_phy_rst); in samsung_mipi_cphy_power_on()
1743 pm_runtime_get_sync(samsung->dev); in samsung_mipi_dcphy_power_on()
1744 reset_control_assert(samsung->apb_rst); in samsung_mipi_dcphy_power_on()
1746 reset_control_deassert(samsung->apb_rst); in samsung_mipi_dcphy_power_on()
1747 if (atomic_read(&samsung->stream_cnt)) { in samsung_mipi_dcphy_power_on()
1748 sensor_sd = get_remote_sensor(&samsung->dphy_dev[0]->sd); in samsung_mipi_dcphy_power_on()
1749 samsung->stream_off(samsung->dphy_dev[0], &samsung->dphy_dev[0]->sd); in samsung_mipi_dcphy_power_on()
1753 samsung->stream_on(samsung->dphy_dev[0], &samsung->dphy_dev[0]->sd); in samsung_mipi_dcphy_power_on()
1787 pm_runtime_put(samsung->dev); in samsung_mipi_dcphy_power_off()
1802 unsigned long fin = div64_ul(clk_get_rate(samsung->ref_clk), MSEC_PER_SEC); in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1803 u16 prediv = samsung->pll.prediv; in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1804 u16 fbdiv = samsung->pll.fbdiv; in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1836 dev_err(samsung->dev, "failed to calc ssc parameter mfr and mrr\n"); in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1837 return -EINVAL; in samsung_mipi_dcphy_pll_ssc_modulation_calc()
1847 unsigned long prate = clk_get_rate(samsung->ref_clk); in samsung_mipi_dcphy_pll_calc_rate()
1859 dev_dbg(samsung->dev, "%s: fin=%lu, req_rate=%llu\n", in samsung_mipi_dcphy_pll_calc_rate()
1861 dev_dbg(samsung->dev, "%s: fout=%lu, prediv=%u, fbdiv=%u\n", in samsung_mipi_dcphy_pll_calc_rate()
1864 samsung->pll.prediv = prediv; in samsung_mipi_dcphy_pll_calc_rate()
1865 samsung->pll.fbdiv = fbdiv; in samsung_mipi_dcphy_pll_calc_rate()
1866 samsung->pll.dsm = dsm; in samsung_mipi_dcphy_pll_calc_rate()
1867 samsung->pll.scaler = scaler; in samsung_mipi_dcphy_pll_calc_rate()
1868 samsung->pll.rate = fout; in samsung_mipi_dcphy_pll_calc_rate()
1878 samsung->pll.ssc_en = true; in samsung_mipi_dcphy_pll_calc_rate()
1879 samsung->pll.mfr = mfr; in samsung_mipi_dcphy_pll_calc_rate()
1880 samsung->pll.mrr = mrr; in samsung_mipi_dcphy_pll_calc_rate()
1889 unsigned long long target_rate = opts->mipi_dphy.hs_clk_rate; in samsung_mipi_dcphy_configure()
1892 samsung->c_option = (mode == PHY_MODE_MIPI_DPHY) ? false : true; in samsung_mipi_dcphy_configure()
1894 samsung->lanes = opts->mipi_dphy.lanes > 4 ? 4 : opts->mipi_dphy.lanes; in samsung_mipi_dcphy_configure()
1897 opts->mipi_dphy.hs_clk_rate = samsung->pll.rate; in samsung_mipi_dcphy_configure()
1907 local = &sd->entity.pads[CSI2_DPHY_RX_PAD_SINK]; in get_remote_sensor()
1914 sensor_me = media_entity_remote_pad(local)->entity; in get_remote_sensor()
1923 for (i = 0; i < dphy->num_sensors; ++i) in sd_to_sensor()
1924 if (dphy->sensors[i].sd == sd) in sd_to_sensor()
1925 return &dphy->sensors[i]; in sd_to_sensor()
1933 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_config_settle()
1939 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { in samsung_dcphy_rx_config_settle()
1943 } else if (sensor->mbus.type == V4L2_MBUS_CSI2_CPHY) { in samsung_dcphy_rx_config_settle()
1948 dev_err(dphy->dev, "mbus type %d is not support", in samsung_dcphy_rx_config_settle()
1949 sensor->mbus.type); in samsung_dcphy_rx_config_settle()
1954 if (hsfreq_ranges[i].range_h >= dphy->data_rate_mbps) { in samsung_dcphy_rx_config_settle()
1961 i = num_hsfreq_ranges - 1; in samsung_dcphy_rx_config_settle()
1962 dev_warn(dphy->dev, "data rate: %lld mbps, max support %d mbps", in samsung_dcphy_rx_config_settle()
1963 dphy->data_rate_mbps, hsfreq_ranges[i].range_h + 1); in samsung_dcphy_rx_config_settle()
1967 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) in samsung_dcphy_rx_config_settle()
1968 regmap_write(samsung->regmap, RX_CLK_THS_SETTLE, 0x301); in samsung_dcphy_rx_config_settle()
1970 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_config_settle()
1971 regmap_update_bits(samsung->regmap, RX_LANE0_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1972 regmap_update_bits(samsung->regmap, RX_LANE0_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1974 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_config_settle()
1975 regmap_update_bits(samsung->regmap, RX_LANE1_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1976 regmap_update_bits(samsung->regmap, RX_LANE1_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1978 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_config_settle()
1979 regmap_update_bits(samsung->regmap, RX_LANE2_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1980 regmap_update_bits(samsung->regmap, RX_LANE2_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1982 if (sensor->lanes > 0x03) { in samsung_dcphy_rx_config_settle()
1983 regmap_update_bits(samsung->regmap, RX_LANE3_THS_SETTLE, 0x1ff, hsfreq); in samsung_dcphy_rx_config_settle()
1984 regmap_update_bits(samsung->regmap, RX_LANE3_ERR_SOT_SYNC, 0xff, sot_sync); in samsung_dcphy_rx_config_settle()
1991 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_config_common()
1995 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { in samsung_dcphy_rx_config_common()
1996 if (dphy->data_rate_mbps < 1500) in samsung_dcphy_rx_config_common()
1998 else if (dphy->data_rate_mbps < 2000) in samsung_dcphy_rx_config_common()
2000 else if (dphy->data_rate_mbps < 3000) in samsung_dcphy_rx_config_common()
2002 else if (dphy->data_rate_mbps < 4000) in samsung_dcphy_rx_config_common()
2004 else if (dphy->data_rate_mbps < 6500) in samsung_dcphy_rx_config_common()
2006 if (dphy->dphy_param.clk_hs_term_sel > 0x7) { in samsung_dcphy_rx_config_common()
2007 dev_err(dphy->dev, "clk_hs_term_sel error param %d\n", in samsung_dcphy_rx_config_common()
2008 dphy->dphy_param.clk_hs_term_sel); in samsung_dcphy_rx_config_common()
2009 return -EINVAL; in samsung_dcphy_rx_config_common()
2011 for (i = 0; i < sensor->lanes; i++) { in samsung_dcphy_rx_config_common()
2012 if (dphy->dphy_param.data_hs_term_sel[i] > 0x7) { in samsung_dcphy_rx_config_common()
2013 dev_err(dphy->dev, "data_hs_term_sel[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2015 dphy->dphy_param.data_hs_term_sel[i]); in samsung_dcphy_rx_config_common()
2016 return -EINVAL; in samsung_dcphy_rx_config_common()
2018 if (dphy->dphy_param.lp_hys_sw[i] > 0x3) { in samsung_dcphy_rx_config_common()
2019 dev_err(dphy->dev, "lp_hys_sw[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2021 dphy->dphy_param.lp_hys_sw[i]); in samsung_dcphy_rx_config_common()
2022 return -EINVAL; in samsung_dcphy_rx_config_common()
2024 if (dphy->dphy_param.lp_escclk_pol_sel[i] > 0x1) { in samsung_dcphy_rx_config_common()
2025 dev_err(dphy->dev, "lp_escclk_pol_sel[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2027 dphy->dphy_param.lp_escclk_pol_sel[i]); in samsung_dcphy_rx_config_common()
2028 return -EINVAL; in samsung_dcphy_rx_config_common()
2030 if (dphy->dphy_param.skew_data_cal_clk[i] > 0x1f) { in samsung_dcphy_rx_config_common()
2031 dev_err(dphy->dev, "skew_data_cal_clk[%d] error param %d\n", in samsung_dcphy_rx_config_common()
2033 dphy->dphy_param.skew_data_cal_clk[i]); in samsung_dcphy_rx_config_common()
2034 return -EINVAL; in samsung_dcphy_rx_config_common()
2037 regmap_write(samsung->regmap, RX_S0C_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2038 regmap_write(samsung->regmap, RX_S0C_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2039 regmap_write(samsung->regmap, RX_S0C_ANA_CON2, dphy->dphy_param.clk_hs_term_sel); in samsung_dcphy_rx_config_common()
2040 regmap_write(samsung->regmap, RX_S0C_ANA_CON3, 0x0600); in samsung_dcphy_rx_config_common()
2041 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_config_common()
2042 regmap_write(samsung->regmap, RX_COMBO_S0D0_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2043 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2044 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2045 dphy->dphy_param.data_hs_term_sel[0]); in samsung_dcphy_rx_config_common()
2046 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2047 (dphy->dphy_param.lp_hys_sw[0] << 4) | in samsung_dcphy_rx_config_common()
2048 (dphy->dphy_param.lp_escclk_pol_sel[0] << 11)); in samsung_dcphy_rx_config_common()
2049 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2050 regmap_write(samsung->regmap, RX_COMBO_S0D0_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2051 dphy->dphy_param.skew_data_cal_clk[0]); in samsung_dcphy_rx_config_common()
2053 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_config_common()
2054 regmap_write(samsung->regmap, RX_COMBO_S0D1_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2055 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2056 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2057 dphy->dphy_param.data_hs_term_sel[1]); in samsung_dcphy_rx_config_common()
2058 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2059 (dphy->dphy_param.lp_hys_sw[1] << 4) | in samsung_dcphy_rx_config_common()
2060 (dphy->dphy_param.lp_escclk_pol_sel[1] << 11)); in samsung_dcphy_rx_config_common()
2061 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2062 regmap_write(samsung->regmap, RX_COMBO_S0D1_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2063 dphy->dphy_param.skew_data_cal_clk[1]); in samsung_dcphy_rx_config_common()
2065 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_config_common()
2066 regmap_write(samsung->regmap, RX_COMBO_S0D2_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2067 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2068 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2069 dphy->dphy_param.data_hs_term_sel[2]); in samsung_dcphy_rx_config_common()
2070 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2071 (dphy->dphy_param.lp_hys_sw[2] << 4) | in samsung_dcphy_rx_config_common()
2072 (dphy->dphy_param.lp_escclk_pol_sel[2] << 11)); in samsung_dcphy_rx_config_common()
2073 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2074 regmap_write(samsung->regmap, RX_COMBO_S0D2_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2075 dphy->dphy_param.skew_data_cal_clk[2]); in samsung_dcphy_rx_config_common()
2077 if (sensor->lanes > 0x03) { in samsung_dcphy_rx_config_common()
2078 regmap_write(samsung->regmap, RX_S0D3_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2079 regmap_write(samsung->regmap, RX_S0D3_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2080 regmap_write(samsung->regmap, RX_S0D3_ANA_CON2, dlysel | in samsung_dcphy_rx_config_common()
2081 dphy->dphy_param.data_hs_term_sel[3]); in samsung_dcphy_rx_config_common()
2082 regmap_write(samsung->regmap, RX_S0D3_ANA_CON3, 0x0600 | in samsung_dcphy_rx_config_common()
2083 (dphy->dphy_param.lp_hys_sw[3] << 4) | in samsung_dcphy_rx_config_common()
2084 (dphy->dphy_param.lp_escclk_pol_sel[3] << 11)); in samsung_dcphy_rx_config_common()
2085 regmap_write(samsung->regmap, RX_S0D3_DESKEW_CON2, in samsung_dcphy_rx_config_common()
2086 dphy->dphy_param.skew_data_cal_clk[3]); in samsung_dcphy_rx_config_common()
2089 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_config_common()
2090 regmap_write(samsung->regmap, RX_COMBO_S0D0_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2091 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2092 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON2, 0x5); in samsung_dcphy_rx_config_common()
2093 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON3, 0x600); in samsung_dcphy_rx_config_common()
2094 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON6, 0x608); in samsung_dcphy_rx_config_common()
2095 regmap_write(samsung->regmap, RX_COMBO_S0D0_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2096 regmap_write(samsung->regmap, RX_COMBO_S0D0_CRC_CON1, 0x1500); in samsung_dcphy_rx_config_common()
2097 regmap_write(samsung->regmap, RX_COMBO_S0D0_CRC_CON2, 0x30); in samsung_dcphy_rx_config_common()
2099 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_config_common()
2100 regmap_write(samsung->regmap, RX_COMBO_S0D1_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2101 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2102 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON2, 0x5); in samsung_dcphy_rx_config_common()
2103 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON3, 0x600); in samsung_dcphy_rx_config_common()
2104 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON6, 0x608); in samsung_dcphy_rx_config_common()
2105 regmap_write(samsung->regmap, RX_COMBO_S0D1_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2106 regmap_write(samsung->regmap, RX_COMBO_S0D1_CRC_CON1, 0x1500); in samsung_dcphy_rx_config_common()
2107 regmap_write(samsung->regmap, RX_COMBO_S0D1_CRC_CON2, 0x30); in samsung_dcphy_rx_config_common()
2109 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_config_common()
2110 regmap_write(samsung->regmap, RX_COMBO_S0D2_GNR_CON1, 0x1450); in samsung_dcphy_rx_config_common()
2111 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON1, 0x8000); in samsung_dcphy_rx_config_common()
2112 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON2, 0x5); in samsung_dcphy_rx_config_common()
2113 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON3, 0x600); in samsung_dcphy_rx_config_common()
2114 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON6, 0x608); in samsung_dcphy_rx_config_common()
2115 regmap_write(samsung->regmap, RX_COMBO_S0D2_ANA_CON7, 0x40); in samsung_dcphy_rx_config_common()
2116 regmap_write(samsung->regmap, RX_COMBO_S0D2_CRC_CON1, 0x1500); in samsung_dcphy_rx_config_common()
2117 regmap_write(samsung->regmap, RX_COMBO_S0D2_CRC_CON2, 0x30); in samsung_dcphy_rx_config_common()
2126 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_lane_enable()
2130 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) in samsung_dcphy_rx_lane_enable()
2131 regmap_update_bits(samsung->regmap, RX_CLK_LANE_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2133 if (sensor->lanes > 0x00) in samsung_dcphy_rx_lane_enable()
2134 regmap_update_bits(samsung->regmap, RX_DATA_LANE0_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2135 if (sensor->lanes > 0x01) in samsung_dcphy_rx_lane_enable()
2136 regmap_update_bits(samsung->regmap, RX_DATA_LANE1_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2137 if (sensor->lanes > 0x02) in samsung_dcphy_rx_lane_enable()
2138 regmap_update_bits(samsung->regmap, RX_DATA_LANE2_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2139 if (sensor->lanes > 0x03) in samsung_dcphy_rx_lane_enable()
2140 regmap_update_bits(samsung->regmap, RX_DATA_LANE3_ENABLE, PHY_ENABLE, PHY_ENABLE); in samsung_dcphy_rx_lane_enable()
2143 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { in samsung_dcphy_rx_lane_enable()
2144 ret = regmap_read_poll_timeout(samsung->regmap, RX_CLK_LANE_ENABLE, in samsung_dcphy_rx_lane_enable()
2147 dev_err(samsung->dev, "phy rx clk lane is not locked\n"); in samsung_dcphy_rx_lane_enable()
2148 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2153 if (sensor->lanes > 0x00) { in samsung_dcphy_rx_lane_enable()
2154 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE0_ENABLE, in samsung_dcphy_rx_lane_enable()
2157 dev_err(samsung->dev, "phy rx data lane 0 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2158 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2161 if (sensor->lanes > 0x01) { in samsung_dcphy_rx_lane_enable()
2162 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE1_ENABLE, in samsung_dcphy_rx_lane_enable()
2165 dev_err(samsung->dev, "phy rx data lane 1 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2166 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2169 if (sensor->lanes > 0x02) { in samsung_dcphy_rx_lane_enable()
2170 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE2_ENABLE, in samsung_dcphy_rx_lane_enable()
2173 dev_err(samsung->dev, "phy rx data lane 2 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2174 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2178 if (sensor->lanes > 0x03) { in samsung_dcphy_rx_lane_enable()
2179 ret = regmap_read_poll_timeout(samsung->regmap, RX_DATA_LANE3_ENABLE, in samsung_dcphy_rx_lane_enable()
2182 dev_err(samsung->dev, "phy rx data lane 3 is not locked\n"); in samsung_dcphy_rx_lane_enable()
2183 return -EINVAL; in samsung_dcphy_rx_lane_enable()
2194 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_stream_on()
2198 return -ENODEV; in samsung_dcphy_rx_stream_on()
2201 return -ENODEV; in samsung_dcphy_rx_stream_on()
2203 mutex_lock(&samsung->mutex); in samsung_dcphy_rx_stream_on()
2204 if (sensor->mbus.type == V4L2_MBUS_CSI2_CPHY) in samsung_dcphy_rx_stream_on()
2205 regmap_write(samsung->grf_regmap, MIPI_DCPHY_GRF_CON0, S_CPHY_MODE); in samsung_dcphy_rx_stream_on()
2207 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_on()
2208 reset_control_assert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_on()
2220 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_on()
2221 reset_control_deassert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_on()
2223 atomic_inc(&samsung->stream_cnt); in samsung_dcphy_rx_stream_on()
2224 mutex_unlock(&samsung->mutex); in samsung_dcphy_rx_stream_on()
2228 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_on()
2229 reset_control_deassert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_on()
2230 mutex_unlock(&samsung->mutex); in samsung_dcphy_rx_stream_on()
2231 dev_err(dphy->dev, "stream on error\n"); in samsung_dcphy_rx_stream_on()
2232 return -EINVAL; in samsung_dcphy_rx_stream_on()
2239 struct samsung_mipi_dcphy *samsung = dphy->samsung_phy; in samsung_dcphy_rx_stream_off()
2244 return -ENODEV; in samsung_dcphy_rx_stream_off()
2247 return -ENODEV; in samsung_dcphy_rx_stream_off()
2249 if (atomic_dec_return(&samsung->stream_cnt)) in samsung_dcphy_rx_stream_off()
2252 mutex_lock(&samsung->mutex); in samsung_dcphy_rx_stream_off()
2253 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_off()
2254 reset_control_assert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_off()
2256 if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) in samsung_dcphy_rx_stream_off()
2257 regmap_update_bits(samsung->regmap, RX_CLK_LANE_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2259 if (sensor->lanes > 0x00) in samsung_dcphy_rx_stream_off()
2260 regmap_update_bits(samsung->regmap, RX_DATA_LANE0_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2261 if (sensor->lanes > 0x01) in samsung_dcphy_rx_stream_off()
2262 regmap_update_bits(samsung->regmap, RX_DATA_LANE1_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2263 if (sensor->lanes > 0x02) in samsung_dcphy_rx_stream_off()
2264 regmap_update_bits(samsung->regmap, RX_DATA_LANE2_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2265 if (sensor->lanes > 0x03) in samsung_dcphy_rx_stream_off()
2266 regmap_update_bits(samsung->regmap, RX_DATA_LANE3_ENABLE, PHY_ENABLE, 0); in samsung_dcphy_rx_stream_off()
2268 if (samsung->s_phy_rst) in samsung_dcphy_rx_stream_off()
2269 reset_control_deassert(samsung->s_phy_rst); in samsung_dcphy_rx_stream_off()
2272 mutex_unlock(&samsung->mutex); in samsung_dcphy_rx_stream_off()
2281 pm_runtime_get_sync(samsung->dev); in samsung_mipi_dcphy_init()
2290 pm_runtime_put(samsung->dev); in samsung_mipi_dcphy_exit()
2314 struct device *dev = &pdev->dev; in samsung_mipi_dcphy_probe()
2315 struct device_node *np = dev->of_node; in samsung_mipi_dcphy_probe()
2325 return -ENOMEM; in samsung_mipi_dcphy_probe()
2327 samsung->dev = dev; in samsung_mipi_dcphy_probe()
2335 samsung->regmap = devm_regmap_init_mmio(dev, regs, in samsung_mipi_dcphy_probe()
2337 if (IS_ERR(samsung->regmap)) { in samsung_mipi_dcphy_probe()
2338 ret = PTR_ERR(samsung->regmap); in samsung_mipi_dcphy_probe()
2343 samsung->grf_regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); in samsung_mipi_dcphy_probe()
2344 if (IS_ERR(samsung->grf_regmap)) { in samsung_mipi_dcphy_probe()
2346 return PTR_ERR(samsung->grf_regmap); in samsung_mipi_dcphy_probe()
2349 samsung->ref_clk = devm_clk_get(dev, "ref"); in samsung_mipi_dcphy_probe()
2350 if (IS_ERR(samsung->ref_clk)) { in samsung_mipi_dcphy_probe()
2352 return PTR_ERR(samsung->ref_clk); in samsung_mipi_dcphy_probe()
2355 samsung->pclk = devm_clk_get(dev, "pclk"); in samsung_mipi_dcphy_probe()
2356 if (IS_ERR(samsung->pclk)) { in samsung_mipi_dcphy_probe()
2358 return PTR_ERR(samsung->pclk); in samsung_mipi_dcphy_probe()
2361 samsung->m_phy_rst = devm_reset_control_get(dev, "m_phy"); in samsung_mipi_dcphy_probe()
2362 if (IS_ERR(samsung->m_phy_rst)) { in samsung_mipi_dcphy_probe()
2364 return PTR_ERR(samsung->m_phy_rst); in samsung_mipi_dcphy_probe()
2367 samsung->s_phy_rst = devm_reset_control_get(dev, "s_phy"); in samsung_mipi_dcphy_probe()
2368 if (IS_ERR(samsung->s_phy_rst)) { in samsung_mipi_dcphy_probe()
2370 return PTR_ERR(samsung->s_phy_rst); in samsung_mipi_dcphy_probe()
2373 samsung->apb_rst = devm_reset_control_get(dev, "apb"); in samsung_mipi_dcphy_probe()
2374 if (IS_ERR(samsung->apb_rst)) { in samsung_mipi_dcphy_probe()
2376 return PTR_ERR(samsung->apb_rst); in samsung_mipi_dcphy_probe()
2379 samsung->grf_apb_rst = devm_reset_control_get(dev, "grf"); in samsung_mipi_dcphy_probe()
2380 if (IS_ERR(samsung->grf_apb_rst)) { in samsung_mipi_dcphy_probe()
2382 return PTR_ERR(samsung->grf_apb_rst); in samsung_mipi_dcphy_probe()
2387 dev_err(dev, "failed to create MIPI Dc-PHY\n"); in samsung_mipi_dcphy_probe()
2399 samsung->stream_on = samsung_dcphy_rx_stream_on; in samsung_mipi_dcphy_probe()
2400 samsung->stream_off = samsung_dcphy_rx_stream_off; in samsung_mipi_dcphy_probe()
2401 mutex_init(&samsung->mutex); in samsung_mipi_dcphy_probe()
2411 pm_runtime_disable(samsung->dev); in samsung_mipi_dcphy_remove()
2412 mutex_destroy(&samsung->mutex); in samsung_mipi_dcphy_remove()
2421 clk_disable_unprepare(samsung->pclk); in samsung_mipi_dcphy_runtime_suspend()
2422 clk_disable_unprepare(samsung->ref_clk); in samsung_mipi_dcphy_runtime_suspend()
2431 clk_prepare_enable(samsung->pclk); in samsung_mipi_dcphy_runtime_resume()
2432 clk_prepare_enable(samsung->ref_clk); in samsung_mipi_dcphy_runtime_resume()
2444 .compatible = "rockchip,rk3588-mipi-dcphy",
2452 .name = "samsung-mipi-dcphy",
2461 MODULE_AUTHOR("Guochun Huang<hero.huang@rock-chips.com>");