mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-21 18:14:48 +08:00
352bfbb3e0
The Exynos Chip ID driver on Exynos SoCs has so far only informational purpose - to expose the SoC device in sysfs. No other drivers depend on it so there is really no benefit of initializing it early. The code would be the most flexible if converted to a regular driver. However there is already another driver - Exynos ASV (Adaptive Supply Voltage) - which binds to the device node of Chip ID. The solution is to convert the Exynos Chip ID to a built in driver and merge the Exynos ASV into it. This has several benefits: 1. Although the Exynos ASV driver binds to a device node present in all Exynos DTS (generic compatible), it fails to probe except on the supported ones (only Exynos5422). This means that the regular boot process has a planned/normal device probe failure. Merging the ASV into Chip ID will remove this probe failure because the final driver will always bind, just with disabled ASV features. 2. Allows to use dev_info() as the SoC bus is present (since core_initcall). 3. Could speed things up because of execution of Chip ID code in a SMP environment (after bringing up secondary CPUs, unlike early_initcall), This reduces the amount of work to be done early, when the kernel has to bring up critical devices. 5. Makes the Chip ID code defer-probe friendly, Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20201207190517.262051-5-krzk@kernel.org Reviewed-by: Pankaj Dubey <pankaj.dubey@samsung.com>
74 lines
1.7 KiB
C
74 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (c) 2019 Samsung Electronics Co., Ltd.
|
|
* http://www.samsung.com/
|
|
* Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
|
|
*
|
|
* Samsung Exynos SoC Adaptive Supply Voltage support
|
|
*/
|
|
#ifndef __LINUX_SOC_EXYNOS_ASV_H
|
|
#define __LINUX_SOC_EXYNOS_ASV_H
|
|
|
|
struct regmap;
|
|
|
|
/* HPM, IDS values to select target group */
|
|
struct asv_limit_entry {
|
|
unsigned int hpm;
|
|
unsigned int ids;
|
|
};
|
|
|
|
struct exynos_asv_table {
|
|
unsigned int num_rows;
|
|
unsigned int num_cols;
|
|
u32 *buf;
|
|
};
|
|
|
|
struct exynos_asv_subsys {
|
|
struct exynos_asv *asv;
|
|
const char *cpu_dt_compat;
|
|
int id;
|
|
struct exynos_asv_table table;
|
|
|
|
unsigned int base_volt;
|
|
unsigned int offset_volt_h;
|
|
unsigned int offset_volt_l;
|
|
};
|
|
|
|
struct exynos_asv {
|
|
struct device *dev;
|
|
struct regmap *chipid_regmap;
|
|
struct exynos_asv_subsys subsys[2];
|
|
|
|
int (*opp_get_voltage)(const struct exynos_asv_subsys *subs,
|
|
int level, unsigned int voltage);
|
|
unsigned int group;
|
|
unsigned int table;
|
|
|
|
/* True if SG fields from PKG_ID register should be used */
|
|
bool use_sg;
|
|
/* ASV bin read from DT */
|
|
int of_bin;
|
|
};
|
|
|
|
static inline u32 __asv_get_table_entry(const struct exynos_asv_table *table,
|
|
unsigned int row, unsigned int col)
|
|
{
|
|
return table->buf[row * (table->num_cols) + col];
|
|
}
|
|
|
|
static inline u32 exynos_asv_opp_get_voltage(const struct exynos_asv_subsys *subsys,
|
|
unsigned int level, unsigned int group)
|
|
{
|
|
return __asv_get_table_entry(&subsys->table, level, group + 1);
|
|
}
|
|
|
|
static inline u32 exynos_asv_opp_get_frequency(const struct exynos_asv_subsys *subsys,
|
|
unsigned int level)
|
|
{
|
|
return __asv_get_table_entry(&subsys->table, level, 0);
|
|
}
|
|
|
|
int exynos_asv_init(struct device *dev, struct regmap *regmap);
|
|
|
|
#endif /* __LINUX_SOC_EXYNOS_ASV_H */
|