mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
soc: rockchip: io-domain: dump power supply-map when probe
Tested on RK3568-evb2 with io-domain node as following:
pmuio2-supply = <&vcc3v3_pmu>;
vccio1-supply = <&vccio_acodec>;
vccio3-supply = <&vccio_sd>;
vccio4-supply = <&vcc_3v3>;
vccio5-supply = <&vcc_3v3>;
vccio6-supply = <&vcc_3v3>;
vccio7-supply = <&vcc_3v3>;
With this patch, the system bootup log shows:
[ 0.773089] rockchip-iodomain fdc20000.syscon:io-domains: pmuio2(3300000 uV) supplied by vcc3v3_pmu
[ 0.773247] rockchip-iodomain fdc20000.syscon:io-domains: vccio1(3300000 uV) supplied by vccio_acodec
[ 0.773426] rockchip-iodomain fdc20000.syscon:io-domains: vccio3(3300000 uV) supplied by vccio_sd
[ 0.773603] rockchip-iodomain fdc20000.syscon:io-domains: vccio4(3300000 uV) supplied by vcc_3v3
[ 0.773721] rockchip-iodomain fdc20000.syscon:io-domains: vccio5(3300000 uV) supplied by vcc_3v3
[ 0.773839] rockchip-iodomain fdc20000.syscon:io-domains: vccio6(3300000 uV) supplied by vcc_3v3
[ 0.773989] rockchip-iodomain fdc20000.syscon:io-domains: vccio7(3300000 uV) supplied by vcc_3v3
Change-Id: Ib4bcb78bf932b07beb03b3b39a0224ecb6699a54
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
@@ -14,6 +14,12 @@
|
|||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_device.h>
|
||||||
|
#include <linux/regulator/of_regulator.h>
|
||||||
|
#include <linux/regulator/driver.h>
|
||||||
|
#include <linux/regulator/machine.h>
|
||||||
|
#include "../../regulator/internal.h"
|
||||||
|
|
||||||
#define MAX_SUPPLIES 16
|
#define MAX_SUPPLIES 16
|
||||||
|
|
||||||
@@ -632,6 +638,77 @@ static const struct of_device_id rockchip_iodomain_match[] = {
|
|||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, rockchip_iodomain_match);
|
MODULE_DEVICE_TABLE(of, rockchip_iodomain_match);
|
||||||
|
|
||||||
|
static const char *rdev_get_name(struct regulator_dev *rdev)
|
||||||
|
{
|
||||||
|
if (rdev->constraints && rdev->constraints->name)
|
||||||
|
return rdev->constraints->name;
|
||||||
|
else if (rdev->desc->name)
|
||||||
|
return rdev->desc->name;
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct device_node *of_get_child_regulator(struct device_node *parent,
|
||||||
|
const char *prop_name)
|
||||||
|
{
|
||||||
|
struct device_node *regnode = NULL;
|
||||||
|
struct device_node *child = NULL;
|
||||||
|
|
||||||
|
for_each_child_of_node(parent, child) {
|
||||||
|
regnode = of_parse_phandle(child, prop_name, 0);
|
||||||
|
|
||||||
|
if (!regnode) {
|
||||||
|
regnode = of_get_child_regulator(child, prop_name);
|
||||||
|
if (regnode)
|
||||||
|
return regnode;
|
||||||
|
} else {
|
||||||
|
return regnode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct device_node *of_get_regulator(struct device *dev, const char *supply)
|
||||||
|
{
|
||||||
|
struct device_node *regnode = NULL;
|
||||||
|
char prop_name[256];
|
||||||
|
|
||||||
|
dev_dbg(dev, "Looking up %s-supply from device tree\n", supply);
|
||||||
|
|
||||||
|
snprintf(prop_name, sizeof(prop_name), "%s-supply", supply);
|
||||||
|
regnode = of_parse_phandle(dev->of_node, prop_name, 0);
|
||||||
|
|
||||||
|
if (!regnode) {
|
||||||
|
regnode = of_get_child_regulator(dev->of_node, prop_name);
|
||||||
|
if (regnode)
|
||||||
|
return regnode;
|
||||||
|
|
||||||
|
dev_dbg(dev, "Looking up %s property in node %pOF failed\n",
|
||||||
|
prop_name, dev->of_node);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return regnode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rockchip_iodomain_dump(const struct platform_device *pdev,
|
||||||
|
struct rockchip_iodomain_supply *supply)
|
||||||
|
{
|
||||||
|
struct rockchip_iodomain *iod = supply->iod;
|
||||||
|
const char *name = iod->soc_data->supply_names[supply->idx];
|
||||||
|
struct device *dev = iod->dev;
|
||||||
|
struct device_node *node;
|
||||||
|
struct regulator_dev *r = NULL;
|
||||||
|
|
||||||
|
node = of_get_regulator(dev, name);
|
||||||
|
if (node) {
|
||||||
|
r = of_find_regulator_by_node(node);
|
||||||
|
if (!IS_ERR_OR_NULL(r))
|
||||||
|
dev_info(&pdev->dev, "%s(%d uV) supplied by %s\n",
|
||||||
|
name, regulator_get_voltage(supply->reg),
|
||||||
|
rdev_get_name(r));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int rv1126_iodomain_notify(struct notifier_block *nb,
|
static int rv1126_iodomain_notify(struct notifier_block *nb,
|
||||||
unsigned long event,
|
unsigned long event,
|
||||||
void *data)
|
void *data)
|
||||||
@@ -783,6 +860,8 @@ static int rockchip_iodomain_probe(struct platform_device *pdev)
|
|||||||
supply->reg = NULL;
|
supply->reg = NULL;
|
||||||
goto unreg_notify;
|
goto unreg_notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rockchip_iodomain_dump(pdev, supply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iod->soc_data->init)
|
if (iod->soc_data->init)
|
||||||
|
|||||||
Reference in New Issue
Block a user