Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4247780imu; Mon, 24 Dec 2018 20:21:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN6HPZF+0naeE5273qL5z5VFYCsTZSX6nS0mk41VukA8mSokzXBQpzHkwm8hr2vLr6ajy5hu X-Received: by 2002:a17:902:968d:: with SMTP id n13mr15393555plp.109.1545711668133; Mon, 24 Dec 2018 20:21:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545711668; cv=none; d=google.com; s=arc-20160816; b=AJVPTOLnTK6RvtQcNOAjMkOqMXlFz/laxd+P+nfFhnQ9WX6QNWYUjtNOrD/k5sRrUl ZfIR6ontlN87UenmGnZwry6X1UP0kzHuW9pPbu+0b85rmdI83AbOQKXSWyPa8rq1Bttw GPec5tf/xYbyTQG8YBEOJeid0PxlZryk6sVNN38frf7KFlJTdKUR0NmwoBIjwgPzTf2R Fl3GRMFE5OZXgnPnHnnI+d6T+0vuGYdfs+ktjKgU4mKl3fNly9DEGjM4xwi6DqHJ1Cj5 GhQna1ew63tHoeOiM8oDeoyTk/2E/+4XDO/0mBddBCLPHKl6PCASeaCTVt0KSnI3NDhn JG7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4fLaJ9WArwsfvNaLAZ8iEKft++hOrau5AV7vS/wxgZw=; b=gOHVMPRMCSAx+IqNicoCh+e52daztWKRUgkUEDjJ91JfbSgSg2sIaIToo2N/58StIC ObfbgnGv2Ml7Bgra34mytxu3qMZVAHa095uoMLdtimYnQa+EVD05yIWZ/qcgxsRT3Fyr ET1VMseo2Kach7rI3310il2/bkba+mtRr8BAI6Nv9wmL8rGYDcHVK2QRyHnCtQW0MnXz /M5CUUBVfm4zGJxcDpR1LgQQcktiF/QkN0J1jO8DitHjsS28EdkqQLiG92NhI6pkgxKI YwgRLLSk8BTBp1wUuLdQXqjYRDyamONgM6IBZM8eNC9E8f4TUScBeDMO5ASrv5Lh+LGf 1FnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KEfh6oir; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 39si29145821pla.352.2018.12.24.20.20.08; Mon, 24 Dec 2018 20:21:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KEfh6oir; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725849AbeLYEPz (ORCPT + 99 others); Mon, 24 Dec 2018 23:15:55 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:44730 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbeLYEPz (ORCPT ); Mon, 24 Dec 2018 23:15:55 -0500 Received: by mail-qk1-f193.google.com with SMTP id n12so7755886qkh.11 for ; Mon, 24 Dec 2018 20:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4fLaJ9WArwsfvNaLAZ8iEKft++hOrau5AV7vS/wxgZw=; b=KEfh6oirEOs7YwLIvfEoKJ/f9+ivNg3AZXMEeU2TqFQ8v0JH+X3GVJ3W4sLKttZnsR oZLgO3MLwpJi/+CwDQKnbTmMG7H1nNZqZ2VWPvG/3Cr1fLSOS/hPoQO1rGUS54s2ldhF kxlRMFULW4cZw4oNaCWnbu0O0cQIVldWdjImQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4fLaJ9WArwsfvNaLAZ8iEKft++hOrau5AV7vS/wxgZw=; b=B8I2m6GYz4zk4mxSgRpz/oxPu2vHBWoIBqV09bOSZ774O9TVgnv0uxgMZotA4OzJgh TW5L8Hq7hJGb/PYTq17GBDKr9f1X0deyPBGGPrIRzwlpJjrmzFFy+2v8x+W4BPqjhz2/ PjvxqgOBgx0jvrpqDlAXK6+tic5RBgJpzeNzm7KQVABsYfyM/JmQec6jUePpi9xUhe9T 4stbZRzOutnR3EzwvLdDrkDm0KG+Snlc3AyRNSDyNhyU6vXav7Jzi08HHJqx+pi3nCj1 qFVy/AJq3aZt5X5HuDUcZNX1hnP6zn6nXcuBrHDeWZu/F06CGvt+xHwB45QilsyPf6pN ej3Q== X-Gm-Message-State: AJcUukcPs8vBe3EF5nCTsMrvDdaZU8MnIHj80d3Zb0TMwIrhGPVP/5uT QGbO8Ic6in6IYTX+cAMuqMhn6raMKRt6B+EnG0SNWA== X-Received: by 2002:a37:7885:: with SMTP id t127mr14062107qkc.323.1545711353630; Mon, 24 Dec 2018 20:15:53 -0800 (PST) MIME-Version: 1.0 References: <1545638931-24938-1-git-send-email-yongqiang.niu@mediatek.com> <1545638931-24938-11-git-send-email-yongqiang.niu@mediatek.com> In-Reply-To: <1545638931-24938-11-git-send-email-yongqiang.niu@mediatek.com> From: Nicolas Boichat Date: Tue, 25 Dec 2018 12:15:42 +0800 Message-ID: Subject: Re: [PATCH 10/18] drm/mediatek: add gmc_bits for ovl private data To: Yongqiang Niu Cc: CK Hu , Philipp Zabel , David Airlie , Rob Herring , Mark Rutland , Matthias Brugger , devicetree@vger.kernel.org, lkml , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 24, 2018 at 6:53 PM Yongqiang Niu wrote: > > This patch add gmc_bits for ovl private data > > Signed-off-by: Yongqiang Niu > --- > drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > index 28d1911..afb313c 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c > @@ -39,7 +39,9 @@ > #define DISP_REG_OVL_ADDR_MT8173 0x0f40 > #define DISP_REG_OVL_ADDR(ovl, n) ((ovl)->data->addr + 0x20 * (n)) > > -#define OVL_RDMA_MEM_GMC 0x40402020 > +#define GMC_THRESHOLD_BITS 16 > +#define GMC_THRESHOLD_HIGH ((1 << GMC_THRESHOLD_BITS) / 4) > +#define GMC_THRESHOLD_LOW ((1 << GMC_THRESHOLD_BITS) / 8) > > #define OVL_CON_BYTE_SWAP BIT(24) > #define OVL_CON_MTX_YUV_TO_RGB (6 << 16) > @@ -57,6 +59,7 @@ > > struct mtk_disp_ovl_data { > unsigned int addr; > + unsigned int gmc_bits; > bool fmt_rgb565_is_0; > }; > > @@ -140,9 +143,23 @@ static unsigned int mtk_ovl_layer_nr(struct mtk_ddp_comp *comp) > static void mtk_ovl_layer_on(struct mtk_ddp_comp *comp, unsigned int idx) > { > unsigned int reg; > + unsigned int gmc_thrshd_l; > + unsigned int gmc_thrshd_h; > + unsigned int gmc_value; > + struct mtk_disp_ovl *ovl = comp_to_ovl(comp); > > writel(0x1, comp->regs + DISP_REG_OVL_RDMA_CTRL(idx)); > - writel(OVL_RDMA_MEM_GMC, comp->regs + DISP_REG_OVL_RDMA_GMC(idx)); > + > + gmc_thrshd_l = GMC_THRESHOLD_LOW >> > + (GMC_THRESHOLD_BITS - ovl->data->gmc_bits); > + gmc_thrshd_h = GMC_THRESHOLD_HIGH >> > + (GMC_THRESHOLD_BITS - ovl->data->gmc_bits); > + if (ovl->data->gmc_bits == 10) > + gmc_value = gmc_thrshd_h | gmc_thrshd_h << 16; I don't really get what this does, but is it intentional that you don't use gmc_thrshd_l here? Also, if you only ever use 8 or 10 bits gmc, maybe it's easier to hard-code the 2 values? if (ovl->data->gmc_bits == 10) gmc_value = OVL_RDMA_MEM_GMC_10BIT; else gmc_value = OVL_RDMA_MEM_GMC_8BIT; //0x40402020 > + else > + gmc_value = gmc_thrshd_l | gmc_thrshd_l << 8 | > + gmc_thrshd_h << 16 | gmc_thrshd_h << 24; > + writel(gmc_value, comp->regs + DISP_REG_OVL_RDMA_GMC(idx)); > > reg = readl(comp->regs + DISP_REG_OVL_SRC_CON); > reg = reg | BIT(idx); > @@ -324,11 +341,13 @@ static int mtk_disp_ovl_remove(struct platform_device *pdev) > > static const struct mtk_disp_ovl_data mt2701_ovl_driver_data = { > .addr = DISP_REG_OVL_ADDR_MT2701, > + .gmc_bits = 8, > .fmt_rgb565_is_0 = false, > }; > > static const struct mtk_disp_ovl_data mt8173_ovl_driver_data = { > .addr = DISP_REG_OVL_ADDR_MT8173, > + .gmc_bits = 8, > .fmt_rgb565_is_0 = true, > }; > > -- > 1.8.1.1.dirty > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel