On Tue Nov 25 15:29:56 2025 +0100, Thorsten Schmelzer wrote:
> The g_register and s_register callbacks are useful for debugging the
> adv7180.
> 
> Implement the callbacks to expose the register debugging to userspace.
> 
> Signed-off-by: Thorsten Schmelzer <[email protected]>
> Reviewed-by: Niklas Söderlund <[email protected]>
> Signed-off-by: Michael Tretter <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/i2c/adv7180.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

---

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 4152f2049a6d..d289cbc2eefd 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -969,6 +969,32 @@ static int adv7180_subscribe_event(struct v4l2_subdev *sd,
        }
 }
 
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+static int adv7180_g_register(struct v4l2_subdev *sd,
+                             struct v4l2_dbg_register *reg)
+{
+       struct adv7180_state *state = to_state(sd);
+       int ret;
+
+       ret = adv7180_read(state, reg->reg);
+       if (ret < 0)
+               return ret;
+
+       reg->val = ret;
+       reg->size = 1;
+
+       return 0;
+}
+
+static int adv7180_s_register(struct v4l2_subdev *sd,
+                             const struct v4l2_dbg_register *reg)
+{
+       struct adv7180_state *state = to_state(sd);
+
+       return adv7180_write(state, reg->reg, reg->val);
+}
+#endif
+
 static const struct v4l2_subdev_video_ops adv7180_video_ops = {
        .s_std = adv7180_s_std,
        .g_std = adv7180_g_std,
@@ -982,6 +1008,10 @@ static const struct v4l2_subdev_video_ops 
adv7180_video_ops = {
 static const struct v4l2_subdev_core_ops adv7180_core_ops = {
        .subscribe_event = adv7180_subscribe_event,
        .unsubscribe_event = v4l2_event_subdev_unsubscribe,
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+       .g_register = adv7180_g_register,
+       .s_register = adv7180_s_register,
+#endif
 };
 
 static const struct v4l2_subdev_pad_ops adv7180_pad_ops = {
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to