FILE
nouveau_encoder.h
File preview with syntax highlighting.
linux-6.19.14/drivers/gpu/drm/nouveau/nouveau_encoder.h
1/* 2 * Copyright (C) 2008 Maarten Maathuis. 3 * All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sublicense, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * The above copyright notice and this permission notice (including the 14 * next paragraph) shall be included in all copies or substantial 15 * portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 * 25 */ 26 27#ifndef __NOUVEAU_ENCODER_H__ 28#define __NOUVEAU_ENCODER_H__ 29#include <nvif/outp.h> 30#include <subdev/bios/dcb.h> 31 32#include <drm/display/drm_dp_helper.h> 33#include <drm/display/drm_dp_mst_helper.h> 34 35#include <dispnv04/i2c/encoder_i2c.h> 36 37#include "dispnv04/disp.h" 38 39struct nv50_head_atom; 40struct nouveau_connector; 41 42#define NV_DPMS_CLEARED 0x80 43 44struct nvkm_i2c_port; 45 46struct nouveau_encoder { 47 struct nouveau_i2c_encoder base; 48 49 struct dcb_output *dcb; 50 struct nvif_outp outp; 51 int or; 52 53 struct nouveau_connector *conn; 54 55 struct i2c_adapter *i2c; 56 57 /* different to drm_encoder.crtc, this reflects what's 58 * actually programmed on the hw, not the proposed crtc */ 59 struct drm_crtc *crtc; 60 u32 ctrl; 61 62 /* Protected by nouveau_drm.audio.lock */ 63 struct { 64 bool enabled; 65 } audio; 66 67 struct drm_display_mode mode; 68 int last_dpms; 69 70 struct nv04_output_reg restore; 71 72 struct { 73 struct { 74 bool enabled; 75 } hdmi; 76 77 struct { 78 struct nv50_mstm *mstm; 79 80 struct { 81 u8 caps[DP_LTTPR_COMMON_CAP_SIZE]; 82 u8 nr; 83 } lttpr; 84 85 u8 dpcd[DP_RECEIVER_CAP_SIZE]; 86 87 struct nvif_outp_dp_rate rate[8]; 88 int rate_nr; 89 90 int link_nr; 91 int link_bw; 92 93 struct { 94 bool mst; 95 u8 nr; 96 u32 bw; 97 } lt; 98 99 /* Protects DP state that needs to be accessed outside 100 * connector reprobing contexts 101 */ 102 struct mutex hpd_irq_lock; 103 104 u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; 105 struct drm_dp_desc desc; 106 107 u8 sink_count; 108 } dp; 109 }; 110 111 struct { 112 bool dp_interlace : 1; 113 } caps; 114 115 void (*enc_save)(struct drm_encoder *encoder); 116 void (*enc_restore)(struct drm_encoder *encoder); 117 void (*update)(struct nouveau_encoder *, u8 head, 118 struct nv50_head_atom *, u8 proto, u8 depth); 119}; 120 121struct nv50_mstm { 122 struct nouveau_encoder *outp; 123 124 struct drm_dp_mst_topology_mgr mgr; 125 126 /* Protected under nouveau_encoder->dp.hpd_irq_lock */ 127 bool can_mst; 128 bool is_mst; 129 bool suspended; 130 131 bool modified; 132 bool disabled; 133 int links; 134}; 135 136struct nouveau_encoder * 137find_encoder(struct drm_connector *connector, int type); 138 139static inline struct nouveau_encoder *nouveau_encoder(struct drm_encoder *enc) 140{ 141 struct nouveau_i2c_encoder *slave = to_encoder_i2c(enc); 142 143 return container_of(slave, struct nouveau_encoder, base); 144} 145 146static inline struct drm_encoder *to_drm_encoder(struct nouveau_encoder *enc) 147{ 148 return &enc->base.base; 149} 150 151/* nouveau_dp.c */ 152enum nouveau_dp_status { 153 NOUVEAU_DP_NONE, 154 NOUVEAU_DP_SST, 155 NOUVEAU_DP_MST, 156}; 157 158int nouveau_dp_detect(struct nouveau_connector *, struct nouveau_encoder *); 159bool nouveau_dp_train(struct nouveau_encoder *, bool mst, u32 khz, u8 bpc); 160void nouveau_dp_power_down(struct nouveau_encoder *); 161bool nouveau_dp_link_check(struct nouveau_connector *); 162void nouveau_dp_irq(struct work_struct *); 163enum drm_mode_status nv50_dp_mode_valid(struct nouveau_encoder *, 164 const struct drm_display_mode *, 165 unsigned *clock); 166 167struct nouveau_connector * 168nv50_outp_get_new_connector(struct drm_atomic_state *state, struct nouveau_encoder *outp); 169struct nouveau_connector * 170nv50_outp_get_old_connector(struct drm_atomic_state *state, struct nouveau_encoder *outp); 171 172int nv50_mstm_detect(struct nouveau_encoder *encoder); 173void nv50_mstm_remove(struct nv50_mstm *mstm); 174bool nv50_mstm_service(struct nouveau_drm *drm, 175 struct nouveau_connector *nv_connector, 176 struct nv50_mstm *mstm); 177#endif /* __NOUVEAU_ENCODER_H__ */
~/
Read-only file preview.