Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp212303lqb; Tue, 28 May 2024 13:14:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWm++vsTad4+omaseRRtekZwalMlKCE3vGFkMYBc61Drq/kjmtfd8wJwEX2BeB7if9cL8BuuqCTpoKZkfe9tb9wCdvTIASTQzphM9bccg== X-Google-Smtp-Source: AGHT+IFI5IithXARMaQCMsDPiRuf2lP44vnfs4Q0rdK2Ug7hotNdNE0s2rlTHRgnnmObp53kPG+I X-Received: by 2002:a05:622a:48f:b0:43e:e6e:21d3 with SMTP id d75a77b69052e-43fb0efee08mr171113041cf.41.1716927268829; Tue, 28 May 2024 13:14:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716927268; cv=pass; d=google.com; s=arc-20160816; b=xFrLfgdQAW5divFBfh2+Tx/W7HjYDjo5+szJpd1HJr1F5LRNBS9tWwqdX6Kixi6xOf kBtE9YvGvb4MMbX9CbXSEi0ftLOew+3ojva68N2BSw0Dz/oSqJbhAiw0KEYgyCvPgmED swWQzyPNgkRQbz/g2kXo5j/HK2bS5lzV+SQJzPI+bmMqMMcr322iBj1XUoQAfh1YcCEB /Xr43HDv5VPv0oVjVP09Hz5LSPjgCP+8ruCh5Qm4kCEAcGoNu8tr7oKxiVJKGbSNQYT2 plzZyjORv7m57eGpTF18S5IlfTc6wc+iPk+YveaTTqDlIIscDM8vNPWaCRsgSGh4td22 /f1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VUKg9gk7RIuyCOFdksOFlsVwtqvYYUgwIr0MwxE49vI=; fh=L18ko88ztPO7ITuyimjmNHkH3CdDwjUCN5BiWTf+3DQ=; b=p3/tmdlNqPUL1d2RjTQRlvSpzzOxn/kCcqx2kthdhN9mq6/cafv9PraX/Xc4t8JLkq 9EAUKsXgsVgtzXaCrCkbd71HrkIpLGX/fNcqF4Nb2xlVMHJ8tCYjdxNa5eUUHvmvyVi+ sekwPHmnEWxxfbh5Yyw9WKmNmjzrITO722oy5j64u7nUvJtX3terRgdmk/okXqQML0HB t6Cx+/a3MiGt2NJq8UaH2qmBJmAXgzobzaHHclf7egXDIYMZvwK60HWXgvUZU/dU7ctM UpyWKaICPvTbOfpeK9xnBBE2aEtSiSzbGSq6Yaln5R79fVZ8y577wXV6Ga4bxh+58fCo TxAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nMofiA1b; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-193009-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193009-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18e0b3bsi77242211cf.715.2024.05.28.13.14.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 13:14:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193009-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nMofiA1b; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-193009-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193009-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4456B1C26530 for ; Tue, 28 May 2024 20:13:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFCB7178CF6; Tue, 28 May 2024 20:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nMofiA1b" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E21510A3E; Tue, 28 May 2024 20:13:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716927224; cv=none; b=SepqxMxP82uoOdcFsOeJv0i67HV30I6occExiR85ZdNRQ3bOYVmRlLYfIAKtagU6hBzdBy0+ALWoad7jePJAUuOnjas7zYZmyeJYahXKzcUCbZJ6YbK95Q1Ckc53qDuQrRSsWIJyfnuuT2/O6ZDWSsQWariso46LIHhI7wCU9M4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716927224; c=relaxed/simple; bh=5L3qsjsXrrwCrw7oASW9JBM1c2YSWZy3HEB/uxPOve8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rUdFQ9S2SEXEjpDoRuMXAGwEBFi2rLoPufWx0osy3tyrq9X0lRGGVX6z9VmClxYUf7Yd9O3j+JYWK3wh68t39HEK9Y4Xe6Fx4uUYnz7Lh5AX0FY/Aer1r7CfhTte+CNqH0Npsos2KfIjP3p/wqThW/G8FsOzkGiiABUTF29ouGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=nMofiA1b; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 117D43A2; Tue, 28 May 2024 22:13:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1716927217; bh=5L3qsjsXrrwCrw7oASW9JBM1c2YSWZy3HEB/uxPOve8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nMofiA1bIHN2lh+NOTVMAvyYjG6razaHPOVM4c165dmxqPvkwsbm1NMr6Rt+y26bO 7Mh9JhFSniCHo2SuQFoGTVPUAmhSSRSOS0JGBBarh8fFFC4+UCXN5RmyUTab5Qgczh dHdHaobzg8RqTrLm1nd/N+L47gk8qMjc5KHdZxEE= Date: Tue, 28 May 2024 23:13:26 +0300 From: Laurent Pinchart To: Andy Shevchenko Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pwm@vger.kernel.org, Bartosz Golaszewski , Conor Dooley , Krzysztof Kozlowski , Lee Jones , Linus Walleij , Rob Herring , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Haibo Chen Subject: Re: [PATCH v2 2/4] mfd: adp5585: Add Analog Devices ADP5585 core support Message-ID: <20240528201326.GA8500@pendragon.ideasonboard.com> References: <20240528190315.3865-1-laurent.pinchart@ideasonboard.com> <20240528190315.3865-3-laurent.pinchart@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Tue, May 28, 2024 at 10:27:34PM +0300, Andy Shevchenko wrote: > Tue, May 28, 2024 at 10:03:12PM +0300, Laurent Pinchart kirjoitti: > > From: Haibo Chen > > > > The ADP5585 is a 10/11 input/output port expander with a built in keypad > > matrix decoder, programmable logic, reset generator, and PWM generator. > > This driver supports the chip by modelling it as an MFD device, with two > > child devices for the GPIO and PWM functions. > > > > The driver is derived from an initial implementation from NXP, available > > in commit 8059835bee19 ("MLK-25917-1 mfd: adp5585: add ADI adp5585 core > > support") in their BSP kernel tree. It has been extensively rewritten. > > ... > > > + tristate "Analog Devices ADP5585 MFD driver" > > + select MFD_CORE > > + select REGMAP_I2C > > + depends on I2C && OF > > Why OF? Because the driver works on OF systems only. > No COMPILE_TEST? The driver won't compile without CONFIG_I2C, so I can use depends on I2C depends on OF || COMPILE_TEST Do you think that's better ? > > ... > > + array_size.h > + device.h // e.g., devm_kzalloc() > > > +#include > > +#include > > +#include > > +#include I'll drop those 3 headers, there's not needed anymore. > > +#include > > > +#include > > +#include > > You don't need them, instead of proxying... of.h for of_device_get_match_data() and of_match_ptr(). I'll drop the former, but I need the latter, so I'll keep of.h of_device.h for historical reasons probably, I'll drop it. > > +#include > > +#include > > m is earlier than 'o', but with above drop no more issue :-) > > ...just include mod_devicetable.h. > > > +#include > > + types.h // e.g., u8 > > ... > > > + regmap_config = of_device_get_match_data(&i2c->dev); > > We have i2c_get_match_data(). Sounds good. > ... > > > +#ifndef __LINUX_MFD_ADP5585_H_ > > +#define __LINUX_MFD_ADP5585_H_ > > + > > +#include > > ... > > > +#define ADP5585_MAN_ID(v) (((v) & 0xf0) >> 4) > > GENMASK() This is not a mask. Or do you mean (((v) & GENMASK(7, 4)) >> 4) ? I think that's overkill. > ... > > > +#define ADP5585_Rx_PULL_CFG_MASK (3) > > GENMASK() Not here, as this value is meant to be passed to ADP5585_Rx_PULL_CFG(). > Why parentheses in all of them, btw? Probably for consistency, but I don't mind dropping them. > ... > > > +#define ADP5585_C4_EXTEND_CFG_MASK (1U << 6) > > > +#define ADP5585_R4_EXTEND_CFG_MASK (1U << 5) > > > +#define ADP5585_R3_EXTEND_CFG_MASK (3U << 2) > > > +#define ADP5585_R0_EXTEND_CFG_MASK (1U << 0) > > > +#define ADP5585_OSC_FREQ_MASK (3U << 5) > > BIT() / GENMASK() I'll use GENMASK for the masks. > > +#endif -- Regards, Laurent Pinchart