Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp943236rdb; Fri, 1 Dec 2023 02:57:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXQMzhJDfteTdfBY6HW5NI2yRfUi8TdWoq06M2CW20zzu4cD6zQfqdAhnfzvHJeI+RuXQQ X-Received: by 2002:a05:6358:6501:b0:16e:5aae:aa32 with SMTP id v1-20020a056358650100b0016e5aaeaa32mr11840592rwg.25.1701428247314; Fri, 01 Dec 2023 02:57:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701428247; cv=none; d=google.com; s=arc-20160816; b=vozkE8fRoZBZnjfKtuZUVFSLZF4UblpDMkeaSYDB7oVHFei1egfhsni9loDy94KdMh XUZPl22Rxb0aKO6NSnzgquF3rSiN5xWh37VaucjYRvfHkM10i7PEEExLBZadmhb4A5uF KynRsMacVDAWCyxmxufaFxPRAqkDzUD7FzMqU73HDUWnE8cMzBFv3DNUR5yqTAQ00VgE xT/27Fs2m35nWdcgGOtWD3Iw5JONwjScwI8Xj1xardEiaWO/4ynQIdHREi8gHFViiFip WIXdsQ1Ut7XsfqH7KGkuaDl3WSTd48WjSzwWdNrT2QcS2Bds+tpKn2M6JqN458o2str9 cJeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=RySFbfyvaHsqug+ERD4vuVpgi0t3arIqsvjaFfV9xjA=; fh=BOdAI+D5U2Q5+SkapY0dXptEjjuxND+dhV7fNkR0d7A=; b=XGFVL7953r4BxsS8TYkMSM6LnpEVd1Spy1lFh6INwMWDJcaUI6bHLgNFjjxioVihwn UpM7tCHR9Fzzkdet6jUlOWqqt2iZhk6HWtPo032ZESHk/l0/svBE3+QdmDP8Qj80FP2o Y6hfIT6/Vqg0lFBPb69Cui3mh9mbbkIKIqGTro6fVAcNaGLF5D2AnE66EnZ5J9ZaAL08 orll7Nt+fZkjGDvRTO3QWn0zf5TIZGOEppQIkEJcwc6FXFiWIN+Mvaa+CR3lPxoZcblr gZ5bUuG0sYxJYkqkAFB3N3yuC5bygX3kdrVLIaXYXy1EPikmF981fpDss6XKiKSU0n3s UaYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f4vVePf+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id n185-20020a6327c2000000b005c2188ae892si3255602pgn.583.2023.12.01.02.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 02:57:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f4vVePf+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B014F80F66AA; Fri, 1 Dec 2023 02:57:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378387AbjLAK5J (ORCPT + 99 others); Fri, 1 Dec 2023 05:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378366AbjLAK5I (ORCPT ); Fri, 1 Dec 2023 05:57:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABA3ED40 for ; Fri, 1 Dec 2023 02:57:13 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A52AFC433C8; Fri, 1 Dec 2023 10:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701428233; bh=Oq0kqOP01NdYfWI6CUIb/qnr5mpWp63Eao1PiQvHSdE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=f4vVePf+y0CmsPee1Eprexqu/MEoBYFcR1J3Kk82L80GniiYoMQjKkaTv1cvZ7Dib M9Dcv6J4zNWHzxn9NvAFrRJGVBjgrZKY+cnd93PIhiwLQGY91gHSAngzS7ZxcgYAU4 XQMfMZs8LHfY4yBYCwvIHBsi6aN23SP3mzlJeo3YBmk5SI5PvEiFmUczAPId0tJq3/ r/DIkk9HCOcofsQDR7tCXsxJS+mH4S4C6IDY1wOeDl8Qtfgliuni4epEjLasrTQx53 OK4IOYYbmKrTbegKIDOqL4yGbDIliau1F/JEq6pd86P/HPzRK5cGNjWn4cOdxg3iET hrmShK5FUwUIA== Message-ID: <019c84e6-2e77-4b76-b105-fc9ff678c058@kernel.org> Date: Fri, 1 Dec 2023 12:57:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] USB: typec: tps6598x: use device 'type' field to identify devices Content-Language: en-US To: Heikki Krogerus Cc: Alexandru Ardelean , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, christophe.jaillet@wanadoo.fr, a-govindraju@ti.com, trix@redhat.com, abdelalkuor@geotab.com, Bryan O'Donoghue , Krzysztof Kozlowski , Rob Herring References: <20231123210021.463122-1-alex@shruggie.ro> <47ffbb30-34a7-4f5b-b262-3e068e574c8a@kernel.org> <292f5d48-8567-4b60-ad03-6cf70f71bacc@kernel.org> From: Roger Quadros In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, 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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 01 Dec 2023 02:57:24 -0800 (PST) +Rob & Krzysztof On 01/12/2023 10:10, Heikki Krogerus wrote: > Hi Roger, > > On Thu, Nov 30, 2023 at 03:30:54PM +0200, Roger Quadros wrote: >> Hi Heikki, >> >> On 30/11/2023 12:54, Heikki Krogerus wrote: >>> Hi Roger, >>> >>>>> Why not just match against the structures themselves? >>>>> >>>>> if (tps->data == &tps25750_data) >>>>> ... >>>> >>>> Then you need to declare tps25750_data and friends at the top of the file? >>>> >>>> A better approach might be to have type agnostic quirk flags for the special >>>> behavior required for different types. This way, multiple devices can share >>>> the same quirk if needed. >>>> >>>> e.g. >>>> NEEDS_POWER_UP instead of TIPD_TYPE_APPLE_CD321X >>>> SKIP_VID_READ instead of TIPD_TYPE_TI_TPS25750X >>>> INIT_ON_RESUME instead of TIPD_TYPE_TI_TPS25750X >>>> >>>> Also rename cd321x_switch_power_state() to tps6598x_switch_power_state(). >>> >>> No. Functions like that isolate cd321x specific functionality into an >>> actual "function" just like they should. >>> >>> Quirk flags mean that if something breaks, it will almost always break >>> for everybody (there is no real isolation with quirk flags), and when >>> things are fixed and when features are added, we are forced to always >>> "dance" around those quirk flags - you always have to consider them. >>> >>> Platform/device type checks are just as bad IMO, but in one way they >>> are better than quirk flags. There is no question about what a >>> platform check is checking, but quirk flags can so easily become >>> incomprehensible (just what exactly does it mean when you say >>> NEEDS_POWER_UP, SKIP_VID_READ and so on (you would need to document >>> those quirks, which is waste of effort, and in reality nobody will do). >>> >>> In case of tipd/code.c, it should be converted into a library that >>> only has the common/shared functionality. CD321, TPS2579x, TPS6598x >>> and what ever there is, then will have a glue driver that handles >>> everything that specific for their controller type. >> >> Do you mean that you want to treat the 3 devices as different incompatible devices >> so each one has a separate driver which warrants for a different DT binding >> for each and also Kconfig symbol? > > I did not consider that, I was thinking that we would still continue > with just one probe driver for all of these, but now that you > mentioned this, maybe it would actually make sense to have separate > full fledged probing drivers for all of these. Do you think it would > be better like that? Would it be a problem to split the bindings? I'm no DT expert but looks like an overkill to me. -- cheers, -roger