Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751828AbbF0QRw (ORCPT ); Sat, 27 Jun 2015 12:17:52 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:38945 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751217AbbF0QRm (ORCPT ); Sat, 27 Jun 2015 12:17:42 -0400 Message-ID: <558ECCA2.2070204@roeck-us.net> Date: Sat, 27 Jun 2015 09:17:38 -0700 From: Guenter Roeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Vivien Didelot CC: linux-watchdog , Wim Van Sebroeck , linux-kernel , kernel Subject: Re: [v2,2/3] watchdog: max63xx: add GPIO support References: <1434581940-15086-2-git-send-email-vivien.didelot@savoirfairelinux.com> <20150622165327.GA1189@roeck-us.net> <1645175105.110998.1435005823701.JavaMail.zimbra@savoirfairelinux.com> In-Reply-To: <1645175105.110998.1435005823701.JavaMail.zimbra@savoirfairelinux.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1768 Lines: 43 On 06/22/2015 01:43 PM, Vivien Didelot wrote: > Hi Guenter, > > On Jun 22, 2015, at 12:53 PM, Guenter Roeck linux@roeck-us.net wrote: >> On Wed, Jun 17, 2015 at 06:58:59PM -0400, Vivien Didelot wrote: >>> Introduce a new struct max63xx_platform_data to support MAX63xx watchdog >>> chips connected via GPIO. A platform code can fill this structure with >>> GPIO numbers for WDI and WDSET pins to enable GPIO support in the code. >>> >>> The driver takes care of requesting and releasing the GPIOs. >>> >>> Signed-off-by: Vivien Didelot >> >> would it be possible to use gpiod functions ? > > It might be, but I never played with it yet though. I'm using integer-based > GPIOs from a TCA6424 on an x86 platform (no Device Tree). Is it ok to keep > max63xx_gpio_{ping,set} for legacy GPIOs, and let someone add > max63xx_gpiod_{ping,set} if there is a need? > Hi Vivien, That would pretty much defeat the purpose. The gpiod API is supposed to replace the gpio API, not to augment it. Having both at the same time does not really make sense. There is a mapping from integer based pins to name based pins; check out gpiod_add_lookup_table(). Essentially platform initialization code (in your case probably the code which instantiates the tca6424) would set up a pin lookup table, and then you would request pins using a name instead of a number. That would also solve the "is the pin valid" problem in patch 3/3 since you would have a string to identify the gpio pin. Thanks, Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/