Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1538062pxa; Sun, 2 Aug 2020 11:07:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcBlQNG8kPh8rDZuyvvtLexEqiIRqt8biKYO3PmAj91v0KM+a/CJxQDAvs+Dsruy1pUlg9 X-Received: by 2002:a17:906:ce43:: with SMTP id se3mr13109250ejb.403.1596391666154; Sun, 02 Aug 2020 11:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596391666; cv=none; d=google.com; s=arc-20160816; b=Do7LHwA14DcwFDvu6Kr/U+PtYM79sQGDcGs3Lban2aXgJIdGruBmIQLrsTkiJRGEq8 ITweR6UeEZzESV+J71KGxLu15BZZp41bvPQvVADX0sdTRRg2ARvFwiEL+6XkZbhfUGea h3EY01lGKO0B1/ltem7b2M5GVjc7OAvksN9iGPQrOqOFuiT+z0yqxmJNtjMjASbd6w6b mm2LRIxIiJ5XRCcgqiveCij3yFL9LtrB+XuMRSembK5/qAe9kPkyxuOtR2FOupiDGihD /p/GEnOR0vTnMxf1PMOXRYEJBe1gsQAjJLGRq+qEpkmzOaJB4qwwfXPwOxiKy8/3pUbJ ei5Q== 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=y4HiYNt38nc70/fF7gpPYeiC1nVRazwaZXZ0UbUAj+g=; b=uL/RYEssjABU45QF0FQzRe5/MY0HbbZe/I75ILWvldwQixCEzS6bycQ7ELZRzS+wqS H51707omotKL0NZkdvx38ai3bgtIXbj98AZph4ic5gdaaQ31/9U+0+OOBulS1oxGYpnU WchE+GVjslGxjBUmC8vxP0JVFRuKi1oVXwiqOdD3ivwlppmHnkHi+aST3IDzu6dhey9Q L8TT9zalT40DsU314OKoRgZaznqgcvEn8bb2ZYeExbFhuqCgerkq0B07tCZZZiSDHSmh la4SP/IkQgwwTzmPIhFrGjI8jqWCkPPztNLFpSoXe2p6fZAywChDTobW6FeUGYN1EKkb egOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cWsnVevz; 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 c12si10968839edx.494.2020.08.02.11.07.24; Sun, 02 Aug 2020 11:07:46 -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=cWsnVevz; 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 S1727874AbgHBSCy (ORCPT + 99 others); Sun, 2 Aug 2020 14:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbgHBSCx (ORCPT ); Sun, 2 Aug 2020 14:02:53 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85D7AC06174A; Sun, 2 Aug 2020 11:02:53 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id p8so2558789pgn.13; Sun, 02 Aug 2020 11:02:53 -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=y4HiYNt38nc70/fF7gpPYeiC1nVRazwaZXZ0UbUAj+g=; b=cWsnVevzoK5pBbgZECT6VJ89nBen1DFqMuLo8VaTzwqLpb2XsSQGqpei3I86NShXFw JtbeddrTC4NlAue+Io6adpxLpWb9+R/md/h97DVE3lAS4V/yC457dFLJ96G5omZXLMXs MYwvkucIVEJaPbs17A6MR23oOWW86agyI7+rW69Gl3ClDUIFnCSHP62Dp6ahcMFXhr8q aM2IxSlqubNixcNRoACXBm8l5/H2cSZMWQN71SOXwG77oIzU4x/5WudHc3aTRgXj0Wtx WpuLezEr4qY+i2pK+d5v1AVwJFD3vxZxTm80lZS67yRyH2DW/mdeKuszPKAPX8fqaAP+ f4qg== 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=y4HiYNt38nc70/fF7gpPYeiC1nVRazwaZXZ0UbUAj+g=; b=YNNHsW/neBgAHDiyGzyIdNSRDFmkpwL4FVICy2Hhr2irHvdwf+n+dLtU1SlD4RN7PH Mdu63OuorVyKym5eDeNDALi1qxSqoEhl8Pwfsa2+E8IdJir0YZnqvKZ6fjmtEVSpG7AS 2ERrxcgjK1ReRrIgonJat2WpVQWwFk/g9t8YswlEJelohr7dq0YT4jRHMjcWlscPVCbj C+yVZsLQkuRcn75y02aslwU4+51D2ePrnEH5DpB4GrYiu6gUi6AriN3B+rcYrrmPwVnr p85aJeGUWTmGHx0u2ldFL1Z+FObmgl1zhJMDAiujou3zDq7Wh+SBVae3NeRDA2+CE2VS kJgA== X-Gm-Message-State: AOAM532LWDtLXKG7AzxUs9lDWuassMKtroBxdAThmhDdWKplrRCRJ35z BulqazewQF1tES6i4sqqch5t1bMmFMdIo4GAlrFaf/VihFg= X-Received: by 2002:a62:158e:: with SMTP id 136mr12689670pfv.36.1596391372482; Sun, 02 Aug 2020 11:02:52 -0700 (PDT) MIME-Version: 1.0 References: <20200802163735.76617-1-ceggers@arri.de> <20200802163735.76617-3-ceggers@arri.de> In-Reply-To: <20200802163735.76617-3-ceggers@arri.de> From: Andy Shevchenko Date: Sun, 2 Aug 2020 21:02:35 +0300 Message-ID: Subject: Re: [PATCH v5 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 Sun, Aug 2, 2020 at 7:40 PM Christian Eggers wrote: > > Support for AMS AS73211 JENCOLOR(R) Digital XYZ Sensor. > > This driver has no built-in trigger. In order for making triggered > measurements, an external (software) trigger driver like > iio-trig-hrtimer or iio-trig-sysfs is required. > > The sensor supports single and continuous measurement modes. The latter > is not used by design as this would require tight timing synchronization > between hardware and driver without much benefit. Thanks for an update, my comments below. > Datasheet: https://ams.com/documents/20143/36005/AS73211_DS000556_3-01.pdf/a65474c0-b302-c2fd-e30a-c98df87616df Do we need the UUID after the document file name? ... > +/* Available sample frequencies are 1.024MHz multiplied by powers of two. */ > +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 + Comma. > +}; ... > +#define AS73211_OFFSET_TEMP (-66.9) > +#define AS73211_SCALE_TEMP 0.05 In the kernel we don't do float arithmetic. How these are being used? ... > + *val2 = (AS73211_OFFSET_TEMP - (int)AS73211_OFFSET_TEMP) * 1000000; > + *val2 = (AS73211_SCALE_TEMP - (int)AS73211_SCALE_TEMP) * 1000000; Magic 1000000 multiplier. I think here you got them always 0. And to fix that you need to redefine (with also units included in the name) above constants like #define ..._OFFSET_TEMP_mC 66500 ... _SCALE_TEMP_?? 50 Consider to use definitions from https://elixir.bootlin.com/linux/latest/source/include/linux/units.h ... > + }} > + > + return -EINVAL; Make it default case. > + } > + > + return -EINVAL; Ditto. ... > + }} > + > + return -EINVAL; Ditto. ... > + ret = devm_iio_device_register(dev, indio_dev); > + if (ret < 0) > + return ret; > + > + return 0; return devm_iio_device_register(); And consider to drop ' < 0' for devm_*() calls. As far as I understood your intention to explicitly leave them because of i2c_*() calls, though devm_*() and such are different. -- With Best Regards, Andy Shevchenko