mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
PM / devfreq: rockchip-dfi: use consistent name for private data struct
The variable name for the private data struct is 'info' in some functions and 'data' in others. Both names do not give a clue what type the variable has, so consistently use 'dfi'. Link: https://lore.kernel.org/lkml/20230704093242.583575-4-s.hauer@pengutronix.de/ Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This commit is contained in:
parent
bbf4790054
commit
9325b3ec92
1 changed files with 36 additions and 36 deletions
|
@ -59,13 +59,13 @@ struct rockchip_dfi {
|
||||||
|
|
||||||
static void rockchip_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
static void rockchip_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||||
{
|
{
|
||||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
|
||||||
void __iomem *dfi_regs = info->regs;
|
void __iomem *dfi_regs = dfi->regs;
|
||||||
u32 val;
|
u32 val;
|
||||||
u32 ddr_type;
|
u32 ddr_type;
|
||||||
|
|
||||||
/* get ddr type */
|
/* get ddr type */
|
||||||
regmap_read(info->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val);
|
regmap_read(dfi->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val);
|
||||||
ddr_type = (val >> RK3399_PMUGRF_DDRTYPE_SHIFT) &
|
ddr_type = (val >> RK3399_PMUGRF_DDRTYPE_SHIFT) &
|
||||||
RK3399_PMUGRF_DDRTYPE_MASK;
|
RK3399_PMUGRF_DDRTYPE_MASK;
|
||||||
|
|
||||||
|
@ -84,28 +84,28 @@ static void rockchip_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
|
||||||
|
|
||||||
static void rockchip_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
static void rockchip_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
|
||||||
{
|
{
|
||||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
|
||||||
void __iomem *dfi_regs = info->regs;
|
void __iomem *dfi_regs = dfi->regs;
|
||||||
|
|
||||||
writel_relaxed(SOFTWARE_DIS, dfi_regs + DDRMON_CTRL);
|
writel_relaxed(SOFTWARE_DIS, dfi_regs + DDRMON_CTRL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rockchip_dfi_get_busier_ch(struct devfreq_event_dev *edev)
|
static int rockchip_dfi_get_busier_ch(struct devfreq_event_dev *edev)
|
||||||
{
|
{
|
||||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
|
||||||
u32 tmp, max = 0;
|
u32 tmp, max = 0;
|
||||||
u32 i, busier_ch = 0;
|
u32 i, busier_ch = 0;
|
||||||
void __iomem *dfi_regs = info->regs;
|
void __iomem *dfi_regs = dfi->regs;
|
||||||
|
|
||||||
rockchip_dfi_stop_hardware_counter(edev);
|
rockchip_dfi_stop_hardware_counter(edev);
|
||||||
|
|
||||||
/* Find out which channel is busier */
|
/* Find out which channel is busier */
|
||||||
for (i = 0; i < RK3399_DMC_NUM_CH; i++) {
|
for (i = 0; i < RK3399_DMC_NUM_CH; i++) {
|
||||||
info->ch_usage[i].access = readl_relaxed(dfi_regs +
|
dfi->ch_usage[i].access = readl_relaxed(dfi_regs +
|
||||||
DDRMON_CH0_DFI_ACCESS_NUM + i * 20) * 4;
|
DDRMON_CH0_DFI_ACCESS_NUM + i * 20) * 4;
|
||||||
info->ch_usage[i].total = readl_relaxed(dfi_regs +
|
dfi->ch_usage[i].total = readl_relaxed(dfi_regs +
|
||||||
DDRMON_CH0_COUNT_NUM + i * 20);
|
DDRMON_CH0_COUNT_NUM + i * 20);
|
||||||
tmp = info->ch_usage[i].access;
|
tmp = dfi->ch_usage[i].access;
|
||||||
if (tmp > max) {
|
if (tmp > max) {
|
||||||
busier_ch = i;
|
busier_ch = i;
|
||||||
max = tmp;
|
max = tmp;
|
||||||
|
@ -118,20 +118,20 @@ static int rockchip_dfi_get_busier_ch(struct devfreq_event_dev *edev)
|
||||||
|
|
||||||
static int rockchip_dfi_disable(struct devfreq_event_dev *edev)
|
static int rockchip_dfi_disable(struct devfreq_event_dev *edev)
|
||||||
{
|
{
|
||||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
|
||||||
|
|
||||||
rockchip_dfi_stop_hardware_counter(edev);
|
rockchip_dfi_stop_hardware_counter(edev);
|
||||||
clk_disable_unprepare(info->clk);
|
clk_disable_unprepare(dfi->clk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rockchip_dfi_enable(struct devfreq_event_dev *edev)
|
static int rockchip_dfi_enable(struct devfreq_event_dev *edev)
|
||||||
{
|
{
|
||||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = clk_prepare_enable(info->clk);
|
ret = clk_prepare_enable(dfi->clk);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&edev->dev, "failed to enable dfi clk: %d\n", ret);
|
dev_err(&edev->dev, "failed to enable dfi clk: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -149,13 +149,13 @@ static int rockchip_dfi_set_event(struct devfreq_event_dev *edev)
|
||||||
static int rockchip_dfi_get_event(struct devfreq_event_dev *edev,
|
static int rockchip_dfi_get_event(struct devfreq_event_dev *edev,
|
||||||
struct devfreq_event_data *edata)
|
struct devfreq_event_data *edata)
|
||||||
{
|
{
|
||||||
struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
|
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
|
||||||
int busier_ch;
|
int busier_ch;
|
||||||
|
|
||||||
busier_ch = rockchip_dfi_get_busier_ch(edev);
|
busier_ch = rockchip_dfi_get_busier_ch(edev);
|
||||||
|
|
||||||
edata->load_count = info->ch_usage[busier_ch].access;
|
edata->load_count = dfi->ch_usage[busier_ch].access;
|
||||||
edata->total_count = info->ch_usage[busier_ch].total;
|
edata->total_count = dfi->ch_usage[busier_ch].total;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -176,47 +176,47 @@ MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match);
|
||||||
static int rockchip_dfi_probe(struct platform_device *pdev)
|
static int rockchip_dfi_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct rockchip_dfi *data;
|
struct rockchip_dfi *dfi;
|
||||||
struct devfreq_event_desc *desc;
|
struct devfreq_event_desc *desc;
|
||||||
struct device_node *np = pdev->dev.of_node, *node;
|
struct device_node *np = pdev->dev.of_node, *node;
|
||||||
|
|
||||||
data = devm_kzalloc(dev, sizeof(struct rockchip_dfi), GFP_KERNEL);
|
dfi = devm_kzalloc(dev, sizeof(*dfi), GFP_KERNEL);
|
||||||
if (!data)
|
if (!dfi)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
data->regs = devm_platform_ioremap_resource(pdev, 0);
|
dfi->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (IS_ERR(data->regs))
|
if (IS_ERR(dfi->regs))
|
||||||
return PTR_ERR(data->regs);
|
return PTR_ERR(dfi->regs);
|
||||||
|
|
||||||
data->clk = devm_clk_get(dev, "pclk_ddr_mon");
|
dfi->clk = devm_clk_get(dev, "pclk_ddr_mon");
|
||||||
if (IS_ERR(data->clk))
|
if (IS_ERR(dfi->clk))
|
||||||
return dev_err_probe(dev, PTR_ERR(data->clk),
|
return dev_err_probe(dev, PTR_ERR(dfi->clk),
|
||||||
"Cannot get the clk pclk_ddr_mon\n");
|
"Cannot get the clk pclk_ddr_mon\n");
|
||||||
|
|
||||||
node = of_parse_phandle(np, "rockchip,pmu", 0);
|
node = of_parse_phandle(np, "rockchip,pmu", 0);
|
||||||
if (!node)
|
if (!node)
|
||||||
return dev_err_probe(&pdev->dev, -ENODEV, "Can't find pmu_grf registers\n");
|
return dev_err_probe(&pdev->dev, -ENODEV, "Can't find pmu_grf registers\n");
|
||||||
|
|
||||||
data->regmap_pmu = syscon_node_to_regmap(node);
|
dfi->regmap_pmu = syscon_node_to_regmap(node);
|
||||||
of_node_put(node);
|
of_node_put(node);
|
||||||
if (IS_ERR(data->regmap_pmu))
|
if (IS_ERR(dfi->regmap_pmu))
|
||||||
return PTR_ERR(data->regmap_pmu);
|
return PTR_ERR(dfi->regmap_pmu);
|
||||||
|
|
||||||
data->dev = dev;
|
dfi->dev = dev;
|
||||||
|
|
||||||
desc = &data->desc;
|
desc = &dfi->desc;
|
||||||
desc->ops = &rockchip_dfi_ops;
|
desc->ops = &rockchip_dfi_ops;
|
||||||
desc->driver_data = data;
|
desc->driver_data = dfi;
|
||||||
desc->name = np->name;
|
desc->name = np->name;
|
||||||
|
|
||||||
data->edev = devm_devfreq_event_add_edev(&pdev->dev, desc);
|
dfi->edev = devm_devfreq_event_add_edev(&pdev->dev, desc);
|
||||||
if (IS_ERR(data->edev)) {
|
if (IS_ERR(dfi->edev)) {
|
||||||
dev_err(&pdev->dev,
|
dev_err(&pdev->dev,
|
||||||
"failed to add devfreq-event device\n");
|
"failed to add devfreq-event device\n");
|
||||||
return PTR_ERR(data->edev);
|
return PTR_ERR(dfi->edev);
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, data);
|
platform_set_drvdata(pdev, dfi);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue