From patchwork Fri Sep 8 12:47:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112065 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1558666ybm; Fri, 8 Sep 2017 05:47:23 -0700 (PDT) X-Received: by 10.99.98.70 with SMTP id w67mr2988449pgb.362.1504874843415; Fri, 08 Sep 2017 05:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504874843; cv=none; d=google.com; s=arc-20160816; b=N5scmcXMPL4WZZtc34SO+6QOdHNDa6liHJDNuR00So56A1ci0jkzwSJ0rTXxzM6MM0 wBchFrHvqbJyj8hJoK/0v9y0wuhrm1rhBTcN2nZyBNgTu9WdrqCB/ilt55a1Bl8Ke6A9 tIkcJZ+lH+jhTmz7u9JO6S3UgPoLRRmZOG+GshkwzYk2DiIgP//+H7JqBVeBrv2nclsV omvvWEMyS7YoYivVxRvIAkIHc+7azBjg4/h92sLjgPnsYVGOUu7JqYTiOJYuqv2hw/y5 2ioJfKVZHLut1V4vA5+MehY1/j5u8T9MXS6ZBEkwyanXS9DD86Sb7RosM9ZJZTIWdiyp GG4w== 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=KL6YzkG5Ksothl02r52/cMSFCtuECsBGXXlbBaJIP4Y=; b=ZAQBGfk6gA8RYp6trEn23Y0dYv1coWeCteP1DG3OdUHbSK6BVDMrutQL5UBiSNTXUV IfTbw9gFcAJ6CkkXKILoqFqcqU34XffQDPspjoRhCpN0SJP8UXTekQQjiic/OPhVB0WP G8w5x2T1W/OXqndSHAeB5c0CE38MKjtwEZEuOR1t098rZshVEh8v/YWJOjrvBcIy9qlY H4m/o2UBxxQsiVKD32SOKAg/AVNty7ddPxAewIKcpkvAZuDqAPOHmMqka4u/kvR5nlT2 JpIrdfKV7rwT1yozShNHLytQ6xhg4NYZE1ngrPiS4PrdmUfpyz0ydQA4V8fuaAFbYzph Kf5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Rsp53WIR; 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 l63si1613221plb.115.2017.09.08.05.47.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 05:47:23 -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=Rsp53WIR; 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 90E866E0D1; Fri, 8 Sep 2017 12:47:21 +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 C0E326E0D1 for ; Fri, 8 Sep 2017 12:47:19 +0000 (UTC) Received: by mail-lf0-x22b.google.com with SMTP id q132so5392674lfe.5 for ; Fri, 08 Sep 2017 05:47:19 -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=+Rd/xZw8GVGqapYI/C3IDbTbJZkTkbX2hUZjWSC3hn0=; b=Rsp53WIReUKDtXaWhNeewTiS9I8WsYEh26qn7OoD7QQ23SIxE0/B9qZ5hZ1Ws7E8Rl A/0VCsgtIsvNIVO2ksoSeBw07Apn58rzpD6cEEbXdfC/Ed5L9w7MdKeO+1h2w4rUmowF k09oCakl5wwSsSL2MecN7J9khuBq6DAU37DZA= 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=+Rd/xZw8GVGqapYI/C3IDbTbJZkTkbX2hUZjWSC3hn0=; b=LC4dRDfFbIxEUCWTd29PgmK+uOPpc9yqL44uYZwzfQCprkEEj6rxVyi+F4L/Wb6xqQ OmTRkcu7i9uNXpnohwedO3oTNXDX1RTn3GpTSZA0hyRT7JHCXJ/dQ1+r4pilzJ1v8VfX rzKQkI+ALJ0CUtl9y5r1RjFAM79MAGkTHawA58/Ywras2MmAWDb+BUFW5xVPS7PZvZ9B uLnlftGdgc2nE98ptoTPrXo65ic5mGUkB+uEKn7wWL71FFxIyas+yhVDOlcmexl9Zl7y B+8iLuVNuPgTz8f8RhwJ59R1SI+wnuxbHtuucaeuyEUeex0AxcWTQN6ufUFLePlCTIOA PVVQ== X-Gm-Message-State: AHPjjUgaUs/mhe8jJAUs3zvlgMtsZpp81PVyCdTcQiF/gj5DVUdY8Znn wbmgP0Exljn04Vk7WHgv8g== X-Google-Smtp-Source: AOwi7QBLtA/zLCV4YExsDJvovx6gBXd6XIOfgldAChFjUFYlZS86AloPA9p9vwOBaypzC12bS46SLw== X-Received: by 10.25.42.25 with SMTP id f25mr897181lfl.173.1504874838123; Fri, 08 Sep 2017 05:47:18 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o28sm317427lfc.9.2017.09.08.05.47.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 05:47:17 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 1/7 v4] drm/pl111: Cleanup local header file Date: Fri, 8 Sep 2017 14:47:03 +0200 Message-Id: <20170908124709.4758-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 v3->v4: - No changes. 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 Fri Sep 8 12:47:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112066 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1558696ybm; Fri, 8 Sep 2017 05:47:25 -0700 (PDT) X-Received: by 10.84.210.107 with SMTP id z98mr3335036plh.79.1504874845032; Fri, 08 Sep 2017 05:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504874845; cv=none; d=google.com; s=arc-20160816; b=0ld01ryuIW/RUC4wOZPYxhC1nLPKqp6vdVmewnxGFdDw4oFlnrOSZXu8/mza/KDp6f 1Tv09wRucbgdOV80LIfZw3urhHoINFn755XfxfEWpfRFz6jPS9JML2qEPp6tTRmkJ9IA C9BpUsGS1It9qTQ/qf35cO/HnBjOwFCpMpMpDW15AvYahjxLcUDLpyYUqEXaCV5ep38/ bL2FJUIrfbcdiuWMCqGi10MlEh3/ro17Kp/G2S/RcXz5kf/N0ndRaR7G1Ki12dW8ffTm eHdyeSii76v32d50TXNNktEmGnhTk5NZ8rRuBWETea+RV4xfBBm83/1rJ+MD2pzqGkkX 317Q== 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=M6tvzvNxaa/CosVh9c8uAkTSGj6QYej46Lgr2mYyJkY=; b=CvkdwX6mm999PqpEQnIfLPN9qHR1IOU4EQJ4y6urXyHVD61sd91DZ9xoUO0esPUeN/ 6ZrxmJe2dJ0F0CQ1VajhLMf1+2nWESJTb3u9DfdrU146yvvOqrQxwbYyE1OtnXP5gCoJ dQwSm14LjWaGLdm78T4nnlPp8MZV+Up5VXnWO7shfpdzhtt79KCFzpt6RuHVshsN0S+V RHS3v/QGGX1FV4xd3lDWet6L1uN4p9Jajvbf6qR+JMHEb9JlUfuIzdoiqQyo+Meyz2gd R73vhFyZ0IiZx4UnHv2HX4aYdcGRJN100LjtneER54ejCVDXtnjrWgl8ukOToee0ZNcF scdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KddtA2PA; 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 o61si1615630plb.291.2017.09.08.05.47.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 05:47: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=KddtA2PA; 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 6C3DA6E29C; Fri, 8 Sep 2017 12:47:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id A4EC26E29C for ; Fri, 8 Sep 2017 12:47:21 +0000 (UTC) Received: by mail-lf0-x22d.google.com with SMTP id c80so5464922lfh.0 for ; Fri, 08 Sep 2017 05:47:21 -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=EABU4qjpY2weYoAPHzcI1kiLubBxgwevWD+MLJWbcXo=; b=KddtA2PA2mnMNqX10Ms3jn3eRNB7amELYJsC2HmSfkoX4fgKPxpI6VUpl5VwuJRBO1 iVLOEQ7KGctlOUrES6aq2oR/P6InK1R2KItArAG/l5Jwdkf3QKyFTb0daG/GYk5vqVZ/ 5ELhH0iDMzn9z4Ldc5TS/cb8bMgkbbaE5oIbY= 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=EABU4qjpY2weYoAPHzcI1kiLubBxgwevWD+MLJWbcXo=; b=bYa59r33QobEgLOqg0vSCwdHlgyCKz5oBU9cSO/597l+uMXQ6h6TT5V/6im4/2SVPk AkankCP+2/kYSQwBMqjC44tYhe6O+AoeejJDjcVCpFxJW/OghDpwLcOU0Gcncc+axonv rMbmvpibuTenvQ2mNZw7xoqmLj74hzDYOI4wdEcf06xbhzWqgR5UQxNe3tAjTEf8aJLG 9DfOQ9Flvo55Vwm1rae1jsq+qAReeh8Z15uOlX8Z4EzVJ4P+TyhFZOXgx1/xf38Bo9W0 qDbjnIWUD0iBfk9+/XAsk4BmNf5rfE01ixzsYE/2o6fC3qNIOSOhYQUorF5MWs5YsGqm Wzrg== X-Gm-Message-State: AHPjjUhFn8KwY7uxsaepvMz0if+OMtfxVgWfOeQTjTnuyvbu6NMfxNXK muIvJSgtL1ywhoWP X-Google-Smtp-Source: AOwi7QBBgvDTxSodxjxmO3TWLnM7Hj2ldtbM+xbYrnjvTzs5emuUDmg5vQUbzcxDsfZYP4qakqghpA== X-Received: by 10.46.71.15 with SMTP id u15mr1066858lja.166.1504874840002; Fri, 08 Sep 2017 05:47:20 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o28sm317427lfc.9.2017.09.08.05.47.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 05:47:19 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 2/7 v4] drm/pl111: Add all registers to debugfs Date: Fri, 8 Sep 2017 14:47:04 +0200 Message-Id: <20170908124709.4758-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908124709.4758-1-linus.walleij@linaro.org> References: <20170908124709.4758-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 v3->v4: - No changes. 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 Fri Sep 8 12:47:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112070 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1559391ybm; Fri, 8 Sep 2017 05:47:57 -0700 (PDT) X-Received: by 10.101.86.79 with SMTP id m15mr2960837pgs.157.1504874876951; Fri, 08 Sep 2017 05:47:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504874876; cv=none; d=google.com; s=arc-20160816; b=HNy2GtlPufHbuDoMvDM2bssmarUEcP9dVv7IaT8Rww5maYRgFUsh974jrDL8BL5Vnp PGvpeDOqi/VSBdLKwSnVr2mNJt9AO/XPgiJh3B39u4QDCyA2qyaG0ssxBkcmWRcOa2C1 Gu5h0PabJxe19WkWaFpL96M1kjcbOPHd00qWW8oxKG23oFR9r9QuVVt3gvZkFJu7jVeD RpbZU7Z+m5ZQUAzL1j/Ow2EArGk+o8b7QeS2V+rjYirrxU70pJWNzX4H1SSPqhkAPbLL c9JeGZzMD2Vyjogr6L3O8I2qckBrYbgFdlsUcwVl/Tc4FkqZOo+4Xd0Flccn6UnHhKnl F+/w== 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=Ng1j2vQeMcE0q970+V2vjfrj8A0pKcqwOMGU8TsBIRs=; b=wKEX4nrCM0j5VQ2JMxGKpwRqWXdfvBFVYii7ZXpOZNIX4R0RuqX/0T8VelhnpVYkPN TbzUEt3RnRySbzZ0pKsPcAL7Ec9aqxeWZHo62HX658AmYOzGKXfCAGmdWqi1I3VpBrAR ci/fs5tSjpcmDUgpj54Ct4hLhCtHkqWTU7vdMknRoVlmm19oSaainAmQAUCuyggmye5s LSTIYfR+jMo3ItBkUeJUmCXbNzqdWmJj1itZ+uriiRHfXKyVgCExk4genOQQ9TkCj+eD 4Gsa33AusgfSTGRvvn1tHMoK/H9LDwDZXANujF5px9+rNfiG39hCmdr58YMg/ewepZgW pC3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e77s/gAz; 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 l13si1482508pgq.315.2017.09.08.05.47.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 05:47: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=e77s/gAz; 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 C07146EB31; Fri, 8 Sep 2017 12:47:25 +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 DE0686E0C7 for ; Fri, 8 Sep 2017 12:47:23 +0000 (UTC) Received: by mail-lf0-x233.google.com with SMTP id l196so5451602lfl.1 for ; Fri, 08 Sep 2017 05:47:23 -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=ry/vNoGGhdM3JaUw3G0Buxodvt7AMMq6dTsSufB5GK0=; b=e77s/gAzbZJA5JQLBC85uhDlNCK+8b15p+C0vXQlI3EAmM3bh40i98HRnkR54u9cHj vt6bI/ZS4K2f8fefCmlENOpzGs5fJdcEb7zIwZzn6PF+01LybuvLljeUd5FPDAXK9f6/ Cfv9wNkhN43NZGmRwp+cFHZxF+4yauJTFlVug= 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=ry/vNoGGhdM3JaUw3G0Buxodvt7AMMq6dTsSufB5GK0=; b=WY1zNwNJ9fNCMays3EGMDP7dk0+HTGdcDm7uS7LTVk3/+8KBpXeV1jdygMLiLMBR8Z Yy1lXkmXM5Dkz86WgeiH3FNe9Z3m8hvYbOCf5kdtEDFPf+9vGJfCKejxpJSioAGdnWoL Bz4YrRky4A71WwI9mX9iXXY19X/FnpxYx61G9B2aJPHLW7Z8BAHVg80CeDDaosmi3vvo V7/+/xOrbnfOG1ZlIhdDTmFhGC8AwMX7NdrB38rXX9ttab0u0C277vMmjcfAOuEmkxUr bsVp6k0mMoF1yz7c9uRz8Bv+fDCox/ozVouc0bcXPyxyZtab5iGLhg5b6FCusa6d9ZrT gCEw== X-Gm-Message-State: AHPjjUhyZbuS5L3WhFEAaM8x1Z61+qXMhJJCXPcWK0OkY5FYU0WdwChU VUa5dP6ljRYDS5n0 X-Google-Smtp-Source: ADKCNb6EMYM+/gMAxpCl7qSJXd7JWVzQHRYbCVp5aEW2Wch94MjkV1bBhnxOAAOp7C9NlpHqLy4VAg== X-Received: by 10.46.85.205 with SMTP id g74mr655418lje.84.1504874841876; Fri, 08 Sep 2017 05:47:21 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o28sm317427lfc.9.2017.09.08.05.47.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 05:47:21 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 3/7 v4] drm/pl111: Replace custom connector with panel bridge Date: Fri, 8 Sep 2017 14:47:05 +0200 Message-Id: <20170908124709.4758-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908124709.4758-1-linus.walleij@linaro.org> References: <20170908124709.4758-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Drop the surplus drm_bridge_remove(bridge) calls. - Collect Eric's review tag. 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 | 13 +--- drivers/gpu/drm/pl111/pl111_drm.h | 17 ++--- drivers/gpu/drm/pl111/pl111_drv.c | 55 +++++++++----- 6 files changed, 49 insertions(+), 168 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..9caf50d130f4 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,7 @@ 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; 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..7dae687a8df4 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,43 @@ 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; + } + /* + * 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. + */ } 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_simple_display_pipe_attach_bridge(&priv->pipe, + bridge); + if (ret) + return ret; + + priv->bridge = bridge; + priv->panel = panel; + priv->connector = panel->connector; + 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 +146,9 @@ static int pl111_modeset_init(struct drm_device *dev) goto finish; +out_bridge: + if (panel) + drm_panel_bridge_remove(bridge); out_config: drm_mode_config_cleanup(dev); finish: @@ -236,6 +253,8 @@ 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); drm_mode_config_cleanup(drm); drm_dev_unref(drm); From patchwork Fri Sep 8 12:47:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112067 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1558764ybm; Fri, 8 Sep 2017 05:47:28 -0700 (PDT) X-Received: by 10.84.229.143 with SMTP id c15mr3405227plk.311.1504874848602; Fri, 08 Sep 2017 05:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504874848; cv=none; d=google.com; s=arc-20160816; b=gMA8YhPiX9pTmGUvq3K9YH7J5cInmJPbiQUF+eLD/SyuG1/aQiC7SccQjIpzgGVBAj mbr/FqptbrMRgLuuNIsDqEdjVxWWWp+Xa+Zga2PfVxxgXrxrpCEx6KAi6/mMaqo7Q2Ro k0UIMnPqAWyZbW6YdHr52WoHX9vcWlKN1H5HdkGaOgtbVxpxbY+nYNf0pTGbxHVep85R 7ZR7Cpyw14Ld4iLgMgNztjemoN2XD2OftPpL7SnyxhX3DBi7RXr/m8vqmzxRKcBpr6wj pDIQP+TOGrf7yItCNr4akfTfclXSrw29UCjq+DQIb2Snt9FbE8cZTF1RPLsfrL9MRI7n h7zg== 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=QO21rwpnyYv4uZtEaFIwhgZ/iKTgzNTUZDDn8d6CXYY=; b=tJGQSSZHz+mR8N84keU0kwczh4itH0CnCAa5/f+oaFBMfNCv12TAAS2nPgFSE5ODVd OfzEkRfwo0dNPz6yp1iKhhtNoOSrp+e9lqLA/a30d2ity/r6PCZpqCFSowIYp7OqhV4v oIATzCIXJaCUDAlMeE3XKCs9cSYtkjr49kEwjAUeAf7tBW+LBbpajVkpoeMbxG7o7fk0 5GiyHv9rxMeYlgGrTZZRdAFG+1SKM5/rKipZhB05xieD14rVNsmgKotR9P6s55WoSUww TbjqYRprV2keN6jL9l6WhbmFI8l2ZmYPPhRbTmIkkuGG+9VQbbLIoTNlj2giuJH/nDcv cqQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=E8J1VEUN; 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 a6si1579290pll.406.2017.09.08.05.47.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 05:47:28 -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=E8J1VEUN; 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 3767B6EB3B; Fri, 8 Sep 2017 12:47:27 +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 57FDF6E0C7 for ; Fri, 8 Sep 2017 12:47:25 +0000 (UTC) Received: by mail-lf0-x22b.google.com with SMTP id 80so5422486lfy.4 for ; Fri, 08 Sep 2017 05:47:25 -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=c7Mz31N7bUGxGUVY5YJsrUZO21tnJCRiWvp6FAHnyO0=; b=E8J1VEUNRGASPkO6uRNeeNZlasJ3AN3pHtpIRLVVjIWDW3mcLv+9i/TK+V07x/Qrb3 vxd4WaVjZbe6l3a+Xdl83CvcRp0KOjmEok7ml6SQoj3c5MyjB429KL7Xo3bZEHvkddJ0 5e5R5wALpwBZN7AekZ42xPQ3AWB3kseCX0PeI= 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=c7Mz31N7bUGxGUVY5YJsrUZO21tnJCRiWvp6FAHnyO0=; b=FA0vFtCv/CKwVd6EvfmgRxWOyB4gmx4Sf+8X3n+QpQOov8IyUDuPEF6SgtCX0m59U2 etWNgEuYl4DoW4LgfhWIK741Y9ljvyrr6w+vzqSupvBnC477Nl+xtdbrT124v1XkAzX+ fCLZYRbuIbBUupF1nqDTQWU+jDfW/o5Sg7b/Vhs8xfTu4eHlsCQy3oDtK7xbCjLhIS/A S78tUAYovv38Bkdd8gDTt1dGpnIuMiznZda24hZI6KZtNkxojBATLyLDcpJ7MRwFYH/u munlcgzXW4n1VIdCRGfBcZ313a0sActolVhekWVKcnnqcipSSBklBcpC7w7E3jNqH/UT lthw== X-Gm-Message-State: AHPjjUiYbuym6gwo9GM6Rh26TOvi5WBpeUk4QwjY1AwPdPcY9RlN+/K6 xfSqqsN+oK2Ro8L+ZTYnHA== X-Google-Smtp-Source: AOwi7QClPBcMZa2sF1oH5anJgoyfxRmtCfC4Klqmvwt1CCVBCrGO5T7CNWDfcYWj/C1UabG6bD5BmA== X-Received: by 10.46.71.83 with SMTP id u80mr974198lja.111.1504874843697; Fri, 08 Sep 2017 05:47:23 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o28sm317427lfc.9.2017.09.08.05.47.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 05:47:22 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 4/7 v4] drm/pl111: Enable PL110 variant Date: Fri, 8 Sep 2017 14:47:06 +0200 Message-Id: <20170908124709.4758-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908124709.4758-1-linus.walleij@linaro.org> References: <20170908124709.4758-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 v3->v4: - No changes. 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 9caf50d130f4..c08706be4b7e 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 7dae687a8df4..7a47db066a78 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -200,6 +200,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; @@ -213,6 +214,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)) { @@ -221,10 +249,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; @@ -261,10 +289,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 8 12:47:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112068 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1558826ybm; Fri, 8 Sep 2017 05:47:31 -0700 (PDT) X-Received: by 10.99.174.78 with SMTP id e14mr2936033pgp.155.1504874851619; Fri, 08 Sep 2017 05:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504874851; cv=none; d=google.com; s=arc-20160816; b=vB3fK8H9AuKcMKPanbaGwuI+qnY2fwCkwBjQtZCfQaxaonVqBpZKLZX5cCpI6Mauiq A/0HqeJB2ZUT4x6LIf0BF7b0IQC715W+D8+EKj/2bETkdXbOW3FQZmElb0sCfrfkG43y RFF6cB7/BwmwXDjBzI9Aa3oNrIPwPf1d0FdBpHvV/nUIQPV+/BK/L+S+WKd7pcnNdg4C vlVkGaIX3RaEPMLOmX1yVCAGOuITyGQ8pxPia7tNWXXGKjxeBPeyQU2BTi3yagRsZa15 fAiedywgGo9aX62lpR51YUpko1xe4oDi5Vm5VP7FuOZ3yH+IHf93o5ZbXmsaXQgTuJvF nzjw== 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=bouMyY6OQ4k/qE0o0F1Jj7xJ+Gp5cNmI/Og+GhgO80k=; b=RmwowDffGis2EvqqRKDMijWMm6j+Zi4bAc8EpQuA2HTgVDr5S/psdQeOe1M6Arhrsq zrR+pXYnkfF71iTfa6JoT/zvg5KxAOFo72AO9urSKvYpzouzCekB418vGqiMAr+PaI51 rYLdLzXYZiTAvg/sTzPO5c01dfuBpzSx7gY/lmCH8+MuPN96tJv4SsOiTAmn7WakckCI wZnIqlfl9c/kTd7o2O8byHWB75DU21FQ7J+s09USawXsKA0XKmi8fP8WxkiObNBPn/Lr 6BS5bTPf1bf2cGyZqEpJe4fNwQBYEKvx5fK5gDP+bhwVOOKKUIVVnApwbQLjOf+zEPW7 ijpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CkUDGPyA; 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 m23si1539672pfg.11.2017.09.08.05.47.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 05:47:31 -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=CkUDGPyA; 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 879996EB29; Fri, 8 Sep 2017 12:47:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x234.google.com (mail-lf0-x234.google.com [IPv6:2a00:1450:4010:c07::234]) by gabe.freedesktop.org (Postfix) with ESMTPS id 367036EB35 for ; Fri, 8 Sep 2017 12:47:27 +0000 (UTC) Received: by mail-lf0-x234.google.com with SMTP id d17so5433054lfe.2 for ; Fri, 08 Sep 2017 05:47:26 -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=C/chJQwuGntfluB5Kf5cUea+c/Glat/WRbkaWbl9yuQ=; b=CkUDGPyAhaTocDfNIAsISeozw2TB3noRd7TULsyMfi30TjSMDjYXVFUqw97OVUwYCs ErizfIcGm6TzWgAeimwcegfoLT83giMpnS5KBofYSyc6S2N1yCQ1NKsg8KJIasdEHIyh P90MxwXfdNkT4pVt1fDtcqa60uBNBUvUddYCE= 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=C/chJQwuGntfluB5Kf5cUea+c/Glat/WRbkaWbl9yuQ=; b=C9Y9OYTD6bCJPEAMkPtzK6bCJRjcJvDXoKISlgMFn8QbMsAIKnyA6M1Bt/I3Gs3ett LrfucKaPEHAMVzvTHj44HQXZQzRxsV+/AL1aDDff4l0qqriZ+rgtI4Gmw1yxZKJccL8A 9wM2bYCtgG9vGy/DpVQNbjJEpbjh7tiJ8QA3IEdVMsUYUk/irTBM5cGQzq3vNmVudrlF Ngs7MPeDRcRuZSIslkz3BRrpjPBi9pbUqG4SlhvO33AIU6ePk/Vfoq202EeLeT4Nqyul FgjHWOIHESlHRi0bW0LslcKmSA6ATkqWecRUIJuKDMzdPsY4suvBToqTs+vMBUsCnDI0 eZhw== X-Gm-Message-State: AHPjjUiiwpJrwHwuz90mxRXGX0J9aG3/87f1cDRzn47f/DqLp2e1Gz2z PQ4jl7V6I7NlDwcx X-Google-Smtp-Source: AOwi7QDEBd9jUdGSWL4XSsCgBZH4q9c4pbuom/vbJz4bdJcazTTQvoGzB7TVBFzgk0HFla0O2+JpiQ== X-Received: by 10.46.77.141 with SMTP id c13mr1009239ljd.150.1504874845486; Fri, 08 Sep 2017 05:47:25 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o28sm317427lfc.9.2017.09.08.05.47.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 05:47:24 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 5/7 v4] drm/pl111: Insert delay before powering up PL11x Date: Fri, 8 Sep 2017 14:47:07 +0200 Message-Id: <20170908124709.4758-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908124709.4758-1-linus.walleij@linaro.org> References: <20170908124709.4758-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 v3->v4: - No changes. 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 c08706be4b7e..3091fb4559cf 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 Fri Sep 8 12:47:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112069 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1558905ybm; Fri, 8 Sep 2017 05:47:35 -0700 (PDT) X-Received: by 10.99.109.13 with SMTP id i13mr3063902pgc.349.1504874855397; Fri, 08 Sep 2017 05:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504874855; cv=none; d=google.com; s=arc-20160816; b=x+cy7iGhvkuCvu0aOMJEbMVgyjgHGVVpanB+tlOdOMMKKsj3aJgcpLSWSm8dxIguu3 UOcpOYcVJyb1VCN4l4A1vbCcY2piJStqQ7xeKDmIle4niI9JC54uqfKIj2FB3WCmcsKO d9ShpfPjkKBI3BQN6W+vJrryrM9ITXc4gB9lazYyk3uNIrdWWOYpj4GCVdb34vPCIm0r XU23zcM7Ry/Jyw/yWKsv64QoPbVnkgwDF+Wi6Fu+XdKd9zWl2oU33cegMCMiNANi9k+m C50iKOjfEmlYDB1wyb6fJUn7iYI2WN8uZxZcRbSjC5IvKyctUSsEBXY0CTKj4d0DKXRA h5LA== 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=IvOtWq86aTQNbwENmgIv7eLfJ+vm0fscuswHDoiVLQs=; b=Hqw6zEAcstdwq1lSpClc1hj1D8x5/3I5pXAPDlBbbyL1N6Zf3zjoKbou6czmKtBWIg 4bu7zXYZ6Up/vxMucsAt4Z2Yk2d/TqzGIOqLXVbe+PTT0QFctE9xLy/HowwAro/i7+xN MTSgJPaX4JMwy8BwrOISsHjm9fJjkEfqZBX5xt3/hjr9JUjcPH/YoWO6HtXYXByIpVIp jbODqOoNHyk9g0yurH4JV60aqORpF1M1MN1/DzHjyKyFBHP0ZYFu0XQ9H34LAD7slzKn vekjalnq2vedh3G4r4aRRey9AJ2CJO+Rqxzvm96fMNWaNdAK7MxlstHRcw7MvUIhiBI3 UKLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=emubVV+V; 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 c30si1438832pgn.743.2017.09.08.05.47.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 05:47:35 -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=emubVV+V; 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 98AB76EB24; Fri, 8 Sep 2017 12:47:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x22d.google.com (mail-lf0-x22d.google.com [IPv6:2a00:1450:4010:c07::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id B15046EB3F for ; Fri, 8 Sep 2017 12:47:28 +0000 (UTC) Received: by mail-lf0-x22d.google.com with SMTP id d17so5433219lfe.2 for ; Fri, 08 Sep 2017 05:47:28 -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=gB2GMFvw0/jrEzOEqx5mHtst7IZGIDPy9qAcxP8D9mk=; b=emubVV+V9UE/AOrzsr0FLbJ1UfiSc5nnR0os53T58VrAvD1XqLySRwC5atbvnBqNXV tD1kllHcHMvLLJbGU4BbBJJhfASpBmudStUz3VennMcUyFLhB+R2/1zFdl17df+fq4oA 0/AodyOoiqXI37qWDZg7ovxYjZJhvIVc7xu9U= 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=gB2GMFvw0/jrEzOEqx5mHtst7IZGIDPy9qAcxP8D9mk=; b=BRH5KnmKjgu6gx0ULweODIN5YZtTHopiJv+kqS/GdT0VzdiJCpzxk6ZGRxuHPDaQMp TaQJyHxBOjFdn3d1kArlfvTPXUgzBfNRDa6wpSrWuEL09//rMc20e3x+K4b/HGPVwJPo UDb5woHorE5qRcFsQ9AGX12uP7qFeI9XAb5FIFLToUEtKx++Xi0mSefVAAkMWRqYi0FP eunmFiO6cVkkDTkxDO6BD9ITQSRONU8Lfql7Vrt9gnXZEzQmpc60cUpz/OL0bJmS/r5Y rtCcUmHK3jJ67n/DBcs3vgV1zL0ouMtiGfPp4g0aIyXq4jKdBnr4j3Ht5+eYiKkdi60V ZuFw== X-Gm-Message-State: AHPjjUgopnS4SvKnUzM3ttmggLIiguxaprL2eCTTjGjqqB8jwUqtKDd9 gqFuXi5UuCEY5Uq2 X-Google-Smtp-Source: AOwi7QCqiEGb30pxFGkZ60LAWYrIXVOlCCW/Rq508F2XQ4uUPIlzGeb0BEJq39VlQ+3QCBYWMAf3sw== X-Received: by 10.46.22.66 with SMTP id 2mr875420ljw.29.1504874847118; Fri, 08 Sep 2017 05:47:27 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o28sm317427lfc.9.2017.09.08.05.47.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 05:47:26 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 6/7 v4] drm/pl111: Add optional variant display en/disable callbacks Date: Fri, 8 Sep 2017 14:47:08 +0200 Message-Id: <20170908124709.4758-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908124709.4758-1-linus.walleij@linaro.org> References: <20170908124709.4758-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 v3->v4: - No changes. 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 3091fb4559cf..29148ff380d8 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 Fri Sep 8 12:47:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 112071 Delivered-To: patch@linaro.org Received: by 10.37.128.210 with SMTP id c18csp1559709ybm; Fri, 8 Sep 2017 05:48:11 -0700 (PDT) X-Received: by 10.84.131.74 with SMTP id 68mr3401363pld.227.1504874891366; Fri, 08 Sep 2017 05:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504874891; cv=none; d=google.com; s=arc-20160816; b=UdMtd9mJT+71f9uZmWq0yLFq8UUwZNjeVb55X/+OqBdBNoYlIlCFgEayCHFAfsSDpZ 5anYHwA5hzzV5whgp8rV+hjpJsa7pNgsWpu8OuJfDk4/o2knH94c1WuqQc8n0JKxodDs zD1jmmsP1JvKSUypBsLSM845OmpErvCaFvHZ2jf4eayC9O5/FGpub63d+ZCmdcbfPimv Z1lCfFDA0hCJmaXMfQh9C1pdCuK1i6solITXudqbn8NpqyVQoaCCn+ctT5NY2wDkP3Fu sAzAi9FKAwuk0ySf9qn19Mgbn/KylezwmfQJqf5gyBnwNWsNeZJQ0X9GmhL9gpDsjxEv 3Frg== 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=B3dwqdOXtBcUp7do8j6yS70WMs894r+ZpgCHdHz1GaU=; b=0ssKfFiHYucHUAtekpEYXEyP+c3jpeFBZch4MllEXjhLpeTjVjNeGfwztEdpaC3dig B85vmDOfVYsVoV8wMqIv/K2rRPxgD8VLLT6HNwUFaf+B36Ct+SbjPJkol+Z2r0+E3s/e Lp2ZYfyCIxnAGs4v/YyTkWcGfwJcUyhxcUpBojIBk84jyBQTQfrzAbZNU778C3ARANNV K1tm3ORQxivJnQbmExk+wPQO7fNCgbyx7ZUOxYnS2IMXpY5MC43LCgOV+4C44OtF8LtY DiR+tbRQfBpPHWZDJArGl6Tml+lrk6wrapgdyft7aMCq8yZclURHsujegt7TcUK9TRfm 83JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=H7TnaFd8; 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 g8si1450627pgr.356.2017.09.08.05.48.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 05:48:11 -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=H7TnaFd8; 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 6A4E16EB41; Fri, 8 Sep 2017 12:47:33 +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 2C3466EB41 for ; Fri, 8 Sep 2017 12:47:31 +0000 (UTC) Received: by mail-lf0-x232.google.com with SMTP id m199so5430559lfe.3 for ; Fri, 08 Sep 2017 05:47:30 -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=uQlF+2ZTZoNZgaC0ms7zCQQ0ZAmggIHx0vKU/9iDDvk=; b=H7TnaFd80yR450y3umQEgnEZPa6ZbGuKBBfKAHzcAd0090kP6N1xTBigtc3FozqrYP nIhC0WxBYSbzKupmwpAUWP4bKHxpHOPDRnW6rBvI9mXCX1hyJKjwfNOlVruaUn+NECPU XI1TPWTO3SGumDaVb4Exhn6b5tN6/iGNeZYPg= 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=uQlF+2ZTZoNZgaC0ms7zCQQ0ZAmggIHx0vKU/9iDDvk=; b=mbHik5onzZ4MFSvk/m24LUNK8JPTfMm/dwQRT75wgW/xN1Hu/SjuuzmEsmvr8GYK6Z qITniFfjHm5CTo/E7S45TXDsJcHiV1Y8D09h7ML+K3Ro6lijDZ8X8qAfjo8jOm8n97Mf 0qYqSRrHtqiNtmJv0yvb1tuqWqRWQYh3P+sgkWRnaqiRV5dH0WwZaJ3FvBMv/+IDXH5Z M7tyYQxWHr3d70/nYOrw8io5mI6YIVj1SfJr84TsgyLyktixw1gJ0hXSmwRZ2Be1VbXM qRZa9iWcFigL2dhlesDfwod+vhiqMvdzIi31bi0nv7jMVx6xzNXJ/tLcuq0KtSNBiGVh C3DQ== X-Gm-Message-State: AHPjjUiYopw/3O8kGvX/3KnmlcrnZQdpY97gBo8cEjmXQlu8RyUubvms Yh8h1QtCdCBRBfLo X-Google-Smtp-Source: AOwi7QD59dtbJlPl89xKuA8f6oTHuth/y1VfvguW7BwyW2UqIdlsW70BJEBSeNwxaBQW0MBnRcgXvA== X-Received: by 10.46.21.92 with SMTP id 28mr1020336ljv.70.1504874849199; Fri, 08 Sep 2017 05:47:29 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o28sm317427lfc.9.2017.09.08.05.47.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 05:47:28 -0700 (PDT) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 7/7 v4] drm/pl111: Add handling of Versatile platforms Date: Fri, 8 Sep 2017 14:47:09 +0200 Message-Id: <20170908124709.4758-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170908124709.4758-1-linus.walleij@linaro.org> References: <20170908124709.4758-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 v3->v4: - No changes. 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 29148ff380d8..06c4bf756b69 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 7a47db066a78..201d57d5cb54 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" @@ -258,6 +256,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