From patchwork Tue Nov 12 17:59:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Torsten Duwe X-Patchwork-Id: 11239955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 992AA1515 for ; Tue, 12 Nov 2019 17:59:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8085F21925 for ; Tue, 12 Nov 2019 17:59:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8085F21925 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6452C6EBA0; Tue, 12 Nov 2019 17:59:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by gabe.freedesktop.org (Postfix) with ESMTPS id B05A46EBA0 for ; Tue, 12 Nov 2019 17:59:44 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2005) id DB8AF68BE1; Tue, 12 Nov 2019 18:59:40 +0100 (CET) Date: Tue, 12 Nov 2019 18:59:40 +0100 From: Torsten Duwe To: Maxime Ripard Subject: [PATCH] drm/bridge: fix anx6345 compilation for v5.5 Message-ID: <20191112175940.GA13539@lst.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, David Airlie , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Vasily Khoruzhick , Chen-Yu Tsai , Rob Herring , Thierry Reding , Laurent Pinchart , Harald Geyer , Sean Paul , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Icenowy Zheng Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The anx6345 driver originally was copied from anx78xx.c, which has meanwhile seen a few changes. In particular, the removal of drm_dp_link helpers and the discontinuation to include drm_bridge.h from drm_crtc.h breaks compilation in linux-5.5. Apply equivalents of these changes to anx6345.c. Signed-off-by: Torsten Duwe --- The commits in question are ff1e8fb68ea06 and ee68c743f8d07, but I guess the next rebase will change these. next-20191112 plus the anx6345-v5a series plus this patch compile cleanly on arm64. --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -49,7 +50,6 @@ struct anx6345 { struct i2c_client *client; struct edid *edid; struct drm_connector connector; - struct drm_dp_link link; struct drm_panel *panel; struct regulator *dvdd12; struct regulator *dvdd25; @@ -96,7 +96,7 @@ static ssize_t anx6345_aux_transfer(stru static int anx6345_dp_link_training(struct anx6345 *anx6345) { unsigned int value; - u8 dp_bw; + u8 dp_bw, dpcd[2]; int err; err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM], @@ -144,18 +143,34 @@ static int anx6345_dp_link_training(stru if (err) return err; - /* Check link capabilities */ - err = drm_dp_link_probe(&anx6345->aux, &anx6345->link); - if (err < 0) { - DRM_ERROR("Failed to probe link capabilities: %d\n", err); - return err; - } + /* + * Power up the sink (DP_SET_POWER register is only available on DPCD + * v1.1 and later). + */ + if (anx6345->dpcd[DP_DPCD_REV] >= 0x11) { + err = drm_dp_dpcd_readb(&anx6345->aux, DP_SET_POWER, &dpcd[0]); + if (err < 0) { + DRM_ERROR("Failed to read DP_SET_POWER register: %d\n", + err); + return err; + } + + dpcd[0] &= ~DP_SET_POWER_MASK; + dpcd[0] |= DP_SET_POWER_D0; + + err = drm_dp_dpcd_writeb(&anx6345->aux, DP_SET_POWER, dpcd[0]); + if (err < 0) { + DRM_ERROR("Failed to power up DisplayPort link: %d\n", + err); + return err; + } - /* Power up the sink */ - err = drm_dp_link_power_up(&anx6345->aux, &anx6345->link); - if (err < 0) { - DRM_ERROR("Failed to power up DisplayPort link: %d\n", err); - return err; + /* + * According to the DP 1.1 specification, a "Sink Device must + * exit the power saving state within 1 ms" (Section 2.5.3.1, + * Table 5-52, "Sink Control Field" (register 0x600). + */ + usleep_range(1000, 2000); } /* Possibly enable downspread on the sink */ @@ -194,20 +209,28 @@ static int anx6345_dp_link_training(stru if (err) return err; - value = drm_dp_link_rate_to_bw_code(anx6345->link.rate); + dpcd[0] = drm_dp_max_link_rate(anx6345->dpcd); + dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]); err = regmap_write(anx6345->map[I2C_IDX_DPTX], - SP_DP_MAIN_LINK_BW_SET_REG, value); + SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]); if (err) return err; + dpcd[1] = drm_dp_max_lane_count(anx6345->dpcd); + err = regmap_write(anx6345->map[I2C_IDX_DPTX], - SP_DP_LANE_COUNT_SET_REG, anx6345->link.num_lanes); + SP_DP_LANE_COUNT_SET_REG, dpcd[1]); if (err) return err; - err = drm_dp_link_configure(&anx6345->aux, &anx6345->link); + if (drm_dp_enhanced_frame_cap(anx6345->dpcd)) + dpcd[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; + + err = drm_dp_dpcd_write(&anx6345->aux, DP_LINK_BW_SET, dpcd, + sizeof(dpcd)); + if (err < 0) { - DRM_ERROR("Failed to configure DisplayPort link: %d\n", err); + DRM_ERROR("Failed to configure link: %d\n", err); return err; }