Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754739Ab3EMKq1 (ORCPT ); Mon, 13 May 2013 06:46:27 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:52805 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519Ab3EMKqY (ORCPT ); Mon, 13 May 2013 06:46:24 -0400 Date: Mon, 13 May 2013 12:46:04 +0200 From: Sascha Hauer To: Laurent Pinchart Cc: Prabhakar Lad , Arnd Bergmann , LMML , Mauro Carvalho Chehab , DLOS , Hans Verkuil , Guennadi Liakhovetski , LKML , Sakari Ailus , Sylwester Nawrocki , Grant Likely , Rob Herring , Rob Landley , devicetree-discuss@lists.ozlabs.org, linux-doc@vger.kernel.org Subject: Re: [PATCH RFC v3] media: i2c: mt9p031: add OF support Message-ID: <20130513104604.GU20989@pengutronix.de> References: <1367563919-2880-1-git-send-email-prabhakar.csengg@gmail.com> <124364082.ILKsvVk9ro@avalon> <5750435.WVYuIYMX2V@avalon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5750435.WVYuIYMX2V@avalon> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 11:56:56 up 324 days, 1:08, 103 users, load average: 18.08, 13.41, 12.28 User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3349 Lines: 80 On Wed, May 08, 2013 at 12:37:29PM +0200, Laurent Pinchart wrote: > Hi Prabhakar, > > On Wednesday 08 May 2013 10:19:57 Prabhakar Lad wrote: > > On Wed, May 8, 2013 at 7:32 AM, Laurent Pinchart wrote: > > > On Tuesday 07 May 2013 15:10:36 Prabhakar Lad wrote: > > >> On Mon, May 6, 2013 at 8:29 PM, Prabhakar Lad wrote: > > >> > On Fri, May 3, 2013 at 8:04 PM, Arnd Bergmann wrote: > > >> >> On Friday 03 May 2013, Prabhakar Lad wrote: > > >> > [snip] > > >> > > > >> >>> +} > > >> >> > > >> >> Ok, good. > > >> >> > > >> >>> @@ -955,7 +998,17 @@ static int mt9p031_probe(struct i2c_client > > >> >>> *client, > > >> >>> > > >> >>> mt9p031->pdata = pdata; > > >> >>> mt9p031->output_control = MT9P031_OUTPUT_CONTROL_DEF; > > >> >>> mt9p031->mode2 = MT9P031_READ_MODE_2_ROW_BLC; > > >> >>> > > >> >>> - mt9p031->model = did->driver_data; > > >> >>> + > > >> >>> + if (!client->dev.of_node) { > > >> >>> + mt9p031->model = (enum > > >> >>> mt9p031_model)did->driver_data; > > >> >>> + } else { > > >> >>> + const struct of_device_id *of_id; > > >> >>> + > > >> >>> + of_id = > > >> >>> of_match_device(of_match_ptr(mt9p031_of_match), > > >> >>> + &client->dev); > > >> >>> + if (of_id) > > >> >>> + mt9p031->model = (enum > > >> >>> mt9p031_model)of_id->data; > > >> >>> + } > > >> >>> > > >> >>> mt9p031->reset = -1; > > >> >> > > >> >> Is this actually required? I thought the i2c core just compared the > > >> >> part of the "compatible" value after the first comma to the string, so > > >> >> "mt9p031->model = (enum mt9p031_model)did->driver_data" should work > > >> >> in both cases. At least on v3.8 I just checked that 'did' is indeed NULL for the devicetree case. Also I see no indication that i2c starts comparing after the first comma in the string. > > >> > > > >> > I am OK with "mt9p031->model = (enum mt9p031_model)did->driver_data" > > >> > but I see still few drivers doing this, I am not sure for what reason. > > >> > If everyone is OK with it I can drop the above change. > > >> > > >> My bad, while booting with DT the i2c_device_id ie did in this case will > > >> be NULL, so the above changes are required :-) > > > > > > I've just tested your patch, and did isn't NULL when booting my > > > Beagleboard with DT (on v3.9-rc5). > > > > I am pretty much sure you tested it compatible property as "aptina,mt9p031" > > if the compatible property is set to "aptina,mt9p031m" the did will be NULL. > > I've tested both :-) Sorry to nag, but did you use "aptina,mt9p031[m]" as a compatible string or did you use "mt9p031[m]". With "aptina,..." 'did' should really be NULL. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- 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/