| 1 | // SPDX-License-Identifier: MIT | 
|---|---|
| 2 | /* | 
| 3 | * Copyright © 2022 Intel Corporation | 
| 4 | */ | 
| 5 | |
| 6 | #include <drm/drm_device.h> | 
| 7 | #include <drm/drm_print.h> | 
| 8 | |
| 9 | #include "intel_de.h" | 
| 10 | #include "intel_display.h" | 
| 11 | #include "intel_hti.h" | 
| 12 | #include "intel_hti_regs.h" | 
| 13 | |
| 14 | void intel_hti_init(struct intel_display *display) | 
| 15 | { | 
| 16 | /* | 
| 17 | * If the platform has HTI, we need to find out whether it has reserved | 
| 18 | * any display resources before we create our display outputs. | 
| 19 | */ | 
| 20 | if (DISPLAY_INFO(display)->has_hti) | 
| 21 | display->hti.state = intel_de_read(display, HDPORT_STATE); | 
| 22 | } | 
| 23 | |
| 24 | bool intel_hti_uses_phy(struct intel_display *display, enum phy phy) | 
| 25 | { | 
| 26 | if (drm_WARN_ON(display->drm, phy == PHY_NONE)) | 
| 27 | return false; | 
| 28 | |
| 29 | return display->hti.state & HDPORT_ENABLED && | 
| 30 | display->hti.state & HDPORT_DDI_USED(phy); | 
| 31 | } | 
| 32 | |
| 33 | u32 intel_hti_dpll_mask(struct intel_display *display) | 
| 34 | { | 
| 35 | if (!(display->hti.state & HDPORT_ENABLED)) | 
| 36 | return 0; | 
| 37 | |
| 38 | /* | 
| 39 | * Note: This is subtle. The values must coincide with what's defined | 
| 40 | * for the platform. | 
| 41 | */ | 
| 42 | return REG_FIELD_GET(HDPORT_DPLL_USED_MASK, display->hti.state); | 
| 43 | } | 
| 44 | 
