From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932627AbeARPWo (ORCPT ); Thu, 18 Jan 2018 10:22:44 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:31841 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932124AbeARPWn (ORCPT ); Thu, 18 Jan 2018 10:22:43 -0500 X-IronPort-AV: E=Sophos;i="5.46,378,1511852400"; d="scan'208";a="8374819" Date: Thu, 18 Jan 2018 16:22:28 +0100 From: Ludovic Desroches To: Linus Walleij CC: Ludovic Desroches , , Linux ARM , "linux-kernel@vger.kernel.org" , Nicolas Ferre Subject: Re: [RFC PATCH 2/2] gpio: provide a consumer when requesting a gpio Message-ID: <20180118152228.GX2989@rfolt0960.corp.atmel.com> Mail-Followup-To: Linus Walleij , linux-gpio@vger.kernel.org, Linux ARM , "linux-kernel@vger.kernel.org" , Nicolas Ferre References: <20180115162407.6314-1-ludovic.desroches@microchip.com> <20180115162407.6314-3-ludovic.desroches@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 18, 2018 at 11:30:00AM +0100, Linus Walleij wrote: > On Mon, Jan 15, 2018 at 5:24 PM, Ludovic Desroches > wrote: > > > It can be useful for the pinmuxing layer to know which device is > > requesting a GPIO. Add a consumer variant for gpiod_request to > > reach this goal. > > > > GPIO chips managed by pin controllers should provide the new > > request_consumer operation. They can rely on > > gpiochip_generic_request_consumer instead of > > gpiochip_generic_request. > > > > Signed-off-by: Ludovic Desroches > > I think we need to think over what is a good way to share ownership > of a pin. > > Russell pointed me to a similar problem incidentally and I briefly looked > into it: there are cases when several devices may need to hold the > same pin. > > Can't we just look up the associated gpio_chip from the GPIO range, > and in case the pin is connected between the pin controller and > the GPIO chip, then we allow the gpiochip to also take a > reference? > It's the probably the way to go, it was Maxime's proposal and Andy seems to agree this solution. > I.e. in that case you just allow gpio_owner to proceed and take the > pin just like with a non-strict controller. > > Yours, > Linus Walleij Regards Ludovic