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

Commit ac2254da authored by Venkat Chinta's avatar Venkat Chinta
Browse files

msm: camera: isp: Move event bottom-halves to hardware layer



Currently the bottom half for all hardware events resides in
the hardware manager layer. This bottom half polls all VFE
hardware for the occurrence of all types of events every time
it is invoked. This change moves bottom-half processing to
the hardware layer and adds an event callback function in the
hardware manager layer. This callback function is invoked by
the bottom-halves in the hardware layer with knowledge of the
specific resource and event type and hardware index, thus
eliminating the need to poll all hardware for all types of
events.

Change-Id: If1a50e2386d6d0d73f9e8b9ecceed72fcb73023c
Signed-off-by: default avatarVenkat Chinta <vchinta@codeaurora.org>
parent 364475ab
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-License-Identifier: GPL-2.0-only */
/*
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */
 */


#ifndef _CAM_HW_INTF_H_
#ifndef _CAM_HW_INTF_H_
@@ -73,4 +73,8 @@ struct cam_hw_intf {
	void                        *hw_priv;
	void                        *hw_priv;
};
};


/* hardware event callback function type */
typedef int (*cam_hw_mgr_event_cb_func)(void *priv, uint32_t evt_id,
	void *evt_data);

#endif /* _CAM_HW_INTF_H_ */
#endif /* _CAM_HW_INTF_H_ */
+269 −955

File changed.

Preview size limit exceeded, changes collapsed.

+2 −34
Original line number Original line Diff line number Diff line
@@ -124,6 +124,7 @@ struct cam_ife_hw_mgr_debug {
 * @config_done_complete    indicator for configuration complete
 * @config_done_complete    indicator for configuration complete
 * @init_done               indicate whether init hw is done
 * @init_done               indicate whether init hw is done
 * @is_fe_enable            indicate whether fetch engine\read path is enabled
 * @is_fe_enable            indicate whether fetch engine\read path is enabled
 * @is_dual                 indicate whether context is in dual VFE mode
 */
 */
struct cam_ife_hw_mgr_ctx {
struct cam_ife_hw_mgr_ctx {
	struct list_head                list;
	struct list_head                list;
@@ -160,6 +161,7 @@ struct cam_ife_hw_mgr_ctx {
	struct completion               config_done_complete;
	struct completion               config_done_complete;
	bool                            init_done;
	bool                            init_done;
	bool                            is_fe_enable;
	bool                            is_fe_enable;
	bool                            is_dual;
};
};


/**
/**
@@ -210,38 +212,4 @@ struct cam_ife_hw_mgr {
 */
 */
int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl);
int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl);


/**
 * cam_ife_mgr_do_tasklet_buf_done()
 *
 * @brief:              Main tasklet handle function for the buf done event
 *
 * @handler_priv:       Tasklet information handle
 * @evt_payload_priv:   Event payload for the handler funciton
 *
 */
int cam_ife_mgr_do_tasklet_buf_done(void *handler_priv, void *evt_payload_priv);

/**
 * cam_ife_mgr_do_tasklet()
 *
 * @brief:              Main tasklet handle function for mux resource events
 *
 * @handler_priv:       Tasklet information handle
 * @evt_payload_priv:   Event payload for the handler funciton
 *
 */
int cam_ife_mgr_do_tasklet(void *handler_priv, void *evt_payload_priv);

/**
 * cam_ife_mgr_do_tasklet_reg_update()
 *
 * @brief:              Tasklet handle function for reg update
 *
 * @handler_priv:       Tasklet information handle
 * @evt_payload_priv:   Event payload for the handler funciton
 *
 */
int cam_ife_mgr_do_tasklet_reg_update(void *handler_priv,
	void *evt_payload_priv);

#endif /* _CAM_IFE_HW_MGR_H_ */
#endif /* _CAM_IFE_HW_MGR_H_ */
+5 −2
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/*
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */
 */


#include <linux/slab.h>
#include <linux/slab.h>
@@ -24,6 +24,7 @@ static void cam_tasklet_action(unsigned long data);
 * @list:                   list_head member for each entry in queue
 * @list:                   list_head member for each entry in queue
 * @payload:                Payload structure for the event. This will be
 * @payload:                Payload structure for the event. This will be
 *                          passed to the handler function
 *                          passed to the handler function
 * @handler_priv:           Private data passed at event subscribe
 * @bottom_half_handler:    Function pointer for event handler in bottom
 * @bottom_half_handler:    Function pointer for event handler in bottom
 *                          half context
 *                          half context
 *
 *
@@ -31,6 +32,7 @@ static void cam_tasklet_action(unsigned long data);
struct cam_tasklet_queue_cmd {
struct cam_tasklet_queue_cmd {
	struct list_head                   list;
	struct list_head                   list;
	void                              *payload;
	void                              *payload;
	void                              *handler_priv;
	CAM_IRQ_HANDLER_BOTTOM_HALF        bottom_half_handler;
	CAM_IRQ_HANDLER_BOTTOM_HALF        bottom_half_handler;
};
};


@@ -203,6 +205,7 @@ void cam_tasklet_enqueue_cmd(
	CAM_DBG(CAM_ISP, "Enqueue tasklet cmd");
	CAM_DBG(CAM_ISP, "Enqueue tasklet cmd");
	tasklet_cmd->bottom_half_handler = bottom_half_handler;
	tasklet_cmd->bottom_half_handler = bottom_half_handler;
	tasklet_cmd->payload = evt_payload_priv;
	tasklet_cmd->payload = evt_payload_priv;
	tasklet_cmd->handler_priv = handler_priv;
	spin_lock_irqsave(&tasklet->tasklet_lock, flags);
	spin_lock_irqsave(&tasklet->tasklet_lock, flags);
	list_add_tail(&tasklet_cmd->list,
	list_add_tail(&tasklet_cmd->list,
		&tasklet->used_cmd_list);
		&tasklet->used_cmd_list);
@@ -317,7 +320,7 @@ static void cam_tasklet_action(unsigned long data)
	tasklet_info = (struct cam_tasklet_info *)data;
	tasklet_info = (struct cam_tasklet_info *)data;


	while (!cam_tasklet_dequeue_cmd(tasklet_info, &tasklet_cmd)) {
	while (!cam_tasklet_dequeue_cmd(tasklet_info, &tasklet_cmd)) {
		tasklet_cmd->bottom_half_handler(tasklet_info->ctx_priv,
		tasklet_cmd->bottom_half_handler(tasklet_cmd->handler_priv,
			tasklet_cmd->payload);
			tasklet_cmd->payload);
		cam_tasklet_put_cmd(tasklet_info, (void **)(&tasklet_cmd));
		cam_tasklet_put_cmd(tasklet_info, (void **)(&tasklet_cmd));
	}
	}
+19 −1
Original line number Original line Diff line number Diff line
@@ -8,9 +8,9 @@


#include <linux/completion.h>
#include <linux/completion.h>
#include "cam_hw.h"
#include "cam_hw.h"
#include <uapi/media/cam_isp.h>
#include "cam_soc_util.h"
#include "cam_soc_util.h"
#include "cam_irq_controller.h"
#include "cam_irq_controller.h"
#include "cam_hw_intf.h"
#include <uapi/media/cam_isp.h>
#include <uapi/media/cam_isp.h>


/*
/*
@@ -152,6 +152,24 @@ struct cam_isp_resource_node {
	CAM_IRQ_HANDLER_BOTTOM_HALF    bottom_half_handler;
	CAM_IRQ_HANDLER_BOTTOM_HALF    bottom_half_handler;
};
};


/*
 * struct cam_isp_hw_event_info:
 *
 * @Brief:          Structure to pass event details to hw mgr
 *
 * @res_type:       Type of IFE resource
 * @res_id:         Unique resource ID
 * @hw_idx:         IFE hw index
 * @err_type:       Error type if any
 *
 */
struct cam_isp_hw_event_info {
	enum cam_isp_resource_type     res_type;
	uint32_t                       res_id;
	uint32_t                       hw_idx;
	uint32_t                       err_type;
};

/*
/*
 * struct cam_isp_hw_cmd_buf_update:
 * struct cam_isp_hw_cmd_buf_update:
 *
 *
Loading