Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4493701imm; Mon, 15 Oct 2018 16:11:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV63+lRIbhtMDuH3kSXrzitYNpXoQj7ZYwz7SX8bF3UOBaQx62yEprBToCeHho8exHmigzro9 X-Received: by 2002:a63:1411:: with SMTP id u17-v6mr17498316pgl.247.1539645066045; Mon, 15 Oct 2018 16:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539645066; cv=none; d=google.com; s=arc-20160816; b=Qs/zcoRXJxJykuYet2bc91NF4OcIvpvSWoLLvXhV8HriLzw5nBXzxjIBgVsIW/LT3z lM3B6lAMSWlPaNRLT/TuAnLxVwTJeV/T9zCPjH5/N4hADgMKCw3rm70SeeKA9RCEAJQt 32LIWG6gw7SctU00+TZU32WfKy7wttqSZvAGA0H9WZCp0FFOWQVAYuc8pct4yfnoUh+U G3JMEB85tX5dhAYaDjYZEUbWPOkq1Svxz2zf2aTlr1qc/1QfdNqSijB7nI1ejgX+HuDW xn4HOAj9tVvpGapfeGbRrZoORwxD56GWwvNCtMhFlXa17vN72kAk9ZWHdX3yvA37YETw 3sVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=j4XAFI48IoEt3UWUR9bN/qqPbwTPPlgvJl7rr7QmSVM=; b=Fbd/S1lCTncNQ3phrk5DsbIwx63B1x1Vp9QBMhR4cJpFCS6jfAwtOvNU3Zso0L9kqC 2g6WHP7CaT1XNbKG0eaaDj2yyacgM5JM9+fu64EO/VFfWy4QPNHUNfjSCWFR/UKuCJnI STHC51FJSHvsOW1OSWnb7zlx9Pld14HrzO6SCsubufpvTohmLxmKxdIKzxol8LcHsplT VSSY7KCshKnRuepO7iFin60imvINYuRDBkZvO8hjlsFvFpw8XmaZB/MU6AAbK4vaXR2Q VKqtYFQMupQWEMoEzAqf0c4eUfiATAVDXK+BJ8LDng5AEUZx2g1pNnszEaZsbHSexwxf Z5Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=T2uQhAVD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p19-v6si12090971pfi.12.2018.10.15.16.10.49; Mon, 15 Oct 2018 16:11:06 -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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=T2uQhAVD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbeJPG4Q (ORCPT + 99 others); Tue, 16 Oct 2018 02:56:16 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:56186 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbeJPG4P (ORCPT ); Tue, 16 Oct 2018 02:56:15 -0400 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C1871A81; Tue, 16 Oct 2018 01:08:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1539644930; bh=qYmffRecfbOImEZNJufFxnK08rw9AXp+6KGMK5hE9go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T2uQhAVDzQ3fplEaLZGglWrcfXjn/T6eSuKn/RhkPr+ap8qpEGZpXE67ucK+RmeQ2 oyx8xMrA9X8TX7iP5mN4xPSgnBWvw0+8QdKKP1ZtfNKqwof89RyKR6b3TwLx+cvTmV nPZ155J1v88G1vKc6YXLO+AyS2FIGBayquqta0Hw= From: Laurent Pinchart To: Mark Brown Cc: jacopo mondi , Linus Walleij , Liam Girdwood , linux-kernel@vger.kernel.org, Marek Szyprowski , Jon Hunter , Cheng-yi Chiang Subject: Re: [PATCH v2] regulator/gpio: Allow nonexclusive GPIO access Date: Tue, 16 Oct 2018 02:08:57 +0300 Message-ID: <2849502.hPNvL6TNkA@avalon> Organization: Ideas on Board Oy In-Reply-To: <20181012164424.GE2340@sirena.org.uk> References: <20181012125412.21324-1-linus.walleij@linaro.org> <20181012142612.GJ7677@w540> <20181012164424.GE2340@sirena.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Friday, 12 October 2018 19:44:24 EEST Mark Brown wrote: > On Fri, Oct 12, 2018 at 04:26:12PM +0200, jacopo mondi wrote: > > Sorry, I'm going slightly OT with this, but please read below. > > > > On Fri, Oct 12, 2018 at 02:54:12PM +0200, Linus Walleij wrote: > > > This allows nonexclusive (simultaneous) access to a single > > > GPIO line for the fixed regulator enable line. This happens > > > > I might have a use case for shared GPIO lines used as 'simple' reset > > signal for camera devices and not for regulators. > > This recently came up in ASoC too with audio CODECs sharing reset lines, > there was a discussion started with the reset API maintainer though no > response yet. CCing in Cheng-yi who had that problem. Not deleting > context for that. > > > See drivers/media/i2c/ov772x.c FIXME note in power_on() function at: > > https://elixir.bootlin.com/linux/latest/source/drivers/media/i2c/ov772x.c# > > L832 > > > > The reset line is in this case is passed to the driver by board file: > > https://elixir.bootlin.com/linux/latest/source/arch/sh/boards/mach-migor/s > > etup.c#L350 > > > > As you can see PTT3 is used for both sensors (I know, questionable > > HW design...) > > > > Do you think extending gpiod_lookup_flags with this newly introduced > > NONEXCLUSIVE one is an acceptable solution to avoid handling this in > > the sensor driver like we're doing today? > > One problem you've got there is that you need the two devices to know > about each other so they coordinate their use of the reset line. This > was relatively easy in the sysetm Cheng-yi has as it's just one driver > but what if there's mutiple drivers? That's relatively likely with > audio where you might have something like a CODEC with a separate power > amplifier. The regulator enable stuff is handling this in the core but > it's less clear where to put that for reset lines. I've seen other boards where two components sharing a reset signal have an active low reset for one, and an active high reset for the other one. Only one of the two can be out of reset at a time. That's probably considered as "clever" by the hardware engineers, but is awful to support for us. The core issue in my opinion is that we need code to handle this, and since the removal of board files there is no place anymore for such code. Board drivers exist in drivers/staging/board/, but that's hardly a solution moving forward (the TODO file explicitly states that removal of that code is the end goal). > > Please note this is an ancient architecture that boots from board > > files, but the same might happen in modern designs with OF support. Is > > there any clean way to handle shared GPIOs I might not be aware of for > > those systems? -- Regards, Laurent Pinchart