[PATCH 5/7] [RFC] drm/amdgpu: drop DVO encoders support.

2016-04-14 Thread Dave Airlie
From: Dave Airlie 

I'm a bit confused whether this is needed so it would be good to
confirm if hw shipped with it.

DAL as currently is doesn't have any support for this, it doesn't
have any encoder ids for DVO that I can see.

So before porting to DAL graphics objects, I'm removing this code,
so we can see if any regressions land here.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/amd/amdgpu/atombios_crtc.c |   3 -
 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c | 100 -
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c |   8 --
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c |   8 --
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  |   8 --
 5 files changed, 127 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c 
b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
index 49aa350..072a729 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
@@ -344,9 +344,6 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct drm_crtc 
*crtc,
}
}

-   /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
-   if (amdgpu_encoder->encoder_id == 
ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
-   adjusted_clock = mode->clock * 2;
if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
amdgpu_crtc->pll_flags |= AMDGPU_PLL_PREFER_CLOSEST_LOWER;
if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c 
b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
index 4367941..7ef93c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
@@ -272,7 +272,6 @@ bool amdgpu_atombios_encoder_is_digital(struct drm_encoder 
*encoder)
 {
struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
switch (amdgpu_encoder->encoder_id) {
-   case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
@@ -369,79 +368,8 @@ static u8 amdgpu_atombios_encoder_get_bpc(struct 
drm_encoder *encoder)
}
 }

-union dvo_encoder_control {
-   ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION ext_tmds;
-   DVO_ENCODER_CONTROL_PS_ALLOCATION dvo;
-   DVO_ENCODER_CONTROL_PS_ALLOCATION_V3 dvo_v3;
-   DVO_ENCODER_CONTROL_PS_ALLOCATION_V1_4 dvo_v4;
-};
-
-static void
-amdgpu_atombios_encoder_setup_dvo(struct drm_encoder *encoder, int action)
-{
-   struct drm_device *dev = encoder->dev;
-   struct amdgpu_device *adev = dev->dev_private;
-   struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
-   union dvo_encoder_control args;
-   int index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl);
-   uint8_t frev, crev;
-
-   memset(, 0, sizeof(args));
-
-   if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, 
, ))
-   return;
-
-   switch (frev) {
-   case 1:
-   switch (crev) {
-   case 1:
-   /* R4xx, R5xx */
-   args.ext_tmds.sXTmdsEncoder.ucEnable = action;
-
-   if (amdgpu_dig_monitor_is_duallink(encoder, 
amdgpu_encoder->pixel_clock))
-   args.ext_tmds.sXTmdsEncoder.ucMisc |= 
PANEL_ENCODER_MISC_DUAL;
-
-   args.ext_tmds.sXTmdsEncoder.ucMisc |= 
ATOM_PANEL_MISC_888RGB;
-   break;
-   case 2:
-   /* RS600/690/740 */
-   args.dvo.sDVOEncoder.ucAction = action;
-   args.dvo.sDVOEncoder.usPixelClock = 
cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
-   /* DFP1, CRT1, TV1 depending on the type of port */
-   args.dvo.sDVOEncoder.ucDeviceType = 
ATOM_DEVICE_DFP1_INDEX;
-
-   if (amdgpu_dig_monitor_is_duallink(encoder, 
amdgpu_encoder->pixel_clock))
-   
args.dvo.sDVOEncoder.usDevAttr.sDigAttrib.ucAttribute |= 
PANEL_ENCODER_MISC_DUAL;
-   break;
-   case 3:
-   /* R6xx */
-   args.dvo_v3.ucAction = action;
-   args.dvo_v3.usPixelClock = 
cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
-   args.dvo_v3.ucDVOConfig = 0; /* XXX */
-   break;
-   case 4:
-   /* DCE8 */
-   args.dvo_v4.ucAction = action;
-   args.dvo_v4.usPixelClock = 
cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
-   args.dvo_v4.ucDVOConfig = 0; /* XXX */
-   args.dvo_v4.ucBitPerColor = 
amdgpu_atombios_encoder_get_bpc(encoder);
-   break;
-   default:
- 

[PATCH 5/7] [RFC] drm/amdgpu: drop DVO encoders support.

2016-04-14 Thread Harry Wentland
DVO was mainly used for crossfire pre-DCE 8, and possibly on some DCE 8 
(Tonga) SKUs as well. On newer ASICs crossfire uses XDMA so there's no 
longer a need for DVO.

It's probably safe to drop it for amdgpu. Radeon driver might still want 
to keep it if there's support for it.

Harry


On 2016-04-13 10:56 PM, Dave Airlie wrote:
> From: Dave Airlie 
>
> I'm a bit confused whether this is needed so it would be good to
> confirm if hw shipped with it.
>
> DAL as currently is doesn't have any support for this, it doesn't
> have any encoder ids for DVO that I can see.
>
> So before porting to DAL graphics objects, I'm removing this code,
> so we can see if any regressions land here.
>
> Signed-off-by: Dave Airlie 
> ---
>   drivers/gpu/drm/amd/amdgpu/atombios_crtc.c |   3 -
>   drivers/gpu/drm/amd/amdgpu/atombios_encoders.c | 100 
> -
>   drivers/gpu/drm/amd/amdgpu/dce_v10_0.c |   8 --
>   drivers/gpu/drm/amd/amdgpu/dce_v11_0.c |   8 --
>   drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  |   8 --
>   5 files changed, 127 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c 
> b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> index 49aa350..072a729 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_crtc.c
> @@ -344,9 +344,6 @@ static u32 amdgpu_atombios_crtc_adjust_pll(struct 
> drm_crtc *crtc,
>   }
>   }
>   
> - /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
> - if (amdgpu_encoder->encoder_id == 
> ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
> - adjusted_clock = mode->clock * 2;
>   if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
>   amdgpu_crtc->pll_flags |= AMDGPU_PLL_PREFER_CLOSEST_LOWER;
>   if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c 
> b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
> index 4367941..7ef93c6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c
> @@ -272,7 +272,6 @@ bool amdgpu_atombios_encoder_is_digital(struct 
> drm_encoder *encoder)
>   {
>   struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
>   switch (amdgpu_encoder->encoder_id) {
> - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
>   case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
>   case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
>   case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
> @@ -369,79 +368,8 @@ static u8 amdgpu_atombios_encoder_get_bpc(struct 
> drm_encoder *encoder)
>   }
>   }
>   
> -union dvo_encoder_control {
> - ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION ext_tmds;
> - DVO_ENCODER_CONTROL_PS_ALLOCATION dvo;
> - DVO_ENCODER_CONTROL_PS_ALLOCATION_V3 dvo_v3;
> - DVO_ENCODER_CONTROL_PS_ALLOCATION_V1_4 dvo_v4;
> -};
> -
> -static void
> -amdgpu_atombios_encoder_setup_dvo(struct drm_encoder *encoder, int action)
> -{
> - struct drm_device *dev = encoder->dev;
> - struct amdgpu_device *adev = dev->dev_private;
> - struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
> - union dvo_encoder_control args;
> - int index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl);
> - uint8_t frev, crev;
> -
> - memset(, 0, sizeof(args));
> -
> - if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, 
> , ))
> - return;
> -
> - switch (frev) {
> - case 1:
> - switch (crev) {
> - case 1:
> - /* R4xx, R5xx */
> - args.ext_tmds.sXTmdsEncoder.ucEnable = action;
> -
> - if (amdgpu_dig_monitor_is_duallink(encoder, 
> amdgpu_encoder->pixel_clock))
> - args.ext_tmds.sXTmdsEncoder.ucMisc |= 
> PANEL_ENCODER_MISC_DUAL;
> -
> - args.ext_tmds.sXTmdsEncoder.ucMisc |= 
> ATOM_PANEL_MISC_888RGB;
> - break;
> - case 2:
> - /* RS600/690/740 */
> - args.dvo.sDVOEncoder.ucAction = action;
> - args.dvo.sDVOEncoder.usPixelClock = 
> cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
> - /* DFP1, CRT1, TV1 depending on the type of port */
> - args.dvo.sDVOEncoder.ucDeviceType = 
> ATOM_DEVICE_DFP1_INDEX;
> -
> - if (amdgpu_dig_monitor_is_duallink(encoder, 
> amdgpu_encoder->pixel_clock))
> - 
> args.dvo.sDVOEncoder.usDevAttr.sDigAttrib.ucAttribute |= 
> PANEL_ENCODER_MISC_DUAL;
> - break;
> - case 3:
> - /* R6xx */
> - args.dvo_v3.ucAction = action;
> - args.dvo_v3.usPixelClock = 
> cpu_to_le16(amdgpu_encoder->pixel_clock / 10);
> - args.dvo_v3.ucDVOConfig = 0; /* XXX */
> -