Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1314664pxk; Thu, 10 Sep 2020 12:15:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb3vBtnR3exyAISJ3ZCd/u0v5OHGL+0WVvQRb/KcpNwfSoM2TtkzmekkwzNOFLES5KwhB2 X-Received: by 2002:a50:fc91:: with SMTP id f17mr11314000edq.319.1599765325261; Thu, 10 Sep 2020 12:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599765325; cv=none; d=google.com; s=arc-20160816; b=kSWtVf+ONqdM25rznPIIl032tautPaTZRp8MpNBBcuE5IkQV8HLLlXWbxlO5E9nAhv vomMNivWsTbiSqB2YXCQteczt0HypWuiFTwZoVmY9SKyuAyeK9XJ5NUKuI8kSgnpKPFJ GUYh8I/DJwrnEwK9vH4PxZhjZXwvwxOfLmdyEk1qG2iDqdTHY+9HlJTLYU2KJNEdwHzf qQiHWFhCLC7C9OoXbDZh+9ALttJ0+zoFaJP9uM+xzfXwWKY6JhpUQ+QriKDtoGlo8VTH hPMKOogz69/tIF5nspEzDWBK8/0br2sjGRWjD86GWj3+WvaaFkBIj9lz7RR2GQuM3N5w 7YJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=d6HM3kGnX3hcsyqN4s/tls+RNqCNBXXglm5eTQT3j4A=; b=Z0qz6gAZ7ZWQNUrhBacRe3SGHp8ljAAIMXm0dc6xB5O/ERf0r6olTeZW9Sa/1/cRVW 5Gnq3+wlvpaUbyzvm9x8RjtzKzZ1VscDC+VpTlTxJIkAoGuV3SSOrwU485unD2lpopJm 7gvvo6N44pG3fLVyqV0hpkgdauw35fEtDM9DFrz4LuxkRGQcJhTsNJ/GZqqVCpA12TCQ iYGXsfzxIQd8RcnWnXR88bPc0M5mhciqe3pe1eeAS/m9U4vBQUYnNT3GhmHmytoupSTU a7sBWI+xxoEncLxuqdOJtt/9B6MMtvm0uBuMqD4i1Jxv+/cvdezY7EU7wy60wJZEtxJY 6+7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=aLt0WaHp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t27si4130804edc.436.2020.09.10.12.15.02; Thu, 10 Sep 2020 12:15:25 -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=@gmx.net header.s=badeba3b8450 header.b=aLt0WaHp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbgIJTML (ORCPT + 99 others); Thu, 10 Sep 2020 15:12:11 -0400 Received: from mout.gmx.net ([212.227.15.18]:43267 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbgIJTLG (ORCPT ); Thu, 10 Sep 2020 15:11:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599765003; bh=e/GjHdRDaBKeltHwO5EENqEZEm8NoRyfw4WXvri23to=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=aLt0WaHp2K+27F8mFTyBRsEOuF3eHSIgFfbQfhSFJgr9Yffrr/ZRunmO2Bbat6tMx WtZn4odHoFdb4wJOURVOAr+tqg5Jh1yvULJgPpK7F/U+OY5hIG79BEL3z/AjA8LJ1T Oymy+kgmhcmsUTihUWDayy2ttFebbyhjolXg25ow= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from longitude ([5.146.195.151]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MxDkw-1kRUd10zG4-00xe8D; Thu, 10 Sep 2020 21:10:03 +0200 Date: Thu, 10 Sep 2020 21:09:57 +0200 From: Jonathan =?utf-8?Q?Neusch=C3=A4fer?= To: Andy Shevchenko Cc: Jonathan =?utf-8?Q?Neusch=C3=A4fer?= , "linux-kernel@vger.kernel.org" , Lee Jones , Rob Herring , Thierry Reding , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Alessandro Zummo , Alexandre Belloni , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Sam Ravnborg , Linus Walleij , Heiko Stuebner , Stephan Gerhold , Lubomir Rintel , Mark Brown , allen , Mauro Carvalho Chehab , "David S. Miller" , "devicetree@vger.kernel.org" , "linux-pwm@vger.kernel.org" , "linux-rtc@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Heiko Stuebner , Josua Mayer , Andreas Kemnade , Arnd Bergmann , Daniel Palmer Subject: Re: [PATCH v2 05/10] pwm: ntxec: Add driver for PWM function in Netronix EC Message-ID: <20200910190957.GB3306@latitude> References: <20200905133230.1014581-1-j.neuschaefer@gmx.net> <20200905133230.1014581-6-j.neuschaefer@gmx.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mxv5cy4qt+RJ9ypb" Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:2kulQix1IwHTgVYh/suxTjvDyKy9vES/+dG4cKEhMDL8fo3cwpx Ap8fmH3Xtn9sE0LmqdTVBm00y1TH3G+F5etIJE86d0XqwbeKveBHu/E0tCgmMRaKrU/5s4N kQBHyi5bHZdyFfVbKuTVZ1/KOtFUtCsIi7Rdszh5c+0OXRUMm0xHTbMx2b6zA4s3EnEFoFW QnrEy5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7zzkqbnY8GT92CPQyRuJUdE4tJquOHxoQ9IYUqNJ mbqRUfgso3i5PC5DOx9HsywTgH8/JIZwNy5i1W7E1E9ohbcQSTRxD24zkxqqVPgVdHQRd72Q1 jreSPAVNEz/ekECmD6i9hp+05Jsp5gXGausBDvYB/laIDCmzglACJ9TM3mkA8/OGIQMYoI5ZE EHF9BtmZXGCJ3fsJc/Uhlh3IeRHNVawSWW8bAJxKm2BW8qhNxUbVrA4mNY4YuPYa0gBKzaPA2 VoLjuDALpQNG98yZlblET1kpE6NEvHHJ3J+j9mg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --mxv5cy4qt+RJ9ypb Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 05, 2020 at 09:08:49PM +0300, Andy Shevchenko wrote: > On Saturday, September 5, 2020, Jonathan Neusch=C3=A4fer > wrote: >=20 > > The Netronix EC provides a PWM output which is used for the backlight > > on some ebook readers. This patches adds a driver for the PWM output. > > > > Signed-off-by: Jonathan Neusch=C3=A4fer > > --- [...] > > +#include >=20 >=20 > mod_devicetable.h Okay > > +/* Convert an 8-bit value into the correct format for writing into a > > register */ > > +#define u8_to_reg(x) (((x) & 0xff) << 8) >=20 >=20 > You spread this macro among the drivers w/o explanation what=E2=80=99s go= ing on. I > think there will be better approach. Okay, I'll move it to ntxec.h and expand on the explanation. I think what's missing is the following part: Some registers, such as the battery status register (0x41), are in big-endian, but others only have eight significant bits, which are in the first byte transmitted over I2C (the MSB of the big-endian value). This convenience macro/function converts an 8-bit value to 16-bit for use in the second kind of register. > > + > > + res |=3D regmap_write(pwm->ec->regmap, NTXEC_REG_PERIOD_HIGH, > > u8_to_reg(period >> 8)); > > + res |=3D regmap_write(pwm->ec->regmap, NTXEC_REG_PERIOD_LOW, > > u8_to_reg(period)); > > + res |=3D regmap_write(pwm->ec->regmap, NTXEC_REG_DUTY_HIGH, > > u8_to_reg(duty >> 8)); > > + res |=3D regmap_write(pwm->ec->regmap, NTXEC_REG_DUTY_LOW, > > u8_to_reg(duty)); >=20 >=20 > These funny res |=3D is unusual pattern for returned error codes. Moreover > you are shadowing the real ones. Same go the rest drovers. Please fix by > checking each separately. Okay > > + platform_set_drvdata(pdev, pwm); > > + > > + return (res < 0) ? -EIO : 0; >=20 >=20 > What?! That's an editing error, sorry. > > +static const struct of_device_id ntxec_pwm_of_match[] =3D { > > + { .compatible =3D "netronix,ntxec-pwm" }, > > > > >=20 > > + { }, >=20 >=20 > No comma. Okay Thanks for the review, Jonathan Neusch=C3=A4fer --mxv5cy4qt+RJ9ypb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEvHAHGBBjQPVy+qvDCDBEmo7zX9sFAl9aefUACgkQCDBEmo7z X9s28xAAnaOJ911XlEgMRmp99aYqJpEdZgZvH/LVKEQBPLYT/XeUf/t2X5MqVTSG VjhU4kbYvnUWrVL3Ud63qNe2TV73lI2mUOsz9wFu7coD/+QVmNv5Y2+/SsHBxNcr sf6mOX5TTKkwe0bS6bChJZmpZ19fottJ6STYPgeTMJK7zxn299D4gEuO3KNjK8I2 k0PoE/U/CMAGb4lwzOQ55qXK9u/rmrPp15ME09TSePU0Mqip1ki/jg2qagSuxyfC mvsUWZJlHSnx412cJucSpZmT/2IzlVgqn3YDuWOT+gvF0XrUXbKcGYsU4hkCeyb5 TFostixxqKy7YPXbgNJDQ9AXUXmAOBAMjy+knnR1EFgt8SLNITeiFgqoubIe1vJj RA6V9ZNRCsBzRboplVeyjQYqmAWul4mlzezhVp6P9A5S/GfgziKOD5zrDMaGorUP qA9Q00SbQuo2WMasehHeo0x1vDan2kzMNBm2F54VZn1awDP/UwI/0s6bDxKK8Bsl djXY509LfGcc5phgl199m8rE7PUIaHQQHsEw1T+Z867vPES7pjL0OFnsG4NiiX5o QecSeK7xp8BK6c3wAebX3VqMISPfj+R66lhspCtfsbJ1yeVX/nwh8V4OouZtTQJJ WF1FS5izzOQO/QaajIE3gH0+ZPfkC9QoH8vEBBtL0mzEbljNq+E= =P/2J -----END PGP SIGNATURE----- --mxv5cy4qt+RJ9ypb--