Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5764352imu; Mon, 26 Nov 2018 05:03:13 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xqqu7RraMYPZQvRVJA8oDjrgzqD7RZioKAzknPmipY0w1o8LjRg8RthAivK3GPRlgYaR27 X-Received: by 2002:a63:b105:: with SMTP id r5mr25038917pgf.442.1543237393215; Mon, 26 Nov 2018 05:03:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543237393; cv=none; d=google.com; s=arc-20160816; b=fiJX7PvL/L7frMnd0oHczkT9GRsrshovsib2UGZDNwQtQqA8W7tvSqHiTlUcJzYzk/ MqLpPe0KqdGCXdtTbk0mJ6o0yaDfx7a7gN+0ClAd75fLqdi/WLZMsdXti4Peb0/MQmfg LpOwY7feHdtUmRp3wQEWU4pfF1tyXsaoHrD+GiX7TZFLt3weK76rvWEx+R+MZqXc75zN aI1YIeL3o/2bEMYAg/HR0xJTXxbSu9p3eQloCRgLvJ8oDRg+MQZqMgiUYhWjbivpj1bj wd1Bi4gTsEGhPeJ/DVCO30k7xX6AJ49p6FQzAit+in4p+vrOW4TAK/WKOkzMFqCxl/Yz oLZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lwGEspYDqZsDXGH4FIOndSmuFp2CbZJQH8mWt1ez0Z8=; b=JKIa5xBeyZaD+ilUUvDRwb7EkKDMpGT2/R7PJeqFYWM/pyJqulCJ+ji2Pjp5xIMF0U 624gbJbhLg82UrhC5AU7knQcWFToqPb5PhbxO25nZnJGzBh0DFvcJuj/lBjrMIXPytIO hmNU/XvM0pWz4sIMf01jTr1WkmL7G2YOI2CRliJoZKiMnMBMJ+jTwn5h2gD5WXG7019g bnGSmNEgN56oOW72+3irwOpKcjbQDFzxlWUp4wk9f1RGApbvkPfVfGRjTPEuMkQcWSyE DUPk0AxhejgqVfuN0ckRh1r9kBJsPVJWYWtr0q00CJnXyw3plkiUdGcXwG1i09BsRTrj PxNw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si243871plz.220.2018.11.26.05.02.25; Mon, 26 Nov 2018 05:03:13 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbeKZXyP (ORCPT + 99 others); Mon, 26 Nov 2018 18:54:15 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:27239 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbeKZXyP (ORCPT ); Mon, 26 Nov 2018 18:54:15 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wAQCjmqp006020; Mon, 26 Nov 2018 07:00:03 -0600 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail4.cirrus.com ([87.246.98.35]) by mx0b-001ae601.pphosted.com with ESMTP id 2ny3xu2dhu-1; Mon, 26 Nov 2018 07:00:03 -0600 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail4.cirrus.com (Postfix) with ESMTP id E8422611C8B6; Mon, 26 Nov 2018 07:03:30 -0600 (CST) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 13:00:02 +0000 Received: from imbe.wolfsonmicro.main (imbe.wolfsonmicro.main [198.61.95.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id wAQD01IX014558; Mon, 26 Nov 2018 13:00:01 GMT Date: Mon, 26 Nov 2018 13:00:01 +0000 From: Charles Keepax To: Mark Brown CC: Linus Walleij , Liam Girdwood , Marek Szyprowski , "linux-kernel@vger.kernel.org" , Subject: Re: [PATCH 3/3] gpio: Add reference counting for non-exclusive GPIOs Message-ID: <20181126130001.GN16508@imbe.wolfsonmicro.main> References: <20181122173015.23905-1-ckeepax@opensource.cirrus.com> <20181122173015.23905-3-ckeepax@opensource.cirrus.com> <20181123105729.GM16508@imbe.wolfsonmicro.main> <20181123132522.GE2089@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20181123132522.GE2089@sirena.org.uk> User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811260118 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 23, 2018 at 01:25:22PM +0000, Mark Brown wrote: > On Fri, Nov 23, 2018 at 10:57:29AM +0000, Charles Keepax wrote: > > > It's fixing something in the case of two regulators using the > > same GPIO. The direction this patch chain takes is that the end > > drivers own the GPIOs not the regulator core (except for the > > legacy case). So both of the end drivers will devm_ request their > > The situation with descriptor based GPIOs is a bug - the reason why the > core does the request in the legacy case is precisely the problem Linus > identified. Once a GPIO is shared all the users of the GPIO need to > coordinate with each other in order to set the value so the refcount by > itself in the GPIO core isn't super useful unless it can also serve to > help the multiple users find each other somehow. I think what we want > to do here is either push the gpiod requests into the regulator core or > change things so that once the regulator is registered with the > regulator core the regulator core owns and is responsible for freeing > the regulator. On the co-ordinating do we expect that the behaviour will be that the GPIO should in the "enabled" state whenever any regulator is requesting it? IE. the GPIO state is an OR of the regulator states. Or are we expecting to handle more complex interaction? Thanks, Charles