* Mark Brown wrote: > On Wed, Mar 28, 2012 at 04:33:46PM +0200, Thierry Reding wrote: > > > + static struct pwm_lookup board_pwm_lookup[] = { > > + PWM_LOOKUP("tegra-pwm", 0, "pwm-backlight"), > > + }; > > The clock and regulator APIs namespace the consumers by struct device - > might this not be sensible here? pwm_get() does already take the device > as an argument. It'd feel safer, and for example there's plenty of > phones out there with two backlit displays...
That's actually how this is supposed to work. "pwm-backlight" in the above case is matched against the name of the struct device that you pass in to pwm_get(). The only difference, at least as far as I can tell, to the clock and regulator APIs is that a second name is not listed explicitly in the lookup table. So compared with the clock and regulator APIs it doesn't make too much sense to pass both the struct device and the name to pwm_get() because it will match the device name against the consumer name in the lookup table first and only use the passed name if no match was found. In case you have two backlight devices I would expect the following to work: static struct pwm_lookup board_pwm_lookup[] = { PWM_LOOKUP("tegra-pwm", 0, "pwm-backlight.0"), PWM_LOOKUP("tegra-pwm", 1, "pwm-backlight.1"), }; > > > + * pwm_get() - look up and request a PWM device > > + * @dev: device for PWM consumer > > + * @provider: name of provider PWM chip > > + * @index: per-chip index of PWM to request > > The documentation is out of sync with the signature. Indeed. Thanks. Thierry
pgprWYbYAJiNh.pgp
Description: PGP signature
_______________________________________________ devicetree-discuss mailing list devicetree-discuss@lists.ozlabs.org https://lists.ozlabs.org/listinfo/devicetree-discuss