From patchwork Wed Dec 20 10:50:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10127189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53CF8603B5 for ; Thu, 21 Dec 2017 09:02:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4750C29B3E for ; Thu, 21 Dec 2017 09:02:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C04E29B43; Thu, 21 Dec 2017 09:02:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 80B5529B3E for ; Thu, 21 Dec 2017 09:02:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 19CAD6E5B5; Thu, 21 Dec 2017 09:00:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A2956E3C3; Wed, 20 Dec 2017 10:50:24 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id f9so8945730wmh.0; Wed, 20 Dec 2017 02:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=iFds08JjYg9VUNyCt7NAB7qSprKhvtClfcnVEvDlO4g=; b=jYx78564XqG5hG0EN+HiQpxShP02SPO3RW/lPBu65VUqnWo8lHS893JYGI0r8dv/FP wbfOnFWIlc3L16MDoYAahQJ3moOA30ngYIK4gLF6EJwXmJ+ylBf43HdRYQnz+Pc3FtmH Ui1t99EV0ep4EGpY7ByNC8e8gUgdCcNcNNvv7TCEuG1niI9XMxU2hNsM57DTrtSQG5pI OrvWojGkHb1Ple9/Tr/hQmjxzOGiVvi2vSp6Klf04Aqb2TJKKUPzG828CHxZnpBg2zU7 Mn7Ga2XoNbJGw40xrjONr1Z/AQC/67+1Z/3uP9/kK6VIk6rhuViVK5YIE1sFzuAIiLVw jBaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iFds08JjYg9VUNyCt7NAB7qSprKhvtClfcnVEvDlO4g=; b=umpxRoagDvmzfft/6jCTcayOMNdzJC+FQbHeP8yGyBKfpct3dj3KR28X5NiGTw+gjg kITCO3Jw4OLz+c0DN1QaD8lhssrAGcA/gELTjwcjirVeGgAB0yvGNhUSmWxlfxecWa4p J7tWYjm2mHlZlh8IiuT2/ZAK1PPb+M+rEZeqBKTLgvHG9DVMv1I6AQB8x7vf8QxG9YMB 6ojCuTYCVYnTBYNXEy55rFrb6pUvr8OseOa9GixUe1YZI3j7rrMC+48Fzs85bXw7Y9PI hn1rWwold56qyHXH95hL7foTWeuiH34F9f7W1wNMN2lqRb/wTMoqvCHmBYt8xrLDNzdj gxtg== X-Gm-Message-State: AKGB3mL+xjuhIui1zDlKxArXftNEj/zvcwqghc4sCieU66OHcuAnY6q7 WLEFjKZjSG1/De6H1ZP88rI= X-Google-Smtp-Source: ACJfBotZZo8itYxZf3pH6WeIgoCcfYxvBD8uY3the/1rZFnVQR8zCaqRIkOmc8zvORiZMSbE3XalNw== X-Received: by 10.28.37.3 with SMTP id l3mr6217824wml.66.1513767023629; Wed, 20 Dec 2017 02:50:23 -0800 (PST) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id 2sm4266594wmk.28.2017.12.20.02.50.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Dec 2017 02:50:21 -0800 (PST) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Subject: [PATCH v2] drm/i915/vlv: Add cdclk workaround for DSI Date: Wed, 20 Dec 2017 11:50:17 +0100 Message-Id: <20171220105017.11259-1-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.3 X-Mailman-Approved-At: Thu, 21 Dec 2017 08:59:57 +0000 Cc: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP At least on the Chuwi Vi8 (non pro/plus) the LCD panel will show an image shifted aprox. 20% to the left (with wraparound) and sometimes also wrong colors, showing that the panel controller is starting with sampling the datastream somewhere mid-line. This happens after the first blanking and re-init of the panel. After looking at drm.debug output I noticed that initially we inherit the cdclk of 333333 KHz set by the GOP, but after the re-init we picked 266667 KHz, which turns out to be the cause of this problem, a quick hack to hard code the cdclk to 333333 KHz makes the problem go away. I've tested this on various Bay Trail devices, to make sure this not causes regressions on other devices and the higher cdclk does not cause any problems on the following devices: -GP-electronic T701 1024x600 333333 KHz cdclk after this patch -PEAQ C1010 1920x1200 333333 KHz cdclk after this patch -PoV mobii-wintab-800w 800x1280 333333 KHz cdclk after this patch -Asus Transformer-T100TA 1368x768 320000 KHz cdclk after this patch Also interesting wrt this is the comment in vlv_calc_cdclk about the existing workaround to avoid 200 Mhz as clock because that causes issues in some cases. This commit extends the "do not use 200 Mhz" workaround with an extra check to require atleast 320000 KHz (avoiding 266667 KHz) when a DSI panel is active. Changes in v2: -Change the commit message and the code comment to not treat the GOP as a reference, the GOP should not be treated as a reference Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/intel_cdclk.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c index 9c5ceb98d48f..a15976f55f47 100644 --- a/drivers/gpu/drm/i915/intel_cdclk.c +++ b/drivers/gpu/drm/i915/intel_cdclk.c @@ -1923,6 +1923,14 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state) if (crtc_state->has_audio && INTEL_GEN(dev_priv) >= 9) min_cdclk = max(2 * 96000, min_cdclk); + /* + * On Valleyview some DSI panels loose (v|h)sync when the clock is lower + * then 320000KHz. + */ + if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DSI) && + IS_VALLEYVIEW(dev_priv)) + min_cdclk = max(320000, min_cdclk); + if (min_cdclk > dev_priv->max_cdclk_freq) { DRM_DEBUG_KMS("required cdclk (%d kHz) exceeds max (%d kHz)\n", min_cdclk, dev_priv->max_cdclk_freq);