@@ -330,7 +330,7 @@ enum dp_link_rate {
330
330
};
331
331
332
332
struct ropll_config {
333
- u32 bit_rate ;
333
+ unsigned long long rate ;
334
334
u8 pms_mdiv ;
335
335
u8 pms_mdiv_afc ;
336
336
u8 pms_pdiv ;
@@ -410,45 +410,45 @@ struct rk_hdptx_phy {
410
410
};
411
411
412
412
static const struct ropll_config ropll_tmds_cfg [] = {
413
- { 5940000 , 124 , 124 , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
413
+ { 594000000ULL , 124 , 124 , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
414
414
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
415
- { 3712500 , 155 , 155 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
415
+ { 371250000ULL , 155 , 155 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
416
416
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
417
- { 2970000 , 124 , 124 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
417
+ { 297000000ULL , 124 , 124 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
418
418
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
419
- { 1620000 , 135 , 135 , 1 , 1 , 3 , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 4 , 0 , 3 , 5 , 5 , 0x10 ,
419
+ { 162000000ULL , 135 , 135 , 1 , 1 , 3 , 1 , 1 , 0 , 1 , 1 , 1 , 1 , 4 , 0 , 3 , 5 , 5 , 0x10 ,
420
420
1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
421
- { 1856250 , 155 , 155 , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
421
+ { 185625000ULL , 155 , 155 , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
422
422
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
423
- { 1540000 , 193 , 193 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 193 , 1 , 32 , 2 , 1 ,
423
+ { 154000000ULL , 193 , 193 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 193 , 1 , 32 , 2 , 1 ,
424
424
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
425
- { 1485000 , 0x7b , 0x7b , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 4 , 0 , 3 , 5 , 5 ,
425
+ { 148500000ULL , 0x7b , 0x7b , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 4 , 0 , 3 , 5 , 5 ,
426
426
0x10 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
427
- { 1462500 , 122 , 122 , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 244 , 1 , 16 , 2 , 1 , 1 ,
427
+ { 146250000ULL , 122 , 122 , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 244 , 1 , 16 , 2 , 1 , 1 ,
428
428
1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
429
- { 1190000 , 149 , 149 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 149 , 1 , 16 , 2 , 1 , 1 ,
429
+ { 119000000ULL , 149 , 149 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 149 , 1 , 16 , 2 , 1 , 1 ,
430
430
1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
431
- { 1065000 , 89 , 89 , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 89 , 1 , 16 , 1 , 0 , 1 ,
431
+ { 106500000ULL , 89 , 89 , 1 , 1 , 3 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 89 , 1 , 16 , 1 , 0 , 1 ,
432
432
1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
433
- { 1080000 , 135 , 135 , 1 , 1 , 5 , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 0x9 , 0 , 0x05 , 0 ,
433
+ { 108000000ULL , 135 , 135 , 1 , 1 , 5 , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 0x9 , 0 , 0x05 , 0 ,
434
434
0x14 , 0x18 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
435
- { 855000 , 214 , 214 , 1 , 1 , 11 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 214 , 1 , 16 , 2 , 1 ,
435
+ { 85500000ULL , 214 , 214 , 1 , 1 , 11 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 214 , 1 , 16 , 2 , 1 ,
436
436
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
437
- { 835000 , 105 , 105 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 42 , 1 , 16 , 1 , 0 ,
437
+ { 83500000ULL , 105 , 105 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 42 , 1 , 16 , 1 , 0 ,
438
438
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
439
- { 928125 , 155 , 155 , 1 , 1 , 7 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
439
+ { 92812500ULL , 155 , 155 , 1 , 1 , 7 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
440
440
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
441
- { 742500 , 124 , 124 , 1 , 1 , 7 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
441
+ { 74250000ULL , 124 , 124 , 1 , 1 , 7 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 62 , 1 , 16 , 5 , 0 ,
442
442
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
443
- { 650000 , 162 , 162 , 1 , 1 , 11 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 54 , 0 , 16 , 4 , 1 ,
443
+ { 65000000ULL , 162 , 162 , 1 , 1 , 11 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 54 , 0 , 16 , 4 , 1 ,
444
444
1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
445
- { 337500 , 0x70 , 0x70 , 1 , 1 , 0xf , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0x2 , 0 , 0x01 , 5 ,
445
+ { 33750000ULL , 0x70 , 0x70 , 1 , 1 , 0xf , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0x2 , 0 , 0x01 , 5 ,
446
446
1 , 1 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
447
- { 400000 , 100 , 100 , 1 , 1 , 11 , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 0x9 , 0 , 0x05 , 0 ,
447
+ { 40000000ULL , 100 , 100 , 1 , 1 , 11 , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 0x9 , 0 , 0x05 , 0 ,
448
448
0x14 , 0x18 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
449
- { 270000 , 0x5a , 0x5a , 1 , 1 , 0xf , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 0x9 , 0 , 0x05 , 0 ,
449
+ { 27000000ULL , 0x5a , 0x5a , 1 , 1 , 0xf , 1 , 1 , 0 , 1 , 0 , 1 , 1 , 0x9 , 0 , 0x05 , 0 ,
450
450
0x14 , 0x18 , 1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
451
- { 251750 , 84 , 84 , 1 , 1 , 0xf , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 168 , 1 , 16 , 4 , 1 , 1 ,
451
+ { 25175000ULL , 84 , 84 , 1 , 1 , 0xf , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 168 , 1 , 16 , 4 , 1 , 1 ,
452
452
1 , 0 , 0x20 , 0x0c , 1 , 0x0e , 0 , 0 , },
453
453
};
454
454
@@ -894,10 +894,10 @@ static void rk_hdptx_phy_disable(struct rk_hdptx_phy *hdptx)
894
894
regmap_write (hdptx -> grf , GRF_HDPTX_CON0 , val );
895
895
}
896
896
897
- static bool rk_hdptx_phy_clk_pll_calc (unsigned int data_rate ,
897
+ static bool rk_hdptx_phy_clk_pll_calc (unsigned long long rate ,
898
898
struct ropll_config * cfg )
899
899
{
900
- const unsigned int fout = data_rate / 2 , fref = 24000 ;
900
+ const unsigned int fout = div_u64 ( rate , 200 ) , fref = 24000 ;
901
901
unsigned long k = 0 , lc , k_sub , lc_sub ;
902
902
unsigned int fvco , sdc ;
903
903
u32 mdiv , sdiv , n = 8 ;
@@ -967,14 +967,14 @@ static bool rk_hdptx_phy_clk_pll_calc(unsigned int data_rate,
967
967
}
968
968
969
969
static int rk_hdptx_ropll_tmds_cmn_config (struct rk_hdptx_phy * hdptx ,
970
- unsigned int rate )
970
+ unsigned long long rate )
971
971
{
972
972
const struct ropll_config * cfg = NULL ;
973
973
struct ropll_config rc = {0 };
974
974
int ret , i ;
975
975
976
976
for (i = 0 ; i < ARRAY_SIZE (ropll_tmds_cfg ); i ++ )
977
- if (rate == ropll_tmds_cfg [i ].bit_rate ) {
977
+ if (rate == ropll_tmds_cfg [i ].rate ) {
978
978
cfg = & ropll_tmds_cfg [i ];
979
979
break ;
980
980
}
@@ -988,8 +988,8 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx,
988
988
}
989
989
}
990
990
991
- dev_dbg (hdptx -> dev , "mdiv=%u, sdiv=%u, sdm_en=%u, k_sign=%u, k=%u, lc=%u\n" ,
992
- cfg -> pms_mdiv , cfg -> pms_sdiv + 1 , cfg -> sdm_en ,
991
+ dev_dbg (hdptx -> dev , "%s rate=%llu mdiv=%u sdiv=%u sdm_en=%u k_sign=%u k=%u lc=%u\n" ,
992
+ __func__ , rate , cfg -> pms_mdiv , cfg -> pms_sdiv + 1 , cfg -> sdm_en ,
993
993
cfg -> sdm_num_sign , cfg -> sdm_num , cfg -> sdm_deno );
994
994
995
995
rk_hdptx_pre_power_up (hdptx );
@@ -1028,19 +1028,19 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx,
1028
1028
1029
1029
ret = rk_hdptx_post_enable_pll (hdptx );
1030
1030
if (!ret )
1031
- hdptx -> rate = rate * 100 ;
1031
+ hdptx -> rate = rate ;
1032
1032
1033
1033
return ret ;
1034
1034
}
1035
1035
1036
1036
static int rk_hdptx_ropll_tmds_mode_config (struct rk_hdptx_phy * hdptx ,
1037
- unsigned int rate )
1037
+ unsigned long long rate )
1038
1038
{
1039
1039
rk_hdptx_multi_reg_write (hdptx , rk_hdtpx_common_sb_init_seq );
1040
1040
1041
1041
regmap_write (hdptx -> regmap , LNTOP_REG (0200 ), 0x06 );
1042
1042
1043
- if (rate > HDMI14_MAX_RATE / 100 ) {
1043
+ if (rate > HDMI14_MAX_RATE ) {
1044
1044
/* For 1/40 bitrate clk */
1045
1045
rk_hdptx_multi_reg_write (hdptx , rk_hdtpx_tmds_lntop_highbr_seq );
1046
1046
} else {
@@ -1093,7 +1093,7 @@ static void rk_hdptx_dp_reset(struct rk_hdptx_phy *hdptx)
1093
1093
}
1094
1094
1095
1095
static int rk_hdptx_phy_consumer_get (struct rk_hdptx_phy * hdptx ,
1096
- unsigned int rate )
1096
+ unsigned long long rate )
1097
1097
{
1098
1098
enum phy_mode mode = phy_get_mode (hdptx -> phy );
1099
1099
u32 status ;
@@ -1411,19 +1411,19 @@ static int rk_hdptx_dp_aux_init(struct rk_hdptx_phy *hdptx)
1411
1411
static int rk_hdptx_phy_power_on (struct phy * phy )
1412
1412
{
1413
1413
struct rk_hdptx_phy * hdptx = phy_get_drvdata (phy );
1414
- int bus_width = phy_get_bus_width (hdptx -> phy );
1415
1414
enum phy_mode mode = phy_get_mode (phy );
1415
+ unsigned long long rate ;
1416
1416
int ret , lane ;
1417
1417
1418
1418
/*
1419
1419
* FIXME: Temporary workaround to pass pixel_clk_rate
1420
1420
* from the HDMI bridge driver until phy_configure_opts_hdmi
1421
1421
* becomes available in the PHY API.
1422
1422
*/
1423
- unsigned int rate = bus_width & 0xfffffff ;
1423
+ rate = phy_get_bus_width (hdptx -> phy ) & 0xfffffff ;
1424
+ rate *= 100 ;
1424
1425
1425
- dev_dbg (hdptx -> dev , "%s bus_width=%x rate=%u\n" ,
1426
- __func__ , bus_width , rate );
1426
+ dev_dbg (hdptx -> dev , "%s rate=%llu\n" , __func__ , rate );
1427
1427
1428
1428
ret = rk_hdptx_phy_consumer_get (hdptx , rate );
1429
1429
if (ret )
@@ -1785,7 +1785,7 @@ static int rk_hdptx_phy_clk_prepare(struct clk_hw *hw)
1785
1785
{
1786
1786
struct rk_hdptx_phy * hdptx = to_rk_hdptx_phy (hw );
1787
1787
1788
- return rk_hdptx_phy_consumer_get (hdptx , hdptx -> rate / 100 );
1788
+ return rk_hdptx_phy_consumer_get (hdptx , hdptx -> rate );
1789
1789
}
1790
1790
1791
1791
static void rk_hdptx_phy_clk_unprepare (struct clk_hw * hw )
@@ -1806,18 +1806,17 @@ static unsigned long rk_hdptx_phy_clk_recalc_rate(struct clk_hw *hw,
1806
1806
static long rk_hdptx_phy_clk_round_rate (struct clk_hw * hw , unsigned long rate ,
1807
1807
unsigned long * parent_rate )
1808
1808
{
1809
- u32 bit_rate = rate / 100 ;
1810
1809
int i ;
1811
1810
1812
1811
if (rate > HDMI20_MAX_RATE )
1813
1812
return rate ;
1814
1813
1815
1814
for (i = 0 ; i < ARRAY_SIZE (ropll_tmds_cfg ); i ++ )
1816
- if (bit_rate == ropll_tmds_cfg [i ].bit_rate )
1815
+ if (rate == ropll_tmds_cfg [i ].rate )
1817
1816
break ;
1818
1817
1819
1818
if (i == ARRAY_SIZE (ropll_tmds_cfg ) &&
1820
- !rk_hdptx_phy_clk_pll_calc (bit_rate , NULL ))
1819
+ !rk_hdptx_phy_clk_pll_calc (rate , NULL ))
1821
1820
return - EINVAL ;
1822
1821
1823
1822
return rate ;
@@ -1828,7 +1827,7 @@ static int rk_hdptx_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate,
1828
1827
{
1829
1828
struct rk_hdptx_phy * hdptx = to_rk_hdptx_phy (hw );
1830
1829
1831
- return rk_hdptx_ropll_tmds_cmn_config (hdptx , rate / 100 );
1830
+ return rk_hdptx_ropll_tmds_cmn_config (hdptx , rate );
1832
1831
}
1833
1832
1834
1833
static const struct clk_ops hdptx_phy_clk_ops = {
0 commit comments