Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752127AbbGaC4A (ORCPT ); Thu, 30 Jul 2015 22:56:00 -0400 Received: from eusmtp01.atmel.com ([212.144.249.242]:1907 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbbGaCz6 (ORCPT ); Thu, 30 Jul 2015 22:55:58 -0400 Message-ID: <55BAE37F.6050705@atmel.com> Date: Fri, 31 Jul 2015 10:54:55 +0800 From: Josh Wu User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Linux Media Mailing List , "Guennadi Liakhovetski" CC: Laurent Pinchart , "Mauro Carvalho Chehab" , Subject: Re: [PATCH 1/2] media: atmel-isi: setup the ISI_CFG2 register directly References: <1434537579-23417-1-git-send-email-josh.wu@atmel.com> In-Reply-To: <1434537579-23417-1-git-send-email-josh.wu@atmel.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.168.5.13] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2671 Lines: 83 Hi, list Ping..., any feedback for this series? Best Regards, Josh Wu On 6/17/2015 6:39 PM, 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. > 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); -- 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/