From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 361DCC4338F for ; Wed, 18 Aug 2021 06:26:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1704160FDA for ; Wed, 18 Aug 2021 06:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238789AbhHRG1a (ORCPT ); Wed, 18 Aug 2021 02:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240245AbhHRG1P (ORCPT ); Wed, 18 Aug 2021 02:27:15 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4029BC061224 for ; Tue, 17 Aug 2021 23:26:07 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id c12so3080360ljr.5 for ; Tue, 17 Aug 2021 23:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0niOOKpLOqJWr+G2N4qsyCfMLmKR4C8+b8TBbZbKaU8=; b=Et8efFBgzM1OWhTpqkovSGInq7BYnqTenDPJF5Sfp/8L2BDfO3pcqtdv6gK9Xf6rVi bPlFqq3u2Mlnv1Oxq7zttZXNhuIFaIoCKH5Il61HHre6WKqQXBgZ2rtyo6Ql01WiAgAf iqwYaadnd/cBDGdzYU20uWob0rjtS561A0+w4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0niOOKpLOqJWr+G2N4qsyCfMLmKR4C8+b8TBbZbKaU8=; b=cTajntYZmX6vZU+etHOUqIRr/l0eiFsxj3VAEYQSf8aGpG3pkHXMrSKa/uvHRdviwl W/8R5XSw2OnrLr9jcIxmsgnXnXweIu3K15ksarSEn6shEIPNQt4BENOcTCa5WF+uE0Xt uasSxcP4GWbK0qL5cd5roG4s7Pm4q5BxiA2ZFv9iRRC4vdmVQ4BI7qw6y3AXdXkal6o5 FA5kQjCTgEYyrKi+nopVG3ZGaeLvMfKMYqMSXEomCtsc10lknubKEWl4sP+WUJih8OJ7 Se6J/QHsBEkzpXWSXyUEhaXFU2IN8JzUtVRiGlO6lfPFF5bGdFJj5A4SFsc2jfNHvtky c0Qw== X-Gm-Message-State: AOAM530d3YZ0NkYtgqK0lEVXC0DayS7gATSwWmKTK8A+eLWyZjb8WohG yZjZRO49jL/Bwyh80Od5tuhVq01uww5wbt7pgVOWtA== X-Google-Smtp-Source: ABdhPJycOOwNmb0zD73kqTDlXcUFSNdJdOw1Y3p1pB/PjGtP3t4iluned8prH8xjVYxNIs08EqJIS54IEOaxSu1nOPY= X-Received: by 2002:a2e:7d0e:: with SMTP id y14mr6438392ljc.251.1629267965676; Tue, 17 Aug 2021 23:26:05 -0700 (PDT) MIME-Version: 1.0 References: <20210710081722.1828-1-zhiyong.tao@mediatek.com> <20210710081722.1828-2-zhiyong.tao@mediatek.com> <1626940470.29611.9.camel@mhfsdcap03> <07388dac4e25e0f260725e8f80ba099d5aa80949.camel@mediatek.com> <4fd12d5c53f6492e5fa3ba94a78b9a149f5b6ed9.camel@mediatek.com> In-Reply-To: From: Chen-Yu Tsai Date: Wed, 18 Aug 2021 14:25:54 +0800 Message-ID: Subject: Re: [PATCH v10 1/2] dt-bindings: pinctrl: mt8195: add rsel define To: "zhiyong.tao" Cc: Linus Walleij , Rob Herring , Mark Rutland , Matthias Brugger , Sean Wang , srv_heupstream , hui.liu@mediatek.com, Eddie Huang , Light Hsieh , Biao Huang , Hongzhou Yang , Sean Wang , Seiya Wang , Devicetree List , LKML , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "moderated list:ARM/Mediatek SoC support" , "open list:GPIO SUBSYSTEM" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 18, 2021 at 4:09 AM Linus Walleij wrote: > > On Tue, Aug 17, 2021 at 9:51 AM zhiyong.tao wrote: > > > In one chip, If GPIO is different, the MTXXXX_PULL_UP_RSEL_001 may > > means different actual bias resistance setting. > > > > For example, > > > > KPROW IO > > Paramters Descriptions Min Typ Max > > UNIT > > Rpd Input pull-down resistance 40 75 190 Kohm > > Rpu Input pull-up resistance 40 75 190 Kohm > > Rpd Input pull-down resistance 0.8 1.6 2 Kohm > > Rpu Input pull-up resistance 0.8 1.6 2 Kohm > > This is exactly why we should try to use SI units in the device tree. > I assume that the software can eventually configure which resistance > it gets? > > The electronics people will say make sure it is pulled down by around > 80 kOhm, they can put that on the device tree and your code can > say, "hm 40 < 80 < 190 this is OK" and let the value pass. > > We do not define these exact semantics, it is up to the driver code > to decide what to do with the Ohm value 80000 in this case, but > it makes perfect sent for me to let it pass and fail if someone > for example requests 20 kOhm, or at least print a helpful warning: > > dev_warn(dev, "the requested resistance %d is out of range, supported > range %d to %d kOhm\n", > val, low, high); > > This is what makes the SI units really helpful for people writing device > trees: solve real integration tasks and make it easy to do the right thing. I think this makes a lot of sense. The driver could select the closest setting. And from what Zhiyong mentioned offline, the resistor values aren't exact as specified in the datasheet. I suppose this is expected with any electronics. So the hardware integration will say to pull up or down by some value, and the driver will do its best to fulfill that request. That precludes DT schema checking for the values used, but I think that is a good compromise. Zhiyong also mentioned that some of their downstream integrators might not be able to deal with actual values, and would prefer symbols tied to specific RSEL values. I think that would be doable together using some _magic_ values, but I would prefer not to if it were avoidable. Regards ChenYu