From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935819AbdADMIy (ORCPT ); Wed, 4 Jan 2017 07:08:54 -0500 Received: from mail1.bemta6.messagelabs.com ([193.109.254.105]:52493 "EHLO mail1.bemta6.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934247AbdADMIZ (ORCPT ); Wed, 4 Jan 2017 07:08:25 -0500 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOKsWRWlGSWpSXmKPExsUSt3OpsW7505w Igx2r2CymPnzCZjH/yDlWi8OLXjBazL9yjdXi/tejjBbfrnQwWdz89I3V4vKuOWwWn3uPMFrc WLeP3eLJwjNMFkuvX2SyaN17BMh92MdmcWvGC1YHfo8189YweuycdZfd49pmMY/Fe14yeWxa1 cnmcefaHjaPnd8b2D0+b5IL4IhizcxLyq9IYM14fHIWe8EM4Yrjly6wNjD+EOpi5OQQEljKKP HpjDSIzSZgKDHvzXvGLkYODhEBFYlzb8y7GLk4mAUes0icePiGFaRGWMBSYtuhk+wgtoiAlcT 2eVuZYOyeM9MZQWwWoN7V+06BxXkFAiRuTnnDDLFrB6PE7t/SIPM5BbQk7u/WAQkzCshKfGlc DVbCLCAucevJfLBWCQEBiSV7zjND2KISLx//Y4Ww5SXW/noCFbeXeH3vHQvISAkBfYm+xmKIs KHEqmkHWCBsc4lbZ5+DlTALaEqs36UPsUlRYkr3Q3aIIwUlTs58wjKBUXwWkiNmIXTMQtIxC0 nHAkaWVYzqxalFZalFuoZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBCYIBCHY w7nzudIhRkoNJSZS3rz0nQogvKT+lMiOxOCO+qDQntfgQowwHh5IEr+IToJxgUWp6akVaZg4w VcGkJTh4lER4K0HSvMUFibnFmekQqVOMilLivN4gCQGQREZpHlwbLD1eYpSVEuZlBDpEiKcgt Sg3swRV/hWjOAejkjCvP8gUnsy8Erjpr4AWMwEt3h6QDbK4JBEhJdXAmLmpdZ7QgaLfs7KKDp V/M8+onfR4ZkTqlqnBajuT71U9aWh3zRE9+tdiZWHp1S0TVLo6J3B7Llc1Sj0pJrViqdPDSd9 XfJDq1Ku1LVgQo2StvNu1Svz06nu8a3Jun53Fc6j6bcjUCZFK5gHVGxO7tv4v9z7e5DR7spy2 W0PaMc6f/s+tlVJilFiKMxINtZiLihMBOb44DYoDAAA= X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-13.tower-194.messagelabs.com!1483531638!41973024!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked From: Steve Twiss To: Lee Jones CC: LINUX-KERNEL , DEVICETREE , Dmitry Torokhov , Eduardo Valentin , Guenter Roeck , LINUX-INPUT , LINUX-PM , LINUX-WATCHDOG , Liam Girdwood , Mark Brown , "Mark Rutland" , Rob Herring , "Support Opensource" , Wim Van Sebroeck , Zhang Rui Subject: RE: [PATCH V5 4/8] mfd: da9061: MFD core support Thread-Topic: [PATCH V5 4/8] mfd: da9061: MFD core support Thread-Index: AQHSVwnIZ0wEPsSHZkugUuD7xF/YiaEoN/6AgAAZaPA= Date: Wed, 4 Jan 2017 12:07:18 +0000 Message-ID: <6ED8E3B22081A4459DAC7699F3695FB7018CD3BBC9@SW-EX-MBX02.diasemi.com> References: <20170104101221.GT27589@dell> In-Reply-To: <20170104101221.GT27589@dell> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.20.26.77] x-kse-attachmentfiltering-interceptor-info: protection disabled x-kse-serverinfo: sw-ex-cashub01.diasemi.com, 9 x-kse-antivirus-interceptor-info: scan successful x-kse-antivirus-info: Clean, bases: 04/01/2017 07:08:00 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v04CA8w1014118 Hi Lee, On 04 January 2017 10:12, Lee Jones wrote: > Subject: Re: [PATCH V5 4/8] mfd: da9061: MFD core support > On Thu, 15 Dec 2016, Steve Twiss wrote: > > From: Steve Twiss [...] > > +static const struct of_device_id da9062_dt_ids[] = { > > + { .compatible = "dlg,da9061", .data = (void *)COMPAT_TYPE_DA9061, > }, > > + { .compatible = "dlg,da9062", .data = (void *)COMPAT_TYPE_DA9062, > }, > > It looks like this device can dynamically obtain this information from > the device. Please use that method instead. As I mentioned in an earlier post, https://lkml.org/lkml/2016/11/7/418 The 61/62 device type has been defined by the device tree in this case, and that definition is used to set the register map. With the regmap defined, access to the registers is then possible. It is not possible to detect the device type automatically in this case because it suggests a predefined regmap. This is the reason I define the chip type (DA9061 or DA9062) in the device tree and then assign the correct regmap first before accessing any registers. [...] > > + if (i2c->dev.of_node) { > > + match = of_match_node(da9062_dt_ids, i2c->dev.of_node); > > + if (!match) > > + return -EINVAL; > > + > > + chip->chip_type = (int)match->data; > > + } else > > + chip->chip_type = id->driver_data; > > Please obtain this information from DA9062AA_VARIANT_ID. The variant ID does contain the information about whether it is a 61 or 62, but in order to read the register the regmap definition needs to be defined first. [...] > > static const struct i2c_device_id da9062_i2c_id[] = { > > - { "da9062", 0 }, > > + { "da9061", COMPAT_TYPE_DA9061 }, > > + { "da9062", COMPAT_TYPE_DA9062 }, > > This too. Regards, Steve