lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAN6tsi4VCnRD7gj0c0feFdfjcRbYVGdud8M=qEit-uGHrnqyTQ@mail.gmail.com>
Date: Wed, 29 May 2024 16:06:21 +0200
From: Robert Foss <rfoss@...nel.org>
To: Alexander Stein <alexander.stein@...tq-group.com>
Cc: Andrzej Hajda <andrzej.hajda@...el.com>, Neil Armstrong <neil.armstrong@...aro.org>, 
	Laurent Pinchart <Laurent.pinchart@...asonboard.com>, Jonas Karlman <jonas@...boo.se>, 
	Jernej Skrabec <jernej.skrabec@...il.com>, 
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>, 
	Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, 
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/3] drm/bridge: tc358767: Support write-only registers

On Thu, May 16, 2024 at 8:25 AM Alexander Stein
<alexander.stein@...tq-group.com> wrote:
>
> Most registers are read-writable, but some are only RO or even WO.
> regmap does not support using readable_reg and wr_table when outputting
> in debugfs, so switch to writeable_reg.
> First check for RO or WO registers and fallback tc_readable_reg() for the
> leftover RW registers.
>
> Signed-off-by: Alexander Stein <alexander.stein@...tq-group.com>
> ---
>  drivers/gpu/drm/bridge/tc358767.c | 40 ++++++++++++++++++++-----------
>  1 file changed, 26 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index 8874713bdd4a4..04c98ab1991bd 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -2086,19 +2086,31 @@ static const struct regmap_access_table tc_precious_table = {
>         .n_yes_ranges = ARRAY_SIZE(tc_precious_ranges),
>  };
>
> -static const struct regmap_range tc_non_writeable_ranges[] = {
> -       regmap_reg_range(PPI_BUSYPPI, PPI_BUSYPPI),
> -       regmap_reg_range(DSI_BUSYDSI, DSI_BUSYDSI),
> -       regmap_reg_range(DSI_LANESTATUS0, DSI_INTSTATUS),
> -       regmap_reg_range(TC_IDREG, SYSSTAT),
> -       regmap_reg_range(GPIOI, GPIOI),
> -       regmap_reg_range(DP0_LTSTAT, DP0_SNKLTCHGREQ),
> -};
> -
> -static const struct regmap_access_table tc_writeable_table = {
> -       .no_ranges = tc_non_writeable_ranges,
> -       .n_no_ranges = ARRAY_SIZE(tc_non_writeable_ranges),
> -};
> +static bool tc_writeable_reg(struct device *dev, unsigned int reg)
> +{
> +       /* RO reg */
> +       switch (reg) {
> +       case PPI_BUSYPPI:
> +       case DSI_BUSYDSI:
> +       case DSI_LANESTATUS0:
> +       case DSI_LANESTATUS1:
> +       case DSI_INTSTATUS:
> +       case TC_IDREG:
> +       case SYSBOOT:
> +       case SYSSTAT:
> +       case GPIOI:
> +       case DP0_LTSTAT:
> +       case DP0_SNKLTCHGREQ:
> +               return false;
> +       }
> +       /* WO reg */
> +       switch (reg) {
> +       case DSI_STARTDSI:
> +       case DSI_INTCLR:
> +               return true;
> +       }
> +       return tc_readable_reg(dev, reg);
> +}
>
>  static const struct regmap_config tc_regmap_config = {
>         .name = "tc358767",
> @@ -2108,9 +2120,9 @@ static const struct regmap_config tc_regmap_config = {
>         .max_register = PLL_DBG,
>         .cache_type = REGCACHE_MAPLE,
>         .readable_reg = tc_readable_reg,
> +       .writeable_reg = tc_writeable_reg,
>         .volatile_table = &tc_volatile_table,
>         .precious_table = &tc_precious_table,
> -       .wr_table = &tc_writeable_table,
>         .reg_format_endian = REGMAP_ENDIAN_BIG,
>         .val_format_endian = REGMAP_ENDIAN_LITTLE,
>  };
> --
> 2.34.1
>


Reviewed-by: Robert Foss <rfoss@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ