Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp983465rdb; Fri, 1 Dec 2023 04:13:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKSvTO29SVj4ZXPet3AKvlWHy9YJEEy4ogJzHCk4TpeCWZh2f+7LfsYzkBF3/0rTi0ODyc X-Received: by 2002:a05:6a00:1888:b0:6cd:daa5:1398 with SMTP id x8-20020a056a00188800b006cddaa51398mr9379832pfh.9.1701432789921; Fri, 01 Dec 2023 04:13:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701432789; cv=none; d=google.com; s=arc-20160816; b=cDoD00pgLMrmNvxpD1ad6/6Wm5H5Cp4h+CZpxN1xqNUtGCpsOwzkBXJHDC+ZCvMRDG NNIt6rkO5XYf4fVhthHcrwNUO5EhOJW5zTYBG2EJCtsV95nkDbAMe/+yfylPfat58pZS CzKIWk/0m0zlrcz05emuozHuHjTNgADUy/S118jck11b58WiAF8pQFDHcqzdMzM/En9j mgIINNQXBFyANVKcGziUyvPBqC2uz+dSOf+rWdkuwMrvJbxCqgujt7lq/5F/ul4G5JTk imUEKRh1fphAWPiYQdVjCXx9H7osuOQiUaq+1qzJUjz5TBL/nE1zpISEL5RDjHFWSb+j HE0A== 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:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=elxv3lTJW8D4+Mj9XKImFIdtqE5ajcp6kHSasoKUYrw=; fh=39EZIQpiYfFa/vdRNPVuNlStQirQX8oWSUbD9TPFZsg=; b=TyPk7fOdfWxohwGHDgrIJ4GSR1V01k9Xvf29ETAXyTwj5U+NJe0waGOmv3IJn5aVh0 WnKRuuP+6RNy+LbCtS0HviH8c5jAcmzTTlRowh6I/C+DGM7hukpNuHyWCtlCbEjPeGfc fAihLxNoM7jQ52hYBwNfLP5FT3abc2GpK/RHSYfcKeAMfSkVz5p3qcpORQiIhXipKoXp hK8f3dtyW074RJ97U6Q8gW7D7J3XShjsGfDMUXG+b5o0Ts/fccyVFnblH07p+Ml+UB59 v0jhQXa1SbNZ0XInpl3wk8KP0EMp3hzmpUnEt1H4ZVlmL+nmjbR5gVvETPhdpLzXCH5U tKHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eHwXw4YM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bw5-20020a056a00408500b006cc86fef8fdsi3300577pfb.170.2023.12.01.04.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 04:13:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eHwXw4YM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 182888028A63; Fri, 1 Dec 2023 04:12:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378718AbjLAMMh (ORCPT + 99 others); Fri, 1 Dec 2023 07:12:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378681AbjLAMMf (ORCPT ); Fri, 1 Dec 2023 07:12:35 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C6A103 for ; Fri, 1 Dec 2023 04:12:41 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a00cbb83c80so293437066b.0 for ; Fri, 01 Dec 2023 04:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701432760; x=1702037560; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=elxv3lTJW8D4+Mj9XKImFIdtqE5ajcp6kHSasoKUYrw=; b=eHwXw4YM2wTeHw3qBsWUAANRkLjaXD7mrBaAWR6kyFROGvdpPx3cNztQ/rBKi/0kcm U4EbYVHoJU/Y1Lk0W3a/Xnbx27kzl6SVNPi0d64fO2vEfIKgKCZhWLR3ytvTM/+5XJdy +dT+tWvSPJu9jlDkA+IyMdgwNuKs/vnlOYuO5ss1ub+aTmGHoqJnBOn8xnkOARIn9hX/ G2dy4tWTmBR2/iWsQfPkxXrKsFh2nSkBTKPZ2NLMbaOUwfiuorfoL8Py/YfsZNNwYo4N zsEh8gW+KTcQPigqilqJe2YxX3YlyzXtFAwXYsFMbJu18pRAwIdZudex76TOgWwyKzDP wXsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701432760; x=1702037560; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=elxv3lTJW8D4+Mj9XKImFIdtqE5ajcp6kHSasoKUYrw=; b=ink91D1V7TkZzue3O9JSbftAWYe3oNraBtIUYnj0gLU23SnnAdfv0OenNspBXsf0Dq eiJ2h9+qRaMUX5zNSRK3fiLxIvhKxryzBIeRBE/Xu2uvmhBNvIA6mdy5oEP/wYj0BJUk TbzBzdP74O3JxSu7lp1c3+cnx8BMGGCHbljUc6ZVG9PFJA6gnWe5K5Nhx8fQI6JHhkW3 0vk3Wxy754wR/aq6L4Gi9G7ry91S40xL2T42YMk/B/llAgg703QOA5ovVV1khfUFhhno vFwgETp4LiF2K8sbNV7ap1mMnhwkTF7ZnGWubjDSGrAhSclnk/I4BWJcU1D5XmL/Dvqf aArA== X-Gm-Message-State: AOJu0YyTbgipxjXGn4siUW3Ijm4dB3dipe8Gr5MALs/a8aUw8c+XZZ1a wLV1DuBqs2zZWgd74X6lcOnYbg== X-Received: by 2002:a17:906:738d:b0:a19:a19a:ea97 with SMTP id f13-20020a170906738d00b00a19a19aea97mr827630ejl.80.1701432760061; Fri, 01 Dec 2023 04:12:40 -0800 (PST) Received: from [192.168.1.20] ([178.197.223.109]) by smtp.gmail.com with ESMTPSA id d8-20020a1709061f4800b00a0435148ed7sm1873850ejk.17.2023.12.01.04.12.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Dec 2023 04:12:39 -0800 (PST) Message-ID: Date: Fri, 1 Dec 2023 13:12:37 +0100 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: Roger Quadros , 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> <019c84e6-2e77-4b76-b105-fc9ff678c058@kernel.org> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzTRLcnp5c3p0b2Yg S296bG93c2tpIDxrcnp5c3p0b2Yua296bG93c2tpQGxpbmFyby5vcmc+wsGUBBMBCgA+FiEE m9B+DgxR+NWWd7dUG5NDfTtBYpsFAmI+BxMCGwMFCRRfreEFCwkIBwIGFQoJCAsCBBYCAwEC HgECF4AACgkQG5NDfTtBYptgbhAAjAGunRoOTduBeC7V6GGOQMYIT5n3OuDSzG1oZyM4kyvO XeodvvYv49/ng473E8ZFhXfrre+c1olbr1A8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UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 01 Dec 2023 04:12:52 -0800 (PST) On 01/12/2023 11:57, Roger Quadros wrote: > +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. Splitting or not splitting drivers has nothing to do with bindings. Does the hardware suddenly change if you decide to do something with drivers? No, it does not. Best regards, Krzysztof