Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751769AbdFIHjb (ORCPT ); Fri, 9 Jun 2017 03:39:31 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:35208 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbdFIHj3 (ORCPT ); Fri, 9 Jun 2017 03:39:29 -0400 MIME-Version: 1.0 In-Reply-To: <20170601121826.14685-3-richard.genoud@gmail.com> References: <20170601121826.14685-1-richard.genoud@gmail.com> <20170601121826.14685-3-richard.genoud@gmail.com> From: Linus Walleij Date: Fri, 9 Jun 2017 09:39:23 +0200 Message-ID: Subject: Re: [PATCHv2 2/2] gpio: mvebu: fix gpio bank registration when pwm is used To: Richard Genoud Cc: Alexandre Courbot , Andrew Lunn , Gregory Clement , Jason Cooper , "linux-arm-kernel@lists.infradead.org" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pwm@vger.kernel.org" , Mark Rutland , Ralph Sennhauser , Rob Herring , Russell King , Sebastian Hesselbarth , Thierry Reding Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 934 Lines: 26 On Thu, Jun 1, 2017 at 2:18 PM, Richard Genoud wrote: > If more than one gpio bank has the "pwm" property, only one will be > registered successfully, all the others will fail with: > mvebu-gpio: probe of f1018140.gpio failed with error -17 > > That's because in alloc_pwms(), the chip->base (aka "int pwm"), was not > set (thus, ==0) ; and 0 is a meaningful start value in alloc_pwm(). > What was intended is mvpwm->chip->base = -1. > Like that, the numbering will be done auto-magically > > Moreover, as the region might be already occupied by another pwm, we > shouldn't force: > mvpwm->chip->base = 0 > nor > mvpwm->chip->base = id * MVEBU_MAX_GPIO_PER_BANK; > > Tested on clearfog-pro (Marvell 88F6828) > > Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support") > Signed-off-by: Richard Genoud Patch applied for fixes with Gregory's review tag. Yours, Linus Walleij