Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp840775rwb; Wed, 16 Nov 2022 08:19:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4IdagD5b6WOa26xL+RjiAosWpjNbFIcAaJ8CvrHVuNZmUIt5kKh166i4D6Wr+3UQkGcAi7 X-Received: by 2002:aa7:c0c9:0:b0:467:a8cb:10c9 with SMTP id j9-20020aa7c0c9000000b00467a8cb10c9mr14857774edp.123.1668615575176; Wed, 16 Nov 2022 08:19:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668615575; cv=none; d=google.com; s=arc-20160816; b=Qru6bA1E62SQRn7rX4hRodGpZ0BI/EtudDKOk/stAwL020IvXmD5ZtFoHEMkQXrYWz FVNP4FD8Ce76BKogjustwjOuDFQyHnuEi5uQ0Xtq2za1SFdpFjiRD9E7hTjSSKXO6b7p k9PAJ06ZaHOxkOIH4lDzR23UGBjy6A2XFZndl+cjOS+cWw3K9ynIzzUOKV8bdO2L7NPD wPbpi4LHvwYg+Ahsjb+91r8LMEWahFWPV8Xk+W4Pdbv02BYtw4a59gbWB9el6LURaIrz mTrW0wG9zpBmg3rIQC2jR0/U49l+I/gy1y/0rDGv+Wb7TBLfgwBj7e19BLY9Js1gD77c ugxw== 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=YCtO68c0N+Ww36YT02rpqZ/a1z2pgv9Wp0TI/3HtDfE=; b=BhyKyC6+afN8zB0Q++77p8oXKXSEQ6+DGaIek6Xe8DNfDn4OQyPAwynX5mW0GDnnlU ScCApMkbWKWYW719I33YSTACULAob28WObH5frLTPfhK9SzMzY+A5imXkl8GdtZWS0cB fF72EBgvcKWnMk5gcecjzFqdPgp9f/H4/vJ9/NMRUSX3u9kfPJJoTVVjxlakXGk4toaP nB70WrNqhvijtayDqdHs2exHp/panUpK6gxAJK5ckset8PAGgrn1RzLTT3pDafs18s4N Ezc/zTIxL236cjukaxjq55ea4R2YnDgBH3v2Ko1So442N7pZswHxn9dxQ6wTzPTxEkKU 6lHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ODLUzvTY; 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 k4-20020a1709063e0400b0078d4ba46622si12490812eji.616.2022.11.16.08.19.13; Wed, 16 Nov 2022 08:19:35 -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=ODLUzvTY; 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 S233576AbiKPPyj (ORCPT + 91 others); Wed, 16 Nov 2022 10:54:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233490AbiKPPy0 (ORCPT ); Wed, 16 Nov 2022 10:54:26 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567D24C27F; Wed, 16 Nov 2022 07:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668614065; x=1700150065; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=CEMTVhD37/v0TOE4RjN1urcfJX/Nq7FS9gVShtgGvtM=; b=ODLUzvTYVN6KCKmuBls1n5ouRs27EyeCV8bDT0MBTtrdrnwiO2xPvuOr wLkOoYn+Jfvx8KDyBTr3E7bbo65UEV0GzHu3wkqYB/15AXm8UbLGyrGGB Xuypnn/ynWZo77sB5kOUk44OJhYgKwAgFbdKNonm0RLTYuVULjA/8inFI n4UNMVwHTNfOuzhzwhKVS9uTT9AjzTGZ2U5oXLrNoIYUfzB3zXSThayXX FJeYJhIna3DHudAhKOcnvHQaFKr/8s67FzGlQsdoP3b95KXYnbue0TUec oHalKYW/YnObYlXpI2emWBzfDhaDiQWBBI7sf6cn53txJC2KpE3lLs0lg A==; X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="310208251" X-IronPort-AV: E=Sophos;i="5.96,167,1665471600"; d="scan'208";a="310208251" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Nov 2022 07:54:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10533"; a="633670268" X-IronPort-AV: E=Sophos;i="5.96,167,1665471600"; d="scan'208";a="633670268" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga007.jf.intel.com with ESMTP; 16 Nov 2022 07:54:22 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1ovKk0-00DCi3-1R; Wed, 16 Nov 2022 17:54:20 +0200 Date: Wed, 16 Nov 2022 17:54:20 +0200 From: Andy Shevchenko To: Michael Walle Cc: William Breathitt Gray , robert.marko@sartura.hr, linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, broonie@kernel.org Subject: Re: [PATCH v2 1/4] gpio: regmap: Always set gpio_chip get_direction Message-ID: References: <1805d1ddb5bbce8e86164e66421ddde481cce4f9.1668129763.git.william.gray@linaro.org> 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=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, 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 Wed, Nov 16, 2022 at 04:41:30PM +0100, Michael Walle wrote: > Am 2022-11-13 14:21, schrieb William Breathitt Gray: > > On Sun, Nov 13, 2022 at 02:40:17PM +0200, Andy Shevchenko wrote: > > > On Thu, Nov 10, 2022 at 08:55:50PM -0500, William Breathitt Gray > > > wrote: > > > > If you only have reg_dat_base set, then it is input-only; if you only > > > > have reg_set_base set, then it is output-only. Thus, we can always set > > > > gpio_chip get_direction to gpio_regmap_get_direction and return > > > > GPIO_LINE_DIRECTION_IN/GPIO_LINE_DIRECTION_OUT given the respective > > > > register base addresses configuration. > > > > > > Seems legit to me. Have you checked if we have any gpio-regmap > > > drivers that > > > have something like this in their configuration already? In such > > > cases we need > > > to be sure they behave as expected. > > > > > > From the code perspective: > > > Reviewed-by: Andy Shevchenko > > > > I see gpio-sl28cpld has two device types SL28CPLD_GPO (output-only) and > > SL28CPLD_GPI (input-only); gpio-tn48m similarly has two device types > > TN48M_GPO (output-only) and TN48M_GPI (input-only). It doesn't look like > > the change in this patch will cause problems for them, but I'll let > > Michael Walle and Robert Marko comment if they see issues here. > > For the sl28cpld driver this shouldn't be a problem. So for that > Acked-by: Michael Walle > > But back when I wrote gpio-regmap the bgpio served as a blue print. > There is the same handling. If you look at gpiolib-sysfs.c there > is a comment about the direction property: > > * MAY BE OMITTED if kernel won't allow direction changes > > So from a gpiolib/sysfs POV I'm not sure about this change. Does > get_direction == NULL means setting the direction isn't possible? > OTHO there is a fat "MAY" :) > > Which brings me to the question of "why this change?". The commit > message doesn't mention it. Just out of curiosity. Sysfs shouldn't be considered nowadays as anything but deprecated and not-to-use interface. Hence, I don't care what it tells there. -- With Best Regards, Andy Shevchenko