From patchwork Tue Jul 23 13:37:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 169535 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8888119ilk; Tue, 23 Jul 2019 06:38:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnxvsEWafk+D0rXaOe4LKSRCWZmOoE+7kdEnYEaOnL+sjvRT71HKUoabM8g4AUn+D2Xsq5 X-Received: by 2002:a17:902:a417:: with SMTP id p23mr79449088plq.136.1563889090057; Tue, 23 Jul 2019 06:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563889090; cv=none; d=google.com; s=arc-20160816; b=RbKSWf87C0iFa0o0F5aHrKtQaDODcqyb0PvKigREzZTFWLPaEyuJVCVSwmgYYvs8ub p+sDMX5tSDf7IF9SxdMOhQVHBDhzvrgfZPfzhqmqd+CZCc7fFTdWhnM6I2sbEyEnQ3jS UL1NxYmVzap4GYQAhIjGnYrRf/J6PXfitybnNwRkChNrz1Pcw2gToQ4jypbeBcz/lOn3 p0AUj6FqWrUGYtafsXx66sbYFt1IyiQNxqJPhvEf8A1wDn4ybT5dgrpiDhjVfWaNbXfT Z627EE08CEk2sjo2xhnRN2ZOd8gTYQ2owpOnDlgF5OHWsxX6RXtiPGEJZJjzsiko0P/m QVKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=DupSiK2SYxjeCihxdVD+4kGb5lbA65EOqfUXEOyY+4s=; b=bmG0WkDXN3EpESmNSHPFRaL1hu9DvPmqX8wCkN85ARv/FcoKsczyHjOUsIjqeakVen +7z7UQYJNizapvlsp5br3OFP5KIBW/AAmB2OtD4BST5yN2qDZ6GfSE4yu5gRSnlZlJdl T8qpHnMJSVDHFB3RvvRj0r3ySge5Ryk+zKOKpbdBJGa2H6la3RcqRKQTMM1w++Vy/WbS SzjCY+NLzWlT5UBcmT84E/0tWl/6qsZajqWlTcZVEHVNpZVHi+iTTPM8TSLEnA35wSDm 2WHAduB+U/6Y8jtoZWFjq4HiaCl2ceDjmVFxZyLF12Zzn0v5WKeZCurPtZiCFG5DeS0q B5+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id w17si11294227plp.404.2019.07.23.06.38.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2019 06:38:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 C96576E228; Tue, 23 Jul 2019 13:38:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 730896E228 for ; Tue, 23 Jul 2019 13:38:06 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id x25so41131009ljh.2 for ; Tue, 23 Jul 2019 06:38:06 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=GyBL54uJUg2m+QxxPgdjICGLYK38bj57Ff5SS54KJ84=; b=ChyTcBPPyoK2sGkUzWjno6CvrQfovhHCK+tzE71HYMiTwB3Xj9KCnpQDYOhW6P1l9z 5kK1X9yCiA/4FgMTew2WHEneAzomF5rwGPIuHVUJwe6loH4FuynAsQz9xg+hc4kNx0x+ a49c0eCqC7/l05pZF5tew48E24hHtUZ1F7+DpXWGqyn7pUPUD3pzhKQ5LSnjby2eKJx6 lsN+qLEZPYsk3FeCga3AMvDEIyC2eP0DKZnLcPU9uR0U6ZdbL8a4G66HqFxgePEFL9SD T3sfIE/Rbe0aB27hUyhSGjZxoSAOVI81DV6OCsEKnQWsKri5nsy94pusIXayPZbsuJnb XvVQ== X-Gm-Message-State: APjAAAVmWJS5DPDXH32AhxokQNcGFrazO7xEUMD6cY4+RDd78PIj6J+g ypU0C9adhxxniqFoftxa6/Zblg== X-Received: by 2002:a2e:781a:: with SMTP id t26mr39491275ljc.28.1563889084464; Tue, 23 Jul 2019 06:38:04 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l24sm8069411lji.78.2019.07.23.06.38.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 06:38:03 -0700 (PDT) From: Linus Walleij To: Daniel Tang , Fabian Vogt Subject: [PATCH 1/3] RFT: drm/pl111: Support grayscale Date: Tue, 23 Jul 2019 15:37:53 +0200 Message-Id: <20190723133755.22677-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190723133755.22677-1-linus.walleij@linaro.org> References: <20190723133755.22677-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-Mailman-Original-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 :mime-version:content-transfer-encoding; bh=GyBL54uJUg2m+QxxPgdjICGLYK38bj57Ff5SS54KJ84=; b=uIYvb8MvC9wkOgu4ZqcZpMAUdOOoYxGs9AUNUM+zaZBCT/7x26riSySUpBm1+h8d5/ 6L7bpN7N2U3zMDv/tJoo4NZ43xQV1KQrSJxmlwYkCeWHuTuThw+a9StzvdgAWum+S6eL 4MRUO5OxI0DZ9NXXeW11cbLH/5kj3xI5aV5/UGGPWcM7EgDybtPMAeYNsd3JdkyN+1az Uc1EbIliEURo8r21lV/2ifhyBJfvIQveik0y9wkR3B7yECd/bWVEUIedXTXx3mAw2350 KMxKZgoCe0+DYaArMg0b9b/SY6GLNTNn04+yvKy4P/xyTTC9qlcuw3hjQ3eKay6M4pnq TvJQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Migrating the TI nspire calculators to use the PL111 driver for framebuffer requires grayscale support for the elder panel which uses 8bit grayscale only. DRM does not support 8bit grayscale framebuffers in memory, but by defining the bus format to be MEDIA_BUS_FMT_Y8_1X8 we can get the hardware to turn on a grayscaling feature and convert the RGB framebuffer to grayscale for us. Cc: Daniel Tang Cc: Fabian Vogt Signed-off-by: Linus Walleij --- drivers/gpu/drm/pl111/pl111_display.c | 28 +++++++++++++++++++++++++-- include/linux/amba/clcd-regs.h | 1 + 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 15d2755fdba4..587b4d148c18 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -126,12 +126,17 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, struct drm_framebuffer *fb = plane->state->fb; struct drm_connector *connector = priv->connector; struct drm_bridge *bridge = priv->bridge; + bool grayscale = false; u32 cntl; u32 ppl, hsw, hfp, hbp; u32 lpp, vsw, vfp, vbp; u32 cpl, tim2; int ret; + if (connector->display_info.num_bus_formats == 1 && + connector->display_info.bus_formats[0] == MEDIA_BUS_FMT_Y8_1X8) + grayscale = true; + ret = clk_set_rate(priv->clk, mode->clock * 1000); if (ret) { dev_err(drm->dev, @@ -185,6 +190,15 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, if (connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE) tim2 |= TIM2_IPC; + + /* + * The AC pin bias frequency is set to max count when using + * grayscale so at least once in a while we will reverse + * polarity and get rid of any DC built up that could + * damage the display. + */ + if (grayscale) + tim2 |= TIM2_ACB_MASK; } if (bridge) { @@ -216,8 +230,18 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, writel(0, priv->regs + CLCD_TIM3); - /* Hard-code TFT panel */ - cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDVCOMP(1); + /* + * Detect grayscale bus format. We do not support a grayscale mode + * toward userspace, instead we expose an RGB24 buffer and then the + * hardware will activate its grayscaler to convert to the grayscale + * format. + */ + if (grayscale) + cntl = CNTL_LCDEN | CNTL_LCDMONO8; + else + /* Else we assume TFT display */ + cntl = CNTL_LCDEN | CNTL_LCDTFT | CNTL_LCDVCOMP(1); + /* On the ST Micro variant, assume all 24 bits are connected */ if (priv->variant->st_bitmux_control) cntl |= CNTL_ST_CDWID_24; diff --git a/include/linux/amba/clcd-regs.h b/include/linux/amba/clcd-regs.h index 516a6fda83c5..421b0fa90d6a 100644 --- a/include/linux/amba/clcd-regs.h +++ b/include/linux/amba/clcd-regs.h @@ -42,6 +42,7 @@ #define TIM2_PCD_LO_MASK GENMASK(4, 0) #define TIM2_PCD_LO_BITS 5 #define TIM2_CLKSEL (1 << 5) +#define TIM2_ACB_MASK GENMASK(10, 6) #define TIM2_IVS (1 << 11) #define TIM2_IHS (1 << 12) #define TIM2_IPC (1 << 13) From patchwork Tue Jul 23 13:37:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 169536 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8888170ilk; Tue, 23 Jul 2019 06:38:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdNd/PlWJgt+KpssqVfG7fjST0VnSzz9RQOMa6uTuWTc8Cxb1wUEvj9gMwIcAfycXWFXxT X-Received: by 2002:a63:2ec9:: with SMTP id u192mr74965068pgu.16.1563889092825; Tue, 23 Jul 2019 06:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563889092; cv=none; d=google.com; s=arc-20160816; b=OxjFZODyoRCEBdMbnj9uh017e/ahU7LO2O6ByQq86UOHHG5EhqOG2McG2kGAIecbAd 77sD+VTzp7nhT3jo181q251mKm+HZR+FeNUTF0Bhh6MXyz1KnN+5X4KRgEjfHYCLOPkR XPEGEfA4ebSpteb2ccWG25UOQArIJCOBxO4v1iWpMaVTdcP1xsRg/MGFidTahAC8zYX/ p1N3EuxcVkAqDJsscHnUYixnzk9G4j9RITjpJbcPoN3zlFiipCvYjNzwmTTCLFDjqLl+ B+njPVBiIEimFiM34CynOZHz2yHwJX2Z0hpGNRpK/oh7ZEnLHjQQOcd/8YIf4KEcB8Y4 DchA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=KK0sUHSx9tFlrTp/2yVHHJuBnNMJNHsfjvCkc6GN2Z8=; b=U011GsZ/mzFFD1oMffhInD6nrfQ5bDoB40ktEi3pPByHGgYpZF1i1U1g5fQQTbR0ig ab8qcGBIeDYME3ZcJloyaP7y6ADdD5v0qv9QutJBX4yAZ++5oc6wWUu6psZLtW7lqZCz g7GXebyr6tJeuJ+35jzx+KzNaDIT3mWP0BZdx8uZu22juXIN2eLysHus6q1xDZz4oRfk PwJ5eX+pvJG3ha7+xvRvr6hROgVkxktudHmPAkSL57tFn7hN/ePoLywxmSJrHhDNwWYH CYZwt69XHlg3muSkn0OUc/nyrM6RagSXFQElVkfrx3U/1iH7KF84vYE09ACSEqVrsNKC jw8w== ARC-Authentication-Results: i=1; mx.google.com; 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 g15si11718813pfb.137.2019.07.23.06.38.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2019 06:38:12 -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; 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 A20756E28A; Tue, 23 Jul 2019 13:38:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 39D806E228 for ; Tue, 23 Jul 2019 13:38:08 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id p17so41090735ljg.1 for ; Tue, 23 Jul 2019 06:38:08 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=1WIz4398NalYoE1dkIhu0zv1BVloq81pBzlO+qRIk2I=; b=dY0z3i5hJrcy2gtAuo1wMA49TfAmQogglkE5odE0lJ6nerVYMtzhMc2F4omd9+EOa6 opcFPk5RSH7pKjlQWU2EqjRZhmDJqU2UKXxXVriEyTNajuqT/3feFY4sU3h8gcnWoJgc ks97jgtIjj/pW2jHfxMlN4tNWGWWZm+i0ESVrFRx0xNNg2xWKNwNdUtAZMHeHLt6x6uJ cgK97ldht5/WLisfNOqfD5KyCEf++bE/puFIq3XgAqxUa5GgEgxpHn2OV3w0LxNMvzTj JvEnajWPYEjbVbwm4T4SdRbmjuAocXT3a66MZtdabV4NvtA1WCm77wGibwzQ/s5FFkAJ ccsA== X-Gm-Message-State: APjAAAXbnI+kLQnI0TEDjCWfKZmMBZGRoErB+BKU2/TX8MtW3MgGkSYo cCtOTiptkX0Wo8V8MKAUQ/fmhLPyiOM= X-Received: by 2002:a2e:89d0:: with SMTP id c16mr38667121ljk.219.1563889086687; Tue, 23 Jul 2019 06:38:06 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l24sm8069411lji.78.2019.07.23.06.38.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 06:38:05 -0700 (PDT) From: Linus Walleij To: Daniel Tang , Fabian Vogt Subject: [PATCH 2/3] RTF: drm/panel: simple: Add TI nspire panels Date: Tue, 23 Jul 2019 15:37:54 +0200 Message-Id: <20190723133755.22677-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190723133755.22677-1-linus.walleij@linaro.org> References: <20190723133755.22677-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-Mailman-Original-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 :mime-version:content-transfer-encoding; bh=1WIz4398NalYoE1dkIhu0zv1BVloq81pBzlO+qRIk2I=; b=OuhS0VSszSa/G+X8Vg8wOX4jN8ZWDZS3HVget6W39BC0v6+nDLYNJ/IDrryN+4galP +LkZx4gw2vFzAHOuHz0XjiUHQV4UuFrYsPtsbQaAySmaNwqImGY8tYZIhAe4niKTC2Ja h1bGtbWp6EobD7I1no/m/iXS2qreA0g/ulZHFm6vhBJU+1jLVzEFFpbsssimk4DQEP3u +Oq3lV/DRdwM/3ABEguM0ZOB9oNgo3RKUKtyRgRGUu8RZYCA1hGMNeDL4YP2pAtXNIie VedCUoWMNl9E1LyRy9RH/I2hNhkfiXCC+HHLFHR86yN6NB7cijvL/l4GimVJsD2hR0w8 nf9Q== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This adds support for the TI nspire panels to the simple panel roster. This code is based on arch/arm/mach-nspire/clcd.c. This includes likely the first grayscale panel supported. These panels will be used with the PL11x DRM driver. Cc: Daniel Tang Cc: Fabian Vogt Signed-off-by: Linus Walleij --- drivers/gpu/drm/panel/panel-simple.c | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 5a93c4edf1e4..e5cfe1398a3b 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -2761,6 +2761,63 @@ static const struct panel_desc arm_rtsm = { .bus_format = MEDIA_BUS_FMT_RGB888_1X24, }; +static const struct drm_display_mode nspire_cx_lcd_mode[] = { + { + .clock = 1000, + .hdisplay = 320, + .hsync_start = 320 + 50, + .hsync_end = 320 + 50 + 6, + .htotal = 320 + 50 + 6 + 38, + .vdisplay = 240, + .vsync_start = 240 + 3, + .vsync_end = 240 + 3 + 1, + .vtotal = 240 + 3 + 1 + 17, + .vrefresh = 60, + .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, + }, +}; + +static const struct panel_desc nspire_cx_lcd_panel = { + .modes = nspire_cx_lcd_mode, + .num_modes = 1, + .bpc = 8, + .size = { + .width = 65, + .height = 49, + }, + .bus_format = MEDIA_BUS_FMT_RGB888_1X24, + .bus_flags = DRM_BUS_FLAG_PIXDATA_NEGEDGE, +}; + +static const struct drm_display_mode nspire_classic_lcd_mode[] = { + { + .clock = 1000, + .hdisplay = 320, + .hsync_start = 320 + 6, + .hsync_end = 320 + 6 + 6, + .htotal = 320 + 6 + 6 + 6, + .vdisplay = 240, + .vsync_start = 240 + 0, + .vsync_end = 240 + 0 + 1, + .vtotal = 240 + 0 + 1 + 0, + .vrefresh = 60, + .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC, + }, +}; + +static const struct panel_desc nspire_classic_lcd_panel = { + .modes = nspire_classic_lcd_mode, + .num_modes = 1, + /* The grayscale panel has 8 bit for the color .. Y (black) */ + .bpc = 8, + .size = { + .width = 71, + .height = 53, + }, + /* This is the grayscale bus format */ + .bus_format = MEDIA_BUS_FMT_Y8_1X8, +}; + static const struct of_device_id platform_of_match[] = { { .compatible = "ampire,am-480272h3tmqw-t01h", @@ -2966,6 +3023,12 @@ static const struct of_device_id platform_of_match[] = { }, { .compatible = "nlt,nl192108ac18-02d", .data = &nlt_nl192108ac18_02d, + }, { + .compatible = "ti,nspire-cx-lcd-panel", + .data = &nspire_cx_lcd_panel, + }, { + .compatible = "ti,nspire-classic-lcd-panel", + .data = &nspire_classic_lcd_panel, }, { .compatible = "nvd,9128", .data = &nvd_9128, From patchwork Tue Jul 23 13:37:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 169537 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8888204ilk; Tue, 23 Jul 2019 06:38:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxy/migzDigg5jhjVHfcEOzdKwLraiocMVwnC9cApTMvHfZW+PBliCg09ipVrj8afWCbJsV X-Received: by 2002:a62:107:: with SMTP id 7mr5915865pfb.4.1563889094958; Tue, 23 Jul 2019 06:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563889094; cv=none; d=google.com; s=arc-20160816; b=FDPcz0ynNyftvSObc5UcVNsOhcWrycEJa+X7+FG3AaJD2/EEtuz/yqxLE63umsAhzF 25SeYNHy1Z09qXl0H/hUuk4fWB+9rAJm6UAfqNq7aKv/Ds/6WTY1Qf0PojQoNG4PqASd f7rbiwxbylDfhbX6WBTCml614lyWaIECFj3OSU+wSPs4glG1ihqtTpQqZpQBAKjH5xwG MSj0g7RoVSO0Re+pl+DUhTbwfXoONtvfrOp73Rut7vI/8POUb65Om70onFGpwtRpZCfQ 8lOxNcRG3pTgElx9lYx1TFOswm7alpY6LCLz166NSag/MadtnFdxk1MgdvVgPhzFA7ut Bmeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=+83BUo7cTFcopuLhOnFTF8SE3dR/+NppoxlFPMg/oP0=; b=pBG6x+zYGzPGgd4p253xhB40gqmTsHvlH8iDCIY9rFd6RClaGrBT1DGNvmD22st3e7 RVa3R7rf90uWk5LVzJWwX7DN1xxRa8cL/XslmM2vxeXPekFe3onIzNLMPKSzN7bph2KY pGWfe6I8/7SYnd0pcHE3yyqSqlFTEAsD/9uZD7SW2VOLY7KY/SbAbFg2XuVlYpWmAnf/ lND4aRxJXwakctKz0ecW17A4m9m+iwiITEOTB3iJ0Yzjahdd8BAuy4dhIg7pFwAzv9Y+ cGo5whzGoWoXOepXXVvnwTjPj4kFh41Sg6epKLiSae6kvRgmDRjMvBt6sDB7QHKxTeXa OHEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id t29si13785651pfq.272.2019.07.23.06.38.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2019 06:38:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 C58816E28C; Tue, 23 Jul 2019 13:38:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC5B76E28A for ; Tue, 23 Jul 2019 13:38:10 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id b29so22139016lfq.1 for ; Tue, 23 Jul 2019 06:38:10 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=NoM+u3eZl93GWMw56RZ3gY4cqzVCzROKb5N4Ny2Ql9w=; b=tg8uyW4FkHbh75YpxsxsQQPYcE3QNS3SCZgVSKhbNosY6RhpNjYTecs9kPtz8I9I0z 6eF1iN9cCoQ8dBRkvpfuYY4jT5HkGloWVuxcOcKf8YUKZJhUUrSrozZuWlRegWZGsCkJ t4NnKjGT1ICSiJO/FTZGHHcDMWaSIa+ME0g3bwUL1WJGaWEBdXldUlr1wn6eBfZeuvKi qkp5hOPDr3nwTU8rmSZTdk3GQrljOYH7/p00+fXhOB4X2TFTwPRvh9ydu073A0sd5QVT Emy9LXLNWJUerFnCYv5y7ooirdExj0uOm16jTUKX/mnYundBdElHTmfHitGFoWaZUiA+ cATQ== X-Gm-Message-State: APjAAAV4ejg9tXMCAkQHMuAhlzdd/2QmouY/M6u1nSzUxqL76mIDWmVQ SrOFYYDWxBio9vgKkJx+mEjj3A== X-Received: by 2002:a19:6b0e:: with SMTP id d14mr34277883lfa.174.1563889089021; Tue, 23 Jul 2019 06:38:09 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l24sm8069411lji.78.2019.07.23.06.38.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 23 Jul 2019 06:38:07 -0700 (PDT) From: Linus Walleij To: Daniel Tang , Fabian Vogt Subject: [PATCH 3/3] RFT: ARM: nspire: Move CLCD set-up to device tree Date: Tue, 23 Jul 2019 15:37:55 +0200 Message-Id: <20190723133755.22677-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190723133755.22677-1-linus.walleij@linaro.org> References: <20190723133755.22677-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-Mailman-Original-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 :mime-version:content-transfer-encoding; bh=NoM+u3eZl93GWMw56RZ3gY4cqzVCzROKb5N4Ny2Ql9w=; b=GMZgH5hTIHYVDXVgnx9aTggTXry9d3EtswgkQeikW0/PTMcVYOrZSxHk9v2MEb3QXV DIFyjJfVuLIT9kvL0KTxyaEkBZV4yX8glp2E3OMotZ2KRvNuyDjwJqpysO24v78btCyM imtGhXXuyYMvbtv4whsweOS9Iq7tAraY6fTDb2cZU8KGrhfTVXopZIxrG2xm8vdJv7lO KIR41z+4Nw4SRa2Y/b0mptGPh5BLSYeo+gVxMr/t6ehv4pdpCt5ob+LxgMYFMlrLT+Ko QR7zKgoS2CQECU6VrtultzQvkp/iNXIMsVrxHHSIK7Yv1hoZkDjOBcrgQZjHFGcSUFEe KUPg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This moves the nspire over to using the device tree to set-up and probe the PL111 DRM driver and use the panels from the simple-panel drivers. Cc: Daniel Tang Cc: Fabian Vogt Signed-off-by: Linus Walleij --- arch/arm/boot/dts/nspire-classic.dtsi | 19 ++++- arch/arm/boot/dts/nspire-cx.dts | 18 +++- arch/arm/boot/dts/nspire.dtsi | 10 ++- arch/arm/mach-nspire/Makefile | 1 - arch/arm/mach-nspire/clcd.c | 114 -------------------------- arch/arm/mach-nspire/clcd.h | 10 --- arch/arm/mach-nspire/nspire.c | 25 ------ 7 files changed, 43 insertions(+), 154 deletions(-) delete mode 100644 arch/arm/mach-nspire/clcd.c delete mode 100644 arch/arm/mach-nspire/clcd.h diff --git a/arch/arm/boot/dts/nspire-classic.dtsi b/arch/arm/boot/dts/nspire-classic.dtsi index c53f42777851..fabd8270f168 100644 --- a/arch/arm/boot/dts/nspire-classic.dtsi +++ b/arch/arm/boot/dts/nspire-classic.dtsi @@ -8,7 +8,13 @@ /include/ "nspire.dtsi" &lcd { - lcd-type = "classic"; + port { + clcd_pads: endpoint { + remote-endpoint = <&panel_in>; + /* Dummy values, since we are grayscale */ + arm,pl11x,tft-r0g0b0-pads = <0 8 16>; + }; + }; }; &fast_timer { @@ -69,6 +75,17 @@ #interrupt-cells = <1>; }; }; + + panel { + compatible = "ti,nspire-classic-lcd-panel"; + ports { + port { + panel_in: endpoint { + remote-endpoint = <&clcd_pads>; + }; + }; + }; + }; chosen { bootargs = "debug earlyprintk console=tty0 console=ttyS0,115200n8 root=/dev/ram0"; }; diff --git a/arch/arm/boot/dts/nspire-cx.dts b/arch/arm/boot/dts/nspire-cx.dts index da95c3736651..1551d0d0189f 100644 --- a/arch/arm/boot/dts/nspire-cx.dts +++ b/arch/arm/boot/dts/nspire-cx.dts @@ -9,7 +9,12 @@ /include/ "nspire.dtsi" &lcd { - lcd-type = "cx"; + port { + clcd_pads: endpoint { + remote-endpoint = <&panel_in>; + arm,pl11x,tft-r0g0b0-pads = <0 8 16>; + }; + }; }; &fast_timer { @@ -106,6 +111,17 @@ }; }; }; + + panel { + compatible = "ti,nspire-cx-lcd-panel"; + ports { + port { + panel_in: endpoint { + remote-endpoint = <&clcd_pads>; + }; + }; + }; + }; chosen { bootargs = "debug earlyprintk console=tty0 console=ttyAMA0,115200n8 root=/dev/ram0"; }; diff --git a/arch/arm/boot/dts/nspire.dtsi b/arch/arm/boot/dts/nspire.dtsi index c35fd6667716..d9a0fd7524dc 100644 --- a/arch/arm/boot/dts/nspire.dtsi +++ b/arch/arm/boot/dts/nspire.dtsi @@ -95,8 +95,14 @@ reg = <0xC0000000 0x1000>; interrupts = <21>; - clocks = <&apb_pclk>; - clock-names = "apb_pclk"; + /* + * We assume the same clock is fed to APB and CLCDCLK. + * There is some code to scale the clock down by a factor + * 48 for the display so likely the frequency to the + * display is 1MHz and the CLCDCLK is 48 MHz. + */ + clocks = <&apb_pclk>, <&apb_pclk>; + clock-names = "clcdclk", "apb_pclk"; }; adc: adc@C4000000 { diff --git a/arch/arm/mach-nspire/Makefile b/arch/arm/mach-nspire/Makefile index 1d568c600452..4716b9b9aa7b 100644 --- a/arch/arm/mach-nspire/Makefile +++ b/arch/arm/mach-nspire/Makefile @@ -1,3 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only obj-y += nspire.o -obj-y += clcd.o diff --git a/arch/arm/mach-nspire/clcd.c b/arch/arm/mach-nspire/clcd.c deleted file mode 100644 index 44738dcb391d..000000000000 --- a/arch/arm/mach-nspire/clcd.c +++ /dev/null @@ -1,114 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * linux/arch/arm/mach-nspire/clcd.c - * - * Copyright (C) 2013 Daniel Tang - */ - -#include -#include -#include -#include -#include - -static struct clcd_panel nspire_cx_lcd_panel = { - .mode = { - .name = "Color LCD", - .refresh = 60, - .xres = 320, - .yres = 240, - .sync = 0, - .vmode = FB_VMODE_NONINTERLACED, - .pixclock = 1, - .hsync_len = 6, - .vsync_len = 1, - .right_margin = 50, - .left_margin = 38, - .lower_margin = 3, - .upper_margin = 17, - }, - .width = 65, /* ~6.50 cm */ - .height = 49, /* ~4.87 cm */ - .tim2 = TIM2_IPC, - .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), - .bpp = 16, - .caps = CLCD_CAP_565, -}; - -static struct clcd_panel nspire_classic_lcd_panel = { - .mode = { - .name = "Grayscale LCD", - .refresh = 60, - .xres = 320, - .yres = 240, - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - .vmode = FB_VMODE_NONINTERLACED, - .pixclock = 1, - .hsync_len = 6, - .vsync_len = 1, - .right_margin = 6, - .left_margin = 6, - }, - .width = 71, /* 7.11cm */ - .height = 53, /* 5.33cm */ - .tim2 = 0x80007d0, - .cntl = CNTL_LCDMONO8, - .bpp = 8, - .grayscale = 1, - .caps = CLCD_CAP_5551, -}; - -int nspire_clcd_setup(struct clcd_fb *fb) -{ - struct clcd_panel *panel; - size_t panel_size; - const char *type; - dma_addr_t dma; - int err; - - BUG_ON(!fb->dev->dev.of_node); - - err = of_property_read_string(fb->dev->dev.of_node, "lcd-type", &type); - if (err) { - pr_err("CLCD: Could not find lcd-type property\n"); - return err; - } - - if (!strcmp(type, "cx")) { - panel = &nspire_cx_lcd_panel; - } else if (!strcmp(type, "classic")) { - panel = &nspire_classic_lcd_panel; - } else { - pr_err("CLCD: Unknown lcd-type %s\n", type); - return -EINVAL; - } - - panel_size = ((panel->mode.xres * panel->mode.yres) * panel->bpp) / 8; - panel_size = ALIGN(panel_size, PAGE_SIZE); - - fb->fb.screen_base = dma_alloc_wc(&fb->dev->dev, panel_size, &dma, - GFP_KERNEL); - - if (!fb->fb.screen_base) { - pr_err("CLCD: unable to map framebuffer\n"); - return -ENOMEM; - } - - fb->fb.fix.smem_start = dma; - fb->fb.fix.smem_len = panel_size; - fb->panel = panel; - - return 0; -} - -int nspire_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma) -{ - return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base, - fb->fb.fix.smem_start, fb->fb.fix.smem_len); -} - -void nspire_clcd_remove(struct clcd_fb *fb) -{ - dma_free_wc(&fb->dev->dev, fb->fb.fix.smem_len, fb->fb.screen_base, - fb->fb.fix.smem_start); -} diff --git a/arch/arm/mach-nspire/clcd.h b/arch/arm/mach-nspire/clcd.h deleted file mode 100644 index 7f36bd8511c5..000000000000 --- a/arch/arm/mach-nspire/clcd.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * linux/arch/arm/mach-nspire/clcd.h - * - * Copyright (C) 2013 Daniel Tang - */ - -int nspire_clcd_setup(struct clcd_fb *fb); -int nspire_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma); -void nspire_clcd_remove(struct clcd_fb *fb); diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c index 957bd0c0fbd5..2d4abb0288b9 100644 --- a/arch/arm/mach-nspire/nspire.c +++ b/arch/arm/mach-nspire/nspire.c @@ -12,14 +12,12 @@ #include #include #include -#include #include #include #include #include "mmio.h" -#include "clcd.h" static const char *const nspire_dt_match[] __initconst = { "ti,nspire", @@ -29,28 +27,6 @@ static const char *const nspire_dt_match[] __initconst = { NULL, }; -static struct clcd_board nspire_clcd_data = { - .name = "LCD", - .caps = CLCD_CAP_5551 | CLCD_CAP_565, - .check = clcdfb_check, - .decode = clcdfb_decode, - .setup = nspire_clcd_setup, - .mmap = nspire_clcd_mmap, - .remove = nspire_clcd_remove, -}; - - -static struct of_dev_auxdata nspire_auxdata[] __initdata = { - OF_DEV_AUXDATA("arm,pl111", NSPIRE_LCD_PHYS_BASE, - NULL, &nspire_clcd_data), - { } -}; - -static void __init nspire_init(void) -{ - of_platform_default_populate(NULL, nspire_auxdata, NULL); -} - static void nspire_restart(enum reboot_mode mode, const char *cmd) { void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K); @@ -62,6 +38,5 @@ static void nspire_restart(enum reboot_mode mode, const char *cmd) DT_MACHINE_START(NSPIRE, "TI-NSPIRE") .dt_compat = nspire_dt_match, - .init_machine = nspire_init, .restart = nspire_restart, MACHINE_END