Lines Matching refs:vc4_hdmi

114 static bool vc4_hdmi_supports_scrambling(struct vc4_hdmi *vc4_hdmi)  in vc4_hdmi_supports_scrambling()  argument
116 struct drm_display_info *display = &vc4_hdmi->connector.display_info; in vc4_hdmi_supports_scrambling()
118 lockdep_assert_held(&vc4_hdmi->mutex); in vc4_hdmi_supports_scrambling()
142 struct vc4_hdmi *vc4_hdmi = entry->file.data; in vc4_hdmi_debugfs_regs() local
143 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_debugfs_regs()
150 drm_print_regset32(&p, &vc4_hdmi->hdmi_regset); in vc4_hdmi_debugfs_regs()
151 drm_print_regset32(&p, &vc4_hdmi->hd_regset); in vc4_hdmi_debugfs_regs()
152 drm_print_regset32(&p, &vc4_hdmi->cec_regset); in vc4_hdmi_debugfs_regs()
153 drm_print_regset32(&p, &vc4_hdmi->csc_regset); in vc4_hdmi_debugfs_regs()
154 drm_print_regset32(&p, &vc4_hdmi->dvp_regset); in vc4_hdmi_debugfs_regs()
155 drm_print_regset32(&p, &vc4_hdmi->phy_regset); in vc4_hdmi_debugfs_regs()
156 drm_print_regset32(&p, &vc4_hdmi->ram_regset); in vc4_hdmi_debugfs_regs()
157 drm_print_regset32(&p, &vc4_hdmi->rm_regset); in vc4_hdmi_debugfs_regs()
164 static void vc4_hdmi_reset(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_reset() argument
166 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_reset()
177 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_reset()
191 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_reset()
197 static void vc5_hdmi_reset(struct vc4_hdmi *vc4_hdmi) in vc5_hdmi_reset() argument
199 struct drm_device *drm = vc4_hdmi->connector.dev; in vc5_hdmi_reset()
210 reset_control_reset(vc4_hdmi->reset); in vc5_hdmi_reset()
212 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_reset()
219 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_reset()
226 static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_cec_update_clk_div() argument
228 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_cec_update_clk_div()
244 cec_rate = clk_get_rate(vc4_hdmi->cec_clock); in vc4_hdmi_cec_update_clk_div()
246 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_update_clk_div()
259 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_update_clk_div()
265 static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) {} in vc4_hdmi_cec_update_clk_div() argument
300 struct vc4_hdmi *vc4_hdmi; in vc4_hdmi_reset_link() local
329 vc4_hdmi = connector_to_vc4_hdmi(connector); in vc4_hdmi_reset_link()
330 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_reset_link()
332 if (!vc4_hdmi_supports_scrambling(vc4_hdmi)) { in vc4_hdmi_reset_link()
333 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_reset_link()
337 scrambling_needed = vc4_hdmi_mode_needs_scrambling(&vc4_hdmi->saved_adjusted_mode, in vc4_hdmi_reset_link()
338 vc4_hdmi->output_bpc, in vc4_hdmi_reset_link()
339 vc4_hdmi->output_format); in vc4_hdmi_reset_link()
341 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_reset_link()
347 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_reset_link()
354 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_reset_link()
359 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_reset_link()
363 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_reset_link()
377 static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, in vc4_hdmi_handle_hotplug() argument
381 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_handle_hotplug()
400 cec_phys_addr_invalidate(vc4_hdmi->cec_adap); in vc4_hdmi_handle_hotplug()
404 drm_edid = drm_edid_read_ddc(connector, vc4_hdmi->ddc); in vc4_hdmi_handle_hotplug()
407 cec_s_phys_addr(vc4_hdmi->cec_adap, in vc4_hdmi_handle_hotplug()
430 struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); in vc4_hdmi_connector_detect_ctx() local
445 ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); in vc4_hdmi_connector_detect_ctx()
452 if (vc4_hdmi->hpd_gpio) { in vc4_hdmi_connector_detect_ctx()
453 if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) in vc4_hdmi_connector_detect_ctx()
456 if (vc4_hdmi->variant->hp_detect && in vc4_hdmi_connector_detect_ctx()
457 vc4_hdmi->variant->hp_detect(vc4_hdmi)) in vc4_hdmi_connector_detect_ctx()
461 vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); in vc4_hdmi_connector_detect_ctx()
462 pm_runtime_put(&vc4_hdmi->pdev->dev); in vc4_hdmi_connector_detect_ctx()
469 struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); in vc4_hdmi_connector_get_modes() local
485 drm_edid = drm_edid_read_ddc(connector, vc4_hdmi->ddc); in vc4_hdmi_connector_get_modes()
487 cec_s_phys_addr(vc4_hdmi->cec_adap, in vc4_hdmi_connector_get_modes()
584 struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_connector_init() argument
586 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_connector_init()
587 struct drm_encoder *encoder = &vc4_hdmi->encoder.base; in vc4_hdmi_connector_init()
591 if (vc4_hdmi->variant->supports_hdr) in vc4_hdmi_connector_init()
599 vc4_hdmi->ddc, in vc4_hdmi_connector_init()
644 static int vc4_hdmi_stop_packet(struct vc4_hdmi *vc4_hdmi, in vc4_hdmi_stop_packet() argument
648 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_stop_packet()
657 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_stop_packet()
660 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_stop_packet()
675 struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); in vc4_hdmi_write_infoframe() local
679 &vc4_hdmi->variant->registers[HDMI_RAM_PACKET_START]; in vc4_hdmi_write_infoframe()
683 void __iomem *base = __vc4_hdmi_get_field_base(vc4_hdmi, in vc4_hdmi_write_infoframe()
705 ret = vc4_hdmi_stop_packet(vc4_hdmi, type, true); in vc4_hdmi_write_infoframe()
711 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_write_infoframe()
738 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_write_infoframe()
754 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_enable_scrambling() local
755 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_enable_scrambling()
757 const struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode; in vc4_hdmi_enable_scrambling()
761 lockdep_assert_held(&vc4_hdmi->mutex); in vc4_hdmi_enable_scrambling()
763 if (!vc4_hdmi_supports_scrambling(vc4_hdmi)) in vc4_hdmi_enable_scrambling()
767 vc4_hdmi->output_bpc, in vc4_hdmi_enable_scrambling()
768 vc4_hdmi->output_format)) in vc4_hdmi_enable_scrambling()
777 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_enable_scrambling()
780 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_enable_scrambling()
784 vc4_hdmi->scdc_enabled = true; in vc4_hdmi_enable_scrambling()
786 queue_delayed_work(system_wq, &vc4_hdmi->scrambling_work, in vc4_hdmi_enable_scrambling()
792 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_disable_scrambling() local
793 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_disable_scrambling()
798 lockdep_assert_held(&vc4_hdmi->mutex); in vc4_hdmi_disable_scrambling()
800 if (!vc4_hdmi->scdc_enabled) in vc4_hdmi_disable_scrambling()
803 vc4_hdmi->scdc_enabled = false; in vc4_hdmi_disable_scrambling()
805 if (delayed_work_pending(&vc4_hdmi->scrambling_work)) in vc4_hdmi_disable_scrambling()
806 cancel_delayed_work_sync(&vc4_hdmi->scrambling_work); in vc4_hdmi_disable_scrambling()
811 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_disable_scrambling()
814 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_disable_scrambling()
824 struct vc4_hdmi *vc4_hdmi = container_of(to_delayed_work(work), in vc4_hdmi_scrambling_wq() local
825 struct vc4_hdmi, in vc4_hdmi_scrambling_wq()
827 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_scrambling_wq()
835 queue_delayed_work(system_wq, &vc4_hdmi->scrambling_work, in vc4_hdmi_scrambling_wq()
842 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_post_crtc_disable() local
843 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_encoder_post_crtc_disable()
847 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_post_crtc_disable()
849 vc4_hdmi->packet_ram_enabled = false; in vc4_hdmi_encoder_post_crtc_disable()
854 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_disable()
860 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_disable()
864 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_disable()
867 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_disable()
874 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_post_crtc_disable()
880 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_post_crtc_powerdown() local
881 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_encoder_post_crtc_powerdown()
886 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_post_crtc_powerdown()
891 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_powerdown()
894 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_powerdown()
896 if (vc4_hdmi->variant->phy_disable) in vc4_hdmi_encoder_post_crtc_powerdown()
897 vc4_hdmi->variant->phy_disable(vc4_hdmi); in vc4_hdmi_encoder_post_crtc_powerdown()
899 clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); in vc4_hdmi_encoder_post_crtc_powerdown()
900 clk_disable_unprepare(vc4_hdmi->pixel_clock); in vc4_hdmi_encoder_post_crtc_powerdown()
902 ret = pm_runtime_put(&vc4_hdmi->pdev->dev); in vc4_hdmi_encoder_post_crtc_powerdown()
909 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_post_crtc_powerdown()
912 static void vc4_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, in vc4_hdmi_csc_setup() argument
916 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_csc_setup()
924 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_csc_setup()
956 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_csc_setup()
1092 static void vc5_hdmi_set_csc_coeffs(struct vc4_hdmi *vc4_hdmi, in vc5_hdmi_set_csc_coeffs() argument
1095 lockdep_assert_held(&vc4_hdmi->hw_lock); in vc5_hdmi_set_csc_coeffs()
1105 static void vc5_hdmi_set_csc_coeffs_swap(struct vc4_hdmi *vc4_hdmi, in vc5_hdmi_set_csc_coeffs_swap() argument
1108 lockdep_assert_held(&vc4_hdmi->hw_lock); in vc5_hdmi_set_csc_coeffs_swap()
1120 (*vc5_hdmi_find_yuv_csc_coeffs(struct vc4_hdmi *vc4_hdmi, u32 colorspace, bool limited))[4] in vc5_hdmi_find_yuv_csc_coeffs() argument
1147 static void vc5_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi, in vc5_hdmi_csc_setup() argument
1151 struct drm_device *drm = vc4_hdmi->connector.dev; in vc5_hdmi_csc_setup()
1165 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_csc_setup()
1169 csc = vc5_hdmi_find_yuv_csc_coeffs(vc4_hdmi, state->colorspace, !!lim_range); in vc5_hdmi_csc_setup()
1171 vc5_hdmi_set_csc_coeffs_swap(vc4_hdmi, csc); in vc5_hdmi_csc_setup()
1175 csc = vc5_hdmi_find_yuv_csc_coeffs(vc4_hdmi, state->colorspace, !!lim_range); in vc5_hdmi_csc_setup()
1188 vc5_hdmi_set_csc_coeffs(vc4_hdmi, csc); in vc5_hdmi_csc_setup()
1194 vc5_hdmi_set_csc_coeffs(vc4_hdmi, vc5_hdmi_csc_full_rgb_to_rgb[lim_range]); in vc5_hdmi_csc_setup()
1206 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_csc_setup()
1211 static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, in vc4_hdmi_set_timings() argument
1215 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_set_timings()
1240 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_set_timings()
1270 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_set_timings()
1275 static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_hdmi, in vc5_hdmi_set_timings() argument
1279 struct drm_device *drm = vc4_hdmi->connector.dev; in vc5_hdmi_set_timings()
1306 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_set_timings()
1377 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_set_timings()
1382 static void vc4_hdmi_recenter_fifo(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_recenter_fifo() argument
1384 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_recenter_fifo()
1393 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_recenter_fifo()
1403 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_recenter_fifo()
1407 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_recenter_fifo()
1414 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_recenter_fifo()
1427 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_pre_crtc_configure() local
1428 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_encoder_pre_crtc_configure()
1429 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_encoder_pre_crtc_configure()
1432 const struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode; in vc4_hdmi_encoder_pre_crtc_configure()
1439 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_pre_crtc_configure()
1444 ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); in vc4_hdmi_encoder_pre_crtc_configure()
1469 ret = clk_set_min_rate(vc4_hdmi->hsm_clock, hsm_rate); in vc4_hdmi_encoder_pre_crtc_configure()
1475 ret = clk_set_rate(vc4_hdmi->pixel_clock, tmds_char_rate); in vc4_hdmi_encoder_pre_crtc_configure()
1481 ret = clk_prepare_enable(vc4_hdmi->pixel_clock); in vc4_hdmi_encoder_pre_crtc_configure()
1488 vc4_hdmi_cec_update_clk_div(vc4_hdmi); in vc4_hdmi_encoder_pre_crtc_configure()
1497 ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate); in vc4_hdmi_encoder_pre_crtc_configure()
1503 ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); in vc4_hdmi_encoder_pre_crtc_configure()
1509 if (vc4_hdmi->variant->phy_init) in vc4_hdmi_encoder_pre_crtc_configure()
1510 vc4_hdmi->variant->phy_init(vc4_hdmi, conn_state); in vc4_hdmi_encoder_pre_crtc_configure()
1512 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_pre_crtc_configure()
1519 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_pre_crtc_configure()
1521 if (vc4_hdmi->variant->set_timings) in vc4_hdmi_encoder_pre_crtc_configure()
1522 vc4_hdmi->variant->set_timings(vc4_hdmi, conn_state, mode); in vc4_hdmi_encoder_pre_crtc_configure()
1526 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_pre_crtc_configure()
1531 clk_disable_unprepare(vc4_hdmi->pixel_clock); in vc4_hdmi_encoder_pre_crtc_configure()
1533 pm_runtime_put(&vc4_hdmi->pdev->dev); in vc4_hdmi_encoder_pre_crtc_configure()
1537 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_pre_crtc_configure()
1544 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_pre_crtc_enable() local
1545 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_encoder_pre_crtc_enable()
1546 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_encoder_pre_crtc_enable()
1547 const struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode; in vc4_hdmi_encoder_pre_crtc_enable()
1553 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_pre_crtc_enable()
1558 if (vc4_hdmi->variant->csc_setup) in vc4_hdmi_encoder_pre_crtc_enable()
1559 vc4_hdmi->variant->csc_setup(vc4_hdmi, conn_state, mode); in vc4_hdmi_encoder_pre_crtc_enable()
1561 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_pre_crtc_enable()
1563 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_pre_crtc_enable()
1568 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_pre_crtc_enable()
1574 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_post_crtc_enable() local
1575 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_encoder_post_crtc_enable()
1577 const struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode; in vc4_hdmi_encoder_post_crtc_enable()
1578 struct drm_display_info *display = &vc4_hdmi->connector.display_info; in vc4_hdmi_encoder_post_crtc_enable()
1585 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_post_crtc_enable()
1590 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_enable()
1608 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_enable()
1622 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_enable()
1631 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_enable()
1639 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_encoder_post_crtc_enable()
1640 vc4_hdmi->packet_ram_enabled = true; in vc4_hdmi_encoder_post_crtc_enable()
1645 vc4_hdmi_recenter_fifo(vc4_hdmi); in vc4_hdmi_encoder_post_crtc_enable()
1651 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_post_crtc_enable()
1658 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_atomic_mode_set() local
1660 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_atomic_mode_set()
1661 drm_mode_copy(&vc4_hdmi->saved_adjusted_mode, in vc4_hdmi_encoder_atomic_mode_set()
1663 vc4_hdmi->output_bpc = conn_state->hdmi.output_bpc; in vc4_hdmi_encoder_atomic_mode_set()
1664 vc4_hdmi->output_format = conn_state->hdmi.output_format; in vc4_hdmi_encoder_atomic_mode_set()
1665 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_encoder_atomic_mode_set()
1673 const struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); in vc4_hdmi_connector_clock_valid() local
1676 if (clock > vc4_hdmi->variant->max_pixel_clock) in vc4_hdmi_connector_clock_valid()
1703 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_atomic_check() local
1708 if (vc4_hdmi->variant->unsupported_odd_h_timings) { in vc4_hdmi_encoder_atomic_check()
1735 if (vc4_hdmi->disable_wifi_frequencies && in vc4_hdmi_encoder_atomic_check()
1749 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_encoder_mode_valid() local
1752 if (vc4_hdmi->variant->unsupported_odd_h_timings && in vc4_hdmi_encoder_mode_valid()
1759 return vc4_hdmi_connector_clock_valid(&vc4_hdmi->connector, mode, rate); in vc4_hdmi_encoder_mode_valid()
1771 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); in vc4_hdmi_late_register() local
1772 const struct vc4_hdmi_variant *variant = vc4_hdmi->variant; in vc4_hdmi_late_register()
1775 vc4_hdmi_debugfs_regs, vc4_hdmi); in vc4_hdmi_late_register()
1784 static u32 vc4_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask) in vc4_hdmi_channel_map() argument
1796 static u32 vc5_hdmi_channel_map(struct vc4_hdmi *vc4_hdmi, u32 channel_mask) in vc5_hdmi_channel_map() argument
1808 static bool vc5_hdmi_hp_detect(struct vc4_hdmi *vc4_hdmi) in vc5_hdmi_hp_detect() argument
1810 struct drm_device *drm = vc4_hdmi->connector.dev; in vc5_hdmi_hp_detect()
1818 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_hp_detect()
1820 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc5_hdmi_hp_detect()
1828 static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi, in vc4_hdmi_audio_set_mai_clock() argument
1831 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_audio_set_mai_clock()
1840 hsm_clock = clk_get_rate(vc4_hdmi->audio_clock); in vc4_hdmi_audio_set_mai_clock()
1848 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_set_mai_clock()
1852 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_set_mai_clock()
1857 static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate) in vc4_hdmi_set_n_cts() argument
1859 const struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode; in vc4_hdmi_set_n_cts()
1863 lockdep_assert_held(&vc4_hdmi->mutex); in vc4_hdmi_set_n_cts()
1864 lockdep_assert_held(&vc4_hdmi->hw_lock); in vc4_hdmi_set_n_cts()
1884 static inline struct vc4_hdmi *dai_to_hdmi(struct snd_soc_dai *dai) in dai_to_hdmi()
1891 static bool vc4_hdmi_audio_can_stream(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_audio_can_stream() argument
1893 struct drm_display_info *display = &vc4_hdmi->connector.display_info; in vc4_hdmi_audio_can_stream()
1895 lockdep_assert_held(&vc4_hdmi->mutex); in vc4_hdmi_audio_can_stream()
1909 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); in vc4_hdmi_audio_startup() local
1910 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_audio_startup()
1915 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_audio_startup()
1922 if (!vc4_hdmi_audio_can_stream(vc4_hdmi)) { in vc4_hdmi_audio_startup()
1927 vc4_hdmi->audio.streaming = true; in vc4_hdmi_audio_startup()
1929 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_startup()
1936 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_startup()
1938 if (vc4_hdmi->variant->phy_rng_enable) in vc4_hdmi_audio_startup()
1939 vc4_hdmi->variant->phy_rng_enable(vc4_hdmi); in vc4_hdmi_audio_startup()
1944 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_audio_startup()
1949 static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_audio_reset() argument
1951 struct device *dev = &vc4_hdmi->pdev->dev; in vc4_hdmi_audio_reset()
1955 lockdep_assert_held(&vc4_hdmi->mutex); in vc4_hdmi_audio_reset()
1957 vc4_hdmi->audio.streaming = false; in vc4_hdmi_audio_reset()
1958 ret = vc4_hdmi_stop_packet(vc4_hdmi, HDMI_INFOFRAME_TYPE_AUDIO, false); in vc4_hdmi_audio_reset()
1962 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_reset()
1968 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_reset()
1973 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); in vc4_hdmi_audio_shutdown() local
1974 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_audio_shutdown()
1978 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_audio_shutdown()
1983 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_shutdown()
1990 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_shutdown()
1992 if (vc4_hdmi->variant->phy_rng_disable) in vc4_hdmi_audio_shutdown()
1993 vc4_hdmi->variant->phy_rng_disable(vc4_hdmi); in vc4_hdmi_audio_shutdown()
1995 vc4_hdmi->audio.streaming = false; in vc4_hdmi_audio_shutdown()
1996 vc4_hdmi_audio_reset(vc4_hdmi); in vc4_hdmi_audio_shutdown()
2001 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_audio_shutdown()
2047 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); in vc4_hdmi_audio_prepare() local
2048 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_audio_prepare()
2049 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_audio_prepare()
2063 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_audio_prepare()
2070 if (!vc4_hdmi_audio_can_stream(vc4_hdmi)) { in vc4_hdmi_audio_prepare()
2075 vc4_hdmi_audio_set_mai_clock(vc4_hdmi, sample_rate); in vc4_hdmi_audio_prepare()
2077 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_prepare()
2118 channel_map = vc4_hdmi->variant->channel_map(vc4_hdmi, channel_mask); in vc4_hdmi_audio_prepare()
2122 vc4_hdmi_set_n_cts(vc4_hdmi, sample_rate); in vc4_hdmi_audio_prepare()
2124 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_audio_prepare()
2134 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_audio_prepare()
2146 struct vc4_hdmi *vc4_hdmi = dai_to_hdmi(dai); in vc4_hdmi_audio_cpu_dai_probe() local
2148 snd_soc_dai_init_dma_data(dai, &vc4_hdmi->audio.dma_data, NULL); in vc4_hdmi_audio_cpu_dai_probe()
2180 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); in vc4_hdmi_audio_get_eld() local
2181 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_audio_get_eld()
2183 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_audio_get_eld()
2185 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_audio_get_eld()
2205 struct vc4_hdmi *vc4_hdmi = ptr; in vc4_hdmi_audio_codec_release() local
2207 platform_device_unregister(vc4_hdmi->audio.codec_pdev); in vc4_hdmi_audio_codec_release()
2208 vc4_hdmi->audio.codec_pdev = NULL; in vc4_hdmi_audio_codec_release()
2211 static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_audio_init() argument
2214 &vc4_hdmi->variant->registers[HDMI_MAI_DATA]; in vc4_hdmi_audio_init()
2215 struct snd_soc_dai_link *dai_link = &vc4_hdmi->audio.link; in vc4_hdmi_audio_init()
2216 struct snd_soc_card *card = &vc4_hdmi->audio.card; in vc4_hdmi_audio_init()
2217 struct device *dev = &vc4_hdmi->pdev->dev; in vc4_hdmi_audio_init()
2241 BUILD_BUG_ON(offsetof(struct vc4_hdmi, audio) != 0); in vc4_hdmi_audio_init()
2270 vc4_hdmi->audio.dma_data.addr = be32_to_cpup(addr) + mai_data->offset; in vc4_hdmi_audio_init()
2271 vc4_hdmi->audio.dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; in vc4_hdmi_audio_init()
2272 vc4_hdmi->audio.dma_data.maxburst = 2; in vc4_hdmi_audio_init()
2319 vc4_hdmi->audio.codec_pdev = codec_pdev; in vc4_hdmi_audio_init()
2321 ret = devm_add_action_or_reset(dev, vc4_hdmi_audio_codec_release, vc4_hdmi); in vc4_hdmi_audio_init()
2325 dai_link->cpus = &vc4_hdmi->audio.cpu; in vc4_hdmi_audio_init()
2326 dai_link->codecs = &vc4_hdmi->audio.codec; in vc4_hdmi_audio_init()
2327 dai_link->platforms = &vc4_hdmi->audio.platform; in vc4_hdmi_audio_init()
2342 card->name = vc4_hdmi->variant->card_name; in vc4_hdmi_audio_init()
2354 snd_soc_card_set_drvdata(card, vc4_hdmi); in vc4_hdmi_audio_init()
2365 struct vc4_hdmi *vc4_hdmi = priv; in vc4_hdmi_hpd_irq_thread() local
2366 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_hpd_irq_thread()
2375 static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_hotplug_init() argument
2377 struct drm_connector *connector = &vc4_hdmi->connector; in vc4_hdmi_hotplug_init()
2378 struct platform_device *pdev = vc4_hdmi->pdev; in vc4_hdmi_hotplug_init()
2381 if (vc4_hdmi->variant->external_irq_controller) { in vc4_hdmi_hotplug_init()
2388 "vc4 hdmi hpd connected", vc4_hdmi); in vc4_hdmi_hotplug_init()
2395 "vc4 hdmi hpd disconnected", vc4_hdmi); in vc4_hdmi_hotplug_init()
2408 struct vc4_hdmi *vc4_hdmi = priv; in vc4_cec_irq_handler_rx_thread() local
2410 if (vc4_hdmi->cec_rx_msg.len) in vc4_cec_irq_handler_rx_thread()
2411 cec_received_msg(vc4_hdmi->cec_adap, in vc4_cec_irq_handler_rx_thread()
2412 &vc4_hdmi->cec_rx_msg); in vc4_cec_irq_handler_rx_thread()
2419 struct vc4_hdmi *vc4_hdmi = priv; in vc4_cec_irq_handler_tx_thread() local
2421 if (vc4_hdmi->cec_tx_ok) { in vc4_cec_irq_handler_tx_thread()
2422 cec_transmit_done(vc4_hdmi->cec_adap, CEC_TX_STATUS_OK, in vc4_cec_irq_handler_tx_thread()
2429 cec_transmit_done(vc4_hdmi->cec_adap, CEC_TX_STATUS_NACK, in vc4_cec_irq_handler_tx_thread()
2437 struct vc4_hdmi *vc4_hdmi = priv; in vc4_cec_irq_handler_thread() local
2440 if (vc4_hdmi->cec_irq_was_rx) in vc4_cec_irq_handler_thread()
2448 static void vc4_cec_read_msg(struct vc4_hdmi *vc4_hdmi, u32 cntrl1) in vc4_cec_read_msg() argument
2450 struct drm_device *dev = vc4_hdmi->connector.dev; in vc4_cec_read_msg()
2451 struct cec_msg *msg = &vc4_hdmi->cec_rx_msg; in vc4_cec_read_msg()
2454 lockdep_assert_held(&vc4_hdmi->hw_lock); in vc4_cec_read_msg()
2474 static irqreturn_t vc4_cec_irq_handler_tx_bare_locked(struct vc4_hdmi *vc4_hdmi) in vc4_cec_irq_handler_tx_bare_locked() argument
2489 lockdep_assert_held(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler_tx_bare_locked()
2492 vc4_hdmi->cec_tx_ok = cntrl1 & VC4_HDMI_CEC_TX_STATUS_GOOD; in vc4_cec_irq_handler_tx_bare_locked()
2501 struct vc4_hdmi *vc4_hdmi = priv; in vc4_cec_irq_handler_tx_bare() local
2504 spin_lock(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler_tx_bare()
2505 ret = vc4_cec_irq_handler_tx_bare_locked(vc4_hdmi); in vc4_cec_irq_handler_tx_bare()
2506 spin_unlock(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler_tx_bare()
2511 static irqreturn_t vc4_cec_irq_handler_rx_bare_locked(struct vc4_hdmi *vc4_hdmi) in vc4_cec_irq_handler_rx_bare_locked() argument
2515 lockdep_assert_held(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler_rx_bare_locked()
2528 vc4_hdmi->cec_rx_msg.len = 0; in vc4_cec_irq_handler_rx_bare_locked()
2530 vc4_cec_read_msg(vc4_hdmi, cntrl1); in vc4_cec_irq_handler_rx_bare_locked()
2542 struct vc4_hdmi *vc4_hdmi = priv; in vc4_cec_irq_handler_rx_bare() local
2545 spin_lock(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler_rx_bare()
2546 ret = vc4_cec_irq_handler_rx_bare_locked(vc4_hdmi); in vc4_cec_irq_handler_rx_bare()
2547 spin_unlock(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler_rx_bare()
2554 struct vc4_hdmi *vc4_hdmi = priv; in vc4_cec_irq_handler() local
2573 spin_lock(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler()
2575 vc4_hdmi->cec_irq_was_rx = cntrl5 & VC4_HDMI_CEC_RX_CEC_INT; in vc4_cec_irq_handler()
2576 if (vc4_hdmi->cec_irq_was_rx) in vc4_cec_irq_handler()
2577 ret = vc4_cec_irq_handler_rx_bare_locked(vc4_hdmi); in vc4_cec_irq_handler()
2579 ret = vc4_cec_irq_handler_tx_bare_locked(vc4_hdmi); in vc4_cec_irq_handler()
2582 spin_unlock(&vc4_hdmi->hw_lock); in vc4_cec_irq_handler()
2589 struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap); in vc4_hdmi_cec_enable() local
2590 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_cec_enable()
2606 ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); in vc4_hdmi_cec_enable()
2612 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_cec_enable()
2614 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_enable()
2643 if (!vc4_hdmi->variant->external_irq_controller) in vc4_hdmi_cec_enable()
2646 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_enable()
2648 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_cec_enable()
2656 struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap); in vc4_hdmi_cec_disable() local
2657 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_cec_disable()
2669 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_cec_disable()
2671 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_disable()
2673 if (!vc4_hdmi->variant->external_irq_controller) in vc4_hdmi_cec_disable()
2679 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_disable()
2681 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_cec_disable()
2683 pm_runtime_put(&vc4_hdmi->pdev->dev); in vc4_hdmi_cec_disable()
2700 struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap); in vc4_hdmi_cec_adap_log_addr() local
2701 struct drm_device *drm = vc4_hdmi->connector.dev; in vc4_hdmi_cec_adap_log_addr()
2713 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_cec_adap_log_addr()
2714 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_adap_log_addr()
2718 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_adap_log_addr()
2719 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_cec_adap_log_addr()
2729 struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap); in vc4_hdmi_cec_adap_transmit() local
2730 struct drm_device *dev = vc4_hdmi->connector.dev; in vc4_hdmi_cec_adap_transmit()
2745 mutex_lock(&vc4_hdmi->mutex); in vc4_hdmi_cec_adap_transmit()
2747 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_adap_transmit()
2765 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_cec_adap_transmit()
2766 mutex_unlock(&vc4_hdmi->mutex); in vc4_hdmi_cec_adap_transmit()
2780 struct vc4_hdmi *vc4_hdmi = ptr; in vc4_hdmi_cec_release() local
2782 cec_unregister_adapter(vc4_hdmi->cec_adap); in vc4_hdmi_cec_release()
2783 vc4_hdmi->cec_adap = NULL; in vc4_hdmi_cec_release()
2786 static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_cec_init() argument
2789 struct platform_device *pdev = vc4_hdmi->pdev; in vc4_hdmi_cec_init()
2798 vc4_hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops, in vc4_hdmi_cec_init()
2799 vc4_hdmi, in vc4_hdmi_cec_init()
2800 vc4_hdmi->variant->card_name, in vc4_hdmi_cec_init()
2803 ret = PTR_ERR_OR_ZERO(vc4_hdmi->cec_adap); in vc4_hdmi_cec_init()
2807 cec_fill_conn_info_from_drm(&conn_info, &vc4_hdmi->connector); in vc4_hdmi_cec_init()
2808 cec_s_conn_info(vc4_hdmi->cec_adap, &conn_info); in vc4_hdmi_cec_init()
2810 if (vc4_hdmi->variant->external_irq_controller) { in vc4_hdmi_cec_init()
2814 "vc4 hdmi cec rx", vc4_hdmi); in vc4_hdmi_cec_init()
2821 "vc4 hdmi cec tx", vc4_hdmi); in vc4_hdmi_cec_init()
2828 "vc4 hdmi cec", vc4_hdmi); in vc4_hdmi_cec_init()
2833 ret = cec_register_adapter(vc4_hdmi->cec_adap, &pdev->dev); in vc4_hdmi_cec_init()
2860 ret = devm_add_action_or_reset(dev, vc4_hdmi_cec_release, vc4_hdmi); in vc4_hdmi_cec_init()
2867 cec_delete_adapter(vc4_hdmi->cec_adap); in vc4_hdmi_cec_init()
2872 static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_cec_init() argument
2886 struct vc4_hdmi *vc4_hdmi, in vc4_hdmi_build_regset() argument
2890 const struct vc4_hdmi_variant *variant = vc4_hdmi->variant; in vc4_hdmi_build_regset()
2916 regset->base = __vc4_hdmi_get_field_base(vc4_hdmi, reg); in vc4_hdmi_build_regset()
2928 struct vc4_hdmi *vc4_hdmi) in vc4_hdmi_init_resources() argument
2930 struct platform_device *pdev = vc4_hdmi->pdev; in vc4_hdmi_init_resources()
2934 vc4_hdmi->hdmicore_regs = vc4_ioremap_regs(pdev, 0); in vc4_hdmi_init_resources()
2935 if (IS_ERR(vc4_hdmi->hdmicore_regs)) in vc4_hdmi_init_resources()
2936 return PTR_ERR(vc4_hdmi->hdmicore_regs); in vc4_hdmi_init_resources()
2938 vc4_hdmi->hd_regs = vc4_ioremap_regs(pdev, 1); in vc4_hdmi_init_resources()
2939 if (IS_ERR(vc4_hdmi->hd_regs)) in vc4_hdmi_init_resources()
2940 return PTR_ERR(vc4_hdmi->hd_regs); in vc4_hdmi_init_resources()
2942 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->hd_regset, VC4_HD); in vc4_hdmi_init_resources()
2946 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->hdmi_regset, VC4_HDMI); in vc4_hdmi_init_resources()
2950 vc4_hdmi->pixel_clock = devm_clk_get(dev, "pixel"); in vc4_hdmi_init_resources()
2951 if (IS_ERR(vc4_hdmi->pixel_clock)) { in vc4_hdmi_init_resources()
2952 ret = PTR_ERR(vc4_hdmi->pixel_clock); in vc4_hdmi_init_resources()
2958 vc4_hdmi->hsm_clock = devm_clk_get(dev, "hdmi"); in vc4_hdmi_init_resources()
2959 if (IS_ERR(vc4_hdmi->hsm_clock)) { in vc4_hdmi_init_resources()
2961 return PTR_ERR(vc4_hdmi->hsm_clock); in vc4_hdmi_init_resources()
2963 vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock; in vc4_hdmi_init_resources()
2964 vc4_hdmi->cec_clock = vc4_hdmi->hsm_clock; in vc4_hdmi_init_resources()
2970 struct vc4_hdmi *vc4_hdmi) in vc5_hdmi_init_resources() argument
2972 struct platform_device *pdev = vc4_hdmi->pdev; in vc5_hdmi_init_resources()
2981 vc4_hdmi->hdmicore_regs = devm_ioremap(dev, res->start, in vc5_hdmi_init_resources()
2983 if (!vc4_hdmi->hdmicore_regs) in vc5_hdmi_init_resources()
2990 vc4_hdmi->hd_regs = devm_ioremap(dev, res->start, resource_size(res)); in vc5_hdmi_init_resources()
2991 if (!vc4_hdmi->hd_regs) in vc5_hdmi_init_resources()
2998 vc4_hdmi->cec_regs = devm_ioremap(dev, res->start, resource_size(res)); in vc5_hdmi_init_resources()
2999 if (!vc4_hdmi->cec_regs) in vc5_hdmi_init_resources()
3006 vc4_hdmi->csc_regs = devm_ioremap(dev, res->start, resource_size(res)); in vc5_hdmi_init_resources()
3007 if (!vc4_hdmi->csc_regs) in vc5_hdmi_init_resources()
3014 vc4_hdmi->dvp_regs = devm_ioremap(dev, res->start, resource_size(res)); in vc5_hdmi_init_resources()
3015 if (!vc4_hdmi->dvp_regs) in vc5_hdmi_init_resources()
3022 vc4_hdmi->phy_regs = devm_ioremap(dev, res->start, resource_size(res)); in vc5_hdmi_init_resources()
3023 if (!vc4_hdmi->phy_regs) in vc5_hdmi_init_resources()
3030 vc4_hdmi->ram_regs = devm_ioremap(dev, res->start, resource_size(res)); in vc5_hdmi_init_resources()
3031 if (!vc4_hdmi->ram_regs) in vc5_hdmi_init_resources()
3038 vc4_hdmi->rm_regs = devm_ioremap(dev, res->start, resource_size(res)); in vc5_hdmi_init_resources()
3039 if (!vc4_hdmi->rm_regs) in vc5_hdmi_init_resources()
3042 vc4_hdmi->hsm_clock = devm_clk_get(dev, "hdmi"); in vc5_hdmi_init_resources()
3043 if (IS_ERR(vc4_hdmi->hsm_clock)) { in vc5_hdmi_init_resources()
3045 return PTR_ERR(vc4_hdmi->hsm_clock); in vc5_hdmi_init_resources()
3048 vc4_hdmi->pixel_bvb_clock = devm_clk_get(dev, "bvb"); in vc5_hdmi_init_resources()
3049 if (IS_ERR(vc4_hdmi->pixel_bvb_clock)) { in vc5_hdmi_init_resources()
3051 return PTR_ERR(vc4_hdmi->pixel_bvb_clock); in vc5_hdmi_init_resources()
3054 vc4_hdmi->audio_clock = devm_clk_get(dev, "audio"); in vc5_hdmi_init_resources()
3055 if (IS_ERR(vc4_hdmi->audio_clock)) { in vc5_hdmi_init_resources()
3057 return PTR_ERR(vc4_hdmi->audio_clock); in vc5_hdmi_init_resources()
3060 vc4_hdmi->cec_clock = devm_clk_get(dev, "cec"); in vc5_hdmi_init_resources()
3061 if (IS_ERR(vc4_hdmi->cec_clock)) { in vc5_hdmi_init_resources()
3063 return PTR_ERR(vc4_hdmi->cec_clock); in vc5_hdmi_init_resources()
3066 vc4_hdmi->reset = devm_reset_control_get(dev, NULL); in vc5_hdmi_init_resources()
3067 if (IS_ERR(vc4_hdmi->reset)) { in vc5_hdmi_init_resources()
3069 return PTR_ERR(vc4_hdmi->reset); in vc5_hdmi_init_resources()
3072 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->hdmi_regset, VC4_HDMI); in vc5_hdmi_init_resources()
3076 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->hd_regset, VC4_HD); in vc5_hdmi_init_resources()
3080 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->cec_regset, VC5_CEC); in vc5_hdmi_init_resources()
3084 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->csc_regset, VC5_CSC); in vc5_hdmi_init_resources()
3088 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->dvp_regset, VC5_DVP); in vc5_hdmi_init_resources()
3092 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->phy_regset, VC5_PHY); in vc5_hdmi_init_resources()
3096 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->ram_regset, VC5_RAM); in vc5_hdmi_init_resources()
3100 ret = vc4_hdmi_build_regset(drm, vc4_hdmi, &vc4_hdmi->rm_regset, VC5_RM); in vc5_hdmi_init_resources()
3109 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); in vc4_hdmi_runtime_suspend() local
3111 clk_disable_unprepare(vc4_hdmi->hsm_clock); in vc4_hdmi_runtime_suspend()
3118 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); in vc4_hdmi_runtime_resume() local
3124 ret = clk_prepare_enable(vc4_hdmi->hsm_clock); in vc4_hdmi_runtime_resume()
3137 rate = clk_get_rate(vc4_hdmi->hsm_clock); in vc4_hdmi_runtime_resume()
3143 if (vc4_hdmi->variant->reset) in vc4_hdmi_runtime_resume()
3144 vc4_hdmi->variant->reset(vc4_hdmi); in vc4_hdmi_runtime_resume()
3147 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_runtime_resume()
3152 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_runtime_resume()
3154 vc4_hdmi_cec_update_clk_div(vc4_hdmi); in vc4_hdmi_runtime_resume()
3156 if (!vc4_hdmi->variant->external_irq_controller) { in vc4_hdmi_runtime_resume()
3157 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_runtime_resume()
3159 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); in vc4_hdmi_runtime_resume()
3166 clk_disable_unprepare(vc4_hdmi->hsm_clock); in vc4_hdmi_runtime_resume()
3172 struct vc4_hdmi *vc4_hdmi = ptr; in vc4_hdmi_put_ddc_device() local
3174 put_device(&vc4_hdmi->ddc->dev); in vc4_hdmi_put_ddc_device()
3182 struct vc4_hdmi *vc4_hdmi; in vc4_hdmi_bind() local
3187 vc4_hdmi = drmm_kzalloc(drm, sizeof(*vc4_hdmi), GFP_KERNEL); in vc4_hdmi_bind()
3188 if (!vc4_hdmi) in vc4_hdmi_bind()
3191 ret = drmm_mutex_init(drm, &vc4_hdmi->mutex); in vc4_hdmi_bind()
3195 spin_lock_init(&vc4_hdmi->hw_lock); in vc4_hdmi_bind()
3196 INIT_DELAYED_WORK(&vc4_hdmi->scrambling_work, vc4_hdmi_scrambling_wq); in vc4_hdmi_bind()
3198 dev_set_drvdata(dev, vc4_hdmi); in vc4_hdmi_bind()
3199 encoder = &vc4_hdmi->encoder.base; in vc4_hdmi_bind()
3200 vc4_hdmi->encoder.type = variant->encoder_type; in vc4_hdmi_bind()
3201 vc4_hdmi->encoder.pre_crtc_configure = vc4_hdmi_encoder_pre_crtc_configure; in vc4_hdmi_bind()
3202 vc4_hdmi->encoder.pre_crtc_enable = vc4_hdmi_encoder_pre_crtc_enable; in vc4_hdmi_bind()
3203 vc4_hdmi->encoder.post_crtc_enable = vc4_hdmi_encoder_post_crtc_enable; in vc4_hdmi_bind()
3204 vc4_hdmi->encoder.post_crtc_disable = vc4_hdmi_encoder_post_crtc_disable; in vc4_hdmi_bind()
3205 vc4_hdmi->encoder.post_crtc_powerdown = vc4_hdmi_encoder_post_crtc_powerdown; in vc4_hdmi_bind()
3206 vc4_hdmi->pdev = pdev; in vc4_hdmi_bind()
3207 vc4_hdmi->variant = variant; in vc4_hdmi_bind()
3216 vc4_hdmi->scdc_enabled = true; in vc4_hdmi_bind()
3218 ret = variant->init_resources(drm, vc4_hdmi); in vc4_hdmi_bind()
3228 vc4_hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node); in vc4_hdmi_bind()
3230 if (!vc4_hdmi->ddc) { in vc4_hdmi_bind()
3235 ret = devm_add_action_or_reset(dev, vc4_hdmi_put_ddc_device, vc4_hdmi); in vc4_hdmi_bind()
3242 vc4_hdmi->hpd_gpio = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN); in vc4_hdmi_bind()
3243 if (IS_ERR(vc4_hdmi->hpd_gpio)) { in vc4_hdmi_bind()
3244 return PTR_ERR(vc4_hdmi->hpd_gpio); in vc4_hdmi_bind()
3247 vc4_hdmi->disable_wifi_frequencies = in vc4_hdmi_bind()
3265 clk_prepare_enable(vc4_hdmi->pixel_clock); in vc4_hdmi_bind()
3266 clk_prepare_enable(vc4_hdmi->hsm_clock); in vc4_hdmi_bind()
3267 clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); in vc4_hdmi_bind()
3279 ret = vc4_hdmi_connector_init(drm, vc4_hdmi); in vc4_hdmi_bind()
3283 ret = vc4_hdmi_hotplug_init(vc4_hdmi); in vc4_hdmi_bind()
3287 ret = vc4_hdmi_cec_init(vc4_hdmi); in vc4_hdmi_bind()
3291 ret = vc4_hdmi_audio_init(vc4_hdmi); in vc4_hdmi_bind()