Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347AbbH3ItJ (ORCPT ); Sun, 30 Aug 2015 04:49:09 -0400 Received: from mout.gmx.net ([212.227.15.15]:59633 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbbH3ItH (ORCPT ); Sun, 30 Aug 2015 04:49:07 -0400 Date: Sun, 30 Aug 2015 10:48:49 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Josh Wu cc: Linux Media Mailing List , Laurent Pinchart , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] media: atmel-isi: setup the ISI_CFG2 register directly In-Reply-To: <1434537579-23417-1-git-send-email-josh.wu@atmel.com> Message-ID: References: <1434537579-23417-1-git-send-email-josh.wu@atmel.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Provags-ID: V03:K0:Qr5gPVixeWXeUrT/N7rq7t7k65d+NQ9VR3ErVdS6w0xiG3yOwbz R78NNxxLU+KmLy8FhgX/bg1GUgs2cwT8SLNPFB07x8sh12ILGo4Lrce/lC9eHmsa9oEA+RA ta/gOMS85w0kJSs7Pkcs/4EBvyQn/OiVpAOyH6DHgPfO37d+Q+NREzibRm8/YAqGArpmXIy 6Zd68vpGocDByCxsn6kmg== X-UI-Out-Filterresults: notjunk:1;V01:K0:NgOFJe/5qxo=:zzwuNeEOd2oNX4w0OuoU38 dIsoX9i8ZxCkJujhCL/htP6B+3o7A2BmF+bRS+I+kayfV3sXYWLtXNhpHHG7AvpgqYKZaEKic m7xtzFiUg3HLVo3BWIhvU+GF76OelXj/AaTGVvX7d/ixbEsk4MtagQF8k2eKjGAE2Rcrqov/C KPa0eaoncqA4hNp8UcM78KbhYm/EJyixORAjgxb8Yh7cSRzLKtphgc5Mn0TKuAdWla0aKdkCC sG+LldU2tlCg2b1720a3a4Q45uimuiGHE88ixo1GzJnxac7xTHcigF7pnR9B3lX4Qx+oVupjA e23/6aC2ORPlhbD7q01wvy+W7itkpvfCQdZedfCc5vJ3M+dJS2sgVli1IDizgw5Aaqke6N43a IUIHRq+gpUUwTn9ygLzVUvUKdYB42GRz4WBLngtWTXWoqW58nv3U9uRm1OnCi8ulYLPpK/IQs ZjjSVfRYOt2blrlKEGiCBTU0z9DNlhJ9V1zUDf0Iu8Ww8C9IDuZOFdfWM/d5AXhExqnUNORLz 3xvwBM08ETPnXQTM1QLw00phfyKoqU1sXlD3mDWYsyZf+YMCyTKDm7SIFLSNg1BJF7NhHOhFz Yz46VaSZA7tkXNyxcDc0wSAxqKYAAr7RFv3kKfEfp0NIVt7HBbPEXccRmmH7ymZIntr2+5oA2 MTgbqP3VTugeEkdWXC6WsWhWDFo9e5V7ArrYZ4a2ZU5GdeqSjFyD9TFgZ/f8NN5d44b+A4Toj puhQtXEjUG+/AQik/DAeemRkxs7ARtO5klYjag== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3617 Lines: 100 Hi Josh, On Wed, 17 Jun 2015, Josh Wu wrote: > In the function configure_geometry(), we will setup the ISI CFG2 > according to the sensor output format. > > It make no sense to just read back the CFG2 register and just set part > of it. > > So just set up this register directly makes things simpler. Simpler doesn't necessarily mean better or more correct:) There are other fields in that register and currently the driver preserves them, with this patch you overwrite them with 0. 0 happens to be the reset value of that register. So, you should at least mention that in this patch description, just saying "simpler" doesn't convince me. So, at least I'd modify that, I can do that myself. But in general I'm not even sure why this patch is needed. Yes, currently those fields of that register are unused, so, we can assume they stay at their reset values. But firstly the hardware can change and at some point the reset value can change, or those other fields will get set indirectly by something. Or the driver will change at some point to support more fields of that register and then this code will have to be changed again. So, I'd ask you again - do you really want this patch? If you insist - I'll take it, but I'd add the "reset value" reasoning. Otherwise maybe just drop it? Thanks Guennadi > Currently only support YUV format from camera sensor. > > Signed-off-by: Josh Wu > --- > > drivers/media/platform/soc_camera/atmel-isi.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c > index 9070172..8bc40ca 100644 > --- a/drivers/media/platform/soc_camera/atmel-isi.c > +++ b/drivers/media/platform/soc_camera/atmel-isi.c > @@ -105,24 +105,25 @@ static u32 isi_readl(struct atmel_isi *isi, u32 reg) > static int configure_geometry(struct atmel_isi *isi, u32 width, > u32 height, u32 code) > { > - u32 cfg2, cr; > + u32 cfg2; > > + /* According to sensor's output format to set cfg2 */ > switch (code) { > /* YUV, including grey */ > case MEDIA_BUS_FMT_Y8_1X8: > - cr = ISI_CFG2_GRAYSCALE; > + cfg2 = ISI_CFG2_GRAYSCALE; > break; > case MEDIA_BUS_FMT_VYUY8_2X8: > - cr = ISI_CFG2_YCC_SWAP_MODE_3; > + cfg2 = ISI_CFG2_YCC_SWAP_MODE_3; > break; > case MEDIA_BUS_FMT_UYVY8_2X8: > - cr = ISI_CFG2_YCC_SWAP_MODE_2; > + cfg2 = ISI_CFG2_YCC_SWAP_MODE_2; > break; > case MEDIA_BUS_FMT_YVYU8_2X8: > - cr = ISI_CFG2_YCC_SWAP_MODE_1; > + cfg2 = ISI_CFG2_YCC_SWAP_MODE_1; > break; > case MEDIA_BUS_FMT_YUYV8_2X8: > - cr = ISI_CFG2_YCC_SWAP_DEFAULT; > + cfg2 = ISI_CFG2_YCC_SWAP_DEFAULT; > break; > /* RGB, TODO */ > default: > @@ -130,17 +131,10 @@ static int configure_geometry(struct atmel_isi *isi, u32 width, > } > > isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); > - > - cfg2 = isi_readl(isi, ISI_CFG2); > - /* Set YCC swap mode */ > - cfg2 &= ~ISI_CFG2_YCC_SWAP_MODE_MASK; > - cfg2 |= cr; > /* Set width */ > - cfg2 &= ~(ISI_CFG2_IM_HSIZE_MASK); > cfg2 |= ((width - 1) << ISI_CFG2_IM_HSIZE_OFFSET) & > ISI_CFG2_IM_HSIZE_MASK; > /* Set height */ > - cfg2 &= ~(ISI_CFG2_IM_VSIZE_MASK); > cfg2 |= ((height - 1) << ISI_CFG2_IM_VSIZE_OFFSET) > & ISI_CFG2_IM_VSIZE_MASK; > isi_writel(isi, ISI_CFG2, cfg2); > -- > 1.9.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/