/* Return the powerdomain pointer associated with the OMAP module @oh's main clock. If @oh does not have a main clk, return the powerdomain associated with the interface clock associated with the module's MPU port. (XXX Perhaps this should use the SDMA port instead?) Returns NULL on error, or a struct powerdomain * on success.  */
struct powerdomain* omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
/* Return the powerdomain pointer associated with the OMAP module @oh's main clock. If @oh does not have a main clk, return the powerdomain associated with the interface clock associated with the module's MPU port. (XXX Perhaps this should use the SDMA port instead?) Returns NULL on error, or a struct powerdomain * on success.  */
struct powerdomain* omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
{
	struct clk *c;
	if (!oh)
		return NULL;
	if (oh->_clk) {
		c = oh->_clk;
	} else {
		if (oh->_int_flags & _HWMOD_NO_MPU_PORT)
			return NULL;
		c = oh->slaves[oh->_mpu_port_index]->_clk;
	}
	return c->clkdm->pwrdm.ptr;
}