From patchwork Wed Sep 20 15:18:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 9961683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7D2360208 for ; Wed, 20 Sep 2017 15:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B446528867 for ; Wed, 20 Sep 2017 15:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A925D288EF; Wed, 20 Sep 2017 15:21:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 194C628867 for ; Wed, 20 Sep 2017 15:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751877AbdITPSt (ORCPT ); Wed, 20 Sep 2017 11:18:49 -0400 Received: from hermes.aosc.io ([199.195.250.187]:41635 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbdITPSs (ORCPT ); Wed, 20 Sep 2017 11:18:48 -0400 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 5E6DB47941; Wed, 20 Sep 2017 15:18:43 +0000 (UTC) From: Icenowy Zheng To: Chen-Yu Tsai , Maxime Ripard , Jonathan Cameron , Lee Jones , Quentin Schulz Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org, linux-sunxi@googlegroups.com, Icenowy Zheng Subject: [RFC PATCH 2/7] iio: adc: axp20x-adc: allow to skip ADC rate setup now Date: Wed, 20 Sep 2017 23:18:09 +0800 Message-Id: <20170920151814.22461-3-icenowy@aosc.io> In-Reply-To: <20170920151814.22461-1-icenowy@aosc.io> References: <20170920151814.22461-1-icenowy@aosc.io> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ADC rate setup on AXP803 is more complex than AXP20x/22x. As it's not a necessary setup, allow it to be skipped, to allow simpler AXP803 support now. Signed-off-by: Icenowy Zheng --- drivers/iio/adc/axp20x_adc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c index 11e177180ea0..93dd6b80059e 100644 --- a/drivers/iio/adc/axp20x_adc.c +++ b/drivers/iio/adc/axp20x_adc.c @@ -556,8 +556,10 @@ static int axp20x_probe(struct platform_device *pdev) AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK); /* Configure ADCs rate */ - regmap_update_bits(info->regmap, AXP20X_ADC_RATE, AXP20X_ADC_RATE_MASK, - info->data->adc_rate(100)); + if (info->data->adc_rate) + regmap_update_bits(info->regmap, AXP20X_ADC_RATE, + AXP20X_ADC_RATE_MASK, + info->data->adc_rate(100)); ret = iio_map_array_register(indio_dev, info->data->maps); if (ret < 0) {