Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp158426pxa; Fri, 31 Jul 2020 08:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjagO8o0XM+Aavs064/TwZiCmEbrHyUBm+aRspSVYofso+aEp2APIU4jtCaE9SabyTcf+j X-Received: by 2002:a17:906:970a:: with SMTP id k10mr4512832ejx.189.1596210202494; Fri, 31 Jul 2020 08:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596210202; cv=none; d=google.com; s=arc-20160816; b=QHdLzPX1QBZONUNUBfgM6BeS8ptlmWd9BNK3WzUuVIhMQpD5pK9jNM9qt0e2HJ3cl7 vWI+mdl4Rojcekd8r34zzbvkWvM4ntZAH0Zy53YvwiTCma3QGZyjE9zTsKnyWf9g+DMH Bk7CEypddk1vP4C1lfPs719MHYyRccM2FkoxS+aFsPy7Q5De+KpSacFvXb8k3yJ1GVFX iBPHaU9dNX/yxSCmiioygRYTWoiz6yeTic4kE4Wx4inhyy1jxMKEsQUvOlNnLk8u8FWG dNro9GZThWTFM/m4deO9T+CH7u3dsh7EtH8yVWjkZp/igeC1lJntmUtEgIIgnt9QDNbQ ZZNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xPAf+0yy2ZlHtMa5ZnoGgULR1tZaCKmjHqaKAapeiYE=; b=sfkMv9eUsqwUe/Js1DE0BB/8Gry/mjIZf/E3vdhAhAHpVmWYh+wnA9OjBx1/hT8EqX lJ54fneWF5DBM2mMxk7aPHq/ZPONlv1eDW683pTSvYZwGLg+SWz1Fe1mRfBVy5TX1tL0 Dsjwq7zgeVEioY48omH4JeFm85LxvUtiyAngDieQ475vF4aQFDpz5LnJmK3gklsrwMcr H9kpQ/wcOkys4B/LPmBNCOoCnU0pq8aQkQcUvbfBwdbYUJrFXhEnvhCIF5ITQnBLhbq+ 4Bzks7HJulRbgz176wUb5hEWZiamnsvA3CNTA47p18Ba3LZLlsEFUy3RZ9paYVRssOK0 vhEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P9SusStE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si5370058edy.381.2020.07.31.08.42.57; Fri, 31 Jul 2020 08:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P9SusStE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728693AbgGaPmG (ORCPT + 99 others); Fri, 31 Jul 2020 11:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726497AbgGaPmF (ORCPT ); Fri, 31 Jul 2020 11:42:05 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE9A4C061574; Fri, 31 Jul 2020 08:42:05 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id a9so7616166pjd.3; Fri, 31 Jul 2020 08:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xPAf+0yy2ZlHtMa5ZnoGgULR1tZaCKmjHqaKAapeiYE=; b=P9SusStEhBevVJFpyIwzCSJhXC0IF23IbxXJG5RUH3Lo0cOgXcfs9zNejxYvCaUJma 1aSRYCOEw6xfCbaMKqEG1OMIairUU0As7lC29/kyNkmpknvKHQIFlMK01c0WjzANlvoS 8v7ToKIeIsXO8O/KUeruKvlVecTG7Nvr/Ndz1yt9A+lpE9cpUAnOlckY3Wjm4fU3Owpg K0ZsEO3QjXyG2bQHV/oKcMcCWfjs/NoZmAD7SZzfY22ucXF9jJxSqZEwTUtrxhJ1k2Pt PF4BOVkyl9ZozstvXLWBGIXGlnHYXKXFAJs0YjpzA4j4pv55IyB+xOw3NpR9fOoFq6tk ox+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xPAf+0yy2ZlHtMa5ZnoGgULR1tZaCKmjHqaKAapeiYE=; b=HUirnGBVuz3nL9uFjSbQiIUTheGA1IJuN13h+JI5mlEEQAWog/mKpiPN5APm/p0ija w0Uy7d69/3SGhFfueumgGdoJNNr4hfl4lfDN5kuPv5c5jh5SF9JgR7tzcEf3ETP/BcQ3 UVlF+Ey/eMEESTIQtl0s+W4++NfI26L7JrJfKTsQ5cSjUvt+BqIsxjuBYx0BC+VjYu/q dENBe93p8Xh+/ArFPdiWtsNtlp1fY7f7KKvD9KP6DT+TRJeKqxIPc+3Tw9n+BuPpJ8k6 jUafNiwoLOD6ULNYTW5WipNEv9wtPpmeMVA+qTLIl7LnFaPubSdtK1uM1ROm4kAI9yd7 7Y4A== X-Gm-Message-State: AOAM530wToEGalKEPSsi5yy3WftyYIWTM/EJWl/m8fTfrJy9gBGyqDuD EiAYsfcW92de84TSUstc+KKN34WLjHmtkiHIf+Q= X-Received: by 2002:a17:902:9a4b:: with SMTP id x11mr4119309plv.255.1596210125122; Fri, 31 Jul 2020 08:42:05 -0700 (PDT) MIME-Version: 1.0 References: <20200731070114.40471-1-ceggers@arri.de> <20200731070114.40471-3-ceggers@arri.de> <2706267.JtmGt7LAV2@n95hx1g2> In-Reply-To: <2706267.JtmGt7LAV2@n95hx1g2> From: Andy Shevchenko Date: Fri, 31 Jul 2020 18:41:47 +0300 Message-ID: Subject: Re: [PATCH v4 2/2] iio: light: as73211: New driver To: Christian Eggers Cc: Rob Herring , Jonathan Cameron , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio , devicetree , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 31, 2020 at 1:52 PM Christian Eggers wrote: > > W=1 (not V=1) runs kernel doc validation script. > without V=1, I get nothing. Neither excess nor missing members > are reported on my system. It's strange. ... > > Perhaps add a definition above and comment here? > > > > #define AS73211_BASE_FREQ_1024KHZ 1024000 > added similar define in v5. The array looks like the following now > > static const int as73211_samp_freq_avail[] = { > AS73211_SAMPLE_FREQ_BASE, ' * 1' > AS73211_SAMPLE_FREQ_BASE * 2, > AS73211_SAMPLE_FREQ_BASE * 4, > AS73211_SAMPLE_FREQ_BASE * 8 > }; ... > > > +/* integration time in units of 1024 clock cycles */ > > > > Unify this with below one. Or the other way around, i.o.w. join one of > > them into the other. > > > > > +static unsigned int as73211_integration_time_1024cyc(struct as73211_data > > > *data) +{ > > > + /* integration time in CREG1 is in powers of 2 (x 1024 cycles) */ > > > + return BIT(FIELD_GET(AS73211_CREG1_TIME_MASK, data->creg1)); > > > +} > I'm not sure, whether this is possible. as73211_integration_time_1024cyc() > returns the current setting from hardware. as73211_integration_time_us() > calculates the resulting time. But as73211_integration_time_us() is also > called in as73211_integration_time_calc_avail() inside the loop. What I meant is solely comments to be joined, not the code. ... > > > + unsigned int time_us = as73211_integration_time_us(data, > > > + as73211_integration_time_1024cyc(data)); > > One line? > checkpatch complains... ignore? Hmm... is it over 100? Or you are using some old tools to work with the kernel... ... > > > + /* gain can be calculated from CREG1 as 2^(13 - > > > CREG1_GAIN) */ + reg_bits = 13 - ilog2(val); > > > > 13 is the second time in the code. Deserves a descriptive definition. > I'm unsure how to solve this. Possible values for gain: > > CREG1[7:4] | gain > ----------------------------- > 0 | 2048x > 1 | 1024x > 2 | 512x > ... | ... > 13 | 1x > > #define AS73211_CREG1_GAIN_1_NON_SHIFTED 13 // this define is CREG1 related, but not shifted to the right position > > static unsigned int as73211_gain(struct as73211_data *data) > { > /* gain can be calculated from CREG1 as 2^(13 - CREG1_GAIN) */ > return BIT(AS73211_CREG1_GAIN_1_NON_SHIFTED - FIELD_GET(AS73211_CREG1_GAIN_MASK, data->creg1)); > } This way (w/o _NON_SHIFTED suffix) if both 13:s in the code are of the same meaning. ... > > > + indio_dev->dev.parent = dev; > > > > Doesn't IIO core do this for you? > devm_iio_device_alloc() doesn't pass 'dev' to iio_device_alloc(). > I already looked around, but I didn't find. And after debugging > v5.4, devm_iio_device_alloc() definitely doesn't do it. Why are you talking about v5.4? We are in v5.8 cycle contributing to v5.9. Recently IIO gained some features among which I think the one that assigns parent devices. -- With Best Regards, Andy Shevchenko