From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 8C787CA6F for ; Tue, 11 Nov 2025 16:01:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762876864; cv=none; b=JYpv16t/NLoNG3nblt3qcf+PBSTODP0dUSVAlKlRTmmbK5UOifzjjaps7+T/EVzPRliZ6HKexNO4HHsf+N64LTH597M5LdsIS8bDAvK5PndlUhXGvyLYZl91A1AOd8BMIBRxlU6any+j350+SvWNsk1/1qNCNt8ivRXh6A0lVNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762876864; c=relaxed/simple; bh=77IDsQYmahI9ijT7fLxWT1kp1PvqrF+ymBNFDP6vCX4=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=GrE+EUpqAoJxtYgp79kVrlyAHipmjBYi7K5R0fqdddouDt/WpuuzuXBVNEFWYUbejnHfK79/Oh4Sc/bhkyio6EkdtY22t1DxflzXO5+a490jGWNkuXzMsorktk4FoQC/mO+TScaiJKZEH50DJjA2cNeyGwwnfivHAJgAgG/VRuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P+d9MG4n; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P+d9MG4n" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-42b379cd896so1502361f8f.3 for ; Tue, 11 Nov 2025 08:01:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762876861; x=1763481661; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=77IDsQYmahI9ijT7fLxWT1kp1PvqrF+ymBNFDP6vCX4=; b=P+d9MG4nBoyxWhDPDQJA0O1mVI8+YM4UsEM8CRYYIJHS4Bq4CvDLIDWcq8Pe77AxW3 w0jrcrYi9lhXjhTQQQs7+WOrSLWoJICeMeQPv/uAgQB+wPcFyF+0d/qYgo7QHF5DMwui ajMjeH6QppL5KhnIHO71JqVB/6iod6WONzONszJZtWeJqMzHk7GSjnwYuyN6N0o+UcSr PmGc6iNfPEiFq5N2sWCXWtDHG/6E9xRGDDELea2S6ROK3B7p91oT4WR6gK5I9ETzl9rx NdRQpD8T9WIWJjOL1LSSJ94cwpAtH2PMD2Ed2F6CYjxRWcfLxHdfAdmuRhm3TfWq1D3g tS9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762876861; x=1763481661; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=77IDsQYmahI9ijT7fLxWT1kp1PvqrF+ymBNFDP6vCX4=; b=CcvtG3plD+0Mrze950trAFSV9WCEwj791VK3Za7B2TcWNAdGeo7WesgI7Z1QPb67pk iKsyDZMuZgpCLevbhBv9ijjZ8Ed86vd8o+VnU0Qfk/uZ0TMnVlcWfq6ymj/SkFuHro1S 1zT6I5O6SPI1Cm0Ci/lYwcgw5GHslILXAKXgQDIu38K/yz69DY586VHY4doNuF6WRYZ0 f/+Yala9SKrSTnOoYf7zj+eJ2Osy/1F8n983k43bFG2w3KITK6VSFb8fw1Ma188Odn2W 3xoZyKb7LeyctrJgKpywnod0eIyLvfGuwUf9T1j4OGt4rBb7F4ETYrwMlK3qtxnKJvbx bPcQ== X-Forwarded-Encrypted: i=1; AJvYcCUrtwj1qEwFboSDhDSnTvY3KquwcYBOy8KSOZSJV+YoitG8oHKhpc913Y3P4EDDxE+ifOK3IdihnwmdwhI=@vger.kernel.org X-Gm-Message-State: AOJu0YxMdRnfVEcvPQe+15FA1GU6egDSLCBpK4k9o1FsLkZ/7XOAJJx3 XYymOfEIMRcuiAD+mU0uh1xswJcLJwnsWVKmyHDNZx4qlneSXla19eu6 X-Gm-Gg: ASbGncug3ojfWuh6USqAr5YpQtMmcB25118cf2k/XHOm/1uamuBh4WKTe3uMTJctPO8 fEg/PjHjeBi4D0lvnrqVDytk19dsLAmRdEAv400d2sF7ucxHXmE1vE54Y5MMWtffvnUQ63BPfsb aeWNT8wHPAD+4on+qSYSE9cRQExZisz6I71f0tyTy+kWBUDY2JPdFcQKd4D9a/ITERVZFTjdW9Y wMupjDjkL5dwgCR/+hzJM8FdC+KOYZlM2xev1FQOa1Xx+8CK1hErjKFU1TvuLQ3IrTfk2noJwFR DYYjfBUanrUh1VPwlMzl+dTUPLjOWhgvNv7hLVpXtZE9uyovgLXvLCLgWbw8Yq4Q1RTAwqppLHf Oc5/WUAG76Az1maPn6w0S4y7VTRzxv/MPTNtrw8t0gI45qs8g71rX0OmIYFvKVMVXFG/y8Tofr8 +552Sd0Mf6sa626vbpsANZm1qt4LTdtQ== X-Google-Smtp-Source: AGHT+IFleuPQ+Yh44UnYxk7hUJZAz8lA8CHIsfFNcSgSsYUo+es9pg2BgzYwZlwbevsmgE0KNhYWtQ== X-Received: by 2002:a5d:5f83:0:b0:428:5673:11e0 with SMTP id ffacd0b85a97d-42b2dc8725bmr10989423f8f.40.1762876860585; Tue, 11 Nov 2025 08:01:00 -0800 (PST) Received: from [192.168.1.187] ([161.230.67.253]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b2e052f32sm22089171f8f.17.2025.11.11.08.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Nov 2025 08:01:00 -0800 (PST) Message-ID: <0cd7cf10d47683f22a4358635f243a2dfb6be564.camel@gmail.com> Subject: Re: [PATCH 2/2] gpio: adg1712: add driver support From: Nuno =?ISO-8859-1?Q?S=E1?= To: Linus Walleij Cc: Antoniu Miclaus , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 11 Nov 2025 16:01:36 +0000 In-Reply-To: References: <20251031160710.13343-1-antoniu.miclaus@analog.com> <20251031160710.13343-3-antoniu.miclaus@analog.com> <3ead5d7aa5e6be2b6df3bb91b35fec37e23353f3.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2025-11-11 at 12:05 +0100, Linus Walleij wrote: > On Mon, Nov 10, 2025 at 1:32=E2=80=AFPM Nuno S=C3=A1 wrote: > > On Mon, 2025-11-10 at 11:30 +0100, Linus Walleij wrote: > > > Hi Antoniu, > > >=20 > > > thanks for your patch! > > >=20 > > > On Fri, Oct 31, 2025 at 5:08=E2=80=AFPM Antoniu Miclaus > > > wrote: > > >=20 > > > > Add driver support for the ADG1712, which contains four independent > > > > single-pole/single-throw (SPST) switches and operates with a > > > > low-voltage single supply range from +1.08V to +5.5V or a low-volta= ge > > > > dual supply range from =C2=B11.08V to =C2=B12.75V. > > > >=20 > > > > Signed-off-by: Antoniu Miclaus > > >=20 > > > So tying into the binding discussion: > > >=20 > > > GPIO means "general purpose input/output". > > >=20 > > > I am really confused as whether this is: > > >=20 > > > - General purpose - seems to be for the purpose of switching > > > =C2=A0 currents and nothing else. > > >=20 > > > - Input/Output - It's switching something else and not inputting > > > =C2=A0 or outputting anything and this makes the driver look strange. > > >=20 > > >=20 > >=20 > > Not the first time a part like this pops up [1]. At the time, the final > > conclusion was to go with gpiolib. Naturally you can think otherwise no= w :) >=20 > I think we might wanna go with gpiolib for the Linux internals, maybe > we want to add some kind of awareness or flag in gpiolib that this is > a switch and not an output we can control the level of? >=20 > I could think of this: >=20 > - Make .get() and .set() in struct gpio_chip return -ENOTIMP > =C2=A0 no getting and setting these "lines" because we really cannot > =C2=A0 control that, these lines will have the level of whatever is on > =C2=A0 the line we are switching. >=20 > - Implement .set_config() and implement the generic pin > =C2=A0 control property PIN_CONFIG_OUTPUT_ENABLE as 1 > =C2=A0 to switch "on" and 0 for switch "off". > =C2=A0 See include/linux/pinctrl/pinconf-generic.h >=20 > This makes it possible to use the gpiolib in a way that is > non-ambiguous. >=20 The above makes sense to me. I'll let Antoniu take it from here and check i= f=20 the above fits the usecases he is aware of. Not sure if it makes sense for = a piece of HW like this but if the usecase is for userspace to control the on/off s= tates, then I guess we would need .get() and .set(). Or some kind of "frontend" dr= iver making use of the consumer helpers. Thanks! - Nuno S=C3=A1 > We might want to add consumer helpers in > include/linux/gpio/consumer.h such as: >=20 > #include >=20 > int gpiod_switch_enable(struct gpio_desc *desc) > { > =C2=A0=C2=A0 unsigned long cfg =3D pinconf_to_config_packed(PIN_CONFIG_OU= TPUT_ENABLE, 1); >=20 > =C2=A0=C2=A0 return gpiod_set_config(desc, cfg); > } >=20 > int gpiod_switch_disable(struct gpio_desc *desc) > { > =C2=A0=C2=A0 unsigned long cfg =3D pinconf_to_config_packed(PIN_CONFIG_OU= TPUT_ENABLE, 0); >=20 > =C2=A0=C2=A0 return gpiod_set_config(desc, cfg); > } >=20 > See e.g. rtd_gpio_set_config() in drivers/gpio/gpio-rtd.c for > an example of how the GPIO driver can unpack and handle > generic .set_config() options like this. >=20 > The binding however needs to be something separate like a proper switch b= inding > I think or we will confuse other operating systems. >=20 > Yours, > Linus Walleij