8080# define VC4_HD_M_ENABLE BIT(0)
8181
8282#define CEC_CLOCK_FREQ 40000
83+ #define VC4_HSM_CLOCK 163682864
8384
8485static int vc4_hdmi_debugfs_regs (struct seq_file * m , void * unused )
8586{
@@ -744,8 +745,7 @@ static u32 vc4_hdmi_calc_hsm_clock(struct vc4_hdmi *vc4_hdmi, unsigned long pixe
744745 * needs to be a bit higher than the pixel clock rate
745746 * (generally 148.5Mhz).
746747 */
747-
748- return 163682864 ;
748+ return VC4_HSM_CLOCK ;
749749}
750750
751751static u32 vc5_hdmi_calc_hsm_clock (struct vc4_hdmi * vc4_hdmi , unsigned long pixel_rate )
@@ -1389,6 +1389,7 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi)
13891389 struct cec_connector_info conn_info ;
13901390 struct platform_device * pdev = vc4_hdmi -> pdev ;
13911391 u32 value ;
1392+ u32 clk_cnt ;
13921393 int ret ;
13931394
13941395 if (!vc4_hdmi -> variant -> cec_available )
@@ -1413,8 +1414,9 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi)
14131414 * divider: the hsm_clock rate and this divider setting will
14141415 * give a 40 kHz CEC clock.
14151416 */
1417+ clk_cnt = vc4_hdmi -> variant -> cec_input_clock / CEC_CLOCK_FREQ ;
14161418 value |= VC4_HDMI_CEC_ADDR_MASK |
1417- (4091 << VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT );
1419+ (( clk_cnt - 1 ) << VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT );
14181420 HDMI_WRITE (HDMI_CEC_CNTRL_1 , value );
14191421 ret = devm_request_threaded_irq (& pdev -> dev , platform_get_irq (pdev , 0 ),
14201422 vc4_cec_irq_handler ,
@@ -1758,6 +1760,7 @@ static int vc4_hdmi_dev_remove(struct platform_device *pdev)
17581760
17591761static const struct vc4_hdmi_variant bcm2835_variant = {
17601762 .max_pixel_clock = 162000000 ,
1763+ .cec_input_clock = VC4_HSM_CLOCK ,
17611764 .audio_available = true,
17621765 .cec_available = true,
17631766 .registers = vc4_hdmi_fields ,
@@ -1782,6 +1785,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi0_variant = {
17821785 .id = 0 ,
17831786 .audio_available = true,
17841787 .max_pixel_clock = 297000000 ,
1788+ .cec_input_clock = 27000000 ,
17851789 .registers = vc5_hdmi_hdmi0_fields ,
17861790 .num_registers = ARRAY_SIZE (vc5_hdmi_hdmi0_fields ),
17871791 .phy_lane_mapping = {
@@ -1809,6 +1813,7 @@ static const struct vc4_hdmi_variant bcm2711_hdmi1_variant = {
18091813 .id = 1 ,
18101814 .audio_available = true,
18111815 .max_pixel_clock = 297000000 ,
1816+ .cec_input_clock = 27000000 ,
18121817 .registers = vc5_hdmi_hdmi1_fields ,
18131818 .num_registers = ARRAY_SIZE (vc5_hdmi_hdmi1_fields ),
18141819 .phy_lane_mapping = {
0 commit comments