diff options
Diffstat (limited to 'drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c')
-rw-r--r-- | drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 7c6cf41645eb..68f08dc18da9 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -312,8 +312,7 @@ static void buffer_cleanup(struct vb2_buffer *vb) static inline bool is_capturing(struct bm2835_mmal_dev *dev) { return dev->capture.camera_port == - &dev-> - component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; } static void buffer_cb(struct vchiq_mmal_instance *instance, @@ -513,8 +512,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) msleep(300); /* enable the connection from camera to encoder (if applicable) */ - if (dev->capture.camera_port != dev->capture.port - && dev->capture.camera_port) { + if (dev->capture.camera_port != dev->capture.port && + dev->capture.camera_port) { ret = vchiq_mmal_port_enable(dev->instance, dev->capture.camera_port, NULL); if (ret) { @@ -751,8 +750,7 @@ static int vidioc_overlay(struct file *file, void *f, unsigned int on) return 0; /* already in requested state */ src = - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_PREVIEW]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_PREVIEW]; if (!on) { /* disconnect preview ports and disable component */ @@ -807,8 +805,7 @@ static int vidioc_g_fbuf(struct file *file, void *fh, */ struct bm2835_mmal_dev *dev = video_drvdata(file); struct vchiq_mmal_port *preview_port = - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_PREVIEW]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_PREVIEW]; a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY | V4L2_FBUF_CAP_GLOBAL_ALPHA; @@ -1000,8 +997,7 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, dev->capture.camera_port, NULL); dev->capture.camera_port = NULL; ret = vchiq_mmal_component_disable(dev->instance, - dev->capture. - encode_component); + dev->capture.encode_component); if (ret) v4l2_err(&dev->v4l2_dev, "Failed to disable encode component %d\n", @@ -1013,29 +1009,25 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, switch (mfmt->mmal_component) { case MMAL_COMPONENT_CAMERA: /* Make a further decision on port based on resolution */ - if (f->fmt.pix.width <= max_video_width - && f->fmt.pix.height <= max_video_height) + if (f->fmt.pix.width <= max_video_width && + f->fmt.pix.height <= max_video_height) camera_port = port = - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_VIDEO]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO]; else camera_port = port = - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_CAPTURE]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; break; case MMAL_COMPONENT_IMAGE_ENCODE: encode_component = dev->component[MMAL_COMPONENT_IMAGE_ENCODE]; port = &dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->output[0]; camera_port = - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_CAPTURE]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_CAPTURE]; break; case MMAL_COMPONENT_VIDEO_ENCODE: encode_component = dev->component[MMAL_COMPONENT_VIDEO_ENCODE]; port = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0]; camera_port = - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_VIDEO]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO]; break; default: break; @@ -1075,15 +1067,13 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev, ret = vchiq_mmal_port_set_format(dev->instance, camera_port); - if (!ret - && camera_port == - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_VIDEO]) { + if (!ret && + camera_port == + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_VIDEO]) { bool overlay_enabled = !!dev->component[MMAL_COMPONENT_PREVIEW]->enabled; struct vchiq_mmal_port *preview_port = - &dev->component[MMAL_COMPONENT_CAMERA]-> - output[MMAL_CAMERA_PORT_PREVIEW]; + &dev->component[MMAL_COMPONENT_CAMERA]->output[MMAL_CAMERA_PORT_PREVIEW]; /* Preview and encode ports need to match on resolution */ if (overlay_enabled) { /* Need to disable the overlay before we can update @@ -1501,7 +1491,6 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, struct vchiq_mmal_component *camera, struct bm2835_mmal_dev *dev) { - int ret; struct mmal_parameter_camera_config cam_config = { .max_stills_w = dev->max_width, .max_stills_h = dev->max_height, @@ -1517,10 +1506,9 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance, .use_stc_timestamp = MMAL_PARAM_TIMESTAMP_MODE_RAW_STC }; - ret = vchiq_mmal_port_parameter_set(instance, &camera->control, + return vchiq_mmal_port_parameter_set(instance, &camera->control, MMAL_PARAMETER_CAMERA_CONFIG, &cam_config, sizeof(cam_config)); - return ret; } #define MAX_SUPPORTED_ENCODINGS 20 @@ -1673,8 +1661,7 @@ static int mmal_init(struct bm2835_mmal_dev *dev) /* get the video encoder component ready */ ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode", - &dev-> - component[MMAL_COMPONENT_VIDEO_ENCODE]); + &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]); if (ret < 0) goto unreg_image_encoder; @@ -1797,12 +1784,10 @@ static void bcm2835_cleanup_instance(struct bm2835_mmal_dev *dev) dev->component[MMAL_COMPONENT_CAMERA]); vchiq_mmal_component_finalise(dev->instance, - dev-> - component[MMAL_COMPONENT_VIDEO_ENCODE]); + dev->component[MMAL_COMPONENT_VIDEO_ENCODE]); vchiq_mmal_component_finalise(dev->instance, - dev-> - component[MMAL_COMPONENT_IMAGE_ENCODE]); + dev->component[MMAL_COMPONENT_IMAGE_ENCODE]); vchiq_mmal_component_finalise(dev->instance, dev->component[MMAL_COMPONENT_PREVIEW]); |