Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5830282rwb; Mon, 5 Dec 2022 04:51:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf7LX6D8Qg9g9HrEYN7GwYkHnmQdN9XjfSgf21sMSRxOt6I8GgBhFOx9Q0YrVm5eENy1myo3 X-Received: by 2002:a17:906:f90:b0:7ba:9c18:11e7 with SMTP id q16-20020a1709060f9000b007ba9c1811e7mr46938050ejj.198.1670244683556; Mon, 05 Dec 2022 04:51:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670244683; cv=none; d=google.com; s=arc-20160816; b=Y2vltDqyyclGmku9yP6iIeTX5g0o3G7FS4lsyziqGIJg+JKomHG+I3UASLRJ3xEMI8 h5FXwu1rz8dAMxKSRI9IPVmFcPg+Tz6jXEF5YYJ81Ku8mI2/2VdXBrDMqYMeK2XgnXpJ /R2QHu+m0Y7g5h+/WUCt+t6GOoe8pqXk1okO3oMhkNnsa4ol+AbRHvRAXG7aY+MPD4PD K1MB9Gan2B9spDnT6j1CQHn9uat43Y4786bkuPrDP6PAkZ/DKo4u8bO1Zsb47pFjUOyq /Bia+sv7vhenrLJ/qQru0Jc+Vm2LrMG/ptmQZmUzLV3rM264m4lA74YXmvweolj17vAU ctcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jzP5v62pE/Cl70I3CVYzxPdyTGbQnFNedsgYykuBRDo=; b=Rdjh1lqa302B97WiKQE2AOmJeTPSrFu5w/lQ1Q45rxxwIVZNPTLReggp7cHXYNZnot hvwYXJeSMiE0vtBATcPYSLyIOeChdW121G/sQ2ts3Bc0PUvlAs3uIHnUQIWx0wIbgDxk 44VCLN5SlnueVqxsdeWXomtZEIy/QH9/7ar85uD2zpzStc69E6FAYV2DIKcPja3wtQyw AbuwcBqHrW07X3i6YsOCJubVgcqAFfViWqox27whkAOEp9Y5uMSlhPGD+IfiHZD/CN1S gWnyzNZJhq/gNj2n/d3yVhPQ4FEA1gsy8647J4tdm94Cg/ezHpeafanVcKiezCu57BfC gkvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXk61bxb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a50c309000000b0046751bddcf0si11126239edb.425.2022.12.05.04.51.01; Mon, 05 Dec 2022 04:51:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXk61bxb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231592AbiLEMIs (ORCPT + 82 others); Mon, 5 Dec 2022 07:08:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbiLEMIj (ORCPT ); Mon, 5 Dec 2022 07:08:39 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD70C19022; Mon, 5 Dec 2022 04:08:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670242117; x=1701778117; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=uJDU9m043EcXQE54s0k8c5YvgSAGF8dwhqSdHctP7KA=; b=nXk61bxbevVx+SIggjzDRSfk6Sqi5i1e7XgdXGOj+Wr6kd6IcZOLBG8C sHUifjlpgZmAdV9p3DAozL1JAiUDIcnJHJC0TenusQpgH6J0eyx7tQVw7 XCXrPDHhy6AUQ3W3v/vRgQvE6wHAVD7Dh/amh1YUbX6Anq/DNARl3IJur LnzGC4KqGPPFCRhMvInd7SRC5rAK+Ql6zL0YKgSPJ1cuZc5afkjuV7wiH z/TdjhEjxcq3cuiw6+qZWjQD543HTNG2f629EmPqG2SwerdWdNkgnHzXm vAjSPI/8gAzX1VpDv0BaDwR2uVv9UYDeW3kH7FfjJhO0ixCpxRKqc+53T Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="296028414" X-IronPort-AV: E=Sophos;i="5.96,219,1665471600"; d="scan'208";a="296028414" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 04:08:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="645796618" X-IronPort-AV: E=Sophos;i="5.96,219,1665471600"; d="scan'208";a="645796618" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga002.jf.intel.com with ESMTP; 05 Dec 2022 04:08:34 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1p2AGv-004rL6-04; Mon, 05 Dec 2022 14:08:33 +0200 Date: Mon, 5 Dec 2022 14:08:32 +0200 From: Andy Shevchenko To: Kent Gibson Cc: Linus Walleij , Marc Zyngier , linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , Jonathan Corbet , Hans de Goede Subject: Re: [PATCH v1 2/3] Documentation: gpio: Add a section on what to return in ->get() callback Message-ID: References: <20221130155519.20362-1-andriy.shevchenko@linux.intel.com> <20221130155519.20362-2-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 05, 2022 at 09:43:32AM +0800, Kent Gibson wrote: > On Sat, Dec 03, 2022 at 10:38:45AM +0100, Linus Walleij wrote: > > On Wed, Nov 30, 2022 at 4:55 PM Andy Shevchenko > > wrote: > > > > > +The below table gathered the most used cases. > > > + > > > +========== ========== =============== ======================= > > > + Input Output State What value to return? > > > +========== ========== =============== ======================= > > > + Disabled Disabled Hi-Z input buffer > > > + Disabled OS/OD/etc Single ended [cached] output buffer > > > + x Push-Pull Out [cached] output buffer > > > + Enabled Disabled In input buffer > > > + Enabled OS/OD/etc Bidirectional input buffer > > > +========== ========== =============== ======================= > > > > This looks about right to me, but we need more input, Kent? > > > > Firstly, I'm all for tightening up the driver contract, and hope that > whatever is decided will also be updated in driver.h itself. > > I can also understand Andy wanting to add support for Bidirectional > using the existing API. > > But, and please correct me if I'm wrong, the user has no control over > whether an open drain output is single ended or bidirectional, and > no visibility as to which the driver supports or chooses. > So the contract is still vague. > > My preference would be for the driver API to be extended with a new > callback for the output buffer, say get_output(), and have the existing > get() always return the input buffer. Both would return an error if the > buffer is unavailable or disconnected, e.g. in the Hi-Z case. > As per Hans' suggestions, this would keep the drivers simple. That's not about keeping driver simple, it's about how from hardware (electrical) point of view we should recognize the GPIO signal value. And I disagree on the input buffer to be always involved (in particular, not all hardware may support that anyway). That said, I will send an answer to all you guys, but just to make sure that we are on the different pages here I state yet another time that this is not about solely software p.o.v. And yes, there is no simple answer to the question. > Then cdev could determine the approriate buffer to return, depending > on the mode. Or, better yet, we extend that through the uAPI and > handball that decision to the user. TL;DR: I don't like this idea. -- With Best Regards, Andy Shevchenko