Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751354AbeAPJ1J (ORCPT + 1 other); Tue, 16 Jan 2018 04:27:09 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:35055 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750954AbeAPJ1F (ORCPT ); Tue, 16 Jan 2018 04:27:05 -0500 X-Google-Smtp-Source: ACJfBovH4AkauPPs+YMjpUlfncGZzAyXbJf+kXPIKKMN/TgrXNeNGA/CmWIkI39YtT68UAodWBcpmeq9L4pH27RPH08= MIME-Version: 1.0 In-Reply-To: <20180115124205.29042-13-rf@opensource.wolfsonmicro.com> References: <20180115124205.29042-1-rf@opensource.wolfsonmicro.com> <20180115124205.29042-13-rf@opensource.wolfsonmicro.com> From: Linus Walleij Date: Tue, 16 Jan 2018 10:27:03 +0100 Message-ID: Subject: Re: [PATCH v7 12/17] gpio: madera: Support Cirrus Logic Madera class codecs To: Richard Fitzgerald Cc: Lee Jones , Mark Brown , Alexandre Courbot , Rob Herring , Thomas Gleixner , Jason Cooper , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , "open list:WOLFSON MICROELECTRONICS DRIVERS" , linux-gpio@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, Jan 15, 2018 at 1:42 PM, Richard Fitzgerald wrote: > This adds support for the GPIOs on Cirrus Logic Madera class codecs. > Any pins not used for special functions (see the pinctrl driver) can be > used as general single-bit input or output lines. The number of available > GPIOs varies between codecs. > > Signed-off-by: Nariman Poushin > Signed-off-by: Richard Fitzgerald > Signed-off-by: Charles Keepax > Acked-by: Linus Walleij I see Andy found more problems so fix those too.. > +#include > +#include Only #include > +#include > +#include Not for bool drivers, right, as Andy pointed out. > +static struct gpio_chip template_chip = { Why is this named "template"? There is nothing template about it, it is what you use. If you keep it like this, name it madera_chip or something. > + .label = "madera", > + .owner = THIS_MODULE, > + .request = gpiochip_generic_request, > + .free = gpiochip_generic_free, > + .get_direction = madera_gpio_get_direction, > + .direction_input = madera_gpio_direction_in, > + .get = madera_gpio_get, > + .direction_output = madera_gpio_direction_out, > + .set = madera_gpio_set, > + .set_config = gpiochip_generic_config, Pretty cool! Have you tested this with e.g. open drain or debounce? > + ret = gpiochip_add_pin_range(&madera_gpio->gpio_chip, "madera-pinctrl", > + 0, 0, madera_gpio->gpio_chip.ngpio); Are you using device tree for this? In that case add the range in the device tree instead. The gpiolib will pick that up for you by default and you don't even need this code. See git grep 'gpio-ranges' arch/arm/boot/dts If you're also using this with platform data or ACPI or whatever, then this is fine. Yours, Linus Walleij