From patchwork Fri Sep 1 09:36:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111473 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp785778qge; Fri, 1 Sep 2017 02:37:24 -0700 (PDT) X-Received: by 10.98.149.142 with SMTP id c14mr1580297pfk.113.1504258644811; Fri, 01 Sep 2017 02:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258644; cv=none; d=google.com; s=arc-20160816; b=v87jssqBgtygclweX7+7o/mZkG0nJf+nxdF0EU/FWq7kdVayPS4hlMFGD1ndFqcE9E hUzXbY4pP3fjALaItJyFlbuR4f5cfHwDg1CdG6K9Q62y7aR8WWFxCg14kyf1m7bkwDW6 F3wufqEAFt3T1MTHVE0u6aeC4AeWjhVx5xqm2hvH4XFpVM9AhveQ4jdWAoK+QSq8S0fb 1yVwSp3AuyM6pk4e9YDA/yEa48kbEiFQFtm5vH1g5gF0vk/x2t5T6WW4yigC8Q2dVESA WqSrpMOVES/sdCaHQ5srxmgp1e/3xogBcwTUgfZd77ytTqazSgxgt/lEOfFc5YEUUmUW /Oew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=4yOck1Znw+3nPYSwlaXyXU9djU8QtyrUWMUYOBoVFp0=; b=qHDEg2QR9rp1opBlLAk8mc1K49jEmZ3bU9xSDxWchTtg8UJV4KYPLZM79BS0lNTU7e 00cjzL3eCahRefhQTYdJKCkv985X1JW67mNKXEhJfptb9FrcbBwa0HIjHAo0lwuKHEsD cZJlUEzSME+NPbOFZ7RxWAK4R3+zyNPQCmtZ7Pbw2rcuI7O5t7nhO04xmhR+XuwmRe2m j00m1MjsQiF8quv3Y5gIa2CtXkMBONZaDwoNoZTPpXTe1PN4Jz/B/LTFKnzqrsPhXh6J FDYmUFV/IlvrnQsGaO5NCqBP+F9qcQN1MQ1nA0z8H5JVVcM6Ocq9hkoThupEOqsa6+bj a1lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=a6neJDoB; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 7si1500737pll.390.2017.09.01.02.37.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:37:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=a6neJDoB; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 78F756E7FA; Fri, 1 Sep 2017 09:36:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id BAF086E800 for ; Fri, 1 Sep 2017 09:36:51 +0000 (UTC) Received: by mail-lf0-x22e.google.com with SMTP id g18so7317336lfl.2 for ; Fri, 01 Sep 2017 02:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=O2U6t/HjF5blUWev0EAU4Z0hQW6rTj0m4uGm6kZEpqw=; b=a6neJDoBnXsgxVw94VgAwed9LPPs5kg00s02IRkv7mCfin0UvJOJJ7myQcS00oIpI5 jjVLzR7R6cmUW1M58V9kd2ar0G4FSdg/uvwyh4lO/Fk3MrVJXG5Ft3lU2ofB0ZUfBTy1 A0VVQUhkoCfTONBglhZkQMh8ir9iX2KiWY+Rk= 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:in-reply-to :references; bh=O2U6t/HjF5blUWev0EAU4Z0hQW6rTj0m4uGm6kZEpqw=; b=iSOrM8/2qJQ5FJhIkWAyJxTI74YZWwGPpUSR6WagFpQRGxMMqb0SA93iprISw28nka GOZwxKX8r5JjLKhKqSXTYKGH78EN6hSameKHYYGU+T7/Af3eJOLsUCoN8ExKMWFail/L 3herqs7izgNB4hEaMTUcs7wzkrPVcsbaKOlFx8Zmr6nmRVQ+PSgFsJ8s6chPSD6mrjdV yKjm6L4NoQlLJhPprNixCbCLO6FIb3Tm4pavaV3p2Ijr7kJ0amxQ4EHrE12Q9S8YSrbz K5PnV+BUwVn05w+e+BsuVsVpBAj538oqBdJfJdrcF1kT1/TPa+JwhflI8P8oEsScOVQj UYsg== X-Gm-Message-State: AHPjjUiK6Se8aZZhEzHi6hxNalIEQX0nM7lOXZkSHPZHPyH5nVz1i9iZ N66nQTCvfgM7Ui75 X-Google-Smtp-Source: ADKCNb7zJn9N2vqN6qTmfzNO232O6cd2sxaqZb6IKR9Q2NwQYR/jAnAqv7IM+a+NDLuqLXhhmxWsYQ== X-Received: by 10.25.143.209 with SMTP id s78mr627328lfk.133.1504258610129; Fri, 01 Sep 2017 02:36:50 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18sm328588ljd.85.2017.09.01.02.36.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:36:49 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 1/7 v2] drm/pl111: Cleanup local header file Date: Fri, 1 Sep 2017 11:36:31 +0200 Message-Id: <20170901093637.4041-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170901093637.4041-1-linus.walleij@linaro.org> References: <20170901093637.4041-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, 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" The header file contains prototypes for two nonexisting functions. Get rid of them. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Collect Eric's ACK. --- drivers/gpu/drm/pl111/pl111_drm.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index 5c685bfc8fdc..a97f303f6833 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -58,10 +58,6 @@ int pl111_enable_vblank(struct drm_device *drm, unsigned int crtc); void pl111_disable_vblank(struct drm_device *drm, unsigned int crtc); irqreturn_t pl111_irq(int irq, void *data); int pl111_connector_init(struct drm_device *dev); -int pl111_encoder_init(struct drm_device *dev); -int pl111_dumb_create(struct drm_file *file_priv, - struct drm_device *dev, - struct drm_mode_create_dumb *args); int pl111_debugfs_init(struct drm_minor *minor); #endif /* _PL111_DRM_H_ */ From patchwork Fri Sep 1 09:36:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111468 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp785377qge; Fri, 1 Sep 2017 02:36:56 -0700 (PDT) X-Received: by 10.84.131.15 with SMTP id 15mr1664767pld.210.1504258616492; Fri, 01 Sep 2017 02:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258616; cv=none; d=google.com; s=arc-20160816; b=n2IJW2MgCFxNL/aYQJKQXIcS/4J+vlPKRi2twkHgZFlA5i8QjXCH2j7LM+NUA16J8J xTE7YJ68c2eEx1CindbjZn9Fzv25QWvD0yQiZkmPRmTU+QAXlmcSnkQofbaLpMwPtpfs FG3Qc9iprV1KGE8oFZaxTS5C8lJdyUiRCqAdimGJcT6QQDQAA09QQJgZORrX2/eOQNsd KVmsrh5KF+AdKq6+LMptdTaxdOO7v61wlYb52ia08RSz7/RS8AtlmCrIYIgwQ/AehG2t KV4sqBfUB3XuHg6c4+geGAu+JguJTiuusv+UAUSl0zfrgL2dqYMpRW7eL3PMBauUZqdk 4Cww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=auLuWMXtXZFuWrQ6HtQqsr9ggbwEJZAaHykMeVrLluA=; b=gm+yGLDAWqQnwme0tBZlU6v4QCe8lnZqIEPdcOV4OJ/GrukzUnuYNh0JsZPWi10wvX V62Ncg0uqJ26PhBW450qioqOIR+kD2u3izCstz3VU87JB2vhsrPV1mT4SR/WAUudbr/6 l3b6pJQ5aHjm8/BFn4Kzd0ZPg0Kx1jCfZMHECLFZs3EsRq1iVCfj5fjdlhnbiGNXyk7F FVv72tk6QwiqA42Vk6rF67CELe/88kyTAbxCUiY051NQg+YoXGIZSP8w3xnVtCKV9fzy be6UdiVtnv8Mvyg517iO1XP2bt67lFJSXCjOCE7F8Te+ZoMUACUhl3ST3mnQ2ZUpga7c SJGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fwvNq/0p; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u66si1587479pfd.235.2017.09.01.02.36.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:36:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fwvNq/0p; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36D8F6E7FC; Fri, 1 Sep 2017 09:36:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::230]) by gabe.freedesktop.org (Postfix) with ESMTPS id BADE96E7FC for ; Fri, 1 Sep 2017 09:36:53 +0000 (UTC) Received: by mail-lf0-x230.google.com with SMTP id g18so7317570lfl.2 for ; Fri, 01 Sep 2017 02:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cXy1oF1AprNP6ktzrUDX7HRtgX2oaByCgKqDSkMSkQg=; b=fwvNq/0pTxdAB6U7QybeX77HjGW8Ge4/KEE+L+lVBuD15w8ZQLhXCOr8i+gv5ARafH VfbIqo/2xkAHeOYmrYZ5nH4IoYGyU7DjoZEhPaZ2mCIVQC3SXw0TBnDJO868VRZvSXRQ CW+UXcayQltwH5WrsgKtKfC6tCpM6d+mRrHuo= 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:in-reply-to :references; bh=cXy1oF1AprNP6ktzrUDX7HRtgX2oaByCgKqDSkMSkQg=; b=ktcZkpsjcEI//U5vyrtyXmSBwCXAqukugmb+4m4G1RzduBvq7jRwaaAVtVncB9ks3S Q26PE6bczuzgVRKXt7xH/dOHj0uvlLI8CfrHb5moZN8qNTgljQJFnL3okgV9ukIcHqGJ X4+kt1Q/bH+neW5q3kwpEiCxqtF96H+6kKWxQkjqlZZFoy6xOgt8sKEU7q7xBFVvqWiv Txc/8i/CLxC1TALxrVMpChzOX2DnZExiuhnvOBpWlgSzD7ZKU6RBw5GSy7Ho8UAF/HFk krWham/JBPx8RoFYozfitESChSHM3v9msATOjo25b91FI6QINfRDRBQnMxJRdykZBOUO jcZg== X-Gm-Message-State: AHPjjUjE0uuq3Nbn2y7/GdIkVNzoyCoA/tHBoYaK4JAk12hFbYO6GiM8 6OraCCDnmYFAGnre X-Google-Smtp-Source: ADKCNb5ciYnWlXSUFo6PJoNHkvdeL4vxhxRLKcLvr2ciDmPHcD8ur3xLWlHSa/8kNg9fg2f3tBzLPg== X-Received: by 10.25.15.34 with SMTP id e34mr610100lfi.217.1504258612168; Fri, 01 Sep 2017 02:36:52 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18sm328588ljd.85.2017.09.01.02.36.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:36:51 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 2/7 v2] drm/pl111: Add all registers to debugfs Date: Fri, 1 Sep 2017 11:36:32 +0200 Message-Id: <20170901093637.4041-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170901093637.4041-1-linus.walleij@linaro.org> References: <20170901093637.4041-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, 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" This adds all the main control registers to the debugfs register file. This was helpful for my debugging so it will likely help others as well. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Collect Eric's ACK. --- drivers/gpu/drm/pl111/pl111_debugfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c b/drivers/gpu/drm/pl111/pl111_debugfs.c index 0d9dee199b2c..7ddc7e3b9e7d 100644 --- a/drivers/gpu/drm/pl111/pl111_debugfs.c +++ b/drivers/gpu/drm/pl111/pl111_debugfs.c @@ -22,8 +22,14 @@ static const struct { REGDEF(CLCD_TIM2), REGDEF(CLCD_TIM3), REGDEF(CLCD_UBAS), + REGDEF(CLCD_LBAS), REGDEF(CLCD_PL111_CNTL), REGDEF(CLCD_PL111_IENB), + REGDEF(CLCD_PL111_RIS), + REGDEF(CLCD_PL111_MIS), + REGDEF(CLCD_PL111_ICR), + REGDEF(CLCD_PL111_UCUR), + REGDEF(CLCD_PL111_LCUR), }; int pl111_debugfs_regs(struct seq_file *m, void *unused) From patchwork Fri Sep 1 09:36:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111469 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp785410qge; Fri, 1 Sep 2017 02:36:58 -0700 (PDT) X-Received: by 10.99.112.20 with SMTP id l20mr1712978pgc.146.1504258618612; Fri, 01 Sep 2017 02:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258618; cv=none; d=google.com; s=arc-20160816; b=ShWGe73szb1ukLY8tAFynPtd7I7A3+l6QUfEwqL8xaWipjKCYnS1aLMgBOaKCWx/Vy lO5MZLjNkyNSxGc+jzaleRkSuvoFy3DLX/bOfl/+AsGGzyWEYqDNjh17P9GAdOkgLw2v 3tdeK/j6a/FT1WeDFvPlIbCDvWsPjEBTN1eUGK5TRStKDvkgTXRZHBv3iXIdKbxt7iM+ dMYUGXRBEnjH4VQllzLoKJcMqJLaVF6CQCPZxKfBHc35PD0MpjYVf0krQb7qnETvFKGH vwjYxKvROOdQLPc6+XPHqoqMo7ElzN8tWZ2obnkWf/5XomAmz8vfqWtLELKhH9XIe10Z /S7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=RFciHtGtbhp2utO2y8ZY+mTvjFHWH5dcE0nMjsmd9kU=; b=pf/0n5OO4iUKO2tzjbITP0hs9r8cIq7dGE0sUDeZ5mdaGdqG/Ce9UPowpqfvpOlHNS o1EU1xTUQ7oM7K9weA4C5hX4hTxmOswq5h8C558uZ9YQW5vF1gYwRE8u9OIlshyn+U8e ZUiJligLY2k2nVZog8adCAoQYUjaA+ToHzXhf/On+bH6mucmjxr+RuNG6kaqc9Ai092P K3wtVxbSUQdklUCDKQiZakqmZZ3bVFwMJmquQ9vKlJW5otiA9suWMcE0IlzoaCzXeu7T ORYOwRzoUAHHQAehtFsb5R5o9NS62nIoaDtrkDbok0DRdbmyWPh4B0kKXe9iVUNQPVB9 HtAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GnhvN1lC; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id b15si1353788plk.231.2017.09.01.02.36.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:36:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GnhvN1lC; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C30716E807; Fri, 1 Sep 2017 09:36:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com [IPv6:2a00:1450:4010:c07::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id EC0556E807 for ; Fri, 1 Sep 2017 09:36:55 +0000 (UTC) Received: by mail-lf0-x233.google.com with SMTP id d17so7315624lfe.1 for ; Fri, 01 Sep 2017 02:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6iPyxDqwcFfmHKeH+rNjrVtYWTxyy42+NYJO47DG1Is=; b=GnhvN1lC2T88trtKDNmiH3E9yCdtDB02B/AyuflVoUUxwpI3uS51fL1iUy7zokr3ZB nw7PV3uEJvRZG8JREVrjQyWRKE3D80ysNwgfCiUx0uRYWizX3hwVNbgkDgDKG+7vLUWG rLN74Twh8cQbqYfHkM16cwbt+nWWN0PQxLPUs= 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:in-reply-to :references; bh=6iPyxDqwcFfmHKeH+rNjrVtYWTxyy42+NYJO47DG1Is=; b=R9QUL+CkyNYJ458U6oUsSIG47LEq9zvab3zpOTJh3YWO1N/fZX308dy6JQ3q5yDw0v DsWrxukB+ksIZABsi7ktq/Ahyj/9Hwrzo/39mttgP/2NJDC6PT1FCYAJMXQLrk+JBzQj PVsWCdSSoGzymQVHgzMe+Qm7T4ILyNcIFp6aBbeGN1UFsMde8HUFpaM0lZj2Bhfd7Ath 2HHWU7eDPwNV/vmsg88tsZiejwiV8iIpDbuAOpPluTc1cW7iwVxOH0f75yS/HbB/Ge1b gV1OUH2bzO46PE5qHGEsfwzcDvDRlApphWlzVL7slc0+B3V+rK4Q0Ug5Y5V4rTLbtvGP 4oOQ== X-Gm-Message-State: AHPjjUjBI2KoxmHxBFu61uYKRZwPTxSDJ49ZCkXT95deuaBViAtxrVIr tY664yX5z3uWPWBy X-Google-Smtp-Source: ADKCNb5mHE7pPYwyN7bRlGSBHXo/uf5Ca/XAvkhO+J1BjJRBkgcoSnNzS6ZbGdmMjWfZALIkfXXH6g== X-Received: by 10.25.23.100 with SMTP id n97mr631907lfi.242.1504258614080; Fri, 01 Sep 2017 02:36:54 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18sm328588ljd.85.2017.09.01.02.36.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:36:53 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 3/7 v2] drm/pl111: Replace custom connector with panel bridge Date: Fri, 1 Sep 2017 11:36:33 +0200 Message-Id: <20170901093637.4041-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170901093637.4041-1-linus.walleij@linaro.org> References: <20170901093637.4041-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, 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" This replaces the custom connector in the PL111 with the panel bridge helper. This works nicely for all standard panels, but since there are several PL11x-based systems that will need to use the dumb VGA connector bridge we use drm_of_find_panel_or_bridge() and make some headroom for dealing with bridges that are not panels as well, and drop a TODO in the code. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Remove the panel [un]prepare() and [en|dis]able() calls from the display driver, since this is now handled by the bridge. --- drivers/gpu/drm/pl111/Kconfig | 3 +- drivers/gpu/drm/pl111/Makefile | 3 +- drivers/gpu/drm/pl111/pl111_connector.c | 127 -------------------------------- drivers/gpu/drm/pl111/pl111_display.c | 16 ++-- drivers/gpu/drm/pl111/pl111_drm.h | 18 ++--- drivers/gpu/drm/pl111/pl111_drv.c | 62 +++++++++++----- 6 files changed, 60 insertions(+), 169 deletions(-) delete mode 100644 drivers/gpu/drm/pl111/pl111_connector.c diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig index bbfba87cd1a8..e5e2abd66491 100644 --- a/drivers/gpu/drm/pl111/Kconfig +++ b/drivers/gpu/drm/pl111/Kconfig @@ -6,7 +6,8 @@ config DRM_PL111 select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER - select DRM_PANEL + select DRM_BRIDGE + select DRM_PANEL_BRIDGE select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE help Choose this option for DRM support for the PL111 CLCD controller. diff --git a/drivers/gpu/drm/pl111/Makefile b/drivers/gpu/drm/pl111/Makefile index 59483d610ef5..c5f8f9684848 100644 --- a/drivers/gpu/drm/pl111/Makefile +++ b/drivers/gpu/drm/pl111/Makefile @@ -1,5 +1,4 @@ -pl111_drm-y += pl111_connector.o \ - pl111_display.o \ +pl111_drm-y += pl111_display.o \ pl111_drv.o pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o diff --git a/drivers/gpu/drm/pl111/pl111_connector.c b/drivers/gpu/drm/pl111/pl111_connector.c deleted file mode 100644 index 3f213d7e7692..000000000000 --- a/drivers/gpu/drm/pl111/pl111_connector.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) COPYRIGHT 2012-2013 ARM Limited. All rights reserved. - * - * Parts of this file were based on sources as follows: - * - * Copyright (c) 2006-2008 Intel Corporation - * Copyright (c) 2007 Dave Airlie - * Copyright (C) 2011 Texas Instruments - * - * This program is free software and is provided to you under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation, and any use by you of this program is subject to the terms of - * such GNU licence. - * - */ - -/** - * pl111_drm_connector.c - * Implementation of the connector functions for PL111 DRM - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "pl111_drm.h" - -static void pl111_connector_destroy(struct drm_connector *connector) -{ - struct pl111_drm_connector *pl111_connector = - to_pl111_connector(connector); - - if (pl111_connector->panel) - drm_panel_detach(pl111_connector->panel); - - drm_connector_unregister(connector); - drm_connector_cleanup(connector); -} - -static enum drm_connector_status pl111_connector_detect(struct drm_connector - *connector, bool force) -{ - struct pl111_drm_connector *pl111_connector = - to_pl111_connector(connector); - - return (pl111_connector->panel ? - connector_status_connected : - connector_status_disconnected); -} - -static int pl111_connector_helper_get_modes(struct drm_connector *connector) -{ - struct pl111_drm_connector *pl111_connector = - to_pl111_connector(connector); - - if (!pl111_connector->panel) - return 0; - - return drm_panel_get_modes(pl111_connector->panel); -} - -const struct drm_connector_funcs connector_funcs = { - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = pl111_connector_destroy, - .detect = pl111_connector_detect, - .dpms = drm_atomic_helper_connector_dpms, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -const struct drm_connector_helper_funcs connector_helper_funcs = { - .get_modes = pl111_connector_helper_get_modes, -}; - -/* Walks the OF graph to find the panel node and then asks DRM to look - * up the panel. - */ -static struct drm_panel *pl111_get_panel(struct device *dev) -{ - struct device_node *endpoint, *panel_node; - struct device_node *np = dev->of_node; - struct drm_panel *panel; - - endpoint = of_graph_get_next_endpoint(np, NULL); - if (!endpoint) { - dev_err(dev, "no endpoint to fetch panel\n"); - return NULL; - } - - /* don't proceed if we have an endpoint but no panel_node tied to it */ - panel_node = of_graph_get_remote_port_parent(endpoint); - of_node_put(endpoint); - if (!panel_node) { - dev_err(dev, "no valid panel node\n"); - return NULL; - } - - panel = of_drm_find_panel(panel_node); - of_node_put(panel_node); - - return panel; -} - -int pl111_connector_init(struct drm_device *dev) -{ - struct pl111_drm_dev_private *priv = dev->dev_private; - struct pl111_drm_connector *pl111_connector = &priv->connector; - struct drm_connector *connector = &pl111_connector->connector; - - drm_connector_init(dev, connector, &connector_funcs, - DRM_MODE_CONNECTOR_DPI); - drm_connector_helper_add(connector, &connector_helper_funcs); - - pl111_connector->panel = pl111_get_panel(dev->dev); - if (pl111_connector->panel) - drm_panel_attach(pl111_connector->panel, connector); - - return 0; -} - diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index c6ca4f1bbd49..59cdb8f49bb1 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -93,7 +92,7 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, struct pl111_drm_dev_private *priv = drm->dev_private; const struct drm_display_mode *mode = &cstate->mode; struct drm_framebuffer *fb = plane->state->fb; - struct drm_connector *connector = &priv->connector.connector; + struct drm_connector *connector = priv->connector; u32 cntl; u32 ppl, hsw, hfp, hbp; u32 lpp, vsw, vfp, vbp; @@ -155,8 +154,6 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, writel(0, priv->regs + CLCD_TIM3); - drm_panel_prepare(priv->connector.panel); - /* Enable and Power Up */ cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDPWR | CNTL_LCDVCOMP(1); @@ -203,8 +200,6 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, writel(cntl, priv->regs + CLCD_PL111_CNTL); - drm_panel_enable(priv->connector.panel); - drm_crtc_vblank_on(crtc); } @@ -216,13 +211,9 @@ void pl111_display_disable(struct drm_simple_display_pipe *pipe) drm_crtc_vblank_off(crtc); - drm_panel_disable(priv->connector.panel); - /* Disable and Power Down */ writel(0, priv->regs + CLCD_PL111_CNTL); - drm_panel_unprepare(priv->connector.panel); - clk_disable_unprepare(priv->clk); } @@ -457,9 +448,12 @@ int pl111_display_init(struct drm_device *drm) ret = drm_simple_display_pipe_init(drm, &priv->pipe, &pl111_display_funcs, formats, ARRAY_SIZE(formats), - &priv->connector.connector); + priv->connector); if (ret) return ret; + /* We need the encoder to attach the bridge */ + priv->encoder = &priv->pipe.encoder; + return 0; } diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index a97f303f6833..8804af0f8997 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -21,21 +21,23 @@ #include #include +#include +#include +#include +#include #include #define CLCD_IRQ_NEXTBASE_UPDATE BIT(2) struct drm_minor; -struct pl111_drm_connector { - struct drm_connector connector; - struct drm_panel *panel; -}; - struct pl111_drm_dev_private { struct drm_device *drm; - struct pl111_drm_connector connector; + struct drm_connector *connector; + struct drm_encoder *encoder; + struct drm_panel *panel; + struct drm_bridge *bridge; struct drm_simple_display_pipe pipe; struct drm_fbdev_cma *fbdev; @@ -50,14 +52,10 @@ struct pl111_drm_dev_private { spinlock_t tim2_lock; }; -#define to_pl111_connector(x) \ - container_of(x, struct pl111_drm_connector, connector) - int pl111_display_init(struct drm_device *dev); int pl111_enable_vblank(struct drm_device *drm, unsigned int crtc); void pl111_disable_vblank(struct drm_device *drm, unsigned int crtc); irqreturn_t pl111_irq(int irq, void *data); -int pl111_connector_init(struct drm_device *dev); int pl111_debugfs_init(struct drm_minor *minor); #endif /* _PL111_DRM_H_ */ diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index ac8771be70b0..e66cbf202e17 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -67,6 +67,9 @@ #include #include #include +#include +#include +#include #include "pl111_drm.h" @@ -82,6 +85,8 @@ static int pl111_modeset_init(struct drm_device *dev) { struct drm_mode_config *mode_config; struct pl111_drm_dev_private *priv = dev->dev_private; + struct drm_panel *panel; + struct drm_bridge *bridge; int ret = 0; drm_mode_config_init(dev); @@ -92,34 +97,46 @@ static int pl111_modeset_init(struct drm_device *dev) mode_config->min_height = 1; mode_config->max_height = 768; - ret = pl111_connector_init(dev); - if (ret) { - dev_err(dev->dev, "Failed to create pl111_drm_connector\n"); - goto out_config; - } - - /* Don't actually attach if we didn't find a drm_panel - * attached to us. This will allow a kernel to include both - * the fbdev pl111 driver and this one, and choose between - * them based on which subsystem has support for the panel. - */ - if (!priv->connector.panel) { - dev_info(dev->dev, - "Disabling due to lack of DRM panel device.\n"); - ret = -ENODEV; - goto out_config; + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, + 0, 0, &panel, &bridge); + if (ret && ret != -ENODEV) + return ret; + if (panel) { + bridge = drm_panel_bridge_add(panel, + DRM_MODE_CONNECTOR_Unknown); + if (IS_ERR(bridge)) { + ret = PTR_ERR(bridge); + goto out_config; + } } ret = pl111_display_init(dev); if (ret != 0) { dev_err(dev->dev, "Failed to init display\n"); - goto out_config; + goto out_bridge; + } + + if (bridge) { + ret = drm_bridge_attach(priv->encoder, bridge, NULL); + if (ret) + goto out_bridge; + } + + /* + * TODO: when we are using a different bridge than a panel + * (such as a dumb VGA connector) we need to devise a different + * method to get the connector out of the bridge. + */ + if (panel) { + priv->panel = panel; + priv->connector = panel->connector; } + priv->bridge = bridge; ret = drm_vblank_init(dev, 1); if (ret != 0) { dev_err(dev->dev, "Failed to init vblank\n"); - goto out_config; + goto out_bridge; } drm_mode_config_reset(dev); @@ -131,6 +148,11 @@ static int pl111_modeset_init(struct drm_device *dev) goto finish; +out_bridge: + if (panel) + drm_panel_bridge_remove(bridge); + else + drm_bridge_remove(bridge); out_config: drm_mode_config_cleanup(dev); finish: @@ -237,6 +259,10 @@ static int pl111_amba_remove(struct amba_device *amba_dev) drm_dev_unregister(drm); if (priv->fbdev) drm_fbdev_cma_fini(priv->fbdev); + if (priv->panel) + drm_panel_bridge_remove(priv->bridge); + else + drm_bridge_remove(priv->bridge); drm_mode_config_cleanup(drm); drm_dev_unref(drm); From patchwork Fri Sep 1 09:36:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111470 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp785437qge; Fri, 1 Sep 2017 02:37:00 -0700 (PDT) X-Received: by 10.99.47.69 with SMTP id v66mr1613263pgv.273.1504258620854; Fri, 01 Sep 2017 02:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258620; cv=none; d=google.com; s=arc-20160816; b=FkLYa65ACnFeRi3pquKOU6qGvMIgpGmL34JKOPGrcE+waD5kXVOHki7CaUT78CYtyP 89/+1nx/ZGfbh1b64IKAJe/UQH6pYcQPzgJCqz+O7ULnqDjzDNz6gU5x3USDU601l/b8 opRro4Mn1hCQi7iWm8y4ZHzJH0myQOGb0bHwIs1btX9QFUmpI/tsraOuMjzmbUitGYQ8 PVviPGSAgXzD3TnJm3w32s0es2uWjfCutEPFaQsio+hjO9my7ApuoF4YgmdXwQxvfcH4 HmZZCCvYx7wmhdi/HsIm0fsf36ZlLtU3kEJmth/2cRqZkoa/uyK/H8kevZrsQJW5zFhE ktmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=wRxpIO+93X461N7py2voszspKCM884A0Oa8wJPSsHhM=; b=MxCpFz1wsXFo+w6k2bhmPDYmKk1f5GUfvKSEHMg7JxbX6RSEBWs/7EpJCC3zKBsqs0 GFw3wv9lLalmSiPkSKlZgWVfAdUy5m0kKlFyQ5B8P/OPytjN4TMvvxgWjFTj6k/HRlyU Aw1sNj89GgSPh7Lpd6orK9HB8amO7gDxKLqNLlj62TYtdakPAJPNK/zPFE8iAmalYG4S BNQeAgG3H+a0A/ebfqtd6O3w7tHR+ApaqEf3lPWB8RwU9wwgD6R11fxssnsn7AmVDbF5 os/H1fvRzKobZ3aFmLosTKRmo6O6CzEgZpMWIXQEwVz4j3U0F67/TX/n4e13J2453yLb Of9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cfewkTcc; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g3si1580904pgp.39.2017.09.01.02.37.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:37:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cfewkTcc; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 778926E80F; Fri, 1 Sep 2017 09:36:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id D93D26E808 for ; Fri, 1 Sep 2017 09:36:57 +0000 (UTC) Received: by mail-lf0-x232.google.com with SMTP id d17so7315848lfe.1 for ; Fri, 01 Sep 2017 02:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hk5e9u7wu0nIZ97flOuE/8XaEygU7rSPh7eDKDZ1gyI=; b=cfewkTccEAq8cT3Bmo+tWC3bY694GSKg/tsFWfQwfxsvHyqXMGTw+UX1EXVXRTcZCV CRiq4QH1yn5MBkt2tpKyAv7DDKOSSOQeeTgbJYX5q6/RekOqa/zzdRf62Qdd7mm2Xzmx 2D9uqamSrp7OSJ2utq5N+EdycjJYMiHQeggwA= 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:in-reply-to :references; bh=hk5e9u7wu0nIZ97flOuE/8XaEygU7rSPh7eDKDZ1gyI=; b=P6c2bkx1iNWebRdq2w894HPyAMrWir0hDwzI9gXuw2LwzShBhPFMSUyVrOqJZInxgk p6jJyDo0xWKXZvj22r9TxHsy+NFPrQzZ5ptw7AwpGBfJ2/kOYzaLIvpqTcQLY1qkm6gA lo1zkM8uLYJe9suEDqYaA2cm2yPhfs0drseNPWaJbX8TIF85ATUtVRpjjoNWgBG1d0tm V/PhD8mQ+1kNulCdH01S/MaCCe8kCmPGcB1or9xHDaXGwfVww954eXCsaIKkPIJxgpcj dSjwQWkMD5Bna3WWKUwhmbcy+kzbULf3GDcSbrrnX+2AXR/MIIQ7ttXYbdph8oiPIP/8 SqBQ== X-Gm-Message-State: AHPjjUjBjiOUzsj+3LCLQj5V5SOdQNieTs9RyWgqs3W3hUtajJ7OMU65 86XyzcKEnbxsqB4+ X-Google-Smtp-Source: ADKCNb493GiNnHVxi0rnRVMucvgPbvnAf9aoODEXgHCR659gG3SpWuQG1qvkRiM1cbs87n8Zv7/AMQ== X-Received: by 10.25.242.72 with SMTP id d8mr532958lfk.185.1504258616044; Fri, 01 Sep 2017 02:36:56 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18sm328588ljd.85.2017.09.01.02.36.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:36:55 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 4/7 v2] drm/pl111: Enable PL110 variant Date: Fri, 1 Sep 2017 11:36:34 +0200 Message-Id: <20170901093637.4041-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170901093637.4041-1-linus.walleij@linaro.org> References: <20170901093637.4041-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, 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" We detect and enable the use of the PL110 variant, an earlier incarnation of PL111. The only real difference is that the control and interrupt enable registers have swapped place. The Versatile AB and Versatile PB have a variant inbetween PL110 and PL111, it is PL110 but they have already swapped the two registers so those two need a bit of special handling. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Fix static const on the variant struct holders. (Had to insert a (void*) cast for this because amba_id is not consting this field) - Collect Eric A's Reviewed-by --- drivers/gpu/drm/pl111/pl111_display.c | 27 +++-------- drivers/gpu/drm/pl111/pl111_drm.h | 17 +++++++ drivers/gpu/drm/pl111/pl111_drv.c | 86 +++++++++++++++++++++++++++++++++-- 3 files changed, 106 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 59cdb8f49bb1..51e3530c876c 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -198,7 +198,7 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, break; } - writel(cntl, priv->regs + CLCD_PL111_CNTL); + writel(cntl, priv->regs + priv->ctrl); drm_crtc_vblank_on(crtc); } @@ -212,7 +212,7 @@ void pl111_display_disable(struct drm_simple_display_pipe *pipe) drm_crtc_vblank_off(crtc); /* Disable and Power Down */ - writel(0, priv->regs + CLCD_PL111_CNTL); + writel(0, priv->regs + priv->ctrl); clk_disable_unprepare(priv->clk); } @@ -250,7 +250,7 @@ int pl111_enable_vblank(struct drm_device *drm, unsigned int crtc) { struct pl111_drm_dev_private *priv = drm->dev_private; - writel(CLCD_IRQ_NEXTBASE_UPDATE, priv->regs + CLCD_PL111_IENB); + writel(CLCD_IRQ_NEXTBASE_UPDATE, priv->regs + priv->ienb); return 0; } @@ -259,7 +259,7 @@ void pl111_disable_vblank(struct drm_device *drm, unsigned int crtc) { struct pl111_drm_dev_private *priv = drm->dev_private; - writel(0, priv->regs + CLCD_PL111_IENB); + writel(0, priv->regs + priv->ienb); } static int pl111_display_prepare_fb(struct drm_simple_display_pipe *pipe, @@ -403,22 +403,6 @@ int pl111_display_init(struct drm_device *drm) struct device_node *endpoint; u32 tft_r0b0g0[3]; int ret; - static const u32 formats[] = { - DRM_FORMAT_ABGR8888, - DRM_FORMAT_XBGR8888, - DRM_FORMAT_ARGB8888, - DRM_FORMAT_XRGB8888, - DRM_FORMAT_BGR565, - DRM_FORMAT_RGB565, - DRM_FORMAT_ABGR1555, - DRM_FORMAT_XBGR1555, - DRM_FORMAT_ARGB1555, - DRM_FORMAT_XRGB1555, - DRM_FORMAT_ABGR4444, - DRM_FORMAT_XBGR4444, - DRM_FORMAT_ARGB4444, - DRM_FORMAT_XRGB4444, - }; endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); if (!endpoint) @@ -447,7 +431,8 @@ int pl111_display_init(struct drm_device *drm) ret = drm_simple_display_pipe_init(drm, &priv->pipe, &pl111_display_funcs, - formats, ARRAY_SIZE(formats), + priv->variant->formats, + priv->variant->nformats, priv->connector); if (ret) return ret; diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index 8804af0f8997..eeaabe735058 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -31,6 +31,20 @@ struct drm_minor; +/** + * struct pl111_variant_data - encodes IP differences + * @name: the name of this variant + * @is_pl110: this is the early PL110 variant + * @formats: array of supported pixel formats on this variant + * @nformats: the length of the array of supported pixel formats + */ +struct pl111_variant_data { + const char *name; + bool is_pl110; + const u32 *formats; + unsigned int nformats; +}; + struct pl111_drm_dev_private { struct drm_device *drm; @@ -42,6 +56,8 @@ struct pl111_drm_dev_private { struct drm_fbdev_cma *fbdev; void *regs; + u32 ienb; + u32 ctrl; /* The pixel clock (a reference to our clock divider off of CLCDCLK). */ struct clk *clk; /* pl111's internal clock divider. */ @@ -50,6 +66,7 @@ struct pl111_drm_dev_private { * subsystem and pl111_display_enable(). */ spinlock_t tim2_lock; + const struct pl111_variant_data *variant; }; int pl111_display_init(struct drm_device *dev); diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index e66cbf202e17..c4a654867ed1 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -206,6 +206,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev, { struct device *dev = &amba_dev->dev; struct pl111_drm_dev_private *priv; + struct pl111_variant_data *variant = id->data; struct drm_device *drm; int ret; @@ -219,6 +220,33 @@ static int pl111_amba_probe(struct amba_device *amba_dev, amba_set_drvdata(amba_dev, drm); priv->drm = drm; drm->dev_private = priv; + priv->variant = variant; + + /* + * The PL110 and PL111 variants have two registers + * swapped: interrupt enable and control. For this reason + * we use offsets that we can change per variant. + */ + if (variant->is_pl110) { + /* + * The ARM Versatile boards are even more special: + * their PrimeCell ID say they are PL110 but the + * control and interrupt enable registers are anyway + * swapped to the PL111 order so they are not following + * the PL110 datasheet. + */ + if (of_machine_is_compatible("arm,versatile-ab") || + of_machine_is_compatible("arm,versatile-pb")) { + priv->ienb = CLCD_PL111_IENB; + priv->ctrl = CLCD_PL111_CNTL; + } else { + priv->ienb = CLCD_PL110_IENB; + priv->ctrl = CLCD_PL110_CNTL; + } + } else { + priv->ienb = CLCD_PL111_IENB; + priv->ctrl = CLCD_PL111_CNTL; + } priv->regs = devm_ioremap_resource(dev, &amba_dev->res); if (IS_ERR(priv->regs)) { @@ -227,10 +255,10 @@ static int pl111_amba_probe(struct amba_device *amba_dev, } /* turn off interrupts before requesting the irq */ - writel(0, priv->regs + CLCD_PL111_IENB); + writel(0, priv->regs + priv->ienb); ret = devm_request_irq(dev, amba_dev->irq[0], pl111_irq, 0, - "pl111", priv); + variant->name, priv); if (ret != 0) { dev_err(dev, "%s failed irq %d\n", __func__, ret); return ret; @@ -269,10 +297,62 @@ static int pl111_amba_remove(struct amba_device *amba_dev) return 0; } -static struct amba_id pl111_id_table[] = { +/* + * This variant exist in early versions like the ARM Integrator + * and this version lacks the 565 and 444 pixel formats. + */ +static const u32 pl110_pixel_formats[] = { + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_ABGR1555, + DRM_FORMAT_XBGR1555, + DRM_FORMAT_ARGB1555, + DRM_FORMAT_XRGB1555, +}; + +static const struct pl111_variant_data pl110_variant = { + .name = "PL110", + .is_pl110 = true, + .formats = pl110_pixel_formats, + .nformats = ARRAY_SIZE(pl110_pixel_formats), +}; + +/* RealView, Versatile Express etc use this modern variant */ +static const u32 pl111_pixel_formats[] = { + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_BGR565, + DRM_FORMAT_RGB565, + DRM_FORMAT_ABGR1555, + DRM_FORMAT_XBGR1555, + DRM_FORMAT_ARGB1555, + DRM_FORMAT_XRGB1555, + DRM_FORMAT_ABGR4444, + DRM_FORMAT_XBGR4444, + DRM_FORMAT_ARGB4444, + DRM_FORMAT_XRGB4444, +}; + +static const struct pl111_variant_data pl111_variant = { + .name = "PL111", + .formats = pl111_pixel_formats, + .nformats = ARRAY_SIZE(pl111_pixel_formats), +}; + +static const struct amba_id pl111_id_table[] = { + { + .id = 0x00041110, + .mask = 0x000fffff, + .data = (void*)&pl110_variant, + }, { .id = 0x00041111, .mask = 0x000fffff, + .data = (void*)&pl111_variant, }, {0, 0}, }; From patchwork Fri Sep 1 09:36:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111471 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp785484qge; Fri, 1 Sep 2017 02:37:03 -0700 (PDT) X-Received: by 10.98.98.69 with SMTP id w66mr1599190pfb.282.1504258623592; Fri, 01 Sep 2017 02:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258623; cv=none; d=google.com; s=arc-20160816; b=i9ABpBwMB5jivLNY0eQGN52EEIUCn77G8dqxtvub9kGDVpc5C13zQMsx32KbTH2PWl 5SZOihuRYR5ff3GbuNziu0X9ruSR66ZWM9YIXWrsZlrSv7LWqT05OGKP1l3I28qolJNN DX9thV4lFr/t0Z8VzZHdGPjbRor42WUV2decxBqS9oRevOChGDYqzFRpC5pdGpzyDojn 1r0JxX/teBO4Oa+fqSNIyFWq5NWRsSAZmyFQUvRPCIXpzyLXuU9HWJJZFTKkxgk4/OTT 8weKGaxdoPgFb63VBGwk9s6N7glXkNrfIoa1gsv7cNKvj5G+K1A/W2OWayQvbxh1AQ6l 7a7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=xyILmKVLhaS86gnC+iOzkTwnXu/g+UBcbnfhkzR0CTM=; b=xsk7MPmV3PG+czC+iKUfKYojz9M5eRKEtJZvM3vSRgtkP0Mu3Ehf8SPGCxUZt6PW+x v1QxqCbuRgVQ7eFgwf4Qapf2xzAs28p+vAzPrj1egRRuJjYFQM79XilX4RSfvmcPT4d5 Xqaqm81/JndPNkhl+ZUv6ZoMPXRD7DlpPbXf7KlzALB292dUkfp7vhwHt4klY/Mk17j0 kiFcY6K0+tZ50pNiPAV16ENnkEv/Xc6ZbqXluDFLtpXSup3PCWCen+op5hqEZaUCEMyB M8m70UUox9Brg1RAZ/bEyeKUU1+OHLx8kw/mh6gqGsYCC1IwYAyZRMkU2f/f/T11KZHT ewUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BaG9IlpU; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id t202si1568333pgb.82.2017.09.01.02.37.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:37:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BaG9IlpU; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3556B6E810; Fri, 1 Sep 2017 09:37:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com [IPv6:2a00:1450:4010:c07::22a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CF876E810 for ; Fri, 1 Sep 2017 09:36:59 +0000 (UTC) Received: by mail-lf0-x22a.google.com with SMTP id a126so7330939lfa.0 for ; Fri, 01 Sep 2017 02:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=an3gtzWdE/JgZ3IsQ/Zpzj+/Nm/X5XRYs8T2AJSjgtM=; b=BaG9IlpUxpKatwra/cTewT/Sv/MdxR3B5f/gzr2EEcMax7CgmozqR3bcaz1Tq8bqEa vquQo4xCERtR68JSlAwdPHdeLHSvXY9B/kszTLmb1ioxbz8r41Tj5C/8bRxQ9L1THUf0 C6BRfT2NNTjGTKuHKNNVyqtH2Y1o886n42xVg= 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:in-reply-to :references; bh=an3gtzWdE/JgZ3IsQ/Zpzj+/Nm/X5XRYs8T2AJSjgtM=; b=nzTRd/70/1hJTh4pEDXDcOHx6uPZM3Zl4ZVCf+YAu19Uq7u3JXXli9l5pP6B8BJ2O4 R7SISbkZ/us0BfWfiPkskCcmsztyYxNRJA1Ik54MsBI3p8LxCGxIbPXRt4DW/HF0lu2a CbueYZYryCWIfMFcR+SFoPaOT6k9Jew0Ooj5P3QBU3LNGpKuriDQqKep/4Op8OUQOS+4 XSfov7QbiXsj8829BWarzpPxjIDs+nQ9xEsG7Rn0lNydsPS54hKuIPtLCMVP2pkIMahO GkO+kdlhWbJQKHM2y2YvR+iZRny3Lb4RMFEXb9m/Jkh43Snka/GaoHw95FNBWzhFSYEo A44g== X-Gm-Message-State: AHPjjUiD18qOolg5dTroRB31kIg577qQEUodTJzdQnfWayQ8Edl2NMkO 4NDFk947CKdEwB2q X-Google-Smtp-Source: ADKCNb5H6+awbBjg5iRMqnMEPLdLhlPDKjjStuzW7CT3sVThAqoyWsKjJGqqXuucAoLjUL80Qbva5g== X-Received: by 10.25.26.7 with SMTP id a7mr636624lfa.196.1504258617965; Fri, 01 Sep 2017 02:36:57 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18sm328588ljd.85.2017.09.01.02.36.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:36:57 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 5/7 v2] drm/pl111: Insert delay before powering up PL11x Date: Fri, 1 Sep 2017 11:36:35 +0200 Message-Id: <20170901093637.4041-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170901093637.4041-1-linus.walleij@linaro.org> References: <20170901093637.4041-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, 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" The old codebase has a delay between enabling and powering up the PL11x. According to the manual for PL110, ARM DDI 0161E page 1-5 and the PL111 manual ARM DDI 0293C page 1-6, the power sequence should be such that once Vdd is stable (which we assume it is at boot) LCDEN is enabled first and then CLPOWER should be enabled "after the signals have stabilized" and this is said to be display-dependent. The old codebase uses 20ms. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Fall back to the delay of 20 ms from the old framebuffer driver to stabilize Vee in shortage of other alternatives. --- drivers/gpu/drm/pl111/pl111_display.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 51e3530c876c..3ed451ca2744 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -154,8 +154,8 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, writel(0, priv->regs + CLCD_TIM3); - /* Enable and Power Up */ - cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDPWR | CNTL_LCDVCOMP(1); + /* Hard-code TFT panel */ + cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDVCOMP(1); /* Note that the the hardware's format reader takes 'r' from * the low bit, while DRM formats list channels from high bit @@ -198,6 +198,17 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, break; } + /* Power sequence: first enable and chill */ + writel(cntl, priv->regs + priv->ctrl); + + /* + * We expect this delay to stabilize the contrast + * voltage Vee as stipulated by the manual + */ + msleep(20); + + /* Power Up */ + cntl |= CNTL_LCDPWR; writel(cntl, priv->regs + priv->ctrl); drm_crtc_vblank_on(crtc); @@ -208,10 +219,24 @@ void pl111_display_disable(struct drm_simple_display_pipe *pipe) struct drm_crtc *crtc = &pipe->crtc; struct drm_device *drm = crtc->dev; struct pl111_drm_dev_private *priv = drm->dev_private; + u32 cntl; drm_crtc_vblank_off(crtc); - /* Disable and Power Down */ + /* Power Down */ + cntl = readl(priv->regs + priv->ctrl); + if (cntl & CNTL_LCDPWR) { + cntl &= ~CNTL_LCDPWR; + writel(cntl, priv->regs + priv->ctrl); + } + + /* + * We expect this delay to stabilize the contrast voltage Vee as + * stipulated by the manual + */ + msleep(20); + + /* Disable */ writel(0, priv->regs + priv->ctrl); clk_disable_unprepare(priv->clk); From patchwork Fri Sep 1 09:36:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111474 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp785965qge; Fri, 1 Sep 2017 02:37:37 -0700 (PDT) X-Received: by 10.99.111.6 with SMTP id k6mr1703256pgc.138.1504258657416; Fri, 01 Sep 2017 02:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258657; cv=none; d=google.com; s=arc-20160816; b=lIS1rRlf9MmDK68nfLEqu8dV9l9tJb8iywnWZR04KWplNVNOq7DAu2QYq8seETElYH T1DD3SqxZIZwrROmNaZ5gZs9K/QmM5p6huer9Lm27GvQmJjXyEsGa6Ma82nseVbFucG9 6pmCfeS5VJupuVqwXJfX6MPhf9EZT6uDGmdHva9bSbKPP8JdKLfWjXW6OjPyY+HpKdi0 zi3Wy0nHPXmT1Mftoewas8JMWkJizXEyWCZcRckLILlrvRpVmzqBczqjHxFbtY7VFA7D sYp3YJTZDn1chHQC6PWPaD5YhsZav5yOkx8ZXYzgYxMunhvvNd3kEXWJkAEuPAR31+Jl ysvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=2mZD0FovAGKZ6R5xyByMNPArSd5AxMjXYZ00H3hSISY=; b=NQx1043jvLPy2fhgDbr3Qty+xg6N9mJBAUp4M/6TggzIhmj5E7MY1XADVMihytQAVD HFHEs60zZ/VTUWYdjasxYFOG05/uSLNHtMH84xuXVanj8XBi0PJHcIL+Nu3BqaGY6p0i sgqE7tydmgDhNICkK40OHdIbATolqQecg1woC56Iuc8zLaJYx8hirCsXPe904fjPra4q BbX31ZW/Fh/WyecxrRk42AeMJEGeFUTsAOM37uvNBfzrszoxubjE3//pAteRRsGiO+Af 6pBl61Hk948F08PRqtUH55Zoejhe8ukXIqrS6Zb5WCbsWEzGoZChDwkVpwL1vn9nSGWQ IDXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UJoaMoSh; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id z11si1583997pfl.452.2017.09.01.02.37.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:37:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UJoaMoSh; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0C586E819; Fri, 1 Sep 2017 09:37:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com [IPv6:2a00:1450:4010:c07::22b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66CF66E814 for ; Fri, 1 Sep 2017 09:37:01 +0000 (UTC) Received: by mail-lf0-x22b.google.com with SMTP id d17so7316310lfe.1 for ; Fri, 01 Sep 2017 02:37:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KjD1PRJQp+SuXhWigSGZLuQ50pztlk1EB2ciyXUKI3Q=; b=UJoaMoShkd41wEbCa1kDGgATqPthK2NsAwsOgsEAyiPEjNXL8V35UCT+c/+lZnZxvM WRKj5ULr9D9qoTP1eN4uHzIVzz57prsiOckLTe0blHcGIRR+kLcDwWnfqCs9AvARUUic kR4XcMmYM3TtOhjV6nTvKsnruwjNKKEMDubcw= 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:in-reply-to :references; bh=KjD1PRJQp+SuXhWigSGZLuQ50pztlk1EB2ciyXUKI3Q=; b=DyPqyWbN2k0P///x3ABVzbXmZOxuwo00rS/lVq1gk7uRJjV6psPhIrvtQhg+jcH5gs tv7OeJQ6kO6zmosnXmEE111ed866J6VG71a6qzldP8wgcPwTtG18TF5MRMdyhPd0ZhBr xtK4THGBB53Dv29qNtQGIEZW75sUpiV3/GkV6l2oWXVi96bAUd9DMIz2zh5sYyLwa8i9 sUg18uAlnPbo5Z6+ao4P4RNa+p7x7itNhDnP45SRBPaXP0JSzmV85TtnYgAvcxHiT9nw hPVoDTxWCqKUH456yNEnbCYsSHaNUjAw3t4QZ8W1t+HAwPfE4T8/WOPO5mjGSfTS9pjB oP5A== X-Gm-Message-State: AHPjjUi9If1qyXoKPqFhYQXu3bdpv58RM2KuhrK1WrGN3QZD830rPtT1 DFCFj29kBrV/52I1 X-Google-Smtp-Source: ADKCNb5V4jgKUXL8RpCtrVHCg7TxM1A07KS90ksYwYVXRHaaYNNDuK+WriBqd4fC1F+O4BsR1YbUPw== X-Received: by 10.25.225.3 with SMTP id y3mr674386lfg.88.1504258619698; Fri, 01 Sep 2017 02:36:59 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18sm328588ljd.85.2017.09.01.02.36.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:36:59 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 6/7 v2] drm/pl111: Add optional variant display en/disable callbacks Date: Fri, 1 Sep 2017 11:36:36 +0200 Message-Id: <20170901093637.4041-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170901093637.4041-1-linus.walleij@linaro.org> References: <20170901093637.4041-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, 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" The silcon and components around the PL111 may require some variants to perform special set-up of the display. Add two callbacks to manage this. Signed-off-by: Linus Walleij Reviewed-by: Eric Anholt --- ChangeLog v1->v2: - Rebase on other display driver changes. --- drivers/gpu/drm/pl111/pl111_display.c | 6 ++++++ drivers/gpu/drm/pl111/pl111_drm.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 3ed451ca2744..5ca2c307856c 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -207,6 +207,9 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, */ msleep(20); + if (priv->variant_display_enable) + priv->variant_display_enable(drm, fb->format->format); + /* Power Up */ cntl |= CNTL_LCDPWR; writel(cntl, priv->regs + priv->ctrl); @@ -236,6 +239,9 @@ void pl111_display_disable(struct drm_simple_display_pipe *pipe) */ msleep(20); + if (priv->variant_display_disable) + priv->variant_display_disable(drm); + /* Disable */ writel(0, priv->regs + priv->ctrl); diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index eeaabe735058..c28b5d042412 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -26,6 +26,7 @@ #include #include #include +#include #define CLCD_IRQ_NEXTBASE_UPDATE BIT(2) @@ -67,6 +68,8 @@ struct pl111_drm_dev_private { */ spinlock_t tim2_lock; const struct pl111_variant_data *variant; + void (*variant_display_enable) (struct drm_device *drm, u32 format); + void (*variant_display_disable) (struct drm_device *drm); }; int pl111_display_init(struct drm_device *dev); From patchwork Fri Sep 1 09:36:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111472 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp785712qge; Fri, 1 Sep 2017 02:37:20 -0700 (PDT) X-Received: by 10.84.129.33 with SMTP id 30mr1697816plb.276.1504258640349; Fri, 01 Sep 2017 02:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504258640; cv=none; d=google.com; s=arc-20160816; b=rDKLRhYR9RSdFbnZiKOCMLREijmp5EDcWAPFJlnZ4ELQsSh/RH7LF7Ug1N1Bb3HD84 jiPoNY2nLipbFlo1SnYZpbW4Wgbr8+d2/X+bcZORe3DAcikEMmqTzi75YR/mSfX0kg/3 pT2oLacyj5ycmZiSnPtRTGZIp+UFWrMSOwZW1ooWcRWIZSAoUPge77sEAau41T3Da5bx Tb5k/dcZVt7Qu/A1zGSRPhgXKEB+sCnt5epMNj6r0jhTYPzO/PrsXr7tn3WEY0JdTNBy eIFTuT3EyZJulX9lQQtt4biIqwqgbLKQzauIV/cEL7JYBBqXZjTBcPkkpiRJDw5On8gE 0Duw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=1c8PN6s85f4opwQJJaYXgzRX/nKm5COOhKHU/LoPgYg=; b=q+iUQdkVt5g9deRrXryq17B3Qo0J7Oaz8GbbJfaiIHKZLlFN9I5IZ9+Ow/70peU/VS sOpUtgpliYbJbs3dDueq7/KtCbmlo9J2dEN2GH3ZZYyjLg4QR/JgBUwszEQ9s0PCTBI+ 4keX9xpcf6yzaDWaW9SqloWwyMvAEyZi4prsr3hSlQFVlpYEJ53008wu+fIB5ArjoqeB eSLPjYB0bagTpffOTSKFQt4OXFHhgu8qNRGzD8dcWxaiy4DizcUDv87pajE3AT7J2/q+ SePQxvFe7RsOl0d/akhTgwz29lgHrZwX5vMkPttjuNnjEGm+QPYJ7PPn2B87byN8Vle/ 45+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XyRn6Hyk; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g11si1558183pln.755.2017.09.01.02.37.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 02:37:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XyRn6Hyk; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E41366E81C; Fri, 1 Sep 2017 09:37:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com [IPv6:2a00:1450:4010:c07::236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CC2F6E814 for ; Fri, 1 Sep 2017 09:37:03 +0000 (UTC) Received: by mail-lf0-x236.google.com with SMTP id d202so7234396lfd.5 for ; Fri, 01 Sep 2017 02:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YTNNalElYn5Z/WHWjTUPOmM2xIZboSi5T0HUs/9i1O4=; b=XyRn6HykJTnLo4Bm9kTnWKrwJk3lXHCsZ7a06T5/1JCUsFbs1CZQgqc8+sO4RjWKW7 RqYlhhJLfnTlS9IIlHSv2USuUbowvM1mGAC+XYy63NSymh2QqSyiYEhjJwMIp9CiERU4 wK3cDmICakkekKYYKcY2YKDuj36TSKrzKT044= 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:in-reply-to :references; bh=YTNNalElYn5Z/WHWjTUPOmM2xIZboSi5T0HUs/9i1O4=; b=bUNgqEOAjxMCB9tjUdjrwkEMwwUG5HzzGuuqCO1ReOeDY9xmN3ZOis+Ac0wQejNIUe dkF9MqfmXMrtGT36tzMrg3OLLC3THNQp+3fFLQ+TASYp8TyMaK9kdzl1cAMWPw72Q22w 4Iu6ZB1LTw78229Km21lrYhXAY1TXpq13C+i8hazyGJaiD6eWrSxalbIYVlxI4zqwgLA j/bu0GHLsV6O6pGD3UMhoyTyIFgpT7vcPFvge0v73icBN1Y6Mu6HvY/JVrUFuj8MIQ8F cRQNw/vQg6iMAcldxf+38QwYxDgA2yKCSrRL83HoKszgQym9xA5kdUNxOykuV0YHdgYo A9lA== X-Gm-Message-State: AHPjjUgazdrApJG69kUzR4ZHOfo0/hL8Y6qxmhK/PD+gHFxf9+MBDs9V 41BqELQHmK6P64huChroRw== X-Google-Smtp-Source: ADKCNb4K+ubOqPMIp7xQHSl0y6y/huqA109kUDUALlm6vfaBRL144JXZyZ+X09HNztqWiT+sWDrCpA== X-Received: by 10.46.66.135 with SMTP id h7mr478869ljf.28.1504258621557; Fri, 01 Sep 2017 02:37:01 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x18sm328588ljd.85.2017.09.01.02.37.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 02:37:00 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 7/7 v2] drm/pl111: Add handling of Versatile platforms Date: Fri, 1 Sep 2017 11:36:37 +0200 Message-Id: <20170901093637.4041-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170901093637.4041-1-linus.walleij@linaro.org> References: <20170901093637.4041-1-linus.walleij@linaro.org> Cc: linux-arm-kernel@lists.infradead.org, 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" The ARM reference designs in the Versatile family: Integrator, Versatile and RealView can make use of the new DRM driver as well. We just need to create a bit of platform-specific code for them that we isolate to its own file. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebase on the other patches. - Drop pad note from DOC section. --- drivers/gpu/drm/pl111/Makefile | 1 + drivers/gpu/drm/pl111/pl111_display.c | 7 - drivers/gpu/drm/pl111/pl111_drv.c | 8 +- drivers/gpu/drm/pl111/pl111_versatile.c | 270 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/pl111/pl111_versatile.h | 9 ++ 5 files changed, 285 insertions(+), 10 deletions(-) create mode 100644 drivers/gpu/drm/pl111/pl111_versatile.c create mode 100644 drivers/gpu/drm/pl111/pl111_versatile.h diff --git a/drivers/gpu/drm/pl111/Makefile b/drivers/gpu/drm/pl111/Makefile index c5f8f9684848..fce1453a93e1 100644 --- a/drivers/gpu/drm/pl111/Makefile +++ b/drivers/gpu/drm/pl111/Makefile @@ -1,4 +1,5 @@ pl111_drm-y += pl111_display.o \ + pl111_versatile.o \ pl111_drv.o pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 5ca2c307856c..a3cf2ac8d4c1 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -449,13 +449,6 @@ int pl111_display_init(struct drm_device *drm) } of_node_put(endpoint); - if (tft_r0b0g0[0] != 0 || - tft_r0b0g0[1] != 8 || - tft_r0b0g0[2] != 16) { - dev_err(dev, "arm,pl11x,tft-r0g0b0-pads != [0,8,16] not yet supported\n"); - return -EINVAL; - } - ret = pl111_init_clock_divider(drm); if (ret) return ret; diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index c4a654867ed1..f5bc6f160e60 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -41,9 +41,6 @@ * - Fix race between setting plane base address and getting IRQ for * vsync firing the pageflip completion. * - * - Expose the correct set of formats we can support based on the - * "arm,pl11x,tft-r0g0b0-pads" DT property. - * * - Use the "max-memory-bandwidth" DT property to filter the * supported formats. * @@ -72,6 +69,7 @@ #include #include "pl111_drm.h" +#include "pl111_versatile.h" #define DRIVER_DESC "DRM module for PL111" @@ -264,6 +262,10 @@ static int pl111_amba_probe(struct amba_device *amba_dev, return ret; } + ret = pl111_versatile_init(dev, priv); + if (ret) + goto dev_unref; + ret = pl111_modeset_init(drm); if (ret != 0) goto dev_unref; diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c new file mode 100644 index 000000000000..97d4af6925a3 --- /dev/null +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -0,0 +1,270 @@ +#include +#include +#include +#include +#include +#include +#include +#include "pl111_versatile.h" +#include "pl111_drm.h" + +static struct regmap *versatile_syscon_map; + +/* + * We detect the different syscon types from the compatible strings. + */ +enum versatile_clcd { + INTEGRATOR_CLCD_CM, + VERSATILE_CLCD, + REALVIEW_CLCD_EB, + REALVIEW_CLCD_PB1176, + REALVIEW_CLCD_PB11MP, + REALVIEW_CLCD_PBA8, + REALVIEW_CLCD_PBX, +}; + +static const struct of_device_id versatile_clcd_of_match[] = { + { + .compatible = "arm,core-module-integrator", + .data = (void *)INTEGRATOR_CLCD_CM, + }, + { + .compatible = "arm,versatile-sysreg", + .data = (void *)VERSATILE_CLCD, + }, + { + .compatible = "arm,realview-eb-syscon", + .data = (void *)REALVIEW_CLCD_EB, + }, + { + .compatible = "arm,realview-pb1176-syscon", + .data = (void *)REALVIEW_CLCD_PB1176, + }, + { + .compatible = "arm,realview-pb11mp-syscon", + .data = (void *)REALVIEW_CLCD_PB11MP, + }, + { + .compatible = "arm,realview-pba8-syscon", + .data = (void *)REALVIEW_CLCD_PBA8, + }, + { + .compatible = "arm,realview-pbx-syscon", + .data = (void *)REALVIEW_CLCD_PBX, + }, + {}, +}; + +/* + * Core module CLCD control on the Integrator/CP, bits + * 8 thru 19 of the CM_CONTROL register controls a bunch + * of CLCD settings. + */ +#define INTEGRATOR_HDR_CTRL_OFFSET 0x0C +#define INTEGRATOR_CLCD_LCDBIASEN BIT(8) +#define INTEGRATOR_CLCD_LCDBIASUP BIT(9) +#define INTEGRATOR_CLCD_LCDBIASDN BIT(10) +/* Bits 11,12,13 controls the LCD type */ +#define INTEGRATOR_CLCD_LCDMUX_MASK (BIT(11)|BIT(12)|BIT(13)) +#define INTEGRATOR_CLCD_LCDMUX_LCD24 BIT(11) +#define INTEGRATOR_CLCD_LCDMUX_VGA565 BIT(12) +#define INTEGRATOR_CLCD_LCDMUX_SHARP (BIT(11)|BIT(12)) +#define INTEGRATOR_CLCD_LCDMUX_VGA555 BIT(13) +#define INTEGRATOR_CLCD_LCDMUX_VGA24 (BIT(11)|BIT(12)|BIT(13)) +#define INTEGRATOR_CLCD_LCD0_EN BIT(14) +#define INTEGRATOR_CLCD_LCD1_EN BIT(15) +/* R/L flip on Sharp */ +#define INTEGRATOR_CLCD_LCD_STATIC1 BIT(16) +/* U/D flip on Sharp */ +#define INTEGRATOR_CLCD_LCD_STATIC2 BIT(17) +/* No connection on Sharp */ +#define INTEGRATOR_CLCD_LCD_STATIC BIT(18) +/* 0 = 24bit VGA, 1 = 18bit VGA */ +#define INTEGRATOR_CLCD_LCD_N24BITEN BIT(19) + +#define INTEGRATOR_CLCD_MASK (INTEGRATOR_CLCD_LCDBIASEN | \ + INTEGRATOR_CLCD_LCDBIASUP | \ + INTEGRATOR_CLCD_LCDBIASDN | \ + INTEGRATOR_CLCD_LCDMUX_MASK | \ + INTEGRATOR_CLCD_LCD0_EN | \ + INTEGRATOR_CLCD_LCD1_EN | \ + INTEGRATOR_CLCD_LCD_STATIC1 | \ + INTEGRATOR_CLCD_LCD_STATIC2 | \ + INTEGRATOR_CLCD_LCD_STATIC | \ + INTEGRATOR_CLCD_LCD_N24BITEN) + +static void pl111_integrator_enable(struct drm_device *drm, u32 format) +{ + u32 val; + + dev_info(drm->dev, "enable Integrator CLCD connectors\n"); + + /* FIXME: really needed? */ + val = INTEGRATOR_CLCD_LCD_STATIC1 | INTEGRATOR_CLCD_LCD_STATIC2 | + INTEGRATOR_CLCD_LCD0_EN | INTEGRATOR_CLCD_LCD1_EN; + + switch (format) { + case DRM_FORMAT_XBGR8888: + case DRM_FORMAT_XRGB8888: + break; + case DRM_FORMAT_BGR565: + case DRM_FORMAT_RGB565: + /* truecolor RGB565 */ + val |= INTEGRATOR_CLCD_LCDMUX_VGA565; + break; + case DRM_FORMAT_XBGR1555: + case DRM_FORMAT_XRGB1555: + /* Pseudocolor, RGB555, BGR555 */ + val |= INTEGRATOR_CLCD_LCDMUX_VGA555; + break; + default: + dev_err(drm->dev, "unhandled format on Integrator 0x%08x\n", + format); + break; + } + + regmap_update_bits(versatile_syscon_map, + INTEGRATOR_HDR_CTRL_OFFSET, + INTEGRATOR_CLCD_MASK, + val); +} + +/* + * This configuration register in the Versatile and RealView + * family is uniformly present but appears more and more + * unutilized starting with the RealView series. + */ +#define SYS_CLCD 0x50 +#define SYS_CLCD_MODE_MASK (BIT(0)|BIT(1)) +#define SYS_CLCD_MODE_888 0 +#define SYS_CLCD_MODE_5551 BIT(0) +#define SYS_CLCD_MODE_565_R_LSB BIT(1) +#define SYS_CLCD_MODE_565_B_LSB (BIT(0)|BIT(1)) +#define SYS_CLCD_CONNECTOR_MASK (BIT(2)|BIT(3)|BIT(4)|BIT(5)) +#define SYS_CLCD_NLCDIOON BIT(2) +#define SYS_CLCD_VDDPOSSWITCH BIT(3) +#define SYS_CLCD_PWR3V5SWITCH BIT(4) +#define SYS_CLCD_VDDNEGSWITCH BIT(5) + +static void pl111_versatile_disable(struct drm_device *drm) +{ + dev_info(drm->dev, "disable Versatile CLCD connectors\n"); + regmap_update_bits(versatile_syscon_map, + SYS_CLCD, + SYS_CLCD_CONNECTOR_MASK, + 0); +} + +static void pl111_versatile_enable(struct drm_device *drm, u32 format) +{ + u32 val = 0; + + dev_info(drm->dev, "enable Versatile CLCD connectors\n"); + + switch (format) { + case DRM_FORMAT_ABGR8888: + case DRM_FORMAT_XBGR8888: + case DRM_FORMAT_ARGB8888: + case DRM_FORMAT_XRGB8888: + val |= SYS_CLCD_MODE_888; + break; + case DRM_FORMAT_BGR565: + val |= SYS_CLCD_MODE_565_R_LSB; + break; + case DRM_FORMAT_RGB565: + val |= SYS_CLCD_MODE_565_B_LSB; + break; + case DRM_FORMAT_ABGR1555: + case DRM_FORMAT_XBGR1555: + case DRM_FORMAT_ARGB1555: + case DRM_FORMAT_XRGB1555: + val |= SYS_CLCD_MODE_5551; + break; + default: + dev_err(drm->dev, "unhandled format on Versatile 0x%08x\n", + format); + break; + } + + /* Set up the MUX */ + regmap_update_bits(versatile_syscon_map, + SYS_CLCD, + SYS_CLCD_MODE_MASK, + val); + + /* Then enable the display */ + regmap_update_bits(versatile_syscon_map, + SYS_CLCD, + SYS_CLCD_CONNECTOR_MASK, + SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH); +} + +static void pl111_realview_clcd_disable(struct drm_device *drm) +{ + dev_info(drm->dev, "disable RealView CLCD connectors\n"); + regmap_update_bits(versatile_syscon_map, + SYS_CLCD, + SYS_CLCD_CONNECTOR_MASK, + 0); +} + +static void pl111_realview_clcd_enable(struct drm_device *drm, u32 format) +{ + dev_info(drm->dev, "enable RealView CLCD connectors\n"); + regmap_update_bits(versatile_syscon_map, + SYS_CLCD, + SYS_CLCD_CONNECTOR_MASK, + SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH); +} + +int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) +{ + const struct of_device_id *clcd_id; + enum versatile_clcd versatile_clcd_type; + struct device_node *np; + struct regmap *map; + + np = of_find_matching_node_and_match(NULL, versatile_clcd_of_match, + &clcd_id); + if (!np) { + /* Non-ARM reference designs, just bail out */ + return 0; + } + versatile_clcd_type = (enum versatile_clcd)clcd_id->data; + + map = syscon_node_to_regmap(np); + if (IS_ERR(map)) { + dev_err(dev, "no Versatile syscon regmap\n"); + return PTR_ERR(map); + } + + switch (versatile_clcd_type) { + case INTEGRATOR_CLCD_CM: + versatile_syscon_map = map; + priv->variant_display_enable = pl111_integrator_enable; + dev_info(dev, "set up callbacks for Integrator PL110\n"); + break; + case VERSATILE_CLCD: + versatile_syscon_map = map; + priv->variant_display_enable = pl111_versatile_enable; + priv->variant_display_disable = pl111_versatile_disable; + dev_info(dev, "set up callbacks for Versatile PL110+\n"); + break; + case REALVIEW_CLCD_EB: + case REALVIEW_CLCD_PB1176: + case REALVIEW_CLCD_PB11MP: + case REALVIEW_CLCD_PBA8: + case REALVIEW_CLCD_PBX: + versatile_syscon_map = map; + priv->variant_display_enable = pl111_realview_clcd_enable; + priv->variant_display_disable = pl111_realview_clcd_disable; + dev_info(dev, "set up callbacks for RealView PL111\n"); + break; + default: + dev_info(dev, "unknown Versatile system controller\n"); + break; + } + + return 0; +} +EXPORT_SYMBOL_GPL(pl111_versatile_init); diff --git a/drivers/gpu/drm/pl111/pl111_versatile.h b/drivers/gpu/drm/pl111/pl111_versatile.h new file mode 100644 index 000000000000..41aa6d969dc6 --- /dev/null +++ b/drivers/gpu/drm/pl111/pl111_versatile.h @@ -0,0 +1,9 @@ +#include +#include "pl111_drm.h" + +#ifndef PL111_VERSATILE_H +#define PL111_VERSATILE_H + +int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv); + +#endif