static int mc13783_gpo_regulator_disable(struct regulator_dev *rdev) { struct mc13783_regulator_priv *priv = rdev_get_drvdata(rdev); int id = rdev_get_id(rdev); int ret; u32 dis_val = 0; dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id); /* Power Gate disable value is 1 */ if (id == MC13783_REGU_PWGT1SPI || id == MC13783_REGU_PWGT2SPI) dis_val = mc13783_regulators[id].enable_bit; mc13783_lock(priv->mc13783); ret = mc13783_powermisc_rmw(priv, mc13783_regulators[id].enable_bit, dis_val); mc13783_unlock(priv->mc13783); return ret; }
static int mc13783_gpo_regulator_enable(struct regulator_dev *rdev) { struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev); struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators; int id = rdev_get_id(rdev); int ret; u32 en_val = mc13xxx_regulators[id].enable_bit; dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id); /* Power Gate enable value is 0 */ if (id == MC13783_REG_PWGT1SPI || id == MC13783_REG_PWGT2SPI) en_val = 0; mc13xxx_lock(priv->mc13xxx); ret = mc13783_powermisc_rmw(priv, mc13xxx_regulators[id].enable_bit, en_val); mc13xxx_unlock(priv->mc13xxx); return ret; }