Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,8 @@ F: tools/diagnostics/display-attributes-fixture.json
F: tools/diagnostics/test-apple-afk-admission.py
F: tools/diagnostics/test-apple-atc-unwind.py
F: tools/diagnostics/test-apple-dcp-readiness.py
F: tools/diagnostics/test-apple-dptx-readiness.py
F: tools/diagnostics/test-apple-external-lifecycle.py
F: tools/diagnostics/test-apple-display-metadata*.py
F: tools/diagnostics/test-apple-display-trace.py
F: tools/diagnostics/test-apple-external-sdr.py
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/apple/apple_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ static void apple_crtc_atomic_enable(struct drm_crtc *crtc,
dcp_poweron(apple_crtc->dcp);
/* Force the CTM to be set on first swap */
crtc_state->color_mgmt_changed = true;
} else if (crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state)) {
/* A cable generation can change while the CRTC stays active. */
dcp_external_recover(to_apple_crtc(crtc)->dcp);
}

if (crtc_state->active)
Expand Down
25 changes: 25 additions & 0 deletions drivers/gpu/drm/apple/dcp-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct iomfb_transaction {
bool backlight_reserved;
bool backlight_failed;
bool brightness_only;
bool presentation;
bool completed;
};
struct apple_dcp_typec_port;
Expand Down Expand Up @@ -219,6 +220,25 @@ struct apple_dcp {

struct apple_dcp_hw_data hw;
bool external_prepared;
/* Serializes external connection, power, and CRTC generation changes. */
struct mutex external_lock;
u64 external_generation;
u64 external_crtc_generation;
/* iomfb.lock: epoch used by receive-side deferred stop requests. */
u64 external_rx_generation;
u64 external_stop_generation;
bool external_cable;
bool external_running;
bool external_power_attempted;
/* iomfb.lock: replay the latest callback after activation succeeds. */
bool external_hotplug_pending;
bool external_hotplug_connected;
bool external_stopped;
int external_error;
u64 external_power_reply;
bool external_power_reply_valid;
struct work_struct external_stop_work;


/* firmware version and compatible firmware version */
enum dcp_firmware_version fw_compat;
Expand Down Expand Up @@ -460,6 +480,7 @@ struct apple_dcp {
unsigned long deadline;
unsigned int queued;
bool stopped;
bool presentation_paused;
bool backlight_queued;
atomic_t opaque_x_state;
struct iomfb_scanout_h17p *scanout;
Expand Down Expand Up @@ -493,11 +514,15 @@ int iomfb_configure_backlight_h17p(struct apple_dcp *dcp, u32 maximum,
void iomfb_queue_init(struct apple_dcp *dcp);
void iomfb_queue_stop(struct apple_dcp *dcp);
bool iomfb_queue_drain(struct apple_dcp *dcp, unsigned long timeout);
int iomfb_queue_settle(struct apple_dcp *dcp, unsigned long timeout);
void iomfb_pause_presentation(struct apple_dcp *dcp, bool pause);
int iomfb_external_power_h17p(struct apple_dcp *dcp, bool on);
int iomfb_queue(struct apple_dcp *dcp, struct iomfb_transaction *transaction);
void iomfb_queue_crc_h17p(struct apple_dcp *dcp, u32 swap_id);

void dcp_drm_crtc_page_flip(struct apple_dcp *dcp, ktime_t now);
void dcp_handle_hotplug_actions(struct apple_dcp *dcp, unsigned int action);
bool dcp_external_hotplug(struct apple_dcp *dcp, bool connected);

int dcp_backlight_init(struct apple_dcp *dcp, struct device *dev);
void dcp_backlight_stop(struct apple_dcp *dcp);
Expand Down
Loading