From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eHwXw4YM" Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF544CD for ; Fri, 1 Dec 2023 04:12:41 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a19067009d2so211013966b.3 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=NwaZMYHuGj6oYSOPBEE1pZYUwvTnZVs/T0I4WU/1NG9o6ibDdmtfOgFp0KNTEZc0ct PWtOWR7pGwjQcNbTGRCP0DWJ+MXm0MxGCf65JYKFHncr07L6gC+HqL/uxrOuKjgvxNf7 QQzgoUWIaT8RR6Z+AhjiN8/O/fiyRxUe9ZLTntBaLbMx0sVPldt4pPjOoPjSrGzi4tB2 mMGK7RTPguKbAsr7/eUaIAe9SCMui+5lfHEEz7Irk8Afbr4blRjdhpjk1T3PmdUd14A8 0divDLAa8c4UKnj5GblRUXlwLXyNSg8Y8hDiY7id80Gjf5c47vXWozIEE3ZzQQx8y/gy 2fVg== X-Gm-Message-State: AOJu0YzsSHHZbgR5pUX/p+yLUx1DkEctDmjdz1xj04gBNvfIHcSl3di8 55UxrboZBbpyls1KgArYZjfW4g== X-Google-Smtp-Source: AGHT+IG6K1LKQfvVGGJzsHpnDnlJY0Qg0R2GO2J6XFLCT2ebTzKDDa97z0J6Hxm2tfR/LLTtvwIsIg== 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 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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+NWWd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ZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <019c84e6-2e77-4b76-b105-fc9ff678c058@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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