Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp93541lqo; Wed, 15 May 2024 23:25:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMAhU1G9110vEY5CfLnDivx5IwNevRX8bbLqHQsdgCjwK58C/kdIafGz48izALrBqYURqZUs8reGOe0atx2Jzhy0UCaYFnPMs0hrkfDg== X-Google-Smtp-Source: AGHT+IHnePpbblxw40eRhu+xCxey0SqQpQ00wFQpfhfwx8SHFte2ZX1elra0OOU1BtyWb3SwGqtY X-Received: by 2002:a05:6102:94d:b0:485:75ae:4d91 with SMTP id ada2fe7eead31-48575ae65d9mr1385999137.34.1715840749300; Wed, 15 May 2024 23:25:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715840749; cv=pass; d=google.com; s=arc-20160816; b=O+PXSzOdXF6rgQjjTz5HRRylPOPssOQyfzHQmnPQO/BVyTlt4+fMG2G2DrCqoiRaRe cxqQXIBUJO76w3he3vFp0z0sQE0q0pVUTcu0hgk6tAFNS49PKm0mAmfiIVgPRjM4Vq1W Iob8/mFLivWPvI2BzncD7IiZpr7MKAI/ePRrI6Uocbtdb1pR46CEtV5zt9RwhHZJLHp4 lfccHttgbsPM4CUW1/3nVl+qOdM76uhmawzuKRPv+Woa53SfiCB7FfRL1taK2S1zTMsq 4oo1Y4qH72YWFTd8uiidJhl90g3QEVT+mvIygc+Tnx3QsI52YydMBV45mJ34pZlt3lQz m3qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature; bh=pjwDRb2G8zbxPaNc+6tKezQ18Sz0q1wOIQZhKqVMLVI=; fh=i4D4fpoKQyYP7X2YfmnfJNAKZdIoinDfQ4wTNJaduS0=; b=cyeOfz9ANNylS/TYHkxtO66Tbl/7Ye3KRDi4XCMA8Mcn5qhW4f8p+zsJ6MM4rflMEI 7nHwhbynXJQg9x+HRAbBX8vZaGaDvc57JWCDvBzaMmCwsPcbzGzkkQtv2k025htgJuz6 b0fay3X1JISm+X6kdAQE1WExmH6jgOGdw7ngy9ucoS0CEqS4H1De+ppSjswv0aheLGC9 CPboNF7gPT12KONdQvbAasFcbESQhtBflSxvA4Q8VAIuZBI4gYPJn3qx5VZWJEae3kf9 z+9ZwzB4daJQYC7Jk2PTMJCFgM8q5lwvj58bFZ27PFe+5htauBGJSZxlPiA4kgJeA7Gh nMHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=OvVRu5Be; dkim=temperror (no key for signature) header.i=@ew.tq-group.com header.s=dkim header.b=GzR3r79t; arc=pass (i=1 spf=pass spfdomain=ew.tq-group.com dkim=pass dkdomain=tq-group.com dmarc=pass fromdomain=ew.tq-group.com); spf=pass (google.com: domain of linux-kernel+bounces-180673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180673-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df54a1b77si165774881cf.87.2024.05.15.23.25.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 23:25:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=OvVRu5Be; dkim=temperror (no key for signature) header.i=@ew.tq-group.com header.s=dkim header.b=GzR3r79t; arc=pass (i=1 spf=pass spfdomain=ew.tq-group.com dkim=pass dkdomain=tq-group.com dmarc=pass fromdomain=ew.tq-group.com); spf=pass (google.com: domain of linux-kernel+bounces-180673-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180673-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 057521C20C36 for ; Thu, 16 May 2024 06:25:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCB6D2E40D; Thu, 16 May 2024 06:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="OvVRu5Be"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="GzR3r79t" Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (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 73FBD250EC for ; Thu, 16 May 2024 06:25:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715840719; cv=none; b=VZ/silFUjlTpJpXrgQeuiDqadLAQK6ZSNnBS28ZmLz8WSNTzeSBp/O7zUy7OZxll3zszie/47JJRtY7sfvOPXlgQr+LXvnnKhwtoMKeB8HNgZ0mTF/ukCzhridYck4GWYEHgb1IdoAGQ8noWbdFWwQgp8tZbAg7qJC3YHuvFGlM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715840719; c=relaxed/simple; bh=cr2u80cvM29z+pFP8mTV5WAvPIk+8alCYrHT5NDOLII=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n9PtvaDIRJo4NZHMCFgfVMs/NunOjy/jm0gKIGgLDzacPehSycGsYp42gin5PBF45/FYhG412bhLpcHN1Zt+9NAjVhvfT42GR6ZmHUrroHXDlq7JQilUbQ2plWgZmOdMZYZ5cUDl5Ciqy1ili4hpJJr45BDKzedMckey6d3C1dQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=OvVRu5Be; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=GzR3r79t reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1715840716; x=1747376716; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pjwDRb2G8zbxPaNc+6tKezQ18Sz0q1wOIQZhKqVMLVI=; b=OvVRu5BebKHRHR+BtHfXcFHqHYcMldAqGx3xh3ZB+6RX5QtpSzD1ExzL 6OrVUN4Z04654b6H/dUolXaiBRnFdr5Yhkk5J9m2knKXVFVzA7eik0078 xku89WTm3nwGTlxdWYoM6JWXX7Pcs4sw0y1jO4J+yOXwM+PrBP8Fqsek1 O72G0Pl6Qyx/qVccNho8gB4Bo7GVM1JuDO176HYE1r30qlRDyU2BqO5me yZS6ZFYdZ0M+UmsAjk4CUVu260K+w/dx1Rq03fBKouYsJbRLDeY2qZxLy oR3ENDM9uOBU3cfVT/VRYWvwUOjC1MuMf1vX0CD8+eXtt8HqFaTvtuksb g==; X-CSE-ConnectionGUID: 8Zh0bOBDSNqc60l5W+vPSw== X-CSE-MsgGUID: HmPVmQodSIaBzFT1MtwTfQ== X-IronPort-AV: E=Sophos;i="6.08,163,1712613600"; d="scan'208";a="36926967" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 16 May 2024 08:25:15 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 54669172BB1; Thu, 16 May 2024 08:25:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1715840711; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=pjwDRb2G8zbxPaNc+6tKezQ18Sz0q1wOIQZhKqVMLVI=; b=GzR3r79t9O7j1ByvAwCMbL1xieMpA+SDimX0ooFuOfNOlHs937Tc8x+Q7yT2Pr3gp6LEKi +RUePh2UyGihMp6CnJ5swrw8lTGV7bBZthQoCqXgMVGltCqUwtZAtONSkzsG6c+ByRpl9J XGrAPhVVMDbuqLpBf5hxrEgyCNgZfq9D1YDFvGw+JrEyfbGwNOn2UrYMSPb2k5ZvVV2LGT /pfwh5UKBCNwm9AOWoiniV6B20tc4QPQPCEjk0I7I51/eTgMq21/nztZa90PQExrHW2O4H NaIXL3cB3MB0WkdrMUqyVlcSYtOjOmTW2+ToDngyY7jn7jFvtvYzBptzlge+hA== From: Alexander Stein To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: Alexander Stein , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] drm/bridge: tc358767: Support write-only registers Date: Thu, 16 May 2024 08:24:55 +0200 Message-Id: <20240516062455.106266-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240516062455.106266-1-alexander.stein@ew.tq-group.com> References: <20240516062455.106266-1-alexander.stein@ew.tq-group.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 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/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