Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753500AbbH3J0Y (ORCPT ); Sun, 30 Aug 2015 05:26:24 -0400 Received: from mout.gmx.net ([212.227.17.22]:54575 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbbH3J0V (ORCPT ); Sun, 30 Aug 2015 05:26:21 -0400 Date: Sun, 30 Aug 2015 11:26:06 +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 2/2] media: atmel-isi: move configure_geometry() to start_streaming() In-Reply-To: <1434537579-23417-2-git-send-email-josh.wu@atmel.com> Message-ID: References: <1434537579-23417-1-git-send-email-josh.wu@atmel.com> <1434537579-23417-2-git-send-email-josh.wu@atmel.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Provags-ID: V03:K0:pMvKOBsBUaVLSUuE2UA9kugupkDT5T8bofKpOPJj4tda1ZfgJzW IxgLLppM+H9bYKgf69CUongmsCjDm0VF7sPMbw/RYSdc1bjduaW85o7SFBWD4Qx17YaZL/7 3w5hVPAdR9nVdb2Bv/tkO3Pp5xpVhSDZrnE0jLN8YOKOffEyscHJBKgjdXfRSXtV7miPzxO VWSaa2azLH1ZMVSecP9zw== X-UI-Out-Filterresults: notjunk:1;V01:K0:z0cHQH/dhUs=:sJ1mFKz8AafgoVgRgPA5uk ZmsV+S4AOf2t4Kx5TEd0Cjx1oy7zCPFfpnLROx1G4zj3bjSItjHr86eO7jzD7q+GYF+220AHr ZMjzb2012/cdg5OKGTy3ERwUenGfTq4lxPH4CRy0ofEK7GVd1njqty3OlaGlNs5pUbW1mLGuM X69TK87/kbRRDpARUAFnw26auHP80O75cVsBUUYtcTbCFiBjmNSxjzD1vNWj7BB6RMnf2qL6H LGL3bzIFUY29W+1oG/IczNgvZWPRntMS0mlaAB4amfUvlr3IEcGe2VDlEUY1/BZP6tkhy4d3O f8vqu4MYAK75AybaVvKHXDahf7/DErj86Ej864QG3Qi5pwIgd30umROsrm4B7cUyposPiFrU2 XoCPTBETYQe9eD/jlwqb+pBSITi9EsLvvTTSRvO4oUYmHaloSVxXGrJQkrL8wybRCz8jcHm9w 8cO+uh18N7P/SEVJ93xSEuTRt7RS1FC29GH3aT8DOlb+nQU01v27BM0JpDcZ/wEiDcF/+/zoN NTPH1Sl1l9E4UtCSEx8sggETwdkULyj6YmDMzo+QiNsJ22qH91niponq6jncs1aMUl15byF1H s24SijSDSxsBOq7tT5fXrLogVVcPLiDQP9Tt7irkAyQoACvNRSNi5Wh/hzeVd7a6K1l+BXT76 IEMiICTNuTdt5bOxjESxzWf78DQ74CNetlIyp1RuY6fz5c18oMW/LFaGqqD9Oq33JvT9gmOU6 eW5UFECpV64T8SOO77VCn0SNyH61d2OsKvomGQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2754 Lines: 76 Hi Josh, On Wed, 17 Jun 2015, Josh Wu wrote: > As in set_fmt() function we only need to know which format is been set, > we don't need to access the ISI hardware in this moment. > > So move the configure_geometry(), which access the ISI hardware, to > start_streaming() will make code more consistent and simpler. > > Signed-off-by: Josh Wu > --- > > drivers/media/platform/soc_camera/atmel-isi.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c > index 8bc40ca..b01086d 100644 > --- a/drivers/media/platform/soc_camera/atmel-isi.c > +++ b/drivers/media/platform/soc_camera/atmel-isi.c > @@ -390,6 +390,11 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) > /* Disable all interrupts */ > isi_writel(isi, ISI_INTDIS, (u32)~0UL); > > + ret = configure_geometry(isi, icd->user_width, icd->user_height, > + icd->current_fmt->code); > + if (ret < 0) > + return ret; No. Firstly, you'd have to pm_runtime_put() here if you fail. Secondly I think it's better to fail earlier - at S_FMT, than here. Not accessing the hardware in S_FMT is a good idea, but I'd at least do all the checking there. So, maybe add a "u32 cfg2_cr" field to struct atmel_isi, calculate it in S_FMT but only write to the hardware in start_streaming()? Thanks Guennadi > + > spin_lock_irq(&isi->lock); > /* Clear any pending interrupt */ > isi_readl(isi, ISI_STATUS); > @@ -477,8 +482,6 @@ static int isi_camera_init_videobuf(struct vb2_queue *q, > static int isi_camera_set_fmt(struct soc_camera_device *icd, > struct v4l2_format *f) > { > - struct soc_camera_host *ici = to_soc_camera_host(icd->parent); > - struct atmel_isi *isi = ici->priv; > struct v4l2_subdev *sd = soc_camera_to_subdev(icd); > const struct soc_camera_format_xlate *xlate; > struct v4l2_pix_format *pix = &f->fmt.pix; > @@ -511,16 +514,6 @@ static int isi_camera_set_fmt(struct soc_camera_device *icd, > if (mf->code != xlate->code) > return -EINVAL; > > - /* Enable PM and peripheral clock before operate isi registers */ > - pm_runtime_get_sync(ici->v4l2_dev.dev); > - > - ret = configure_geometry(isi, pix->width, pix->height, xlate->code); > - > - pm_runtime_put(ici->v4l2_dev.dev); > - > - if (ret < 0) > - return ret; > - > pix->width = mf->width; > pix->height = mf->height; > pix->field = mf->field; > -- > 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/