Skip to content

Commit

Permalink
drm/nouveau/kms/nv50-: Remove open-coded drm_dp_read_desc()
Browse files Browse the repository at this point in the history
Noticed this while going through our DP code - we use an open-coded
version of drm_dp_read_desc() instead of just using the helper, so
change that. This will also let us use quirks in the future if we end up
needing them.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200826182456.322681-3-lyude@redhat.com
  • Loading branch information
Lyude Paul committed Aug 31, 2020
1 parent bbcd521 commit 6ba1193
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/nouveau/nouveau_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ nouveau_connector_ddc_detect(struct drm_connector *connector)

switch (nv_encoder->dcb->type) {
case DCB_OUTPUT_DP:
ret = nouveau_dp_detect(nv_encoder);
ret = nouveau_dp_detect(nouveau_connector(connector),
nv_encoder);
if (ret == NOUVEAU_DP_MST)
return NULL;
else if (ret == NOUVEAU_DP_SST)
Expand Down
30 changes: 9 additions & 21 deletions drivers/gpu/drm/nouveau/nouveau_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,9 @@ MODULE_PARM_DESC(mst, "Enable DisplayPort multi-stream (default: enabled)");
static int nouveau_mst = 1;
module_param_named(mst, nouveau_mst, int, 0400);

static void
nouveau_dp_probe_oui(struct drm_device *dev, struct nvkm_i2c_aux *aux, u8 *dpcd)
{
struct nouveau_drm *drm = nouveau_drm(dev);
u8 buf[3];

if (!(dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT))
return;

if (!nvkm_rdaux(aux, DP_SINK_OUI, buf, 3))
NV_DEBUG(drm, "Sink OUI: %02hx%02hx%02hx\n",
buf[0], buf[1], buf[2]);

if (!nvkm_rdaux(aux, DP_BRANCH_OUI, buf, 3))
NV_DEBUG(drm, "Branch OUI: %02hx%02hx%02hx\n",
buf[0], buf[1], buf[2]);

}

int
nouveau_dp_detect(struct nouveau_encoder *nv_encoder)
nouveau_dp_detect(struct nouveau_connector *nv_connector,
struct nouveau_encoder *nv_encoder)
{
struct drm_device *dev = nv_encoder->base.base.dev;
struct nouveau_drm *drm = nouveau_drm(dev);
Expand Down Expand Up @@ -89,7 +71,13 @@ nouveau_dp_detect(struct nouveau_encoder *nv_encoder)
NV_DEBUG(drm, "maximum: %dx%d\n",
nv_encoder->dp.link_nr, nv_encoder->dp.link_bw);

nouveau_dp_probe_oui(dev, aux, dpcd);
ret = drm_dp_read_desc(&nv_connector->aux, &nv_encoder->dp.desc,
drm_dp_is_branch(dpcd));
if (ret) {
NV_ERROR(drm, "Failed to read DP descriptor on %s: %d\n",
nv_connector->base.name, ret);
return ret;
}

ret = nv50_mstm_detect(nv_encoder->dp.mstm, dpcd, nouveau_mst);
if (ret == 1)
Expand Down
4 changes: 3 additions & 1 deletion drivers/gpu/drm/nouveau/nouveau_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <drm/drm_dp_mst_helper.h>
#include "dispnv04/disp.h"
struct nv50_head_atom;
struct nouveau_connector;

#define NV_DPMS_CLEARED 0x80

Expand Down Expand Up @@ -64,6 +65,7 @@ struct nouveau_encoder {
struct nv50_mstm *mstm;
int link_nr;
int link_bw;
struct drm_dp_desc desc;
} dp;
};

Expand Down Expand Up @@ -104,7 +106,7 @@ enum nouveau_dp_status {
NOUVEAU_DP_MST,
};

int nouveau_dp_detect(struct nouveau_encoder *);
int nouveau_dp_detect(struct nouveau_connector *, struct nouveau_encoder *);
enum drm_mode_status nv50_dp_mode_valid(struct drm_connector *,
struct nouveau_encoder *,
const struct drm_display_mode *,
Expand Down

0 comments on commit 6ba1193

Please sign in to comment.