Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: vimc: expand the names of vimc entity types

When introducing the lens controller, it became apparent that the vimc
entity type names were hard to understand, e.g. vimc_len_type refers to the
lens. The names of the vimc entity types have been expanded to make the
code easier to understand. There is no functional change intended.

Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Daniel Oakley and committed by
Mauro Carvalho Chehab
ec917d77 d534b952

+652 -648
+135 -135
drivers/media/test-drivers/vimc/vimc-capture.c
··· 13 13 #include "vimc-common.h" 14 14 #include "vimc-streamer.h" 15 15 16 - struct vimc_cap_device { 16 + struct vimc_capture_device { 17 17 struct vimc_ent_device ved; 18 18 struct video_device vdev; 19 19 struct v4l2_pix_format format; ··· 41 41 .colorspace = V4L2_COLORSPACE_SRGB, 42 42 }; 43 43 44 - struct vimc_cap_buffer { 44 + struct vimc_capture_buffer { 45 45 /* 46 46 * struct vb2_v4l2_buffer must be the first element 47 47 * the videobuf2 framework will allocate this struct based on ··· 52 52 struct list_head list; 53 53 }; 54 54 55 - static int vimc_cap_querycap(struct file *file, void *priv, 55 + static int vimc_capture_querycap(struct file *file, void *priv, 56 56 struct v4l2_capability *cap) 57 57 { 58 58 strscpy(cap->driver, VIMC_PDEV_NAME, sizeof(cap->driver)); ··· 63 63 return 0; 64 64 } 65 65 66 - static void vimc_cap_get_format(struct vimc_ent_device *ved, 66 + static void vimc_capture_get_format(struct vimc_ent_device *ved, 67 67 struct v4l2_pix_format *fmt) 68 68 { 69 - struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, 69 + struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device, 70 70 ved); 71 71 72 - *fmt = vcap->format; 72 + *fmt = vcapture->format; 73 73 } 74 74 75 - static int vimc_cap_g_fmt_vid_cap(struct file *file, void *priv, 75 + static int vimc_capture_g_fmt_vid_cap(struct file *file, void *priv, 76 76 struct v4l2_format *f) 77 77 { 78 - struct vimc_cap_device *vcap = video_drvdata(file); 78 + struct vimc_capture_device *vcapture = video_drvdata(file); 79 79 80 - f->fmt.pix = vcap->format; 80 + f->fmt.pix = vcapture->format; 81 81 82 82 return 0; 83 83 } 84 84 85 - static int vimc_cap_try_fmt_vid_cap(struct file *file, void *priv, 85 + static int vimc_capture_try_fmt_vid_cap(struct file *file, void *priv, 86 86 struct v4l2_format *f) 87 87 { 88 88 struct v4l2_pix_format *format = &f->fmt.pix; ··· 114 114 return 0; 115 115 } 116 116 117 - static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv, 117 + static int vimc_capture_s_fmt_vid_cap(struct file *file, void *priv, 118 118 struct v4l2_format *f) 119 119 { 120 - struct vimc_cap_device *vcap = video_drvdata(file); 120 + struct vimc_capture_device *vcapture = video_drvdata(file); 121 121 int ret; 122 122 123 123 /* Do not change the format while stream is on */ 124 - if (vb2_is_busy(&vcap->queue)) 124 + if (vb2_is_busy(&vcapture->queue)) 125 125 return -EBUSY; 126 126 127 - ret = vimc_cap_try_fmt_vid_cap(file, priv, f); 127 + ret = vimc_capture_try_fmt_vid_cap(file, priv, f); 128 128 if (ret) 129 129 return ret; 130 130 131 - dev_dbg(vcap->ved.dev, "%s: format update: " 131 + dev_dbg(vcapture->ved.dev, "%s: format update: " 132 132 "old:%dx%d (0x%x, %d, %d, %d, %d) " 133 - "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcap->vdev.name, 133 + "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcapture->vdev.name, 134 134 /* old */ 135 - vcap->format.width, vcap->format.height, 136 - vcap->format.pixelformat, vcap->format.colorspace, 137 - vcap->format.quantization, vcap->format.xfer_func, 138 - vcap->format.ycbcr_enc, 135 + vcapture->format.width, vcapture->format.height, 136 + vcapture->format.pixelformat, vcapture->format.colorspace, 137 + vcapture->format.quantization, vcapture->format.xfer_func, 138 + vcapture->format.ycbcr_enc, 139 139 /* new */ 140 140 f->fmt.pix.width, f->fmt.pix.height, 141 141 f->fmt.pix.pixelformat, f->fmt.pix.colorspace, 142 142 f->fmt.pix.quantization, f->fmt.pix.xfer_func, 143 143 f->fmt.pix.ycbcr_enc); 144 144 145 - vcap->format = f->fmt.pix; 145 + vcapture->format = f->fmt.pix; 146 146 147 147 return 0; 148 148 } 149 149 150 - static int vimc_cap_enum_fmt_vid_cap(struct file *file, void *priv, 150 + static int vimc_capture_enum_fmt_vid_cap(struct file *file, void *priv, 151 151 struct v4l2_fmtdesc *f) 152 152 { 153 153 const struct vimc_pix_map *vpix; ··· 169 169 return 0; 170 170 } 171 171 172 - static int vimc_cap_enum_framesizes(struct file *file, void *fh, 172 + static int vimc_capture_enum_framesizes(struct file *file, void *fh, 173 173 struct v4l2_frmsizeenum *fsize) 174 174 { 175 175 const struct vimc_pix_map *vpix; ··· 193 193 return 0; 194 194 } 195 195 196 - static const struct v4l2_file_operations vimc_cap_fops = { 196 + static const struct v4l2_file_operations vimc_capture_fops = { 197 197 .owner = THIS_MODULE, 198 198 .open = v4l2_fh_open, 199 199 .release = vb2_fop_release, ··· 203 203 .mmap = vb2_fop_mmap, 204 204 }; 205 205 206 - static const struct v4l2_ioctl_ops vimc_cap_ioctl_ops = { 207 - .vidioc_querycap = vimc_cap_querycap, 206 + static const struct v4l2_ioctl_ops vimc_capture_ioctl_ops = { 207 + .vidioc_querycap = vimc_capture_querycap, 208 208 209 - .vidioc_g_fmt_vid_cap = vimc_cap_g_fmt_vid_cap, 210 - .vidioc_s_fmt_vid_cap = vimc_cap_s_fmt_vid_cap, 211 - .vidioc_try_fmt_vid_cap = vimc_cap_try_fmt_vid_cap, 212 - .vidioc_enum_fmt_vid_cap = vimc_cap_enum_fmt_vid_cap, 213 - .vidioc_enum_framesizes = vimc_cap_enum_framesizes, 209 + .vidioc_g_fmt_vid_cap = vimc_capture_g_fmt_vid_cap, 210 + .vidioc_s_fmt_vid_cap = vimc_capture_s_fmt_vid_cap, 211 + .vidioc_try_fmt_vid_cap = vimc_capture_try_fmt_vid_cap, 212 + .vidioc_enum_fmt_vid_cap = vimc_capture_enum_fmt_vid_cap, 213 + .vidioc_enum_framesizes = vimc_capture_enum_framesizes, 214 214 215 215 .vidioc_reqbufs = vb2_ioctl_reqbufs, 216 216 .vidioc_create_bufs = vb2_ioctl_create_bufs, ··· 223 223 .vidioc_streamoff = vb2_ioctl_streamoff, 224 224 }; 225 225 226 - static void vimc_cap_return_all_buffers(struct vimc_cap_device *vcap, 226 + static void vimc_capture_return_all_buffers(struct vimc_capture_device *vcapture, 227 227 enum vb2_buffer_state state) 228 228 { 229 - struct vimc_cap_buffer *vbuf, *node; 229 + struct vimc_capture_buffer *vbuf, *node; 230 230 231 - spin_lock(&vcap->qlock); 231 + spin_lock(&vcapture->qlock); 232 232 233 - list_for_each_entry_safe(vbuf, node, &vcap->buf_list, list) { 233 + list_for_each_entry_safe(vbuf, node, &vcapture->buf_list, list) { 234 234 list_del(&vbuf->list); 235 235 vb2_buffer_done(&vbuf->vb2.vb2_buf, state); 236 236 } 237 237 238 - spin_unlock(&vcap->qlock); 238 + spin_unlock(&vcapture->qlock); 239 239 } 240 240 241 - static int vimc_cap_start_streaming(struct vb2_queue *vq, unsigned int count) 241 + static int vimc_capture_start_streaming(struct vb2_queue *vq, unsigned int count) 242 242 { 243 - struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); 244 - struct media_entity *entity = &vcap->vdev.entity; 243 + struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); 244 + struct media_entity *entity = &vcapture->vdev.entity; 245 245 int ret; 246 246 247 - vcap->sequence = 0; 247 + vcapture->sequence = 0; 248 248 249 249 /* Start the media pipeline */ 250 - ret = media_pipeline_start(entity, &vcap->stream.pipe); 250 + ret = media_pipeline_start(entity, &vcapture->stream.pipe); 251 251 if (ret) { 252 - vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); 252 + vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); 253 253 return ret; 254 254 } 255 255 256 - ret = vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 1); 256 + ret = vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 1); 257 257 if (ret) { 258 258 media_pipeline_stop(entity); 259 - vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_QUEUED); 259 + vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); 260 260 return ret; 261 261 } 262 262 ··· 267 267 * Stop the stream engine. Any remaining buffers in the stream queue are 268 268 * dequeued and passed on to the vb2 framework marked as STATE_ERROR. 269 269 */ 270 - static void vimc_cap_stop_streaming(struct vb2_queue *vq) 270 + static void vimc_capture_stop_streaming(struct vb2_queue *vq) 271 271 { 272 - struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); 272 + struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); 273 273 274 - vimc_streamer_s_stream(&vcap->stream, &vcap->ved, 0); 274 + vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 0); 275 275 276 276 /* Stop the media pipeline */ 277 - media_pipeline_stop(&vcap->vdev.entity); 277 + media_pipeline_stop(&vcapture->vdev.entity); 278 278 279 279 /* Release all active buffers */ 280 - vimc_cap_return_all_buffers(vcap, VB2_BUF_STATE_ERROR); 280 + vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_ERROR); 281 281 } 282 282 283 - static void vimc_cap_buf_queue(struct vb2_buffer *vb2_buf) 283 + static void vimc_capture_buf_queue(struct vb2_buffer *vb2_buf) 284 284 { 285 - struct vimc_cap_device *vcap = vb2_get_drv_priv(vb2_buf->vb2_queue); 286 - struct vimc_cap_buffer *buf = container_of(vb2_buf, 287 - struct vimc_cap_buffer, 285 + struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb2_buf->vb2_queue); 286 + struct vimc_capture_buffer *buf = container_of(vb2_buf, 287 + struct vimc_capture_buffer, 288 288 vb2.vb2_buf); 289 289 290 - spin_lock(&vcap->qlock); 291 - list_add_tail(&buf->list, &vcap->buf_list); 292 - spin_unlock(&vcap->qlock); 290 + spin_lock(&vcapture->qlock); 291 + list_add_tail(&buf->list, &vcapture->buf_list); 292 + spin_unlock(&vcapture->qlock); 293 293 } 294 294 295 - static int vimc_cap_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, 295 + static int vimc_capture_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, 296 296 unsigned int *nplanes, unsigned int sizes[], 297 297 struct device *alloc_devs[]) 298 298 { 299 - struct vimc_cap_device *vcap = vb2_get_drv_priv(vq); 299 + struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); 300 300 301 301 if (*nplanes) 302 - return sizes[0] < vcap->format.sizeimage ? -EINVAL : 0; 302 + return sizes[0] < vcapture->format.sizeimage ? -EINVAL : 0; 303 303 /* We don't support multiplanes for now */ 304 304 *nplanes = 1; 305 - sizes[0] = vcap->format.sizeimage; 305 + sizes[0] = vcapture->format.sizeimage; 306 306 307 307 return 0; 308 308 } 309 309 310 - static int vimc_cap_buffer_prepare(struct vb2_buffer *vb) 310 + static int vimc_capture_buffer_prepare(struct vb2_buffer *vb) 311 311 { 312 - struct vimc_cap_device *vcap = vb2_get_drv_priv(vb->vb2_queue); 313 - unsigned long size = vcap->format.sizeimage; 312 + struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb->vb2_queue); 313 + unsigned long size = vcapture->format.sizeimage; 314 314 315 315 if (vb2_plane_size(vb, 0) < size) { 316 - dev_err(vcap->ved.dev, "%s: buffer too small (%lu < %lu)\n", 317 - vcap->vdev.name, vb2_plane_size(vb, 0), size); 316 + dev_err(vcapture->ved.dev, "%s: buffer too small (%lu < %lu)\n", 317 + vcapture->vdev.name, vb2_plane_size(vb, 0), size); 318 318 return -EINVAL; 319 319 } 320 320 return 0; 321 321 } 322 322 323 - static const struct vb2_ops vimc_cap_qops = { 324 - .start_streaming = vimc_cap_start_streaming, 325 - .stop_streaming = vimc_cap_stop_streaming, 326 - .buf_queue = vimc_cap_buf_queue, 327 - .queue_setup = vimc_cap_queue_setup, 328 - .buf_prepare = vimc_cap_buffer_prepare, 323 + static const struct vb2_ops vimc_capture_qops = { 324 + .start_streaming = vimc_capture_start_streaming, 325 + .stop_streaming = vimc_capture_stop_streaming, 326 + .buf_queue = vimc_capture_buf_queue, 327 + .queue_setup = vimc_capture_queue_setup, 328 + .buf_prepare = vimc_capture_buffer_prepare, 329 329 /* 330 330 * Since q->lock is set we can use the standard 331 331 * vb2_ops_wait_prepare/finish helper functions. ··· 334 334 .wait_finish = vb2_ops_wait_finish, 335 335 }; 336 336 337 - static const struct media_entity_operations vimc_cap_mops = { 337 + static const struct media_entity_operations vimc_capture_mops = { 338 338 .link_validate = vimc_vdev_link_validate, 339 339 }; 340 340 341 - static void vimc_cap_release(struct vimc_ent_device *ved) 341 + static void vimc_capture_release(struct vimc_ent_device *ved) 342 342 { 343 - struct vimc_cap_device *vcap = 344 - container_of(ved, struct vimc_cap_device, ved); 343 + struct vimc_capture_device *vcapture = 344 + container_of(ved, struct vimc_capture_device, ved); 345 345 346 - media_entity_cleanup(vcap->ved.ent); 347 - kfree(vcap); 346 + media_entity_cleanup(vcapture->ved.ent); 347 + kfree(vcapture); 348 348 } 349 349 350 - static void vimc_cap_unregister(struct vimc_ent_device *ved) 350 + static void vimc_capture_unregister(struct vimc_ent_device *ved) 351 351 { 352 - struct vimc_cap_device *vcap = 353 - container_of(ved, struct vimc_cap_device, ved); 352 + struct vimc_capture_device *vcapture = 353 + container_of(ved, struct vimc_capture_device, ved); 354 354 355 - vb2_video_unregister_device(&vcap->vdev); 355 + vb2_video_unregister_device(&vcapture->vdev); 356 356 } 357 357 358 - static void *vimc_cap_process_frame(struct vimc_ent_device *ved, 358 + static void *vimc_capture_process_frame(struct vimc_ent_device *ved, 359 359 const void *frame) 360 360 { 361 - struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, 361 + struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device, 362 362 ved); 363 - struct vimc_cap_buffer *vimc_buf; 363 + struct vimc_capture_buffer *vimc_buf; 364 364 void *vbuf; 365 365 366 - spin_lock(&vcap->qlock); 366 + spin_lock(&vcapture->qlock); 367 367 368 368 /* Get the first entry of the list */ 369 - vimc_buf = list_first_entry_or_null(&vcap->buf_list, 369 + vimc_buf = list_first_entry_or_null(&vcapture->buf_list, 370 370 typeof(*vimc_buf), list); 371 371 if (!vimc_buf) { 372 - spin_unlock(&vcap->qlock); 372 + spin_unlock(&vcapture->qlock); 373 373 return ERR_PTR(-EAGAIN); 374 374 } 375 375 376 376 /* Remove this entry from the list */ 377 377 list_del(&vimc_buf->list); 378 378 379 - spin_unlock(&vcap->qlock); 379 + spin_unlock(&vcapture->qlock); 380 380 381 381 /* Fill the buffer */ 382 382 vimc_buf->vb2.vb2_buf.timestamp = ktime_get_ns(); 383 - vimc_buf->vb2.sequence = vcap->sequence++; 384 - vimc_buf->vb2.field = vcap->format.field; 383 + vimc_buf->vb2.sequence = vcapture->sequence++; 384 + vimc_buf->vb2.field = vcapture->format.field; 385 385 386 386 vbuf = vb2_plane_vaddr(&vimc_buf->vb2.vb2_buf, 0); 387 387 388 - memcpy(vbuf, frame, vcap->format.sizeimage); 388 + memcpy(vbuf, frame, vcapture->format.sizeimage); 389 389 390 390 /* Set it as ready */ 391 391 vb2_set_plane_payload(&vimc_buf->vb2.vb2_buf, 0, 392 - vcap->format.sizeimage); 392 + vcapture->format.sizeimage); 393 393 vb2_buffer_done(&vimc_buf->vb2.vb2_buf, VB2_BUF_STATE_DONE); 394 394 return NULL; 395 395 } 396 396 397 - static struct vimc_ent_device *vimc_cap_add(struct vimc_device *vimc, 397 + static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc, 398 398 const char *vcfg_name) 399 399 { 400 400 struct v4l2_device *v4l2_dev = &vimc->v4l2_dev; 401 401 const struct vimc_pix_map *vpix; 402 - struct vimc_cap_device *vcap; 402 + struct vimc_capture_device *vcapture; 403 403 struct video_device *vdev; 404 404 struct vb2_queue *q; 405 405 int ret; 406 406 407 - /* Allocate the vimc_cap_device struct */ 408 - vcap = kzalloc(sizeof(*vcap), GFP_KERNEL); 409 - if (!vcap) 407 + /* Allocate the vimc_capture_device struct */ 408 + vcapture = kzalloc(sizeof(*vcapture), GFP_KERNEL); 409 + if (!vcapture) 410 410 return ERR_PTR(-ENOMEM); 411 411 412 412 /* Initialize the media entity */ 413 - vcap->vdev.entity.name = vcfg_name; 414 - vcap->vdev.entity.function = MEDIA_ENT_F_IO_V4L; 415 - vcap->pad.flags = MEDIA_PAD_FL_SINK; 416 - ret = media_entity_pads_init(&vcap->vdev.entity, 417 - 1, &vcap->pad); 413 + vcapture->vdev.entity.name = vcfg_name; 414 + vcapture->vdev.entity.function = MEDIA_ENT_F_IO_V4L; 415 + vcapture->pad.flags = MEDIA_PAD_FL_SINK; 416 + ret = media_entity_pads_init(&vcapture->vdev.entity, 417 + 1, &vcapture->pad); 418 418 if (ret) 419 - goto err_free_vcap; 419 + goto err_free_vcapture; 420 420 421 421 /* Initialize the lock */ 422 - mutex_init(&vcap->lock); 422 + mutex_init(&vcapture->lock); 423 423 424 424 /* Initialize the vb2 queue */ 425 - q = &vcap->queue; 425 + q = &vcapture->queue; 426 426 q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 427 427 q->io_modes = VB2_MMAP | VB2_DMABUF; 428 428 if (vimc_allocator == VIMC_ALLOCATOR_VMALLOC) 429 429 q->io_modes |= VB2_USERPTR; 430 - q->drv_priv = vcap; 431 - q->buf_struct_size = sizeof(struct vimc_cap_buffer); 432 - q->ops = &vimc_cap_qops; 430 + q->drv_priv = vcapture; 431 + q->buf_struct_size = sizeof(struct vimc_capture_buffer); 432 + q->ops = &vimc_capture_qops; 433 433 q->mem_ops = vimc_allocator == VIMC_ALLOCATOR_DMA_CONTIG 434 434 ? &vb2_dma_contig_memops : &vb2_vmalloc_memops; 435 435 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 436 436 q->min_buffers_needed = 2; 437 - q->lock = &vcap->lock; 437 + q->lock = &vcapture->lock; 438 438 q->dev = v4l2_dev->dev; 439 439 440 440 ret = vb2_queue_init(q); ··· 445 445 } 446 446 447 447 /* Initialize buffer list and its lock */ 448 - INIT_LIST_HEAD(&vcap->buf_list); 449 - spin_lock_init(&vcap->qlock); 448 + INIT_LIST_HEAD(&vcapture->buf_list); 449 + spin_lock_init(&vcapture->qlock); 450 450 451 451 /* Set default frame format */ 452 - vcap->format = fmt_default; 453 - vpix = vimc_pix_map_by_pixelformat(vcap->format.pixelformat); 454 - vcap->format.bytesperline = vcap->format.width * vpix->bpp; 455 - vcap->format.sizeimage = vcap->format.bytesperline * 456 - vcap->format.height; 452 + vcapture->format = fmt_default; 453 + vpix = vimc_pix_map_by_pixelformat(vcapture->format.pixelformat); 454 + vcapture->format.bytesperline = vcapture->format.width * vpix->bpp; 455 + vcapture->format.sizeimage = vcapture->format.bytesperline * 456 + vcapture->format.height; 457 457 458 458 /* Fill the vimc_ent_device struct */ 459 - vcap->ved.ent = &vcap->vdev.entity; 460 - vcap->ved.process_frame = vimc_cap_process_frame; 461 - vcap->ved.vdev_get_format = vimc_cap_get_format; 462 - vcap->ved.dev = vimc->mdev.dev; 459 + vcapture->ved.ent = &vcapture->vdev.entity; 460 + vcapture->ved.process_frame = vimc_capture_process_frame; 461 + vcapture->ved.vdev_get_format = vimc_capture_get_format; 462 + vcapture->ved.dev = vimc->mdev.dev; 463 463 464 464 /* Initialize the video_device struct */ 465 - vdev = &vcap->vdev; 465 + vdev = &vcapture->vdev; 466 466 vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING 467 467 | V4L2_CAP_IO_MC; 468 - vdev->entity.ops = &vimc_cap_mops; 468 + vdev->entity.ops = &vimc_capture_mops; 469 469 vdev->release = video_device_release_empty; 470 - vdev->fops = &vimc_cap_fops; 471 - vdev->ioctl_ops = &vimc_cap_ioctl_ops; 472 - vdev->lock = &vcap->lock; 470 + vdev->fops = &vimc_capture_fops; 471 + vdev->ioctl_ops = &vimc_capture_ioctl_ops; 472 + vdev->lock = &vcapture->lock; 473 473 vdev->queue = q; 474 474 vdev->v4l2_dev = v4l2_dev; 475 475 vdev->vfl_dir = VFL_DIR_RX; 476 476 strscpy(vdev->name, vcfg_name, sizeof(vdev->name)); 477 - video_set_drvdata(vdev, &vcap->ved); 477 + video_set_drvdata(vdev, &vcapture->ved); 478 478 479 479 /* Register the video_device with the v4l2 and the media framework */ 480 480 ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); 481 481 if (ret) { 482 482 dev_err(vimc->mdev.dev, "%s: video register failed (err=%d)\n", 483 - vcap->vdev.name, ret); 483 + vcapture->vdev.name, ret); 484 484 goto err_clean_m_ent; 485 485 } 486 486 487 - return &vcap->ved; 487 + return &vcapture->ved; 488 488 489 489 err_clean_m_ent: 490 - media_entity_cleanup(&vcap->vdev.entity); 491 - err_free_vcap: 492 - kfree(vcap); 490 + media_entity_cleanup(&vcapture->vdev.entity); 491 + err_free_vcapture: 492 + kfree(vcapture); 493 493 494 494 return ERR_PTR(ret); 495 495 } 496 496 497 - struct vimc_ent_type vimc_cap_type = { 498 - .add = vimc_cap_add, 499 - .unregister = vimc_cap_unregister, 500 - .release = vimc_cap_release 497 + struct vimc_ent_type vimc_capture_type = { 498 + .add = vimc_capture_add, 499 + .unregister = vimc_capture_unregister, 500 + .release = vimc_capture_release 501 501 };
+5 -5
drivers/media/test-drivers/vimc/vimc-common.h
··· 167 167 */ 168 168 bool vimc_is_source(struct media_entity *ent); 169 169 170 - extern struct vimc_ent_type vimc_sen_type; 171 - extern struct vimc_ent_type vimc_deb_type; 172 - extern struct vimc_ent_type vimc_sca_type; 173 - extern struct vimc_ent_type vimc_cap_type; 174 - extern struct vimc_ent_type vimc_len_type; 170 + extern struct vimc_ent_type vimc_sensor_type; 171 + extern struct vimc_ent_type vimc_debayer_type; 172 + extern struct vimc_ent_type vimc_scaler_type; 173 + extern struct vimc_ent_type vimc_capture_type; 174 + extern struct vimc_ent_type vimc_lens_type; 175 175 176 176 /** 177 177 * vimc_pix_map_by_index - get vimc_pix_map struct by its index
+11 -11
drivers/media/test-drivers/vimc/vimc-core.c
··· 69 69 static struct vimc_ent_config ent_config[] = { 70 70 { 71 71 .name = "Sensor A", 72 - .type = &vimc_sen_type 72 + .type = &vimc_sensor_type 73 73 }, 74 74 { 75 75 .name = "Sensor B", 76 - .type = &vimc_sen_type 76 + .type = &vimc_sensor_type 77 77 }, 78 78 { 79 79 .name = "Debayer A", 80 - .type = &vimc_deb_type 80 + .type = &vimc_debayer_type 81 81 }, 82 82 { 83 83 .name = "Debayer B", 84 - .type = &vimc_deb_type 84 + .type = &vimc_debayer_type 85 85 }, 86 86 { 87 87 .name = "Raw Capture 0", 88 - .type = &vimc_cap_type 88 + .type = &vimc_capture_type 89 89 }, 90 90 { 91 91 .name = "Raw Capture 1", 92 - .type = &vimc_cap_type 92 + .type = &vimc_capture_type 93 93 }, 94 94 { 95 95 /* TODO: change this to vimc-input when it is implemented */ 96 96 .name = "RGB/YUV Input", 97 - .type = &vimc_sen_type 97 + .type = &vimc_sensor_type 98 98 }, 99 99 { 100 100 .name = "Scaler", 101 - .type = &vimc_sca_type 101 + .type = &vimc_scaler_type 102 102 }, 103 103 { 104 104 .name = "RGB/YUV Capture", 105 - .type = &vimc_cap_type 105 + .type = &vimc_capture_type 106 106 }, 107 107 { 108 108 .name = "Lens A", 109 - .type = &vimc_len_type 109 + .type = &vimc_lens_type 110 110 }, 111 111 { 112 112 .name = "Lens B", 113 - .type = &vimc_len_type 113 + .type = &vimc_lens_type 114 114 }, 115 115 }; 116 116
+198 -195
drivers/media/test-drivers/vimc/vimc-debayer.c
··· 15 15 16 16 #include "vimc-common.h" 17 17 18 - enum vimc_deb_rgb_colors { 19 - VIMC_DEB_RED = 0, 20 - VIMC_DEB_GREEN = 1, 21 - VIMC_DEB_BLUE = 2, 18 + enum vimc_debayer_rgb_colors { 19 + VIMC_DEBAYER_RED = 0, 20 + VIMC_DEBAYER_GREEN = 1, 21 + VIMC_DEBAYER_BLUE = 2, 22 22 }; 23 23 24 - struct vimc_deb_pix_map { 24 + struct vimc_debayer_pix_map { 25 25 u32 code; 26 - enum vimc_deb_rgb_colors order[2][2]; 26 + enum vimc_debayer_rgb_colors order[2][2]; 27 27 }; 28 28 29 - struct vimc_deb_device { 29 + struct vimc_debayer_device { 30 30 struct vimc_ent_device ved; 31 31 struct v4l2_subdev sd; 32 32 /* The active format */ 33 33 struct v4l2_mbus_framefmt sink_fmt; 34 34 u32 src_code; 35 - void (*set_rgb_src)(struct vimc_deb_device *vdeb, unsigned int lin, 36 - unsigned int col, unsigned int rgb[3]); 35 + void (*set_rgb_src)(struct vimc_debayer_device *vdebayer, 36 + unsigned int lin, unsigned int col, 37 + unsigned int rgb[3]); 37 38 /* Values calculated when the stream starts */ 38 39 u8 *src_frame; 39 - const struct vimc_deb_pix_map *sink_pix_map; 40 + const struct vimc_debayer_pix_map *sink_pix_map; 40 41 unsigned int sink_bpp; 41 42 unsigned int mean_win_size; 42 43 struct v4l2_ctrl_handler hdl; ··· 52 51 .colorspace = V4L2_COLORSPACE_SRGB, 53 52 }; 54 53 55 - static const u32 vimc_deb_src_mbus_codes[] = { 54 + static const u32 vimc_debayer_src_mbus_codes[] = { 56 55 MEDIA_BUS_FMT_GBR888_1X24, 57 56 MEDIA_BUS_FMT_BGR888_1X24, 58 57 MEDIA_BUS_FMT_BGR888_3X8, ··· 65 64 MEDIA_BUS_FMT_RGB888_1X32_PADHI, 66 65 }; 67 66 68 - static const struct vimc_deb_pix_map vimc_deb_pix_map_list[] = { 67 + static const struct vimc_debayer_pix_map vimc_debayer_pix_map_list[] = { 69 68 { 70 69 .code = MEDIA_BUS_FMT_SBGGR8_1X8, 71 - .order = { { VIMC_DEB_BLUE, VIMC_DEB_GREEN }, 72 - { VIMC_DEB_GREEN, VIMC_DEB_RED } } 70 + .order = { { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN }, 71 + { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED } } 73 72 }, 74 73 { 75 74 .code = MEDIA_BUS_FMT_SGBRG8_1X8, 76 - .order = { { VIMC_DEB_GREEN, VIMC_DEB_BLUE }, 77 - { VIMC_DEB_RED, VIMC_DEB_GREEN } } 75 + .order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE }, 76 + { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN } } 78 77 }, 79 78 { 80 79 .code = MEDIA_BUS_FMT_SGRBG8_1X8, 81 - .order = { { VIMC_DEB_GREEN, VIMC_DEB_RED }, 82 - { VIMC_DEB_BLUE, VIMC_DEB_GREEN } } 80 + .order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED }, 81 + { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN } } 83 82 }, 84 83 { 85 84 .code = MEDIA_BUS_FMT_SRGGB8_1X8, 86 - .order = { { VIMC_DEB_RED, VIMC_DEB_GREEN }, 87 - { VIMC_DEB_GREEN, VIMC_DEB_BLUE } } 85 + .order = { { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN }, 86 + { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE } } 88 87 }, 89 88 { 90 89 .code = MEDIA_BUS_FMT_SBGGR10_1X10, 91 - .order = { { VIMC_DEB_BLUE, VIMC_DEB_GREEN }, 92 - { VIMC_DEB_GREEN, VIMC_DEB_RED } } 90 + .order = { { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN }, 91 + { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED } } 93 92 }, 94 93 { 95 94 .code = MEDIA_BUS_FMT_SGBRG10_1X10, 96 - .order = { { VIMC_DEB_GREEN, VIMC_DEB_BLUE }, 97 - { VIMC_DEB_RED, VIMC_DEB_GREEN } } 95 + .order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE }, 96 + { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN } } 98 97 }, 99 98 { 100 99 .code = MEDIA_BUS_FMT_SGRBG10_1X10, 101 - .order = { { VIMC_DEB_GREEN, VIMC_DEB_RED }, 102 - { VIMC_DEB_BLUE, VIMC_DEB_GREEN } } 100 + .order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED }, 101 + { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN } } 103 102 }, 104 103 { 105 104 .code = MEDIA_BUS_FMT_SRGGB10_1X10, 106 - .order = { { VIMC_DEB_RED, VIMC_DEB_GREEN }, 107 - { VIMC_DEB_GREEN, VIMC_DEB_BLUE } } 105 + .order = { { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN }, 106 + { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE } } 108 107 }, 109 108 { 110 109 .code = MEDIA_BUS_FMT_SBGGR12_1X12, 111 - .order = { { VIMC_DEB_BLUE, VIMC_DEB_GREEN }, 112 - { VIMC_DEB_GREEN, VIMC_DEB_RED } } 110 + .order = { { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN }, 111 + { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED } } 113 112 }, 114 113 { 115 114 .code = MEDIA_BUS_FMT_SGBRG12_1X12, 116 - .order = { { VIMC_DEB_GREEN, VIMC_DEB_BLUE }, 117 - { VIMC_DEB_RED, VIMC_DEB_GREEN } } 115 + .order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE }, 116 + { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN } } 118 117 }, 119 118 { 120 119 .code = MEDIA_BUS_FMT_SGRBG12_1X12, 121 - .order = { { VIMC_DEB_GREEN, VIMC_DEB_RED }, 122 - { VIMC_DEB_BLUE, VIMC_DEB_GREEN } } 120 + .order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED }, 121 + { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN } } 123 122 }, 124 123 { 125 124 .code = MEDIA_BUS_FMT_SRGGB12_1X12, 126 - .order = { { VIMC_DEB_RED, VIMC_DEB_GREEN }, 127 - { VIMC_DEB_GREEN, VIMC_DEB_BLUE } } 125 + .order = { { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN }, 126 + { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE } } 128 127 }, 129 128 }; 130 129 131 - static const struct vimc_deb_pix_map *vimc_deb_pix_map_by_code(u32 code) 130 + static const struct vimc_debayer_pix_map *vimc_debayer_pix_map_by_code(u32 code) 132 131 { 133 132 unsigned int i; 134 133 135 - for (i = 0; i < ARRAY_SIZE(vimc_deb_pix_map_list); i++) 136 - if (vimc_deb_pix_map_list[i].code == code) 137 - return &vimc_deb_pix_map_list[i]; 134 + for (i = 0; i < ARRAY_SIZE(vimc_debayer_pix_map_list); i++) 135 + if (vimc_debayer_pix_map_list[i].code == code) 136 + return &vimc_debayer_pix_map_list[i]; 138 137 139 138 return NULL; 140 139 } 141 140 142 - static bool vimc_deb_src_code_is_valid(u32 code) 141 + static bool vimc_debayer_src_code_is_valid(u32 code) 143 142 { 144 143 unsigned int i; 145 144 146 - for (i = 0; i < ARRAY_SIZE(vimc_deb_src_mbus_codes); i++) 147 - if (vimc_deb_src_mbus_codes[i] == code) 145 + for (i = 0; i < ARRAY_SIZE(vimc_debayer_src_mbus_codes); i++) 146 + if (vimc_debayer_src_mbus_codes[i] == code) 148 147 return true; 149 148 150 149 return false; 151 150 } 152 151 153 - static int vimc_deb_init_cfg(struct v4l2_subdev *sd, 154 - struct v4l2_subdev_state *sd_state) 152 + static int vimc_debayer_init_cfg(struct v4l2_subdev *sd, 153 + struct v4l2_subdev_state *sd_state) 155 154 { 156 - struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); 155 + struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); 157 156 struct v4l2_mbus_framefmt *mf; 158 157 unsigned int i; 159 158 ··· 163 162 for (i = 1; i < sd->entity.num_pads; i++) { 164 163 mf = v4l2_subdev_get_try_format(sd, sd_state, i); 165 164 *mf = sink_fmt_default; 166 - mf->code = vdeb->src_code; 165 + mf->code = vdebayer->src_code; 167 166 } 168 167 169 168 return 0; 170 169 } 171 170 172 - static int vimc_deb_enum_mbus_code(struct v4l2_subdev *sd, 173 - struct v4l2_subdev_state *sd_state, 174 - struct v4l2_subdev_mbus_code_enum *code) 171 + static int vimc_debayer_enum_mbus_code(struct v4l2_subdev *sd, 172 + struct v4l2_subdev_state *sd_state, 173 + struct v4l2_subdev_mbus_code_enum *code) 175 174 { 176 175 if (VIMC_IS_SRC(code->pad)) { 177 - if (code->index >= ARRAY_SIZE(vimc_deb_src_mbus_codes)) 176 + if (code->index >= ARRAY_SIZE(vimc_debayer_src_mbus_codes)) 178 177 return -EINVAL; 179 178 180 - code->code = vimc_deb_src_mbus_codes[code->index]; 179 + code->code = vimc_debayer_src_mbus_codes[code->index]; 181 180 } else { 182 - if (code->index >= ARRAY_SIZE(vimc_deb_pix_map_list)) 181 + if (code->index >= ARRAY_SIZE(vimc_debayer_pix_map_list)) 183 182 return -EINVAL; 184 183 185 - code->code = vimc_deb_pix_map_list[code->index].code; 184 + code->code = vimc_debayer_pix_map_list[code->index].code; 186 185 } 187 186 188 187 return 0; 189 188 } 190 189 191 - static int vimc_deb_enum_frame_size(struct v4l2_subdev *sd, 192 - struct v4l2_subdev_state *sd_state, 193 - struct v4l2_subdev_frame_size_enum *fse) 190 + static int vimc_debayer_enum_frame_size(struct v4l2_subdev *sd, 191 + struct v4l2_subdev_state *sd_state, 192 + struct v4l2_subdev_frame_size_enum *fse) 194 193 { 195 194 if (fse->index) 196 195 return -EINVAL; 197 196 198 197 if (VIMC_IS_SINK(fse->pad)) { 199 - const struct vimc_deb_pix_map *vpix = 200 - vimc_deb_pix_map_by_code(fse->code); 198 + const struct vimc_debayer_pix_map *vpix = 199 + vimc_debayer_pix_map_by_code(fse->code); 201 200 202 201 if (!vpix) 203 202 return -EINVAL; 204 - } else if (!vimc_deb_src_code_is_valid(fse->code)) { 203 + } else if (!vimc_debayer_src_code_is_valid(fse->code)) { 205 204 return -EINVAL; 206 205 } 207 206 ··· 213 212 return 0; 214 213 } 215 214 216 - static int vimc_deb_get_fmt(struct v4l2_subdev *sd, 217 - struct v4l2_subdev_state *sd_state, 218 - struct v4l2_subdev_format *fmt) 215 + static int vimc_debayer_get_fmt(struct v4l2_subdev *sd, 216 + struct v4l2_subdev_state *sd_state, 217 + struct v4l2_subdev_format *fmt) 219 218 { 220 - struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); 219 + struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); 221 220 222 221 /* Get the current sink format */ 223 222 fmt->format = fmt->which == V4L2_SUBDEV_FORMAT_TRY ? 224 223 *v4l2_subdev_get_try_format(sd, sd_state, 0) : 225 - vdeb->sink_fmt; 224 + vdebayer->sink_fmt; 226 225 227 226 /* Set the right code for the source pad */ 228 227 if (VIMC_IS_SRC(fmt->pad)) 229 - fmt->format.code = vdeb->src_code; 228 + fmt->format.code = vdebayer->src_code; 230 229 231 230 return 0; 232 231 } 233 232 234 - static void vimc_deb_adjust_sink_fmt(struct v4l2_mbus_framefmt *fmt) 233 + static void vimc_debayer_adjust_sink_fmt(struct v4l2_mbus_framefmt *fmt) 235 234 { 236 - const struct vimc_deb_pix_map *vpix; 235 + const struct vimc_debayer_pix_map *vpix; 237 236 238 237 /* Don't accept a code that is not on the debayer table */ 239 - vpix = vimc_deb_pix_map_by_code(fmt->code); 238 + vpix = vimc_debayer_pix_map_by_code(fmt->code); 240 239 if (!vpix) 241 240 fmt->code = sink_fmt_default.code; 242 241 ··· 251 250 vimc_colorimetry_clamp(fmt); 252 251 } 253 252 254 - static int vimc_deb_set_fmt(struct v4l2_subdev *sd, 255 - struct v4l2_subdev_state *sd_state, 256 - struct v4l2_subdev_format *fmt) 253 + static int vimc_debayer_set_fmt(struct v4l2_subdev *sd, 254 + struct v4l2_subdev_state *sd_state, 255 + struct v4l2_subdev_format *fmt) 257 256 { 258 - struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); 257 + struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); 259 258 struct v4l2_mbus_framefmt *sink_fmt; 260 259 u32 *src_code; 261 260 262 261 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 263 262 /* Do not change the format while stream is on */ 264 - if (vdeb->src_frame) 263 + if (vdebayer->src_frame) 265 264 return -EBUSY; 266 265 267 - sink_fmt = &vdeb->sink_fmt; 268 - src_code = &vdeb->src_code; 266 + sink_fmt = &vdebayer->sink_fmt; 267 + src_code = &vdebayer->src_code; 269 268 } else { 270 269 sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 271 270 src_code = &v4l2_subdev_get_try_format(sd, sd_state, 1)->code; ··· 280 279 281 280 fmt->format = *sink_fmt; 282 281 283 - if (vimc_deb_src_code_is_valid(code)) 282 + if (vimc_debayer_src_code_is_valid(code)) 284 283 *src_code = code; 285 284 286 285 fmt->format.code = *src_code; 287 286 } else { 288 287 /* Set the new format in the sink pad */ 289 - vimc_deb_adjust_sink_fmt(&fmt->format); 288 + vimc_debayer_adjust_sink_fmt(&fmt->format); 290 289 291 - dev_dbg(vdeb->ved.dev, "%s: sink format update: " 290 + dev_dbg(vdebayer->ved.dev, "%s: sink format update: " 292 291 "old:%dx%d (0x%x, %d, %d, %d, %d) " 293 - "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vdeb->sd.name, 292 + "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vdebayer->sd.name, 294 293 /* old */ 295 294 sink_fmt->width, sink_fmt->height, sink_fmt->code, 296 295 sink_fmt->colorspace, sink_fmt->quantization, ··· 306 305 return 0; 307 306 } 308 307 309 - static const struct v4l2_subdev_pad_ops vimc_deb_pad_ops = { 310 - .init_cfg = vimc_deb_init_cfg, 311 - .enum_mbus_code = vimc_deb_enum_mbus_code, 312 - .enum_frame_size = vimc_deb_enum_frame_size, 313 - .get_fmt = vimc_deb_get_fmt, 314 - .set_fmt = vimc_deb_set_fmt, 308 + static const struct v4l2_subdev_pad_ops vimc_debayer_pad_ops = { 309 + .init_cfg = vimc_debayer_init_cfg, 310 + .enum_mbus_code = vimc_debayer_enum_mbus_code, 311 + .enum_frame_size = vimc_debayer_enum_frame_size, 312 + .get_fmt = vimc_debayer_get_fmt, 313 + .set_fmt = vimc_debayer_set_fmt, 315 314 }; 316 315 317 - static void vimc_deb_process_rgb_frame(struct vimc_deb_device *vdeb, 318 - unsigned int lin, 319 - unsigned int col, 320 - unsigned int rgb[3]) 316 + static void vimc_debayer_process_rgb_frame(struct vimc_debayer_device *vdebayer, 317 + unsigned int lin, 318 + unsigned int col, 319 + unsigned int rgb[3]) 321 320 { 322 321 const struct vimc_pix_map *vpix; 323 322 unsigned int i, index; 324 323 325 - vpix = vimc_pix_map_by_code(vdeb->src_code); 326 - index = VIMC_FRAME_INDEX(lin, col, vdeb->sink_fmt.width, 3); 324 + vpix = vimc_pix_map_by_code(vdebayer->src_code); 325 + index = VIMC_FRAME_INDEX(lin, col, vdebayer->sink_fmt.width, 3); 327 326 for (i = 0; i < 3; i++) { 328 327 switch (vpix->pixelformat) { 329 328 case V4L2_PIX_FMT_RGB24: 330 - vdeb->src_frame[index + i] = rgb[i]; 329 + vdebayer->src_frame[index + i] = rgb[i]; 331 330 break; 332 331 case V4L2_PIX_FMT_BGR24: 333 - vdeb->src_frame[index + i] = rgb[2 - i]; 332 + vdebayer->src_frame[index + i] = rgb[2 - i]; 334 333 break; 335 334 } 336 335 } 337 336 } 338 337 339 - static int vimc_deb_s_stream(struct v4l2_subdev *sd, int enable) 338 + static int vimc_debayer_s_stream(struct v4l2_subdev *sd, int enable) 340 339 { 341 - struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); 340 + struct vimc_debayer_device *vdebayer = v4l2_get_subdevdata(sd); 342 341 343 342 if (enable) { 344 343 const struct vimc_pix_map *vpix; 345 344 unsigned int frame_size; 346 345 347 - if (vdeb->src_frame) 346 + if (vdebayer->src_frame) 348 347 return 0; 349 348 350 349 /* Calculate the frame size of the source pad */ 351 - vpix = vimc_pix_map_by_code(vdeb->src_code); 352 - frame_size = vdeb->sink_fmt.width * vdeb->sink_fmt.height * 350 + vpix = vimc_pix_map_by_code(vdebayer->src_code); 351 + frame_size = vdebayer->sink_fmt.width * vdebayer->sink_fmt.height * 353 352 vpix->bpp; 354 353 355 354 /* Save the bytes per pixel of the sink */ 356 - vpix = vimc_pix_map_by_code(vdeb->sink_fmt.code); 357 - vdeb->sink_bpp = vpix->bpp; 355 + vpix = vimc_pix_map_by_code(vdebayer->sink_fmt.code); 356 + vdebayer->sink_bpp = vpix->bpp; 358 357 359 358 /* Get the corresponding pixel map from the table */ 360 - vdeb->sink_pix_map = 361 - vimc_deb_pix_map_by_code(vdeb->sink_fmt.code); 359 + vdebayer->sink_pix_map = 360 + vimc_debayer_pix_map_by_code(vdebayer->sink_fmt.code); 362 361 363 362 /* 364 363 * Allocate the frame buffer. Use vmalloc to be able to 365 364 * allocate a large amount of memory 366 365 */ 367 - vdeb->src_frame = vmalloc(frame_size); 368 - if (!vdeb->src_frame) 366 + vdebayer->src_frame = vmalloc(frame_size); 367 + if (!vdebayer->src_frame) 369 368 return -ENOMEM; 370 369 371 370 } else { 372 - if (!vdeb->src_frame) 371 + if (!vdebayer->src_frame) 373 372 return 0; 374 373 375 - vfree(vdeb->src_frame); 376 - vdeb->src_frame = NULL; 374 + vfree(vdebayer->src_frame); 375 + vdebayer->src_frame = NULL; 377 376 } 378 377 379 378 return 0; 380 379 } 381 380 382 - static const struct v4l2_subdev_core_ops vimc_deb_core_ops = { 381 + static const struct v4l2_subdev_core_ops vimc_debayer_core_ops = { 383 382 .log_status = v4l2_ctrl_subdev_log_status, 384 383 .subscribe_event = v4l2_ctrl_subdev_subscribe_event, 385 384 .unsubscribe_event = v4l2_event_subdev_unsubscribe, 386 385 }; 387 386 388 - static const struct v4l2_subdev_video_ops vimc_deb_video_ops = { 389 - .s_stream = vimc_deb_s_stream, 387 + static const struct v4l2_subdev_video_ops vimc_debayer_video_ops = { 388 + .s_stream = vimc_debayer_s_stream, 390 389 }; 391 390 392 - static const struct v4l2_subdev_ops vimc_deb_ops = { 393 - .core = &vimc_deb_core_ops, 394 - .pad = &vimc_deb_pad_ops, 395 - .video = &vimc_deb_video_ops, 391 + static const struct v4l2_subdev_ops vimc_debayer_ops = { 392 + .core = &vimc_debayer_core_ops, 393 + .pad = &vimc_debayer_pad_ops, 394 + .video = &vimc_debayer_video_ops, 396 395 }; 397 396 398 - static unsigned int vimc_deb_get_val(const u8 *bytes, 399 - const unsigned int n_bytes) 397 + static unsigned int vimc_debayer_get_val(const u8 *bytes, 398 + const unsigned int n_bytes) 400 399 { 401 400 unsigned int i; 402 401 unsigned int acc = 0; ··· 407 406 return acc; 408 407 } 409 408 410 - static void vimc_deb_calc_rgb_sink(struct vimc_deb_device *vdeb, 411 - const u8 *frame, 412 - const unsigned int lin, 413 - const unsigned int col, 414 - unsigned int rgb[3]) 409 + static void vimc_debayer_calc_rgb_sink(struct vimc_debayer_device *vdebayer, 410 + const u8 *frame, 411 + const unsigned int lin, 412 + const unsigned int col, 413 + unsigned int rgb[3]) 415 414 { 416 415 unsigned int i, seek, wlin, wcol; 417 416 unsigned int n_rgb[3] = {0, 0, 0}; ··· 424 423 * the top left corner of the mean window (considering the current 425 424 * pixel as the center) 426 425 */ 427 - seek = vdeb->mean_win_size / 2; 426 + seek = vdebayer->mean_win_size / 2; 428 427 429 428 /* Sum the values of the colors in the mean window */ 430 429 431 - dev_dbg(vdeb->ved.dev, 430 + dev_dbg(vdebayer->ved.dev, 432 431 "deb: %s: --- Calc pixel %dx%d, window mean %d, seek %d ---\n", 433 - vdeb->sd.name, lin, col, vdeb->sink_fmt.height, seek); 432 + vdebayer->sd.name, lin, col, vdebayer->sink_fmt.height, seek); 434 433 435 434 /* 436 435 * Iterate through all the lines in the mean window, start ··· 439 438 * frame 440 439 */ 441 440 for (wlin = seek > lin ? 0 : lin - seek; 442 - wlin < lin + seek + 1 && wlin < vdeb->sink_fmt.height; 441 + wlin < lin + seek + 1 && wlin < vdebayer->sink_fmt.height; 443 442 wlin++) { 444 443 445 444 /* ··· 449 448 * frame 450 449 */ 451 450 for (wcol = seek > col ? 0 : col - seek; 452 - wcol < col + seek + 1 && wcol < vdeb->sink_fmt.width; 451 + wcol < col + seek + 1 && wcol < vdebayer->sink_fmt.width; 453 452 wcol++) { 454 - enum vimc_deb_rgb_colors color; 453 + enum vimc_debayer_rgb_colors color; 455 454 unsigned int index; 456 455 457 456 /* Check which color this pixel is */ 458 - color = vdeb->sink_pix_map->order[wlin % 2][wcol % 2]; 457 + color = vdebayer->sink_pix_map->order[wlin % 2][wcol % 2]; 459 458 460 459 index = VIMC_FRAME_INDEX(wlin, wcol, 461 - vdeb->sink_fmt.width, 462 - vdeb->sink_bpp); 460 + vdebayer->sink_fmt.width, 461 + vdebayer->sink_bpp); 463 462 464 - dev_dbg(vdeb->ved.dev, 463 + dev_dbg(vdebayer->ved.dev, 465 464 "deb: %s: RGB CALC: frame index %d, win pos %dx%d, color %d\n", 466 - vdeb->sd.name, index, wlin, wcol, color); 465 + vdebayer->sd.name, index, wlin, wcol, color); 467 466 468 467 /* Get its value */ 469 468 rgb[color] = rgb[color] + 470 - vimc_deb_get_val(&frame[index], vdeb->sink_bpp); 469 + vimc_debayer_get_val(&frame[index], 470 + vdebayer->sink_bpp); 471 471 472 472 /* Save how many values we already added */ 473 473 n_rgb[color]++; 474 474 475 - dev_dbg(vdeb->ved.dev, "deb: %s: RGB CALC: val %d, n %d\n", 476 - vdeb->sd.name, rgb[color], n_rgb[color]); 475 + dev_dbg(vdebayer->ved.dev, "deb: %s: RGB CALC: val %d, n %d\n", 476 + vdebayer->sd.name, rgb[color], n_rgb[color]); 477 477 } 478 478 } 479 479 480 480 /* Calculate the mean */ 481 481 for (i = 0; i < 3; i++) { 482 - dev_dbg(vdeb->ved.dev, 482 + dev_dbg(vdebayer->ved.dev, 483 483 "deb: %s: PRE CALC: %dx%d Color %d, val %d, n %d\n", 484 - vdeb->sd.name, lin, col, i, rgb[i], n_rgb[i]); 484 + vdebayer->sd.name, lin, col, i, rgb[i], n_rgb[i]); 485 485 486 486 if (n_rgb[i]) 487 487 rgb[i] = rgb[i] / n_rgb[i]; 488 488 489 - dev_dbg(vdeb->ved.dev, 489 + dev_dbg(vdebayer->ved.dev, 490 490 "deb: %s: FINAL CALC: %dx%d Color %d, val %d\n", 491 - vdeb->sd.name, lin, col, i, rgb[i]); 491 + vdebayer->sd.name, lin, col, i, rgb[i]); 492 492 } 493 493 } 494 494 495 - static void *vimc_deb_process_frame(struct vimc_ent_device *ved, 496 - const void *sink_frame) 495 + static void *vimc_debayer_process_frame(struct vimc_ent_device *ved, 496 + const void *sink_frame) 497 497 { 498 - struct vimc_deb_device *vdeb = container_of(ved, struct vimc_deb_device, 499 - ved); 498 + struct vimc_debayer_device *vdebayer = 499 + container_of(ved, struct vimc_debayer_device, ved); 500 + 500 501 unsigned int rgb[3]; 501 502 unsigned int i, j; 502 503 503 504 /* If the stream in this node is not active, just return */ 504 - if (!vdeb->src_frame) 505 + if (!vdebayer->src_frame) 505 506 return ERR_PTR(-EINVAL); 506 507 507 - for (i = 0; i < vdeb->sink_fmt.height; i++) 508 - for (j = 0; j < vdeb->sink_fmt.width; j++) { 509 - vimc_deb_calc_rgb_sink(vdeb, sink_frame, i, j, rgb); 510 - vdeb->set_rgb_src(vdeb, i, j, rgb); 508 + for (i = 0; i < vdebayer->sink_fmt.height; i++) 509 + for (j = 0; j < vdebayer->sink_fmt.width; j++) { 510 + vimc_debayer_calc_rgb_sink(vdebayer, sink_frame, i, j, rgb); 511 + vdebayer->set_rgb_src(vdebayer, i, j, rgb); 511 512 } 512 513 513 - return vdeb->src_frame; 514 + return vdebayer->src_frame; 514 515 } 515 516 516 - static int vimc_deb_s_ctrl(struct v4l2_ctrl *ctrl) 517 + static int vimc_debayer_s_ctrl(struct v4l2_ctrl *ctrl) 517 518 { 518 - struct vimc_deb_device *vdeb = 519 - container_of(ctrl->handler, struct vimc_deb_device, hdl); 519 + struct vimc_debayer_device *vdebayer = 520 + container_of(ctrl->handler, struct vimc_debayer_device, hdl); 520 521 521 522 switch (ctrl->id) { 522 523 case VIMC_CID_MEAN_WIN_SIZE: 523 - vdeb->mean_win_size = ctrl->val; 524 + vdebayer->mean_win_size = ctrl->val; 524 525 break; 525 526 default: 526 527 return -EINVAL; ··· 530 527 return 0; 531 528 } 532 529 533 - static const struct v4l2_ctrl_ops vimc_deb_ctrl_ops = { 534 - .s_ctrl = vimc_deb_s_ctrl, 530 + static const struct v4l2_ctrl_ops vimc_debayer_ctrl_ops = { 531 + .s_ctrl = vimc_debayer_s_ctrl, 535 532 }; 536 533 537 - static void vimc_deb_release(struct vimc_ent_device *ved) 534 + static void vimc_debayer_release(struct vimc_ent_device *ved) 538 535 { 539 - struct vimc_deb_device *vdeb = 540 - container_of(ved, struct vimc_deb_device, ved); 536 + struct vimc_debayer_device *vdebayer = 537 + container_of(ved, struct vimc_debayer_device, ved); 541 538 542 - v4l2_ctrl_handler_free(&vdeb->hdl); 543 - media_entity_cleanup(vdeb->ved.ent); 544 - kfree(vdeb); 539 + v4l2_ctrl_handler_free(&vdebayer->hdl); 540 + media_entity_cleanup(vdebayer->ved.ent); 541 + kfree(vdebayer); 545 542 } 546 543 547 - static const struct v4l2_ctrl_config vimc_deb_ctrl_class = { 544 + static const struct v4l2_ctrl_config vimc_debayer_ctrl_class = { 548 545 .flags = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY, 549 546 .id = VIMC_CID_VIMC_CLASS, 550 547 .name = "VIMC Controls", 551 548 .type = V4L2_CTRL_TYPE_CTRL_CLASS, 552 549 }; 553 550 554 - static const struct v4l2_ctrl_config vimc_deb_ctrl_mean_win_size = { 555 - .ops = &vimc_deb_ctrl_ops, 551 + static const struct v4l2_ctrl_config vimc_debayer_ctrl_mean_win_size = { 552 + .ops = &vimc_debayer_ctrl_ops, 556 553 .id = VIMC_CID_MEAN_WIN_SIZE, 557 554 .name = "Debayer Mean Window Size", 558 555 .type = V4L2_CTRL_TYPE_INTEGER, ··· 562 559 .def = 3, 563 560 }; 564 561 565 - static struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc, 566 - const char *vcfg_name) 562 + static struct vimc_ent_device *vimc_debayer_add(struct vimc_device *vimc, 563 + const char *vcfg_name) 567 564 { 568 565 struct v4l2_device *v4l2_dev = &vimc->v4l2_dev; 569 - struct vimc_deb_device *vdeb; 566 + struct vimc_debayer_device *vdebayer; 570 567 int ret; 571 568 572 - /* Allocate the vdeb struct */ 573 - vdeb = kzalloc(sizeof(*vdeb), GFP_KERNEL); 574 - if (!vdeb) 569 + /* Allocate the vdebayer struct */ 570 + vdebayer = kzalloc(sizeof(*vdebayer), GFP_KERNEL); 571 + if (!vdebayer) 575 572 return ERR_PTR(-ENOMEM); 576 573 577 574 /* Create controls: */ 578 - v4l2_ctrl_handler_init(&vdeb->hdl, 2); 579 - v4l2_ctrl_new_custom(&vdeb->hdl, &vimc_deb_ctrl_class, NULL); 580 - v4l2_ctrl_new_custom(&vdeb->hdl, &vimc_deb_ctrl_mean_win_size, NULL); 581 - vdeb->sd.ctrl_handler = &vdeb->hdl; 582 - if (vdeb->hdl.error) { 583 - ret = vdeb->hdl.error; 584 - goto err_free_vdeb; 575 + v4l2_ctrl_handler_init(&vdebayer->hdl, 2); 576 + v4l2_ctrl_new_custom(&vdebayer->hdl, &vimc_debayer_ctrl_class, NULL); 577 + v4l2_ctrl_new_custom(&vdebayer->hdl, &vimc_debayer_ctrl_mean_win_size, NULL); 578 + vdebayer->sd.ctrl_handler = &vdebayer->hdl; 579 + if (vdebayer->hdl.error) { 580 + ret = vdebayer->hdl.error; 581 + goto err_free_vdebayer; 585 582 } 586 583 587 584 /* Initialize ved and sd */ 588 - vdeb->pads[0].flags = MEDIA_PAD_FL_SINK; 589 - vdeb->pads[1].flags = MEDIA_PAD_FL_SOURCE; 585 + vdebayer->pads[0].flags = MEDIA_PAD_FL_SINK; 586 + vdebayer->pads[1].flags = MEDIA_PAD_FL_SOURCE; 590 587 591 - ret = vimc_ent_sd_register(&vdeb->ved, &vdeb->sd, v4l2_dev, 588 + ret = vimc_ent_sd_register(&vdebayer->ved, &vdebayer->sd, v4l2_dev, 592 589 vcfg_name, 593 590 MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV, 2, 594 - vdeb->pads, &vimc_deb_ops); 591 + vdebayer->pads, &vimc_debayer_ops); 595 592 if (ret) 596 593 goto err_free_hdl; 597 594 598 - vdeb->ved.process_frame = vimc_deb_process_frame; 599 - vdeb->ved.dev = vimc->mdev.dev; 600 - vdeb->mean_win_size = vimc_deb_ctrl_mean_win_size.def; 595 + vdebayer->ved.process_frame = vimc_debayer_process_frame; 596 + vdebayer->ved.dev = vimc->mdev.dev; 597 + vdebayer->mean_win_size = vimc_debayer_ctrl_mean_win_size.def; 601 598 602 599 /* Initialize the frame format */ 603 - vdeb->sink_fmt = sink_fmt_default; 600 + vdebayer->sink_fmt = sink_fmt_default; 604 601 /* 605 602 * TODO: Add support for more output formats, we only support 606 603 * RGB888 for now 607 604 * NOTE: the src format is always the same as the sink, except 608 605 * for the code 609 606 */ 610 - vdeb->src_code = MEDIA_BUS_FMT_RGB888_1X24; 611 - vdeb->set_rgb_src = vimc_deb_process_rgb_frame; 607 + vdebayer->src_code = MEDIA_BUS_FMT_RGB888_1X24; 608 + vdebayer->set_rgb_src = vimc_debayer_process_rgb_frame; 612 609 613 - return &vdeb->ved; 610 + return &vdebayer->ved; 614 611 615 612 err_free_hdl: 616 - v4l2_ctrl_handler_free(&vdeb->hdl); 617 - err_free_vdeb: 618 - kfree(vdeb); 613 + v4l2_ctrl_handler_free(&vdebayer->hdl); 614 + err_free_vdebayer: 615 + kfree(vdebayer); 619 616 620 617 return ERR_PTR(ret); 621 618 } 622 619 623 - struct vimc_ent_type vimc_deb_type = { 624 - .add = vimc_deb_add, 625 - .release = vimc_deb_release 620 + struct vimc_ent_type vimc_debayer_type = { 621 + .add = vimc_debayer_add, 622 + .release = vimc_debayer_release 626 623 };
+41 -41
drivers/media/test-drivers/vimc/vimc-lens.c
··· 11 11 12 12 #include "vimc-common.h" 13 13 14 - #define VIMC_LEN_MAX_FOCUS_POS 1023 15 - #define VIMC_LEN_MAX_FOCUS_STEP 1 14 + #define VIMC_LENS_MAX_FOCUS_POS 1023 15 + #define VIMC_LENS_MAX_FOCUS_STEP 1 16 16 17 - struct vimc_len_device { 17 + struct vimc_lens_device { 18 18 struct vimc_ent_device ved; 19 19 struct v4l2_subdev sd; 20 20 struct v4l2_ctrl_handler hdl; 21 21 u32 focus_absolute; 22 22 }; 23 23 24 - static const struct v4l2_subdev_core_ops vimc_len_core_ops = { 24 + static const struct v4l2_subdev_core_ops vimc_lens_core_ops = { 25 25 .log_status = v4l2_ctrl_subdev_log_status, 26 26 .subscribe_event = v4l2_ctrl_subdev_subscribe_event, 27 27 .unsubscribe_event = v4l2_event_subdev_unsubscribe, 28 28 }; 29 29 30 - static const struct v4l2_subdev_ops vimc_len_ops = { 31 - .core = &vimc_len_core_ops 30 + static const struct v4l2_subdev_ops vimc_lens_ops = { 31 + .core = &vimc_lens_core_ops 32 32 }; 33 33 34 - static int vimc_len_s_ctrl(struct v4l2_ctrl *ctrl) 34 + static int vimc_lens_s_ctrl(struct v4l2_ctrl *ctrl) 35 35 { 36 - struct vimc_len_device *vlen = 37 - container_of(ctrl->handler, struct vimc_len_device, hdl); 36 + struct vimc_lens_device *vlens = 37 + container_of(ctrl->handler, struct vimc_lens_device, hdl); 38 38 if (ctrl->id == V4L2_CID_FOCUS_ABSOLUTE) { 39 - vlen->focus_absolute = ctrl->val; 39 + vlens->focus_absolute = ctrl->val; 40 40 return 0; 41 41 } 42 42 return -EINVAL; 43 43 } 44 44 45 - static const struct v4l2_ctrl_ops vimc_len_ctrl_ops = { 46 - .s_ctrl = vimc_len_s_ctrl, 45 + static const struct v4l2_ctrl_ops vimc_lens_ctrl_ops = { 46 + .s_ctrl = vimc_lens_s_ctrl, 47 47 }; 48 48 49 - static struct vimc_ent_device *vimc_len_add(struct vimc_device *vimc, 50 - const char *vcfg_name) 49 + static struct vimc_ent_device *vimc_lens_add(struct vimc_device *vimc, 50 + const char *vcfg_name) 51 51 { 52 52 struct v4l2_device *v4l2_dev = &vimc->v4l2_dev; 53 - struct vimc_len_device *vlen; 53 + struct vimc_lens_device *vlens; 54 54 int ret; 55 55 56 - /* Allocate the vlen struct */ 57 - vlen = kzalloc(sizeof(*vlen), GFP_KERNEL); 58 - if (!vlen) 56 + /* Allocate the vlens struct */ 57 + vlens = kzalloc(sizeof(*vlens), GFP_KERNEL); 58 + if (!vlens) 59 59 return ERR_PTR(-ENOMEM); 60 60 61 - v4l2_ctrl_handler_init(&vlen->hdl, 1); 61 + v4l2_ctrl_handler_init(&vlens->hdl, 1); 62 62 63 - v4l2_ctrl_new_std(&vlen->hdl, &vimc_len_ctrl_ops, 63 + v4l2_ctrl_new_std(&vlens->hdl, &vimc_lens_ctrl_ops, 64 64 V4L2_CID_FOCUS_ABSOLUTE, 0, 65 - VIMC_LEN_MAX_FOCUS_POS, VIMC_LEN_MAX_FOCUS_STEP, 0); 66 - vlen->sd.ctrl_handler = &vlen->hdl; 67 - if (vlen->hdl.error) { 68 - ret = vlen->hdl.error; 69 - goto err_free_vlen; 65 + VIMC_LENS_MAX_FOCUS_POS, VIMC_LENS_MAX_FOCUS_STEP, 0); 66 + vlens->sd.ctrl_handler = &vlens->hdl; 67 + if (vlens->hdl.error) { 68 + ret = vlens->hdl.error; 69 + goto err_free_vlens; 70 70 } 71 - vlen->ved.dev = vimc->mdev.dev; 71 + vlens->ved.dev = vimc->mdev.dev; 72 72 73 - ret = vimc_ent_sd_register(&vlen->ved, &vlen->sd, v4l2_dev, 73 + ret = vimc_ent_sd_register(&vlens->ved, &vlens->sd, v4l2_dev, 74 74 vcfg_name, MEDIA_ENT_F_LENS, 0, 75 - NULL, &vimc_len_ops); 75 + NULL, &vimc_lens_ops); 76 76 if (ret) 77 77 goto err_free_hdl; 78 78 79 - return &vlen->ved; 79 + return &vlens->ved; 80 80 81 81 err_free_hdl: 82 - v4l2_ctrl_handler_free(&vlen->hdl); 83 - err_free_vlen: 84 - kfree(vlen); 82 + v4l2_ctrl_handler_free(&vlens->hdl); 83 + err_free_vlens: 84 + kfree(vlens); 85 85 86 86 return ERR_PTR(ret); 87 87 } 88 88 89 - static void vimc_len_release(struct vimc_ent_device *ved) 89 + static void vimc_lens_release(struct vimc_ent_device *ved) 90 90 { 91 - struct vimc_len_device *vlen = 92 - container_of(ved, struct vimc_len_device, ved); 91 + struct vimc_lens_device *vlens = 92 + container_of(ved, struct vimc_lens_device, ved); 93 93 94 - v4l2_ctrl_handler_free(&vlen->hdl); 95 - media_entity_cleanup(vlen->ved.ent); 96 - kfree(vlen); 94 + v4l2_ctrl_handler_free(&vlens->hdl); 95 + media_entity_cleanup(vlens->ved.ent); 96 + kfree(vlens); 97 97 } 98 98 99 - struct vimc_ent_type vimc_len_type = { 100 - .add = vimc_len_add, 101 - .release = vimc_len_release 99 + struct vimc_ent_type vimc_lens_type = { 100 + .add = vimc_lens_add, 101 + .release = vimc_lens_release 102 102 };
+108 -108
drivers/media/test-drivers/vimc/vimc-scaler.c
··· 16 16 17 17 /* Pad identifier */ 18 18 enum vic_sca_pad { 19 - VIMC_SCA_SINK = 0, 20 - VIMC_SCA_SRC = 1, 19 + VIMC_SCALER_SINK = 0, 20 + VIMC_SCALER_SRC = 1, 21 21 }; 22 22 23 - #define VIMC_SCA_FMT_WIDTH_DEFAULT 640 24 - #define VIMC_SCA_FMT_HEIGHT_DEFAULT 480 23 + #define VIMC_SCALER_FMT_WIDTH_DEFAULT 640 24 + #define VIMC_SCALER_FMT_HEIGHT_DEFAULT 480 25 25 26 - struct vimc_sca_device { 26 + struct vimc_scaler_device { 27 27 struct vimc_ent_device ved; 28 28 struct v4l2_subdev sd; 29 29 struct v4l2_rect crop_rect; ··· 36 36 }; 37 37 38 38 static const struct v4l2_mbus_framefmt fmt_default = { 39 - .width = VIMC_SCA_FMT_WIDTH_DEFAULT, 40 - .height = VIMC_SCA_FMT_HEIGHT_DEFAULT, 39 + .width = VIMC_SCALER_FMT_WIDTH_DEFAULT, 40 + .height = VIMC_SCALER_FMT_HEIGHT_DEFAULT, 41 41 .code = MEDIA_BUS_FMT_RGB888_1X24, 42 42 .field = V4L2_FIELD_NONE, 43 43 .colorspace = V4L2_COLORSPACE_SRGB, 44 44 }; 45 45 46 46 static const struct v4l2_rect crop_rect_default = { 47 - .width = VIMC_SCA_FMT_WIDTH_DEFAULT, 48 - .height = VIMC_SCA_FMT_HEIGHT_DEFAULT, 47 + .width = VIMC_SCALER_FMT_WIDTH_DEFAULT, 48 + .height = VIMC_SCALER_FMT_HEIGHT_DEFAULT, 49 49 .top = 0, 50 50 .left = 0, 51 51 }; ··· 58 58 }; 59 59 60 60 static struct v4l2_rect 61 - vimc_sca_get_crop_bound_sink(const struct v4l2_mbus_framefmt *sink_fmt) 61 + vimc_scaler_get_crop_bound_sink(const struct v4l2_mbus_framefmt *sink_fmt) 62 62 { 63 63 /* Get the crop bounds to clamp the crop rectangle correctly */ 64 64 struct v4l2_rect r = { ··· 70 70 return r; 71 71 } 72 72 73 - static int vimc_sca_init_cfg(struct v4l2_subdev *sd, 73 + static int vimc_scaler_init_cfg(struct v4l2_subdev *sd, 74 74 struct v4l2_subdev_state *sd_state) 75 75 { 76 76 struct v4l2_mbus_framefmt *mf; ··· 82 82 *mf = fmt_default; 83 83 } 84 84 85 - r = v4l2_subdev_get_try_crop(sd, sd_state, VIMC_SCA_SINK); 85 + r = v4l2_subdev_get_try_crop(sd, sd_state, VIMC_SCALER_SINK); 86 86 *r = crop_rect_default; 87 87 88 88 return 0; 89 89 } 90 90 91 - static int vimc_sca_enum_mbus_code(struct v4l2_subdev *sd, 91 + static int vimc_scaler_enum_mbus_code(struct v4l2_subdev *sd, 92 92 struct v4l2_subdev_state *sd_state, 93 93 struct v4l2_subdev_mbus_code_enum *code) 94 94 { ··· 109 109 return 0; 110 110 } 111 111 112 - static int vimc_sca_enum_frame_size(struct v4l2_subdev *sd, 112 + static int vimc_scaler_enum_frame_size(struct v4l2_subdev *sd, 113 113 struct v4l2_subdev_state *sd_state, 114 114 struct v4l2_subdev_frame_size_enum *fse) 115 115 { ··· 133 133 } 134 134 135 135 static struct v4l2_mbus_framefmt * 136 - vimc_sca_pad_format(struct vimc_sca_device *vsca, 136 + vimc_scaler_pad_format(struct vimc_scaler_device *vscaler, 137 137 struct v4l2_subdev_state *sd_state, u32 pad, 138 138 enum v4l2_subdev_format_whence which) 139 139 { 140 140 if (which == V4L2_SUBDEV_FORMAT_TRY) 141 - return v4l2_subdev_get_try_format(&vsca->sd, sd_state, pad); 141 + return v4l2_subdev_get_try_format(&vscaler->sd, sd_state, pad); 142 142 else 143 - return &vsca->fmt[pad]; 143 + return &vscaler->fmt[pad]; 144 144 } 145 145 146 146 static struct v4l2_rect * 147 - vimc_sca_pad_crop(struct vimc_sca_device *vsca, 147 + vimc_scaler_pad_crop(struct vimc_scaler_device *vscaler, 148 148 struct v4l2_subdev_state *sd_state, 149 149 enum v4l2_subdev_format_whence which) 150 150 { 151 151 if (which == V4L2_SUBDEV_FORMAT_TRY) 152 - return v4l2_subdev_get_try_crop(&vsca->sd, sd_state, 153 - VIMC_SCA_SINK); 152 + return v4l2_subdev_get_try_crop(&vscaler->sd, sd_state, 153 + VIMC_SCALER_SINK); 154 154 else 155 - return &vsca->crop_rect; 155 + return &vscaler->crop_rect; 156 156 } 157 157 158 - static int vimc_sca_get_fmt(struct v4l2_subdev *sd, 158 + static int vimc_scaler_get_fmt(struct v4l2_subdev *sd, 159 159 struct v4l2_subdev_state *sd_state, 160 160 struct v4l2_subdev_format *format) 161 161 { 162 - struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); 162 + struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); 163 163 164 - format->format = *vimc_sca_pad_format(vsca, sd_state, format->pad, 164 + format->format = *vimc_scaler_pad_format(vscaler, sd_state, format->pad, 165 165 format->which); 166 166 return 0; 167 167 } 168 168 169 - static int vimc_sca_set_fmt(struct v4l2_subdev *sd, 169 + static int vimc_scaler_set_fmt(struct v4l2_subdev *sd, 170 170 struct v4l2_subdev_state *sd_state, 171 171 struct v4l2_subdev_format *format) 172 172 { 173 - struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); 173 + struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); 174 174 struct v4l2_mbus_framefmt *fmt; 175 175 176 176 /* Do not change the active format while stream is on */ 177 - if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE && vsca->src_frame) 177 + if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE && vscaler->src_frame) 178 178 return -EBUSY; 179 179 180 - fmt = vimc_sca_pad_format(vsca, sd_state, format->pad, format->which); 180 + fmt = vimc_scaler_pad_format(vscaler, sd_state, format->pad, format->which); 181 181 182 182 /* 183 183 * The media bus code and colorspace can only be changed on the sink 184 184 * pad, the source pad only follows. 185 185 */ 186 - if (format->pad == VIMC_SCA_SINK) { 186 + if (format->pad == VIMC_SCALER_SINK) { 187 187 const struct vimc_pix_map *vpix; 188 188 189 189 /* Only accept code in the pix map table in non bayer format. */ ··· 211 211 * Propagate the sink pad format to the crop rectangle and the source 212 212 * pad. 213 213 */ 214 - if (format->pad == VIMC_SCA_SINK) { 214 + if (format->pad == VIMC_SCALER_SINK) { 215 215 struct v4l2_mbus_framefmt *src_fmt; 216 216 struct v4l2_rect *crop; 217 217 218 - crop = vimc_sca_pad_crop(vsca, sd_state, format->which); 218 + crop = vimc_scaler_pad_crop(vscaler, sd_state, format->which); 219 219 crop->width = fmt->width; 220 220 crop->height = fmt->height; 221 221 crop->top = 0; 222 222 crop->left = 0; 223 223 224 - src_fmt = vimc_sca_pad_format(vsca, sd_state, VIMC_SCA_SRC, 224 + src_fmt = vimc_scaler_pad_format(vscaler, sd_state, VIMC_SCALER_SRC, 225 225 format->which); 226 226 *src_fmt = *fmt; 227 227 } ··· 231 231 return 0; 232 232 } 233 233 234 - static int vimc_sca_get_selection(struct v4l2_subdev *sd, 234 + static int vimc_scaler_get_selection(struct v4l2_subdev *sd, 235 235 struct v4l2_subdev_state *sd_state, 236 236 struct v4l2_subdev_selection *sel) 237 237 { 238 - struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); 238 + struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); 239 239 struct v4l2_mbus_framefmt *sink_fmt; 240 240 241 241 if (VIMC_IS_SRC(sel->pad)) ··· 243 243 244 244 switch (sel->target) { 245 245 case V4L2_SEL_TGT_CROP: 246 - sel->r = *vimc_sca_pad_crop(vsca, sd_state, sel->which); 246 + sel->r = *vimc_scaler_pad_crop(vscaler, sd_state, sel->which); 247 247 break; 248 248 case V4L2_SEL_TGT_CROP_BOUNDS: 249 - sink_fmt = vimc_sca_pad_format(vsca, sd_state, VIMC_SCA_SINK, 249 + sink_fmt = vimc_scaler_pad_format(vscaler, sd_state, VIMC_SCALER_SINK, 250 250 sel->which); 251 - sel->r = vimc_sca_get_crop_bound_sink(sink_fmt); 251 + sel->r = vimc_scaler_get_crop_bound_sink(sink_fmt); 252 252 break; 253 253 default: 254 254 return -EINVAL; ··· 257 257 return 0; 258 258 } 259 259 260 - static void vimc_sca_adjust_sink_crop(struct v4l2_rect *r, 260 + static void vimc_scaler_adjust_sink_crop(struct v4l2_rect *r, 261 261 const struct v4l2_mbus_framefmt *sink_fmt) 262 262 { 263 263 const struct v4l2_rect sink_rect = 264 - vimc_sca_get_crop_bound_sink(sink_fmt); 264 + vimc_scaler_get_crop_bound_sink(sink_fmt); 265 265 266 266 /* Disallow rectangles smaller than the minimal one. */ 267 267 v4l2_rect_set_min_size(r, &crop_rect_min); 268 268 v4l2_rect_map_inside(r, &sink_rect); 269 269 } 270 270 271 - static int vimc_sca_set_selection(struct v4l2_subdev *sd, 271 + static int vimc_scaler_set_selection(struct v4l2_subdev *sd, 272 272 struct v4l2_subdev_state *sd_state, 273 273 struct v4l2_subdev_selection *sel) 274 274 { 275 - struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); 275 + struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); 276 276 struct v4l2_mbus_framefmt *sink_fmt; 277 277 struct v4l2_rect *crop_rect; 278 278 ··· 280 280 if (VIMC_IS_SRC(sel->pad) || sel->target != V4L2_SEL_TGT_CROP) 281 281 return -EINVAL; 282 282 283 - if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE && vsca->src_frame) 283 + if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE && vscaler->src_frame) 284 284 return -EBUSY; 285 285 286 - crop_rect = vimc_sca_pad_crop(vsca, sd_state, sel->which); 287 - sink_fmt = vimc_sca_pad_format(vsca, sd_state, VIMC_SCA_SINK, 286 + crop_rect = vimc_scaler_pad_crop(vscaler, sd_state, sel->which); 287 + sink_fmt = vimc_scaler_pad_format(vscaler, sd_state, VIMC_SCALER_SINK, 288 288 sel->which); 289 - vimc_sca_adjust_sink_crop(&sel->r, sink_fmt); 289 + vimc_scaler_adjust_sink_crop(&sel->r, sink_fmt); 290 290 *crop_rect = sel->r; 291 291 292 292 return 0; 293 293 } 294 294 295 - static const struct v4l2_subdev_pad_ops vimc_sca_pad_ops = { 296 - .init_cfg = vimc_sca_init_cfg, 297 - .enum_mbus_code = vimc_sca_enum_mbus_code, 298 - .enum_frame_size = vimc_sca_enum_frame_size, 299 - .get_fmt = vimc_sca_get_fmt, 300 - .set_fmt = vimc_sca_set_fmt, 301 - .get_selection = vimc_sca_get_selection, 302 - .set_selection = vimc_sca_set_selection, 295 + static const struct v4l2_subdev_pad_ops vimc_scaler_pad_ops = { 296 + .init_cfg = vimc_scaler_init_cfg, 297 + .enum_mbus_code = vimc_scaler_enum_mbus_code, 298 + .enum_frame_size = vimc_scaler_enum_frame_size, 299 + .get_fmt = vimc_scaler_get_fmt, 300 + .set_fmt = vimc_scaler_set_fmt, 301 + .get_selection = vimc_scaler_get_selection, 302 + .set_selection = vimc_scaler_set_selection, 303 303 }; 304 304 305 - static int vimc_sca_s_stream(struct v4l2_subdev *sd, int enable) 305 + static int vimc_scaler_s_stream(struct v4l2_subdev *sd, int enable) 306 306 { 307 - struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); 307 + struct vimc_scaler_device *vscaler = v4l2_get_subdevdata(sd); 308 308 309 309 if (enable) { 310 310 const struct vimc_pix_map *vpix; 311 311 unsigned int frame_size; 312 312 313 - if (vsca->src_frame) 313 + if (vscaler->src_frame) 314 314 return 0; 315 315 316 316 /* Save the bytes per pixel of the sink */ 317 - vpix = vimc_pix_map_by_code(vsca->fmt[VIMC_SCA_SINK].code); 318 - vsca->bpp = vpix->bpp; 317 + vpix = vimc_pix_map_by_code(vscaler->fmt[VIMC_SCALER_SINK].code); 318 + vscaler->bpp = vpix->bpp; 319 319 320 320 /* Calculate the frame size of the source pad */ 321 - frame_size = vsca->fmt[VIMC_SCA_SRC].width 322 - * vsca->fmt[VIMC_SCA_SRC].height * vsca->bpp; 321 + frame_size = vscaler->fmt[VIMC_SCALER_SRC].width 322 + * vscaler->fmt[VIMC_SCALER_SRC].height * vscaler->bpp; 323 323 324 324 /* Allocate the frame buffer. Use vmalloc to be able to 325 325 * allocate a large amount of memory 326 326 */ 327 - vsca->src_frame = vmalloc(frame_size); 328 - if (!vsca->src_frame) 327 + vscaler->src_frame = vmalloc(frame_size); 328 + if (!vscaler->src_frame) 329 329 return -ENOMEM; 330 330 331 331 } else { 332 - if (!vsca->src_frame) 332 + if (!vscaler->src_frame) 333 333 return 0; 334 334 335 - vfree(vsca->src_frame); 336 - vsca->src_frame = NULL; 335 + vfree(vscaler->src_frame); 336 + vscaler->src_frame = NULL; 337 337 } 338 338 339 339 return 0; 340 340 } 341 341 342 - static const struct v4l2_subdev_video_ops vimc_sca_video_ops = { 343 - .s_stream = vimc_sca_s_stream, 342 + static const struct v4l2_subdev_video_ops vimc_scaler_video_ops = { 343 + .s_stream = vimc_scaler_s_stream, 344 344 }; 345 345 346 - static const struct v4l2_subdev_ops vimc_sca_ops = { 347 - .pad = &vimc_sca_pad_ops, 348 - .video = &vimc_sca_video_ops, 346 + static const struct v4l2_subdev_ops vimc_scaler_ops = { 347 + .pad = &vimc_scaler_pad_ops, 348 + .video = &vimc_scaler_video_ops, 349 349 }; 350 350 351 - static void vimc_sca_fill_src_frame(const struct vimc_sca_device *const vsca, 351 + static void vimc_scaler_fill_src_frame(const struct vimc_scaler_device *const vscaler, 352 352 const u8 *const sink_frame) 353 353 { 354 - const struct v4l2_mbus_framefmt *src_fmt = &vsca->fmt[VIMC_SCA_SRC]; 355 - const struct v4l2_rect *r = &vsca->crop_rect; 356 - unsigned int snk_width = vsca->fmt[VIMC_SCA_SINK].width; 354 + const struct v4l2_mbus_framefmt *src_fmt = &vscaler->fmt[VIMC_SCALER_SRC]; 355 + const struct v4l2_rect *r = &vscaler->crop_rect; 356 + unsigned int snk_width = vscaler->fmt[VIMC_SCALER_SINK].width; 357 357 unsigned int src_x, src_y; 358 - u8 *walker = vsca->src_frame; 358 + u8 *walker = vscaler->src_frame; 359 359 360 360 /* Set each pixel at the src_frame to its sink_frame equivalent */ 361 361 for (src_y = 0; src_y < src_fmt->height; src_y++) { 362 362 unsigned int snk_y, y_offset; 363 363 364 364 snk_y = (src_y * r->height) / src_fmt->height + r->top; 365 - y_offset = snk_y * snk_width * vsca->bpp; 365 + y_offset = snk_y * snk_width * vscaler->bpp; 366 366 367 367 for (src_x = 0; src_x < src_fmt->width; src_x++) { 368 368 unsigned int snk_x, x_offset, index; 369 369 370 370 snk_x = (src_x * r->width) / src_fmt->width + r->left; 371 - x_offset = snk_x * vsca->bpp; 371 + x_offset = snk_x * vscaler->bpp; 372 372 index = y_offset + x_offset; 373 - memcpy(walker, &sink_frame[index], vsca->bpp); 374 - walker += vsca->bpp; 373 + memcpy(walker, &sink_frame[index], vscaler->bpp); 374 + walker += vscaler->bpp; 375 375 } 376 376 } 377 377 } 378 378 379 - static void *vimc_sca_process_frame(struct vimc_ent_device *ved, 379 + static void *vimc_scaler_process_frame(struct vimc_ent_device *ved, 380 380 const void *sink_frame) 381 381 { 382 - struct vimc_sca_device *vsca = container_of(ved, struct vimc_sca_device, 382 + struct vimc_scaler_device *vscaler = container_of(ved, struct vimc_scaler_device, 383 383 ved); 384 384 385 385 /* If the stream in this node is not active, just return */ 386 - if (!vsca->src_frame) 386 + if (!vscaler->src_frame) 387 387 return ERR_PTR(-EINVAL); 388 388 389 - vimc_sca_fill_src_frame(vsca, sink_frame); 389 + vimc_scaler_fill_src_frame(vscaler, sink_frame); 390 390 391 - return vsca->src_frame; 391 + return vscaler->src_frame; 392 392 }; 393 393 394 - static void vimc_sca_release(struct vimc_ent_device *ved) 394 + static void vimc_scaler_release(struct vimc_ent_device *ved) 395 395 { 396 - struct vimc_sca_device *vsca = 397 - container_of(ved, struct vimc_sca_device, ved); 396 + struct vimc_scaler_device *vscaler = 397 + container_of(ved, struct vimc_scaler_device, ved); 398 398 399 - media_entity_cleanup(vsca->ved.ent); 400 - kfree(vsca); 399 + media_entity_cleanup(vscaler->ved.ent); 400 + kfree(vscaler); 401 401 } 402 402 403 - static struct vimc_ent_device *vimc_sca_add(struct vimc_device *vimc, 403 + static struct vimc_ent_device *vimc_scaler_add(struct vimc_device *vimc, 404 404 const char *vcfg_name) 405 405 { 406 406 struct v4l2_device *v4l2_dev = &vimc->v4l2_dev; 407 - struct vimc_sca_device *vsca; 407 + struct vimc_scaler_device *vscaler; 408 408 int ret; 409 409 410 - /* Allocate the vsca struct */ 411 - vsca = kzalloc(sizeof(*vsca), GFP_KERNEL); 412 - if (!vsca) 410 + /* Allocate the vscaler struct */ 411 + vscaler = kzalloc(sizeof(*vscaler), GFP_KERNEL); 412 + if (!vscaler) 413 413 return ERR_PTR(-ENOMEM); 414 414 415 415 /* Initialize ved and sd */ 416 - vsca->pads[VIMC_SCA_SINK].flags = MEDIA_PAD_FL_SINK; 417 - vsca->pads[VIMC_SCA_SRC].flags = MEDIA_PAD_FL_SOURCE; 416 + vscaler->pads[VIMC_SCALER_SINK].flags = MEDIA_PAD_FL_SINK; 417 + vscaler->pads[VIMC_SCALER_SRC].flags = MEDIA_PAD_FL_SOURCE; 418 418 419 - ret = vimc_ent_sd_register(&vsca->ved, &vsca->sd, v4l2_dev, 419 + ret = vimc_ent_sd_register(&vscaler->ved, &vscaler->sd, v4l2_dev, 420 420 vcfg_name, 421 421 MEDIA_ENT_F_PROC_VIDEO_SCALER, 2, 422 - vsca->pads, &vimc_sca_ops); 422 + vscaler->pads, &vimc_scaler_ops); 423 423 if (ret) { 424 - kfree(vsca); 424 + kfree(vscaler); 425 425 return ERR_PTR(ret); 426 426 } 427 427 428 - vsca->ved.process_frame = vimc_sca_process_frame; 429 - vsca->ved.dev = vimc->mdev.dev; 428 + vscaler->ved.process_frame = vimc_scaler_process_frame; 429 + vscaler->ved.dev = vimc->mdev.dev; 430 430 431 431 /* Initialize the frame format */ 432 - vsca->fmt[VIMC_SCA_SINK] = fmt_default; 433 - vsca->fmt[VIMC_SCA_SRC] = fmt_default; 432 + vscaler->fmt[VIMC_SCALER_SINK] = fmt_default; 433 + vscaler->fmt[VIMC_SCALER_SRC] = fmt_default; 434 434 435 435 /* Initialize the crop selection */ 436 - vsca->crop_rect = crop_rect_default; 436 + vscaler->crop_rect = crop_rect_default; 437 437 438 - return &vsca->ved; 438 + return &vscaler->ved; 439 439 } 440 440 441 - struct vimc_ent_type vimc_sca_type = { 442 - .add = vimc_sca_add, 443 - .release = vimc_sca_release 441 + struct vimc_ent_type vimc_scaler_type = { 442 + .add = vimc_scaler_add, 443 + .release = vimc_scaler_release 444 444 };
+154 -153
drivers/media/test-drivers/vimc/vimc-sensor.c
··· 14 14 15 15 #include "vimc-common.h" 16 16 17 - enum vimc_sen_osd_mode { 18 - VIMC_SEN_OSD_SHOW_ALL = 0, 19 - VIMC_SEN_OSD_SHOW_COUNTERS = 1, 20 - VIMC_SEN_OSD_SHOW_NONE = 2 17 + enum vimc_sensor_osd_mode { 18 + VIMC_SENSOR_OSD_SHOW_ALL = 0, 19 + VIMC_SENSOR_OSD_SHOW_COUNTERS = 1, 20 + VIMC_SENSOR_OSD_SHOW_NONE = 2 21 21 }; 22 22 23 - struct vimc_sen_device { 23 + struct vimc_sensor_device { 24 24 struct vimc_ent_device ved; 25 25 struct v4l2_subdev sd; 26 26 struct tpg_data tpg; 27 27 u8 *frame; 28 - enum vimc_sen_osd_mode osd_value; 28 + enum vimc_sensor_osd_mode osd_value; 29 29 u64 start_stream_ts; 30 30 /* The active format */ 31 31 struct v4l2_mbus_framefmt mbus_format; ··· 41 41 .colorspace = V4L2_COLORSPACE_SRGB, 42 42 }; 43 43 44 - static int vimc_sen_init_cfg(struct v4l2_subdev *sd, 45 - struct v4l2_subdev_state *sd_state) 44 + static int vimc_sensor_init_cfg(struct v4l2_subdev *sd, 45 + struct v4l2_subdev_state *sd_state) 46 46 { 47 47 unsigned int i; 48 48 ··· 56 56 return 0; 57 57 } 58 58 59 - static int vimc_sen_enum_mbus_code(struct v4l2_subdev *sd, 60 - struct v4l2_subdev_state *sd_state, 61 - struct v4l2_subdev_mbus_code_enum *code) 59 + static int vimc_sensor_enum_mbus_code(struct v4l2_subdev *sd, 60 + struct v4l2_subdev_state *sd_state, 61 + struct v4l2_subdev_mbus_code_enum *code) 62 62 { 63 63 u32 mbus_code = vimc_mbus_code_by_index(code->index); 64 64 ··· 70 70 return 0; 71 71 } 72 72 73 - static int vimc_sen_enum_frame_size(struct v4l2_subdev *sd, 74 - struct v4l2_subdev_state *sd_state, 75 - struct v4l2_subdev_frame_size_enum *fse) 73 + static int vimc_sensor_enum_frame_size(struct v4l2_subdev *sd, 74 + struct v4l2_subdev_state *sd_state, 75 + struct v4l2_subdev_frame_size_enum *fse) 76 76 { 77 77 const struct vimc_pix_map *vpix; 78 78 ··· 92 92 return 0; 93 93 } 94 94 95 - static int vimc_sen_get_fmt(struct v4l2_subdev *sd, 96 - struct v4l2_subdev_state *sd_state, 97 - struct v4l2_subdev_format *fmt) 95 + static int vimc_sensor_get_fmt(struct v4l2_subdev *sd, 96 + struct v4l2_subdev_state *sd_state, 97 + struct v4l2_subdev_format *fmt) 98 98 { 99 - struct vimc_sen_device *vsen = 100 - container_of(sd, struct vimc_sen_device, sd); 99 + struct vimc_sensor_device *vsensor = 100 + container_of(sd, struct vimc_sensor_device, sd); 101 101 102 102 fmt->format = fmt->which == V4L2_SUBDEV_FORMAT_TRY ? 103 103 *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) : 104 - vsen->mbus_format; 104 + vsensor->mbus_format; 105 105 106 106 return 0; 107 107 } 108 108 109 - static void vimc_sen_tpg_s_format(struct vimc_sen_device *vsen) 109 + static void vimc_sensor_tpg_s_format(struct vimc_sensor_device *vsensor) 110 110 { 111 111 const struct vimc_pix_map *vpix = 112 - vimc_pix_map_by_code(vsen->mbus_format.code); 112 + vimc_pix_map_by_code(vsensor->mbus_format.code); 113 113 114 - tpg_reset_source(&vsen->tpg, vsen->mbus_format.width, 115 - vsen->mbus_format.height, vsen->mbus_format.field); 116 - tpg_s_bytesperline(&vsen->tpg, 0, vsen->mbus_format.width * vpix->bpp); 117 - tpg_s_buf_height(&vsen->tpg, vsen->mbus_format.height); 118 - tpg_s_fourcc(&vsen->tpg, vpix->pixelformat); 114 + tpg_reset_source(&vsensor->tpg, vsensor->mbus_format.width, 115 + vsensor->mbus_format.height, vsensor->mbus_format.field); 116 + tpg_s_bytesperline(&vsensor->tpg, 0, vsensor->mbus_format.width * vpix->bpp); 117 + tpg_s_buf_height(&vsensor->tpg, vsensor->mbus_format.height); 118 + tpg_s_fourcc(&vsensor->tpg, vpix->pixelformat); 119 119 /* TODO: add support for V4L2_FIELD_ALTERNATE */ 120 - tpg_s_field(&vsen->tpg, vsen->mbus_format.field, false); 121 - tpg_s_colorspace(&vsen->tpg, vsen->mbus_format.colorspace); 122 - tpg_s_ycbcr_enc(&vsen->tpg, vsen->mbus_format.ycbcr_enc); 123 - tpg_s_quantization(&vsen->tpg, vsen->mbus_format.quantization); 124 - tpg_s_xfer_func(&vsen->tpg, vsen->mbus_format.xfer_func); 120 + tpg_s_field(&vsensor->tpg, vsensor->mbus_format.field, false); 121 + tpg_s_colorspace(&vsensor->tpg, vsensor->mbus_format.colorspace); 122 + tpg_s_ycbcr_enc(&vsensor->tpg, vsensor->mbus_format.ycbcr_enc); 123 + tpg_s_quantization(&vsensor->tpg, vsensor->mbus_format.quantization); 124 + tpg_s_xfer_func(&vsensor->tpg, vsensor->mbus_format.xfer_func); 125 125 } 126 126 127 - static void vimc_sen_adjust_fmt(struct v4l2_mbus_framefmt *fmt) 127 + static void vimc_sensor_adjust_fmt(struct v4l2_mbus_framefmt *fmt) 128 128 { 129 129 const struct vimc_pix_map *vpix; 130 130 ··· 145 145 vimc_colorimetry_clamp(fmt); 146 146 } 147 147 148 - static int vimc_sen_set_fmt(struct v4l2_subdev *sd, 149 - struct v4l2_subdev_state *sd_state, 150 - struct v4l2_subdev_format *fmt) 148 + static int vimc_sensor_set_fmt(struct v4l2_subdev *sd, 149 + struct v4l2_subdev_state *sd_state, 150 + struct v4l2_subdev_format *fmt) 151 151 { 152 - struct vimc_sen_device *vsen = v4l2_get_subdevdata(sd); 152 + struct vimc_sensor_device *vsensor = v4l2_get_subdevdata(sd); 153 153 struct v4l2_mbus_framefmt *mf; 154 154 155 155 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 156 156 /* Do not change the format while stream is on */ 157 - if (vsen->frame) 157 + if (vsensor->frame) 158 158 return -EBUSY; 159 159 160 - mf = &vsen->mbus_format; 160 + mf = &vsensor->mbus_format; 161 161 } else { 162 162 mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 163 163 } 164 164 165 165 /* Set the new format */ 166 - vimc_sen_adjust_fmt(&fmt->format); 166 + vimc_sensor_adjust_fmt(&fmt->format); 167 167 168 - dev_dbg(vsen->ved.dev, "%s: format update: " 168 + dev_dbg(vsensor->ved.dev, "%s: format update: " 169 169 "old:%dx%d (0x%x, %d, %d, %d, %d) " 170 - "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vsen->sd.name, 170 + "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vsensor->sd.name, 171 171 /* old */ 172 172 mf->width, mf->height, mf->code, 173 173 mf->colorspace, mf->quantization, ··· 182 182 return 0; 183 183 } 184 184 185 - static const struct v4l2_subdev_pad_ops vimc_sen_pad_ops = { 186 - .init_cfg = vimc_sen_init_cfg, 187 - .enum_mbus_code = vimc_sen_enum_mbus_code, 188 - .enum_frame_size = vimc_sen_enum_frame_size, 189 - .get_fmt = vimc_sen_get_fmt, 190 - .set_fmt = vimc_sen_set_fmt, 185 + static const struct v4l2_subdev_pad_ops vimc_sensor_pad_ops = { 186 + .init_cfg = vimc_sensor_init_cfg, 187 + .enum_mbus_code = vimc_sensor_enum_mbus_code, 188 + .enum_frame_size = vimc_sensor_enum_frame_size, 189 + .get_fmt = vimc_sensor_get_fmt, 190 + .set_fmt = vimc_sensor_set_fmt, 191 191 }; 192 192 193 - static void *vimc_sen_process_frame(struct vimc_ent_device *ved, 194 - const void *sink_frame) 193 + static void *vimc_sensor_process_frame(struct vimc_ent_device *ved, 194 + const void *sink_frame) 195 195 { 196 - struct vimc_sen_device *vsen = container_of(ved, struct vimc_sen_device, 197 - ved); 196 + struct vimc_sensor_device *vsensor = 197 + container_of(ved, struct vimc_sensor_device, ved); 198 + 198 199 const unsigned int line_height = 16; 199 200 u8 *basep[TPG_MAX_PLANES][2]; 200 201 unsigned int line = 1; 201 202 char str[100]; 202 203 203 - tpg_fill_plane_buffer(&vsen->tpg, 0, 0, vsen->frame); 204 - tpg_calc_text_basep(&vsen->tpg, basep, 0, vsen->frame); 205 - switch (vsen->osd_value) { 206 - case VIMC_SEN_OSD_SHOW_ALL: { 207 - const char *order = tpg_g_color_order(&vsen->tpg); 204 + tpg_fill_plane_buffer(&vsensor->tpg, 0, 0, vsensor->frame); 205 + tpg_calc_text_basep(&vsensor->tpg, basep, 0, vsensor->frame); 206 + switch (vsensor->osd_value) { 207 + case VIMC_SENSOR_OSD_SHOW_ALL: { 208 + const char *order = tpg_g_color_order(&vsensor->tpg); 208 209 209 - tpg_gen_text(&vsen->tpg, basep, line++ * line_height, 210 + tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, 210 211 16, order); 211 212 snprintf(str, sizeof(str), 212 213 "brightness %3d, contrast %3d, saturation %3d, hue %d ", 213 - vsen->tpg.brightness, 214 - vsen->tpg.contrast, 215 - vsen->tpg.saturation, 216 - vsen->tpg.hue); 217 - tpg_gen_text(&vsen->tpg, basep, line++ * line_height, 16, str); 214 + vsensor->tpg.brightness, 215 + vsensor->tpg.contrast, 216 + vsensor->tpg.saturation, 217 + vsensor->tpg.hue); 218 + tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, 16, str); 218 219 snprintf(str, sizeof(str), "sensor size: %dx%d", 219 - vsen->mbus_format.width, 220 - vsen->mbus_format.height); 221 - tpg_gen_text(&vsen->tpg, basep, line++ * line_height, 16, str); 220 + vsensor->mbus_format.width, 221 + vsensor->mbus_format.height); 222 + tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, 16, str); 222 223 fallthrough; 223 224 } 224 - case VIMC_SEN_OSD_SHOW_COUNTERS: { 225 + case VIMC_SENSOR_OSD_SHOW_COUNTERS: { 225 226 unsigned int ms; 226 227 227 - ms = div_u64(ktime_get_ns() - vsen->start_stream_ts, 1000000); 228 + ms = div_u64(ktime_get_ns() - vsensor->start_stream_ts, 1000000); 228 229 snprintf(str, sizeof(str), "%02d:%02d:%02d:%03d", 229 230 (ms / (60 * 60 * 1000)) % 24, 230 231 (ms / (60 * 1000)) % 60, 231 232 (ms / 1000) % 60, 232 233 ms % 1000); 233 - tpg_gen_text(&vsen->tpg, basep, line++ * line_height, 16, str); 234 + tpg_gen_text(&vsensor->tpg, basep, line++ * line_height, 16, str); 234 235 break; 235 236 } 236 - case VIMC_SEN_OSD_SHOW_NONE: 237 + case VIMC_SENSOR_OSD_SHOW_NONE: 237 238 default: 238 239 break; 239 240 } 240 241 241 - return vsen->frame; 242 + return vsensor->frame; 242 243 } 243 244 244 - static int vimc_sen_s_stream(struct v4l2_subdev *sd, int enable) 245 + static int vimc_sensor_s_stream(struct v4l2_subdev *sd, int enable) 245 246 { 246 - struct vimc_sen_device *vsen = 247 - container_of(sd, struct vimc_sen_device, sd); 247 + struct vimc_sensor_device *vsensor = 248 + container_of(sd, struct vimc_sensor_device, sd); 248 249 249 250 if (enable) { 250 251 const struct vimc_pix_map *vpix; 251 252 unsigned int frame_size; 252 253 253 - vsen->start_stream_ts = ktime_get_ns(); 254 + vsensor->start_stream_ts = ktime_get_ns(); 254 255 255 256 /* Calculate the frame size */ 256 - vpix = vimc_pix_map_by_code(vsen->mbus_format.code); 257 - frame_size = vsen->mbus_format.width * vpix->bpp * 258 - vsen->mbus_format.height; 257 + vpix = vimc_pix_map_by_code(vsensor->mbus_format.code); 258 + frame_size = vsensor->mbus_format.width * vpix->bpp * 259 + vsensor->mbus_format.height; 259 260 260 261 /* 261 262 * Allocate the frame buffer. Use vmalloc to be able to 262 263 * allocate a large amount of memory 263 264 */ 264 - vsen->frame = vmalloc(frame_size); 265 - if (!vsen->frame) 265 + vsensor->frame = vmalloc(frame_size); 266 + if (!vsensor->frame) 266 267 return -ENOMEM; 267 268 268 269 /* configure the test pattern generator */ 269 - vimc_sen_tpg_s_format(vsen); 270 + vimc_sensor_tpg_s_format(vsensor); 270 271 271 272 } else { 272 273 273 - vfree(vsen->frame); 274 - vsen->frame = NULL; 274 + vfree(vsensor->frame); 275 + vsensor->frame = NULL; 275 276 } 276 277 277 278 return 0; 278 279 } 279 280 280 - static const struct v4l2_subdev_core_ops vimc_sen_core_ops = { 281 + static const struct v4l2_subdev_core_ops vimc_sensor_core_ops = { 281 282 .log_status = v4l2_ctrl_subdev_log_status, 282 283 .subscribe_event = v4l2_ctrl_subdev_subscribe_event, 283 284 .unsubscribe_event = v4l2_event_subdev_unsubscribe, 284 285 }; 285 286 286 - static const struct v4l2_subdev_video_ops vimc_sen_video_ops = { 287 - .s_stream = vimc_sen_s_stream, 287 + static const struct v4l2_subdev_video_ops vimc_sensor_video_ops = { 288 + .s_stream = vimc_sensor_s_stream, 288 289 }; 289 290 290 - static const struct v4l2_subdev_ops vimc_sen_ops = { 291 - .core = &vimc_sen_core_ops, 292 - .pad = &vimc_sen_pad_ops, 293 - .video = &vimc_sen_video_ops, 291 + static const struct v4l2_subdev_ops vimc_sensor_ops = { 292 + .core = &vimc_sensor_core_ops, 293 + .pad = &vimc_sensor_pad_ops, 294 + .video = &vimc_sensor_video_ops, 294 295 }; 295 296 296 - static int vimc_sen_s_ctrl(struct v4l2_ctrl *ctrl) 297 + static int vimc_sensor_s_ctrl(struct v4l2_ctrl *ctrl) 297 298 { 298 - struct vimc_sen_device *vsen = 299 - container_of(ctrl->handler, struct vimc_sen_device, hdl); 299 + struct vimc_sensor_device *vsensor = 300 + container_of(ctrl->handler, struct vimc_sensor_device, hdl); 300 301 301 302 switch (ctrl->id) { 302 303 case VIMC_CID_TEST_PATTERN: 303 - tpg_s_pattern(&vsen->tpg, ctrl->val); 304 + tpg_s_pattern(&vsensor->tpg, ctrl->val); 304 305 break; 305 306 case V4L2_CID_HFLIP: 306 - tpg_s_hflip(&vsen->tpg, ctrl->val); 307 + tpg_s_hflip(&vsensor->tpg, ctrl->val); 307 308 break; 308 309 case V4L2_CID_VFLIP: 309 - tpg_s_vflip(&vsen->tpg, ctrl->val); 310 + tpg_s_vflip(&vsensor->tpg, ctrl->val); 310 311 break; 311 312 case V4L2_CID_BRIGHTNESS: 312 - tpg_s_brightness(&vsen->tpg, ctrl->val); 313 + tpg_s_brightness(&vsensor->tpg, ctrl->val); 313 314 break; 314 315 case V4L2_CID_CONTRAST: 315 - tpg_s_contrast(&vsen->tpg, ctrl->val); 316 + tpg_s_contrast(&vsensor->tpg, ctrl->val); 316 317 break; 317 318 case V4L2_CID_HUE: 318 - tpg_s_hue(&vsen->tpg, ctrl->val); 319 + tpg_s_hue(&vsensor->tpg, ctrl->val); 319 320 break; 320 321 case V4L2_CID_SATURATION: 321 - tpg_s_saturation(&vsen->tpg, ctrl->val); 322 + tpg_s_saturation(&vsensor->tpg, ctrl->val); 322 323 break; 323 324 case VIMC_CID_OSD_TEXT_MODE: 324 - vsen->osd_value = ctrl->val; 325 + vsensor->osd_value = ctrl->val; 325 326 break; 326 327 default: 327 328 return -EINVAL; ··· 330 329 return 0; 331 330 } 332 331 333 - static const struct v4l2_ctrl_ops vimc_sen_ctrl_ops = { 334 - .s_ctrl = vimc_sen_s_ctrl, 332 + static const struct v4l2_ctrl_ops vimc_sensor_ctrl_ops = { 333 + .s_ctrl = vimc_sensor_s_ctrl, 335 334 }; 336 335 337 - static void vimc_sen_release(struct vimc_ent_device *ved) 336 + static void vimc_sensor_release(struct vimc_ent_device *ved) 338 337 { 339 - struct vimc_sen_device *vsen = 340 - container_of(ved, struct vimc_sen_device, ved); 338 + struct vimc_sensor_device *vsensor = 339 + container_of(ved, struct vimc_sensor_device, ved); 341 340 342 - v4l2_ctrl_handler_free(&vsen->hdl); 343 - tpg_free(&vsen->tpg); 344 - media_entity_cleanup(vsen->ved.ent); 345 - kfree(vsen); 341 + v4l2_ctrl_handler_free(&vsensor->hdl); 342 + tpg_free(&vsensor->tpg); 343 + media_entity_cleanup(vsensor->ved.ent); 344 + kfree(vsensor); 346 345 } 347 346 348 347 /* Image Processing Controls */ 349 - static const struct v4l2_ctrl_config vimc_sen_ctrl_class = { 348 + static const struct v4l2_ctrl_config vimc_sensor_ctrl_class = { 350 349 .flags = V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY, 351 350 .id = VIMC_CID_VIMC_CLASS, 352 351 .name = "VIMC Controls", 353 352 .type = V4L2_CTRL_TYPE_CTRL_CLASS, 354 353 }; 355 354 356 - static const struct v4l2_ctrl_config vimc_sen_ctrl_test_pattern = { 357 - .ops = &vimc_sen_ctrl_ops, 355 + static const struct v4l2_ctrl_config vimc_sensor_ctrl_test_pattern = { 356 + .ops = &vimc_sensor_ctrl_ops, 358 357 .id = VIMC_CID_TEST_PATTERN, 359 358 .name = "Test Pattern", 360 359 .type = V4L2_CTRL_TYPE_MENU, ··· 369 368 NULL, 370 369 }; 371 370 372 - static const struct v4l2_ctrl_config vimc_sen_ctrl_osd_mode = { 373 - .ops = &vimc_sen_ctrl_ops, 371 + static const struct v4l2_ctrl_config vimc_sensor_ctrl_osd_mode = { 372 + .ops = &vimc_sensor_ctrl_ops, 374 373 .id = VIMC_CID_OSD_TEXT_MODE, 375 374 .name = "Show Information", 376 375 .type = V4L2_CTRL_TYPE_MENU, ··· 378 377 .qmenu = vimc_ctrl_osd_mode_strings, 379 378 }; 380 379 381 - static struct vimc_ent_device *vimc_sen_add(struct vimc_device *vimc, 382 - const char *vcfg_name) 380 + static struct vimc_ent_device *vimc_sensor_add(struct vimc_device *vimc, 381 + const char *vcfg_name) 383 382 { 384 383 struct v4l2_device *v4l2_dev = &vimc->v4l2_dev; 385 - struct vimc_sen_device *vsen; 384 + struct vimc_sensor_device *vsensor; 386 385 int ret; 387 386 388 - /* Allocate the vsen struct */ 389 - vsen = kzalloc(sizeof(*vsen), GFP_KERNEL); 390 - if (!vsen) 387 + /* Allocate the vsensor struct */ 388 + vsensor = kzalloc(sizeof(*vsensor), GFP_KERNEL); 389 + if (!vsensor) 391 390 return ERR_PTR(-ENOMEM); 392 391 393 - v4l2_ctrl_handler_init(&vsen->hdl, 4); 392 + v4l2_ctrl_handler_init(&vsensor->hdl, 4); 394 393 395 - v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_class, NULL); 396 - v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_test_pattern, NULL); 397 - v4l2_ctrl_new_custom(&vsen->hdl, &vimc_sen_ctrl_osd_mode, NULL); 398 - v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, 394 + v4l2_ctrl_new_custom(&vsensor->hdl, &vimc_sensor_ctrl_class, NULL); 395 + v4l2_ctrl_new_custom(&vsensor->hdl, &vimc_sensor_ctrl_test_pattern, NULL); 396 + v4l2_ctrl_new_custom(&vsensor->hdl, &vimc_sensor_ctrl_osd_mode, NULL); 397 + v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, 399 398 V4L2_CID_VFLIP, 0, 1, 1, 0); 400 - v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, 399 + v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, 401 400 V4L2_CID_HFLIP, 0, 1, 1, 0); 402 - v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, 401 + v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, 403 402 V4L2_CID_BRIGHTNESS, 0, 255, 1, 128); 404 - v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, 403 + v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, 405 404 V4L2_CID_CONTRAST, 0, 255, 1, 128); 406 - v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, 405 + v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, 407 406 V4L2_CID_HUE, -128, 127, 1, 0); 408 - v4l2_ctrl_new_std(&vsen->hdl, &vimc_sen_ctrl_ops, 407 + v4l2_ctrl_new_std(&vsensor->hdl, &vimc_sensor_ctrl_ops, 409 408 V4L2_CID_SATURATION, 0, 255, 1, 128); 410 - vsen->sd.ctrl_handler = &vsen->hdl; 411 - if (vsen->hdl.error) { 412 - ret = vsen->hdl.error; 413 - goto err_free_vsen; 409 + vsensor->sd.ctrl_handler = &vsensor->hdl; 410 + if (vsensor->hdl.error) { 411 + ret = vsensor->hdl.error; 412 + goto err_free_vsensor; 414 413 } 415 414 416 415 /* Initialize the test pattern generator */ 417 - tpg_init(&vsen->tpg, vsen->mbus_format.width, 418 - vsen->mbus_format.height); 419 - ret = tpg_alloc(&vsen->tpg, VIMC_FRAME_MAX_WIDTH); 416 + tpg_init(&vsensor->tpg, vsensor->mbus_format.width, 417 + vsensor->mbus_format.height); 418 + ret = tpg_alloc(&vsensor->tpg, VIMC_FRAME_MAX_WIDTH); 420 419 if (ret) 421 420 goto err_free_hdl; 422 421 423 422 /* Initialize ved and sd */ 424 - vsen->pad.flags = MEDIA_PAD_FL_SOURCE; 425 - ret = vimc_ent_sd_register(&vsen->ved, &vsen->sd, v4l2_dev, 423 + vsensor->pad.flags = MEDIA_PAD_FL_SOURCE; 424 + ret = vimc_ent_sd_register(&vsensor->ved, &vsensor->sd, v4l2_dev, 426 425 vcfg_name, 427 - MEDIA_ENT_F_CAM_SENSOR, 1, &vsen->pad, 428 - &vimc_sen_ops); 426 + MEDIA_ENT_F_CAM_SENSOR, 1, &vsensor->pad, 427 + &vimc_sensor_ops); 429 428 if (ret) 430 429 goto err_free_tpg; 431 430 432 - vsen->ved.process_frame = vimc_sen_process_frame; 433 - vsen->ved.dev = vimc->mdev.dev; 431 + vsensor->ved.process_frame = vimc_sensor_process_frame; 432 + vsensor->ved.dev = vimc->mdev.dev; 434 433 435 434 /* Initialize the frame format */ 436 - vsen->mbus_format = fmt_default; 435 + vsensor->mbus_format = fmt_default; 437 436 438 - return &vsen->ved; 437 + return &vsensor->ved; 439 438 440 439 err_free_tpg: 441 - tpg_free(&vsen->tpg); 440 + tpg_free(&vsensor->tpg); 442 441 err_free_hdl: 443 - v4l2_ctrl_handler_free(&vsen->hdl); 444 - err_free_vsen: 445 - kfree(vsen); 442 + v4l2_ctrl_handler_free(&vsensor->hdl); 443 + err_free_vsensor: 444 + kfree(vsensor); 446 445 447 446 return ERR_PTR(ret); 448 447 } 449 448 450 - struct vimc_ent_type vimc_sen_type = { 451 - .add = vimc_sen_add, 452 - .release = vimc_sen_release 449 + struct vimc_ent_type vimc_sensor_type = { 450 + .add = vimc_sensor_add, 451 + .release = vimc_sensor_release 453 452 };