From patchwork Thu Sep 7 12:49:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111912 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp41357qge; Thu, 7 Sep 2017 05:50:10 -0700 (PDT) X-Received: by 10.101.64.140 with SMTP id t12mr2645170pgp.138.1504788610144; Thu, 07 Sep 2017 05:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504788610; cv=none; d=google.com; s=arc-20160816; b=VDRC0ctWlxuje0v+Q4j5Diov7fLvWLFDAaemmH7iKlhAs2lVSVZnW48WyD32Tz6NjI Cx0u/mIQC9ScrzXGxpYHrrRh9pSXYFk0oDpmAPEtMjn7wCAaE6GQTOc9GkZU0wpttKTM ECTtmBUMJiNSbt9IDYj84oSxmLUWYEVavPHYkWO5iroh3II734zyJMzU+kp7WjEX7sDb zG9O9EWYTOTPnbh3iFI0vCMV9OnpgmkUS842fXbBZ8o+ixffDkv+2qXKIbfUyGgzTRDw +0rL0xlTe7o8Ep47Qi58k7JOA6LSzt8h7AHmM0KxsSeWakLOnWByaNACRbfXlEmmof7h 4f9A== 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:message-id:date:subject:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=275zsFmso6HeVLPdWqtU4SVP/Z2p6PYDjK33EGAYBSw=; b=V1VAQA+C3NVcVSDFiX7RQq3YypFmpDVkHh1Y4MCwj8D+pHA4599VkEjo9FVdr9uIoI TZc15ffwIb/ZkpwEoYg3tlQkb6M+3tZPOcu8B85ZXHQ9wMyhoVArF/G/soHPh1acLMYI qSvAt3wPu0X9iMlixoiZrniaXXzcy28apBP1zr6p4BMVQEjO4k3XueiiHvcoCBldiWiP rMT6T96jVH99JGx0iEWUxWPldmPvbYlYx1tKImu17v270SzsLrJ93wl/tCWsx5zBEm0X lYxS7LYl8WL/5XDATl9Knbnz786n/zffFvPv5AuDwSkCDG1vI0G4IKF9juVBs5ERGXU3 OgFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TTgiLTiS; 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 r13si2055044plj.97.2017.09.07.05.50.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 05:50:10 -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=TTgiLTiS; 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 48EBE6E913; Thu, 7 Sep 2017 12:49:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com [IPv6:2a00:1450:4010:c07::22c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5AA816E913 for ; Thu, 7 Sep 2017 12:49:36 +0000 (UTC) Received: by mail-lf0-x22c.google.com with SMTP id q132so24240819lfe.5 for ; Thu, 07 Sep 2017 05:49:36 -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; bh=dXZf9Ig+TlWMMy0oFqZlttFstXgqgDsNNVq8RRyJK7k=; b=TTgiLTiShUB+7CAn5qwa9p3FSE1cEpSzCIDak6hn+VXcyAqaXmHOpQY+nVkeKGIf2K PiAYtbhEru42iDTIEg2mdMJh3sSoRNPsRa6vARxfkDCAHB2LgPI/BRQQIbcy3dCqMY15 l1PtF2kALvEQXhNXIGCGxaj6pzzxez26zbkgE= 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=dXZf9Ig+TlWMMy0oFqZlttFstXgqgDsNNVq8RRyJK7k=; b=qnfezNYdjNvshkv+EWW/BPG1eN8oMTsXTViFcYj0wu6U829FMJgJ4lJF2yYlOoCdV7 agODxY7Wa3vH3Gs7nKaL9nGxWAkKvMGBPAKEPNU9rNKrvtOqSD3TTjlQ/BjfMt36Bs1Y L+igJnUgp0zhZ9BY/sqawecr8ehkLncLBFFABL+bbgk1OENsKv1vcKzP0q5Y624xQ4Ge YJt7KSv4/Dv35P3bnrqNaN7akwCAw3e+XoKyHS9ZCjQ08oCxxQ+X0kgVKWL6KB9HS6i0 sWs/9qOvYhtNB6a1XADONpILOvA5+rrkBFcWisADQ8WhtnmBmn1yAKTx0GzOUNb131z2 UUzQ== X-Gm-Message-State: AHPjjUj5zp+jTpN+0cIcKkBy7wdP5wNtfiFeQNhALe1mB9ro3zugpP2o pjbO/6jVlbSK43oz X-Google-Smtp-Source: AOwi7QCHT1hNUj9HuoU0Kxjml0CuthWjnixNyYLvUNT/rm+ZGXITUdSVCzSgYFynwm/7nj9ExPGqpQ== X-Received: by 10.25.210.131 with SMTP id j125mr822276lfg.135.1504788574493; Thu, 07 Sep 2017 05:49:34 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g65sm405841ljb.86.2017.09.07.05.49.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 05:49:33 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 1/7 v3] drm/pl111: Cleanup local header file Date: Thu, 7 Sep 2017 14:49:19 +0200 Message-Id: <20170907124925.13805-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 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 v2->v3: - Rebase on DRM-TIP 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 Thu Sep 7 12:49:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111908 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp40839qge; Thu, 7 Sep 2017 05:49:42 -0700 (PDT) X-Received: by 10.84.210.69 with SMTP id z63mr2916231plh.431.1504788581986; Thu, 07 Sep 2017 05:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504788581; cv=none; d=google.com; s=arc-20160816; b=qQMZwIdk4xj6Ci2OLe5SlyzenmB7NvD4Od+OKLFyFw6dgdJqpbGA8OVVnJuKifnoqZ wgu6Tb1UzKZaMtY8pBpuVkc1OB9UbS3tKVERTPkOfOoZk2N8qPj1lHIRnFpRN0iACl8X YymvjpefoWSu2Ik7fYMVGilS4Y+etaNkRjbHVe5BcbbnxQZ5YF6Fz+JHgFDPlA/S234C y7l4K/Smjx+WEZ8ebZTsS3X8SnyVx6TrN8GvcReWs1xN+cUEk55uDl3gYCp98oqwCJ27 BIuFdEg3wYuesF0XJNnITPfHIhUYG/08BNUiAe27lFt1rkbRjfdA7ozg+PtmMuJTu0CI mlfQ== 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=d563quuYrl3CtL0f39XpnUibg2mtstjfmbUEXWV/czE=; b=V7ugY4V1kdjfz90vkCoyLWc74v3a3ysUedJkt5IY8zmmvkQHS3jKH6paABmc8LPvTK C8RzFs1XEbxG0mVU9yxfqlmA1ckWv2b/Yvw9VejDl4EwKytyvz1qL07vFhDsPvVyW+N8 9DASu9YkvpUBbHoQYeA1q+syVcYI8hnPh7/hBVe5KhpmUradYhISh/ICwzas67dEIaFB 6gMZ/FjwP0tzcy1v/PWIQkJqZXadcCtVzk+ZHq7arGAd7kCKHFiOfwuf5s07Zjv5bxvp cVnpgq+uV0KcQUIZGMvhgLfdZArI/0vo+lCzB87/2FeVOawItGk15MdZGW1c5Y9z1mlz 4Ebg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IEyFBEOt; 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 24si1766210pfq.585.2017.09.07.05.49.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 05:49:41 -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=IEyFBEOt; 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 25DC86E91B; Thu, 7 Sep 2017 12:49:40 +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 AB3096E917 for ; Thu, 7 Sep 2017 12:49:38 +0000 (UTC) Received: by mail-lf0-x230.google.com with SMTP id l196so24321693lfl.1 for ; Thu, 07 Sep 2017 05:49:38 -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=lDhwI3mekubg/5nQY5D6GZkrFMqZPGnUHc4OIH2Oduo=; b=IEyFBEOtluMGz4YRHQO6AeFHvEnhQ3V5zXuCbLLW+i+q5+bqHNbu+U5VMFZFyZ8DKa gPI/qiOI8OEKvnrK2cjYD6E/IOVVelTLDrBdmjLKTzy2+JgVj8geP6/nygn4bwJE/9xx 9dr7XsEwjrFBDiAZJbzdSp9MrnuHlkN8h7AgY= 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=lDhwI3mekubg/5nQY5D6GZkrFMqZPGnUHc4OIH2Oduo=; b=UboL5/Jq+DObGuyXQOOUbaVUVJ0iBkoazJWNDEeBbsyV84V7f4g+ems8HICNtJGOBK qDjug0Bg3o1PAixNgNSMWGF8vqwt3PpjDHSpSwLqQnJD8TYKamjfe98dWLsh1zeWUglN ttObxAHXD/+jOJavwko+U3VnMZ6k4p12MG5XS0vA+9xUzweDFZP5LSJDvbwVmUS2VFGN jIH24FqmQf2gtIC/oRdDy6U+RhoNKPZ9+fXvcv/+Fwh/+dSjt91M7LJIehogGsIXb5Fk NzeNqNCMHhxY2uvKy5GNN/6VyQmQrkquQJ4uR9n+QVUZ0LbII0mh2QGY+Dv+sT3hBgBu QeqQ== X-Gm-Message-State: AHPjjUjIjvW/z9QdshKJyMq7E4vbII6A1zwXJWWCC5OAXbzj8r/tZK7q E+XSZjhMWYmsmFn5 X-Google-Smtp-Source: AOwi7QB3utN5udm8J2/q0vz86Hva3s1jysRaMeTM9RHlA6MOt5Mep1VUc4+ie9lqWoL+5Szhfnf61g== X-Received: by 10.25.95.80 with SMTP id a16mr1078941lfj.75.1504788577101; Thu, 07 Sep 2017 05:49:37 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g65sm405841ljb.86.2017.09.07.05.49.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 05:49:36 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 2/7 v3] drm/pl111: Add all registers to debugfs Date: Thu, 7 Sep 2017 14:49:20 +0200 Message-Id: <20170907124925.13805-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907124925.13805-1-linus.walleij@linaro.org> References: <20170907124925.13805-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Rebase on DRM-TIP 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 Thu Sep 7 12:49:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111913 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp41446qge; Thu, 7 Sep 2017 05:50:14 -0700 (PDT) X-Received: by 10.98.220.209 with SMTP id c78mr2652469pfl.37.1504788614063; Thu, 07 Sep 2017 05:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504788614; cv=none; d=google.com; s=arc-20160816; b=TeD9iKUtg2Sp2qoDTg0m9IIPb+PqRghanYTsWQ6hdfXWgRiRGVSqFYsKDHAPFs718F t/qirUsW+Gy7pOx5NNgmGrcCj896KCDBZ8yKV6f+tdSMvBNftFse1vFgzw0KqcgYjaKe 031Qb5U3n0qh3k+SpFkWESfnWUa1LDCLvoD3zIBktEabxn4sDKnZK0C0AdgA7vVIQwl8 WlzCMFbiZHZMG1dv2vhxhrZDSKNilj/N5vAZKqb7qV7nVoSdYL7jwY+eU/k2CT+NamUJ b8HnfqPEnWf+eBC/3nIQKzETLF000p9be4xP8NsbuRjIgnO/txrKOlam5M+arnc4zeI/ p4oA== 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=gT4otGtnWV2RxqpkK+3ocACo3eTlNmHdzkDYVMmmz7I=; b=B0GwXYIvhJnlO7n8aTy4plebTbnKG3yO9FvSwF3ep1PSdgsOIIumZ3kNQ9RiHJdjIP NVsztAJn1UCMKUkhmC+3jbR9RvTmVnVCydxFlK39iXuw0gzDSZz8le9bbM2m234c6Pk+ KcE5I2RNRIkVDl57rH3NSC1Yzb+MuyTQwFf7nQNmOv9osbYOq+HDPXg9otJ8iA7wqtPG oNyevBQivezdEthPA5WW6jS/i1lr5fmKaX5o1w1zr/cYgGPEqRvLZasdMS7gVfpUIbkO OewiAy6tjq5CfPbjUsVKXcOxn4JKMLW9HumeUywS9EDpxJEWZdj3UqVlaRRBzF/7w3VR L5kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dZYy2+vR; 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 m5si1788536pfh.201.2017.09.07.05.50.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 05:50:14 -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=dZYy2+vR; 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 CC42D6E927; Thu, 7 Sep 2017 12:49:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com [IPv6:2a00:1450:4010:c07::22c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2A28A6E927 for ; Thu, 7 Sep 2017 12:49:41 +0000 (UTC) Received: by mail-lf0-x22c.google.com with SMTP id d17so24298477lfe.2 for ; Thu, 07 Sep 2017 05:49:41 -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=mGxzQ7JGefkz3Lcw/Y+QsvMdaAwknMdSq47FkFHWPFA=; b=dZYy2+vRqLxt90JYpKuTSK7rb9JWLM/91ZeFhD0TN1YWufFZJxWm0gnftU9g96nn1J PmxJfOS6eyQ1X67yhda5mzEgCfRaAZ3mDzgnFFlEPYeiB7sj6vr3kYpqAigtiApRBb+W gUD8eLMpVXnOYvN3Y4H/avVHfjksqRtGPo0/o= 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=mGxzQ7JGefkz3Lcw/Y+QsvMdaAwknMdSq47FkFHWPFA=; b=HJ3OIEBKH3PiSTsXZL2RXmu1mlsZmHUDmrag/yT+X0g9J8E1nnj6gN6z0l/5QLN1b8 Pd5vCdQbd7SrEaU67aBJoIQWwYxfvQr6y02LWWKqwC7o1nDHJyXY4f8rI5hQyJLiqWOG V8sjce80JU7bNWNgfxq+brvWNFmi9eXqQ4ThrPGDnDS6fBAwcWyzAhEXBiWr1F2dFywf keImFNpjV3vgC6boc7txWJOcBG3lpMdReJ+rfSl/95QlGnfHQixoyVK93kUxWOoqLNam 6sZ18eVP7pqtEBr61cdRMjOSFto5HU5kQyq2rN1cBoTPsTBJFUQtp1it4jgELviEDqc2 xP0Q== X-Gm-Message-State: AHPjjUjqDo1Wo965LWHTuOsG6Y6Jr/sMsmoZCz2wnZJQOtM+8ZLki/JF LeXBsthbFeNzc6GQ X-Google-Smtp-Source: ADKCNb7oBvtxdKoPADJqscEdp6jNJe8FeBsxeMt2VC/bNgDt7XAxxj5pAyxEG1rVE4WTi6Kgf4gF8w== X-Received: by 10.46.13.18 with SMTP id 18mr1077809ljn.25.1504788579449; Thu, 07 Sep 2017 05:49:39 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g65sm405841ljb.86.2017.09.07.05.49.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 05:49:38 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 3/7 v3] drm/pl111: Replace custom connector with panel bridge Date: Thu, 7 Sep 2017 14:49:21 +0200 Message-Id: <20170907124925.13805-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907124925.13805-1-linus.walleij@linaro.org> References: <20170907124925.13805-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 Reviewed-by: Eric Anholt --- ChangeLog v2->v3: - Rebase on DRM-TIP - Use drm_simple_display_pipe_attach_bridge() as suggested by Daniel Vetter. 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 | 126 -------------------------------- drivers/gpu/drm/pl111/pl111_display.c | 18 ++--- drivers/gpu/drm/pl111/pl111_drm.h | 17 ++--- drivers/gpu/drm/pl111/pl111_drv.c | 52 ++++++++----- 6 files changed, 52 insertions(+), 167 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 d335f9a29ce4..000000000000 --- a/drivers/gpu/drm/pl111/pl111_connector.c +++ /dev/null @@ -1,126 +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, - .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 b58c988d9da0..e4c692230548 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 #include @@ -94,7 +93,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; @@ -156,8 +155,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); @@ -204,8 +201,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); } @@ -217,13 +212,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); } @@ -458,7 +449,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), - NULL, &priv->connector.connector); + NULL, priv->connector); + if (ret) + return ret; + + ret = drm_simple_display_pipe_attach_bridge(&priv->pipe, + priv->bridge); if (ret) return ret; diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index a97f303f6833..000534d85b43 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -21,21 +21,22 @@ #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_panel *panel; + struct drm_bridge *bridge; struct drm_simple_display_pipe pipe; struct drm_fbdev_cma *fbdev; @@ -50,14 +51,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 581c452cede1..bddf24327910 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -68,6 +68,9 @@ #include #include #include +#include +#include +#include #include "pl111_drm.h" @@ -83,6 +86,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); @@ -93,34 +98,38 @@ 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; + 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; + } + /* + * 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. + */ + priv->panel = panel; + priv->connector = panel->connector; } - /* 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; - } + priv->bridge = bridge; ret = pl111_display_init(dev); if (ret != 0) { dev_err(dev->dev, "Failed to init display\n"); - goto out_config; + goto out_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); @@ -132,6 +141,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: @@ -236,6 +250,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 Thu Sep 7 12:49:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111909 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp40922qge; Thu, 7 Sep 2017 05:49:46 -0700 (PDT) X-Received: by 10.84.179.67 with SMTP id a61mr2883362plc.230.1504788586387; Thu, 07 Sep 2017 05:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504788586; cv=none; d=google.com; s=arc-20160816; b=C2IQPslfAioOmU3XYm2aC3TJiDnSkiRMKzJpCG6UsPlqmQf2oJqYBIlG60maVuywwe c4NslzyZzz3277ov2WkbXsnGqE5D7qbRjINscm0HCOI+ddLuqYQJroGaX1HkvoVuUxtr jH1QUN3Knp3GECzKeytuh3DJTMq95xIbiD0B1hrcsoRDB7yp+r1rfUiqyvcDolHGUZS2 FO3rbbrbFIx2+VSomipt/KT+IDjSARhByGYtiTVit39B4JOCLo/GNJuMLZqfA4SvQy3J ROXWjKPtpx5GaIl9iQ/t1Sag03z0M+KUpUm3L1cchOxXBVRasuITs3qY6JTo9kj0z8Xx c7Sw== 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=bC/y/sR297T6RuXubuTOJ5VeYtViY517j9esxJeU0k0=; b=jCtH3EOqXmrO6/U3raUzIaKGH9jOhaV7EfL00B7kRWOxkOfVgiov3da0o6cD5CHBUi 2HPfQG1qSVJALj/dlcdB228DYILtQgiDZG7V+ORCqyPzUjcYadjV18o30oOPRif54ZM7 ZliBm3j21cMYdl5orO5hnjMbxKjKl+oxl0KAI777JJ6vgY/N/is/vEW8rNvc7gvcZ9uB PrQnir7x9rOc9M5nc6zBqK9t+5XeorZO+dCiVfzTxoGSMMZWLxtTykWC7NLJw8JG329q JDcm7qh5oYUzyK8F5NModpLCknbWdrpGaQJKjunoUD0b1dZNHhLKLJWCsYFUBj1at96l rp7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QLgkotHB; 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 k79si1797870pfh.477.2017.09.07.05.49.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 05:49:46 -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=QLgkotHB; 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 82DF16E92A; Thu, 7 Sep 2017 12:49:45 +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 709696E92A for ; Thu, 7 Sep 2017 12:49:43 +0000 (UTC) Received: by mail-lf0-x230.google.com with SMTP id q132so24241526lfe.5 for ; Thu, 07 Sep 2017 05:49:43 -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=fisq9S5fW+B63P+RVIDm6WUJRAzqu/U9N7zXFE3cAvE=; b=QLgkotHBfocnCelA94wieJFBJi8O2DP/fuURI75izXT5w81rRivI+uud2FLcc/m4RP uPXLXjjnAxFiGjsCRLD6mvKPYODEicvZ7hODO5PMcjtEf+ZvHl6FeSdo7OhKQJAhRFYp wbnDNQxDuiBECOLAV+2xVJs6vimfENQUOH43k= 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=fisq9S5fW+B63P+RVIDm6WUJRAzqu/U9N7zXFE3cAvE=; b=WrK8dOqHCEyq2BXpx6c5PY4nC7M18esWL7OTSQqkp9h2bhA2uM2b6D60TBfS1Lg+IR /JtcEjoNc46+QKNv3CB/c9bmHdr3LQNrbn+te5f0Kc406EBIPZimdY2HBSWn9G79u3sd yWiURmRw+Ndg3pQljf8HqrpiiNHGAUZj+vLNzSY2bT1tDcuxEZEJ5HglaQpWvHZ5ZFuR FEzgLYiPiDdbQEybVJFT0xk9+ftgmSENIGH0MjPYfzRRQAw26vYi6k1fEWKV6maQ3ieF UhJXt7uwjt+F8p0C2b5LpZYHQkcXHBPpFZ22kCo3oYJh3tyRMhb5z6no836Xfjcs+gCx m2Wg== X-Gm-Message-State: AHPjjUhaAwi6ez8yPrBjKSMBD2CYwLAMHg+JtqF2xpRY3LRlXHXrZgNk tqMJTgxTqmbPzwfW X-Google-Smtp-Source: ADKCNb57460JTn0kH1xrbRf2S76eVHje6wiXnXJLx3Lt1qnpHh3gzpdXK++DIjlwvlzq7f2UN8rNOQ== X-Received: by 10.46.33.226 with SMTP id h95mr996579lji.3.1504788581769; Thu, 07 Sep 2017 05:49:41 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g65sm405841ljb.86.2017.09.07.05.49.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 05:49:40 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 4/7 v3] drm/pl111: Enable PL110 variant Date: Thu, 7 Sep 2017 14:49:22 +0200 Message-Id: <20170907124925.13805-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907124925.13805-1-linus.walleij@linaro.org> References: <20170907124925.13805-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 v2->v3: - Rebase on DRM-TIP 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 | 30 ++++-------- drivers/gpu/drm/pl111/pl111_drm.h | 17 +++++++ drivers/gpu/drm/pl111/pl111_drv.c | 86 +++++++++++++++++++++++++++++++++-- 3 files changed, 108 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index e4c692230548..b104011cea55 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -199,7 +199,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); } @@ -213,7 +213,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); } @@ -251,7 +251,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; } @@ -260,7 +260,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, @@ -404,22 +404,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) @@ -448,8 +432,10 @@ int pl111_display_init(struct drm_device *drm) ret = drm_simple_display_pipe_init(drm, &priv->pipe, &pl111_display_funcs, - formats, ARRAY_SIZE(formats), - NULL, priv->connector); + priv->variant->formats, + priv->variant->nformats, + NULL, + 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 000534d85b43..b380a7b4fb58 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; @@ -41,6 +55,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. */ @@ -49,6 +65,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 bddf24327910..903e948afea1 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -197,6 +197,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; @@ -210,6 +211,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)) { @@ -218,10 +246,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; @@ -260,10 +288,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 Thu Sep 7 12:49:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111910 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp40968qge; Thu, 7 Sep 2017 05:49:48 -0700 (PDT) X-Received: by 10.84.240.204 with SMTP id l12mr2889733plt.356.1504788588783; Thu, 07 Sep 2017 05:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504788588; cv=none; d=google.com; s=arc-20160816; b=gsfTXW4heixaZsvJlVrVF3d3N7Y6dqhmP6R2etNLDSBb5BfzkkVT+vtRUzHQoASL63 yWcbRSMAAuShhITa4+D2m94+apcqwBFAXXktyDdW3Aa0uO99AZ0nR6M+nhtheLUOwlvU 5cTIMra4WWzMvawk4yiFraeCmdQks70rBXm6LKuUP5HXExnVCI6FvekUca9as/D0oLIS ApooBPPMHvYEHzvhZlXBkLWCuKDiNZHc3s8heggJeGTkhNDvzWRyZJi4qtYFF8RfpDDO +VZ/puMYpdfrpG6B8Vb+Yhj1maQE/KyCRjQYnOqCGsK+dEooMmbRsLc/Z5nI7myPvAZ4 awBQ== 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=phJStX5/f4Fw8xJtCAtNxgSzH3AxSZu/549LEqYARCo=; b=XmcvCCIfqbiFM96nyy4XYYC6VljZ1K0rUdZae0upcKI3kOUEF8NsalAVI7jOg64BiJ /f0w+rUz9KGJUCJzUd8rVRVIhM4O6aXdmqXdBzaBzv3z+5Baz02xo8GCFDdBKnCwseuF 9NWmrx+j5RebQdfnWSKCM6BNt8jIlrkUNsE4cIuBcDCwM1gW6LQumgz/vMadcjGaNSap eObuBLRg4iM6i7Ysn4az9cKlvNI+Q2KUYXg8NUSmtps/tG06JEnGgevNk7YlDmsrXgBq Ri5W8/EBHpWPg2h57pQokQ1ZUXIiUxQct9DdBcsyh5+IUgYFslnz21a/sLtm0E+O7496 mHMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gB8z4kQN; 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 y38si1922094plh.313.2017.09.07.05.49.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 05:49:48 -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=gB8z4kQN; 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 840316E92D; Thu, 7 Sep 2017 12:49:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com [IPv6:2a00:1450:4010:c07::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9CEE36E92B for ; Thu, 7 Sep 2017 12:49:45 +0000 (UTC) Received: by mail-lf0-x231.google.com with SMTP id d17so24298880lfe.2 for ; Thu, 07 Sep 2017 05:49:45 -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=DBMFn9eaNq+TiYu1K2GplSGQcy0o0Nf1R50LQopOPzY=; b=gB8z4kQNz03ZapJO49LvAF4kiSbjYW9QUuagfoN171WFPJZeFbEE9PPTr5+jrXS8Cy sFkR4no3XCM5KA/gsKdwvtgo/p27dJnq22p0vkg/+U4xMBksq1FYJHLjWpLuW/O/hIuK pilkYtO9UyxKwAI6W6emGn4+LpjBwgRNrDptk= 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=DBMFn9eaNq+TiYu1K2GplSGQcy0o0Nf1R50LQopOPzY=; b=rch6aHn8NANSYAVTh7QzGSrykLTQQXJEj6GGJOztb9gdB+3trw5nld6DM9e/o1xHAm 6vO3XI284zBZd3JqyeFHxiR6OGK1aZSMN1HqySczGp6MG9aUTfyIquQEVdYY06HrXm0y 7uZ5ob55UXJ+ESxw+jCCfxPCenLUfzkDAG+Fgu99dvFy6pn97B2JvJowofNH9T2ftozt 7dVAsxTf1PZ1P+7VI4CmE4GKLUnlfDBxiSAjyA+oOQR0t27gxt5YfxFFwsdp8Yz5U9wQ 4BNnnrVow1e3NekNydfNzJrdzj83ScnMU9Ayk8tamWihOzVehLfaXHzXlSqlN4SM1BDx R2vg== X-Gm-Message-State: AHPjjUhWzZZkmMvbXnGUNzFxi8ivprSEvrJyQcoeXdGGActLwpVZTSK4 2Iwvl/kMChGuEZme X-Google-Smtp-Source: ADKCNb5wWnEzXCSO1pK1kjK2V8qXhvXh7wLZWf75HDekbtl1o/PQkrpLuyEW//+m1i6drUlwl96Ysg== X-Received: by 10.46.68.154 with SMTP id b26mr948907ljf.159.1504788583794; Thu, 07 Sep 2017 05:49:43 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g65sm405841ljb.86.2017.09.07.05.49.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 05:49:43 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 5/7 v3] drm/pl111: Insert delay before powering up PL11x Date: Thu, 7 Sep 2017 14:49:23 +0200 Message-Id: <20170907124925.13805-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907124925.13805-1-linus.walleij@linaro.org> References: <20170907124925.13805-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Rebase on DRM-TIP 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 b104011cea55..b7df9f5df881 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -155,8 +155,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 @@ -199,6 +199,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); @@ -209,10 +220,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 Thu Sep 7 12:49:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111911 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp41015qge; Thu, 7 Sep 2017 05:49:51 -0700 (PDT) X-Received: by 10.84.235.71 with SMTP id g7mr2830841plt.86.1504788591822; Thu, 07 Sep 2017 05:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504788591; cv=none; d=google.com; s=arc-20160816; b=LcoBttudDUR24cPRnly9cFCmBbnC3L7Do5XpUf92WsQB0cvO0AOGmDEce2Z1aTzDyC FTeFvfmMV24ShE6f+Zq5E8i0tFf9YaohQtWNuiLcbAIJYtw7DUBGJsjyURCpncAtDU+t Nz55NqCuxdYmBWCwedk6xGCs70krjlHIVxK13StwOGFEKIRNDDK1i7zCVLQ7gngmtTja LlTVUi9fvWTmouazX1mqQrUbQ6jd7rMUywLBAWakO5gMidxAsAACJED255cDJZIMWWug +NcCM/pQk0M5e4auwUTyfyS71TY1JQqfceomF7kTwx0gSJqqTLmbmNhtxXSnkWLzP6Lw ul/Q== 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=irDdtm+lUsGMY/HJ9J+ZJlkXUJE9rD9Wiup4o1wrrd4=; b=t47ksLblFKMf0+yagPRnj/IpmVabUjOg4Dm1afvytNUHec/5O8gKxFz/7Ydo+bWtL0 wMR16mI/Po9KAAIJ69l0iU+aEAPrdTlFjTR9TZuYtW2YoffzeLu+CHRjozvZ0pRkbP+v h4oXJlmk2Q6H3cB3rYVN899o3m84v5Flh5AmOuaqitTNcA1x7OzMHuiQCkMFGMI7he/t ulrNR0uZpwTLtybgDSxvF6xRChPMBrYWj6BXENi6R1CldmTSkJkI3H/56jPwKjNr/Egl LDDwrXokUkpglinb2EOXaBbo3OAaiakfTWiFOwCqBdzUvEUIdEW+FAir1fvL5s+P+uk2 nCAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XHa9p3op; 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 x9si1944075plm.380.2017.09.07.05.49.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 05:49:51 -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=XHa9p3op; 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 97CCD6E930; Thu, 7 Sep 2017 12:49:48 +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 601056E930 for ; Thu, 7 Sep 2017 12:49:47 +0000 (UTC) Received: by mail-lf0-x230.google.com with SMTP id q132so24241894lfe.5 for ; Thu, 07 Sep 2017 05:49:47 -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=XEMKQeRNvLYWPppqoNTO8G+t+oOBjGeBZjwBfM6AzIQ=; b=XHa9p3op2OByja2UAVLgDJbeboFEVFI5O/gnuVZvx8PMxbB22W7EvhNXW9zx8VxJNU c9Xm81B9Me5NdJ81t8602tawZsWFOMpkx7oFJFcUe+hUW7z+QfBiVkgGK7EkxSUHhUuK ViJ/X0IC8U+WfFmENQ6m5ZXX7nNAydeNBfwbo= 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=XEMKQeRNvLYWPppqoNTO8G+t+oOBjGeBZjwBfM6AzIQ=; b=frBNSHFW240ri1XB2ntjCBYtN0nMFLzqByURVlBSnK6Wx2RHbZZvDnUzu6rxS9uE0h p48cfr45YwFi/abYmF+OqS8hOLlCUCug0nA0bsnw+FiAXxNCbZZ/cqgxC/WJazVMBhZ0 zD5caHgufK9Zj2PL9fwx6kDtoYh+oCb6U93hpBqCQuRmxUDnZU2fg17p4+ygSbK+q8Yn Va1IYyuSFYBTEtvOqjr1u5n5FMfmCjtCR4pbhZhGVs5XuM7xSqorpiysHl7iL6VtoznN cXbpn+y9cMGMrXuwSbSFnHyuVmlvB7YdgL8xuZTuFrPEw8F5gdBgihjoOKhs9IMhM9U9 jJ6g== X-Gm-Message-State: AHPjjUioC9q6xIBG4DIjGnNonnqtKQ0LZ7TRH/y/mAmGdq1bNXzq5jfU Thj03TXHWZM2Pi9IgQcn8w== X-Google-Smtp-Source: ADKCNb56/coZNsncjg5IpI54Q3nQ6yPhhDl6LP06trkCjkWpySuGlHi25ZcbzzWun/U/yzKlE0oaTA== X-Received: by 10.46.77.193 with SMTP id c62mr1286410ljd.82.1504788585663; Thu, 07 Sep 2017 05:49:45 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g65sm405841ljb.86.2017.09.07.05.49.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 05:49:45 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 6/7 v3] drm/pl111: Add optional variant display en/disable callbacks Date: Thu, 7 Sep 2017 14:49:24 +0200 Message-Id: <20170907124925.13805-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907124925.13805-1-linus.walleij@linaro.org> References: <20170907124925.13805-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Rebase on DRM-TIP 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 b7df9f5df881..68847a074331 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -208,6 +208,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); @@ -237,6 +240,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 b380a7b4fb58..440f53ebee8c 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) @@ -66,6 +67,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 Thu Sep 7 12:49:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 111914 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp41648qge; Thu, 7 Sep 2017 05:50:25 -0700 (PDT) X-Received: by 10.84.199.170 with SMTP id r39mr2856041pld.375.1504788625711; Thu, 07 Sep 2017 05:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504788625; cv=none; d=google.com; s=arc-20160816; b=xG7jTYbhIR1e9XnZrQpV0batpykEKLAusFqnEkg8oQDAWvB6+GVVnmujiJ49uxCcDN TKPZ4EgMNqc1+FyTHH94Aits1HV3HTd7o6N5GlnBcUPMv1NNRgY9dnSV4YtPv1/7P59x fSYULxRuIdZhUPjxAZa62HhEwNV46u1N1Qb2yIYL+0nGsh/opUYAvLqBqcaQtSD6o5VD /9fycHYOL+bvjX5/Qq3Uft0TecDuta98rfnX6YyProBhVPajej34ikCJOMm3tZ25otmq dFeBtPEgde1Q/NfTyFT0YuwcAAKkDaAEzv8UXg/gh1qKPPEjTtrGIYWPKHkfZQXEt5ur HrGQ== 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=lfLXP/i4NFSm/NdIk9CRU2WFSEYNhh3B0aclPivauYI=; b=IW+HG9VoY+/8vOZPoqqHC4WnhMLia0x+AnNTnxuISst0qBv12Cafi+Nr38pMdZDghr BrY3ZtQPLgHwBzY/XCPY0u8x//UiCXfRQgPG+LO/oXLMQxPUH5cqMUamwjOFPtMIJg3C XUoLsIFI+DT9xHigKjQrW5Zl4KDoBpxbed7esg4E6lEbFz/POH2R6HrAvrEfkzKmRdds 2fceXozSRrT9BhCAgL3uD1BVXojROd9llhT/I2D/hPoSz2uXy39k7F1Qd/jugeFx4W86 tEJCsrRcTx97x/Oltyg8JuFysGD7X4R8bErB6eqcDbb/Z5To9WbbeI8yIGmnm9QJxQOh 3Kcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kzZBs5wY; 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 e1si1700679pln.792.2017.09.07.05.50.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 05:50:25 -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=kzZBs5wY; 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 96A2F6E938; Thu, 7 Sep 2017 12:49:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22c.google.com (mail-lf0-x22c.google.com [IPv6:2a00:1450:4010:c07::22c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 851A46E937 for ; Thu, 7 Sep 2017 12:49:49 +0000 (UTC) Received: by mail-lf0-x22c.google.com with SMTP id d17so24299307lfe.2 for ; Thu, 07 Sep 2017 05:49:49 -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=ige+nxIyXya3XdFy72QhGsKbPkurx4B+CM6p7V0znoY=; b=kzZBs5wYtiptCiiVursxDE1u6dsPesPZcxGIxuScMM3FBvv3oT2yiaVQoNJqshbEeE UlBmqyy55omR3hFrnZfuwzIVBB3MWME4J42giWEGSL2tyYeekEPY8/q8JBG20DoE7dTj qfb5dCpb6L56tNrH3kaXOLQRdfRblOhGk/AhY= 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=ige+nxIyXya3XdFy72QhGsKbPkurx4B+CM6p7V0znoY=; b=bfi0Y73wctELAt5Cn9gKyjafcamkOcJkY/9jcBoFFGFWv44FqYMZZzk9KRakKBkLgP QI2QIvbyuTe805hDeJm++VSoqW/m0LiYI27KcVQ+5pybK4m4jkzDyoVIZpwOAVm1y96p TJ8PNssr7LheUh8pGqQLuGlH/DqwF8OU0XjhLanFJ42UUSl+sphe0zCeDDUgi4bzzS6o hq2BaPCb7dG18sNCWDSsulDOP31LtEGwoqbgqnxcqWadv6ZQUgJwCzwSd0qzuQQtS28c bON3fatYlw2j3ke+zx3ohzKj4umUQvFpMhCNgk1vlFA60IkbPELCOtpmqspSCtLdD7si LFUw== X-Gm-Message-State: AHPjjUipsxvUss9h3JIhpRUcUGa8ORmfJPTXKO0um/Ig/HlNTq882DvG EW5avSZOQvwn8Fxs X-Google-Smtp-Source: ADKCNb6pVNBK+tp+t8ZqIrhtbqqZt2HLQL1obWkBhdVMieflBLgsnJ0/9c35xTyGhh2teerfSpraAw== X-Received: by 10.46.7.67 with SMTP id i3mr1094935ljd.160.1504788587593; Thu, 07 Sep 2017 05:49:47 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g65sm405841ljb.86.2017.09.07.05.49.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Sep 2017 05:49:46 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 7/7 v3] drm/pl111: Add handling of Versatile platforms Date: Thu, 7 Sep 2017 14:49:25 +0200 Message-Id: <20170907124925.13805-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170907124925.13805-1-linus.walleij@linaro.org> References: <20170907124925.13805-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Rebase on DRM-TIP 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 68847a074331..cdb042951de0 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -450,13 +450,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 903e948afea1..b7dcf155bd0f 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. * @@ -73,6 +70,7 @@ #include #include "pl111_drm.h" +#include "pl111_versatile.h" #define DRIVER_DESC "DRM module for PL111" @@ -255,6 +253,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