Skip to content

Commit 5def64c

Browse files
author
Chandan Kumar Jha
committed
msm: camera: isp: Add fps Blob support
Add fps blob to get the fps value from user space. Epoch interrupt configuration will be depend on the fps value. Configure epoch interrupt to half of the frame if fps value is 60, in rest all cases configure epoch interrupt to 2/3 of the frame. Change-Id: I2544a5e18895a983155c2f01e49920c9e1ec59b9 Signed-off-by: Chandan Kumar Jha <[email protected]>
1 parent cb1a16e commit 5def64c

File tree

7 files changed

+136
-2
lines changed

7 files changed

+136
-2
lines changed

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3198,6 +3198,54 @@ static int cam_isp_blob_fe_update(
31983198
return rc;
31993199
}
32003200

3201+
static int cam_isp_blob_fps_config(
3202+
uint32_t blob_type,
3203+
struct cam_isp_generic_blob_info *blob_info,
3204+
struct cam_fps_config *fps_config,
3205+
struct cam_hw_prepare_update_args *prepare)
3206+
{
3207+
struct cam_ife_hw_mgr_ctx *ctx = NULL;
3208+
struct cam_ife_hw_mgr_res *hw_mgr_res;
3209+
struct cam_hw_intf *hw_intf;
3210+
struct cam_vfe_fps_config_args fps_config_args;
3211+
int rc = -EINVAL;
3212+
uint32_t i;
3213+
3214+
ctx = prepare->ctxt_to_hw_map;
3215+
3216+
list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_src, list) {
3217+
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
3218+
if (!hw_mgr_res->hw_res[i])
3219+
continue;
3220+
3221+
if (hw_mgr_res->res_id == CAM_ISP_HW_VFE_IN_CAMIF) {
3222+
hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
3223+
if (hw_intf && hw_intf->hw_ops.process_cmd) {
3224+
fps_config_args.fps =
3225+
fps_config->fps;
3226+
fps_config_args.node_res =
3227+
hw_mgr_res->hw_res[i];
3228+
3229+
rc = hw_intf->hw_ops.process_cmd(
3230+
hw_intf->hw_priv,
3231+
CAM_ISP_HW_CMD_FPS_CONFIG,
3232+
&fps_config_args,
3233+
sizeof(
3234+
struct cam_vfe_fps_config_args)
3235+
);
3236+
if (rc)
3237+
CAM_ERR(CAM_ISP,
3238+
"Failed fps config:%d",
3239+
fps_config->fps);
3240+
} else
3241+
CAM_WARN(CAM_ISP, "NULL hw_intf!");
3242+
}
3243+
}
3244+
}
3245+
3246+
return rc;
3247+
}
3248+
32013249
static int cam_isp_blob_ubwc_update(
32023250
uint32_t blob_type,
32033251
struct cam_isp_generic_blob_info *blob_info,
@@ -3742,7 +3790,6 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
37423790
return -EINVAL;
37433791
}
37443792

3745-
CAM_DBG(CAM_ISP, "FS2: BLOB Type: %d", blob_type);
37463793
switch (blob_type) {
37473794
case CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG: {
37483795
struct cam_isp_resource_hfr_config *hfr_config;
@@ -3995,6 +4042,24 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
39954042
if (rc)
39964043
CAM_ERR(CAM_ISP,
39974044
"Sensor Dimension Update Failed rc: %d", rc);
4045+
}
4046+
break;
4047+
case CAM_ISP_GENERIC_BLOB_TYPE_FPS_CONFIG: {
4048+
struct cam_fps_config *fps_config;
4049+
4050+
if (blob_size < sizeof(struct cam_fps_config)) {
4051+
CAM_ERR(CAM_ISP, "Invalid fps blob size %u expected %u",
4052+
blob_size, sizeof(struct cam_fps_config));
4053+
return -EINVAL;
4054+
}
4055+
4056+
fps_config = (struct cam_fps_config *)blob_data;
4057+
4058+
rc = cam_isp_blob_fps_config(blob_type, blob_info,
4059+
fps_config, prepare);
4060+
if (rc)
4061+
CAM_ERR(CAM_ISP, "FPS Update Failed rc: %d", rc);
4062+
39984063
}
39994064
break;
40004065
default:

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "cam_irq_controller.h"
2121
#include <uapi/media/cam_isp.h>
2222

23+
#define CAM_ISP_FPS_60 60
24+
2325
/*
2426
* struct cam_isp_timestamp:
2527
*
@@ -105,6 +107,7 @@ enum cam_isp_hw_cmd_type {
105107
CAM_ISP_HW_CMD_FE_UPDATE_IN_RD,
106108
CAM_ISP_HW_CMD_FE_UPDATE_BUS_RD,
107109
CAM_ISP_HW_CMD_GET_IRQ_REGISTER_DUMP,
110+
CAM_ISP_HW_CMD_FPS_CONFIG,
108111
CAM_ISP_HW_CMD_MAX,
109112
};
110113

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/include/cam_vfe_hw_intf.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,17 @@ struct cam_vfe_clock_update_args {
177177
uint64_t clk_rate;
178178
};
179179

180+
/*
181+
* struct cam_vfe_fps_config_args:
182+
*
183+
* @node_res: Resource to get the fps value
184+
* @fps: FPS value to configure EPOCH
185+
*/
186+
struct cam_vfe_fps_config_args {
187+
struct cam_isp_resource_node *node_res;
188+
uint32_t fps;
189+
};
190+
180191
/*
181192
* struct cam_vfe_bw_update_args:
182193
*

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ int cam_vfe_process_cmd(void *hw_priv, uint32_t cmd_type,
761761
case CAM_ISP_HW_CMD_BW_UPDATE:
762762
case CAM_ISP_HW_CMD_BW_CONTROL:
763763
case CAM_ISP_HW_CMD_GET_IRQ_REGISTER_DUMP:
764+
case CAM_ISP_HW_CMD_FPS_CONFIG:
764765
rc = core_info->vfe_top->hw_ops.process_cmd(
765766
core_info->vfe_top->top_priv, cmd_type, cmd_args,
766767
arg_size);

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver2.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct cam_vfe_mux_camif_data {
4444
bool enable_sof_irq_debug;
4545
uint32_t irq_debug_cnt;
4646
uint32_t camif_debug;
47+
uint32_t fps;
4748
};
4849

4950
static int cam_vfe_camif_validate_pix_pattern(uint32_t pattern)
@@ -269,9 +270,15 @@ static int cam_vfe_camif_resource_start(
269270
rsrc_data->camif_reg->epoch_irq);
270271
break;
271272
default:
272-
epoch0_irq_mask = ((rsrc_data->last_line -
273+
if (rsrc_data->fps == CAM_ISP_FPS_60) {
274+
epoch0_irq_mask = ((rsrc_data->last_line -
273275
rsrc_data->first_line) / 2) +
274276
rsrc_data->first_line;
277+
} else {
278+
epoch0_irq_mask = (((rsrc_data->last_line -
279+
rsrc_data->first_line) * 2) / 3) +
280+
rsrc_data->first_line;
281+
}
275282
epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg &
276283
0xFFFF;
277284
computed_epoch_line_cfg = (epoch0_irq_mask << 16) |
@@ -515,6 +522,20 @@ static int cam_vfe_camif_sof_irq_debug(
515522

516523
return 0;
517524
}
525+
static int cam_vfe_camif_set_fps_config(
526+
struct cam_isp_resource_node *rsrc_node, void *cmd_args)
527+
{
528+
struct cam_vfe_mux_camif_data *camif_priv = NULL;
529+
struct cam_vfe_fps_config_args *fps_args = cmd_args;
530+
531+
camif_priv =
532+
(struct cam_vfe_mux_camif_data *)rsrc_node->res_priv;
533+
534+
camif_priv->fps = fps_args->fps;
535+
536+
return 0;
537+
538+
}
518539

519540
static int cam_vfe_camif_process_cmd(struct cam_isp_resource_node *rsrc_node,
520541
uint32_t cmd_type, void *cmd_args, uint32_t arg_size)
@@ -546,6 +567,9 @@ static int cam_vfe_camif_process_cmd(struct cam_isp_resource_node *rsrc_node,
546567
case CAM_ISP_HW_CMD_GET_IRQ_REGISTER_DUMP:
547568
rc = cam_vfe_camif_irq_reg_dump(rsrc_node);
548569
break;
570+
case CAM_ISP_HW_CMD_FPS_CONFIG:
571+
rc = cam_vfe_camif_set_fps_config(rsrc_node, cmd_args);
572+
break;
549573
default:
550574
CAM_ERR(CAM_ISP,
551575
"unsupported process command:%d", cmd_type);

drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver2.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,22 @@ static int cam_vfe_top_fs_update(
283283
return 0;
284284
}
285285

286+
static int cam_vfe_top_fps_config(
287+
struct cam_vfe_top_ver2_priv *top_priv,
288+
void *cmd_args, uint32_t arg_size)
289+
{
290+
struct cam_vfe_fps_config_args *cmd_update = NULL;
291+
292+
cmd_update =
293+
(struct cam_vfe_fps_config_args *)cmd_args;
294+
295+
if (cmd_update->node_res->process_cmd)
296+
return cmd_update->node_res->process_cmd(cmd_update->node_res,
297+
CAM_ISP_HW_CMD_FPS_CONFIG, cmd_args, arg_size);
298+
299+
return 0;
300+
}
301+
286302
static int cam_vfe_top_clock_update(
287303
struct cam_vfe_top_ver2_priv *top_priv,
288304
void *cmd_args, uint32_t arg_size)
@@ -740,6 +756,10 @@ int cam_vfe_top_process_cmd(void *device_priv, uint32_t cmd_type,
740756
rc = cam_vfe_get_irq_register_dump(top_priv,
741757
cmd_args, arg_size);
742758
break;
759+
case CAM_ISP_HW_CMD_FPS_CONFIG:
760+
rc = cam_vfe_top_fps_config(top_priv, cmd_args,
761+
arg_size);
762+
break;
743763
default:
744764
rc = -EINVAL;
745765
CAM_ERR(CAM_ISP, "Error! Invalid cmd:%d", cmd_type);

include/uapi/media/cam_isp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
#define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 6
9494
#define CAM_ISP_GENERIC_BLOB_TYPE_INIT_FRAME_DROP 10
9595
#define CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG 11
96+
#define CAM_ISP_GENERIC_BLOB_TYPE_FPS_CONFIG 12
9697

9798
/* Per Path Usage Data */
9899
#define CAM_ISP_USAGE_INVALID 0
@@ -520,6 +521,15 @@ struct cam_isp_acquire_hw_info {
520521
uint64_t data;
521522
};
522523

524+
/**
525+
* struct cam_fps_config - FPS blob support
526+
*
527+
* @fps: FPS value
528+
*/
529+
struct cam_fps_config {
530+
uint32_t fps;
531+
} __attribute__((packed));
532+
523533
#define CAM_ISP_ACQUIRE_COMMON_VER0 0x1000
524534

525535
#define CAM_ISP_ACQUIRE_COMMON_SIZE_VER0 0x0

0 commit comments

Comments
 (0)