Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4eb0112a authored by Vishal Verma's avatar Vishal Verma Committed by Vishal
Browse files

msm: camera: sensor: Dump phy registers on error



Dump csiphy registers on following fatal errors:
1. lane overflow error
2. unbounded frame error
3. SOT ans EOT reception error
4. stream underflow error
These errors irqs are set at csid end, Currently there is no
interface to send message from one subdevice to other if the subdev is
not a real time device. This change adds an interface to notify the
no real time subdev.

CRs-Fixed: 2696744
Change-Id: I522167d1639ac298bc739a8a5a380a01356f0776
Signed-off-by: default avatarVishal Verma <vishverm@codeaurora.org>
parent 7ce00df4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
#include <linux/slab.h>
#include <uapi/media/cam_isp.h>
#include <uapi/media/cam_defs.h>

#include <media/cam_req_mgr.h>
#include <dt-bindings/msm/msm-camera.h>

#include "cam_ife_csid_core.h"
@@ -16,6 +16,7 @@
#include "cam_io_util.h"
#include "cam_debug_util.h"
#include "cam_cpas_api.h"
#include "cam_subdev.h"

/* Timeout value in msec */
#define IFE_CSID_TIMEOUT                               1000
@@ -1654,6 +1655,9 @@ static void cam_ife_csid_halt_csi2(
		csid_reg->csi2_reg->csid_csi2_rx_cfg0_addr);
	cam_io_w_mb(0, soc_info->reg_map[0].mem_base +
		csid_reg->csi2_reg->csid_csi2_rx_cfg1_addr);
	cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
			CAM_SUBDEV_MESSAGE_IRQ_ERR,
			csid_hw->csi2_rx_cfg.phy_sel);
}

static int cam_ife_csid_init_config_pxl_path(
+8 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#include <linux/slab.h>
#include <media/cam_tfe.h>
#include <media/cam_defs.h>
#include <media/cam_req_mgr.h>

#include "cam_tfe_csid_core.h"
#include "cam_isp_hw.h"
@@ -16,6 +17,7 @@
#include "cam_cpas_api.h"
#include "cam_isp_hw_mgr_intf.h"
#include <dt-bindings/msm/msm-camera.h>
#include "cam_subdev.h"

/* Timeout value in msec */
#define TFE_CSID_TIMEOUT                               1000
@@ -2587,6 +2589,12 @@ irqreturn_t cam_tfe_csid_irq(int irq_num, void *data)
			csid_reg->csi2_reg->csid_csi2_rx_cfg1_addr);
		cam_io_w_mb(0, soc_info->reg_map[0].mem_base +
			csid_reg->csi2_reg->csid_csi2_rx_irq_mask_addr);
		/* phy_sel starts from 1 and should never be zero*/
		if (csid_hw->csi2_rx_cfg.phy_sel > 0) {
			cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
				CAM_SUBDEV_MESSAGE_IRQ_ERR,
				(csid_hw->csi2_rx_cfg.phy_sel - 1));
		}
	}

	if (csid_hw->csid_debug & TFE_CSID_DEBUG_ENABLE_EOT_IRQ) {
+20 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -635,6 +635,24 @@ void cam_register_subdev_fops(struct v4l2_file_operations *fops)
}
EXPORT_SYMBOL(cam_register_subdev_fops);

void cam_subdev_notify_message(u32 subdev_type,
		enum cam_subdev_message_type_t message_type,
		uint32_t data)
{
	struct v4l2_subdev *sd = NULL;
	struct cam_subdev *csd = NULL;

	list_for_each_entry(sd, &g_dev.v4l2_dev->subdevs, list) {
		sd->entity.name = video_device_node_name(sd->devnode);
		if (sd->entity.function == subdev_type) {
			csd = container_of(sd, struct cam_subdev, sd);
			if (csd->msg_cb != NULL)
				csd->msg_cb(sd, message_type, data);
		}
	}
}
EXPORT_SYMBOL(cam_subdev_notify_message);

int cam_register_subdev(struct cam_subdev *csd)
{
	struct v4l2_subdev *sd;
@@ -663,7 +681,7 @@ int cam_register_subdev(struct cam_subdev *csd)
	sd = &csd->sd;
	v4l2_subdev_init(sd, csd->ops);
	sd->internal_ops = csd->internal_ops;
	snprintf(sd->name, ARRAY_SIZE(sd->name), csd->name);
	snprintf(sd->name, V4L2_SUBDEV_NAME_SIZE, "%s", csd->name);
	v4l2_set_subdevdata(sd, csd->token);

	sd->flags = csd->sd_flags;
+23 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_SUBDEV_H_
@@ -16,6 +16,10 @@

#define CAM_SUBDEVICE_EVENT_MAX 30

enum cam_subdev_message_type_t {
	CAM_SUBDEV_MESSAGE_IRQ_ERR = 0x1
};

/**
 * struct cam_subdev - describes a camera sub-device
 *
@@ -49,8 +53,26 @@ struct cam_subdev {
	u32                                    sd_flags;
	void                                  *token;
	u32                                    ent_function;
	void                                  (*msg_cb)(
					struct v4l2_subdev *sd,
					enum cam_subdev_message_type_t msg_type,
					uint32_t data);
};

/**
 * cam_subdev_notify_message()
 *
 * @brief:  Notify message to a subdevs of specific type
 *
 * @subdev_type:           Subdev type
 * @message_type:          message type
 * @data:                  data to be delivered.
 *
 */
void cam_subdev_notify_message(u32 subdev_type,
		enum cam_subdev_message_type_t message_type,
		uint32_t data);

/**
 * cam_subdev_probe()
 *
+22 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#include "cam_csiphy_dev.h"
@@ -9,6 +9,25 @@
#include "cam_csiphy_core.h"
#include <media/cam_sensor.h>

static void cam_csiphy_subdev_handle_message(
		struct v4l2_subdev *sd,
		enum cam_subdev_message_type_t message_type,
		uint32_t data)
{
	struct csiphy_device *csiphy_dev = v4l2_get_subdevdata(sd);

	switch (message_type) {
	case CAM_SUBDEV_MESSAGE_IRQ_ERR:
		CAM_INFO(CAM_CSIPHY, "subdev index : %d CSIPHY index: %d",
				csiphy_dev->soc_info.index, data);
		if (data == csiphy_dev->soc_info.index)
			cam_csiphy_status_dmp(csiphy_dev);
		break;
	default:
		break;
	}
}

static long cam_csiphy_subdev_ioctl(struct v4l2_subdev *sd,
	unsigned int cmd, void *arg)
{
@@ -148,6 +167,8 @@ static int32_t cam_csiphy_platform_probe(struct platform_device *pdev)
		(V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS);
	new_csiphy_dev->v4l2_dev_str.ent_function =
		CAM_CSIPHY_DEVICE_TYPE;
	new_csiphy_dev->v4l2_dev_str.msg_cb =
		cam_csiphy_subdev_handle_message;
	new_csiphy_dev->v4l2_dev_str.token =
		new_csiphy_dev;

Loading