Commit e75d25a0 authored by Alexander Stein's avatar Alexander Stein Committed by Hans Verkuil
Browse files

media: staging: media: imx6-mipi-csi2: Add log_status core callback



This prints all register values.

Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent f93ff8b7
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <media/v4l2-common.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-mc.h>
@@ -564,6 +565,49 @@ static int csi2_registered(struct v4l2_subdev *sd)
				      V4L2_FIELD_NONE, NULL);
}

/* --------------- CORE OPS --------------- */

static int csi2_log_status(struct v4l2_subdev *sd)
{
	struct csi2_dev *csi2 = sd_to_dev(sd);

	v4l2_info(sd, "-----MIPI CSI status-----\n");
	v4l2_info(sd, "VERSION: 0x%x\n",
		  readl(csi2->base + CSI2_VERSION));
	v4l2_info(sd, "N_LANES: 0x%x\n",
		  readl(csi2->base + CSI2_N_LANES));
	v4l2_info(sd, "PHY_SHUTDOWNZ: 0x%x\n",
		  readl(csi2->base + CSI2_PHY_SHUTDOWNZ));
	v4l2_info(sd, "DPHY_RSTZ: 0x%x\n",
		  readl(csi2->base + CSI2_DPHY_RSTZ));
	v4l2_info(sd, "RESETN: 0x%x\n",
		  readl(csi2->base + CSI2_RESETN));
	v4l2_info(sd, "PHY_STATE: 0x%x\n",
		  readl(csi2->base + CSI2_PHY_STATE));
	v4l2_info(sd, "DATA_IDS_1: 0x%x\n",
		  readl(csi2->base + CSI2_DATA_IDS_1));
	v4l2_info(sd, "DATA_IDS_2: 0x%x\n",
		  readl(csi2->base + CSI2_DATA_IDS_2));
	v4l2_info(sd, "ERR1: 0x%x\n",
		  readl(csi2->base + CSI2_ERR1));
	v4l2_info(sd, "ERR2: 0x%x\n",
		  readl(csi2->base + CSI2_ERR2));
	v4l2_info(sd, "MSK1: 0x%x\n",
		  readl(csi2->base + CSI2_MSK1));
	v4l2_info(sd, "MSK2: 0x%x\n",
		  readl(csi2->base + CSI2_MSK2));
	v4l2_info(sd, "PHY_TST_CTRL0: 0x%x\n",
		  readl(csi2->base + CSI2_PHY_TST_CTRL0));
	v4l2_info(sd, "PHY_TST_CTRL1: 0x%x\n",
		  readl(csi2->base + CSI2_PHY_TST_CTRL1));

	return 0;
}

static const struct v4l2_subdev_core_ops csi2_core_ops = {
	.log_status = csi2_log_status,
};

static const struct media_entity_operations csi2_entity_ops = {
	.link_setup = csi2_link_setup,
	.link_validate = v4l2_subdev_link_validate,
@@ -581,6 +625,7 @@ static const struct v4l2_subdev_pad_ops csi2_pad_ops = {
};

static const struct v4l2_subdev_ops csi2_subdev_ops = {
	.core = &csi2_core_ops,
	.video = &csi2_video_ops,
	.pad = &csi2_pad_ops,
};