Commit 962fb140 authored by Heiko Stuebner's avatar Heiko Stuebner Committed by Mauro Carvalho Chehab

media: rockchip: rkisp1: make some isp-stats functions variable

The isp block evolved in subsequent socs, so some functions
will behave differently on newer variants.

Therefore make it possible to override the needed stats functions.
Signed-off-by: default avatarHeiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: default avatarDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 5e8d9d72
...@@ -232,6 +232,16 @@ struct rkisp1_capture { ...@@ -232,6 +232,16 @@ struct rkisp1_capture {
} pix; } pix;
}; };
struct rkisp1_stats;
struct rkisp1_stats_ops {
void (*get_awb_meas)(struct rkisp1_stats *stats,
struct rkisp1_stat_buffer *pbuf);
void (*get_aec_meas)(struct rkisp1_stats *stats,
struct rkisp1_stat_buffer *pbuf);
void (*get_hst_meas)(struct rkisp1_stats *stats,
struct rkisp1_stat_buffer *pbuf);
};
/* /*
* struct rkisp1_stats - ISP Statistics device * struct rkisp1_stats - ISP Statistics device
* *
...@@ -244,6 +254,7 @@ struct rkisp1_capture { ...@@ -244,6 +254,7 @@ struct rkisp1_capture {
struct rkisp1_stats { struct rkisp1_stats {
struct rkisp1_vdev_node vnode; struct rkisp1_vdev_node vnode;
struct rkisp1_device *rkisp1; struct rkisp1_device *rkisp1;
const struct rkisp1_stats_ops *ops;
spinlock_t lock; /* locks the buffers list 'stats' */ spinlock_t lock; /* locks the buffers list 'stats' */
struct list_head stat; struct list_head stat;
......
...@@ -286,6 +286,12 @@ static void rkisp1_stats_get_bls_meas(struct rkisp1_stats *stats, ...@@ -286,6 +286,12 @@ static void rkisp1_stats_get_bls_meas(struct rkisp1_stats *stats,
} }
} }
static const struct rkisp1_stats_ops rkisp1_stats_ops = {
.get_awb_meas = rkisp1_stats_get_awb_meas,
.get_aec_meas = rkisp1_stats_get_aec_meas,
.get_hst_meas = rkisp1_stats_get_hst_meas,
};
static void static void
rkisp1_stats_send_measurement(struct rkisp1_stats *stats, u32 isp_ris) rkisp1_stats_send_measurement(struct rkisp1_stats *stats, u32 isp_ris)
{ {
...@@ -307,18 +313,18 @@ rkisp1_stats_send_measurement(struct rkisp1_stats *stats, u32 isp_ris) ...@@ -307,18 +313,18 @@ rkisp1_stats_send_measurement(struct rkisp1_stats *stats, u32 isp_ris)
cur_stat_buf = (struct rkisp1_stat_buffer *) cur_stat_buf = (struct rkisp1_stat_buffer *)
vb2_plane_vaddr(&cur_buf->vb.vb2_buf, 0); vb2_plane_vaddr(&cur_buf->vb.vb2_buf, 0);
if (isp_ris & RKISP1_CIF_ISP_AWB_DONE) if (isp_ris & RKISP1_CIF_ISP_AWB_DONE)
rkisp1_stats_get_awb_meas(stats, cur_stat_buf); stats->ops->get_awb_meas(stats, cur_stat_buf);
if (isp_ris & RKISP1_CIF_ISP_AFM_FIN) if (isp_ris & RKISP1_CIF_ISP_AFM_FIN)
rkisp1_stats_get_afc_meas(stats, cur_stat_buf); rkisp1_stats_get_afc_meas(stats, cur_stat_buf);
if (isp_ris & RKISP1_CIF_ISP_EXP_END) { if (isp_ris & RKISP1_CIF_ISP_EXP_END) {
rkisp1_stats_get_aec_meas(stats, cur_stat_buf); stats->ops->get_aec_meas(stats, cur_stat_buf);
rkisp1_stats_get_bls_meas(stats, cur_stat_buf); rkisp1_stats_get_bls_meas(stats, cur_stat_buf);
} }
if (isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY) if (isp_ris & RKISP1_CIF_ISP_HIST_MEASURE_RDY)
rkisp1_stats_get_hst_meas(stats, cur_stat_buf); stats->ops->get_hst_meas(stats, cur_stat_buf);
vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0, vb2_set_plane_payload(&cur_buf->vb.vb2_buf, 0,
sizeof(struct rkisp1_stat_buffer)); sizeof(struct rkisp1_stat_buffer));
...@@ -352,6 +358,8 @@ static void rkisp1_init_stats(struct rkisp1_stats *stats) ...@@ -352,6 +358,8 @@ static void rkisp1_init_stats(struct rkisp1_stats *stats)
V4L2_META_FMT_RK_ISP1_STAT_3A; V4L2_META_FMT_RK_ISP1_STAT_3A;
stats->vdev_fmt.fmt.meta.buffersize = stats->vdev_fmt.fmt.meta.buffersize =
sizeof(struct rkisp1_stat_buffer); sizeof(struct rkisp1_stat_buffer);
stats->ops = &rkisp1_stats_ops;
} }
int rkisp1_stats_register(struct rkisp1_device *rkisp1) int rkisp1_stats_register(struct rkisp1_device *rkisp1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment