From patchwork Wed Jul 9 22:13:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 4520021 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EAE66BEEAA for ; Wed, 9 Jul 2014 22:13:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0ED22037A for ; Wed, 9 Jul 2014 22:13:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9911E201DE for ; Wed, 9 Jul 2014 22:13:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6102B6E054; Wed, 9 Jul 2014 15:13:13 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx-out-1.rwth-aachen.de (mx-out-1.rwth-aachen.de [134.130.5.186]) by gabe.freedesktop.org (Postfix) with ESMTP id 448F16E054 for ; Wed, 9 Jul 2014 15:13:11 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.01,634,1400018400"; d="scan'208";a="339398837" Received: from hub2.rwth-ad.de (HELO mail.rwth-aachen.de) ([134.130.26.143]) by mx-1.rz.rwth-aachen.de with ESMTP; 10 Jul 2014 00:13:09 +0200 Received: from pebbles.site (78.53.179.27) by mail.rwth-aachen.de (134.130.26.143) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 10 Jul 2014 00:13:09 +0200 From: Stefan Bruens To: Subject: [PATCH] drm/radeon: add HDMI/DP sink description to ELD like data Date: Thu, 10 Jul 2014 00:13:10 +0200 Message-ID: <10657816.3D9ldDOIuB@pebbles.site> User-Agent: KMail/4.13.2 (Linux/3.16.0-rc2-1.g37599aa-desktop; KDE/4.13.2; x86_64; ; ) MIME-Version: 1.0 X-PMWin-Version: 3.1.1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Provide monitor name and product/manufacturer id to alsa hda driver. The output matches the fglrx settings, short of the port_id. As the latter is not standardized, leave it out for now. Corresponding alsa code is already in place. Signed-off-by: Stefan BrĂ¼ns --- The fglrx register settings where retrieved using Rafal Mileckis gdb script. After applying the patch fglrx and radeon register settings for sink info match, short of the port_id. Regarding port id, see comment by Takashi Iwai, 14 Nov 2013: http://www.spinics.net/linux/fedora/alsa-user/msg12453.html and RFC by Stephen Warren (NVidia), 25 May 2011: http://lists.freedesktop.org/pipermail/xorg/2011-May/052893.html drivers/gpu/drm/radeon/dce6_afmt.c | 67 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/radeon/evergreen_hdmi.c | 2 + 2 files changed, 69 insertions(+) diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 0a65dc7..1adf95a 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c @@ -273,6 +273,73 @@ void dce6_afmt_write_sad_regs(struct drm_encoder *encoder) kfree(sads); } +void dce6_afmt_write_sinkinfo(struct drm_encoder *encoder) +{ + struct radeon_device *rdev = encoder->dev->dev_private; + struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); + struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; + struct drm_connector *connector; + u32 tmp = 0, offset; + char description[18]; + uint8_t *eld; + + if (!dig || !dig->afmt || !dig->afmt->pin) + return; + + offset = dig->afmt->pin->offset; + + list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { + if (connector->encoder == encoder) + break; + } + + if (!connector) { + DRM_ERROR("Couldn't find encoder's connector\n"); + return; + } + + if (!connector->eld[0]) { + DRM_ERROR("Connector has no ELD\n"); + return; + } + + eld = connector->eld; + + tmp = MANUFACTURER_ID(eld[16]<<8 | eld[17]) | PRODUCT_ID(eld[18]<<8 | eld[19]); + WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO0, tmp); + + tmp = SINK_DESCRIPTION_LEN(strlen(&eld[20])) + 1; + tmp = (tmp > 19) ? 19 : tmp; + WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO1, tmp); + + strncpy(description, &eld[20], 18); + + tmp = PORT_ID0(0x1); + //WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO2, tmp); + + tmp = PORT_ID1(0x100); + //WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO3, tmp); + + tmp = DESCRIPTION0(description[0]) | DESCRIPTION1(description[1]) | + DESCRIPTION2(description[2]) | DESCRIPTION3(description[3]); + WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO4, tmp); + + tmp = DESCRIPTION4(description[4]) | DESCRIPTION5(description[5]) | + DESCRIPTION6(description[6]) | DESCRIPTION7(description[7]); + WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO5, tmp); + + tmp = DESCRIPTION8(description[8]) | DESCRIPTION9(description[9]) | + DESCRIPTION10(description[10]) | DESCRIPTION11(description[11]); + WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO6, tmp); + + tmp = DESCRIPTION12(description[12]) | DESCRIPTION13(description[13]) | + DESCRIPTION14(description[14]) | DESCRIPTION15(description[15]); + WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO7, tmp); + + tmp = DESCRIPTION16(description[16]) | DESCRIPTION17(description[17]); + WREG32_ENDPOINT(offset, AZ_F0_CODEC_PIN_CONTROL_SINK_INFO8, tmp); +} + static int dce6_audio_chipset_supported(struct radeon_device *rdev) { return !ASIC_IS_NODCE(rdev); diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 1ec0e6e..b04ec3b 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c @@ -37,6 +37,7 @@ extern void dce6_afmt_write_sad_regs(struct drm_encoder *encoder); extern void dce6_afmt_select_pin(struct drm_encoder *encoder); extern void dce6_afmt_write_latency_fields(struct drm_encoder *encoder, struct drm_display_mode *mode); +extern void dce6_afmt_write_sinkinfo(struct drm_encoder *encoder); /* * update the N and CTS parameters for a given pixel clock rate @@ -425,6 +426,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode dce6_afmt_select_pin(encoder); dce6_afmt_write_sad_regs(encoder); dce6_afmt_write_latency_fields(encoder, mode); + dce6_afmt_write_sinkinfo(encoder); } else { evergreen_hdmi_write_sad_regs(encoder); dce4_afmt_write_latency_fields(encoder, mode);