On Fri, Jun 13, 2014 at 10:37:37AM -0400, jonsmirl@xxxxxxxxx wrote: > >> Then I end up with code in the machine file like this... > >> > >> find SOC revision > >> if revision == A > >> fix up codec and i2s driver compatible > >> if revision == B > >> fix up HDMI compatible > >> if revision == C > >> fix up whatever > >> I've seen chips with revision levels of J > >> > >> Why do you want this knowledge in the machine file? Why not just add > >> the test for SOC revision inside the device driver? > > > > Because it's going to be a mess anyway. No matter if it's in the > > driver or the machine code. So at least, that way, we're having it > > centralized and isolated from the driver's code. > > The mess is always going to be in the driver code. You are just > changing the the string the driver code selects on... > > if (of_machine_is_compatible("allwinner,sun7i-codec-rev-a")) { > fix bug > } > > if (of_machine_is_compatible("allwinner,sun7i-a20a")) { > fix bug > } What? Hmmm, nope. Look at how we're doing this for the i2c driver (drivers/i2c/busses/i2c-mv64xxx.c). > The mess is not required in the machine file. Init time code can > always modify the machine compatible string like this with no side > effects. It would add 'a'-'j' as appropriate for the CPU. > > Code changes this: > compatible = "cubietech,cubietruck", "allwinner,sun7i-a20" > to: > compatible = "cubietech,cubietruck", "allwinner,sun7i-a20-a", > "allwinner,sun7i-a20" Again, this is the machine compatible, and this is orthogonal to the issue. You should have a different compatible string for the *codec*. -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Attachment:
signature.asc
Description: Digital signature