Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2059417imn; Mon, 1 Aug 2022 09:36:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR6TCx0EoeoK9kH3OrtEzRBwfpx3ovIsBtWz9mi5dxGdi8x8h+iorOQixoAl/52k8TEWmXNd X-Received: by 2002:a17:907:a064:b0:730:726f:c62c with SMTP id ia4-20020a170907a06400b00730726fc62cmr5628655ejc.86.1659371812020; Mon, 01 Aug 2022 09:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659371812; cv=none; d=google.com; s=arc-20160816; b=Q13Wq7Q7rtKCW9srY9tR7/vXo4pcEqA5UM93TYXpjOTUK3rtn1zs3sWTtDWzmVZdVe ndcT1SV0UXZ6Tq9cowLxSd5GgysdL9prqsc/Clt3ycPVasy5xv3QIBLHvoL5JuMUUa5I OGHsrp+F/JYSmCGuSQFmpGBbitm6F21tSCe5+1SqbukDUPrHYx8Q3Aq+Zz5CiZthCs45 8h+i1xYiPdRFJOaHywBTaFpkv0QXOX1YISGXY2hCxjGolTYFDESG6iNF3PlopUROW4PG MrJ2pva4i02BBgh8KmBWvCzft3TcfctQWZupSiFZahCJ7JodOGmsY7vq1BrStTFhwkA8 L6PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KAf5vLbsKsp7uUbSGBZa7lZ5oL5yKjRD9qrhtjgTrjE=; b=PY+W1xCES/BxMeAigxyePI8lzXoSEU3FR56HnOASEUYd6hr668QDjHqyk9QHcwp/Sq VGuFRklK10sORZz56Dslq2Oy45MW9g8UEL2WbWIBuIKPpM7GpJIygFVXhSXruHedabpL eF6PjeR+rz1TgZjBeqnoD14476FOLmiftuWCeOs/Arlj0w2HFvzx6Mqv0u/YWz7FvbZA hOgihumxkBnvMId47oTe6/87DOfcIX3nIknUdZ83nYxqDLucQV1f89GaJUkR8y/1+n0x rprj8bQY8dPbqTr0HM3PIRoKtwWubw2Fyn4CyqCI3sI6n3bnONRWTADUwvJG2dgN1Q6X TJsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fvsADXhM; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a17090670d400b0072f0a99a61asi9141947ejk.617.2022.08.01.09.36.18; Mon, 01 Aug 2022 09:36:52 -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=@gmail.com header.s=20210112 header.b=fvsADXhM; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233041AbiHAQ1H (ORCPT + 99 others); Mon, 1 Aug 2022 12:27:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232614AbiHAQ1F (ORCPT ); Mon, 1 Aug 2022 12:27:05 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 038FB2E6BF; Mon, 1 Aug 2022 09:27:04 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id tk8so21322504ejc.7; Mon, 01 Aug 2022 09:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=KAf5vLbsKsp7uUbSGBZa7lZ5oL5yKjRD9qrhtjgTrjE=; b=fvsADXhMNgxWYjQhNVn5/Jvose5R01Pgm9ZY0dCYGK8pV3l4OE22DP6sziQyeDC3FJ rlcwyrFD67x0lyTlcHTV673jNFuktDXsqnr0ekX56h3jqlOhS2pXAtXELfLIKMDUbvHP R3MZ5vncKNkEUpotTPq5/LUX9e+bweVQt8DspZ4yQHTX6x+xI/WDTDVZ9crn82bY0L6H lLLR8wpV3+4qbegC5iOafeFHt6zOQNs8kOR9QCwN9UGKzWZC33cDYzuMrz0VUBAuH3XW LElpbSat9RYnHpJNlDTRDCUB5110aK5n+NHUu0+cUcmOAIRtgPsNKpzTDmgqArz5ol63 djMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=KAf5vLbsKsp7uUbSGBZa7lZ5oL5yKjRD9qrhtjgTrjE=; b=BOMaxVjJ509tqQriqHZKbAUbBd+y7Ds6X8XBYt2n0iBDB6kRmEmx446Hfw0ifk7Ona 5IsJ764Z+ETAvXJGSxuz569aR9rb5CdNtCZa0g7FSQKP2E3LW5kZ0rC261U4URGcwnjv PVAN3DjcYbAa77lzcnLS3MVlyd1rAOXcZmMd115B4BGNWnBpJGDXCGVLu8J7gvbP+SMd SrciOXjqD/Za4ZkHXFL9Cpq2XrH5buEBI0+jMgqwFYnYhaod1Q/OxwGjB5cPVNIC8/gI 6cc+6e34hqYchkU8CioN0+QJFqBsuouuIa1EHOqneJX0TH1ljxoph8uQgOBBhDU6VPd9 Zskg== X-Gm-Message-State: AJIora8evS5yo/2yqgqeBWoyBJeuFHwPijRsgY/b8jJ3KICNUqwXlxVK q1MLGgid0qWgZHXAVVNxmz0aCI6A5UPMSXjWeZg= X-Received: by 2002:a17:907:28d6:b0:72b:7497:76b with SMTP id en22-20020a17090728d600b0072b7497076bmr12798927ejc.365.1659371222414; Mon, 01 Aug 2022 09:27:02 -0700 (PDT) MIME-Version: 1.0 References: <20220728125435.3336618-1-potin.lai.pt@gmail.com> <20220728125435.3336618-3-potin.lai.pt@gmail.com> <20220731130959.50826fc4@jic23-huawei> <4ea235d1-46c1-87de-760f-dc4775007ae0@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Mon, 1 Aug 2022 18:26:25 +0200 Message-ID: Subject: Re: [PATCH v5 2/2] iio: humidity: hdc100x: add manufacturer and device ID check To: Patrick Williams Cc: Potin Lai , Jonathan Cameron , Lars-Peter Clausen , Potin Lai , linux-iio , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Mon, Aug 1, 2022 at 6:12 PM Patrick Williams wrote: > > On Mon, Aug 01, 2022 at 10:22:16AM +0200, Andy Shevchenko wrote: > > On Mon, Aug 1, 2022 at 3:52 AM Potin Lai wrote: > > > On 7/31/22 20:09, Jonathan Cameron wrote: > > > In our hardware board, we have "ti,hdc1080" as main source, and "silabs,si7020" > > > for 2nd source. This two chip are locate at same bus and same slave address, > > > and we want to use multiple compatibles to support both chips with single device > > > node in device tree. > > > > > > Ex: > > > compatible = "ti,hdc1099", "silabs,si7020"; > > > > This is simply broken DT, you must not put incompatible hardware on > > the same compatible string. DT is by definition the description of a > > certain platform. What you showed is a combination of incompatible > > chips in a single DT. > > We were mistaken that this is the appropriate way to specify this > behavior, partially because it works as long as the probe functions > return an error the next matching driver from the compatible will probe. > It does seem that specifying two different compatibles like this would > violate the intention of the DT spec: > > The property value consists of a concatenated list of null terminated > strings, from most specific to most general. They allow a device to > express its compatibility with a family of similar devices, potentially > allowing a single device driver to match against several devices. > > > > > > In order to support this, I need to add ID checking mechanism into the current > > > hdc100x driver, so the si7020 chip will fail to probe with hdc100x driver > > > (because the ID checking is not failed), then success probe with si7020. > > > > > > Base on you explanation, it looks multiple compatibles is not suitable in this > > > case? Would you mind advise us what would be the better approach for our case? > > > > If I may advise... fix your DT by dropping the wrong compatible item. > > This doesn't really give any helpful advice. Sorry to hear this, but it's the best and correct solution to your problem. Believe me, many Linux people will tell you the same. > The reality is that these two chips are pin compatible and function > compatible but not driver compatible. Boards have been manufactured > which are identical except for this chip replaced, due various to chip > shortages. > > Making probe fail so that the next 'compatible' is chosen sounds like it > isn't desired. I'm pretty sure you can't have two DT entries for the > same i2c address, but with different 'compatible" properties, and even > if we did you'd still need probe to fail on one of them. > > Are there any other suggestions for being able to inform the kernel that > one of two chips might be present? I guess there is a gap in understanding what DT is. DT is the description of the *platform*. Changing any discrete component on the platform is changing the platform. -- With Best Regards, Andy Shevchenko