From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hartmut Knaack Subject: Re: [PATCH v3 1/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver Date: Mon, 13 Oct 2014 00:14:12 +0200 Message-ID: <543AFD34.5060602@gmx.de> References: <1411563415-11933-1-git-send-email-svarbanov@mm-sol.com> <1411563415-11933-2-git-send-email-svarbanov@mm-sol.com> <1411649225.18580.134.camel@iivanov-dev> <54243533.7080809@mm-sol.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from mout.gmx.net ([212.227.17.20]:56687 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbaJLWO2 (ORCPT ); Sun, 12 Oct 2014 18:14:28 -0400 In-Reply-To: <54243533.7080809@mm-sol.com> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Stanimir Varbanov , "Ivan T. Ivanov" Cc: Ian Campbell , Pawel Moll , Rob Herring , Kumar Gala , Mark Rutland , Grant Likely , Jonathan Cameron , Arnd Bergmann , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Greg Kroah-Hartman , Lars-Peter Clausen , Angelo Compagnucci , Doug Anderson , Fugang Duan , Johannes Thumshirn , Jean Delvare , Philippe Reynes , Lee Jones , Josh Cartwright , Stephen Boyd , David Collins Stanimir Varbanov schrieb am 25.09.2014 17:30: > Hi Ivan, > > On 09/25/2014 03:47 PM, Ivan T. Ivanov wrote: >> >> Hi Stan, few comment bellow. >> >> On Wed, 2014-09-24 at 15:56 +0300, Stanimir Varbanov wrote: >>> The voltage ADC is peripheral of Qualcomm SPMI PMIC chips. It has >>> 15bits resolution and register space inside PMIC accessible across >>> SPMI bus. >>> >>> The vadc driver registers itself through IIO interface. >>> >>> Signed-off-by: Stanimir Varbanov >>> Signed-off-by: Ivan T. Ivanov >>> --- >>> drivers/iio/adc/Kconfig | 10 + >>> drivers/iio/adc/Makefile | 1 + >>> drivers/iio/adc/qcom-spmi-vadc.c | 1029 +++++++++++++++++++++++++ >>> include/dt-bindings/iio/qcom,spmi-pmic-vadc.h | 119 +++ >>> 4 files changed, 1159 insertions(+), 0 deletions(-) >>> create mode 100644 drivers/iio/adc/qcom-spmi-vadc.c >>> create mode 100644 include/dt-bindings/iio/qcom,spmi-pmic-vadc.h >>> >>> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig >>> index 11b048a..ec48360 100644 >>> --- a/drivers/iio/adc/Kconfig >>> +++ b/drivers/iio/adc/Kconfig >>> @@ -206,6 +206,16 @@ config NAU7802 >>> To compile this driver as a module, choose M here: the >>> module will be called nau7802. >>> >>> +config QCOM_SPMI_VADC >>> + tristate "Qualcomm SPMI PMIC voltage ADC" >>> + depends on SPMI >> >> + select REGMAP_SPMI > > I'd suggest MFD_SPMI_PMIC symbol of the parent driver instead? The > parent MFD PMIC driver already selects REGMAP_SPMI and depends on SPMI. > >> >> >> >>> + >>> +static int vadc_read(struct vadc_priv *vadc, u16 offset, u8 *data) >>> +{ >>> + return regmap_bulk_read(vadc->regmap, vadc->base + offset, data, 1); >> >> just regmap_read() ? > > No, regmap_read() expects unsigned int *val as an argument hence I will > need temporary variable. I had a comment to rework this on the first > version of the patchset. > >> >>> +} >>> + >> >> General comment, most of the dev_dbg looks like legitimate dev_err's to me. > > I've decided to not flood console with messages. If someone wants to > debug why the driver doesn't probed he can define DEBUG. > I would also say that whenever you return an error code, it would be a good idea to replace the dev_dbg with dev_err. It should just rarely occur to have such errors, and if memory consumption is no issue, then I don't see a valid reason to go the full way of recompiling, getting the new kernel(-module) on the device and maybe even reboot. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net ([212.227.17.20]:56687 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751639AbaJLWO2 (ORCPT ); Sun, 12 Oct 2014 18:14:28 -0400 Message-ID: <543AFD34.5060602@gmx.de> Date: Mon, 13 Oct 2014 00:14:12 +0200 From: Hartmut Knaack MIME-Version: 1.0 To: Stanimir Varbanov , "Ivan T. Ivanov" CC: Ian Campbell , Pawel Moll , Rob Herring , Kumar Gala , Mark Rutland , Grant Likely , Jonathan Cameron , Arnd Bergmann , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, Greg Kroah-Hartman , Lars-Peter Clausen , Angelo Compagnucci , Doug Anderson , Fugang Duan , Johannes Thumshirn , Jean Delvare , Philippe Reynes , Lee Jones , Josh Cartwright , Stephen Boyd , David Collins Subject: Re: [PATCH v3 1/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver References: <1411563415-11933-1-git-send-email-svarbanov@mm-sol.com> <1411563415-11933-2-git-send-email-svarbanov@mm-sol.com> <1411649225.18580.134.camel@iivanov-dev> <54243533.7080809@mm-sol.com> In-Reply-To: <54243533.7080809@mm-sol.com> Content-Type: text/plain; charset=UTF-8 Sender: linux-iio-owner@vger.kernel.org List-Id: linux-iio@vger.kernel.org Stanimir Varbanov schrieb am 25.09.2014 17:30: > Hi Ivan, > > On 09/25/2014 03:47 PM, Ivan T. Ivanov wrote: >> >> Hi Stan, few comment bellow. >> >> On Wed, 2014-09-24 at 15:56 +0300, Stanimir Varbanov wrote: >>> The voltage ADC is peripheral of Qualcomm SPMI PMIC chips. It has >>> 15bits resolution and register space inside PMIC accessible across >>> SPMI bus. >>> >>> The vadc driver registers itself through IIO interface. >>> >>> Signed-off-by: Stanimir Varbanov >>> Signed-off-by: Ivan T. Ivanov >>> --- >>> drivers/iio/adc/Kconfig | 10 + >>> drivers/iio/adc/Makefile | 1 + >>> drivers/iio/adc/qcom-spmi-vadc.c | 1029 +++++++++++++++++++++++++ >>> include/dt-bindings/iio/qcom,spmi-pmic-vadc.h | 119 +++ >>> 4 files changed, 1159 insertions(+), 0 deletions(-) >>> create mode 100644 drivers/iio/adc/qcom-spmi-vadc.c >>> create mode 100644 include/dt-bindings/iio/qcom,spmi-pmic-vadc.h >>> >>> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig >>> index 11b048a..ec48360 100644 >>> --- a/drivers/iio/adc/Kconfig >>> +++ b/drivers/iio/adc/Kconfig >>> @@ -206,6 +206,16 @@ config NAU7802 >>> To compile this driver as a module, choose M here: the >>> module will be called nau7802. >>> >>> +config QCOM_SPMI_VADC >>> + tristate "Qualcomm SPMI PMIC voltage ADC" >>> + depends on SPMI >> >> + select REGMAP_SPMI > > I'd suggest MFD_SPMI_PMIC symbol of the parent driver instead? The > parent MFD PMIC driver already selects REGMAP_SPMI and depends on SPMI. > >> >> >> >>> + >>> +static int vadc_read(struct vadc_priv *vadc, u16 offset, u8 *data) >>> +{ >>> + return regmap_bulk_read(vadc->regmap, vadc->base + offset, data, 1); >> >> just regmap_read() ? > > No, regmap_read() expects unsigned int *val as an argument hence I will > need temporary variable. I had a comment to rework this on the first > version of the patchset. > >> >>> +} >>> + >> >> General comment, most of the dev_dbg looks like legitimate dev_err's to me. > > I've decided to not flood console with messages. If someone wants to > debug why the driver doesn't probed he can define DEBUG. > I would also say that whenever you return an error code, it would be a good idea to replace the dev_dbg with dev_err. It should just rarely occur to have such errors, and if memory consumption is no issue, then I don't see a valid reason to go the full way of recompiling, getting the new kernel(-module) on the device and maybe even reboot.