linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* NPE with atmel-isc when using the ov5640 driver
@ 2018-10-29 13:55 Martin Townsend
  0 siblings, 0 replies; only message in thread
From: Martin Townsend @ 2018-10-29 13:55 UTC (permalink / raw)
  To: linux-media

Hi,

Apologies if this is the wrong mailing list and if so could you advise
me on the correct one.

I'm trying to use the OmniVision ov5640 camera sensor with the ATMEL
SAMA5D2 using it's Image Sensor Controller (ISC).  I've seen a link
where they have this controller working with the ov7670 and ov7740.
But when I try and use with the OV5640 I get a NULL pointer
dereference on boot.  After debugging I found that it was due to the
atmel ISC driver assuming that isc->raw_fmt would be set.  It looks
like it should be set in isc_formats_init but the OV5640 doesn't have
any formats that match the formats in ISC where FMT_FLAG_RAW_FORMAT is
set and hence isc->raw_fmt is NULL.

In the OV5640 driver it has the following list
static const struct ov5640_pixfmt ov5640_formats[] = {
{ MEDIA_BUS_FMT_JPEG_1X8, V4L2_COLORSPACE_JPEG, },
{ MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_SRGB, },
{ MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_SRGB, },
{ MEDIA_BUS_FMT_RGB565_2X8_LE, V4L2_COLORSPACE_SRGB, },
{ MEDIA_BUS_FMT_RGB565_2X8_BE, V4L2_COLORSPACE_SRGB, },
};

and ISC matches MEDIA_BUS_FMT_YUYV8_2X8
{
.fourcc = V4L2_PIX_FMT_YUYV,
.mbus_code = MEDIA_BUS_FMT_YUYV8_2X8,
.flags = FMT_FLAG_FROM_CONTROLLER |
  FMT_FLAG_FROM_SENSOR,
.bpp = 16,
},

but that seems about all it does match.  Then in the ISC driver there
are quite a few cases where sensor_is_preferred is called but it goes
down the RAW format case
e.g.
if (sensor_is_preferred(isc_fmt))
   fse.code = isc_fmt->mbus_code;
else
   fse.code = isc->raw_fmt->mbus_code;

would run fse.code = isc->raw_fmt->mbus_code; and raise a NPE.  I
debugged sensor_is_preferred and it was because isc_fmt->sd_support is
false.

I notice that the ov7760 driver matches a format that has
FMT_FLAG_RAW_FROM_SENSOR so this is probably why it works.

My question is should the ov5640 driver be modified to include a
format where FMT_FLAG_RAW_FROM_SENSOR is set, or should the Atmel ISC
driver be modified to handle drivers where there is no match for a Raw
Format?

Many Thanks in Advance,
Martin.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-29 22:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29 13:55 NPE with atmel-isc when using the ov5640 driver Martin Townsend

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).