Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp670226lqb; Wed, 29 May 2024 07:21:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNkKcqxms24TZZACV1Gou07pzHRhZ9pY6QWsJQJZyK7Rxfz/rDBogyp2mAz7xULEEOJrcg0dZ5kaIRXtb4wZCz+sDMd95l2zLJ5Lpa4w== X-Google-Smtp-Source: AGHT+IE1TkhYI/R5N0XzybWmXNSOaFbCsGq9uHbLwvT8g9c0itjeg2G/ZOvji41PwrEQw6Y5LHXj X-Received: by 2002:a17:903:230a:b0:1f3:1afd:b150 with SMTP id d9443c01a7336-1f4486ed41dmr252487015ad.19.1716992469563; Wed, 29 May 2024 07:21:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716992469; cv=pass; d=google.com; s=arc-20160816; b=qiFwLF6i/B1XEHoVc/VVh2W0KEodT8dlPc61aoChBM8kpM4q4RGGe4HGVYx3b539m9 622wuOxcT/a9+hWsAq6KDB5KPqrsIpS0EUMJjXyXyqLgrp56fzvKlAfoN59tPwcffS5v 0/Yl2Qe4s5L9ixsmaf6rdKDbPPyUC+xiuzE90BMpL+ZbC7DTtWuulzr6vDpnNb1FubuU VeetsmmPgMRELtA2HMicTKieRJcEvHTQPQ/8W2uNHEBEkNMsZfpJ89KsMLuwAFzL90xq xisReeHvZdsNijMzd7DtDOtBBUrxVPzBDTiwMRG6qqSmcN7cW1m9Gu1DfeFtnMiUugrB v4Rg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=o8Nir5KuUuYhOA+aF4zGR96oizaSq+ZBNoKujx57lng=; fh=WCr07Scg6Gqd2JDiG1w911+90uj5t6/vK7Soh03Dkao=; b=vb99wYDEAUc4UZCICY8RXskfb56R/8SqgM8U+52D14sSGKOZNlHFzAYjSGHrB652UF nXGObaicZfT74Fj5o4rQ6ns+bkvBhBIjJiYg+RNVfdt29gVMtlURLhq2SbLzB/htVt4Z wm1GwI4ad1hHuAr9w/yh6GCNtYa8w8Ea0cVvKyu3LwyGTQHTOIBWvIvecQgxKbRLgGjV ydOYDIiYvSwZlbHmxIT4ZndDnGpl6zqEf1hmTZTuKM7N6Lxly42/7MABZ1RuIj+yi6OK cwKaGK+LY0iffCqvZEzAIIrfHoiQoC+kdqWAEBxJYdQSGnDZm2PuedmNnN5QOu61/Cae 4B+w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p8HcQ16N; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c96fc95si101731455ad.236.2024.05.29.07.21.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 07:21:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p8HcQ16N; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 807DAB24048 for ; Wed, 29 May 2024 14:06:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA4761F5F6; Wed, 29 May 2024 14:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p8HcQ16N" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCBB91DDD1 for ; Wed, 29 May 2024 14:06:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991593; cv=none; b=P4IiLsQOhAksIXl9mHpkty+t2Nfj7RQtuYtHChfh+KMQCbvQtzZuZM9ugSqbwHVzKbHVS+/aZvuaWt1D93MvFxGYO2sXi0dz40jpx60Vas4HItfs1eiJbjlOXApclIyzOQKw/cfo9N9axoHvLUlqQKi+GrXhaH0HdUrlGk+MPsQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991593; c=relaxed/simple; bh=xpmET28viFR3TkIrXW9pSkeAEoSPmQ/nszpOTyWdkAE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=r6Ulg6OEPjTqMY0/VfhlIPwpox/JFw69DPu4qnWUhDeK5ilMIxZm26yVu1Ns6qMFoamCpG2jguYX1BZ7i1s+ODqulm0/rKqD/vo0LnD7jOtfgxGrhmn/5YLtIfJZjcy2ul2xs5qejct0RPtJdTcUuGHyV5Gnm2NmMhE1v90Buuk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p8HcQ16N; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54D42C4AF08 for ; Wed, 29 May 2024 14:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716991593; bh=xpmET28viFR3TkIrXW9pSkeAEoSPmQ/nszpOTyWdkAE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=p8HcQ16NxOe8VYg0EAmIgZuY2Tr0jlUy591iQEqoUc26vWFARjUGWS1FbQ46CatfP M63gFnzA19JNtrBUolfrRVZ/BS2tTldalee8zalu/Hsrl9vyudAfDIOFs2rGqCwgZp PP+yVK0WA1dLN72Tfk7WwzPlJTWKCItQUa8ET8//rbi4ACW22q6jLz2ZwuYUIE4d8J MU7wWl/urjs5gaDZcfkd1TTmsoC76yRDbFML8XD51lvkW3nZMzCQR6E3ZRX534Q6/G h7zxnjCxWip1JzS6K8COsiS+eO5QGCMEsfjcudi7kPl7+wyK1Zw9MNnMoVN3/jxqgl PE0fTzONyenuw== Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-62a0873c6e4so21462257b3.3 for ; Wed, 29 May 2024 07:06:33 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUO2Iw4cEm5BXyMLF2DLashIVUCUJqi65t0I2LsTQxIhJQUlS6CZXw0m8YmXEt712xSAWIlUJVMTDpIDfCFPag0OZH8psQbz79vJxFD X-Gm-Message-State: AOJu0YwpCqhRYWqGkctP5W7O3Xc8IOtDQ5BPo9dg6+siMjd0halqb6Zc YEWoHsJQKqaDzmaI+Jow8YPxmH1yMb7Nw4RIBmoVbI+ESMHeE4wpz2FlnUrckLEvGRCEoZ3F0Sg TSwsT4c2ze1N+ZNhAN2oC78xtGTrV4Ao3gmbBsA== X-Received: by 2002:a05:690c:802:b0:627:7871:e172 with SMTP id 00721157ae682-62a08fdc095mr172764587b3.51.1716991592506; Wed, 29 May 2024 07:06:32 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240516062455.106266-1-alexander.stein@ew.tq-group.com> <20240516062455.106266-4-alexander.stein@ew.tq-group.com> In-Reply-To: <20240516062455.106266-4-alexander.stein@ew.tq-group.com> From: Robert Foss Date: Wed, 29 May 2024 16:06:21 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/3] drm/bridge: tc358767: Support write-only registers To: Alexander Stein Cc: Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 16, 2024 at 8:25=E2=80=AFAM Alexander Stein 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 > --- > 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/t= c358767.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_precio= us_table =3D { > .n_yes_ranges =3D ARRAY_SIZE(tc_precious_ranges), > }; > > -static const struct regmap_range tc_non_writeable_ranges[] =3D { > - 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 =3D { > - .no_ranges =3D tc_non_writeable_ranges, > - .n_no_ranges =3D 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 =3D { > .name =3D "tc358767", > @@ -2108,9 +2120,9 @@ static const struct regmap_config tc_regmap_config = =3D { > .max_register =3D PLL_DBG, > .cache_type =3D REGCACHE_MAPLE, > .readable_reg =3D tc_readable_reg, > + .writeable_reg =3D tc_writeable_reg, > .volatile_table =3D &tc_volatile_table, > .precious_table =3D &tc_precious_table, > - .wr_table =3D &tc_writeable_table, > .reg_format_endian =3D REGMAP_ENDIAN_BIG, > .val_format_endian =3D REGMAP_ENDIAN_LITTLE, > }; > -- > 2.34.1 > Reviewed-by: Robert Foss