Commit 6847d71b authored by Paulo Zanoni's avatar Paulo Zanoni Committed by Daniel Vetter

drm/i915: transform INTEL_OUTPUT_* into an enum

Because I got annoyed that I had to document what values "int
ddi_personality" is supposed to hold.

A good side-effect of this change is that now the compilers can do
some additional checks on our code, which may prevent some bugs in the
future. A bad side-effect of this change is that now the compilers do
some additional checks on our code and complain when a switch
statement doesn't check for all possible values, so we need to add
"default" cases to all those switches. Hopefully, this may help
preventing confusions against DRM_MODE_CONNECTOR_* and
DRM_MODE_ENCODER_*.

I guess that just by looking at the patch, some people will think this
change is not worth its benefits. In this case, I don't really mind
dropping the patch.

Also, there's probably still a few more places where we can
s/int/enum intel_output_type/, but we can change that later, when we
spot the places.
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
[danvet: Resolve conflict due to reordered patches.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 820d2d77
...@@ -2971,6 +2971,8 @@ static int i9xx_pipe_crc_auto_source(struct drm_device *dev, enum pipe pipe, ...@@ -2971,6 +2971,8 @@ static int i9xx_pipe_crc_auto_source(struct drm_device *dev, enum pipe pipe,
break; break;
} }
break; break;
default:
break;
} }
} }
drm_modeset_unlock_all(dev); drm_modeset_unlock_all(dev);
......
...@@ -6269,6 +6269,8 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc, ...@@ -6269,6 +6269,8 @@ static int i9xx_crtc_mode_set(struct intel_crtc *crtc,
case INTEL_OUTPUT_DSI: case INTEL_OUTPUT_DSI:
is_dsi = true; is_dsi = true;
break; break;
default:
break;
} }
num_connectors++; num_connectors++;
...@@ -6597,6 +6599,8 @@ static void ironlake_init_pch_refclk(struct drm_device *dev) ...@@ -6597,6 +6599,8 @@ static void ironlake_init_pch_refclk(struct drm_device *dev)
if (enc_to_dig_port(&encoder->base)->port == PORT_A) if (enc_to_dig_port(&encoder->base)->port == PORT_A)
has_cpu_edp = true; has_cpu_edp = true;
break; break;
default:
break;
} }
} }
...@@ -6901,6 +6905,8 @@ static void lpt_init_pch_refclk(struct drm_device *dev) ...@@ -6901,6 +6905,8 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
case INTEL_OUTPUT_ANALOG: case INTEL_OUTPUT_ANALOG:
has_vga = true; has_vga = true;
break; break;
default:
break;
} }
} }
...@@ -6934,6 +6940,8 @@ static int ironlake_get_refclk(struct drm_crtc *crtc) ...@@ -6934,6 +6940,8 @@ static int ironlake_get_refclk(struct drm_crtc *crtc)
case INTEL_OUTPUT_LVDS: case INTEL_OUTPUT_LVDS:
is_lvds = true; is_lvds = true;
break; break;
default:
break;
} }
num_connectors++; num_connectors++;
} }
...@@ -7188,6 +7196,8 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc, ...@@ -7188,6 +7196,8 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
case INTEL_OUTPUT_HDMI: case INTEL_OUTPUT_HDMI:
is_sdvo = true; is_sdvo = true;
break; break;
default:
break;
} }
num_connectors++; num_connectors++;
......
...@@ -94,18 +94,20 @@ ...@@ -94,18 +94,20 @@
/* these are outputs from the chip - integrated only /* these are outputs from the chip - integrated only
external chips are via DVO or SDVO output */ external chips are via DVO or SDVO output */
#define INTEL_OUTPUT_UNUSED 0 enum intel_output_type {
#define INTEL_OUTPUT_ANALOG 1 INTEL_OUTPUT_UNUSED = 0,
#define INTEL_OUTPUT_DVO 2 INTEL_OUTPUT_ANALOG = 1,
#define INTEL_OUTPUT_SDVO 3 INTEL_OUTPUT_DVO = 2,
#define INTEL_OUTPUT_LVDS 4 INTEL_OUTPUT_SDVO = 3,
#define INTEL_OUTPUT_TVOUT 5 INTEL_OUTPUT_LVDS = 4,
#define INTEL_OUTPUT_HDMI 6 INTEL_OUTPUT_TVOUT = 5,
#define INTEL_OUTPUT_DISPLAYPORT 7 INTEL_OUTPUT_HDMI = 6,
#define INTEL_OUTPUT_EDP 8 INTEL_OUTPUT_DISPLAYPORT = 7,
#define INTEL_OUTPUT_DSI 9 INTEL_OUTPUT_EDP = 8,
#define INTEL_OUTPUT_UNKNOWN 10 INTEL_OUTPUT_DSI = 9,
#define INTEL_OUTPUT_DP_MST 11 INTEL_OUTPUT_UNKNOWN = 10,
INTEL_OUTPUT_DP_MST = 11,
};
#define INTEL_DVO_CHIP_NONE 0 #define INTEL_DVO_CHIP_NONE 0
#define INTEL_DVO_CHIP_LVDS 1 #define INTEL_DVO_CHIP_LVDS 1
...@@ -136,7 +138,7 @@ struct intel_encoder { ...@@ -136,7 +138,7 @@ struct intel_encoder {
*/ */
struct intel_crtc *new_crtc; struct intel_crtc *new_crtc;
int type; enum intel_output_type type;
unsigned int cloneable; unsigned int cloneable;
bool connectors_active; bool connectors_active;
void (*hot_plug)(struct intel_encoder *); void (*hot_plug)(struct intel_encoder *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment