From patchwork Tue Dec 19 19:21:13 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: 10123973 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 775C060390 for ; Tue, 19 Dec 2017 19:21:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A37328912 for ; Tue, 19 Dec 2017 19:21:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EE842951E; Tue, 19 Dec 2017 19:21:23 +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=ham 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 DC65128912 for ; Tue, 19 Dec 2017 19:21:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EFE16E323; Tue, 19 Dec 2017 19:21:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F15D6E323; Tue, 19 Dec 2017 19:21:20 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id n138so5776776wmg.2; Tue, 19 Dec 2017 11:21:20 -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=jJHbHODaxoiYiHkVrJFJnnrmnE9ZFL637BGfXwD0Vh0=; b=UffwnAz6NRTMUXrysrQ1FmrGQnjZtv0UuxD74gO/nXYFUTnJ25Ls7ytAtCm8iZOKMW zJZ6/bBgb2UnYdKnpqmLlL/ENQ5n2/DqxsM3G1JlVTnFmkQhvo8e2+55Q6cYwZkpbZ1k uI8RATSZaK8MsHrbFgWDTPro77tovk5dQeMp+AOZKmb3fNoSQzDHvV+xQI15MIb+HV/u gfcgo3Kv4CCfQtiBK+vWwUsxBhEtjmNnT5E8HlbzbTtX7mNkRHgPVnJtP/dclIqUTKzH oD2LqegoFd44lVuxu8/eD3FfMcd4glWsbHXzQEtA5MeMBi3i7Q7evp11QkuR2NzUtW/R gadQ== 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=jJHbHODaxoiYiHkVrJFJnnrmnE9ZFL637BGfXwD0Vh0=; b=KURxZu6w6W67BQsQ9LgIt0YUAwlTjjiu1Jadp6ucDAq12qEJ44XTzpa/KNXMEqCPZu Ih62JrflRwe7Ge3JXJBT5lofhWL5mjNsL76+f+E8/JWBxx3TTQAcrXL+t1vT1G+dOYHJ hxNqfkZ2VfCeSOB4ZMqP3tmlCDTd8y+gq52xElttLp4ECSD4WGU7gKvxG9aBsNFRxIw2 JTfStG0BuPyUuJq8ltvu1lYcDM9EBvXmsRCVi7D7dRq/WWxy4shnFM2cYFxJEwXhAz6f dB0VoJsZNyD8Cu0fr6euMey6SodZ3Yw/SsxVucefcB0Mji+X+5WCCrLq2ADj/GuKd2cM 7Hlg== X-Gm-Message-State: AKGB3mKYWixQSs/gqxkRGECP97FW/h9Sl0+o9OpKFFePZZLXvtVgoDjl MVCCHY16pZ7bsTSPCWUXePA= X-Google-Smtp-Source: ACJfBotzygo+bamRx8zNDD3kIU11+DAI+mX6/90VZ8cSLwZZ7pcM6z5YnVgjQ1rFVcZv+Udw3mVVUQ== X-Received: by 10.80.177.250 with SMTP id n55mr2031061edd.30.1513711278878; Tue, 19 Dec 2017 11:21:18 -0800 (PST) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id v20sm14631533edm.10.2017.12.19.11.21.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Dec 2017 11:21:18 -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?= Date: Tue, 19 Dec 2017 20:21:13 +0100 Message-Id: <20171219192113.12841-1-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.3 Cc: Hans de Goede , intel-gfx , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] drm/i915/vlv: Add cdclk workaround for DSI X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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: -Chuwi Vi8: 800x1280, 333333 at boot, requires 333333 to work properly -GP-electronic T701: 1024x600, 333333 at boot, works fine with 333333 -PEAQ C1010: 1920x1200, 333333 at boot, works fine with 333333 -PoV mobii-wintab-800w: 800x1280, 333333 at boot, works fine with 333333 -Asus Transformer-T100TA: 1368x768, 320000 at boot, works fine with 320000 So it seems that the GOP is always using what vlv_calc_cdclk calls freq_320 as cdclk clock. Also note the comment in vlv_calc_cdclk about it avoiding 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. 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..cfb3f7fb3e1c 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 the GOP always uses 320000/333333 KHz if DSI is used, + * using a lower clock causes causes sync issues with some panels. + */ + 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);