Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7396583pxb; Thu, 18 Feb 2021 09:01:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJynNhnGMZv78Ds3156fSzTw3fmIG8Q6tIyvFA+dwuYI7LqxfoTkx+rcxLQuToxLFW49Ak98 X-Received: by 2002:a17:906:bc42:: with SMTP id s2mr4825573ejv.57.1613667712992; Thu, 18 Feb 2021 09:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613667712; cv=none; d=google.com; s=arc-20160816; b=mvIQGU6a9PHcyPctoZy7TzUEyFG8H0jrLmJo7Ayh7twvxS0awFDLGpFReG7oUY797r 4KWBTWFoMfFf5H+uqRp+33rM5JO9vWtubxqGley8e6lTmi5fKyst3SRdd8lNKFeypRck JC7T+NXkcOll930xBYfpwDb2FZjmq+B/46o/5s0Zp2s38lr++JWMaxnMw9PVkin47H4S kzlcUCT1Xu17ZnoHvbPVjOHjdl4sqnG2oCFR7Mele0PqenuDzvucNI1MHLP5RO84srY8 7l8srvHbxBPE68DNQRSOeDl+wF92V7tiDd2GU7s2cES+2UVf6OrY7PIK0opA0aW/xXrQ /e0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=XfRQDzcPdjzS9Z5GHkHr9rpTLS4XUEEALTBzq2OwHx8=; b=CWAteCpw2Deb6tPgolUOjAJomnw6vLhINdUH/GxPM7U4A056KofYuh7a+6/bmHJNwd hvSjxX4+o8mVuYZgcgtsk3FmjBPdb5CqFAMFup5DIOIkYZtRnRyxmpLrFvKui9yngleQ dFRpDQGc1To/rXy6aj/227esGlCGfrcjkrx3n12mBf5S2zEbRPyW3xF9Qu31ra82p5Mo eQiQfJeAwEXVtIyyBFaUtsC5Fa4xF9HS2WoJbrDWGQTj1IbJYVv3x/v5Ldh6XW5Sq2Xc E9UM68lSpgJcuzvUeuzxCq6/uezXsLA07zvCBxqk95oN8r3K0k3rqfl0SP1jo5JE0Dtk Kk/Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 q23si5246495edb.260.2021.02.18.09.01.27; Thu, 18 Feb 2021 09:01:52 -0800 (PST) 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; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234176AbhBRQ7C (ORCPT + 99 others); Thu, 18 Feb 2021 11:59:02 -0500 Received: from mga07.intel.com ([134.134.136.100]:2130 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233616AbhBROPd (ORCPT ); Thu, 18 Feb 2021 09:15:33 -0500 IronPort-SDR: pwiwHWxugM2a+bzzydPk1fmiSSr63fc1ThxU92Y8oss9KlLChdlECzl4K4mO/91bUMak8mrTk/ s39UV7z6YFxg== X-IronPort-AV: E=McAfee;i="6000,8403,9898"; a="247590890" X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="247590890" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 06:14:16 -0800 IronPort-SDR: ElQZXhgmFtC60IIVlW+/UT5UP1hzG5Xt8dnWRP3n5MYhm+tebIYls/GzvQokwvZldIkSO2xR73 LRQaLIzyIUtg== X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="439822549" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 06:14:15 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lCk4K-005xt5-EF; Thu, 18 Feb 2021 16:14:12 +0200 Date: Thu, 18 Feb 2021 16:14:12 +0200 From: "andy.shevchenko@gmail.com" To: "Bedel, Alban" Cc: "linux-gpio@vger.kernel.org" , "bgolaszewski@baylibre.com" , "linux-kernel@vger.kernel.org" , "linus.walleij@linaro.org" Subject: Re: [PATCH v2] gpio: pca953x: add support for open drain pins on PCAL6524 Message-ID: References: <20210211175140.85391-1-alban.bedel@aerq.com> <4d67d5627921b0f7ca6579b81f97691c53ef0c34.camel@aerq.com> <6018d92d2fc91841e76324adaf9f285e39b6fc00.camel@aerq.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6018d92d2fc91841e76324adaf9f285e39b6fc00.camel@aerq.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2021 at 06:57:20PM +0000, Bedel, Alban wrote: > On Wed, 2021-02-17 at 16:19 +0200, Andy Shevchenko wrote: > > On Wed, Feb 17, 2021 at 3:11 PM Bedel, Alban > > wrote: > > > On Tue, 2021-02-16 at 19:50 +0200, Andy Shevchenko wrote: > > > > On Tue, Feb 16, 2021 at 6:37 PM Bedel, Alban < > > > > alban.bedel@aerq.com> > > > > wrote: > > > > > On Mon, 2021-02-15 at 14:53 +0200, Andy Shevchenko wrote: > > > > > > On Thu, Feb 11, 2021 at 7:52 PM Alban Bedel < > > > > > > alban.bedel@aerq.com > > > > > > wrote: > > > > ... > > > > > > > > > +#define PCAL65xx_REGS BIT(10) > > > > > > > > > > > > Can we have it as a _TYPE, please? > > > > > > > > > > Let's please take a closer look at these macros and what they > > > > > mean. > > > > > Currently we have 3 possible set of functions that are > > > > > indicated by > > > > > setting bits in driver_data using the PCA_xxx macros: > > > > > > > > > > - Basic register only: 0 > > > > > - With interrupt support: PCA_INT > > > > > - With latching interrupt regs: PCA_INT | PCA_PCAL = > > > > > PCA_LATCH_INT > > > > > > > > > > This patch then add a forth case: > > > > > > > > > > - With pin config regs: PCA_INT | PCA_PCAL | > > > > > $MACRO_WE_ARE_DICUSSING > > > > > > > > > > Then there is the PCA953X_TYPE and PCA957X_TYPE macros which > > > > > indicate > > > > > the need for a different regmap config and register layout. > > > > > > > > Exactly, and you have a different register layout (coincidentally > > > > overlaps with the original PCA953x). > > > > > > We have 2 layout for the base registers, the "mixed up registers" > > > of > > > the PCA957x and the "standard" of the PCA953x. Then we have the > > > PCALxxxx chips which extend the base PCA953x registers with further > > > registers for better interrupt handling. These are not treated as a > > > new > > > type in the current code, but as an extra feature on top of the > > > PCA953x. > > > > Yes, because they are about interrupts AFAICS. > > This distinction seems arbitrary, each more advanced version of the > chip just has more features along with a new register block. > > > > The PCAL65xx we are talking about add a further register > > > block, so following the existing concept its not a new layout. > > > > Yes, with one important detail, i.e. it extends the "mixed up" > > registers, it's not a separate "feature" in this sense. The separate > > "feature" can be, for example, PWM registers. I admit that this most > > of the angle of preference how to draw a line between the features. > > > > I prefer to see it as a type because of two things (in the current > > code): > > - OF_9*() macros take only two arguments, second of which is > > Interrupt related > > - PCA_INT group of bits is about Interrupt only > > No, the register set indicated by PCA_PCAL also allow setting pull > up/down which is supported by this driver. Furthermore the extra > registers of the PCAL65XX also allow configuring edge triggered mode > for interrupts. I really don't see why there should be 2 class of > features, that only make the code more complex. > > > Your proposal will disrupt the code (more invasive). > > I tried to implement what you like to see: > > 1 file changed, 105 insertions(+), 20 deletions(-) > > vs my proposal: > > 1 file changed, 65 insertions(+), 3 deletions(-) Do you have any repo to look for both solutions? -- With Best Regards, Andy Shevchenko