Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9377120rwr; Thu, 11 May 2023 14:07:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ui+orXF3gokrdw0j5gRAhOfhhaaw68ngXZNfg+iMVppoaMaCqiahZFAHntY5w+tWuM6NV X-Received: by 2002:a05:6a21:7891:b0:101:73a9:1680 with SMTP id bf17-20020a056a21789100b0010173a91680mr13350981pzc.8.1683839243298; Thu, 11 May 2023 14:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683839243; cv=none; d=google.com; s=arc-20160816; b=v0DRpBcb3uqTBHbFTXBem7IIFuTMF7QBvYfR3ykXgKzRZU0HNQZ5kUkTQSq87FS9iJ VA/lSywd+dzImjfsknvhH+xqqK6lQxx1Ap40U5vGbbvZWpkhfPwehtOyJXOSXQEh9YEv CILjmmZvfyA8M8p+jFDoXShzjZS+4vVX2zyeXO27sXOFupIUxJxix9fSF2JCTrybCr0o NFK1aUrKvcwLH1k/o8WHMeEkEQFrZgWHTEuqvWrdti4kI5bSDVG8azsfTc60EigPkXe+ 3Bw1wJauY7A7Fi82Hm+h24NrSxJQ4SGFGAKooCgJiRfXjIc2aU2UVDOvGM6vn1Q4jqd6 X+yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Fz02z/ThyjpX0LKTQ8oYmnrLC6kyoGFXG/YjGLfaNeE=; b=pcBVrCZk1aH5hoZ9A+xw/SVwsOjLgKnTHXzMHUXveOKnJQklVagtWU3O4MRydB5qcG 1CYx3BkltZ1LJ85F3RYNx064RwyiWPAT8iqCPx5GMmh1L6G2zzQojSSK2hXH/ygFkXe5 2E0r+z6llqpxQpbkp+1OG4fHxuwPYePkAoRsDN7p9hT9kUyrRUV5kR54uU1zzhZJ4C1C qh7um+c9fvUWdUeCeI22O6r0k3+cqHBgKlW6szPiYcJ/IR1ErLvW2SYUfFjH+Pqxzggx +d6TA7LSBQs+QRdc37KrHNZ5tnsbn8EzQPZ2fa9vR9rhnzAD4Pf9/UvrK7/EprbmCzv2 NcNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tZ27P4Q8; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a6566d4000000b0050bcfe667e7si7509561pgw.474.2023.05.11.14.07.11; Thu, 11 May 2023 14:07:23 -0700 (PDT) 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=@linaro.org header.s=google header.b=tZ27P4Q8; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239177AbjEKU6C (ORCPT + 99 others); Thu, 11 May 2023 16:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239236AbjEKU6B (ORCPT ); Thu, 11 May 2023 16:58:01 -0400 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BFF583DE for ; Thu, 11 May 2023 13:57:58 -0700 (PDT) Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-b9a824c3a95so11499291276.1 for ; Thu, 11 May 2023 13:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683838677; x=1686430677; 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=Fz02z/ThyjpX0LKTQ8oYmnrLC6kyoGFXG/YjGLfaNeE=; b=tZ27P4Q8s5TUk2UDELLo5fEBRXC4T/qiZk0g7SeiyIRw2ZViuSud3+C9Wd2+ypw92C ipih7nmrhqfh8F1sOgdIR5wsckpGjFy5BTuWO4WmDHm1GmVhax4UP3P9nECFvenRxL7r IKDPHCltmKrxzo1Zohps7I+QdVIqNTmLzrcNmMGx6SPcoyQ/PiE5W+CCzwXpihymmbR+ mULEVBiO25de9xqmGMpLsPu5cCHRI0iqEwqSheNg7GzmKktD6iAZ1wHGtdndCbj5Km1T pgWUMDhl/Epq+lE7+/Yyiv/hBtjMLy5yNFVJro8YZ0W465DvkfZLH0pUqCkQhax8dM7V sz5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683838677; x=1686430677; 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=Fz02z/ThyjpX0LKTQ8oYmnrLC6kyoGFXG/YjGLfaNeE=; b=gMl9s6NYd5cGUIPKr+O8RCgCfXkAiFbJ4zawvt2TsMx7bklbErKkDuICb5XUC4lOgl vbPUCraQQdxG75ce3Z2p9TLAGpfcGDshDjMkX0h96e1J3e7qMes+TIw9nTuY9UlH5xgf W4DGZnDf2SU4/4c7bqYEkDnEmMuhO07GTS+pWAFSXkN9s5FsYNWnuRkVfz3o4PwNIgVh Bo/TxuobnbhluLc5Kmvo4hdLUAVIrZVD/foExsX7ojehiNFWy+Qvk8Wa5ZYaDGpHl5rZ wXJ81R44drbNCJhwQWeABbgfF4UmeCWUuqEnBLAXkSabQnNMDfceqYUXtHzQnoldfb0L A8tA== X-Gm-Message-State: AC+VfDya7/gWpOzoZtIKTC56AQXQwYZsE6RHgQg8m9RQEx+tCPTZUNe3 u6advKTGKCbXbjguiHCvIKgnssoG2xtdgAxttLxM5A== X-Received: by 2002:a05:6902:702:b0:b9e:5aad:edda with SMTP id k2-20020a056902070200b00b9e5aadeddamr24679402ybt.4.1683838677612; Thu, 11 May 2023 13:57:57 -0700 (PDT) MIME-Version: 1.0 References: <20230511-tps65219-add-gpio-support-v2-0-60feb64d649a@baylibre.com> <20230511-tps65219-add-gpio-support-v2-1-60feb64d649a@baylibre.com> In-Reply-To: <20230511-tps65219-add-gpio-support-v2-1-60feb64d649a@baylibre.com> From: Linus Walleij Date: Thu, 11 May 2023 22:57:46 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] gpio: tps65219: add GPIO support for TPS65219 PMIC To: Jerome Neanne Cc: Bartosz Golaszewski , Tony Lindgren , Lee Jones , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org, Jonathan Cormier Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Thu, May 11, 2023 at 4:09=E2=80=AFPM Jerome Neanne wrote: > Add support for TPS65219 PMICs GPIO interface. > > 3 GPIO pins: > - GPIO0 only is IO but input mode reserved for MULTI_DEVICE_ENABLE usage > - GPIO1 and GPIO2 are Output only and referred as GPO1 and GPO2 in spec > > GPIO0 is statically configured as input or output prior to Linux boot. > it is used for MULTI_DEVICE_ENABLE function. > This setting is statically configured by NVM. > GPIO0 can't be used as a generic GPIO (specification Table 8-34). > It's either a GPO when MULTI_DEVICE_EN=3D0, > or a GPI when MULTI_DEVICE_EN=3D1. > > Datasheet describes specific usage for non standard GPIO. > Link: https://www.ti.com/lit/ds/symlink/tps65219.pdf > > Co-developed-by: Jonathan Cormier > Signed-off-by: Jonathan Cormier > Signed-off-by: Jerome Neanne (...) This overall looks fine. > +static int tps65219_gpio_change_direction(struct gpio_chip *gc, unsigned= int offset, > + unsigned int direction) > +{ > + struct tps65219_gpio *gpio =3D gpiochip_get_data(gc); > + > + /* Documentation is stating that GPIO0 direction must not be chan= ged in Linux: > + * Table 8-34. MFP_1_CONFIG(3): MULTI_DEVICE_ENABLE, > + * Should only be changed in INITIALIZE state (prior to ON Reques= t). > + * Set statically by NVM, changing direction in application can c= ause a hang. > + * Below can be used for test purpose only: > + */ > + > +#if 0 > + int ret =3D regmap_update_bits(gpio->tps->regmap, TPS65219_REG_MF= P_1_CONFIG, > + TPS65219_GPIO0_DIR_MASK, direction); > + if (ret) > + return ret; > +#endif > + dev_err(gpio->tps->dev, > + "GPIO%d direction set by NVM, change to %u failed, not al= lowed by specification\n", > + offset, direction); > + return -EOPNOTSUPP; > +} Normally people would complain about #if 0 code. But this is a special case! I definitely want the code to be in there somehow. What about: if (IS_ENABLED(DEBUG))? If someone enables debug with an explicit -DDEBUG to the compiler this could be allowed. Yours, Linus Walleij Yours, Linus Walleij