Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56886dbc authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "defconfig: lahaina-gki: enable qti-fixed-regulator driver"

parents 31f07c0c 579e911c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ CONFIG_QSEE_IPC_IRQ=m
CONFIG_RPMSG_QCOM_GLINK_SPSS=m
CONFIG_REGULATOR_RPMH=m
CONFIG_REGULATOR_FIXED_VOLTAGE=m
CONFIG_REGULATOR_QTI_FIXED_VOLTAGE=m
CONFIG_REGULATOR_QCOM_PM8008=m
CONFIG_REGULATOR_QPNP_AMOLED=m
CONFIG_HWMON=m
+9 −0
Original line number Diff line number Diff line
@@ -46,6 +46,15 @@ config REGULATOR_FIXED_VOLTAGE
	  useful for systems which use a combination of software
	  managed regulators and simple non-configurable regulators.

config REGULATOR_QTI_FIXED_VOLTAGE
	tristate "QTI fixed voltage regulator support"
	help
	  This driver provides support for fixed voltage regulators which are
	  controlled via a GPIO.  It also supports proxy consumer voting and
	  debug features utilized on Qualcomm Technologies, Inc. boards.  Use
	  this driver in place of the fixed voltage regulator driver if these
	  additional features are required.

config REGULATOR_VIRTUAL_CONSUMER
	tristate "Virtual regulator consumer support"
	help
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o helpers.o devres.o
obj-$(CONFIG_OF) += of_regulator.o
obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
obj-$(CONFIG_REGULATOR_QTI_FIXED_VOLTAGE) += qti-fixed-regulator.o
obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
obj-$(CONFIG_REGULATOR_PROXY_CONSUMER) += proxy-consumer.o
+39 −6
Original line number Diff line number Diff line
@@ -14,6 +14,13 @@
 * systems with no controllable regulators.
 */

/*
 * Define QTI_FIXED_REGULATOR here to avoid a loss of proxy-consumer voting
 * regression for existing fixed-regulator device tree devices.  Once such
 * devices are switched to qti-fixed-regulator, this line can be removed.
 */
#define QTI_FIXED_REGULATOR

#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/module.h>
@@ -25,7 +32,9 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regulator/of_regulator.h>
#ifdef QTI_FIXED_REGULATOR
#include <linux/regulator/proxy-consumer.h>
#endif
#include <linux/regulator/machine.h>
#include <linux/clk.h>

@@ -140,6 +149,23 @@ static struct regulator_ops fixed_voltage_clkenabled_ops = {
	.is_enabled = reg_clock_is_enabled,
};

#ifdef QTI_FIXED_REGULATOR
static void qti_reg_fixed_voltage_init(struct device *dev,
				       struct regulator_dev *rdev)
{
	int ret;

	ret = devm_regulator_proxy_consumer_register(dev, dev->of_node);
	if (ret)
		dev_err(dev, "failed to register proxy consumer, ret=%d\n",
			ret);
}
#else
static void qti_reg_fixed_voltage_init(struct device *dev,
				       struct regulator_dev *rdev)
{ }
#endif

static int reg_fixed_voltage_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
@@ -250,13 +276,10 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
		return ret;
	}

	ret = devm_regulator_proxy_consumer_register(dev, dev->of_node);
	if (ret)
		dev_err(dev, "failed to register proxy consumer, ret=%d\n",
			ret);

	platform_set_drvdata(pdev, drvdata);

	qti_reg_fixed_voltage_init(dev, drvdata->dev);

	dev_dbg(&pdev->dev, "%s supplying %duV\n", drvdata->desc.name,
		drvdata->desc.fixed_uV);

@@ -265,6 +288,12 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)

#if defined(CONFIG_OF)
static const struct of_device_id fixed_of_match[] = {
#ifdef QTI_FIXED_REGULATOR
	{
		.compatible = "qti-regulator-fixed",
		.data = &fixed_voltage_data,
	},
#endif
	{
		.compatible = "regulator-fixed",
		.data = &fixed_voltage_data,
@@ -282,9 +311,13 @@ MODULE_DEVICE_TABLE(of, fixed_of_match);
static struct platform_driver regulator_fixed_voltage_driver = {
	.probe		= reg_fixed_voltage_probe,
	.driver		= {
#ifdef QTI_FIXED_REGULATOR
		.name		= "qti-reg-fixed-voltage",
		.sync_state	= regulator_proxy_consumer_sync_state,
#else
		.name		= "reg-fixed-voltage",
#endif
		.of_match_table = of_match_ptr(fixed_of_match),
		.sync_state	= regulator_proxy_consumer_sync_state,
	},
};

+5 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2020, The Linux Foundation. All rights reserved. */

#define QTI_FIXED_REGULATOR
#include "fixed.c"