public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Roger Quadros <rogerq@kernel.org>
Cc: Alexandru Ardelean <alex@shruggie.ro>,
	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 <bryan.odonoghue@linaro.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Subject: Re: [PATCH] USB: typec: tps6598x: use device 'type' field to identify devices
Date: Fri, 1 Dec 2023 10:10:43 +0200	[thread overview]
Message-ID: <ZWmVA9KTVhZ4YCPO@kuha.fi.intel.com> (raw)
In-Reply-To: <292f5d48-8567-4b60-ad03-6cf70f71bacc@kernel.org>

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?

thanks,

-- 
heikki

  reply	other threads:[~2023-12-01  8:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 21:00 [PATCH] USB: typec: tps6598x: use device 'type' field to identify devices Alexandru Ardelean
2023-11-29 14:26 ` Heikki Krogerus
2023-11-29 18:45   ` Alexandru Ardelean
2023-11-30  9:13   ` Roger Quadros
2023-11-30 10:54     ` Heikki Krogerus
2023-11-30 13:30       ` Roger Quadros
2023-12-01  8:10         ` Heikki Krogerus [this message]
2023-12-01 10:57           ` Roger Quadros
2023-12-01 12:12             ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZWmVA9KTVhZ4YCPO@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=a-govindraju@ti.com \
    --cc=abdelalkuor@geotab.com \
    --cc=alex@shruggie.ro \
    --cc=bryan.odonoghue@linaro.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rogerq@kernel.org \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox