Lines Matching refs:hgo
26 static inline u32 vsp1_hgo_read(struct vsp1_hgo *hgo, u32 reg) in vsp1_hgo_read() argument
28 return vsp1_read(hgo->histo.entity.vsp1, reg); in vsp1_hgo_read()
31 static inline void vsp1_hgo_write(struct vsp1_hgo *hgo, in vsp1_hgo_write() argument
43 struct vsp1_hgo *hgo = to_hgo(&entity->subdev); in vsp1_hgo_frame_end() local
49 buf = vsp1_histogram_buffer_get(&hgo->histo); in vsp1_hgo_frame_end()
55 if (hgo->num_bins == 256) { in vsp1_hgo_frame_end()
56 *data++ = vsp1_hgo_read(hgo, VI6_HGO_G_MAXMIN); in vsp1_hgo_frame_end()
57 *data++ = vsp1_hgo_read(hgo, VI6_HGO_G_SUM); in vsp1_hgo_frame_end()
60 vsp1_write(hgo->histo.entity.vsp1, in vsp1_hgo_frame_end()
62 *data++ = vsp1_hgo_read(hgo, VI6_HGO_EXT_HIST_DATA); in vsp1_hgo_frame_end()
66 } else if (hgo->max_rgb) { in vsp1_hgo_frame_end()
67 *data++ = vsp1_hgo_read(hgo, VI6_HGO_G_MAXMIN); in vsp1_hgo_frame_end()
68 *data++ = vsp1_hgo_read(hgo, VI6_HGO_G_SUM); in vsp1_hgo_frame_end()
71 *data++ = vsp1_hgo_read(hgo, VI6_HGO_G_HISTO(i)); in vsp1_hgo_frame_end()
75 *data++ = vsp1_hgo_read(hgo, VI6_HGO_R_MAXMIN); in vsp1_hgo_frame_end()
76 *data++ = vsp1_hgo_read(hgo, VI6_HGO_G_MAXMIN); in vsp1_hgo_frame_end()
77 *data++ = vsp1_hgo_read(hgo, VI6_HGO_B_MAXMIN); in vsp1_hgo_frame_end()
79 *data++ = vsp1_hgo_read(hgo, VI6_HGO_R_SUM); in vsp1_hgo_frame_end()
80 *data++ = vsp1_hgo_read(hgo, VI6_HGO_G_SUM); in vsp1_hgo_frame_end()
81 *data++ = vsp1_hgo_read(hgo, VI6_HGO_B_SUM); in vsp1_hgo_frame_end()
84 data[i] = vsp1_hgo_read(hgo, VI6_HGO_R_HISTO(i)); in vsp1_hgo_frame_end()
85 data[i+64] = vsp1_hgo_read(hgo, VI6_HGO_G_HISTO(i)); in vsp1_hgo_frame_end()
86 data[i+128] = vsp1_hgo_read(hgo, VI6_HGO_B_HISTO(i)); in vsp1_hgo_frame_end()
92 vsp1_histogram_buffer_complete(&hgo->histo, buf, size); in vsp1_hgo_frame_end()
137 struct vsp1_hgo *hgo = to_hgo(&entity->subdev); in hgo_configure_stream() local
149 vsp1_hgo_write(hgo, dlb, VI6_HGO_REGRST, VI6_HGO_REGRST_RCLEA); in hgo_configure_stream()
151 vsp1_hgo_write(hgo, dlb, VI6_HGO_OFFSET, in hgo_configure_stream()
154 vsp1_hgo_write(hgo, dlb, VI6_HGO_SIZE, in hgo_configure_stream()
158 mutex_lock(hgo->ctrls.handler.lock); in hgo_configure_stream()
159 hgo->max_rgb = hgo->ctrls.max_rgb->cur.val; in hgo_configure_stream()
160 if (hgo->ctrls.num_bins) in hgo_configure_stream()
161 hgo->num_bins = hgo_num_bins[hgo->ctrls.num_bins->cur.val]; in hgo_configure_stream()
162 mutex_unlock(hgo->ctrls.handler.lock); in hgo_configure_stream()
166 vsp1_hgo_write(hgo, dlb, VI6_HGO_MODE, in hgo_configure_stream()
167 (hgo->num_bins == 256 ? VI6_HGO_MODE_STEP : 0) | in hgo_configure_stream()
168 (hgo->max_rgb ? VI6_HGO_MODE_MAXRGB : 0) | in hgo_configure_stream()
190 struct vsp1_hgo *hgo; in vsp1_hgo_create() local
193 hgo = devm_kzalloc(vsp1->dev, sizeof(*hgo), GFP_KERNEL); in vsp1_hgo_create()
194 if (hgo == NULL) in vsp1_hgo_create()
198 v4l2_ctrl_handler_init(&hgo->ctrls.handler, in vsp1_hgo_create()
200 hgo->ctrls.max_rgb = v4l2_ctrl_new_custom(&hgo->ctrls.handler, in vsp1_hgo_create()
203 hgo->ctrls.num_bins = in vsp1_hgo_create()
204 v4l2_ctrl_new_custom(&hgo->ctrls.handler, in vsp1_hgo_create()
207 hgo->max_rgb = false; in vsp1_hgo_create()
208 hgo->num_bins = 64; in vsp1_hgo_create()
210 hgo->histo.entity.subdev.ctrl_handler = &hgo->ctrls.handler; in vsp1_hgo_create()
213 ret = vsp1_histogram_init(vsp1, &hgo->histo, VSP1_ENTITY_HGO, "hgo", in vsp1_hgo_create()
218 vsp1_entity_destroy(&hgo->histo.entity); in vsp1_hgo_create()
222 return hgo; in vsp1_hgo_create()