Rev 6320 | Rev 6935 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6320 | Rev 6660 | ||
---|---|---|---|
Line 1670... | Line 1670... | ||
1670 | { |
1670 | { |
1671 | struct drm_dp_sideband_msg_tx *txmsg; |
1671 | struct drm_dp_sideband_msg_tx *txmsg; |
1672 | struct drm_dp_mst_branch *mstb; |
1672 | struct drm_dp_mst_branch *mstb; |
1673 | int len, ret, port_num; |
1673 | int len, ret, port_num; |
Line -... | Line 1674... | ||
- | 1674 | ||
- | 1675 | port = drm_dp_get_validated_port_ref(mgr, port); |
|
- | 1676 | if (!port) |
|
- | 1677 | return -EINVAL; |
|
1674 | 1678 | ||
1675 | port_num = port->port_num; |
1679 | port_num = port->port_num; |
1676 | mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent); |
1680 | mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent); |
1677 | if (!mstb) { |
1681 | if (!mstb) { |
Line 1678... | Line 1682... | ||
1678 | mstb = drm_dp_get_last_connected_port_and_mstb(mgr, port->parent, &port_num); |
1682 | mstb = drm_dp_get_last_connected_port_and_mstb(mgr, port->parent, &port_num); |
- | 1683 | ||
1679 | 1684 | if (!mstb) { |
|
1680 | if (!mstb) |
1685 | drm_dp_put_port(port); |
- | 1686 | return -EINVAL; |
|
Line 1681... | Line 1687... | ||
1681 | return -EINVAL; |
1687 | } |
1682 | } |
1688 | } |
1683 | 1689 | ||
1684 | txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); |
1690 | txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL); |
Line 1702... | Line 1708... | ||
1702 | ret = 0; |
1708 | ret = 0; |
1703 | } |
1709 | } |
1704 | kfree(txmsg); |
1710 | kfree(txmsg); |
1705 | fail_put: |
1711 | fail_put: |
1706 | drm_dp_put_mst_branch_device(mstb); |
1712 | drm_dp_put_mst_branch_device(mstb); |
- | 1713 | drm_dp_put_port(port); |
|
1707 | return ret; |
1714 | return ret; |
1708 | } |
1715 | } |
Line 1709... | Line 1716... | ||
1709 | 1716 | ||
1710 | static int drm_dp_create_payload_step1(struct drm_dp_mst_topology_mgr *mgr, |
1717 | static int drm_dp_create_payload_step1(struct drm_dp_mst_topology_mgr *mgr, |
Line 1784... | Line 1791... | ||
1784 | /* solve the current payloads - compare to the hw ones |
1791 | /* solve the current payloads - compare to the hw ones |
1785 | - update the hw view */ |
1792 | - update the hw view */ |
1786 | req_payload.start_slot = cur_slots; |
1793 | req_payload.start_slot = cur_slots; |
1787 | if (mgr->proposed_vcpis[i]) { |
1794 | if (mgr->proposed_vcpis[i]) { |
1788 | port = container_of(mgr->proposed_vcpis[i], struct drm_dp_mst_port, vcpi); |
1795 | port = container_of(mgr->proposed_vcpis[i], struct drm_dp_mst_port, vcpi); |
- | 1796 | port = drm_dp_get_validated_port_ref(mgr, port); |
|
- | 1797 | if (!port) { |
|
- | 1798 | mutex_unlock(&mgr->payload_lock); |
|
- | 1799 | return -EINVAL; |
|
- | 1800 | } |
|
1789 | req_payload.num_slots = mgr->proposed_vcpis[i]->num_slots; |
1801 | req_payload.num_slots = mgr->proposed_vcpis[i]->num_slots; |
1790 | } else { |
1802 | } else { |
1791 | port = NULL; |
1803 | port = NULL; |
1792 | req_payload.num_slots = 0; |
1804 | req_payload.num_slots = 0; |
1793 | } |
1805 | } |
Line 1809... | Line 1821... | ||
1809 | mgr->payloads[i].start_slot = 0; |
1821 | mgr->payloads[i].start_slot = 0; |
1810 | } |
1822 | } |
1811 | mgr->payloads[i].payload_state = req_payload.payload_state; |
1823 | mgr->payloads[i].payload_state = req_payload.payload_state; |
1812 | } |
1824 | } |
1813 | cur_slots += req_payload.num_slots; |
1825 | cur_slots += req_payload.num_slots; |
- | 1826 | ||
- | 1827 | if (port) |
|
- | 1828 | drm_dp_put_port(port); |
|
1814 | } |
1829 | } |
Line 1815... | Line 1830... | ||
1815 | 1830 | ||
1816 | for (i = 0; i < mgr->max_payloads; i++) { |
1831 | for (i = 0; i < mgr->max_payloads; i++) { |
1817 | if (mgr->payloads[i].payload_state == DP_PAYLOAD_DELETE_LOCAL) { |
1832 | if (mgr->payloads[i].payload_state == DP_PAYLOAD_DELETE_LOCAL) { |
Line 2112... | Line 2127... | ||
2112 | 2127 | ||
Line 2113... | Line 2128... | ||
2113 | mutex_lock(&mgr->lock); |
2128 | mutex_lock(&mgr->lock); |
2114 | 2129 | ||
- | 2130 | if (mgr->mst_primary) { |
|
- | 2131 | int sret; |
|
2115 | if (mgr->mst_primary) { |
2132 | u8 guid[16]; |
2116 | int sret; |
2133 | |
2117 | sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE); |
2134 | sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE); |
2118 | if (sret != DP_RECEIVER_CAP_SIZE) { |
2135 | if (sret != DP_RECEIVER_CAP_SIZE) { |
2119 | DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n"); |
2136 | DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n"); |
Line 2126... | Line 2143... | ||
2126 | if (ret < 0) { |
2143 | if (ret < 0) { |
2127 | DRM_DEBUG_KMS("mst write failed - undocked during suspend?\n"); |
2144 | DRM_DEBUG_KMS("mst write failed - undocked during suspend?\n"); |
2128 | ret = -1; |
2145 | ret = -1; |
2129 | goto out_unlock; |
2146 | goto out_unlock; |
2130 | } |
2147 | } |
- | 2148 | ||
- | 2149 | /* Some hubs forget their guids after they resume */ |
|
- | 2150 | sret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16); |
|
- | 2151 | if (sret != 16) { |
|
- | 2152 | DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n"); |
|
- | 2153 | ret = -1; |
|
- | 2154 | goto out_unlock; |
|
- | 2155 | } |
|
- | 2156 | drm_dp_check_mstb_guid(mgr->mst_primary, guid); |
|
- | 2157 | ||
2131 | ret = 0; |
2158 | ret = 0; |
2132 | } else |
2159 | } else |
2133 | ret = -1; |
2160 | ret = -1; |
Line 2134... | Line 2161... | ||
2134 | 2161 |