Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2599120imm; Thu, 11 Oct 2018 12:56:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV604zgC64f2P0Xq94xlxXSMHpoi724gpXWm4GyNOKLLKuC2yzuiZFdijWpVfLlf0Ws+pEMdL X-Received: by 2002:a62:210:: with SMTP id 16-v6mr3054380pfc.100.1539287794744; Thu, 11 Oct 2018 12:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539287794; cv=none; d=google.com; s=arc-20160816; b=boBBGrz5ytyZasqSNkJKgdn0U2fOGib2SwaxIMiawaQ4pGrrVs1YrnqWFr+aASEJNa fh9efmk2V8Ak94IXthSl/N0Ph5410aIlJkkqDtEcUaOWAuveTfTTJgf/pyxJDIPbNfOL 47jq5wWiimG4SjmlvJELoKWMmsFoClYDj8mx9N+NG3biq/8+LmcMFhZ6xuwvdtvyyPp+ vAE0XP92aXarvgv3Tm0AXb+IyiDIPMeVYgVMoqmDSBEd9ufEWSwTBq9OWbmW6HyWvEEG rVymdP/znivmqR2FSssVH8JssgLSgvuUtuk9htOR/zSP0NU2qm+bocboHsHh5/HAp2x1 P3eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9IY/hrivm6igAzQQagDcNEdfa+HIsd26jr/DwDs3xuA=; b=NQrv7zMNlyZmA0AZnXxS6B8TghoAh17MMvIPJzuMepEOeF5HPK7z63gvQOKa9315UB kbp2JlxHEQd7BACKnAW3kAclooD6Y1sfqmQZRcQZvZ8Ez9abZDVgk6VGD2SLJX3n8ba8 wAC5pvHZuTigJiKqrEfZlsjQC5tcIiUci6EK6XNwVg67KXm5iNca0KhJfJZZHXycrQjI uHzJDcKNCiP6RFLLGQpiU7L8Dgc12JFwnL2P4PTb6cuo6ZdkFopsbov9jh1uKh9LX/SD cxE+uxM4SuCu+H87F/mpiTZ8GuYullbZ2fOaDjxz77MqNZv6SRdST7ENk/jM81CtaKnb LzHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d7NfRxCL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6-v6si27637844pgi.160.2018.10.11.12.56.08; Thu, 11 Oct 2018 12:56:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d7NfRxCL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729492AbeJLCJ4 (ORCPT + 99 others); Thu, 11 Oct 2018 22:09:56 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:39748 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727944AbeJLCJ4 (ORCPT ); Thu, 11 Oct 2018 22:09:56 -0400 Received: by mail-it1-f196.google.com with SMTP id w200-v6so14713347itc.4 for ; Thu, 11 Oct 2018 11:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9IY/hrivm6igAzQQagDcNEdfa+HIsd26jr/DwDs3xuA=; b=d7NfRxCLYsiEfcMR9NRtCGrRAw9LPE1ekAmIG7oO3d4Z6hbDo+kfo6oBUWrcPF8Ldb bH3DbP6FKJY683TAoX48TMWT2qV4mw52vevjro3nLzxm/JjVewyCWm5MA4UPWIjBxeoJ siWnpNsbKvnPFboSEc0ggu8iw8iZgEdQ2XDcI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9IY/hrivm6igAzQQagDcNEdfa+HIsd26jr/DwDs3xuA=; b=uOJzyxQtoGRBElMeBDZJtUUgQNsYWy0nhHAG0wb3oVuvePLMuEs8B91FrY7s/4LYQj GJFVEaL3KROeuBtcLmI7F32jdz1hxt8wlzij04kJZkhb/Nee2/62vbRxNfovZOIRG0GU X8LoEp8JuFzatqrK0LHP5elLN15pvO//foQB1iNRYpCyytSq40zhgMsjXIdUE8SDt6L7 /U5vbXODSqNRtwXbrbuyJtzQ+CzOFM9++sv4v/7H83/TtUlUwFmmUvOvIyJNSBM5Y78V AFIka9dAvkeFjXeH8b5PuKvNOvDW3vYlfg4a6LcuLKpAG95QEPTA9kvWIEf7uwbcAYtW EV/A== X-Gm-Message-State: ABuFfogkNdzFAl7Z21xhT3oSPzZuP8lRJiFkqn7wXA6oaOXZQTUuo3/G lp3mDna0huyd4cZ3u+gVhZFZikEnOU7C5hrysSwMk4xOm28= X-Received: by 2002:a24:e0c8:: with SMTP id c191-v6mr1607431ith.156.1539283289834; Thu, 11 Oct 2018 11:41:29 -0700 (PDT) MIME-Version: 1.0 References: <20181011143531.7195-1-linus.walleij@linaro.org> <20181011144330.GF25351@sirena.org.uk> <20181011175406.GH25351@sirena.org.uk> In-Reply-To: <20181011175406.GH25351@sirena.org.uk> From: Linus Walleij Date: Thu, 11 Oct 2018 20:41:16 +0200 Message-ID: Subject: Re: [PATCH] gpio/regulator: Allow nonexclusive GPIO access To: Mark Brown Cc: Liam Girdwood , "linux-kernel@vger.kernel.org" , Marek Szyprowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 7:54 PM Mark Brown wrote: > On Thu, Oct 11, 2018 at 07:01:13PM +0200, Linus Walleij wrote: > > On Thu, Oct 11, 2018 at 4:43 PM Mark Brown wrote: > > > On Thu, Oct 11, 2018 at 04:35:31PM +0200, Linus Walleij wrote: > > > > enable line so you don't need to use the bus to do the enables. That > > > should just be a case of adding this flag to all the drivers that have > > > already been converted to gpiod (including the core code that's in > > > regulator_ena_gpio_request() which I thought was coping with this > > > already) unless I'm missing something? > > > Sorry if I don't get it... we already have code in the core to > > check if the same gpiod is used by two regulators. > > regulator_ena_gpio_request() does this: > > > if (config->ena_gpiod) > > gpiod = config->ena_gpiod; > > else > > gpiod = gpio_to_desc(config->ena_gpio); > > > So after the change I made to fixed.c this comes in through > > config->ena_gpiod. > > Other regulators that have GPIO control for their enables do their own > requests (as does the core) so don't they all need to set the flag > GPIOD_FLAGS_BIT_NONEXCLUSIVE when they request otherwise it'll only work > in systems where the regulators after the first that request the GPIO > are fixed regulators? Yeah ... I guess I assumed that the same enable line is not used for a fixed regulator and then some other regulator (which is not fixed). If this is common practice we need to account for it. Obviously I have no idea what is common practice :/ gpio-regulator.c will work fine since it passes in a global number (still) so it will just grab the desc out of the GPIO with the legacy function and go on. (I need to keep it in mind when refactoring that one later though!) Do we know some way to identify the affected systems or should we just tag on GPIOD_FLAGS_BIT_NONEXCLUSIVE on all the stuff we converted to descs to play it safe? (I can cook a patch.) Yours, Linus Walleij