forked from Minki/linux
pmic-wrapper:
- add support for mt8188 SVS: - several driver cleanups power-domain: - several cleanups of the dt-bindings and driver mutex: - add support to mt6795 disp mutex - add support for mt8186 mdp3 mutex -----BEGIN PGP SIGNATURE----- iQJLBAABCAA1FiEEUdvKHhzqrUYPB/u8L21+TfbCqH4FAmMoQzkXHG1hdHRoaWFz LmJnZ0BnbWFpbC5jb20ACgkQL21+TfbCqH7kHhAAl+iz82nrJIqXh9B3jdALvYvw 2gyYuQh8Q2d0gJ1V4qi9tIonCagwcDAg1e5JAX061wteOHQCTDUHT+vXcy6FqdGr NsmV//nL31dyvxiErnApDyxGhyF1iQqmVMLGp8cJNlwgB7qOYJ1cfhpiPmHo2X7h wST6BipxcGZ/Fmp4tZfsOEylK1RUkY/lrYGoeujUso7qGxZOmcNAfioClMSpvwvn oum+bmR5DHbCOsFWGnSyjKn1zsAR7BOLITSv2RoJXDMqcYhLPd04CVyraXPLl4RR 0kHbxv6ST1N+nTCmuo5/SWzQsSYlFg3C3ACrIPUBEyxnwaaXbfPiszlRoO4SejGR S1+reCm7cSvtXK2ZLAcs9gFrQnUR6IvvPazbgTIz0mvlV1W1hwxJvtCEjHB9mqfB wCqQZQc5LbEfLLIvMtpm5rid7Hh70NFXFmZJ4/oiDr6StUiNM2hMBkjE55iMT2VN K1uaLqMOYjJCCQ0YZi6LuTuNXjjr/hprF2eOKi/V34qqCCLxrPByEUO1PPAQ6DRk iypNxzkTVr9ow0FkflPhSm1eRU7513wC3oMNCklPIUCtueKMA+h8pnD387TCQqk2 baFS+HyylIQV2X223ksNDHf2KibDVY2zwoZhgChyk/cltG4f1y06Vzulcyj73I9/ QyUXHkmeiuLuvdl3uW8= =VKXT -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmMt0qsACgkQmmx57+YA GNl9RQ//XeoILNZpG0kc3rFq6Pc4o7LrUToOtDrM2eccmuHlYuDFXZog00vy2Vpc zQuJwMwWwDe6B+OdxkvQfTZkOknB/4lXanR8lbbmZRNCQ+DMdh4aAzquYepPK8q6 SVaRxDWFq3YQkY3KtULYebNfN7SvTGBgL2ZiIub87hWGVrdLFY2/jujPTJJPhzZR Yer0nRSwaHxfS93xhKyNVsgglBba5S1c27MWJV6LZOy01e/CRdjZsLAZ+FvwAv3u i50xSgJSCEHGI7+wOYD4thpiyvkHBgyFblsQpHGRe/KtBNhtibv/GCSpes0hK4t0 w6zSvsVmAvh1rcBY0ZgC8xZDFtzw9EPXZ7Je+T1wqBAO/tZrrQ8K4pllECjLwoA4 rqfrIOz0wEg4gHBRyiOr5IfCJsFWsZxc4pJaD6o7G5qC1E2vrGbnlP7iv53hez+T p4qXX7MrkBAMegN4z5FMqZQ3Jj8ktiP2QowDZPJGmcCcSUqvC0NUg3B3s9CLRUH+ 57JWyL5I+/35ehdsGeS1mAuhvvk8c401nqI/K8fJWsdbIl75S2lG8WgdgBoc1Lui RF23StWpIe/R05YQD2vDJIyEg+2dmJ1bAe9vaC31D4BTP9qIb71H5qoPNyfsW7Ka iaz4TOwaSmev+U18lkKNhVxKEFAsL+189DNXRvl2R00Rrd/Embk= =64Bh -----END PGP SIGNATURE----- Merge tag 'v6.0-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux into arm/drivers pmic-wrapper: - add support for mt8188 SVS: - several driver cleanups power-domain: - several cleanups of the dt-bindings and driver mutex: - add support to mt6795 disp mutex - add support for mt8186 mdp3 mutex * tag 'v6.0-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/matthias.bgg/linux: soc: mediatek: Add mmsys func to adapt to dpi output for MT8186 soc: mediatek: mutex: Add support for MT6795 Helio X10 display mutex dt-bindings: soc: mediatek: Add display mutex support for MT6795 soc: mediatek: mutex: Add mt8186 mutex mod settings for mdp3 dt-bindings: soc: mediatek: Add mdp3 mutex support for mt8186 soc: mediatek: pm-domains: Simplify some error message soc: mediatek: mtk-svs: Explicitly include bitfield header soc: mediatek: mtk-svs: Use bitfield access macros where possible soc: mediatek: mtk-svs: Commonize t-calibration-data fuse array read dt-bindings: power: mediatek: Update maintainer list dt-bindings: power: mediatek: Support naming power controller node with unit address dt-bindings: power: mediatek: Refine multiple level power domain nodes soc: mediatek: mtk-svs: Use devm variant for dev_pm_opp_of_add_table() soc: mediatek: mtk-svs: Drop of_match_ptr() for of_match_table soc: mediatek: mtk-svs: Remove hardcoded irqflags soc: mediatek: mtk-svs: Switch to platform_get_irq() dt-bindings: soc: mediatek: pwrap: add compatible for mt8188 soc: mediatek: Let PMIC Wrapper and SCPSYS depend on OF Link: https://lore.kernel.org/r/498fe3e5-a237-121a-d500-fbb0994906cb@gmail.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
b49aae5e94
@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
title: Mediatek Power Domains Controller
|
||||
|
||||
maintainers:
|
||||
- Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
- MandyJH Liu <mandyjh.liu@mediatek.com>
|
||||
- Matthias Brugger <mbrugger@suse.com>
|
||||
|
||||
description: |
|
||||
@ -19,7 +19,7 @@ description: |
|
||||
|
||||
properties:
|
||||
$nodename:
|
||||
const: power-controller
|
||||
pattern: '^power-controller(@[0-9a-f]+)?$'
|
||||
|
||||
compatible:
|
||||
enum:
|
||||
@ -42,6 +42,23 @@ properties:
|
||||
|
||||
patternProperties:
|
||||
"^power-domain@[0-9a-f]+$":
|
||||
$ref: "#/$defs/power-domain-node"
|
||||
patternProperties:
|
||||
"^power-domain@[0-9a-f]+$":
|
||||
$ref: "#/$defs/power-domain-node"
|
||||
patternProperties:
|
||||
"^power-domain@[0-9a-f]+$":
|
||||
$ref: "#/$defs/power-domain-node"
|
||||
patternProperties:
|
||||
"^power-domain@[0-9a-f]+$":
|
||||
$ref: "#/$defs/power-domain-node"
|
||||
unevaluatedProperties: false
|
||||
unevaluatedProperties: false
|
||||
unevaluatedProperties: false
|
||||
unevaluatedProperties: false
|
||||
|
||||
$defs:
|
||||
power-domain-node:
|
||||
type: object
|
||||
description: |
|
||||
Represents the power domains within the power controller node as documented
|
||||
@ -100,123 +117,9 @@ patternProperties:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: phandle to the device containing the SMI register range.
|
||||
|
||||
patternProperties:
|
||||
"^power-domain@[0-9a-f]+$":
|
||||
type: object
|
||||
description: |
|
||||
Represents a power domain child within a power domain parent node.
|
||||
|
||||
properties:
|
||||
|
||||
'#power-domain-cells':
|
||||
description:
|
||||
Must be 0 for nodes representing a single PM domain and 1 for nodes
|
||||
providing multiple PM domains.
|
||||
|
||||
'#address-cells':
|
||||
const: 1
|
||||
|
||||
'#size-cells':
|
||||
const: 0
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
description: |
|
||||
A number of phandles to clocks that need to be enabled during domain
|
||||
power-up sequencing.
|
||||
|
||||
clock-names:
|
||||
description: |
|
||||
List of names of clocks, in order to match the power-up sequencing
|
||||
for each power domain we need to group the clocks by name. BASIC
|
||||
clocks need to be enabled before enabling the corresponding power
|
||||
domain, and should not have a '-' in their name (i.e mm, mfg, venc).
|
||||
SUSBYS clocks need to be enabled before releasing the bus protection,
|
||||
and should contain a '-' in their name (i.e mm-0, isp-0, cam-0).
|
||||
|
||||
In order to follow properly the power-up sequencing, the clocks must
|
||||
be specified by order, adding first the BASIC clocks followed by the
|
||||
SUSBSYS clocks.
|
||||
|
||||
domain-supply:
|
||||
description: domain regulator supply.
|
||||
|
||||
mediatek,infracfg:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: phandle to the device containing the INFRACFG register range.
|
||||
|
||||
mediatek,smi:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: phandle to the device containing the SMI register range.
|
||||
|
||||
patternProperties:
|
||||
"^power-domain@[0-9a-f]+$":
|
||||
type: object
|
||||
description: |
|
||||
Represents a power domain child within a power domain parent node.
|
||||
|
||||
properties:
|
||||
|
||||
'#power-domain-cells':
|
||||
description:
|
||||
Must be 0 for nodes representing a single PM domain and 1 for nodes
|
||||
providing multiple PM domains.
|
||||
|
||||
'#address-cells':
|
||||
const: 1
|
||||
|
||||
'#size-cells':
|
||||
const: 0
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
description: |
|
||||
A number of phandles to clocks that need to be enabled during domain
|
||||
power-up sequencing.
|
||||
|
||||
clock-names:
|
||||
description: |
|
||||
List of names of clocks, in order to match the power-up sequencing
|
||||
for each power domain we need to group the clocks by name. BASIC
|
||||
clocks need to be enabled before enabling the corresponding power
|
||||
domain, and should not have a '-' in their name (i.e mm, mfg, venc).
|
||||
SUSBYS clocks need to be enabled before releasing the bus protection,
|
||||
and should contain a '-' in their name (i.e mm-0, isp-0, cam-0).
|
||||
|
||||
In order to follow properly the power-up sequencing, the clocks must
|
||||
be specified by order, adding first the BASIC clocks followed by the
|
||||
SUSBSYS clocks.
|
||||
|
||||
domain-supply:
|
||||
description: domain regulator supply.
|
||||
|
||||
mediatek,infracfg:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: phandle to the device containing the INFRACFG register range.
|
||||
|
||||
mediatek,smi:
|
||||
$ref: /schemas/types.yaml#/definitions/phandle
|
||||
description: phandle to the device containing the SMI register range.
|
||||
|
||||
required:
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
required:
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
required:
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
||||
|
@ -26,10 +26,12 @@ properties:
|
||||
enum:
|
||||
- mediatek,mt2701-disp-mutex
|
||||
- mediatek,mt2712-disp-mutex
|
||||
- mediatek,mt6795-disp-mutex
|
||||
- mediatek,mt8167-disp-mutex
|
||||
- mediatek,mt8173-disp-mutex
|
||||
- mediatek,mt8183-disp-mutex
|
||||
- mediatek,mt8186-disp-mutex
|
||||
- mediatek,mt8186-mdp3-mutex
|
||||
- mediatek,mt8192-disp-mutex
|
||||
- mediatek,mt8195-disp-mutex
|
||||
|
||||
|
@ -28,6 +28,7 @@ Required properties in pwrap device node.
|
||||
"mediatek,mt8173-pwrap" for MT8173 SoCs
|
||||
"mediatek,mt8183-pwrap" for MT8183 SoCs
|
||||
"mediatek,mt8186-pwrap" for MT8186 SoCs
|
||||
"mediatek,mt8188-pwrap", "mediatek,mt8195-pwrap" for MT8188 SoCs
|
||||
"mediatek,mt8195-pwrap" for MT8195 SoCs
|
||||
"mediatek,mt8516-pwrap" for MT8516 SoCs
|
||||
- interrupts: IRQ for pwrap in SOC
|
||||
|
@ -37,6 +37,7 @@ config MTK_INFRACFG
|
||||
config MTK_PMIC_WRAP
|
||||
tristate "MediaTek PMIC Wrapper Support"
|
||||
depends on RESET_CONTROLLER
|
||||
depends on OF
|
||||
select REGMAP
|
||||
help
|
||||
Say yes here to add support for MediaTek PMIC Wrapper found
|
||||
@ -46,6 +47,7 @@ config MTK_PMIC_WRAP
|
||||
config MTK_SCPSYS
|
||||
bool "MediaTek SCPSYS Support"
|
||||
default ARCH_MEDIATEK
|
||||
depends on OF
|
||||
select REGMAP
|
||||
select MTK_INFRACFG
|
||||
select PM_GENERIC_DOMAINS if PM
|
||||
|
@ -3,6 +3,12 @@
|
||||
#ifndef __SOC_MEDIATEK_MT8186_MMSYS_H
|
||||
#define __SOC_MEDIATEK_MT8186_MMSYS_H
|
||||
|
||||
/* Values for DPI configuration in MMSYS address space */
|
||||
#define MT8186_MMSYS_DPI_OUTPUT_FORMAT 0x400
|
||||
#define DPI_FORMAT_MASK 0x1
|
||||
#define DPI_RGB888_DDR_CON BIT(0)
|
||||
#define DPI_RGB565_SDR_CON BIT(1)
|
||||
|
||||
#define MT8186_MMSYS_OVL_CON 0xF04
|
||||
#define MT8186_MMSYS_OVL0_CON_MASK 0x3
|
||||
#define MT8186_MMSYS_OVL0_2L_CON_MASK 0xC
|
||||
|
@ -227,6 +227,26 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_disconnect);
|
||||
|
||||
static void mtk_mmsys_update_bits(struct mtk_mmsys *mmsys, u32 offset, u32 mask, u32 val)
|
||||
{
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl_relaxed(mmsys->regs + offset);
|
||||
tmp = (tmp & ~mask) | val;
|
||||
writel_relaxed(tmp, mmsys->regs + offset);
|
||||
}
|
||||
|
||||
void mtk_mmsys_ddp_dpi_fmt_config(struct device *dev, u32 val)
|
||||
{
|
||||
if (val)
|
||||
mtk_mmsys_update_bits(dev_get_drvdata(dev), MT8186_MMSYS_DPI_OUTPUT_FORMAT,
|
||||
DPI_RGB888_DDR_CON, DPI_FORMAT_MASK);
|
||||
else
|
||||
mtk_mmsys_update_bits(dev_get_drvdata(dev), MT8186_MMSYS_DPI_OUTPUT_FORMAT,
|
||||
DPI_RGB565_SDR_CON, DPI_FORMAT_MASK);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mtk_mmsys_ddp_dpi_fmt_config);
|
||||
|
||||
static int mtk_mmsys_reset_update(struct reset_controller_dev *rcdev, unsigned long id,
|
||||
bool assert)
|
||||
{
|
||||
|
@ -91,6 +91,15 @@
|
||||
#define MT8183_MUTEX_MOD_MDP_AAL0 23
|
||||
#define MT8183_MUTEX_MOD_MDP_CCORR0 24
|
||||
|
||||
#define MT8186_MUTEX_MOD_MDP_RDMA0 0
|
||||
#define MT8186_MUTEX_MOD_MDP_AAL0 2
|
||||
#define MT8186_MUTEX_MOD_MDP_HDR0 4
|
||||
#define MT8186_MUTEX_MOD_MDP_RSZ0 5
|
||||
#define MT8186_MUTEX_MOD_MDP_RSZ1 6
|
||||
#define MT8186_MUTEX_MOD_MDP_WROT0 7
|
||||
#define MT8186_MUTEX_MOD_MDP_TDSHP0 9
|
||||
#define MT8186_MUTEX_MOD_MDP_COLOR0 14
|
||||
|
||||
#define MT8173_MUTEX_MOD_DISP_OVL0 11
|
||||
#define MT8173_MUTEX_MOD_DISP_OVL1 12
|
||||
#define MT8173_MUTEX_MOD_DISP_RDMA0 13
|
||||
@ -324,6 +333,17 @@ static const unsigned int mt8186_mutex_mod[DDP_COMPONENT_ID_MAX] = {
|
||||
[DDP_COMPONENT_RDMA1] = MT8186_MUTEX_MOD_DISP_RDMA1,
|
||||
};
|
||||
|
||||
static const unsigned int mt8186_mdp_mutex_table_mod[MUTEX_MOD_IDX_MAX] = {
|
||||
[MUTEX_MOD_IDX_MDP_RDMA0] = MT8186_MUTEX_MOD_MDP_RDMA0,
|
||||
[MUTEX_MOD_IDX_MDP_RSZ0] = MT8186_MUTEX_MOD_MDP_RSZ0,
|
||||
[MUTEX_MOD_IDX_MDP_RSZ1] = MT8186_MUTEX_MOD_MDP_RSZ1,
|
||||
[MUTEX_MOD_IDX_MDP_TDSHP0] = MT8186_MUTEX_MOD_MDP_TDSHP0,
|
||||
[MUTEX_MOD_IDX_MDP_WROT0] = MT8186_MUTEX_MOD_MDP_WROT0,
|
||||
[MUTEX_MOD_IDX_MDP_HDR0] = MT8186_MUTEX_MOD_MDP_HDR0,
|
||||
[MUTEX_MOD_IDX_MDP_AAL0] = MT8186_MUTEX_MOD_MDP_AAL0,
|
||||
[MUTEX_MOD_IDX_MDP_COLOR0] = MT8186_MUTEX_MOD_MDP_COLOR0,
|
||||
};
|
||||
|
||||
static const unsigned int mt8192_mutex_mod[DDP_COMPONENT_ID_MAX] = {
|
||||
[DDP_COMPONENT_AAL0] = MT8192_MUTEX_MOD_DISP_AAL0,
|
||||
[DDP_COMPONENT_CCORR] = MT8192_MUTEX_MOD_DISP_CCORR0,
|
||||
@ -380,6 +400,13 @@ static const unsigned int mt2712_mutex_sof[DDP_MUTEX_SOF_MAX] = {
|
||||
[MUTEX_SOF_DSI3] = MUTEX_SOF_DSI3,
|
||||
};
|
||||
|
||||
static const unsigned int mt6795_mutex_sof[DDP_MUTEX_SOF_MAX] = {
|
||||
[MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE,
|
||||
[MUTEX_SOF_DSI0] = MUTEX_SOF_DSI0,
|
||||
[MUTEX_SOF_DSI1] = MUTEX_SOF_DSI1,
|
||||
[MUTEX_SOF_DPI0] = MUTEX_SOF_DPI0,
|
||||
};
|
||||
|
||||
static const unsigned int mt8167_mutex_sof[DDP_MUTEX_SOF_MAX] = {
|
||||
[MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE,
|
||||
[MUTEX_SOF_DSI0] = MUTEX_SOF_DSI0,
|
||||
@ -434,6 +461,13 @@ static const struct mtk_mutex_data mt2712_mutex_driver_data = {
|
||||
.mutex_sof_reg = MT2701_MUTEX0_SOF0,
|
||||
};
|
||||
|
||||
static const struct mtk_mutex_data mt6795_mutex_driver_data = {
|
||||
.mutex_mod = mt8173_mutex_mod,
|
||||
.mutex_sof = mt6795_mutex_sof,
|
||||
.mutex_mod_reg = MT2701_MUTEX0_MOD0,
|
||||
.mutex_sof_reg = MT2701_MUTEX0_SOF0,
|
||||
};
|
||||
|
||||
static const struct mtk_mutex_data mt8167_mutex_driver_data = {
|
||||
.mutex_mod = mt8167_mutex_mod,
|
||||
.mutex_sof = mt8167_mutex_sof,
|
||||
@ -458,6 +492,12 @@ static const struct mtk_mutex_data mt8183_mutex_driver_data = {
|
||||
.no_clk = true,
|
||||
};
|
||||
|
||||
static const struct mtk_mutex_data mt8186_mdp_mutex_driver_data = {
|
||||
.mutex_mod_reg = MT8183_MUTEX0_MOD0,
|
||||
.mutex_sof_reg = MT8183_MUTEX0_SOF0,
|
||||
.mutex_table_mod = mt8186_mdp_mutex_table_mod,
|
||||
};
|
||||
|
||||
static const struct mtk_mutex_data mt8186_mutex_driver_data = {
|
||||
.mutex_mod = mt8186_mutex_mod,
|
||||
.mutex_sof = mt8186_mutex_sof,
|
||||
@ -802,6 +842,8 @@ static const struct of_device_id mutex_driver_dt_match[] = {
|
||||
.data = &mt2701_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt2712-disp-mutex",
|
||||
.data = &mt2712_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt6795-disp-mutex",
|
||||
.data = &mt6795_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8167-disp-mutex",
|
||||
.data = &mt8167_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8173-disp-mutex",
|
||||
@ -810,6 +852,8 @@ static const struct of_device_id mutex_driver_dt_match[] = {
|
||||
.data = &mt8183_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8186-disp-mutex",
|
||||
.data = &mt8186_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8186-mdp3-mutex",
|
||||
.data = &mt8186_mdp_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8192-disp-mutex",
|
||||
.data = &mt8192_mutex_driver_data},
|
||||
{ .compatible = "mediatek,mt8195-disp-mutex",
|
||||
|
@ -393,7 +393,7 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
dev_err_probe(scpsys->dev, ret,
|
||||
"%pOF: failed to get clk at index %d: %d\n", node, i, ret);
|
||||
"%pOF: failed to get clk at index %d\n", node, i);
|
||||
goto err_put_clocks;
|
||||
}
|
||||
|
||||
@ -405,8 +405,8 @@ generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_no
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
dev_err_probe(scpsys->dev, ret,
|
||||
"%pOF: failed to get clk at index %d: %d\n", node,
|
||||
i + clk_ind, ret);
|
||||
"%pOF: failed to get clk at index %d\n", node,
|
||||
i + clk_ind);
|
||||
goto err_put_subsys_clocks;
|
||||
}
|
||||
|
||||
|
@ -2316,7 +2316,7 @@ err_out1:
|
||||
static struct platform_driver pwrap_drv = {
|
||||
.driver = {
|
||||
.name = "mt-pmic-pwrap",
|
||||
.of_match_table = of_match_ptr(of_pwrap_match_tbl),
|
||||
.of_match_table = of_pwrap_match_tbl,
|
||||
},
|
||||
.probe = pwrap_probe,
|
||||
};
|
||||
|
@ -1141,7 +1141,7 @@ static struct platform_driver scpsys_drv = {
|
||||
.name = "mtk-scpsys",
|
||||
.suppress_bind_attrs = true,
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = of_match_ptr(of_scpsys_match_tbl),
|
||||
.of_match_table = of_scpsys_match_tbl,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(scpsys_drv);
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2022 MediaTek Inc.
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/bits.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/completion.h>
|
||||
@ -53,22 +54,79 @@
|
||||
#define SVSB_MON_VOLT_IGNORE BIT(16)
|
||||
#define SVSB_REMOVE_DVTFIXED_VOLT BIT(24)
|
||||
|
||||
/* svs bank register common configuration */
|
||||
#define SVSB_DET_MAX 0xffff
|
||||
/* svs bank register fields and common configuration */
|
||||
#define SVSB_PTPCONFIG_DETMAX GENMASK(15, 0)
|
||||
#define SVSB_DET_MAX FIELD_PREP(SVSB_PTPCONFIG_DETMAX, 0xffff)
|
||||
#define SVSB_DET_WINDOW 0xa28
|
||||
#define SVSB_DTHI 0x1
|
||||
#define SVSB_DTLO 0xfe
|
||||
#define SVSB_EN_INIT01 0x1
|
||||
#define SVSB_EN_INIT02 0x5
|
||||
#define SVSB_EN_MON 0x2
|
||||
#define SVSB_EN_OFF 0x0
|
||||
#define SVSB_INTEN_INIT0x 0x00005f01
|
||||
#define SVSB_INTEN_MONVOPEN 0x00ff0000
|
||||
#define SVSB_INTSTS_CLEAN 0x00ffffff
|
||||
#define SVSB_INTSTS_COMPLETE 0x1
|
||||
#define SVSB_INTSTS_MONVOP 0x00ff0000
|
||||
|
||||
/* DESCHAR */
|
||||
#define SVSB_DESCHAR_FLD_MDES GENMASK(7, 0)
|
||||
#define SVSB_DESCHAR_FLD_BDES GENMASK(15, 8)
|
||||
|
||||
/* TEMPCHAR */
|
||||
#define SVSB_TEMPCHAR_FLD_DVT_FIXED GENMASK(7, 0)
|
||||
#define SVSB_TEMPCHAR_FLD_MTDES GENMASK(15, 8)
|
||||
#define SVSB_TEMPCHAR_FLD_VCO GENMASK(23, 16)
|
||||
|
||||
/* DETCHAR */
|
||||
#define SVSB_DETCHAR_FLD_DCMDET GENMASK(7, 0)
|
||||
#define SVSB_DETCHAR_FLD_DCBDET GENMASK(15, 8)
|
||||
|
||||
/* SVSEN (PTPEN) */
|
||||
#define SVSB_PTPEN_INIT01 BIT(0)
|
||||
#define SVSB_PTPEN_MON BIT(1)
|
||||
#define SVSB_PTPEN_INIT02 (SVSB_PTPEN_INIT01 | BIT(2))
|
||||
#define SVSB_PTPEN_OFF 0x0
|
||||
|
||||
/* FREQPCTS */
|
||||
#define SVSB_FREQPCTS_FLD_PCT0_4 GENMASK(7, 0)
|
||||
#define SVSB_FREQPCTS_FLD_PCT1_5 GENMASK(15, 8)
|
||||
#define SVSB_FREQPCTS_FLD_PCT2_6 GENMASK(23, 16)
|
||||
#define SVSB_FREQPCTS_FLD_PCT3_7 GENMASK(31, 24)
|
||||
|
||||
/* INTSTS */
|
||||
#define SVSB_INTSTS_VAL_CLEAN 0x00ffffff
|
||||
#define SVSB_INTSTS_F0_COMPLETE BIT(0)
|
||||
#define SVSB_INTSTS_FLD_MONVOP GENMASK(23, 16)
|
||||
#define SVSB_RUNCONFIG_DEFAULT 0x80000000
|
||||
|
||||
/* LIMITVALS */
|
||||
#define SVSB_LIMITVALS_FLD_DTLO GENMASK(7, 0)
|
||||
#define SVSB_LIMITVALS_FLD_DTHI GENMASK(15, 8)
|
||||
#define SVSB_LIMITVALS_FLD_VMIN GENMASK(23, 16)
|
||||
#define SVSB_LIMITVALS_FLD_VMAX GENMASK(31, 24)
|
||||
#define SVSB_VAL_DTHI 0x1
|
||||
#define SVSB_VAL_DTLO 0xfe
|
||||
|
||||
/* INTEN */
|
||||
#define SVSB_INTEN_F0EN BIT(0)
|
||||
#define SVSB_INTEN_DACK0UPEN BIT(8)
|
||||
#define SVSB_INTEN_DC0EN BIT(9)
|
||||
#define SVSB_INTEN_DC1EN BIT(10)
|
||||
#define SVSB_INTEN_DACK0LOEN BIT(11)
|
||||
#define SVSB_INTEN_INITPROD_OVF_EN BIT(12)
|
||||
#define SVSB_INTEN_INITSUM_OVF_EN BIT(14)
|
||||
#define SVSB_INTEN_MONVOPEN GENMASK(23, 16)
|
||||
#define SVSB_INTEN_INIT0x (SVSB_INTEN_F0EN | SVSB_INTEN_DACK0UPEN | \
|
||||
SVSB_INTEN_DC0EN | SVSB_INTEN_DC1EN | \
|
||||
SVSB_INTEN_DACK0LOEN | \
|
||||
SVSB_INTEN_INITPROD_OVF_EN | \
|
||||
SVSB_INTEN_INITSUM_OVF_EN)
|
||||
|
||||
/* TSCALCS */
|
||||
#define SVSB_TSCALCS_FLD_MTS GENMASK(11, 0)
|
||||
#define SVSB_TSCALCS_FLD_BTS GENMASK(23, 12)
|
||||
|
||||
/* INIT2VALS */
|
||||
#define SVSB_INIT2VALS_FLD_DCVOFFSETIN GENMASK(15, 0)
|
||||
#define SVSB_INIT2VALS_FLD_AGEVOFFSETIN GENMASK(31, 16)
|
||||
|
||||
/* VOPS */
|
||||
#define SVSB_VOPS_FLD_VOP0_4 GENMASK(7, 0)
|
||||
#define SVSB_VOPS_FLD_VOP1_5 GENMASK(15, 8)
|
||||
#define SVSB_VOPS_FLD_VOP2_6 GENMASK(23, 16)
|
||||
#define SVSB_VOPS_FLD_VOP3_7 GENMASK(31, 24)
|
||||
|
||||
/* svs bank related setting */
|
||||
#define BITS8 8
|
||||
#define MAX_OPP_ENTRIES 16
|
||||
@ -262,7 +320,6 @@ static const u32 svs_regs_v2[] = {
|
||||
* @rst: svs platform reset control
|
||||
* @efuse_parsing: svs platform efuse parsing function pointer
|
||||
* @probe: svs platform probe function pointer
|
||||
* @irqflags: svs platform irq settings flags
|
||||
* @efuse_max: total number of svs efuse
|
||||
* @tefuse_max: total number of thermal efuse
|
||||
* @regs: svs platform registers map
|
||||
@ -280,7 +337,6 @@ struct svs_platform {
|
||||
struct reset_control *rst;
|
||||
bool (*efuse_parsing)(struct svs_platform *svsp);
|
||||
int (*probe)(struct svs_platform *svsp);
|
||||
unsigned long irqflags;
|
||||
size_t efuse_max;
|
||||
size_t tefuse_max;
|
||||
const u32 *regs;
|
||||
@ -294,7 +350,6 @@ struct svs_platform_data {
|
||||
struct svs_bank *banks;
|
||||
bool (*efuse_parsing)(struct svs_platform *svsp);
|
||||
int (*probe)(struct svs_platform *svsp);
|
||||
unsigned long irqflags;
|
||||
const u32 *regs;
|
||||
u32 bank_max;
|
||||
};
|
||||
@ -668,8 +723,8 @@ static ssize_t svs_enable_debug_write(struct file *filp,
|
||||
svsp->pbank = svsb;
|
||||
svsb->mode_support = SVSB_MODE_ALL_DISABLE;
|
||||
svs_switch_bank(svsp);
|
||||
svs_writel_relaxed(svsp, SVSB_EN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_CLEAN, INTSTS);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_VAL_CLEAN, INTSTS);
|
||||
spin_unlock_irqrestore(&svs_lock, flags);
|
||||
|
||||
svsb->phase = SVSB_PHASE_ERROR;
|
||||
@ -830,7 +885,7 @@ static void svs_get_bank_volts_v3(struct svs_platform *svsp)
|
||||
} else if (svsb->type == SVSB_LOW) {
|
||||
/* volt[turn_pt] + volt[j] ~ volt[opp_count - 1] */
|
||||
j = svsb->opp_count - 7;
|
||||
svsb->volt[turn_pt] = vop30 & GENMASK(7, 0);
|
||||
svsb->volt[turn_pt] = FIELD_GET(SVSB_VOPS_FLD_VOP0_4, vop30);
|
||||
shift_byte++;
|
||||
for (i = j; i < svsb->opp_count; i++) {
|
||||
b_sft = BITS8 * (shift_byte % REG_BYTES);
|
||||
@ -852,7 +907,7 @@ static void svs_get_bank_volts_v3(struct svs_platform *svsp)
|
||||
if (svsb->type == SVSB_HIGH) {
|
||||
/* volt[0] + volt[j] ~ volt[turn_pt - 1] */
|
||||
j = turn_pt - 7;
|
||||
svsb->volt[0] = vop30 & GENMASK(7, 0);
|
||||
svsb->volt[0] = FIELD_GET(SVSB_VOPS_FLD_VOP0_4, vop30);
|
||||
shift_byte++;
|
||||
for (i = j; i < turn_pt; i++) {
|
||||
b_sft = BITS8 * (shift_byte % REG_BYTES);
|
||||
@ -983,16 +1038,16 @@ static void svs_get_bank_volts_v2(struct svs_platform *svsp)
|
||||
u32 temp, i;
|
||||
|
||||
temp = svs_readl_relaxed(svsp, VOP74);
|
||||
svsb->volt[14] = (temp >> 24) & GENMASK(7, 0);
|
||||
svsb->volt[12] = (temp >> 16) & GENMASK(7, 0);
|
||||
svsb->volt[10] = (temp >> 8) & GENMASK(7, 0);
|
||||
svsb->volt[8] = (temp & GENMASK(7, 0));
|
||||
svsb->volt[14] = FIELD_GET(SVSB_VOPS_FLD_VOP3_7, temp);
|
||||
svsb->volt[12] = FIELD_GET(SVSB_VOPS_FLD_VOP2_6, temp);
|
||||
svsb->volt[10] = FIELD_GET(SVSB_VOPS_FLD_VOP1_5, temp);
|
||||
svsb->volt[8] = FIELD_GET(SVSB_VOPS_FLD_VOP0_4, temp);
|
||||
|
||||
temp = svs_readl_relaxed(svsp, VOP30);
|
||||
svsb->volt[6] = (temp >> 24) & GENMASK(7, 0);
|
||||
svsb->volt[4] = (temp >> 16) & GENMASK(7, 0);
|
||||
svsb->volt[2] = (temp >> 8) & GENMASK(7, 0);
|
||||
svsb->volt[0] = (temp & GENMASK(7, 0));
|
||||
svsb->volt[6] = FIELD_GET(SVSB_VOPS_FLD_VOP3_7, temp);
|
||||
svsb->volt[4] = FIELD_GET(SVSB_VOPS_FLD_VOP2_6, temp);
|
||||
svsb->volt[2] = FIELD_GET(SVSB_VOPS_FLD_VOP1_5, temp);
|
||||
svsb->volt[0] = FIELD_GET(SVSB_VOPS_FLD_VOP0_4, temp);
|
||||
|
||||
for (i = 0; i <= 12; i += 2)
|
||||
svsb->volt[i + 1] = interpolate(svsb->freq_pct[i],
|
||||
@ -1014,20 +1069,20 @@ static void svs_get_bank_volts_v2(struct svs_platform *svsp)
|
||||
static void svs_set_bank_freq_pct_v2(struct svs_platform *svsp)
|
||||
{
|
||||
struct svs_bank *svsb = svsp->pbank;
|
||||
u32 freqpct74_val, freqpct30_val;
|
||||
|
||||
svs_writel_relaxed(svsp,
|
||||
(svsb->freq_pct[14] << 24) |
|
||||
(svsb->freq_pct[12] << 16) |
|
||||
(svsb->freq_pct[10] << 8) |
|
||||
svsb->freq_pct[8],
|
||||
FREQPCT74);
|
||||
freqpct74_val = FIELD_PREP(SVSB_FREQPCTS_FLD_PCT0_4, svsb->freq_pct[8]) |
|
||||
FIELD_PREP(SVSB_FREQPCTS_FLD_PCT1_5, svsb->freq_pct[10]) |
|
||||
FIELD_PREP(SVSB_FREQPCTS_FLD_PCT2_6, svsb->freq_pct[12]) |
|
||||
FIELD_PREP(SVSB_FREQPCTS_FLD_PCT3_7, svsb->freq_pct[14]);
|
||||
|
||||
svs_writel_relaxed(svsp,
|
||||
(svsb->freq_pct[6] << 24) |
|
||||
(svsb->freq_pct[4] << 16) |
|
||||
(svsb->freq_pct[2] << 8) |
|
||||
svsb->freq_pct[0],
|
||||
FREQPCT30);
|
||||
freqpct30_val = FIELD_PREP(SVSB_FREQPCTS_FLD_PCT0_4, svsb->freq_pct[0]) |
|
||||
FIELD_PREP(SVSB_FREQPCTS_FLD_PCT1_5, svsb->freq_pct[2]) |
|
||||
FIELD_PREP(SVSB_FREQPCTS_FLD_PCT2_6, svsb->freq_pct[4]) |
|
||||
FIELD_PREP(SVSB_FREQPCTS_FLD_PCT3_7, svsb->freq_pct[6]);
|
||||
|
||||
svs_writel_relaxed(svsp, freqpct74_val, FREQPCT74);
|
||||
svs_writel_relaxed(svsp, freqpct30_val, FREQPCT30);
|
||||
}
|
||||
|
||||
static void svs_set_bank_phase(struct svs_platform *svsp,
|
||||
@ -1038,13 +1093,17 @@ static void svs_set_bank_phase(struct svs_platform *svsp,
|
||||
|
||||
svs_switch_bank(svsp);
|
||||
|
||||
des_char = (svsb->bdes << 8) | svsb->mdes;
|
||||
des_char = FIELD_PREP(SVSB_DESCHAR_FLD_BDES, svsb->bdes) |
|
||||
FIELD_PREP(SVSB_DESCHAR_FLD_MDES, svsb->mdes);
|
||||
svs_writel_relaxed(svsp, des_char, DESCHAR);
|
||||
|
||||
temp_char = (svsb->vco << 16) | (svsb->mtdes << 8) | svsb->dvt_fixed;
|
||||
temp_char = FIELD_PREP(SVSB_TEMPCHAR_FLD_VCO, svsb->vco) |
|
||||
FIELD_PREP(SVSB_TEMPCHAR_FLD_MTDES, svsb->mtdes) |
|
||||
FIELD_PREP(SVSB_TEMPCHAR_FLD_DVT_FIXED, svsb->dvt_fixed);
|
||||
svs_writel_relaxed(svsp, temp_char, TEMPCHAR);
|
||||
|
||||
det_char = (svsb->dcbdet << 8) | svsb->dcmdet;
|
||||
det_char = FIELD_PREP(SVSB_DETCHAR_FLD_DCBDET, svsb->dcbdet) |
|
||||
FIELD_PREP(SVSB_DETCHAR_FLD_DCMDET, svsb->dcmdet);
|
||||
svs_writel_relaxed(svsp, det_char, DETCHAR);
|
||||
|
||||
svs_writel_relaxed(svsp, svsb->dc_config, DCCONFIG);
|
||||
@ -1053,33 +1112,37 @@ static void svs_set_bank_phase(struct svs_platform *svsp,
|
||||
|
||||
svsb->set_freq_pct(svsp);
|
||||
|
||||
limit_vals = (svsb->vmax << 24) | (svsb->vmin << 16) |
|
||||
(SVSB_DTHI << 8) | SVSB_DTLO;
|
||||
limit_vals = FIELD_PREP(SVSB_LIMITVALS_FLD_DTLO, SVSB_VAL_DTLO) |
|
||||
FIELD_PREP(SVSB_LIMITVALS_FLD_DTHI, SVSB_VAL_DTHI) |
|
||||
FIELD_PREP(SVSB_LIMITVALS_FLD_VMIN, svsb->vmin) |
|
||||
FIELD_PREP(SVSB_LIMITVALS_FLD_VMAX, svsb->vmax);
|
||||
svs_writel_relaxed(svsp, limit_vals, LIMITVALS);
|
||||
|
||||
svs_writel_relaxed(svsp, SVSB_DET_WINDOW, DETWINDOW);
|
||||
svs_writel_relaxed(svsp, SVSB_DET_MAX, CONFIG);
|
||||
svs_writel_relaxed(svsp, svsb->chk_shift, CHKSHIFT);
|
||||
svs_writel_relaxed(svsp, svsb->ctl0, CTL0);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_CLEAN, INTSTS);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_VAL_CLEAN, INTSTS);
|
||||
|
||||
switch (target_phase) {
|
||||
case SVSB_PHASE_INIT01:
|
||||
svs_writel_relaxed(svsp, svsb->vboot, VBOOT);
|
||||
svs_writel_relaxed(svsp, SVSB_INTEN_INIT0x, INTEN);
|
||||
svs_writel_relaxed(svsp, SVSB_EN_INIT01, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_INIT01, SVSEN);
|
||||
break;
|
||||
case SVSB_PHASE_INIT02:
|
||||
init2vals = FIELD_PREP(SVSB_INIT2VALS_FLD_AGEVOFFSETIN, svsb->age_voffset_in) |
|
||||
FIELD_PREP(SVSB_INIT2VALS_FLD_DCVOFFSETIN, svsb->dc_voffset_in);
|
||||
svs_writel_relaxed(svsp, SVSB_INTEN_INIT0x, INTEN);
|
||||
init2vals = (svsb->age_voffset_in << 16) | svsb->dc_voffset_in;
|
||||
svs_writel_relaxed(svsp, init2vals, INIT2VALS);
|
||||
svs_writel_relaxed(svsp, SVSB_EN_INIT02, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_INIT02, SVSEN);
|
||||
break;
|
||||
case SVSB_PHASE_MON:
|
||||
ts_calcs = (svsb->bts << 12) | svsb->mts;
|
||||
ts_calcs = FIELD_PREP(SVSB_TSCALCS_FLD_BTS, svsb->bts) |
|
||||
FIELD_PREP(SVSB_TSCALCS_FLD_MTS, svsb->mts);
|
||||
svs_writel_relaxed(svsp, ts_calcs, TSCALCS);
|
||||
svs_writel_relaxed(svsp, SVSB_INTEN_MONVOPEN, INTEN);
|
||||
svs_writel_relaxed(svsp, SVSB_EN_MON, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_MON, SVSEN);
|
||||
break;
|
||||
default:
|
||||
dev_err(svsb->dev, "requested unknown target phase: %u\n",
|
||||
@ -1115,8 +1178,8 @@ static inline void svs_error_isr_handler(struct svs_platform *svsp)
|
||||
svs_save_bank_register_data(svsp, SVSB_PHASE_ERROR);
|
||||
|
||||
svsb->phase = SVSB_PHASE_ERROR;
|
||||
svs_writel_relaxed(svsp, SVSB_EN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_CLEAN, INTSTS);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_VAL_CLEAN, INTSTS);
|
||||
}
|
||||
|
||||
static inline void svs_init01_isr_handler(struct svs_platform *svsp)
|
||||
@ -1141,8 +1204,8 @@ static inline void svs_init01_isr_handler(struct svs_platform *svsp)
|
||||
svsb->age_voffset_in = svs_readl_relaxed(svsp, AGEVALUES) &
|
||||
GENMASK(15, 0);
|
||||
|
||||
svs_writel_relaxed(svsp, SVSB_EN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_COMPLETE, INTSTS);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_F0_COMPLETE, INTSTS);
|
||||
svsb->core_sel &= ~SVSB_DET_CLK_EN;
|
||||
}
|
||||
|
||||
@ -1160,8 +1223,8 @@ static inline void svs_init02_isr_handler(struct svs_platform *svsp)
|
||||
svsb->phase = SVSB_PHASE_INIT02;
|
||||
svsb->get_volts(svsp);
|
||||
|
||||
svs_writel_relaxed(svsp, SVSB_EN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_COMPLETE, INTSTS);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_F0_COMPLETE, INTSTS);
|
||||
}
|
||||
|
||||
static inline void svs_mon_mode_isr_handler(struct svs_platform *svsp)
|
||||
@ -1174,7 +1237,7 @@ static inline void svs_mon_mode_isr_handler(struct svs_platform *svsp)
|
||||
svsb->get_volts(svsp);
|
||||
|
||||
svsb->temp = svs_readl_relaxed(svsp, TEMP) & GENMASK(7, 0);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_MONVOP, INTSTS);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_FLD_MONVOP, INTSTS);
|
||||
}
|
||||
|
||||
static irqreturn_t svs_isr(int irq, void *data)
|
||||
@ -1201,13 +1264,13 @@ static irqreturn_t svs_isr(int irq, void *data)
|
||||
int_sts = svs_readl_relaxed(svsp, INTSTS);
|
||||
svs_en = svs_readl_relaxed(svsp, SVSEN);
|
||||
|
||||
if (int_sts == SVSB_INTSTS_COMPLETE &&
|
||||
svs_en == SVSB_EN_INIT01)
|
||||
if (int_sts == SVSB_INTSTS_F0_COMPLETE &&
|
||||
svs_en == SVSB_PTPEN_INIT01)
|
||||
svs_init01_isr_handler(svsp);
|
||||
else if (int_sts == SVSB_INTSTS_COMPLETE &&
|
||||
svs_en == SVSB_EN_INIT02)
|
||||
else if (int_sts == SVSB_INTSTS_F0_COMPLETE &&
|
||||
svs_en == SVSB_PTPEN_INIT02)
|
||||
svs_init02_isr_handler(svsp);
|
||||
else if (int_sts & SVSB_INTSTS_MONVOP)
|
||||
else if (int_sts & SVSB_INTSTS_FLD_MONVOP)
|
||||
svs_mon_mode_isr_handler(svsp);
|
||||
else
|
||||
svs_error_isr_handler(svsp);
|
||||
@ -1493,8 +1556,8 @@ static int svs_suspend(struct device *dev)
|
||||
spin_lock_irqsave(&svs_lock, flags);
|
||||
svsp->pbank = svsb;
|
||||
svs_switch_bank(svsp);
|
||||
svs_writel_relaxed(svsp, SVSB_EN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_CLEAN, INTSTS);
|
||||
svs_writel_relaxed(svsp, SVSB_PTPEN_OFF, SVSEN);
|
||||
svs_writel_relaxed(svsp, SVSB_INTSTS_VAL_CLEAN, INTSTS);
|
||||
spin_unlock_irqrestore(&svs_lock, flags);
|
||||
|
||||
svsb->phase = SVSB_PHASE_ERROR;
|
||||
@ -1589,7 +1652,7 @@ static int svs_bank_resource_setup(struct svs_platform *svsp)
|
||||
|
||||
dev_set_drvdata(svsb->dev, svsp);
|
||||
|
||||
ret = dev_pm_opp_of_add_table(svsb->opp_dev);
|
||||
ret = devm_pm_opp_of_add_table(svsb->opp_dev);
|
||||
if (ret) {
|
||||
dev_err(svsb->dev, "add opp table fail: %d\n", ret);
|
||||
return ret;
|
||||
@ -1644,11 +1707,36 @@ static int svs_bank_resource_setup(struct svs_platform *svsp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int svs_thermal_efuse_get_data(struct svs_platform *svsp)
|
||||
{
|
||||
struct nvmem_cell *cell;
|
||||
|
||||
/* Thermal efuse parsing */
|
||||
cell = nvmem_cell_get(svsp->dev, "t-calibration-data");
|
||||
if (IS_ERR_OR_NULL(cell)) {
|
||||
dev_err(svsp->dev, "no \"t-calibration-data\"? %ld\n", PTR_ERR(cell));
|
||||
return PTR_ERR(cell);
|
||||
}
|
||||
|
||||
svsp->tefuse = nvmem_cell_read(cell, &svsp->tefuse_max);
|
||||
if (IS_ERR(svsp->tefuse)) {
|
||||
dev_err(svsp->dev, "cannot read thermal efuse: %ld\n",
|
||||
PTR_ERR(svsp->tefuse));
|
||||
nvmem_cell_put(cell);
|
||||
return PTR_ERR(svsp->tefuse);
|
||||
}
|
||||
|
||||
svsp->tefuse_max /= sizeof(u32);
|
||||
nvmem_cell_put(cell);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool svs_mt8192_efuse_parsing(struct svs_platform *svsp)
|
||||
{
|
||||
struct svs_bank *svsb;
|
||||
struct nvmem_cell *cell;
|
||||
u32 idx, i, vmin, golden_temp;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < svsp->efuse_max; i++)
|
||||
if (svsp->efuse[i])
|
||||
@ -1686,24 +1774,9 @@ static bool svs_mt8192_efuse_parsing(struct svs_platform *svsp)
|
||||
svsb->vmax += svsb->dvt_fixed;
|
||||
}
|
||||
|
||||
/* Thermal efuse parsing */
|
||||
cell = nvmem_cell_get(svsp->dev, "t-calibration-data");
|
||||
if (IS_ERR_OR_NULL(cell)) {
|
||||
dev_err(svsp->dev, "no \"t-calibration-data\"? %ld\n",
|
||||
PTR_ERR(cell));
|
||||
ret = svs_thermal_efuse_get_data(svsp);
|
||||
if (ret)
|
||||
return false;
|
||||
}
|
||||
|
||||
svsp->tefuse = nvmem_cell_read(cell, &svsp->tefuse_max);
|
||||
if (IS_ERR(svsp->tefuse)) {
|
||||
dev_err(svsp->dev, "cannot read thermal efuse: %ld\n",
|
||||
PTR_ERR(svsp->tefuse));
|
||||
nvmem_cell_put(cell);
|
||||
return false;
|
||||
}
|
||||
|
||||
svsp->tefuse_max /= sizeof(u32);
|
||||
nvmem_cell_put(cell);
|
||||
|
||||
for (i = 0; i < svsp->tefuse_max; i++)
|
||||
if (svsp->tefuse[i] != 0)
|
||||
@ -1726,11 +1799,11 @@ static bool svs_mt8192_efuse_parsing(struct svs_platform *svsp)
|
||||
static bool svs_mt8183_efuse_parsing(struct svs_platform *svsp)
|
||||
{
|
||||
struct svs_bank *svsb;
|
||||
struct nvmem_cell *cell;
|
||||
int format[6], x_roomt[6], o_vtsmcu[5], o_vtsabb, tb_roomt = 0;
|
||||
int adc_ge_t, adc_oe_t, ge, oe, gain, degc_cali, adc_cali_en_t;
|
||||
int o_slope, o_slope_sign, ts_id;
|
||||
u32 idx, i, ft_pgm, mts, temp0, temp1, temp2;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < svsp->efuse_max; i++)
|
||||
if (svsp->efuse[i])
|
||||
@ -1806,24 +1879,9 @@ static bool svs_mt8183_efuse_parsing(struct svs_platform *svsp)
|
||||
}
|
||||
}
|
||||
|
||||
/* Get thermal efuse by nvmem */
|
||||
cell = nvmem_cell_get(svsp->dev, "t-calibration-data");
|
||||
if (IS_ERR(cell)) {
|
||||
dev_err(svsp->dev, "no \"t-calibration-data\"? %ld\n",
|
||||
PTR_ERR(cell));
|
||||
goto remove_mt8183_svsb_mon_mode;
|
||||
}
|
||||
|
||||
svsp->tefuse = nvmem_cell_read(cell, &svsp->tefuse_max);
|
||||
if (IS_ERR(svsp->tefuse)) {
|
||||
dev_err(svsp->dev, "cannot read thermal efuse: %ld\n",
|
||||
PTR_ERR(svsp->tefuse));
|
||||
nvmem_cell_put(cell);
|
||||
goto remove_mt8183_svsb_mon_mode;
|
||||
}
|
||||
|
||||
svsp->tefuse_max /= sizeof(u32);
|
||||
nvmem_cell_put(cell);
|
||||
ret = svs_thermal_efuse_get_data(svsp);
|
||||
if (ret)
|
||||
return false;
|
||||
|
||||
/* Thermal efuse parsing */
|
||||
adc_ge_t = (svsp->tefuse[1] >> 22) & GENMASK(9, 0);
|
||||
@ -2244,7 +2302,6 @@ static const struct svs_platform_data svs_mt8192_platform_data = {
|
||||
.banks = svs_mt8192_banks,
|
||||
.efuse_parsing = svs_mt8192_efuse_parsing,
|
||||
.probe = svs_mt8192_platform_probe,
|
||||
.irqflags = IRQF_TRIGGER_HIGH,
|
||||
.regs = svs_regs_v2,
|
||||
.bank_max = ARRAY_SIZE(svs_mt8192_banks),
|
||||
};
|
||||
@ -2254,7 +2311,6 @@ static const struct svs_platform_data svs_mt8183_platform_data = {
|
||||
.banks = svs_mt8183_banks,
|
||||
.efuse_parsing = svs_mt8183_efuse_parsing,
|
||||
.probe = svs_mt8183_platform_probe,
|
||||
.irqflags = IRQF_TRIGGER_LOW,
|
||||
.regs = svs_regs_v2,
|
||||
.bank_max = ARRAY_SIZE(svs_mt8183_banks),
|
||||
};
|
||||
@ -2292,7 +2348,6 @@ static struct svs_platform *svs_platform_probe(struct platform_device *pdev)
|
||||
svsp->banks = svsp_data->banks;
|
||||
svsp->efuse_parsing = svsp_data->efuse_parsing;
|
||||
svsp->probe = svsp_data->probe;
|
||||
svsp->irqflags = svsp_data->irqflags;
|
||||
svsp->regs = svsp_data->regs;
|
||||
svsp->bank_max = svsp_data->bank_max;
|
||||
|
||||
@ -2306,8 +2361,7 @@ static struct svs_platform *svs_platform_probe(struct platform_device *pdev)
|
||||
static int svs_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct svs_platform *svsp;
|
||||
unsigned int svsp_irq;
|
||||
int ret;
|
||||
int svsp_irq, ret;
|
||||
|
||||
svsp = svs_platform_probe(pdev);
|
||||
if (IS_ERR(svsp))
|
||||
@ -2325,10 +2379,14 @@ static int svs_probe(struct platform_device *pdev)
|
||||
goto svs_probe_free_resource;
|
||||
}
|
||||
|
||||
svsp_irq = irq_of_parse_and_map(svsp->dev->of_node, 0);
|
||||
svsp_irq = platform_get_irq(pdev, 0);
|
||||
if (svsp_irq < 0) {
|
||||
ret = svsp_irq;
|
||||
goto svs_probe_free_resource;
|
||||
}
|
||||
|
||||
ret = devm_request_threaded_irq(svsp->dev, svsp_irq, NULL, svs_isr,
|
||||
svsp->irqflags | IRQF_ONESHOT,
|
||||
svsp->name, svsp);
|
||||
IRQF_ONESHOT, svsp->name, svsp);
|
||||
if (ret) {
|
||||
dev_err(svsp->dev, "register irq(%d) failed: %d\n",
|
||||
svsp_irq, ret);
|
||||
@ -2392,7 +2450,7 @@ static struct platform_driver svs_driver = {
|
||||
.driver = {
|
||||
.name = "mtk-svs",
|
||||
.pm = &svs_pm_ops,
|
||||
.of_match_table = of_match_ptr(svs_of_match),
|
||||
.of_match_table = svs_of_match,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -65,4 +65,6 @@ void mtk_mmsys_ddp_disconnect(struct device *dev,
|
||||
enum mtk_ddp_comp_id cur,
|
||||
enum mtk_ddp_comp_id next);
|
||||
|
||||
void mtk_mmsys_ddp_dpi_fmt_config(struct device *dev, u32 val);
|
||||
|
||||
#endif /* __MTK_MMSYS_H */
|
||||
|
@ -20,6 +20,8 @@ enum mtk_mutex_mod_index {
|
||||
MUTEX_MOD_IDX_MDP_WDMA,
|
||||
MUTEX_MOD_IDX_MDP_AAL0,
|
||||
MUTEX_MOD_IDX_MDP_CCORR0,
|
||||
MUTEX_MOD_IDX_MDP_HDR0,
|
||||
MUTEX_MOD_IDX_MDP_COLOR0,
|
||||
|
||||
MUTEX_MOD_IDX_MAX /* ALWAYS keep at the end */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user