From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754160Ab2KWPnS (ORCPT ); Fri, 23 Nov 2012 10:43:18 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:41455 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753633Ab2KWPnR (ORCPT ); Fri, 23 Nov 2012 10:43:17 -0500 Date: Fri, 23 Nov 2012 15:43:11 +0000 From: Lee Jones To: Viresh Kumar Cc: sameo@linux.intel.com, devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org, spear-devel@list.st.com, Vipul Kumar Samar Subject: Re: [PATCH V2 2/2] mfd: stmpe: Extend DT support in stmpe driver Message-ID: <20121123154311.GA28552@gmail.com> References: <20121122112451.GE4328@gmail.com> <20121123093633.GD17471@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Nov 2012, Viresh Kumar wrote: > On 23 November 2012 15:06, Lee Jones wrote: > > On Fri, 23 Nov 2012, Viresh Kumar wrote: > >> pdev = platform_device_alloc(cell->name, id + cell->id); > >> > >> This is required when we have multiple instances of MFD device present > >> on board. How do you want me to handle this ? > > > > There are lots of examples of this already. I have to leave something > > to the imagination, or I'll be requesting a cut of your salary. :D > > My manager already reduced my salary by 20% after reading this mail :( Ah, Good. Tell your manager I'll send my offshore bank details over soon. :) > Ok, this is what my understanding of whole this is. Platform devices are > named like: > - pdev-name: if id passed in pdev.id is -1 > - pdev-name.0[1|2|...]: if id passed is 0[1|2|...] > - pdev-name.: if id passed is -2 > > Now, we don't declare cell->id fields and they are currently zero and so > value is passed from pdata->id field. So, for example with multiple instances > of stmpe on a board, we have: > > - stmpe-0: //Name just for reference... > - stmpe-gpio.0 > - stmpe-ts.0 > - stmpe-1: > - stmpe-gpio.1 > - stmpe-ts.1 > - stmpe-2: > - stmpe-gpio.2 > - stmpe-ts.2 > > I main idea is to distinguish various instances of sub modules, like stmpe-gpio. > And this works well with non-DT support we have currently. Yes, when !DT, then passing ID is no problem. > With DT, i am not sure how should we pass id field to mfd_add_devices(). If > we pass it -1, then multiple instances will have same name: "stmpe-gpio" No, in DT devices named as part of the hiearchy, so you'd have: soc-u9500/i2c@80004000/stmpe1601@40/stmpe_keypad soc-u9500/i2c@80004000/stmpe1601@41/stmpe_keypad ... etc The only time we need to be concerned is if one stmpe device can handle more than one keypad, gpio controller, etc. Which I don't think is the case. > Sorry, for my lack of knowledge. Don't send another mail with salary cut > suggestion as that will make it -40% in total ;) Ah, I promise I'll spend it wisely. :) -- Lee Jones Linaro ST-Ericsson Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog