Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933114AbcCIPoR (ORCPT ); Wed, 9 Mar 2016 10:44:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37620 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932847AbcCIPoJ (ORCPT ); Wed, 9 Mar 2016 10:44:09 -0500 Subject: Re: [linux-sunxi] Re: [PATCH 0/4] Add AXP209 GPIO driver To: Maxime Ripard References: <1457520614-32239-1-git-send-email-maxime.ripard@free-electrons.com> <56E0146E.6050102@redhat.com> <20160309152822.GQ8418@lukather> Cc: Linus Walleij , Alexandre Courbot , Lee Jones , Chen-Yu Tsai , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com From: Hans de Goede Message-ID: <56E044C1.7080300@redhat.com> Date: Wed, 9 Mar 2016 16:44:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160309152822.GQ8418@lukather> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 09 Mar 2016 15:44:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2498 Lines: 62 Hi, On 09-03-16 16:28, Maxime Ripard wrote: > Hi, > > On Wed, Mar 09, 2016 at 01:17:50PM +0100, Hans de Goede wrote: >> Hi, >> >> On 09-03-16 11:50, Maxime Ripard wrote: >>> Hi, >>> >>> The axp209 PMIC used in combination to some Allwinner SoCs has a bunch >>> of GPIOs accessible. Some boards use these to control their backlight >>> or a few LEDs. >> >> Thanks for working on this, but IMHO this cannot go upstream like this, >> the gpio pins on the axp pmics need a pinctrl driver, not a gpio >> driver. I.E. on the axp209 gpio0 and gpio1 can also be used to output >> an additional low-noise ldo (so as a regulator), or as an adc input. > > Eventually, yes, it needs both. But they don't even have to be the > same driver, since they provide two different features. The only > reason we have that construct in the pio case is because they share > the same address space, but in the AXP case, the regmap and our mfd > take care of that already. Hmm, so your suggesting to have mfd instantiate 2 platform devices for this, a gpio and a pinctrl device, each with their own driver. Yes that would work, but I'm a bit worried about the 2 racing or some such since they both will end up touching bit 0-2 of register 0x90 / 0x92, more-over since they are both touching the exact same bits I've the feeling that this really should be one driver. I guess that in a proper written dts we either use pinctrl to enable a special function, or gpio, but still. >> I've been working on gsl1680 touchscreen support lately and on at least >> a few a23 tablets, the low-noise ldo is used as AVCC for the touchscreen >> controller. > > Yeah, the AXP209 also has an ADC connected to these pins. > >> Now these use an axp223 pmic, but nothing is stopping someone from >> doing something similar with an axp209 and I think it would be best >> to support this from day one, rather then hope we can retro-fit this >> later without breaking dts. > > I considered that, but I don't see how it would break the DT later. If > someone wants to enable say the ADC, he will of course have to add the > pinctrl driver, and the pinctrl handles, but the old DT will only > reference the gpio driver directly, which would still be something > that would work. I was assuming we would use one mfd-child(-platform)-device for this, not two. I guess that with 2 devices you're right and there should not be any problem, still as said it feels wrong-ish to have 2 drivers poking bits 0-2 of reg 0x90 / reg 0x92. Regards, Hans