From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757066Ab3BVKcG (ORCPT ); Fri, 22 Feb 2013 05:32:06 -0500 Received: from hqemgate03.nvidia.com ([216.228.121.140]:8238 "EHLO hqemgate03.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754917Ab3BVKbw (ORCPT ); Fri, 22 Feb 2013 05:31:52 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 22 Feb 2013 02:31:04 -0800 Message-ID: <512748DF.8080401@nvidia.com> Date: Fri, 22 Feb 2013 16:00:55 +0530 From: Laxman Dewangan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: Ian Lartey CC: "linux-kernel@vger.kernel.org" , "broonie@opensource.wolfsonmicro.com" , "lrg@ti.com" , "sameo@linux.intel.com" , Graeme Gregory Subject: Re: [PATCH 2/2] mfd: palmas add variant and OTP detection References: <1361494325-4416-1-git-send-email-ian@slimlogic.co.uk> <1361494325-4416-2-git-send-email-ian@slimlogic.co.uk> In-Reply-To: <1361494325-4416-2-git-send-email-ian@slimlogic.co.uk> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 22 February 2013 06:22 AM, Ian Lartey wrote: > From: Graeme Gregory > > Read the chip varient and the OTP information from the chip and display > this on probe to aid in debugging of issues. > > > + /* Read varient info from the device */ > + slave = PALMAS_BASE_TO_SLAVE(PALMAS_ID_BASE); > + addr = PALMAS_BASE_TO_REG(PALMAS_ID_BASE, PALMAS_PRODUCT_ID_LSB); > + ret = regmap_read(palmas->regmap[slave], addr, ®); > + if (ret < 0) { > + dev_err(palmas->dev, "Unable to read ID err: %d\n", ret); > + goto err; > + } > + Can you please use the api palmas_* for reading register which I added recently. This will reduce the calc of slave and addr and done in single call? Same of following code also. Also can we move all these new code to one function where we read id and diaplay. To keep probe() smaller. > + palmas->id = reg; > + > + slave = PALMAS_BASE_TO_SLAVE(PALMAS_ID_BASE); > + addr = PALMAS_BASE_TO_REG(PALMAS_ID_BASE, PALMAS_PRODUCT_ID_MSB); > + ret = regmap_read(palmas->regmap[slave], addr, ®); > + if (ret < 0) { > + dev_err(palmas->dev, "Unable to read ID err: %d\n", ret); > + goto err; > + } > + > + palmas->id |= reg << 8; Is it possible to change variable name id to product_id and then update to have more meaningful name? We can add for vendor_id also if require. > + > + dev_info(palmas->dev, "Product ID %x\n", palmas->id); > + > + slave = PALMAS_BASE_TO_SLAVE(PALMAS_DESIGNREV_BASE); > + addr = PALMAS_BASE_TO_REG(PALMAS_DESIGNREV_BASE, PALMAS_DESIGNREV); > + ret = regmap_read(palmas->regmap[slave], addr, ®); > + if (ret < 0) { > + dev_err(palmas->dev, "Unable to read DESIGNREV err: %d\n", ret); > + goto err; > + } > + > + palmas->designrev = reg & PALMAS_DESIGNREV_DESIGNREV_MASK; > + > + dev_info(palmas->dev, "Product Design Rev %x\n", palmas->designrev); > + > + slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE); > + addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_SW_REVISION); > + ret = regmap_read(palmas->regmap[slave], addr, ®); > + if (ret < 0) { > + dev_err(palmas->dev, "Unable to read SW_REVISION err: %d\n", > + ret); > + goto err; > + } > + > + palmas->sw_revision = reg; > + > + dev_info(palmas->dev, "Product SW Rev %x\n", palmas->sw_revision); > + Here designrev also says the ES version and sw revision says the OTP SW revision. TI has make the design revision as ES1.0, ES2.0, ES2.1, ES2.2 like this and other technical names are 0xA0, 0xB0, 0xB1, 0xB2 etc. Probably I will add this in follow on patch becasue we have some errata which we need to implement based on the version number.