Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6188317pxb; Mon, 14 Feb 2022 18:06:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmaRTf/xF6x5k4sFeNWM/sWLG95LPWoNrMu4i0dtA+eQgQi7dc0w2ysjKAmrdETi8j01Z8 X-Received: by 2002:a17:90a:e618:: with SMTP id j24mr1812528pjy.75.1644890809092; Mon, 14 Feb 2022 18:06:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644890809; cv=none; d=google.com; s=arc-20160816; b=IjATCfS3WPvPF1NFGr916gFSmPPW9IFcLnIKgPHQO2CL3GO20PS9Y8/yc+SRQW9Az7 haxPkJya+EUvZ2OfUOCN5uMcg6fzg9CE6DOdbKpIir58zswf7Htl2qmM4Mf2e8pzer+9 JUO6Vo5x6fNImRqB8OJ3Xey+MpgBs/D3CjHNPmydcLdW4kBdcSMdcpAeqIX7tUZysjjC 76t8vR9Xz3LOHpNsUPpMe2T5qLTjyx0gLt/nXdBF3sBZydUK/Yvox3le5YqhnbN0Qtu/ 9b7XC6FB45Q+IsyX13Cblr0lQI1U8+FfL9t/iRohKx34IMdJJD7kDotpfbXHifYwMwIZ lf+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nQ8TSkYAbvmp6Q3oaHRO6T3ykYVNUOGZKtBNrreWFLo=; b=aa2XixT35jmRlQZw+Uj1JkjqP2SVtehUVzk4xJdxe7FMe9pxZRevVsB7Q8wowvbMvV XSBG9JYKRbG80cBEA/BzPqPQjTiGzPx9kAsWnXlnsZXLlRGTVayImlfozWvo7Q4N90RU Vxx+JA7qEA8jgHXkJFQqcTisO026SwWMYTjF5orZSztyuOqbm5iBi8umwhfga1z6XjRY /JzRnf2bU/kosj2BG+Rmg4k4huM99NcrCbHkF7aaQ496YyqJsvsPh+hn8UMX80+ttpPC bHzK4kruGWDd1a5dpi+H1VIFbfty6UPfAff0RKRCLtY/KdKtw9ZXcMbV/JaTORHaSouD eROw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gjPryxoW; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x188si1293278pgb.570.2022.02.14.18.06.32; Mon, 14 Feb 2022 18:06:49 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=gjPryxoW; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbiBNVAx (ORCPT + 99 others); Mon, 14 Feb 2022 16:00:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbiBNVAn (ORCPT ); Mon, 14 Feb 2022 16:00:43 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A518713194B; Mon, 14 Feb 2022 13:00:34 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id t4-20020a17090a510400b001b8c4a6cd5dso296884pjh.5; Mon, 14 Feb 2022 13:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nQ8TSkYAbvmp6Q3oaHRO6T3ykYVNUOGZKtBNrreWFLo=; b=gjPryxoWPiwCiEaLQKO8x3yzqkQ+YJnYOcvgz2EmXtNKXXIuLVi2DVqX3Is2Dy9R4H gw42n+xgEsswL+F+YL1ohciYqCVi/GM9S9MkGZ5EMkGtnTzo6D+gDrbCHrPMI889N8Yq WukgFIXeRFzLQ/U8cAwb/gizAkWL3rfhwdPK0lO8nbndmcp7UMuca0EM2Ir55aGlYglK t1IUBeRmjyxziKxJdXFLqHIbPfuRqKVgDRlBDvRNyoY2apSb8C+ITVTM/jt5xxCyKYZD tFcm7SKK6aaVsPb58tw+w6tcQDKj2yzf0V7E5gFWoSHnARTYi/hCLPn1bTXs7M7v8BIs 2afQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nQ8TSkYAbvmp6Q3oaHRO6T3ykYVNUOGZKtBNrreWFLo=; b=CiAmdZ1+huo8KkVuTzzTKTzurPJ4hrQKIOO9UgURA6jWJFVdEQXDIUy51UH4+WUjPg GRq+qkNQ+HWyjb10ds9Klu9ZIZ6jynN39Dws0phHpd9Zqp/OZg+5RHWD9jce9NNT7L9x msGzHaNPuSRpNQTZ57S6qT0pVAKF60kZuxnj1R6OoW/38yzBlnUg2cluvhAjl2hlOeQT A6GxCuRR5JdnvYYZUbKVA2aXqb8FvrB+4Pc8xVtm2h2I/nUEqMlLZGh6ZPeYya6HnQBj xjlOTFzdVR5Qjs1ZDnh7bjJH8OaWQswBiscy+d0Ta4+Ka1OPB45y2jH3OH6pKL3JFQYf JZnQ== X-Gm-Message-State: AOAM530sLnM8mNn14Cmyd6+7J5TBP4Y8SDBXSoet6fQXGnJWj68sbyvj 8V2qf39akc5H3y2tA9r8J+bZotQaf02Iug== X-Received: by 2002:a05:6a00:15cd:: with SMTP id o13mr681299pfu.54.1644868379513; Mon, 14 Feb 2022 11:52:59 -0800 (PST) Received: from jagath-PC ([27.4.59.114]) by smtp.gmail.com with ESMTPSA id e28sm359521pgm.23.2022.02.14.11.52.57 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Feb 2022 11:52:59 -0800 (PST) Date: Tue, 15 Feb 2022 01:22:54 +0530 From: Jagath Jog J To: Andy Shevchenko , jic23@kernel.org Cc: Lars-Peter Clausen , Slawomir Stepien , Rob Herring , linux-iio , devicetree , Linux Kernel Mailing List Subject: Re: [PATCH v2 3/4] iio: potentiometer: Add support for Maxim DS3502 Message-ID: <20220214195252.GA7374@jagath-PC> References: <20220214033620.4059-1-jagathjog1996@gmail.com> <20220214033620.4059-4-jagathjog1996@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 Hello Andy, On Mon, Feb 14, 2022 at 01:32:14PM +0200, Andy Shevchenko wrote: > On Mon, Feb 14, 2022 at 5:36 AM Jagath Jog J wrote: > > > > The DS3502 is a 7-bit, nonvolatile digital potentiometer featuring > > an output voltage range of up to 15.5V. > > DS3502 support is implemented into existing ds1803 driver > > Be consistent here and in other commit messages with how you refer to > the IC parts, i.e. > DS1803. Don't forget English grammar and punctuation, i.e. missed period above. > I will fix this in v3 > > Datasheet: https://datasheets.maximintegrated.com/en/ds/DS3502.pdf > > > > > A tag block may not have blank lines. Drop it. > > > Signed-off-by: Jagath Jog J > > ... > > > - tristate "Maxim Integrated DS1803 Digital Potentiometer driver" > > + tristate "Maxim Integrated DS1803 and similar Digital Potentiometer driver" > > Please, list them like other drivers do: > > tristate "Maxim Integrated DS1803/DS... Digital Potentiometer driver" > > ... > > > - Say yes here to build support for the Maxim Integrated DS1803 > > - digital potentiometer chip. > > + Say yes here to build support for the Maxim Integrated DS1803 and > > + similar digital potentiometer chip. > > Same here. > > ... > > > - * Maxim Integrated DS1803 digital potentiometer driver > > + * Maxim Integrated DS1803 and similar digital potentiometer driver > > Same here. Based on Jonathan suggestion for the previous patch version I used "and similar" wording here. > > ... > > > -#define DS1803_MAX_POS 255 > > -#define DS1803_WRITE(chan) (0xa8 | ((chan) + 1)) > > Not sure why these were removed (or moved?) Since max wiper position is present in avail array of ds1803_cfg structure and that is being used for read scale so DS1803_MAX_POS is removed. Since each wiper address of both parts is assigned to the address member of iio_chan_spec struct so DS1803_WRITE(chan) is removed. > > ... > > > +static const struct ds1803_cfg ds1803_cfg[] = { > > + [DS1803_010] = { .wipers = 2, .avail = { 0, 1, 255 }, .kohms = 10, > > + .channels = ds1803_channels, > > + .num_channels = ARRAY_SIZE(ds1803_channels) }, > > + [DS1803_050] = { .wipers = 2, .avail = { 0, 1, 255 }, .kohms = 50, > > + .channels = ds1803_channels, > > + .num_channels = ARRAY_SIZE(ds1803_channels) }, > > + [DS1803_100] = { .wipers = 2, .avail = { 0, 1, 255 }, .kohms = 100, > > + .channels = ds1803_channels, > > + .num_channels = ARRAY_SIZE(ds1803_channels) }, > > + [DS3502] = { .wipers = 1, .avail = { 0, 1, 127 }, .kohms = 10, > > + .channels = ds3502_channels, > > + .num_channels = ARRAY_SIZE(ds3502_channels) }, > > }; > > Split this on a per type basis. I believe it won't be too much work, > also, consider adding channels as a separate preparatory patch as you > did with avail. Based on Jonathan suggestion for the previous patch version to avoid having different chip type related structures so channels and num_channels are added into ds1803_cfg structure. Sure for channels I will split into separate patch for old part in v3. > > ... > > > - data->cfg = &ds1803_cfg[id->driver_data]; > > + data->chip_type = (uintptr_t)device_get_match_data(dev); > > + if (data->chip_type < DS1803_010 || data->chip_type > DS3502) > > + data->chip_type = id->driver_data; > > Split it into a separate patch and use pointer validation instead: > > data->cfg = ... > if (!data->cfg) > data->cfg = ...id->driver_data; > > ... > > > - { .compatible = "maxim,ds1803-010", .data = &ds1803_cfg[DS1803_010] }, > > - { .compatible = "maxim,ds1803-050", .data = &ds1803_cfg[DS1803_050] }, > > - { .compatible = "maxim,ds1803-100", .data = &ds1803_cfg[DS1803_100] }, To get the chip specific structure I can use previous structure method for data and validation as you shown above. But it is necessary to get the chip_type also because of dependency in ds1803_raw_read(). To get the chip_type can I use data->chip_type = id->driver_data > > + { .compatible = "maxim,ds1803-010", .data = (void *)DS1803_010 }, > > + { .compatible = "maxim,ds1803-050", .data = (void *)DS1803_050 }, > > + { .compatible = "maxim,ds1803-100", .data = (void *)DS1803_100 }, > > This is not good, please use pointers as it was before. > > > + { .compatible = "maxim,ds3502", .data = (void *)DS3502 }, > > Ditto. Create a new, separate structure for this type. > > ... > > > { "ds1803-010", DS1803_010 }, > > { "ds1803-050", DS1803_050 }, > > { "ds1803-100", DS1803_100 }, > > + { "ds3502", DS3502 }, > > Too many spaces. > Besides this, please create a new prerequisite patch to convert this > to use pointers as above. Sure I will split this patch in v3. Thanks for feedback. > > -- > With Best Regards, > Andy Shevchenko Best Regards, Jagath