Merge "video: driver: fix subscribe event handling"
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

commit
1dcad3ea8c
@@ -23,6 +23,8 @@ int msm_vdec_s_param(struct msm_vidc_inst *inst,
|
||||
struct v4l2_streamparm *s_parm);
|
||||
int msm_vdec_g_param(struct msm_vidc_inst *inst,
|
||||
struct v4l2_streamparm *s_parm);
|
||||
int msm_vdec_subscribe_event(struct msm_vidc_inst *inst,
|
||||
const struct v4l2_event_subscription *sub);
|
||||
int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f);
|
||||
int msm_vdec_inst_init(struct msm_vidc_inst *inst);
|
||||
int msm_vdec_inst_deinit(struct msm_vidc_inst *inst);
|
||||
|
@@ -25,6 +25,8 @@ int msm_venc_s_param(struct msm_vidc_inst *inst,
|
||||
struct v4l2_streamparm *s_parm);
|
||||
int msm_venc_g_param(struct msm_vidc_inst *inst,
|
||||
struct v4l2_streamparm *s_parm);
|
||||
int msm_venc_subscribe_event(struct msm_vidc_inst *inst,
|
||||
const struct v4l2_event_subscription *sub);
|
||||
int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f);
|
||||
int msm_venc_inst_init(struct msm_vidc_inst *inst);
|
||||
int msm_venc_inst_deinit(struct msm_vidc_inst *inst);
|
||||
|
@@ -12,6 +12,8 @@
|
||||
|
||||
struct msm_vidc_core;
|
||||
|
||||
#define MAX_EVENTS 30
|
||||
|
||||
#define call_venus_op(d, op, ...) \
|
||||
(((d) && (d)->venus_ops && (d)->venus_ops->op) ? \
|
||||
((d)->venus_ops->op(__VA_ARGS__)):0)
|
||||
|
@@ -2827,6 +2827,37 @@ int msm_vdec_g_param(struct msm_vidc_inst *inst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msm_vdec_subscribe_event(struct msm_vidc_inst *inst,
|
||||
const struct v4l2_event_subscription *sub)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!inst || !sub) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (sub->type) {
|
||||
case V4L2_EVENT_EOS:
|
||||
rc = v4l2_event_subscribe(&inst->event_handler, sub, MAX_EVENTS, NULL);
|
||||
break;
|
||||
case V4L2_EVENT_SOURCE_CHANGE:
|
||||
rc = v4l2_src_change_event_subscribe(&inst->event_handler, sub);
|
||||
break;
|
||||
case V4L2_EVENT_CTRL:
|
||||
rc = v4l2_ctrl_subscribe_event(&inst->event_handler, sub);
|
||||
break;
|
||||
default:
|
||||
i_vpr_e(inst, "%s: invalid type %d id %d\n", __func__, sub->type, sub->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (rc)
|
||||
i_vpr_e(inst, "%s: failed, type %d id %d\n",
|
||||
__func__, sub->type, sub->id);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int msm_vdec_check_colorformat_supported(struct msm_vidc_inst* inst,
|
||||
enum msm_vidc_colorformat_type colorformat)
|
||||
{
|
||||
|
@@ -1707,6 +1707,34 @@ int msm_venc_g_param(struct msm_vidc_inst *inst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int msm_venc_subscribe_event(struct msm_vidc_inst *inst,
|
||||
const struct v4l2_event_subscription *sub)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!inst || !sub) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (sub->type) {
|
||||
case V4L2_EVENT_EOS:
|
||||
rc = v4l2_event_subscribe(&inst->event_handler, sub, MAX_EVENTS, NULL);
|
||||
break;
|
||||
case V4L2_EVENT_CTRL:
|
||||
rc = v4l2_ctrl_subscribe_event(&inst->event_handler, sub);
|
||||
break;
|
||||
default:
|
||||
i_vpr_e(inst, "%s: invalid type %d id %d\n", __func__, sub->type, sub->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (rc)
|
||||
i_vpr_e(inst, "%s: failed, type %d id %d\n",
|
||||
__func__, sub->type, sub->id);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@@ -26,8 +26,6 @@
|
||||
/* kernel/msm-4.19 */
|
||||
#define MSM_VIDC_VERSION ((5 << 16) + (10 << 8) + 0)
|
||||
|
||||
#define MAX_EVENTS 30
|
||||
|
||||
static inline bool valid_v4l2_buffer(struct v4l2_buffer *b,
|
||||
struct msm_vidc_inst *inst)
|
||||
{
|
||||
@@ -742,12 +740,14 @@ int msm_vidc_subscribe_event(void *instance,
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
i_vpr_h(inst, "%s: type %d id %d\n", __func__, sub->type, sub->id);
|
||||
rc = v4l2_event_subscribe(&inst->event_handler,
|
||||
sub, MAX_EVENTS, NULL);
|
||||
if (rc)
|
||||
i_vpr_e(inst, "%s: fialed, type %d id %d\n",
|
||||
__func__, sub->type, sub->id);
|
||||
|
||||
if (inst->domain == MSM_VIDC_DECODER)
|
||||
rc = msm_vdec_subscribe_event(inst, sub);
|
||||
if (inst->domain == MSM_VIDC_ENCODER)
|
||||
rc = msm_venc_subscribe_event(inst, sub);
|
||||
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_vidc_subscribe_event);
|
||||
@@ -765,7 +765,7 @@ int msm_vidc_unsubscribe_event(void *instance,
|
||||
i_vpr_h(inst, "%s: type %d id %d\n", __func__, sub->type, sub->id);
|
||||
rc = v4l2_event_unsubscribe(&inst->event_handler, sub);
|
||||
if (rc)
|
||||
i_vpr_e(inst, "%s: fialed, type %d id %d\n",
|
||||
i_vpr_e(inst, "%s: failed, type %d id %d\n",
|
||||
__func__, sub->type, sub->id);
|
||||
return rc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user