-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Change vc4 DSI to being a bridge #4878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2c55355
drm: Introduce DRM_BRIDGE_OP_UPSTREAM_FIRST to alter bridge init order
6by9 6e27cd2
drm/dsi: Document the meaning and spec references for MIPI_DSI_MODE_*
6by9 e90473a
drm/bridge: tc358762: Ignore EPROBE_DEFER when logging errors
6by9 97cdbef
drm/tc358762: Set the DRM_BRIDGE_OP_UPSTREAM_FIRST flag to configure …
6by9 deb4859
drm/vc4: Rename bridge to out_bridge
6by9 911b4e8
drm/vc4: Move DSI initialisation to encoder_mode_set.
6by9 4b8b607
drm/vc4: Remove splitting the bridge chain from the driver.
6by9 e9b590c
drm/vc4: Convert vc4_dsi to use atomic enable/disable/mode_set.
6by9 5d74a18
drm/vc4: Convert vc4_dsi to using a bridge instead of encoder.
6by9 ff223f3
drm/vc4: Remove entry to ULPS from vc4_dsi post_disable
6by9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -462,21 +462,58 @@ EXPORT_SYMBOL(drm_bridge_chain_disable); | |
| * Calls &drm_bridge_funcs.post_disable op for all the bridges in the | ||
| * encoder chain, starting from the first bridge to the last. These are called | ||
| * after completing the encoder's prepare op. | ||
| * If a bridge sets the DRM_BRIDGE_OP_UPSTREAM_FIRST, then the post_disable for | ||
| * that bridge will be called before the previous one to reverse the pre_enable | ||
| * calling direction. | ||
| * | ||
| * Note: the bridge passed should be the one closest to the encoder | ||
| */ | ||
| void drm_bridge_chain_post_disable(struct drm_bridge *bridge) | ||
| { | ||
| struct drm_encoder *encoder; | ||
| struct drm_bridge *next, *limit; | ||
|
|
||
| if (!bridge) | ||
| return; | ||
|
|
||
| encoder = bridge->encoder; | ||
| list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { | ||
| limit = NULL; | ||
|
|
||
| if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) { | ||
| next = list_next_entry(bridge, chain_node); | ||
|
|
||
| if (next->ops & DRM_BRIDGE_OP_UPSTREAM_FIRST) { | ||
| limit = next; | ||
|
|
||
| list_for_each_entry_from(next, &encoder->bridge_chain, | ||
| chain_node) { | ||
| if (!(next->ops & | ||
| DRM_BRIDGE_OP_UPSTREAM_FIRST)) { | ||
| next = list_prev_entry(next, chain_node); | ||
| limit = next; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| list_for_each_entry_from_reverse(next, &encoder->bridge_chain, | ||
| chain_node) { | ||
| if (next == bridge) | ||
| break; | ||
|
|
||
| if (next->funcs->post_disable) | ||
| next->funcs->post_disable(next); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (bridge->funcs->post_disable) | ||
| bridge->funcs->post_disable(bridge); | ||
|
|
||
| if (limit) | ||
| bridge = limit; | ||
| } | ||
|
|
||
| } | ||
| EXPORT_SYMBOL(drm_bridge_chain_post_disable); | ||
|
|
||
|
|
@@ -517,22 +554,53 @@ EXPORT_SYMBOL(drm_bridge_chain_mode_set); | |
| * Calls &drm_bridge_funcs.pre_enable op for all the bridges in the encoder | ||
| * chain, starting from the last bridge to the first. These are called | ||
| * before calling the encoder's commit op. | ||
| * If a bridge sets the DRM_BRIDGE_OP_UPSTREAM_FIRST, then the pre_enable for | ||
| * the previous bridge will be called before pre_enable of this bridge. | ||
| * | ||
| * Note: the bridge passed should be the one closest to the encoder | ||
| */ | ||
| void drm_bridge_chain_pre_enable(struct drm_bridge *bridge) | ||
| { | ||
| struct drm_encoder *encoder; | ||
| struct drm_bridge *iter; | ||
| struct drm_bridge *iter, *next, *limit; | ||
|
|
||
| if (!bridge) | ||
| return; | ||
|
|
||
| encoder = bridge->encoder; | ||
|
|
||
| list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { | ||
| if (iter->ops & DRM_BRIDGE_OP_UPSTREAM_FIRST) { | ||
| next = iter; | ||
| limit = bridge; | ||
| list_for_each_entry_from_reverse(next, | ||
| &encoder->bridge_chain, | ||
| chain_node) { | ||
| if (next == bridge) | ||
| break; | ||
|
|
||
| if (!(next->ops & | ||
| DRM_BRIDGE_OP_UPSTREAM_FIRST)) { | ||
| limit = list_prev_entry(next, chain_node); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| list_for_each_entry_from(next, &encoder->bridge_chain, chain_node) { | ||
| if (next == iter) | ||
| break; | ||
|
|
||
| if (next->funcs->pre_enable) | ||
| next->funcs->pre_enable(next); | ||
| } | ||
| } | ||
|
|
||
| if (iter->funcs->pre_enable) | ||
| iter->funcs->pre_enable(iter); | ||
|
|
||
| if (iter->ops & DRM_BRIDGE_OP_UPSTREAM_FIRST) | ||
| iter = limit; | ||
|
|
||
| if (iter == bridge) | ||
| break; | ||
| } | ||
|
|
@@ -607,6 +675,25 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, | |
| } | ||
| EXPORT_SYMBOL(drm_atomic_bridge_chain_disable); | ||
|
|
||
| static void drm_atomic_bridge_call_post_disable(struct drm_bridge *bridge, | ||
| struct drm_atomic_state *old_state) | ||
| { | ||
| if (bridge->funcs->atomic_post_disable) { | ||
| struct drm_bridge_state *old_bridge_state; | ||
|
|
||
| old_bridge_state = | ||
| drm_atomic_get_old_bridge_state(old_state, | ||
| bridge); | ||
| if (WARN_ON(!old_bridge_state)) | ||
| return; | ||
|
|
||
| bridge->funcs->atomic_post_disable(bridge, | ||
| old_bridge_state); | ||
| } else if (bridge->funcs->post_disable) { | ||
| bridge->funcs->post_disable(bridge); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges | ||
| * in the encoder chain | ||
|
|
@@ -617,37 +704,79 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_disable); | |
| * &drm_bridge_funcs.post_disable) op for all the bridges in the encoder chain, | ||
| * starting from the first bridge to the last. These are called after completing | ||
| * &drm_encoder_helper_funcs.atomic_disable | ||
| * If a bridge sets the DRM_BRIDGE_OP_UPSTREAM_FIRST, then the post_disable for | ||
| * that bridge will be called before the previous one to reverse the pre_enable | ||
| * calling direction. | ||
| * | ||
| * Note: the bridge passed should be the one closest to the encoder | ||
| */ | ||
| void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, | ||
| struct drm_atomic_state *old_state) | ||
| { | ||
| struct drm_encoder *encoder; | ||
| struct drm_bridge *next, *limit; | ||
|
|
||
| if (!bridge) | ||
| return; | ||
|
|
||
| encoder = bridge->encoder; | ||
|
|
||
| list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { | ||
| if (bridge->funcs->atomic_post_disable) { | ||
| struct drm_bridge_state *old_bridge_state; | ||
| limit = NULL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This all looks very familiar - it's a shame the non-atomic case can't be a handled as a special case of the atomic API. |
||
|
|
||
| if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) { | ||
| next = list_next_entry(bridge, chain_node); | ||
|
|
||
| if (next->ops & DRM_BRIDGE_OP_UPSTREAM_FIRST) { | ||
| limit = next; | ||
|
|
||
| list_for_each_entry_from(next, &encoder->bridge_chain, | ||
| chain_node) { | ||
| if (!(next->ops & | ||
| DRM_BRIDGE_OP_UPSTREAM_FIRST)) { | ||
| next = list_prev_entry(next, chain_node); | ||
| limit = next; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| list_for_each_entry_from_reverse(next, &encoder->bridge_chain, | ||
| chain_node) { | ||
| if (next == bridge) | ||
| break; | ||
|
|
||
| drm_atomic_bridge_call_post_disable(next, | ||
| old_state); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| old_bridge_state = | ||
| drm_atomic_get_old_bridge_state(old_state, | ||
| bridge); | ||
| if (WARN_ON(!old_bridge_state)) | ||
| return; | ||
| drm_atomic_bridge_call_post_disable(bridge, old_state); | ||
|
|
||
| bridge->funcs->atomic_post_disable(bridge, | ||
| old_bridge_state); | ||
| } else if (bridge->funcs->post_disable) { | ||
| bridge->funcs->post_disable(bridge); | ||
| } | ||
| if (limit) | ||
| bridge = limit; | ||
| } | ||
| } | ||
| EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable); | ||
|
|
||
| static void drm_atomic_bridge_call_pre_enable(struct drm_bridge *bridge, | ||
| struct drm_atomic_state *old_state) | ||
| { | ||
| if (bridge->funcs->atomic_pre_enable) { | ||
| struct drm_bridge_state *old_bridge_state; | ||
|
|
||
| old_bridge_state = | ||
| drm_atomic_get_old_bridge_state(old_state, | ||
| bridge); | ||
| if (WARN_ON(!old_bridge_state)) | ||
| return; | ||
|
|
||
| bridge->funcs->atomic_pre_enable(bridge, old_bridge_state); | ||
| } else if (bridge->funcs->pre_enable) { | ||
| bridge->funcs->pre_enable(bridge); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in | ||
| * the encoder chain | ||
|
|
@@ -658,33 +787,51 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable); | |
| * &drm_bridge_funcs.pre_enable) op for all the bridges in the encoder chain, | ||
| * starting from the last bridge to the first. These are called before calling | ||
| * &drm_encoder_helper_funcs.atomic_enable | ||
| * If a bridge sets the DRM_BRIDGE_OP_UPSTREAM_FIRST, then the pre_enable for | ||
| * the previous bridge will be called before pre_enable of this bridge. | ||
| * | ||
| * Note: the bridge passed should be the one closest to the encoder | ||
| */ | ||
| void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, | ||
| struct drm_atomic_state *old_state) | ||
| { | ||
| struct drm_encoder *encoder; | ||
| struct drm_bridge *iter; | ||
| struct drm_bridge *iter, *next, *limit; | ||
|
|
||
| if (!bridge) | ||
| return; | ||
|
|
||
| encoder = bridge->encoder; | ||
|
|
||
| list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { | ||
| if (iter->funcs->atomic_pre_enable) { | ||
| struct drm_bridge_state *old_bridge_state; | ||
| if (iter->ops & DRM_BRIDGE_OP_UPSTREAM_FIRST) { | ||
| next = iter; | ||
| limit = bridge; | ||
| list_for_each_entry_from_reverse(next, | ||
| &encoder->bridge_chain, | ||
| chain_node) { | ||
| if (next == bridge) | ||
| break; | ||
|
|
||
| if (!(next->ops & | ||
| DRM_BRIDGE_OP_UPSTREAM_FIRST)) { | ||
| limit = list_prev_entry(next, chain_node); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| list_for_each_entry_from(next, &encoder->bridge_chain, chain_node) { | ||
| if (next == iter) | ||
| break; | ||
|
|
||
| drm_atomic_bridge_call_pre_enable(next, old_state); | ||
| } | ||
| } | ||
|
|
||
| old_bridge_state = | ||
| drm_atomic_get_old_bridge_state(old_state, | ||
| iter); | ||
| if (WARN_ON(!old_bridge_state)) | ||
| return; | ||
| drm_atomic_bridge_call_pre_enable(iter, old_state); | ||
|
|
||
| iter->funcs->atomic_pre_enable(iter, old_bridge_state); | ||
| } else if (iter->funcs->pre_enable) { | ||
| iter->funcs->pre_enable(iter); | ||
| } | ||
| if (iter->ops & DRM_BRIDGE_OP_UPSTREAM_FIRST) | ||
| iter = limit; | ||
|
|
||
| if (iter == bridge) | ||
| break; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop would benefit from at least a single explanatory comment.