Message ID | 1442898875-7147-6-git-send-email-josh.wu@atmel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Guennadi Liakhovetski |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1ZeFt1-00063F-TX; Tue, 22 Sep 2015 07:13:03 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-6) with esmtp id 1ZeFsz-0008Rn-6I; Tue, 22 Sep 2015 07:13:03 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757552AbbIVFNA (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 22 Sep 2015 01:13:00 -0400 Received: from nasmtp01.atmel.com ([192.199.1.245]:58062 "EHLO DVREDG01.corp.atmel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756520AbbIVFM7 (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 22 Sep 2015 01:12:59 -0400 Received: from apsmtp01.atmel.com (10.168.254.31) by DVREDG01.corp.atmel.com (10.42.103.30) with Microsoft SMTP Server (TLS) id 14.3.235.1; Mon, 21 Sep 2015 23:12:55 -0600 Received: from melon.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.3.235.1; Tue, 22 Sep 2015 13:11:04 +0800 From: Josh Wu <josh.wu@atmel.com> To: Linux Media Mailing List <linux-media@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, Guennadi Liakhovetski <g.liakhovetski@gmx.de> CC: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Josh Wu <josh.wu@atmel.com> Subject: [PATCH 5/5] media: atmel-isi: support RGB565 output when sensor output YUV formats Date: Tue, 22 Sep 2015 13:14:34 +0800 Message-ID: <1442898875-7147-6-git-send-email-josh.wu@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442898875-7147-1-git-send-email-josh.wu@atmel.com> References: <1442898875-7147-1-git-send-email-josh.wu@atmel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.9.22.50617 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_URI_HTTPS 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __DATE_TZ_HK 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
Josh Wu
Sept. 22, 2015, 5:14 a.m. UTC
This patch enable Atmel ISI preview path to convert the YUV to RGB format.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
drivers/media/platform/soc_camera/atmel-isi.c | 38 ++++++++++++++++++++-------
1 file changed, 29 insertions(+), 9 deletions(-)
Comments
On Tue, 22 Sep 2015, Josh Wu wrote: > This patch enable Atmel ISI preview path to convert the YUV to RGB format. > > Signed-off-by: Josh Wu <josh.wu@atmel.com> > --- > > drivers/media/platform/soc_camera/atmel-isi.c | 38 ++++++++++++++++++++------- > 1 file changed, 29 insertions(+), 9 deletions(-) > > diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c > index e87d354..e33a16a 100644 > --- a/drivers/media/platform/soc_camera/atmel-isi.c > +++ b/drivers/media/platform/soc_camera/atmel-isi.c > @@ -201,13 +201,20 @@ static bool is_supported(struct soc_camera_device *icd, > case V4L2_PIX_FMT_UYVY: > case V4L2_PIX_FMT_YVYU: > case V4L2_PIX_FMT_VYUY: > + /* RGB */ > + case V4L2_PIX_FMT_RGB565: > return true; > - /* RGB, TODO */ > default: > return false; > } > } > > +static bool is_output_rgb(const struct soc_mbus_pixelfmt *host_fmt) > +{ > + return host_fmt->fourcc == V4L2_PIX_FMT_RGB565 || > + host_fmt->fourcc == V4L2_PIX_FMT_RGB32; > +} > + Why not just pass fourcc to this function? Or maybe just embed it in start_streaming - it won't clutter it a lot. > static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) > { > if (isi->active) { > @@ -467,6 +474,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) > struct atmel_isi *isi = ici->priv; > int ret; > > + isi->enable_preview_path = is_output_rgb(icd->current_fmt->host_fmt); > + > pm_runtime_get_sync(ici->v4l2_dev.dev); > > /* Reset ISI */ > @@ -688,6 +697,14 @@ static const struct soc_mbus_pixelfmt isi_camera_formats[] = { > .order = SOC_MBUS_ORDER_LE, > .layout = SOC_MBUS_LAYOUT_PACKED, > }, > + { > + .fourcc = V4L2_PIX_FMT_RGB565, > + .name = "RGB565", > + .bits_per_sample = 8, > + .packing = SOC_MBUS_PACKING_2X8_PADHI, > + .order = SOC_MBUS_ORDER_LE, > + .layout = SOC_MBUS_LAYOUT_PACKED, > + }, > }; > > /* This will be corrected as we get more formats */ > @@ -744,7 +761,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, > struct soc_camera_format_xlate *xlate) > { > struct v4l2_subdev *sd = soc_camera_to_subdev(icd); > - int formats = 0, ret; > + int formats = 0, ret, i, n; > /* sensor format */ > struct v4l2_subdev_mbus_code_enum code = { > .which = V4L2_SUBDEV_FORMAT_ACTIVE, > @@ -778,13 +795,16 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, > case MEDIA_BUS_FMT_VYUY8_2X8: > case MEDIA_BUS_FMT_YUYV8_2X8: > case MEDIA_BUS_FMT_YVYU8_2X8: > - formats++; > - if (xlate) { > - xlate->host_fmt = &isi_camera_formats[0]; > - xlate->code = code.code; > - xlate++; > - dev_dbg(icd->parent, "Providing format %s using code %d\n", > - isi_camera_formats[0].name, code.code); > + n = ARRAY_SIZE(isi_camera_formats); > + formats += n; > + for (i = 0; i < n; i++) { > + if (xlate) { I'd put if outside of the loop, or just do + for (i = 0; xlate && i < n; i++) { > + xlate->host_fmt = &isi_camera_formats[i]; > + xlate->code = code.code; > + dev_dbg(icd->parent, "Providing format %s using code %d\n", > + isi_camera_formats[0].name, code.code); > + xlate++; > + } > } > break; > default: > -- > 1.9.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Dear Guennadi, Thanks for the review. On 10/5/2015 1:02 AM, Guennadi Liakhovetski wrote: > On Tue, 22 Sep 2015, Josh Wu wrote: > >> This patch enable Atmel ISI preview path to convert the YUV to RGB format. >> >> Signed-off-by: Josh Wu <josh.wu@atmel.com> >> --- >> >> drivers/media/platform/soc_camera/atmel-isi.c | 38 ++++++++++++++++++++------- >> 1 file changed, 29 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c >> index e87d354..e33a16a 100644 >> --- a/drivers/media/platform/soc_camera/atmel-isi.c >> +++ b/drivers/media/platform/soc_camera/atmel-isi.c >> @@ -201,13 +201,20 @@ static bool is_supported(struct soc_camera_device *icd, >> case V4L2_PIX_FMT_UYVY: >> case V4L2_PIX_FMT_YVYU: >> case V4L2_PIX_FMT_VYUY: >> + /* RGB */ >> + case V4L2_PIX_FMT_RGB565: >> return true; >> - /* RGB, TODO */ >> default: >> return false; >> } >> } >> >> +static bool is_output_rgb(const struct soc_mbus_pixelfmt *host_fmt) >> +{ >> + return host_fmt->fourcc == V4L2_PIX_FMT_RGB565 || >> + host_fmt->fourcc == V4L2_PIX_FMT_RGB32; >> +} >> + > Why not just pass fourcc to this function? Or maybe just embed it in > start_streaming - it won't clutter it a lot. I think pass fourcc to the function is good. Since configure_geometry() is hardware related, and the enable_preview_path is also hardware related, so I prefer initialize enable_preview_path in configure_geometry(). > >> static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) >> { >> if (isi->active) { >> @@ -467,6 +474,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) >> struct atmel_isi *isi = ici->priv; >> int ret; >> >> + isi->enable_preview_path = is_output_rgb(icd->current_fmt->host_fmt); >> + >> pm_runtime_get_sync(ici->v4l2_dev.dev); >> >> /* Reset ISI */ >> @@ -688,6 +697,14 @@ static const struct soc_mbus_pixelfmt isi_camera_formats[] = { >> .order = SOC_MBUS_ORDER_LE, >> .layout = SOC_MBUS_LAYOUT_PACKED, >> }, >> + { >> + .fourcc = V4L2_PIX_FMT_RGB565, >> + .name = "RGB565", >> + .bits_per_sample = 8, >> + .packing = SOC_MBUS_PACKING_2X8_PADHI, >> + .order = SOC_MBUS_ORDER_LE, >> + .layout = SOC_MBUS_LAYOUT_PACKED, >> + }, >> }; >> >> /* This will be corrected as we get more formats */ >> @@ -744,7 +761,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, >> struct soc_camera_format_xlate *xlate) >> { >> struct v4l2_subdev *sd = soc_camera_to_subdev(icd); >> - int formats = 0, ret; >> + int formats = 0, ret, i, n; >> /* sensor format */ >> struct v4l2_subdev_mbus_code_enum code = { >> .which = V4L2_SUBDEV_FORMAT_ACTIVE, >> @@ -778,13 +795,16 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, >> case MEDIA_BUS_FMT_VYUY8_2X8: >> case MEDIA_BUS_FMT_YUYV8_2X8: >> case MEDIA_BUS_FMT_YVYU8_2X8: >> - formats++; >> - if (xlate) { >> - xlate->host_fmt = &isi_camera_formats[0]; >> - xlate->code = code.code; >> - xlate++; >> - dev_dbg(icd->parent, "Providing format %s using code %d\n", >> - isi_camera_formats[0].name, code.code); >> + n = ARRAY_SIZE(isi_camera_formats); >> + formats += n; >> + for (i = 0; i < n; i++) { >> + if (xlate) { > I'd put if outside of the loop, or just do > > + for (i = 0; xlate && i < n; i++) { yes, that simpler one. I'll take it. Thanks. Best Regards, Josh Wu > > >> + xlate->host_fmt = &isi_camera_formats[i]; >> + xlate->code = code.code; >> + dev_dbg(icd->parent, "Providing format %s using code %d\n", >> + isi_camera_formats[0].name, code.code); >> + xlate++; >> + } >> } >> break; >> default: >> -- >> 1.9.1 >> -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Josh, On Wed, 14 Oct 2015, Josh Wu wrote: > Dear Guennadi, > > Thanks for the review. > > On 10/5/2015 1:02 AM, Guennadi Liakhovetski wrote: > > On Tue, 22 Sep 2015, Josh Wu wrote: > > > > > This patch enable Atmel ISI preview path to convert the YUV to RGB format. > > > > > > Signed-off-by: Josh Wu <josh.wu@atmel.com> > > > --- > > > > > > drivers/media/platform/soc_camera/atmel-isi.c | 38 > > > ++++++++++++++++++++------- > > > 1 file changed, 29 insertions(+), 9 deletions(-) > > > > > > diff --git a/drivers/media/platform/soc_camera/atmel-isi.c > > > b/drivers/media/platform/soc_camera/atmel-isi.c > > > index e87d354..e33a16a 100644 > > > --- a/drivers/media/platform/soc_camera/atmel-isi.c > > > +++ b/drivers/media/platform/soc_camera/atmel-isi.c > > > @@ -201,13 +201,20 @@ static bool is_supported(struct soc_camera_device > > > *icd, > > > case V4L2_PIX_FMT_UYVY: > > > case V4L2_PIX_FMT_YVYU: > > > case V4L2_PIX_FMT_VYUY: > > > + /* RGB */ > > > + case V4L2_PIX_FMT_RGB565: > > > return true; > > > - /* RGB, TODO */ > > > default: > > > return false; > > > } > > > } > > > +static bool is_output_rgb(const struct soc_mbus_pixelfmt *host_fmt) > > > +{ > > > + return host_fmt->fourcc == V4L2_PIX_FMT_RGB565 || > > > + host_fmt->fourcc == V4L2_PIX_FMT_RGB32; > > > +} > > > + > > Why not just pass fourcc to this function? Or maybe just embed it in > > start_streaming - it won't clutter it a lot. > > I think pass fourcc to the function is good. > Since configure_geometry() is hardware related, and the enable_preview_path is > also hardware related, so I prefer initialize enable_preview_path in > configure_geometry(). But you don't, you do it in start_streaming() below. But actually my comment was not about _where_ to do it, but whether this calculation is worth a separate function. I would just perform this calculation directly where you're calling it: static ... start_streaming(...) { ... u32 fourcc = icd->current_fmt->host_fmt->fourcc; isi->enable_preview_path = fourcc == V4L2_PIX_FMT_RGB565 || fourcc == V4L2_PIX_FMT_RGB32; Thanks Guennadi > > > static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) > > > { > > > if (isi->active) { > > > @@ -467,6 +474,8 @@ static int start_streaming(struct vb2_queue *vq, > > > unsigned int count) > > > struct atmel_isi *isi = ici->priv; > > > int ret; > > > + isi->enable_preview_path = is_output_rgb(icd->current_fmt->host_fmt); > > > + > > > pm_runtime_get_sync(ici->v4l2_dev.dev); > > > /* Reset ISI */ > > > @@ -688,6 +697,14 @@ static const struct soc_mbus_pixelfmt > > > isi_camera_formats[] = { > > > .order = SOC_MBUS_ORDER_LE, > > > .layout = SOC_MBUS_LAYOUT_PACKED, > > > }, > > > + { > > > + .fourcc = V4L2_PIX_FMT_RGB565, > > > + .name = "RGB565", > > > + .bits_per_sample = 8, > > > + .packing = SOC_MBUS_PACKING_2X8_PADHI, > > > + .order = SOC_MBUS_ORDER_LE, > > > + .layout = SOC_MBUS_LAYOUT_PACKED, > > > + }, > > > }; > > > /* This will be corrected as we get more formats */ > > > @@ -744,7 +761,7 @@ static int isi_camera_get_formats(struct > > > soc_camera_device *icd, > > > struct soc_camera_format_xlate *xlate) > > > { > > > struct v4l2_subdev *sd = soc_camera_to_subdev(icd); > > > - int formats = 0, ret; > > > + int formats = 0, ret, i, n; > > > /* sensor format */ > > > struct v4l2_subdev_mbus_code_enum code = { > > > .which = V4L2_SUBDEV_FORMAT_ACTIVE, > > > @@ -778,13 +795,16 @@ static int isi_camera_get_formats(struct > > > soc_camera_device *icd, > > > case MEDIA_BUS_FMT_VYUY8_2X8: > > > case MEDIA_BUS_FMT_YUYV8_2X8: > > > case MEDIA_BUS_FMT_YVYU8_2X8: > > > - formats++; > > > - if (xlate) { > > > - xlate->host_fmt = &isi_camera_formats[0]; > > > - xlate->code = code.code; > > > - xlate++; > > > - dev_dbg(icd->parent, "Providing format %s using code > > > %d\n", > > > - isi_camera_formats[0].name, code.code); > > > + n = ARRAY_SIZE(isi_camera_formats); > > > + formats += n; > > > + for (i = 0; i < n; i++) { > > > + if (xlate) { > > I'd put if outside of the loop, or just do > > > > + for (i = 0; xlate && i < n; i++) { > > yes, that simpler one. I'll take it. Thanks. > > Best Regards, > Josh Wu > > > > > > > + xlate->host_fmt = &isi_camera_formats[i]; > > > + xlate->code = code.code; > > > + dev_dbg(icd->parent, "Providing format %s > > > using code %d\n", > > > + isi_camera_formats[0].name, > > > code.code); > > > + xlate++; > > > + } > > > } > > > break; > > > default: > > > -- > > > 1.9.1 > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Dear Guennadi, On 10/19/2015 10:03 AM, Guennadi Liakhovetski wrote: > Hi Josh, > > On Wed, 14 Oct 2015, Josh Wu wrote: > >> Dear Guennadi, >> >> Thanks for the review. >> >> On 10/5/2015 1:02 AM, Guennadi Liakhovetski wrote: >>> On Tue, 22 Sep 2015, Josh Wu wrote: >>> >>>> This patch enable Atmel ISI preview path to convert the YUV to RGB format. >>>> >>>> Signed-off-by: Josh Wu <josh.wu@atmel.com> >>>> --- >>>> >>>> drivers/media/platform/soc_camera/atmel-isi.c | 38 >>>> ++++++++++++++++++++------- >>>> 1 file changed, 29 insertions(+), 9 deletions(-) >>>> >>>> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c >>>> b/drivers/media/platform/soc_camera/atmel-isi.c >>>> index e87d354..e33a16a 100644 >>>> --- a/drivers/media/platform/soc_camera/atmel-isi.c >>>> +++ b/drivers/media/platform/soc_camera/atmel-isi.c >>>> @@ -201,13 +201,20 @@ static bool is_supported(struct soc_camera_device >>>> *icd, >>>> case V4L2_PIX_FMT_UYVY: >>>> case V4L2_PIX_FMT_YVYU: >>>> case V4L2_PIX_FMT_VYUY: >>>> + /* RGB */ >>>> + case V4L2_PIX_FMT_RGB565: >>>> return true; >>>> - /* RGB, TODO */ >>>> default: >>>> return false; >>>> } >>>> } >>>> +static bool is_output_rgb(const struct soc_mbus_pixelfmt *host_fmt) >>>> +{ >>>> + return host_fmt->fourcc == V4L2_PIX_FMT_RGB565 || >>>> + host_fmt->fourcc == V4L2_PIX_FMT_RGB32; >>>> +} >>>> + >>> Why not just pass fourcc to this function? Or maybe just embed it in >>> start_streaming - it won't clutter it a lot. >> I think pass fourcc to the function is good. >> Since configure_geometry() is hardware related, and the enable_preview_path is >> also hardware related, so I prefer initialize enable_preview_path in >> configure_geometry(). > But you don't, you do it in start_streaming() below. Right, then I'll move it to configure_geometry() in v2.. > But actually my > comment was not about _where_ to do it, but whether this calculation is > worth a separate function. I would just perform this calculation directly > where you're calling it: > > static ... start_streaming(...) > { > ... > u32 fourcc = icd->current_fmt->host_fmt->fourcc; > > isi->enable_preview_path = fourcc == V4L2_PIX_FMT_RGB565 || > fourcc == V4L2_PIX_FMT_RGB32; I thought this "function" might be called in other place, but actually no one call it. So yes, I think there is no need to have such separated function. I'll fix it in v2. Thanks. Best Regards, Josh Wu > > Thanks > Guennadi > >>>> static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) >>>> { >>>> if (isi->active) { >>>> @@ -467,6 +474,8 @@ static int start_streaming(struct vb2_queue *vq, >>>> unsigned int count) >>>> struct atmel_isi *isi = ici->priv; >>>> int ret; >>>> + isi->enable_preview_path = is_output_rgb(icd->current_fmt->host_fmt); >>>> + >>>> pm_runtime_get_sync(ici->v4l2_dev.dev); >>>> /* Reset ISI */ >>>> @@ -688,6 +697,14 @@ static const struct soc_mbus_pixelfmt >>>> isi_camera_formats[] = { >>>> .order = SOC_MBUS_ORDER_LE, >>>> .layout = SOC_MBUS_LAYOUT_PACKED, >>>> }, >>>> + { >>>> + .fourcc = V4L2_PIX_FMT_RGB565, >>>> + .name = "RGB565", >>>> + .bits_per_sample = 8, >>>> + .packing = SOC_MBUS_PACKING_2X8_PADHI, >>>> + .order = SOC_MBUS_ORDER_LE, >>>> + .layout = SOC_MBUS_LAYOUT_PACKED, >>>> + }, >>>> }; >>>> /* This will be corrected as we get more formats */ >>>> @@ -744,7 +761,7 @@ static int isi_camera_get_formats(struct >>>> soc_camera_device *icd, >>>> struct soc_camera_format_xlate *xlate) >>>> { >>>> struct v4l2_subdev *sd = soc_camera_to_subdev(icd); >>>> - int formats = 0, ret; >>>> + int formats = 0, ret, i, n; >>>> /* sensor format */ >>>> struct v4l2_subdev_mbus_code_enum code = { >>>> .which = V4L2_SUBDEV_FORMAT_ACTIVE, >>>> @@ -778,13 +795,16 @@ static int isi_camera_get_formats(struct >>>> soc_camera_device *icd, >>>> case MEDIA_BUS_FMT_VYUY8_2X8: >>>> case MEDIA_BUS_FMT_YUYV8_2X8: >>>> case MEDIA_BUS_FMT_YVYU8_2X8: >>>> - formats++; >>>> - if (xlate) { >>>> - xlate->host_fmt = &isi_camera_formats[0]; >>>> - xlate->code = code.code; >>>> - xlate++; >>>> - dev_dbg(icd->parent, "Providing format %s using code >>>> %d\n", >>>> - isi_camera_formats[0].name, code.code); >>>> + n = ARRAY_SIZE(isi_camera_formats); >>>> + formats += n; >>>> + for (i = 0; i < n; i++) { >>>> + if (xlate) { >>> I'd put if outside of the loop, or just do >>> >>> + for (i = 0; xlate && i < n; i++) { >> yes, that simpler one. I'll take it. Thanks. >> >> Best Regards, >> Josh Wu >>> >>>> + xlate->host_fmt = &isi_camera_formats[i]; >>>> + xlate->code = code.code; >>>> + dev_dbg(icd->parent, "Providing format %s >>>> using code %d\n", >>>> + isi_camera_formats[0].name, >>>> code.code); >>>> + xlate++; >>>> + } >>>> } >>>> break; >>>> default: >>>> -- >>>> 1.9.1 >>>> -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index e87d354..e33a16a 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -201,13 +201,20 @@ static bool is_supported(struct soc_camera_device *icd, case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_YVYU: case V4L2_PIX_FMT_VYUY: + /* RGB */ + case V4L2_PIX_FMT_RGB565: return true; - /* RGB, TODO */ default: return false; } } +static bool is_output_rgb(const struct soc_mbus_pixelfmt *host_fmt) +{ + return host_fmt->fourcc == V4L2_PIX_FMT_RGB565 || + host_fmt->fourcc == V4L2_PIX_FMT_RGB32; +} + static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi) { if (isi->active) { @@ -467,6 +474,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) struct atmel_isi *isi = ici->priv; int ret; + isi->enable_preview_path = is_output_rgb(icd->current_fmt->host_fmt); + pm_runtime_get_sync(ici->v4l2_dev.dev); /* Reset ISI */ @@ -688,6 +697,14 @@ static const struct soc_mbus_pixelfmt isi_camera_formats[] = { .order = SOC_MBUS_ORDER_LE, .layout = SOC_MBUS_LAYOUT_PACKED, }, + { + .fourcc = V4L2_PIX_FMT_RGB565, + .name = "RGB565", + .bits_per_sample = 8, + .packing = SOC_MBUS_PACKING_2X8_PADHI, + .order = SOC_MBUS_ORDER_LE, + .layout = SOC_MBUS_LAYOUT_PACKED, + }, }; /* This will be corrected as we get more formats */ @@ -744,7 +761,7 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, struct soc_camera_format_xlate *xlate) { struct v4l2_subdev *sd = soc_camera_to_subdev(icd); - int formats = 0, ret; + int formats = 0, ret, i, n; /* sensor format */ struct v4l2_subdev_mbus_code_enum code = { .which = V4L2_SUBDEV_FORMAT_ACTIVE, @@ -778,13 +795,16 @@ static int isi_camera_get_formats(struct soc_camera_device *icd, case MEDIA_BUS_FMT_VYUY8_2X8: case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YVYU8_2X8: - formats++; - if (xlate) { - xlate->host_fmt = &isi_camera_formats[0]; - xlate->code = code.code; - xlate++; - dev_dbg(icd->parent, "Providing format %s using code %d\n", - isi_camera_formats[0].name, code.code); + n = ARRAY_SIZE(isi_camera_formats); + formats += n; + for (i = 0; i < n; i++) { + if (xlate) { + xlate->host_fmt = &isi_camera_formats[i]; + xlate->code = code.code; + dev_dbg(icd->parent, "Providing format %s using code %d\n", + isi_camera_formats[0].name, code.code); + xlate++; + } } break; default: