aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/platform/broadcom
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/broadcom')
-rw-r--r--drivers/media/platform/broadcom/Kconfig5
-rw-r--r--drivers/media/platform/broadcom/bcm2835-unicam.c47
2 files changed, 33 insertions, 19 deletions
diff --git a/drivers/media/platform/broadcom/Kconfig b/drivers/media/platform/broadcom/Kconfig
index 32b76ebfcd9a..93ba565d9a02 100644
--- a/drivers/media/platform/broadcom/Kconfig
+++ b/drivers/media/platform/broadcom/Kconfig
@@ -14,10 +14,5 @@ config VIDEO_BCM2835_UNICAM
This is a V4L2 driver that controls the CSI-2 receiver directly,
independently from the VC4 firmware.
- This driver is mutually exclusive with the use of bcm2835-camera. The
- firmware will disable all access to the peripheral from within the
- firmware if it finds a DT node using it, and bcm2835-camera will
- therefore fail to probe.
-
To compile this driver as a module, choose M here. The module will be
called bcm2835-unicam.
diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
index f10064107d54..8d28ba0b59a3 100644
--- a/drivers/media/platform/broadcom/bcm2835-unicam.c
+++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
@@ -14,10 +14,6 @@
* and TI CAL camera interface driver by
* Benoit Parrot <bparrot@ti.com>
*
- *
- * There are two camera drivers in the kernel for BCM283x - this one and
- * bcm2835-camera (currently in staging).
- *
* This driver directly controls the Unicam peripheral - there is no
* involvement with the VideoCore firmware. Unicam receives CSI-2 or CCP2 data
* and writes it into SDRAM. The only potential processing options are to
@@ -342,12 +338,12 @@ static const struct unicam_format_info unicam_image_formats[] = {
.csi_dt = MIPI_CSI2_DT_RGB565,
}, {
.fourcc = V4L2_PIX_FMT_RGB24, /* rgb */
- .code = MEDIA_BUS_FMT_RGB888_1X24,
+ .code = MEDIA_BUS_FMT_BGR888_1X24,
.depth = 24,
.csi_dt = MIPI_CSI2_DT_RGB888,
}, {
.fourcc = V4L2_PIX_FMT_BGR24, /* bgr */
- .code = MEDIA_BUS_FMT_BGR888_1X24,
+ .code = MEDIA_BUS_FMT_RGB888_1X24,
.depth = 24,
.csi_dt = MIPI_CSI2_DT_RGB888,
}, {
@@ -2148,22 +2144,45 @@ static int unicam_video_link_validate(struct media_link *link)
const struct v4l2_pix_format *fmt = &node->fmt.fmt.pix;
const struct unicam_format_info *fmtinfo;
- fmtinfo = unicam_find_format_by_fourcc(fmt->pixelformat,
- UNICAM_SD_PAD_SOURCE_IMAGE);
+ fmtinfo = unicam_find_format_by_code(format->code,
+ UNICAM_SD_PAD_SOURCE_IMAGE);
if (WARN_ON(!fmtinfo)) {
ret = -EPIPE;
goto out;
}
- if (fmtinfo->code != format->code ||
- fmt->height != format->height ||
+ /*
+ * Unicam initially associated BGR24 to BGR888_1X24 and RGB24 to
+ * RGB888_1X24.
+ *
+ * In order to allow the applications using the old behaviour to
+ * run, let's accept the old combination, but warn about it.
+ */
+ if (fmtinfo->fourcc != fmt->pixelformat) {
+ if ((fmt->pixelformat == V4L2_PIX_FMT_BGR24 &&
+ format->code == MEDIA_BUS_FMT_BGR888_1X24) ||
+ (fmt->pixelformat == V4L2_PIX_FMT_RGB24 &&
+ format->code == MEDIA_BUS_FMT_RGB888_1X24)) {
+ dev_warn_once(node->dev->dev,
+ "Incorrect pixel format %p4cc for 0x%04x. Fix your application to use %p4cc.\n",
+ &fmt->pixelformat, format->code, &fmtinfo->fourcc);
+ } else {
+ dev_dbg(node->dev->dev,
+ "image: format mismatch: 0x%04x <=> %p4cc\n",
+ format->code, &fmt->pixelformat);
+ ret = -EPIPE;
+ goto out;
+ }
+ }
+
+ if (fmt->height != format->height ||
fmt->width != format->width ||
fmt->field != format->field) {
dev_dbg(node->dev->dev,
- "image: (%u x %u) 0x%08x %s != (%u x %u) 0x%08x %s\n",
- fmt->width, fmt->height, fmtinfo->code,
+ "image: (%u x %u) %s != (%u x %u) %s\n",
+ fmt->width, fmt->height,
v4l2_field_names[fmt->field],
- format->width, format->height, format->code,
+ format->width, format->height,
v4l2_field_names[format->field]);
ret = -EPIPE;
}
@@ -2642,7 +2661,7 @@ static int unicam_probe(struct platform_device *pdev)
struct unicam_device *unicam;
int ret;
- unicam = kzalloc(sizeof(*unicam), GFP_KERNEL);
+ unicam = kzalloc_obj(*unicam);
if (!unicam)
return -ENOMEM;