Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: hws: fix device info register field masks
@ 2026-08-01  5:37 Ben Hoff
  0 siblings, 0 replies; only message in thread
From: Ben Hoff @ 2026-08-01  5:37 UTC (permalink / raw)
  To: linux-media; +Cc: linux-kernel, mchehab, Hans Verkuil

The baseline driver decodes the device version from bits 15:8 and the
sub-version from bits 23:16 of HWS_REG_DEVICE_INFO. The current masks
decode both fields one byte too low, reading the device version from a
byte the baseline driver ignores and the sub-version from the device
version field.

hws_configure_hardware_capabilities() uses the device version to
classify the hardware generation. An incorrect version can classify
newer hardware as legacy, select the legacy capture path, and skip
HWS_REG_DMA_MAX_SIZE programming.

Correct both field masks and update the register layout documentation.

Signed-off-by: Ben Hoff <hoff.benjamin.k@gmail.com>
---
 drivers/media/pci/hws/hws_pci.c | 4 ++--
 drivers/media/pci/hws/hws_reg.h | 7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/media/pci/hws/hws_pci.c b/drivers/media/pci/hws/hws_pci.c
index 30bb7d34465b..75be77d6c197 100644
--- a/drivers/media/pci/hws/hws_pci.c
+++ b/drivers/media/pci/hws/hws_pci.c
@@ -33,8 +33,8 @@ static unsigned long long hws_elapsed_us(u64 start_ns)
 }
 
 /* register layout inside HWS_REG_DEVICE_INFO */
-#define DEVINFO_VER GENMASK(7, 0)
-#define DEVINFO_SUBVER GENMASK(15, 8)
+#define DEVINFO_VER GENMASK(15, 8)
+#define DEVINFO_SUBVER GENMASK(23, 16)
 #define DEVINFO_YV12 GENMASK(31, 28)
 #define DEVINFO_HWKEY GENMASK(27, 24)
 #define DEVINFO_PORTID GENMASK(25, 24) /* low 2 bits of HW-key */
diff --git a/drivers/media/pci/hws/hws_reg.h b/drivers/media/pci/hws/hws_reg.h
index e4fb4af44434..ac607360d628 100644
--- a/drivers/media/pci/hws/hws_reg.h
+++ b/drivers/media/pci/hws/hws_reg.h
@@ -121,9 +121,10 @@
 #define HWS_REG_DEVICE_INFO   (CVBS_IN_BASE +  88 * PCIE_BARADDROFSIZE)
 /*
  * Reading this 32-bit word returns:
- *   bits 7:0   = "device version"
- *   bits 15:8  = "device sub-version"
- *   bits 23:24 = "HW key / port ID" etc.
+ *   bits 7:0   = unused by the baseline driver
+ *   bits 15:8  = device version
+ *   bits 23:16 = device sub-version
+ *   bits 27:24 = HW key (port ID in bits 25:24)
  *   bits 31:28 = "support YV12" flags
  */
 
-- 
2.43.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-01  5:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-01  5:37 [PATCH] media: hws: fix device info register field masks Ben Hoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox