Skip to content

Commit 739f8db

Browse files
committed
drm/i915/sdvo: Get rid of the output type<->device index stuff
Get rid of this silly output type<->device index back and forth and just pass the output type directly to the corresponding output init function. This was already being done for TV outputs anyway. Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Jani Nikula <[email protected]>
1 parent 5e52622 commit 739f8db

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

drivers/gpu/drm/i915/display/intel_sdvo.c

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,7 +2631,7 @@ intel_sdvo_unselect_i2c_bus(struct intel_sdvo *sdvo)
26312631
}
26322632

26332633
static bool
2634-
intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo, int device)
2634+
intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo)
26352635
{
26362636
return intel_sdvo_check_supp_encode(intel_sdvo);
26372637
}
@@ -2736,24 +2736,21 @@ static struct intel_sdvo_connector *intel_sdvo_connector_alloc(void)
27362736
}
27372737

27382738
static bool
2739-
intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2739+
intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, u16 type)
27402740
{
27412741
struct drm_encoder *encoder = &intel_sdvo->base.base;
27422742
struct drm_connector *connector;
27432743
struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
27442744
struct intel_connector *intel_connector;
27452745
struct intel_sdvo_connector *intel_sdvo_connector;
27462746

2747-
DRM_DEBUG_KMS("initialising DVI device %d\n", device);
2747+
DRM_DEBUG_KMS("initialising DVI type 0x%x\n", type);
27482748

27492749
intel_sdvo_connector = intel_sdvo_connector_alloc();
27502750
if (!intel_sdvo_connector)
27512751
return false;
27522752

2753-
if (device == 0)
2754-
intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS0;
2755-
else if (device == 1)
2756-
intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS1;
2753+
intel_sdvo_connector->output_flag = type;
27572754

27582755
intel_connector = &intel_sdvo_connector->base;
27592756
connector = &intel_connector->base;
@@ -2773,7 +2770,7 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
27732770
encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
27742771
connector->connector_type = DRM_MODE_CONNECTOR_DVID;
27752772

2776-
if (intel_sdvo_is_hdmi_connector(intel_sdvo, device)) {
2773+
if (intel_sdvo_is_hdmi_connector(intel_sdvo)) {
27772774
connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
27782775
intel_sdvo_connector->is_hdmi = true;
27792776
}
@@ -2790,14 +2787,14 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
27902787
}
27912788

27922789
static bool
2793-
intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
2790+
intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, u16 type)
27942791
{
27952792
struct drm_encoder *encoder = &intel_sdvo->base.base;
27962793
struct drm_connector *connector;
27972794
struct intel_connector *intel_connector;
27982795
struct intel_sdvo_connector *intel_sdvo_connector;
27992796

2800-
DRM_DEBUG_KMS("initialising TV type %d\n", type);
2797+
DRM_DEBUG_KMS("initialising TV type 0x%x\n", type);
28012798

28022799
intel_sdvo_connector = intel_sdvo_connector_alloc();
28032800
if (!intel_sdvo_connector)
@@ -2829,14 +2826,14 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
28292826
}
28302827

28312828
static bool
2832-
intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
2829+
intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, u16 type)
28332830
{
28342831
struct drm_encoder *encoder = &intel_sdvo->base.base;
28352832
struct drm_connector *connector;
28362833
struct intel_connector *intel_connector;
28372834
struct intel_sdvo_connector *intel_sdvo_connector;
28382835

2839-
DRM_DEBUG_KMS("initialising analog device %d\n", device);
2836+
DRM_DEBUG_KMS("initialising analog type 0x%x\n", type);
28402837

28412838
intel_sdvo_connector = intel_sdvo_connector_alloc();
28422839
if (!intel_sdvo_connector)
@@ -2848,10 +2845,7 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
28482845
encoder->encoder_type = DRM_MODE_ENCODER_DAC;
28492846
connector->connector_type = DRM_MODE_CONNECTOR_VGA;
28502847

2851-
if (device == 0)
2852-
intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB0;
2853-
else if (device == 1)
2854-
intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1;
2848+
intel_sdvo_connector->output_flag = type;
28552849

28562850
if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
28572851
kfree(intel_sdvo_connector);
@@ -2862,15 +2856,15 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
28622856
}
28632857

28642858
static bool
2865-
intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
2859+
intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, u16 type)
28662860
{
28672861
struct drm_encoder *encoder = &intel_sdvo->base.base;
28682862
struct drm_i915_private *i915 = to_i915(encoder->dev);
28692863
struct drm_connector *connector;
28702864
struct intel_connector *intel_connector;
28712865
struct intel_sdvo_connector *intel_sdvo_connector;
28722866

2873-
DRM_DEBUG_KMS("initialising LVDS device %d\n", device);
2867+
DRM_DEBUG_KMS("initialising LVDS type 0x%x\n", type);
28742868

28752869
intel_sdvo_connector = intel_sdvo_connector_alloc();
28762870
if (!intel_sdvo_connector)
@@ -2881,10 +2875,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
28812875
encoder->encoder_type = DRM_MODE_ENCODER_LVDS;
28822876
connector->connector_type = DRM_MODE_CONNECTOR_LVDS;
28832877

2884-
if (device == 0)
2885-
intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS0;
2886-
else if (device == 1)
2887-
intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1;
2878+
intel_sdvo_connector->output_flag = type;
28882879

28892880
if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) {
28902881
kfree(intel_sdvo_connector);
@@ -2959,11 +2950,11 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo)
29592950
intel_sdvo_select_ddc_bus(i915, intel_sdvo);
29602951

29612952
if (flags & SDVO_OUTPUT_TMDS0)
2962-
if (!intel_sdvo_dvi_init(intel_sdvo, 0))
2953+
if (!intel_sdvo_dvi_init(intel_sdvo, SDVO_OUTPUT_TMDS0))
29632954
return false;
29642955

29652956
if (flags & SDVO_OUTPUT_TMDS1)
2966-
if (!intel_sdvo_dvi_init(intel_sdvo, 1))
2957+
if (!intel_sdvo_dvi_init(intel_sdvo, SDVO_OUTPUT_TMDS1))
29672958
return false;
29682959

29692960
/* TV has no XXX1 function block */
@@ -2980,19 +2971,19 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo)
29802971
return false;
29812972

29822973
if (flags & SDVO_OUTPUT_RGB0)
2983-
if (!intel_sdvo_analog_init(intel_sdvo, 0))
2974+
if (!intel_sdvo_analog_init(intel_sdvo, SDVO_OUTPUT_RGB0))
29842975
return false;
29852976

29862977
if (flags & SDVO_OUTPUT_RGB1)
2987-
if (!intel_sdvo_analog_init(intel_sdvo, 1))
2978+
if (!intel_sdvo_analog_init(intel_sdvo, SDVO_OUTPUT_RGB1))
29882979
return false;
29892980

29902981
if (flags & SDVO_OUTPUT_LVDS0)
2991-
if (!intel_sdvo_lvds_init(intel_sdvo, 0))
2982+
if (!intel_sdvo_lvds_init(intel_sdvo, SDVO_OUTPUT_LVDS0))
29922983
return false;
29932984

29942985
if (flags & SDVO_OUTPUT_LVDS1)
2995-
if (!intel_sdvo_lvds_init(intel_sdvo, 1))
2986+
if (!intel_sdvo_lvds_init(intel_sdvo, SDVO_OUTPUT_LVDS1))
29962987
return false;
29972988

29982989
intel_sdvo->base.pipe_mask = ~0;

0 commit comments

Comments
 (0)