From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 09 Feb 2017 18:14:40 +0100 (CET) Received: from outils.crapouillou.net ([89.234.176.41]:38686 "EHLO outils.crapouillou.net" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23993133AbdBIROd7Ikxp (ORCPT ); Thu, 9 Feb 2017 18:14:33 +0100 To: Linus Walleij Subject: Re: [PATCH v3 04/14] GPIO: Add gpio-ingenic driver MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 09 Feb 2017 18:14:32 +0100 From: Paul Cercueil Cc: Rob Herring , Mark Rutland , Ralf Baechle , Ulf Hansson , Boris Brezillon , Thierry Reding , Bartlomiej Zolnierkiewicz , Maarten ter Huurne , Lars-Peter Clausen , Paul Burton , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Linux MIPS , linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, James Hogan In-Reply-To: References: <27071da2f01d48141e8ac3dfaa13255d@mail.crapouillou.net> <20170125185207.23902-1-paul@crapouillou.net> <20170125185207.23902-5-paul@crapouillou.net> Message-ID: X-Sender: paul@crapouillou.net Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 56744 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: paul@crapouillou.net Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips Hi, > What some drivers do when they just get/set a bit in a register > to get/set or set the direction of a GPIO, is to select GPIO_GENERIC > and just bgpio_init() with the right iomem pointers, then the core > will register handlers for get, set, set_direcition callback and > get_direction and your driver can just focus on the remainders. GPIO_GENERIC and bgpio_init() would work for my .set() / .get() callbacks, not for my .direction_input() / .direction_output() callbacks which need to set more than one register. > If you're not just replacing these with GPIO_GENERIC, please also > include a .get_direction() callback. My .direction_input() and .direction_output() callbacks just call into the pinctrl driver, using pinctrl_gpio_direction_[in,out]put(). I didn't find a way to get the direction info from the pinctrl driver, is that something that the core should provide? Thanks, -Paul