@@ -968,31 +968,34 @@ static bool rk_hdptx_phy_clk_pll_calc(unsigned long long rate,
968
968
return true;
969
969
}
970
970
971
- static int rk_hdptx_ropll_tmds_cmn_config (struct rk_hdptx_phy * hdptx ,
972
- unsigned long long rate )
971
+ static int rk_hdptx_ropll_tmds_cmn_config (struct rk_hdptx_phy * hdptx )
973
972
{
974
973
const struct ropll_config * cfg = NULL ;
975
974
struct ropll_config rc = {0 };
976
975
int ret , i ;
977
976
977
+ if (!hdptx -> hdmi_cfg .tmds_char_rate )
978
+ return 0 ;
979
+
978
980
for (i = 0 ; i < ARRAY_SIZE (ropll_tmds_cfg ); i ++ )
979
- if (rate == ropll_tmds_cfg [i ].rate ) {
981
+ if (hdptx -> hdmi_cfg . tmds_char_rate == ropll_tmds_cfg [i ].rate ) {
980
982
cfg = & ropll_tmds_cfg [i ];
981
983
break ;
982
984
}
983
985
984
986
if (!cfg ) {
985
- if (rk_hdptx_phy_clk_pll_calc (rate , & rc )) {
986
- cfg = & rc ;
987
- } else {
988
- dev_err (hdptx -> dev , "%s cannot find pll cfg\n" , __func__ );
987
+ if (!rk_hdptx_phy_clk_pll_calc (hdptx -> hdmi_cfg .tmds_char_rate , & rc )) {
988
+ dev_err (hdptx -> dev , "%s cannot find pll cfg for rate=%llu\n" ,
989
+ __func__ , hdptx -> hdmi_cfg .tmds_char_rate );
989
990
return - EINVAL ;
990
991
}
992
+
993
+ cfg = & rc ;
991
994
}
992
995
993
996
dev_dbg (hdptx -> dev , "%s rate=%llu mdiv=%u sdiv=%u sdm_en=%u k_sign=%u k=%u lc=%u\n" ,
994
- __func__ , rate , cfg -> pms_mdiv , cfg -> pms_sdiv + 1 , cfg -> sdm_en ,
995
- cfg -> sdm_num_sign , cfg -> sdm_num , cfg -> sdm_deno );
997
+ __func__ , hdptx -> hdmi_cfg . tmds_char_rate , cfg -> pms_mdiv , cfg -> pms_sdiv + 1 ,
998
+ cfg -> sdm_en , cfg -> sdm_num_sign , cfg -> sdm_num , cfg -> sdm_deno );
996
999
997
1000
rk_hdptx_pre_power_up (hdptx );
998
1001
@@ -1030,19 +1033,18 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx,
1030
1033
1031
1034
ret = rk_hdptx_post_enable_pll (hdptx );
1032
1035
if (!ret )
1033
- hdptx -> hw_rate = rate ;
1036
+ hdptx -> hw_rate = hdptx -> hdmi_cfg . tmds_char_rate ;
1034
1037
1035
1038
return ret ;
1036
1039
}
1037
1040
1038
- static int rk_hdptx_ropll_tmds_mode_config (struct rk_hdptx_phy * hdptx ,
1039
- unsigned long long rate )
1041
+ static int rk_hdptx_ropll_tmds_mode_config (struct rk_hdptx_phy * hdptx )
1040
1042
{
1041
1043
rk_hdptx_multi_reg_write (hdptx , rk_hdtpx_common_sb_init_seq );
1042
1044
1043
1045
regmap_write (hdptx -> regmap , LNTOP_REG (0200 ), 0x06 );
1044
1046
1045
- if (rate > HDMI14_MAX_RATE ) {
1047
+ if (hdptx -> hdmi_cfg . tmds_char_rate > HDMI14_MAX_RATE ) {
1046
1048
/* For 1/40 bitrate clk */
1047
1049
rk_hdptx_multi_reg_write (hdptx , rk_hdtpx_tmds_lntop_highbr_seq );
1048
1050
} else {
@@ -1094,8 +1096,7 @@ static void rk_hdptx_dp_reset(struct rk_hdptx_phy *hdptx)
1094
1096
HDPTX_I_BGR_EN << 16 | FIELD_PREP (HDPTX_I_BGR_EN , 0x0 ));
1095
1097
}
1096
1098
1097
- static int rk_hdptx_phy_consumer_get (struct rk_hdptx_phy * hdptx ,
1098
- unsigned long long rate )
1099
+ static int rk_hdptx_phy_consumer_get (struct rk_hdptx_phy * hdptx )
1099
1100
{
1100
1101
enum phy_mode mode = phy_get_mode (hdptx -> phy );
1101
1102
u32 status ;
@@ -1114,11 +1115,9 @@ static int rk_hdptx_phy_consumer_get(struct rk_hdptx_phy *hdptx,
1114
1115
if (mode == PHY_MODE_DP ) {
1115
1116
rk_hdptx_dp_reset (hdptx );
1116
1117
} else {
1117
- if (rate ) {
1118
- ret = rk_hdptx_ropll_tmds_cmn_config (hdptx , rate );
1119
- if (ret )
1120
- goto dec_usage ;
1121
- }
1118
+ ret = rk_hdptx_ropll_tmds_cmn_config (hdptx );
1119
+ if (ret )
1120
+ goto dec_usage ;
1122
1121
}
1123
1122
1124
1123
return 0 ;
@@ -1431,7 +1430,7 @@ static int rk_hdptx_phy_power_on(struct phy *phy)
1431
1430
dev_dbg (hdptx -> dev , "%s rate=%llu\n" , __func__ , hdptx -> hdmi_cfg .tmds_char_rate );
1432
1431
}
1433
1432
1434
- ret = rk_hdptx_phy_consumer_get (hdptx , hdptx -> hdmi_cfg . tmds_char_rate );
1433
+ ret = rk_hdptx_phy_consumer_get (hdptx );
1435
1434
if (ret )
1436
1435
return ret ;
1437
1436
@@ -1462,7 +1461,7 @@ static int rk_hdptx_phy_power_on(struct phy *phy)
1462
1461
regmap_write (hdptx -> grf , GRF_HDPTX_CON0 ,
1463
1462
HDPTX_MODE_SEL << 16 | FIELD_PREP (HDPTX_MODE_SEL , 0x0 ));
1464
1463
1465
- ret = rk_hdptx_ropll_tmds_mode_config (hdptx , hdptx -> hdmi_cfg . tmds_char_rate );
1464
+ ret = rk_hdptx_ropll_tmds_mode_config (hdptx );
1466
1465
if (ret )
1467
1466
rk_hdptx_phy_consumer_put (hdptx , true);
1468
1467
}
@@ -1830,7 +1829,7 @@ static int rk_hdptx_phy_clk_prepare(struct clk_hw *hw)
1830
1829
{
1831
1830
struct rk_hdptx_phy * hdptx = to_rk_hdptx_phy (hw );
1832
1831
1833
- return rk_hdptx_phy_consumer_get (hdptx , hdptx -> hw_rate );
1832
+ return rk_hdptx_phy_consumer_get (hdptx );
1834
1833
}
1835
1834
1836
1835
static void rk_hdptx_phy_clk_unprepare (struct clk_hw * hw )
@@ -1897,7 +1896,7 @@ static int rk_hdptx_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate,
1897
1896
* while the latter being executed only once, i.e. when clock remains
1898
1897
* in the prepared state during rate changes.
1899
1898
*/
1900
- return rk_hdptx_ropll_tmds_cmn_config (hdptx , rate );
1899
+ return rk_hdptx_ropll_tmds_cmn_config (hdptx );
1901
1900
}
1902
1901
1903
1902
static const struct clk_ops hdptx_phy_clk_ops = {
0 commit comments