Messages in this thread | | | Date | Thu, 16 Jun 2022 15:49:03 +0300 | Subject | Re: [PATCH] soc: mediatek: Introduce mediatek-regulator-coupler driver | From | Dmitry Osipenko <> |
| |
16.06.2022 12:45, AngeloGioacchino Del Regno пишет: > +static int mediatek_regulator_attach(struct regulator_coupler *coupler, > + struct regulator_dev *rdev) > +{ > + struct mediatek_regulator_coupler *mrc = to_mediatek_coupler(coupler); > + const char *rdev_name = rdev_get_name(rdev); > + > + if (strstr(rdev_name, "sram")) { > + if (mrc->vsram_rdev) > + return -EINVAL; > + mrc->vsram_rdev = rdev; > + }
You should filter out regulators unrelated to SRAM and GPU, see regulator_find_coupler().
> + return 0; > +} > + > +static int mediatek_regulator_detach(struct regulator_coupler *coupler, > + struct regulator_dev *rdev) > +{ > + struct mediatek_regulator_coupler *mrc = to_mediatek_coupler(coupler); > + > + if (rdev == mrc->vsram_rdev) { > + mrc->vsram_rdev = NULL; > + return 0; > + }
The regulator core should emit error message about GPU regulator failed to detach because you're returning -EINVAL for it.
> + return -EINVAL; > +}
| |