Commit 9c85a4d0 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: bcm2835-camera: Provide more specific probe error messages

Currently there is only a catch-all info message which print the
relevant error code without any context. So add more specific error
messages in order to narrow down possible issues.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7491a9f
No related merge requests found
...@@ -1539,8 +1539,11 @@ static int mmal_init(struct bm2835_mmal_dev *dev) ...@@ -1539,8 +1539,11 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
struct vchiq_mmal_component *camera; struct vchiq_mmal_component *camera;
ret = vchiq_mmal_init(&dev->instance); ret = vchiq_mmal_init(&dev->instance);
if (ret < 0) if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: vchiq mmal init failed %d\n",
__func__, ret);
return ret; return ret;
}
/* get the camera component ready */ /* get the camera component ready */
ret = vchiq_mmal_component_init(dev->instance, "ril.camera", ret = vchiq_mmal_component_init(dev->instance, "ril.camera",
...@@ -1550,6 +1553,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev) ...@@ -1550,6 +1553,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
camera = dev->component[MMAL_COMPONENT_CAMERA]; camera = dev->component[MMAL_COMPONENT_CAMERA];
if (camera->outputs < MMAL_CAMERA_PORT_COUNT) { if (camera->outputs < MMAL_CAMERA_PORT_COUNT) {
v4l2_err(&dev->v4l2_dev, "%s: too few camera outputs %d needed %d\n",
__func__, camera->outputs, MMAL_CAMERA_PORT_COUNT);
ret = -EINVAL; ret = -EINVAL;
goto unreg_camera; goto unreg_camera;
} }
...@@ -1557,8 +1562,11 @@ static int mmal_init(struct bm2835_mmal_dev *dev) ...@@ -1557,8 +1562,11 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
ret = set_camera_parameters(dev->instance, ret = set_camera_parameters(dev->instance,
camera, camera,
dev); dev);
if (ret < 0) if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: unable to set camera parameters: %d\n",
__func__, ret);
goto unreg_camera; goto unreg_camera;
}
/* There was an error in the firmware that meant the camera component /* There was an error in the firmware that meant the camera component
* produced BGR instead of RGB. * produced BGR instead of RGB.
...@@ -1647,8 +1655,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev) ...@@ -1647,8 +1655,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) { if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) {
ret = -EINVAL; ret = -EINVAL;
pr_debug("too few input ports %d needed %d\n", v4l2_err(&dev->v4l2_dev, "%s: too few input ports %d needed %d\n",
dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1); __func__, dev->component[MMAL_COMPONENT_PREVIEW]->inputs, 1);
goto unreg_preview; goto unreg_preview;
} }
...@@ -1661,8 +1669,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev) ...@@ -1661,8 +1669,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) { if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) {
ret = -EINVAL; ret = -EINVAL;
v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", v4l2_err(&dev->v4l2_dev, "%s: too few input ports %d needed %d\n",
dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs, __func__, dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs,
1); 1);
goto unreg_image_encoder; goto unreg_image_encoder;
} }
...@@ -1676,8 +1684,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev) ...@@ -1676,8 +1684,8 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) { if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) {
ret = -EINVAL; ret = -EINVAL;
v4l2_err(&dev->v4l2_dev, "too few input ports %d needed %d\n", v4l2_err(&dev->v4l2_dev, "%s: too few input ports %d needed %d\n",
dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs, __func__, dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs,
1); 1);
goto unreg_vid_encoder; goto unreg_vid_encoder;
} }
...@@ -1706,8 +1714,11 @@ static int mmal_init(struct bm2835_mmal_dev *dev) ...@@ -1706,8 +1714,11 @@ static int mmal_init(struct bm2835_mmal_dev *dev)
sizeof(enable)); sizeof(enable));
} }
ret = bm2835_mmal_set_all_camera_controls(dev); ret = bm2835_mmal_set_all_camera_controls(dev);
if (ret < 0) if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: failed to set all camera controls: %d\n",
__func__, ret);
goto unreg_vid_encoder; goto unreg_vid_encoder;
}
return 0; return 0;
...@@ -1873,21 +1884,29 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) ...@@ -1873,21 +1884,29 @@ static int bcm2835_mmal_probe(struct platform_device *pdev)
snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name),
"%s", BM2835_MMAL_MODULE_NAME); "%s", BM2835_MMAL_MODULE_NAME);
ret = v4l2_device_register(NULL, &dev->v4l2_dev); ret = v4l2_device_register(NULL, &dev->v4l2_dev);
if (ret) if (ret) {
dev_err(&pdev->dev, "%s: could not register V4L2 device: %d\n",
__func__, ret);
goto free_dev; goto free_dev;
}
/* setup v4l controls */ /* setup v4l controls */
ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler); ret = bm2835_mmal_init_controls(dev, &dev->ctrl_handler);
if (ret < 0) if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: could not init controls: %d\n",
__func__, ret);
goto unreg_dev; goto unreg_dev;
}
dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler; dev->v4l2_dev.ctrl_handler = &dev->ctrl_handler;
/* mmal init */ /* mmal init */
dev->instance = instance; dev->instance = instance;
ret = mmal_init(dev); ret = mmal_init(dev);
if (ret < 0) if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: mmal init failed: %d\n",
__func__, ret);
goto unreg_dev; goto unreg_dev;
}
/* initialize queue */ /* initialize queue */
q = &dev->capture.vb_vidq; q = &dev->capture.vb_vidq;
memset(q, 0, sizeof(*q)); memset(q, 0, sizeof(*q));
...@@ -1905,16 +1924,19 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) ...@@ -1905,16 +1924,19 @@ static int bcm2835_mmal_probe(struct platform_device *pdev)
/* initialise video devices */ /* initialise video devices */
ret = bm2835_mmal_init_device(dev, &dev->vdev); ret = bm2835_mmal_init_device(dev, &dev->vdev);
if (ret < 0) if (ret < 0) {
v4l2_err(&dev->v4l2_dev, "%s: could not init device: %d\n",
__func__, ret);
goto unreg_dev; goto unreg_dev;
}
/* Really want to call vidioc_s_fmt_vid_cap with the default /* Really want to call vidioc_s_fmt_vid_cap with the default
* format, but currently the APIs don't join up. * format, but currently the APIs don't join up.
*/ */
ret = mmal_setup_components(dev, &default_v4l2_format); ret = mmal_setup_components(dev, &default_v4l2_format);
if (ret < 0) { if (ret < 0) {
v4l2_err(&dev->v4l2_dev, v4l2_err(&dev->v4l2_dev, "%s: could not setup components: %d\n",
"%s: could not setup components\n", __func__); __func__, ret);
goto unreg_dev; goto unreg_dev;
} }
...@@ -1938,8 +1960,6 @@ static int bcm2835_mmal_probe(struct platform_device *pdev) ...@@ -1938,8 +1960,6 @@ static int bcm2835_mmal_probe(struct platform_device *pdev)
bcm2835_cleanup_instance(gdev[i]); bcm2835_cleanup_instance(gdev[i]);
gdev[i] = NULL; gdev[i] = NULL;
} }
pr_info("%s: error %d while loading driver\n",
BM2835_MMAL_MODULE_NAME, ret);
cleanup_mmal: cleanup_mmal:
vchiq_mmal_finalise(instance); vchiq_mmal_finalise(instance);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment