linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Rob Herring <robh+dt@kernel.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Mike Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, David Airlie <airlied@linux.ie>,
	Archit Taneja <architt@codeaurora.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	devicetree <devicetree@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	linux-sunxi <linux-sunxi@googlegroups.com>,
	Icenowy Zheng <icenowy@aosc.io>
Subject: Re: [linux-sunxi] [PATCH 11/27] drm/sun4i: Rework DE2 register defines
Date: Sat, 22 Sep 2018 20:32:30 +0800	[thread overview]
Message-ID: <CAGb2v67jweJ5OdSzKhj302OLbz7DacKmSGMKS536uquzKGZtAQ@mail.gmail.com> (raw)
In-Reply-To: <20180902072643.4917-12-jernej.skrabec@siol.net>

Hi,

On Sun, Sep 2, 2018 at 3:27 PM Jernej Skrabec <jernej.skrabec@siol.net> wrote:
>
> Most, if not all, registers found in DE2 still exists in DE3. However,
> units are on different base addresses.
>
> To prepare for addition of DE3 support, registers macros are reworked so
> they take base address as parameter.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> [rebased]
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>

This patch mostly checks out. But see below.


> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
> index 406c42e752d7..020b0a097c84 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
> @@ -29,20 +29,24 @@
>
>  #define SUN8I_MIXER_GLOBAL_DBUFF_ENABLE                BIT(0)
>
> -#define SUN8I_MIXER_BLEND_PIPE_CTL             0x1000
> -#define SUN8I_MIXER_BLEND_ATTR_FCOLOR(x)       (0x1004 + 0x10 * (x) + 0x0)
> -#define SUN8I_MIXER_BLEND_ATTR_INSIZE(x)       (0x1004 + 0x10 * (x) + 0x4)
> -#define SUN8I_MIXER_BLEND_ATTR_COORD(x)                (0x1004 + 0x10 * (x) + 0x8)
> -#define SUN8I_MIXER_BLEND_ROUTE                        0x1080
> -#define SUN8I_MIXER_BLEND_PREMULTIPLY          0x1084
> -#define SUN8I_MIXER_BLEND_BKCOLOR              0x1088
> -#define SUN8I_MIXER_BLEND_OUTSIZE              0x108c
> -#define SUN8I_MIXER_BLEND_MODE(x)              (0x1090 + 0x04 * (x))
> -#define SUN8I_MIXER_BLEND_CK_CTL               0x10b0
> -#define SUN8I_MIXER_BLEND_CK_CFG               0x10b4
> -#define SUN8I_MIXER_BLEND_CK_MAX(x)            (0x10c0 + 0x04 * (x))
> -#define SUN8I_MIXER_BLEND_CK_MIN(x)            (0x10e0 + 0x04 * (x))
> -#define SUN8I_MIXER_BLEND_OUTCTL               0x10fc
> +#define DE2_BLD_BASE                           0x1000
> +#define DE2_CH_BASE                            0x2000
> +#define DE2_CH_SIZE                            0x1000
> +
> +#define SUN8I_MIXER_BLEND_PIPE_CTL(base)       ((base) + 0)
> +#define SUN8I_MIXER_BLEND_ATTR_FCOLOR(base, x) ((base) + 0x4 + 0x10 * (x))
> +#define SUN8I_MIXER_BLEND_ATTR_INSIZE(base, x) ((base) + 0x8 + 0x10 * (x))
> +#define SUN8I_MIXER_BLEND_ATTR_COORD(base, x)  ((base) + 0xC + 0x10 * (x))

Nit: Use lowercase for '0xC' to be consistent.

> +#define SUN8I_MIXER_BLEND_ROUTE(base)          ((base) + 0x80)
> +#define SUN8I_MIXER_BLEND_PREMULTIPLY(base)    ((base) + 0x84)
> +#define SUN8I_MIXER_BLEND_BKCOLOR(base)                ((base) + 0x88)
> +#define SUN8I_MIXER_BLEND_OUTSIZE(base)                ((base) + 0x8c)
> +#define SUN8I_MIXER_BLEND_MODE(base, x)                ((base) + 0x90 + 0x04 * (x))
> +#define SUN8I_MIXER_BLEND_CK_CTL(base)         ((base) + 0xb0)
> +#define SUN8I_MIXER_BLEND_CK_CFG(base)         ((base) + 0xb4)
> +#define SUN8I_MIXER_BLEND_CK_MAX(base, x)      ((base) + 0xc0 + 0x04 * (x))
> +#define SUN8I_MIXER_BLEND_CK_MIN(base, x)      ((base) + 0xe0 + 0x04 * (x))
> +#define SUN8I_MIXER_BLEND_OUTCTL(base)         ((base) + 0xfc)
>
>  #define SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK      GENMASK(12, 8)
>  #define SUN8I_MIXER_BLEND_PIPE_CTL_EN(pipe)    BIT(8 + pipe)

[...]

> diff --git a/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c b/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c
> index 6bb2aa164c8e..c68eab8a748f 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_ui_scaler.c
> @@ -10,6 +10,7 @@
>   */
>
>  #include "sun8i_ui_scaler.h"
> +#include "sun8i_vi_scaler.h"
>
>  static const u32 lan2coefftab16[240] = {
>         0x00004000, 0x00033ffe, 0x00063efc, 0x000a3bfb,
> @@ -88,6 +89,14 @@ static const u32 lan2coefftab16[240] = {
>         0x0b1c1603, 0x0d1c1502, 0x0e1d1401, 0x0f1d1301,
>  };
>
> +static inline u32 sun8i_ui_scaler_base(struct sun8i_mixer *mixer, int channel)

I recently saw a review comment stating one should not inline functions
unless they are defined in header files. Otherwise the decision should
be left up to the compiler.

> +{
> +       int vi_num = mixer->cfg->vi_num;
> +
> +       return DE2_VI_SCALER_BASE + DE2_VI_SCALER_SIZE * vi_num +
> +              DE2_UI_SCALER_SIZE * (channel - vi_num);
> +}
> +
>  static int sun8i_ui_scaler_coef_index(unsigned int step)
>  {
>         unsigned int scale, int_part, float_part;

[...]

> diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c b/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
> index d3f1acb234b7..8697afc36023 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
> @@ -833,6 +833,11 @@ static const u32 bicubic4coefftab32[480] = {
>         0x1012110d, 0x1012110d, 0x1013110c, 0x1013110c,
>  };
>
> +static inline u32 sun8i_vi_scaler_base(struct sun8i_mixer *mixer, int channel)
> +{
> +       return DE2_VI_SCALER_BASE + DE2_VI_SCALER_SIZE * channel;
> +}
> +

This one as well.

>  static int sun8i_vi_scaler_coef_index(unsigned int step)
>  {
>         unsigned int scale, int_part, float_part;
> @@ -857,7 +862,7 @@ static int sun8i_vi_scaler_coef_index(unsigned int step)
>         }
>  }
>
> -static void sun8i_vi_scaler_set_coeff(struct regmap *map, int layer,
> +static void sun8i_vi_scaler_set_coeff(struct regmap *map, u32 base,
>                                       u32 hstep, u32 vstep,
>                                       const struct drm_format_info *format)

This is the only instance where a function's "layer" parameter was changed
to "base". It would be nice if it were consistent.

ChenYu

  reply	other threads:[~2018-09-22 12:32 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-02  7:26 [PATCH 00/27] Allwinner H6 DE3 and HDMI support Jernej Skrabec
2018-09-02  7:26 ` [PATCH 01/27] dt-bindings: sunxi-sram: add binding for Allwinner H6 SRAM C Jernej Skrabec
2018-09-04  8:39   ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 02/27] arm64: allwinner: h6: add system controller device tree node Jernej Skrabec
2018-09-04  8:40   ` Chen-Yu Tsai
2018-09-04  8:44     ` [linux-sunxi] " Icenowy Zheng
2018-09-12 14:49       ` Chen-Yu Tsai
2018-09-12 15:37         ` Icenowy Zheng
2018-09-02  7:26 ` [PATCH 03/27] dt-bindings: bus: add H6 DE3 bus binding Jernej Skrabec
2018-09-02  7:26 ` [PATCH 04/27] clk: sunxi-ng: Adjust MP clock parent rate when allowed Jernej Skrabec
2018-09-02  7:26 ` [PATCH 05/27] clk: sunxi-ng: Use u64 for calculation of NM rate Jernej Skrabec
2018-09-04  9:18   ` Chen-Yu Tsai
2018-09-04 18:06     ` Jernej Škrabec
2018-09-02  7:26 ` [PATCH 06/27] clk: sunxi-ng: h6: Set video PLLs limits Jernej Skrabec
2018-09-04 15:49   ` kbuild test robot
2018-09-04 15:49   ` kbuild test robot
2018-09-02  7:26 ` [PATCH 07/27] dt-bindings: clock: sun8i-de2: Add H6 DE3 clock description Jernej Skrabec
2018-09-04  8:59   ` Chen-Yu Tsai
2018-09-04  9:05     ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 08/27] clk: sunxi-ng: Add support for H6 DE3 clocks Jernej Skrabec
2018-09-04  9:04   ` Chen-Yu Tsai
2018-09-04 17:45     ` Jernej Škrabec
2018-09-12 12:20       ` Chen-Yu Tsai
2018-09-12 14:55         ` Jernej Škrabec
2018-09-12 16:16           ` [linux-sunxi] " Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 09/27] dt-bindings: display: sun4i-drm: Add H6 display engine compatibles Jernej Skrabec
     [not found]   ` <5b9f3f4d.1c69fb81.c776b.ee42@mx.google.com>
2018-09-22 13:32     ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 10/27] drm/sun4i: Add compatible for H6 display engine Jernej Skrabec
2018-09-03 12:18   ` Maxime Ripard
2018-09-02  7:26 ` [PATCH 11/27] drm/sun4i: Rework DE2 register defines Jernej Skrabec
2018-09-22 12:32   ` Chen-Yu Tsai [this message]
2018-09-23 20:02     ` [linux-sunxi] " Jernej Škrabec
2018-09-24  2:01       ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 12/27] drm/sun4i: Add basic support for DE3 Jernej Skrabec
2018-09-22 13:19   ` Chen-Yu Tsai
2018-09-23 19:51     ` Jernej Škrabec
2018-09-24  2:04       ` Chen-Yu Tsai
2018-10-05 17:51     ` Jernej Škrabec
2018-10-06 15:34       ` [linux-sunxi] " Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 13/27] drm/sun4i: Add support for H6 DE3 mixer 0 Jernej Skrabec
2018-09-22 13:23   ` Chen-Yu Tsai
2018-09-22 13:47     ` Chen-Yu Tsai
2018-09-23 19:40       ` [linux-sunxi] " Jernej Škrabec
2018-09-24  1:59         ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 14/27] drm/bridge/synopsys: dw-hdmi: Enable workaround for v2.12a Jernej Skrabec
2018-09-22 13:54   ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 15/27] drm/sun4i: Not all DW HDMI controllers has scrambled addresses Jernej Skrabec
2018-09-12 12:25   ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 16/27] drm/sun4i: dw-hdmi: Make mode_valid function configurable Jernej Skrabec
2018-09-22 13:29   ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 17/27] drm/sun4i: dw-hdmi: Add quirk for setting TMDS clock Jernej Skrabec
2018-09-22 13:30   ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 18/27] dt-bindings: display: sunxi: add DT binding for Allwinner H6 DW HDMI Jernej Skrabec
2018-09-02  7:26 ` [PATCH 19/27] drm/sun4i: Add support for H6 DW HDMI controller Jernej Skrabec
2018-09-12 12:29   ` Chen-Yu Tsai
2018-09-02  7:26 ` [PATCH 20/27] drm/sun4i: Add support for Synopsys HDMI PHY Jernej Skrabec
2018-09-02  7:26 ` [PATCH 21/27] drm/sun4i: Add support for H6 " Jernej Skrabec
2018-09-22 15:55   ` Chen-Yu Tsai
2018-09-23 19:29     ` Jernej Škrabec
2018-09-02  7:26 ` [PATCH 22/27] drm/sun4i: Initialize registers in tcon-top driver Jernej Skrabec
2018-09-02  7:26 ` [PATCH 23/27] drm: sun4i: add quirks for TCON TOP Jernej Skrabec
2018-09-02  7:26 ` [PATCH 24/27] dt-bindings: display: sun4i-drm: document H6 " Jernej Skrabec
2018-09-02  7:26 ` [PATCH 25/27] drm: sun4i: add support for " Jernej Skrabec
2018-09-02  7:26 ` [PATCH 26/27] arm64: dts: sun50i: h6: Add HDMI pipeline Jernej Skrabec
2018-09-02  7:26 ` [PATCH 27/27] arm64: dts: sun50i: h6: Enable HDMI output on Pine H64 board Jernej Skrabec
2018-09-02  9:31 ` [PATCH 00/27] Allwinner H6 DE3 and HDMI support Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGb2v67jweJ5OdSzKhj302OLbz7DacKmSGMKS536uquzKGZtAQ@mail.gmail.com \
    --to=wens@csie.org \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=architt@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=icenowy@aosc.io \
    --cc=jernej.skrabec@siol.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).