Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753317AbbH3KRF (ORCPT ); Sun, 30 Aug 2015 06:17:05 -0400 Received: from mout.gmx.net ([212.227.15.18]:64591 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752246AbbH3KRD (ORCPT ); Sun, 30 Aug 2015 06:17:03 -0400 Date: Sun, 30 Aug 2015 12:16:48 +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: 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:b7l6rt5PwZKWtcJnMOLK+NXEA3IPWFyXs9N02Gc8zat7bLQ5hn2 k2yyfwhhlfbEDcf7djS+35/pXXmzGZMTvqEYyGhTJjl5/49c9DQDyKZx7DG/npaEcuN/K6v k0HEMY+TQPvJQZTzY1l4qkAhKGwpJlokjyCCkH1yatHsqQr05a2klsufWKxJ/FX2LL9KPax 7G5ID0etRtLSF/3fYcsBA== X-UI-Out-Filterresults: notjunk:1;V01:K0:0aeg/bJEBp4=:3U1DrrueRHHE8J8MWu7pai fm+jg8uGrcWk9F1+ohaoN8Izsfa++uBdo3xIybPpF8jgvP8t+e8BX5tzfShxNJ8Fc/B6468A4 3LYvoQqD1B9XO4DAy5A8bc2AgdT6WWLaSDRNJCqS+PxQ5kFY7dqjodpzfuzESIwyxhJsc0/vD BkOH1wDJ13k+nQonrYiEoDTZACBIbaYI553HbGwB5JLvrmULc9Lty36yYike1Aq7eOcD3BZSQ 0wU/UMIiKbIy63ZbpK9fyVsu211L2JhnS2yhE3wXBZ5PwWEvR0Rgs3D8Z8ZoW/0qvjFMAsNQD O5A5kNUic4RU6J3tVAngyQOPKiKV/7lqNIGpjJssnlzlcAwey4CR3V3SS77ATFVII5hf6BZbx M59zcG+BHXxZdzvICgwl8rAwEs4GJaJnIITxkHaK2VDMFBtkYMtAsAOqw9mlxUhO8n0Y4U9mE toiO0lKgv8IVAYUIpm0k+2E44cCVsjfL8JkD8PIpmrrQFm7fDfBLv2bVhOiJBDotCvVvs20Ja 6PtGfvW5W5JmOSqkroAWo61Od4/8cgqLBtDfBf7GCZMEuE1LchDzj6rSKvhJadbpnofcsBpmU UzRwPvpba9HOKmcIxjiJErUGfg0cpjA3D6zLAZho95B6rEVDs40ZiGAOoooalWEywQ35MlMRL uXp63eNj/nRIgSNQjx7jR9o3kJ0skQnK/dEoU/W7OGF4wVUC8LmqTleMZ9bTdf8WYJxtM+aWZ PvPVb0HrOnNpSvtrjQHA2O8EvawlaK18hUURMQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3055 Lines: 85 Yep, I see the thread and updates to this patch now, please, ignore this mail, sorry. Thanks Guennadi On Sun, 30 Aug 2015, Guennadi Liakhovetski wrote: > 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/