From patchwork Wed Feb 21 09:20:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 129002 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp409558ljc; Wed, 21 Feb 2018 01:21:32 -0800 (PST) X-Google-Smtp-Source: AH8x2269zsRNx60olfIiR8No0i0d2+EhuMd77sjQCaHmCUNjnTqIvOgxZsKLTzSyV0SUiSTwSkvU X-Received: by 10.98.111.9 with SMTP id k9mr2636250pfc.228.1519204892047; Wed, 21 Feb 2018 01:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519204892; cv=none; d=google.com; s=arc-20160816; b=evSzJxoQseKpvNRKUlsCV/m4/LaDQSkWHCheglwF5MTtI+9TfoM5touamkbBXzjU8y s+/+xrz/kXtVoJMad9MHOdWbeDcb1v3x6LcVj9gbuu7QjvCYVUQoIpgcuvu4ixj0IW85 r0T0rmyKdMObdBy3X2f8P4gVxAc6JQ5FthZPo34vum84wnzcuQ1r5wWwnDe2AyH9ATff kAm2emXVaM7HyBOssJWCf/+8ov6diCQb69+EZx52UOx9UZAriwZXg39s2QJxh8C33dw9 lS4jdZEmkfW0xwAgG2pOZBOM0i1poJWYDd2lLr6Tvzioy6BeFvmi7M/v+2oEHW/5+4CF iVsg== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=ApxzwokqO70F374wIFMfrBvI7fHyDJ0ar6XqoxrH090=; b=k2UAPmI2z0a+VSclMtc72e495O4WXS7ZlDh1cjRYo6uYQB7Tt+bP0pNQtgWV6FbF5Y Xg3zvKXe6CJI00jT75pLIXrFqAnxBevUJv8AP/En2fHrLaCjTsJojoBQ3PpTup7B0MZs bcB6wObs45mS+FE+LIf5WPsSqYoMEFfSJT+lRmSjsjjfNKwBpMGQX14SZ7uVgu8LpuAp Y5GMX3Y9mj9FS+UoWToRLZ459MnjEv7/wM8613NIhaqj0dzjmQtqM3akqtY7SnuCFsFJ XRxLC24t14L1pd7T1Fr4MzUNBRDytct6IqAHyS5f3Aij2ySz/1/kIOkA2ty9bM4je/6P VJzQ== 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 Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id bh5-v6si13001386plb.520.2018.02.21.01.21.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Feb 2018 01:21:32 -0800 (PST) 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 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B22ED6E594; Wed, 21 Feb 2018 09:21:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id C9B486E594 for ; Wed, 21 Feb 2018 09:20:59 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 8E9B0207F7; Wed, 21 Feb 2018 10:20:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 70A9B207CB; Wed, 21 Feb 2018 10:20:39 +0100 (CET) From: Maxime Ripard To: Mark Brown , Thierry Reding , Chen-Yu Tsai , Maxime Ripard , Mark Rutland , Rob Herring Subject: [PATCH v2 01/10] regmap: mmio: Add function to attach a clock Date: Wed, 21 Feb 2018 10:20:25 +0100 Message-Id: <1155920db000d014fd1cd604ed48d1b9a8f64ac1.1519204731.git-series.maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thomas Petazzoni , Daniel Vetter , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Maxime Ripard regmap_init_mmio_clk allows to specify a clock that needs to be enabled while accessing the registers. However, that clock is retrieved through its clock ID, which means it will lookup that clock based on the current device that registers the regmap, and, in the DT case, will only look in that device OF node. This might be problematic if the clock to enable is stored in another node. Let's add a function that allows to attach a clock that has already been retrieved to a regmap in order to fix this. Signed-off-by: Maxime Ripard --- drivers/base/regmap/regmap-mmio.c | 24 ++++++++++++++++++++++++ include/linux/regmap.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c index 5189fd6182f6..5cadfd3394d8 100644 --- a/drivers/base/regmap/regmap-mmio.c +++ b/drivers/base/regmap/regmap-mmio.c @@ -28,6 +28,8 @@ struct regmap_mmio_context { void __iomem *regs; unsigned val_bytes; + + bool attached_clk; struct clk *clk; void (*reg_write)(struct regmap_mmio_context *ctx, @@ -363,4 +365,26 @@ struct regmap *__devm_regmap_init_mmio_clk(struct device *dev, } EXPORT_SYMBOL_GPL(__devm_regmap_init_mmio_clk); +int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk) +{ + struct regmap_mmio_context *ctx = map->bus_context; + + ctx->clk = clk; + ctx->attached_clk = true; + + return clk_prepare(ctx->clk); +} +EXPORT_SYMBOL_GPL(regmap_mmio_attach_clk); + +void regmap_mmio_detach_clk(struct regmap *map) +{ + struct regmap_mmio_context *ctx = map->bus_context; + + clk_unprepare(ctx->clk); + + ctx->attached_clk = false; + ctx->clk = NULL; +} +EXPORT_SYMBOL_GPL(regmap_mmio_detach_clk); + MODULE_LICENSE("GPL v2"); diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 6a3aeba40e9e..5f7ad0552c03 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -21,6 +21,7 @@ #include struct module; +struct clk; struct device; struct i2c_client; struct irq_domain; @@ -905,6 +906,8 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); __regmap_lockdep_wrapper(__devm_regmap_init_sdw, #config, \ sdw, config) +int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk); +void regmap_mmio_detach_clk(struct regmap *map); void regmap_exit(struct regmap *map); int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config); From patchwork Wed Feb 21 09:20:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 129003 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp409609ljc; Wed, 21 Feb 2018 01:21:36 -0800 (PST) X-Google-Smtp-Source: AH8x224j2Wmi18a5L0y+/GZDTcdx9n9ps2NumA+DvHYKWgwNASVHRlY7tKpgekh9jNztd2Ny36kl X-Received: by 2002:a17:902:900b:: with SMTP id a11-v6mr2531239plp.249.1519204896845; Wed, 21 Feb 2018 01:21:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519204896; cv=none; d=google.com; s=arc-20160816; b=OO3A1oMvMUMhp/RDskKedwmgtBBgTru2tzwrvjJJEv4XtZ/ECpwuJRiRFRWbzt1wUd 47WNuKf36zwChhIV/85OUMSGXGJLIvJrOGQ6Q21j3Ob3nueyI54r6EO3T+9E/CgNrx0K KmnxaEU+fCaybrjEOnEoAtDDKlzv8hynZzvPU8Kl5Xh1C+In3wCNQ4egW8V92cZNjN/o QdV3OpnWqlv5lR7HUs+evoghX/uQejIjCeeHeWHL+/8I4pac+OgNYq1CFwzt4yhZpZJN Hgz2idzUHafU5UKVrRaExWClmUEyUGnMTFPaj6VNxc6lSTCnRs29FtTlIlsAerrnUjOm Hw6Q== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=rQXfT+rC5KEdH0cvDdcxzrS5LHxt3uPo1XkIwetiqjA=; b=URhu2uS8SR77msjE0rqwvNWBY5S62rjLGmPme+jef/0qpnmq+2puv3M1tMMBhGJHG/ x4JFSDhlJHilcet4i55KwKMgR8PVTHv6c+BtXCRhWbx38L9BNaK9IB+eWFHmfxZ5dcjN 7TPO1QXDma7Op77F7PcsEkOrD+8LjAm+fM9oWeRD4jwjKtXoAdJxeM4F4HZisFWBx507 ssmngl7QchXCJkSGL84MB/dMWBwjtVjpkA/xvAgurdMST0dRVMHLbnPgCggi6dcj8AQg Mk05WEfqwdm8zv76edNE+Rg5LQc5p8Qk6YknZqmpKQqkIf/IhuqSjVkd6aBTjqOTZfGr 7v7g== 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 Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id o4si2799520pgf.441.2018.02.21.01.21.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Feb 2018 01:21:36 -0800 (PST) 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 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 746196E59F; Wed, 21 Feb 2018 09:21:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id D30F86E59B for ; Wed, 21 Feb 2018 09:20:59 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 906A7207C3; Wed, 21 Feb 2018 10:20:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id D93DC207CC; Wed, 21 Feb 2018 10:20:39 +0100 (CET) From: Maxime Ripard To: Mark Brown , Thierry Reding , Chen-Yu Tsai , Maxime Ripard , Mark Rutland , Rob Herring Subject: [PATCH v2 02/10] drm/sun4i: tcon: Add TRI finish interrupt for vblank Date: Wed, 21 Feb 2018 10:20:26 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thomas Petazzoni , Daniel Vetter , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Maxime Ripard The "CPU" (or Intel 8080) interface uses a different interrupt called TRI_FINISH (most likely TRI being for trigger) to notify the end of frames, and hence the VBLANK period. And that interrupt to the possible VBLANK interrupts source. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 9 ++++++--- drivers/gpu/drm/sun4i/sun4i_tcon.h | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 3c15cf24b503..b73acab74867 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -196,7 +196,8 @@ void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable) DRM_DEBUG_DRIVER("%sabling VBLANK interrupt\n", enable ? "En" : "Dis"); mask = SUN4I_TCON_GINT0_VBLANK_ENABLE(0) | - SUN4I_TCON_GINT0_VBLANK_ENABLE(1); + SUN4I_TCON_GINT0_VBLANK_ENABLE(1) | + SUN4I_TCON_GINT0_TCON0_TRI_FINISH_ENABLE; if (enable) val = mask; @@ -545,7 +546,8 @@ static irqreturn_t sun4i_tcon_handler(int irq, void *private) regmap_read(tcon->regs, SUN4I_TCON_GINT0_REG, &status); if (!(status & (SUN4I_TCON_GINT0_VBLANK_INT(0) | - SUN4I_TCON_GINT0_VBLANK_INT(1)))) + SUN4I_TCON_GINT0_VBLANK_INT(1) | + SUN4I_TCON_GINT0_TCON0_TRI_FINISH_INT))) return IRQ_NONE; drm_crtc_handle_vblank(&scrtc->crtc); @@ -554,7 +556,8 @@ static irqreturn_t sun4i_tcon_handler(int irq, void *private) /* Acknowledge the interrupt */ regmap_update_bits(tcon->regs, SUN4I_TCON_GINT0_REG, SUN4I_TCON_GINT0_VBLANK_INT(0) | - SUN4I_TCON_GINT0_VBLANK_INT(1), + SUN4I_TCON_GINT0_VBLANK_INT(1) | + SUN4I_TCON_GINT0_TCON0_TRI_FINISH_INT, 0); return IRQ_HANDLED; diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h index b761c7b823c5..067183076807 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -28,7 +28,11 @@ #define SUN4I_TCON_GINT0_REG 0x4 #define SUN4I_TCON_GINT0_VBLANK_ENABLE(pipe) BIT(31 - (pipe)) +#define SUN4I_TCON_GINT0_TCON0_TRI_FINISH_ENABLE BIT(27) +#define SUN4I_TCON_GINT0_TCON0_TRI_COUNTER_ENABLE BIT(26) #define SUN4I_TCON_GINT0_VBLANK_INT(pipe) BIT(15 - (pipe)) +#define SUN4I_TCON_GINT0_TCON0_TRI_FINISH_INT BIT(11) +#define SUN4I_TCON_GINT0_TCON0_TRI_COUNTER_INT BIT(10) #define SUN4I_TCON_GINT1_REG 0x8 #define SUN4I_TCON_FRM_CTL_REG 0x10 From patchwork Wed Feb 21 09:20:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 128998 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp409281ljc; Wed, 21 Feb 2018 01:21:09 -0800 (PST) X-Google-Smtp-Source: AH8x226pwRURnAroKc79+5jFdNPPH8AJ9xqh3g5U4m7BTVUlnVTQTKD+kzew7LqBfnIZLfgBmGrI X-Received: by 2002:a17:902:9885:: with SMTP id s5-v6mr2592583plp.400.1519204869815; Wed, 21 Feb 2018 01:21:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519204869; cv=none; d=google.com; s=arc-20160816; b=zVH1CptF1fQaLLLcTLIluux0+ckZsf71GEJu8XvhJ4G4ZQQ6nJBcyG++EfpQFul/q4 UljIoX55rA82sSWc9ORIRH5kgo7mmuXlWvoIT1Tk1r5L02AligpLQ+Z6rWmEjOyjE1hl mqGcted4bB9XvN9UudWEBLRGGIp0nPqNlnnEE7iQl0MHdC+SxzkpaZ1GxwJSZ7/jW4Cc Gl2HobVZr6syXvKXeUlxzrSZAqnCT5Edx+ia5SS0RoRB9FQUCGR7qmMv/MhmQyLm3uwD BEIS+dyrWxpoYj9XfDLI6Pnj4cHCPdeUrUm2BfuRA70pUOZn/x76zxRX268iNxXNAZho N46A== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=nzPSIMtq6b3kS2d67DoL8/TTKmgWFw7MjVhf/VJVM24=; b=fRmfypvZqaxtkjgmM2jU097tXwsdpYx5qptlmRSKBcESl3gqRoms5kbzFw2yNw8ySV 0w5wBwtRY8wgd3anrq/pjLfmKIk+D/IHifPc8CHZ7aUsW+x58CvNICY/TH/vsRtonxrx b8ZPXUkhd0L7s6fKuMuguVuZvqZx1wfQd8wo/vetE1ohNxtbHZk2U6IKOuksuO9ToQHJ QIgFYVcNxvi0/3Pv7xngSJt+aUzdwrFjCdLrzyq8Ta1HRcIKO5HuRs5ktGFSf2tTgbFs bTRZVobJlrl6uMpJyjW365eFQm3vBcDNYmoK+9w0IAkbTDz4yfDyIonY1oC/9M1+/YPx 4nFA== 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 Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id q24si1065916pfh.90.2018.02.21.01.21.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Feb 2018 01:21:09 -0800 (PST) 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 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 20DE46E59D; Wed, 21 Feb 2018 09:21:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id B6D146E59B for ; Wed, 21 Feb 2018 09:21:00 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 7A5AB207CC; Wed, 21 Feb 2018 10:20:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 46D2B207D7; Wed, 21 Feb 2018 10:20:40 +0100 (CET) From: Maxime Ripard To: Mark Brown , Thierry Reding , Chen-Yu Tsai , Maxime Ripard , Mark Rutland , Rob Herring Subject: [PATCH v2 03/10] drm/sun4i: Protect the TCON pixel clocks Date: Wed, 21 Feb 2018 10:20:27 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thomas Petazzoni , Daniel Vetter , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Maxime Ripard Both TCON clocks are very sensitive to clock changes, since any change might lead to improper timings. Make sure our rate is never changed. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index b73acab74867..cbe87cee13d1 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -261,7 +261,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon, const struct drm_display_mode *mode) { /* Configure the dot clock */ - clk_set_rate(tcon->dclk, mode->crtc_clock * 1000); + clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000); /* Set the resolution */ regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG, @@ -419,7 +419,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon, WARN_ON(!tcon->quirks->has_channel_1); /* Configure the dot clock */ - clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000); + clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000); /* Adjust clock delay */ clk_delay = sun4i_tcon_get_clk_delay(mode, 1); From patchwork Wed Feb 21 09:20:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 128997 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp409203ljc; Wed, 21 Feb 2018 01:21:04 -0800 (PST) X-Google-Smtp-Source: AH8x226C96g5bR6HLzD7QhzWVc3dR4iy9WywtA0AMBZhBBolztYDUbSZVmdBe+p6fCXvNLtoXby9 X-Received: by 10.99.142.76 with SMTP id k73mr2195151pge.278.1519204864590; Wed, 21 Feb 2018 01:21:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519204864; cv=none; d=google.com; s=arc-20160816; b=KiioGvim1icjLTN/F2ihPQmwRxgRR2XMASmQWCdZNVH0f60dY+sSniXKUPqx+3HCnU hewM/6Yczb+SjlWHWiMgun+lc1KfKjP3zt77cOjn4HdJ0MOH6FgYUPh0h0YyFc6i9N7I IDKQFdLta27mBhZtCYqXU6nrwI0t4wkvY6D2G87yPpy2D/ENVPyAnB+u4dd/m51pJ/an oI46elmKx9sludV9pOcnOMJ67izW9W4WLxHkJzJKIqiNoKgbpjA/s3gK4AHGhLfHZ7Nc dxoEidOo031q4BntvGWC8AuCbC/BdtHrAgk3iCGobw4kfhVVz7HCgDeU2P28cxA+CUyM hNQg== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=SRCLkXA3FDqcMC7+xs5kCB7Ru6EeY12g3WXFZv+1R0s=; b=bHSo7bJyt6c81dA2UUQU8BDqXdjFAY7fglfltvy8SyNGCB+t0QKymCWQOntC8T0ZCX rVK4ZhHSH/wV/zBBnvObcTzRk5nhmVdymlMW41VOSWYrrrWATiZ2lc8qTt5nDmD+/oPy Bsl70B57XvR/quKBLnZqjzrH2R/ld8K5+YImUIoqfJwvT3r+S1ShZftAXUR4QS03552F 3diZlCOtl/AMwp7gkI3z6mvHGYtLq4SoFkfvdeYMcWuo7TjeM24QKVsZHTW/EI7CS4ab IGm5V2BpFX1uqAG5MEy4ZWEWUAu0CdrbLEKB/TuL/1iMdx6Sjqo3O6+oYvCRLraBSYAp 3jEg== 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 Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id k15si955816pgc.482.2018.02.21.01.21.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Feb 2018 01:21:04 -0800 (PST) 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 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E93076E59C; Wed, 21 Feb 2018 09:21:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id D9E2D6E59C for ; Wed, 21 Feb 2018 09:21:00 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 95B4D207D7; Wed, 21 Feb 2018 10:20:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id B029A207E4; Wed, 21 Feb 2018 10:20:40 +0100 (CET) From: Maxime Ripard To: Mark Brown , Thierry Reding , Chen-Yu Tsai , Maxime Ripard , Mark Rutland , Rob Herring Subject: [PATCH v2 04/10] dt-bindings: display: Add Allwinner MIPI-DSI bindings Date: Wed, 21 Feb 2018 10:20:28 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thomas Petazzoni , Daniel Vetter , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Maxime Ripard The Allwinner SoCs usually come with a DSI encoder. Add a binding for it. Signed-off-by: Maxime Ripard --- Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 84 +++++++- 1 file changed, 84 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt diff --git a/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt new file mode 100644 index 000000000000..cbcc673b9bcc --- /dev/null +++ b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt @@ -0,0 +1,84 @@ +Allwinner A31 DSI Encoder +========================= + +The DSI pipeline consists of two separate blocks: the DSI controller +itself, and its associated D-PHY. + +DSI Encoder +----------- + +The DSI Encoder generates the DSI signal from the TCON's. + +Required properties: + - compatible: value must be one of: + * allwinner,sun6i-a31-mipi-dsi + - reg: base address and size of memory-mapped region + - interrupts: interrupt associated to this IP + - clocks: phandles to the clocks feeding the DSI encoder + * bus: the DSI interface clock + * mod: the DSI module clock + - clock-names: the clock names mentioned above + - phys: phandle to the D-PHY + - phy-names: must be "dphy" + - resets: phandle to the reset controller driving the encoder + + - ports: A ports node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. The + port should be the input endpoint, usually coming from the + associated TCON. + +Any MIPI-DSI device attached to this should be described according to +the bindings defined in ../mipi-dsi-bus.txt + +D-PHY +----- + +Required properties: + - compatible: value must be one of: + * allwinner,sun6i-a31-mipi-dphy + - reg: base address and size of memory-mapped region + - clocks: phandles to the clocks feeding the DSI encoder + * bus: the DSI interface clock + * mod: the DSI module clock + - clock-names: the clock names mentioned above + - resets: phandle to the reset controller driving the encoder + +Example: + +dsi0: dsi@1ca0000 { + compatible = "allwinner,sun6i-a31-mipi-dsi"; + reg = <0x01ca0000 0x1000>; + interrupts = ; + clocks = <&ccu CLK_BUS_MIPI_DSI>, + <&ccu CLK_DSI_SCLK>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_MIPI_DSI>; + phys = <&dphy0>; + phy-names = "dphy"; + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "huarui,lhr050h41"; + reg = <0>; + power-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* PB07 */ + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL05 */ + backlight = <&pwm_bl>; + }; + + port { + dsi0_in_tcon0: endpoint { + remote-endpoint = <&tcon0_out_dsi0>; + }; + }; +}; + +dphy0: d-phy@1ca1000 { + compatible = "allwinner,sun6i-a31-mipi-dphy"; + reg = <0x01ca1000 0x1000>; + clocks = <&ccu CLK_BUS_MIPI_DSI>, + <&ccu CLK_DSI_DPHY>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_MIPI_DSI>; + #phy-cells = <0>; +}; From patchwork Wed Feb 21 09:20:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 128996 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp409102ljc; Wed, 21 Feb 2018 01:20:53 -0800 (PST) X-Google-Smtp-Source: AH8x226XhJmR7h0cydGmADIUbTZF50gFBtbyaBW9nHv9S3hM0zvANKkYZ4N1eON2jc0q39pxU4iw X-Received: by 10.98.82.138 with SMTP id g132mr2681269pfb.120.1519204853845; Wed, 21 Feb 2018 01:20:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519204853; cv=none; d=google.com; s=arc-20160816; b=gXZepLw5CG7a9xE37/JYyGe4OjOCrzCmGbeFaTuDxnqwJoaDDRlI1a7fZUnOGrtVXX ot+tP09PTrD+mqYcVj3Wz0/b1+sNhB7By728uc3W7OGpdWIHp9WY8j90pnN9xDA/GetQ eTwn/vkK1/vd4OIimQhlvPm23MekHCiOIr9GgGR2wHmlWxwuEQ9weDLdeltevTX/yxhb P5HC/uMRqKtltkCkCv1Kqpd27uHKnsstquR4DGyde8VB/yjJVHMLqMUL5wl7bCfiji0O kffLGM7AMlFdVDQjowJ8LJeNiwa7aCeqLFOd0Sc5NS8lPbBn12KOio/q2+jNG8IK8eqA /Vfw== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=F0bxsI+/D+s+fJ/FvPzjfyK9v1ULwAI1WhWF17q3OOY=; b=ezdzvWRiZ5iIbTiUFgFiNaNTZahzvsGWR+6IYv9OavRSjEMInfZ+0sTftSju07OqbI Px/F3DeH8bPRAYL2yR4O6mpxwyM+b6IG3SLWkjIZ4SZ6u7dtrK7ez0PI81VjLDGh84tL IET8kXneUKztf1nTF+PY6QjuVDFAxvXd4ElkXABEpcpb5qPHz+bEOQjO9EtSvEaWIwEr I1/XM2ey3Aqn4z0i7eZRUyxvoAaReb23SKKgvXvo+4QSSAbWP+lWjTk2d6VPSPHqpk8y a1kOYEpGy7RcrLn3EqQNAiA715AFUlpBGX90bKWz4Cqq/b5pcPHX7XyCq+fPN42OQkMe 75cw== 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 Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id e1-v6si3102443pln.578.2018.02.21.01.20.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Feb 2018 01:20:53 -0800 (PST) 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 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 916226E571; Wed, 21 Feb 2018 09:20:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DBDA6E571 for ; Wed, 21 Feb 2018 09:20:50 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 58E50207F5; Wed, 21 Feb 2018 10:20:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 1611F207C3; Wed, 21 Feb 2018 10:20:39 +0100 (CET) From: Maxime Ripard To: Mark Brown , Thierry Reding , Chen-Yu Tsai , Maxime Ripard , Mark Rutland , Rob Herring Subject: [PATCH v2 10/10] [DO NOT MERGE] arm: dts: sun8i: bpi-m2m: Add DSI display Date: Wed, 21 Feb 2018 10:20:34 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: 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: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Thomas Petazzoni , Daniel Vetter , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Maxime Ripard The BananaPi M2M has an optional 1280x720 DSI panel. Since that panel is optional, we can only show a DT patch that would show how to enable it. Signed-off-by: Maxime Ripard --- arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 39 +++++++++++++++++++++- 1 file changed, 39 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts index eaf09666720d..11a4dfde2679 100644 --- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts +++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts @@ -44,6 +44,7 @@ #include "sun8i-a33.dtsi" #include +#include / { model = "BananaPi M2 Magic"; @@ -81,6 +82,14 @@ }; }; + pwm_bl: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>; + brightness-levels = <1 2 4 8 16 32 64 128 255>; + default-brightness-level = <8>; + enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PG10 */ + }; + reg_vcc5v0: vcc5v0 { compatible = "regulator-fixed"; regulator-name = "vcc5v0"; @@ -120,6 +129,26 @@ status = "okay"; }; +&de { + status = "okay"; +}; + +&dphy0 { + status = "okay"; +}; + +&dsi0 { + status = "okay"; + + panel@0 { + compatible = "huarui,lhr050h41"; + reg = <0>; + power-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* PB07 */ + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL05 */ + backlight = <&pwm_bl>; + }; +}; + &ehci0 { status = "okay"; }; @@ -179,6 +208,12 @@ status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pins>; + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -291,6 +326,10 @@ status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_b>;