Regulator supplies when using Device Tree
From: Michael Bohan
Date: Thu Mar 22 2012 - 21:17:58 EST
Hi,
I'm curious if there was a reason we didn't standardize on a binding
name for regulator supplies when using Device Tree. This appears to
cause duplicated code for regulator drivers that support devices that
may or may not have supplies specified.
For example, if one were to set rdesc->supply_name to a chosen supply
name "parent" and that particular device does not exist in the Device
Tree topology, then regulator_register() will fail. So in the driver, we
have to first use of_get_property() to verify that "parent-supply" is
defined. Only then do we set rdesc->supply_name. Since I have multiple
regulator drivers that may or may not have supplies, each has to
duplicate this check.
But it seems like if we agreed on a standardized supply name for
regulators, then we could move that complexity to
of_get_regulator_init_data(). Having multiple supply names sure makes
sense for consumers, but for supplies, there can ever only be one.
I guess another alternative is to have the driver unconditionally assign
rdesc->supply_name, but change the framework to not fail the
regulator_register() if the supply is not specified in the topology. If
it is specified but fails either a phandle lookup or the targeted supply
regulator is not valid, then fail only in those cases.
Also, I'm curious why we need two pointers for the supply name. There's
currently regulator_desc->supply_name, recently added for Device Tree,
and then the old init_data->supply_regulator. Is there a need for both?
Thanks,
Mike
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/