[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ddbd947-6cb6-8c86-eb48-8b6ae9b4be2b@linaro.org>
Date: Thu, 29 Jun 2023 22:44:34 +0200
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Rob Clark <robdclark@...il.com>,
Abhinav Kumar <quic_abhinavk@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Krishna Manikandan <quic_mkrishn@...cinc.com>
Cc: Marijn Suijten <marijn.suijten@...ainline.org>,
Konrad Dybcio <konradybcio@...nel.org>,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, dri-devel@...ts.freedesktop.org,
freedreno@...ts.freedesktop.org
Subject: Re: [PATCH v2 2/4] regulator: Introduce Qualcomm REFGEN regulator
driver
On 29.06.2023 22:35, Konrad Dybcio wrote:
> Modern Qualcomm SoCs have a REFGEN (reference voltage generator)
> regulator, providing reference voltage to on-chip IP, like PHYs.
>
> Add a driver to support toggling that regulator.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@...aro.org>
> ---
Ugh. Missed the 'const' here and below. LMK if that warrants a resend
(or.. perhaps you just have other comments)
Konrad
> + .ops = &(struct regulator_ops) {
> + .enable = qcom_sdm845_refgen_enable,
> + .disable = qcom_sdm845_refgen_disable,
> + .is_enabled = qcom_sdm845_refgen_is_enabled,
> + },
> +};
> +
> +static struct regulator_desc sm8250_refgen_desc = {
> + .enable_reg = REFGEN_REG_PWRDWN_CTRL5,
> + .enable_mask = REFGEN_PWRDWN_CTRL5_MASK,
> + .enable_val = REFGEN_PWRDWN_CTRL5_ENABLE,
> + .disable_val = 0,
> + .enable_time = 5,
> + .name = "refgen",
> + .owner = THIS_MODULE,
> + .type = REGULATOR_VOLTAGE,
> + .ops = &(struct regulator_ops) {
> + .enable = regulator_enable_regmap,
> + .disable = regulator_disable_regmap,
> + .is_enabled = regulator_is_enabled_regmap,
> + },
> +};
> +
> +static const struct regmap_config qcom_refgen_regmap_config = {
> + .reg_bits = 32,
> + .reg_stride = 4,
> + .val_bits = 32,
> + .fast_io = true,
> +};
> +
> +static int qcom_refgen_probe(struct platform_device *pdev)
> +{
> + struct regulator_init_data *init_data;
> + struct regulator_config config = {};
> + const struct regulator_desc *rdesc;
> + struct device *dev = &pdev->dev;
> + struct regulator_dev *rdev;
> + struct regmap *regmap;
> + void __iomem *base;
> +
> + rdesc = of_device_get_match_data(dev);
> + if (!rdesc)
> + return -ENODATA;
> +
> + base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(base))
> + return PTR_ERR(base);
> +
> + regmap = devm_regmap_init_mmio(dev, base, &qcom_refgen_regmap_config);
> + if (IS_ERR(regmap))
> + return PTR_ERR(regmap);
> +
> + init_data = of_get_regulator_init_data(dev, dev->of_node, rdesc);
> + if (!init_data)
> + return -ENOMEM;
> +
> + config.dev = dev;
> + config.init_data = init_data;
> + config.of_node = dev->of_node;
> + config.regmap = regmap;
> +
> + rdev = devm_regulator_register(dev, rdesc, &config);
> + if (IS_ERR(rdev))
> + return PTR_ERR(rdev);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id qcom_refgen_match_table[] = {
> + { .compatible = "qcom,sdm845-refgen-regulator", .data = &sdm845_refgen_desc },
> + { .compatible = "qcom,sm8250-refgen-regulator", .data = &sm8250_refgen_desc },
> + { }
> +};
> +
> +static struct platform_driver qcom_refgen_driver = {
> + .probe = qcom_refgen_probe,
> + .driver = {
> + .name = "qcom-refgen-regulator",
> + .of_match_table = qcom_refgen_match_table,
> + },
> +};
> +module_platform_driver(qcom_refgen_driver);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Qualcomm REFGEN regulator driver");
>
Powered by blists - more mailing lists