Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp8421156ioo; Sat, 4 Jun 2022 07:55:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/lV7I4luga38/9mtlNvT3gd7EwBVEqVSr37hw4U/OFtxyuajBhsFnDZpAfZois4JNwSvI X-Received: by 2002:a65:6bc4:0:b0:3c2:2f7c:cc74 with SMTP id e4-20020a656bc4000000b003c22f7ccc74mr13258256pgw.307.1654354529147; Sat, 04 Jun 2022 07:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654354529; cv=none; d=google.com; s=arc-20160816; b=E7EBhfTtZK5UcXCXNzFf7Nxt9FtC9hI+9h0zxFboQ0tL1PjMT2N4YizzhBsebvxmY1 Wcq6boCKX1sUzA7UbZYe021OrWLkuCDQuwdPOAKlOuPW8o6IjEYIHmXsYo7Rddns9IPp XXrySlNIPWXoTlIW9ye4xF5e21wG7ypEp9kAw/VVoUwuCIfPXUxc1D1IdG4vgKQBI0uv XxIW/GhNv8iTCG87VFudCaqva4EjJtpHgJDlTi1vRZ1p1n/v2OGfTptUvv5ptluPokxh TcSWiPjFtTE0UYOtOTxDcjHa8SwAyeyHq6C34ZDz2PMEy3zzSDj4Ta7387A6lw8pZe1/ X7hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8fIAYOJwyLLTRsqFiT3LQKfU3541+iKBYJ4u6kyrI0s=; b=JVK77huo/WbPhYYzNY44d+q2XzGLmc8P2QzZZMPqbv/ZMA+mhFZAlMOa9ibaNwapgz lXHezqivSGrk7CE37jIDTUdJyIEGf2ZukYv0XvHuQba9hmudsltEDE2Ilpq6VS0eyui9 p1Md3Lc+nr0Prl+dVV3uH8RxYwrcnvSFQjOpWVeaQkTATSP/kkBqwVyIrxNL1Pphc6N5 0XPkYNa8tKmOeXGoUiT178CURasiy8vDrS83uS7+uKYrZ+AO+jtLR5lsKxK2vHk9AgM3 V1EtUUn6HRkmaSpzO5rdFfxPs3WtFtuzaXpMD2OhcgcRPQvO4S+QQ/MKrl/scUEvyAI6 fk/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pJUj26xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a170902d09300b00163e051ed3bsi11495949plv.338.2022.06.04.07.55.15; Sat, 04 Jun 2022 07:55:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pJUj26xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344250AbiFCRKa (ORCPT + 99 others); Fri, 3 Jun 2022 13:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230480AbiFCRK0 (ORCPT ); Fri, 3 Jun 2022 13:10:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869CE5251B; Fri, 3 Jun 2022 10:10:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B46BB823AB; Fri, 3 Jun 2022 17:10:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C2A6C385B8; Fri, 3 Jun 2022 17:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654276222; bh=Yhb8OPp1sSwZzVcLGVjDxYrN0vlwebO9faHuTNWhG4o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pJUj26xM3omq1XfJzae2/kNYP0GNrKZJAlX6qQvFkoORdgX2jatgBaZhjITDetyo4 6Ho3r8JCZNDTqYqTywpriBv1enouc70JPjw/sYrT7zAqOY3+TbCZUGrBVxnV0twFzb vBFIAuE6Owl4SCoC0jyhKAh0Wkj62wDDrGkEYuY9ZHlH2kkn5YxDGMdMJ4lJ4ZJtOM 8FilAtIOaatwJZHh8x0+lYlCL4U9MemxvnRqpNaXZGP17ucBaA6OSj8utHuAIdF2Zq mOVjuiYHKrUQzkdqfZZndqYO3gcqFcQLMxn6f/bbPrMbEy5YxC7w8yXCWqyVB3lzQC zN8eYoz/vFcNw== Date: Fri, 3 Jun 2022 18:19:17 +0100 From: Jonathan Cameron To: ChiaEn Wu Cc: Jonathan Cameron , lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, pavel@ucw.cz, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, matthias.bgg@gmail.com, sre@kernel.org, chunfeng.yun@mediatek.com, gregkh@linuxfoundation.org, lars@metafoo.de, lgirdwood@gmail.com, broonie@kernel.org, linux@roeck-us.net, heikki.krogerus@linux.intel.com, deller@gmx.de, ChiYuan Huang , alice_chen@richtek.com, chiaen_wu@richtek.com, dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-iio@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: Re: [RESEND 10/14] iio: adc: mt6370: Add Mediatek MT6370 support Message-ID: <20220603181917.3f737913@jic23-huawei> In-Reply-To: References: <20220531111900.19422-1-peterwu.pub@gmail.com> <20220531111900.19422-11-peterwu.pub@gmail.com> <20220531142102.00007df0@Huawei.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > > + > > > +#define MT6370_AICR_400MA 0x6 > > > +#define MT6370_ICHG_500MA 0x4 > > > +#define MT6370_ICHG_900MA 0x8 > > > + > > > +#define ADC_CONV_TIME_US 35000 > > > +#define ADC_CONV_POLLING_TIME 1000 > > > + > > > +struct mt6370_adc_data { > > > + struct device *dev; > > > + struct regmap *regmap; > > > + struct mutex lock; > > > > All locks need documentation. What is the scope of the lock? > > Looks like it protects device state when doing setup, wait for read, read > > cycles. > > This mutex lock is for preventing the different adc channel from being > read at the same time. > So, if I just change its name to adc_chan_lock or adc_lock and add the > comment for this mutex lock, does this change meet your requirement Yes > > > > > > +}; > > > + > > > +static int mt6370_adc_read_scale(struct mt6370_adc_data *priv, > > > + int chan, int *val1, int *val2) > > > +{ > > > + unsigned int reg_val; > > > + int ret; > > > + > > > + switch (chan) { > > > + case MT6370_CHAN_VBAT: > > > + case MT6370_CHAN_VSYS: > > > + case MT6370_CHAN_CHG_VDDP: > > > + *val1 = 5000; > > > > This seems very large. Voltages are in millivolts > > as per Documentation/ABI/testing/sysfs-bus-iio > > and this means each step is 5 volts. > > > > So value in mv is currently 5 * _raw > > > > OK, I got it. Also, I will add the ABI file in the next version. Thanks! Only add ABI documentation for anything non-standard. The documentation scripts really don't like repeats! > > > > +static const char * const mt6370_channel_labels[MT6370_CHAN_MAX] = { > > > > Perhaps define an enum with which to index this and the chan spec > > and hence ensure they end up matching. > > [vbusdiv5] = "vbusdiv5", etc > > > > Do you mean that I can refine this const char array to the following array?? > > static const char * const mt6370_channel_labels[MT6370_CHAN_MAX] = { > [MT6370_CHAN_VBUSDIV5] = "vbusdiv5", > [MT6370_CHAN_VBUSDIV2] = "vbusdiv2", > ... > ... > [MT6370_CHAN_TEMP_JC] = "temp_jc", > }; Yes thanks, Jonathan