[PATCH] soc: mediatek: Introduce mediatek-regulator-coupler driver

Dmitry Osipenko digetx at gmail.com
Thu Jun 16 05:49:03 PDT 2022


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;
> +}




More information about the Linux-mediatek mailing list