Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp859903lqh; Sun, 5 May 2024 05:25:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZ2bQj25bvl9G8C/RCF3UaFZzBDmti65AAH2s0Vx75bcXSZKIYUrtQFTeWsRUvVLp/nL5OkfKgDaDpQ2A8Wm2gzgfxk9AuoScY1IqwXg== X-Google-Smtp-Source: AGHT+IGTn2dRPnmHqPnei2i8oQObArZE44yW4LZKXYl8HeJLgV27uMtwACIPpjFWUDosdo/b0n9f X-Received: by 2002:ad4:5ba6:0:b0:6a0:d16b:9650 with SMTP id 6-20020ad45ba6000000b006a0d16b9650mr7478141qvq.59.1714911923281; Sun, 05 May 2024 05:25:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714911923; cv=pass; d=google.com; s=arc-20160816; b=CeSKUsbclan1SCBorHzc4OblK28CFkr84sD+bichBNABcVoMpSBlxUQekpqsxcKt9m cg9Kpq5Do9Rn6JJ39qVjHmT50nih8sDd2oxQbmBsMBrsDG7/ewfc0IAWe2kNLATZJlBM i0AjQAglD1NyJjQIk/gtvycaCNdTJ8ll2fJr2qKvi30AhHrKf1Hgs+03WwhoeZJF+BTk rc275ltePUPczXJb/VdWwX4Bqy5BGd5LjDDK5H6t4jo+Fc+c3ZNc9emd9bu9GhOySGrX 3UtH3N09d7W/Ql9B6XLpt9CdEn+/ja25C8L2RMSVvVhS+yz0V/FKXBEO9b8NkCMZF7+2 FONw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=I6d8pltQnbe1BNul8TKdyylJH57jCMCGH7OFNBm5Jck=; fh=tHZK5CCiBU/CJ6oAsNALR175v/nRrsftVpX6WQ5JYvQ=; b=kKbXL0B2CUnsK28DODseLaSKNpyIj32oPDX9DVJ1xwkDkRZOg+La84pNmfP1+VglPd zdxYVXTY9ToRbyU8adNfG4NS8qFdw9opI1gife5lMj1W88JFwJXjspnmEZOj2HA/ihGB 4Eo0TpYZ7TRueRi3fBH3YOVOjKluRupIja2fFDTLRlD62uYrv9wOWmJzKNfTDGtgpf9u 6c6hDBMh+Q+QJMxatf9RaZHHCh6DO36M7Uo9a8pa7jp3I8ZAoWrLRowdahhXSletgHUR Cu7OZWM7JKKw5XPV9t29B/netlHDoWOjqWwFTkNNHAUZTvT/KoMpxAUE2ohTg6S/qsO9 XcUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=C4rEVt+b; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-168968-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168968-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fo6-20020ad45f06000000b006993bbcb63dsi7151376qvb.549.2024.05.05.05.25.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 05:25:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168968-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=C4rEVt+b; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-168968-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168968-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id ED00B1C20A4D for ; Sun, 5 May 2024 12:25:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 425DA1BC5C; Sun, 5 May 2024 12:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="C4rEVt+b" Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3A7C17556 for ; Sun, 5 May 2024 12:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714911914; cv=none; b=nydk3Upowsy5UpXgQPLjKmg0bDCnpC8NuUg3p8+zR0PKhR81peUUW5zfUxv2ImsRe0vsEfBZ3RTJYd5cXuCmsjIC1kFi5qEzOAcHwPyO1qX8Hm7qpBZ0eSeH9447nKtaq2Vzff6Za6qsIUJYtlFUhGFbQ5b+Fia3+fAxTKkXUdI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714911914; c=relaxed/simple; bh=yrQqbN5qDXhsCWhv8edlKrikJt0tdGrh2rwpISyK1Jk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=BBwpzsvwRWWb2SD9TrvZWouwAzqDVEM04rcAZqJqfJBEnJ29xWGe3ssRm/mpFGsxyuGIFLJDpIlZx4L7OFMx6F02miURkxzPMqnS314fQYZ6Vuy7Uu2QlSVTCK3Q/Qpqxs05scGaWIeZXaHvgmnGcCiIJwukcAF59qcOskJt73M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=C4rEVt+b; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2e1fa1f1d9bso20354061fa.0 for ; Sun, 05 May 2024 05:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1714911911; x=1715516711; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=I6d8pltQnbe1BNul8TKdyylJH57jCMCGH7OFNBm5Jck=; b=C4rEVt+b13HI8XC3SCWwlaVD4zD2doCRm2g4yQsdhiE5iO35klgZphT3h/u/RpisiH 7yoHa2nHdEOY3AM9QPMEfwjhBcWkuohBcDXBmjZRy7WMQFknyy+Tq2iX3k0lYdMRCzni MlICsHei+6dF5hDf5vV8bz42G7ba8bx1+a5q+Jv5bjl8lPYmxLjzBeORfJBhwxGpcnXU ZAWIWIBYpuH+7RQ1oeEnZlm2xfWwU8467OEwzhv8rgeHCJ6Um7AYVyVcLeMPjVXVAvIP zXbkJHdqTIPNIN+JyGI5pfnir260CgZMod9PnvVN3ZJs/uXFGqpe6BwlVDQkVOeEvqei paig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714911911; x=1715516711; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I6d8pltQnbe1BNul8TKdyylJH57jCMCGH7OFNBm5Jck=; b=G06x68zlxqLZSkEMfcY3SFu+EDDFzOU5xElGQatm9JcyO6ZQrNc4G5nNwKqnZUC+Ts FobANSt1E2JHeoweJOJynqT7zV9mIFjxhXi+Ct9F36Tt8lvJ+9U3Crlkk8Lc7+m4D2tc 4mUpguQTCnm16heFIsnXPkR5khgDhbool7qG1CosaiT3x1AoHJKFtlOpIl5v1tRwUlzC FX2Qp6dUkBCqXjeYPQVjRDI88F/DD+2rHTP086hAKZIZBUgqbs1nANTm3BGsrEfdjwjC siuVDKWKDBMvam6Rkui8FdMWUXcFX73qAkoRic0KYllRB7fpd4JInvoiho0zT88Kxdi0 O5Dw== X-Forwarded-Encrypted: i=1; AJvYcCWtRWQ7Jq4h2hK5htP7Ve6/9+6B97PuhcOhDM05HEj4q5ImkosPtYgf4/2xw/JLU0U4Ghi5wVaFvyuht2u9fv/fXGWVXQaotM3HKL4O X-Gm-Message-State: AOJu0YyzI+Hfta/lWvonIbEjneoQNCW9+jo/mc2iflZhzqfjMMbBR8Wk bc0b+SXFazJEcWID42tNlW95iZWdB7HlbkjLpIaCVwHs0Hdt7VHc+rGd5nOBWNaVEeFxk+nb9p1 Z4CpF3eyqc5ePnhM59IA01ajje/8Oh84tNHsXzg== X-Received: by 2002:a05:6512:4027:b0:51d:d630:365c with SMTP id br39-20020a056512402700b0051dd630365cmr8601279lfb.4.1714911910873; Sun, 05 May 2024 05:25:10 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240424185039.1707812-1-opendmb@gmail.com> <20240424185039.1707812-3-opendmb@gmail.com> <45b7742c-9cde-4238-9c2c-c75dfbe9d8f3@gmail.com> In-Reply-To: <45b7742c-9cde-4238-9c2c-c75dfbe9d8f3@gmail.com> From: Bartosz Golaszewski Date: Sun, 5 May 2024 14:25:00 +0200 Message-ID: Subject: Re: [PATCH 2/3] gpio: of: support gpio-ranges for multiple gpiochip devices To: Doug Berger Cc: Linus Walleij , Phil Elwell , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 3, 2024 at 10:21=E2=80=AFPM Doug Berger wro= te: > > On 5/3/2024 1:25 AM, Linus Walleij wrote: > > Hi Dough, > > > > thanks for your patch! > Thanks for your review! > > > > > I'm a bit confused here: > "Communication is hard" and I may be confused about your confusion, but > hopefully we can work it out. > > > > > On Wed, Apr 24, 2024 at 8:51=E2=80=AFPM Doug Berger = wrote: > > > > > >> + /* Ignore ranges outside of this GPIO chip */ > >> + if (pinspec.args[0] >=3D (chip->offset + chip->ngpio)) > >> + continue; > >> + if (pinspec.args[0] + pinspec.args[2] <=3D chip->offse= t) > >> + continue; > > > > Here pinspec.args[0] and [2] comes directly from the device tree. > > > > The documentation in Documentation/devicetree/bindings/gpio/gpio.txt > > says: > > > >> 2.2) Ordinary (numerical) GPIO ranges > >> ------------------------------------- > >> > >> It is useful to represent which GPIOs correspond to which pins on whic= h pin > >> controllers. The gpio-ranges property described below represents this = with > >> a discrete set of ranges mapping pins from the pin controller local nu= mber space > >> to pins in the GPIO controller local number space. > >> > >> The format is: <[pin controller phandle], [GPIO controller offset], > >> [pin controller offset], [number of pins]>; > >> > >> The GPIO controller offset pertains to the GPIO controller node contai= ning the > >> range definition. > I think we are in agreement here. For extra clarity, I will add that in > my understanding pinspec.args[0] corresponds to [GPIO controller offset] > and pinspec.args[2] corresponds to [number of pins]. > > > > > So I do not understand how pinspec[0] and [2] can ever be compared > > to something involving chip->offset which is a Linux-specific offset. > > > > It rather looks like you are trying to accomodate the Linux numberspace > > in the ranges, which it was explicitly designed to avoid. > The struct gpio_chip documentation in include/linux/gpio/driver.h says: > > > * @offset: when multiple gpio chips belong to the same device this > > * can be used as offset within the device so friendly names can > > * be properly assigned. > > It is my understanding that this value represents the offset of a > gpiochip relative to the GPIO controller device defined by the GPIO > controller node in device tree. This puts it in the same number space as > [GPIO controller offset]. I believe it was introduced for the specific > purpose of translating [GPIO controller offset] values into > Linux-specific offsets, which is why it is being reused for that purpose > in this patch. > > For GPIO Controllers that contain a single gpiochip the 'offset' member > is 0 and the device tree node offsets can be applied directly to the > gpiochip. However, when a GPIO Controller contains multiple gpiochips, > the device tree node offsets must be translated to each individual gpioch= ip. > > > > > I just don't get it. > > > > So NACK until I understand what is going on here. > > > > Yours, > > Linus Walleij > I hope it makes sense now, but if not please help me understand what I > may be missing. > > Thanks, > Doug > Linus, Please let me know if this is still a NAK, if so, I'll drop this series from my tree at least for this release. Bart