Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4393863ybx; Mon, 4 Nov 2019 12:37:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxvD3w3vq0q52BP/AJ2pKSGqkpFBNQCP+KL55d8e4xRQiVOxjdmh13YRVNH6Ef3eMRRAlss X-Received: by 2002:a17:906:1c97:: with SMTP id g23mr25963631ejh.66.1572899822077; Mon, 04 Nov 2019 12:37:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572899822; cv=none; d=google.com; s=arc-20160816; b=eBSTUE0NBQcTs27vXCMU4QL+m9kpCWZt6zv0sG72prwWYOP8WyU/3WeryzT1rK+lU0 8PZ2Xo151gmL9a6pRwc6smc3Y1KicC/PRUt2guz2Gn6VOgOxEdtAfVFM/kyBzhpE456e VNGYP6lKpJ5OE26lJXBxX9B7UmSFA7qHn2QhZuQ7iaH9S0v3Qma1dVGeEQ1Eb6fSuXSp mGTaTKgTpVS3ptSeTALACVFOu4uazM2cTAhkEFBaSL7AFMUGzpQLoUdfAmPvsqr/iw6Y ytrVsIEkgNCpozTjYL10YwYf921WtwvKGwPmlQ5tLGINUnFptkpVATi3KA0aRybM+Nh5 z4Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=KekS1mj1zQTj0reF49WchywdU6xsfJD9g9A7syG/AtE=; b=B/sCJboT4F71ZzDSeUnuJTbdOQA+uxgzBdLM9G4yqtcVeXgX7NoWKxA4rfgERIT3uy AriK6NloCk04ox9ApKGwp8cwLSQrADwOtNiewajBj0wSDyxIkum/Cnuu2RVdQTVYkRc1 nZTemKdp7+mSyAuVQQ5TnH4rzaYbqNgWT1XaJrFnRdEyv+SA+F6NyMr7CHu/sOHVShlz HZHZ/V4dYZcA9vtOQX4u+pugikyOKxrSZLbPHaaxePp4Xq4mTSneSGBqY+q3XetfteED 4gmqmR+ivuyE5cyMDiSyzcHZVpCWAMYEJspR/KpYwv8gBbyxiBojjgyL/5Z9v5Qm66sC bKqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si12344667eja.141.2019.11.04.12.36.38; Mon, 04 Nov 2019 12:37:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729658AbfKDUdv (ORCPT + 99 others); Mon, 4 Nov 2019 15:33:51 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:48417 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729607AbfKDUdu (ORCPT ); Mon, 4 Nov 2019 15:33:50 -0500 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iRj2p-00051i-3m; Mon, 04 Nov 2019 21:33:47 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iRj2o-00070j-61; Mon, 04 Nov 2019 21:33:46 +0100 Date: Mon, 4 Nov 2019 21:33:46 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Bartosz Golaszewski Cc: Miquel Raynal , Andy Shevchenko , Linus Walleij , Thierry Reding , "open list:GPIO SUBSYSTEM" , linux-pwm@vger.kernel.org, Linux Kernel Mailing List , Thomas Petazzoni , kernel@pengutronix.de Subject: Re: [PATCH] gpio: pca953x: Add Maxim MAX7313 PWM support Message-ID: <20191104203346.epdbzflnynh2gf3z@pengutronix.de> References: <20191014124803.13661-1-miquel.raynal@bootlin.com> <20191015163055.0d8f44e5@xps13> <20191104161103.64995b8a@xps13> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, Nov 04, 2019 at 04:32:23PM +0100, Bartosz Golaszewski wrote: > pon., 4 lis 2019 o 16:11 Miquel Raynal napisał(a): > > Andy Shevchenko wrote on Tue, 15 Oct 2019 > > 17:55:33 +0300: > > > > > Or other way around. PWM registers GPIO (which actually I prefer since > > > we have PCA9685 case where PWM provides GPIO functionality, though via > > > different means) > > > > > > > Can I have your input on this proposal? > > > > On one hand I agree that the GPIO driver is already quite big due to > > its genericity and the amount of controllers it supports, on the other > > hand: > > 1/ Registering a PWM driver from the GPIO core seems strange. Maybe > > registering a platform device could do the trick but I am not convinced > > it is worth the trouble. > > 2/ Putting the PWM logic in the drivers/pwm/ directory is not very > > convenient as the object file will have to be embedded within the GPIO > > one; this line in drivers/gpio/Makefile would be horrible: > > ... += gpio-pca953x.o ../pwm/pwm-max7313.o (not even sure it works) > > 3/ In any cases, the regmap's ->readable_reg(), ->writable_reg() > > callbacks shall be tweaked to turn the PWM registers accessible, so we > > would still have PWM related code in the PCA953x GPIO driver. > > > > In the end, I wonder if keeping everything in one file is not better? > > Eventually I can create a separate file and fill it with just the PWM > > helpers/hooks. Please advise on the better solution for you, I'll wait > > your feedback before addressing Thierry Reding's other review and > > resubmit. > > > > I'm not sure if this has been discussed, but is it possible to create > an MFD driver for this chip and conditionally plug in the GPIO part > from pca953x? I don't like the idea of having PWM functionality in a > GPIO driver either. I didn't check the manual or driver in depth, but I guess it doesn't match the MFD abstraction well. (That is, the PWM and GPIO parts live in different address areas of the chip and can be used independently of each other.) While it's not nice to have a driver that provides two different devices (here: gpio controller and pwm controller) similar things are not unseen. And for example the splitting of watchdog (drivers/watchdog/stmp3xxx_rtc_wdt.c) and rtc (drivers/rtc/rtc-stmp3xxx.c) of the device in the mx28 is more trouble than worth. So I'd vote for putting it in a single file that lives where the bigger/more complex part fits to. So assuming that's the GPIO part (as the driver supports several variants and not all of them have a PWM function if I'm not mistaken) having it in drivers/gpio is fine for me. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |