* [PATCH v3 0/2]
@ 2025-01-24 13:40 Hao Chang
2025-01-24 13:40 ` [PATCH v3 1/2] pinctrl: mediatek: update EINT base retrieval method Hao Chang
2025-01-24 13:40 ` [PATCH v3 2/2] pinctrl: mediatek: adapt to multi-base design Hao Chang
0 siblings, 2 replies; 5+ messages in thread
From: Hao Chang @ 2025-01-24 13:40 UTC (permalink / raw)
To: Sean Wang, Linus Walleij, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Wenbin Mei, Axe Yang, Qingliang Li, Hanks Chen, Chunhui Li,
linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel,
Hao Chang
Change in v3:
1)Add error handling to prevent memory leaks
2)Move the eint pin assignment action to eint for processing
---
This patch depends on
[v3,2/2] pinctrl: mediatek: add mt8196 driver
[v3,1/2] dt-bindings: pinctrl: mediatek: add support for mt8196
Please also accept this patch together with [1]
to avoid build and dt binding check error.
[1]https://patchwork.kernel.org/project/linux-mediatek/list/?series=&submitter=215008&state=&q=v3&archive=&delegate=
---
Hao Chang (2):
pinctrl: mediatek: update EINT base retrieval method
pinctrl: mediatek: adapt to multi-base design
drivers/pinctrl/mediatek/mtk-eint.c | 38 +++++++++-----
.../pinctrl/mediatek/pinctrl-mtk-common-v2.c | 50 +++++++++++++------
2 files changed, 60 insertions(+), 28 deletions(-)
--
2.46.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] pinctrl: mediatek: update EINT base retrieval method
2025-01-24 13:40 [PATCH v3 0/2] Hao Chang
@ 2025-01-24 13:40 ` Hao Chang
2025-01-24 13:40 ` [PATCH v3 2/2] pinctrl: mediatek: adapt to multi-base design Hao Chang
1 sibling, 0 replies; 5+ messages in thread
From: Hao Chang @ 2025-01-24 13:40 UTC (permalink / raw)
To: Sean Wang, Linus Walleij, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Wenbin Mei, Axe Yang, Qingliang Li, Hanks Chen, Chunhui Li,
linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel,
Hao Chang
Change the method of obtaining the EINT base from a single value to
multiple values.
Modify the EINT base and add nbase for counting.
Change-Id: I708f2eaa4c57b5705201025c252a7122914c4a40
Signed-off-by: Hao Chang <ot_chhao.chang@mediatek.com>
Signed-off-by: Qingliang Li <qingliang.li@mediatek.com>
---
.../pinctrl/mediatek/pinctrl-mtk-common-v2.c | 50 +++++++++++++------
1 file changed, 35 insertions(+), 15 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index 6411c10cb637..e74fc68f631d 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -368,7 +368,7 @@ static const struct mtk_eint_xt mtk_eint_xt = {
int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
- unsigned int i, j, count_reg_names;
+ int ret, i, j, count_reg_names;
if (!IS_ENABLED(CONFIG_EINT_MTK))
return 0;
@@ -377,7 +377,7 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev)
return -ENODEV;
count_reg_names = of_property_count_strings(np, "reg-names");
- if (count_reg_names < 0 || count_reg_names < hw->soc->nbase_names)
+ if (count_reg_names < hw->soc->nbase_names)
return -EINVAL;
hw->eint = devm_kmalloc(hw->dev, sizeof(*hw->eint), GFP_KERNEL);
@@ -385,33 +385,53 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev)
return -ENOMEM;
hw->eint->nbase = count_reg_names - hw->soc->nbase_names;
- hw->eint->base = devm_kmalloc_array(&pdev->dev, hw->eint->nbase,
+ hw->eint->base = devm_kmalloc_array(hw->dev, hw->eint->nbase,
sizeof(*hw->eint->base), GFP_KERNEL);
- if (!hw->eint->base)
- return -ENOMEM;
+ if (!hw->eint->base) {
+ ret = -ENOMEM;
+ goto err_free_eint;
+ }
for (i = hw->soc->nbase_names, j = 0; i < count_reg_names; i++, j++) {
hw->eint->base[j] = of_iomap(np, i);
- if (IS_ERR(hw->eint->base[j]))
- return PTR_ERR(hw->eint->base[j]);
+ if (IS_ERR(hw->eint->base[j])) {
+ ret = PTR_ERR(hw->eint->base[j]);
+ goto err_free_eint;
+ }
}
- if (!of_property_read_bool(np, "interrupt-controller"))
- return -ENODEV;
+ if (!of_property_read_bool(np, "interrupt-controller")) {
+ ret = -ENODEV;
+ goto err_free_eint;
+ }
hw->eint->irq = irq_of_parse_and_map(np, 0);
- if (!hw->eint->irq)
- return -EINVAL;
-
- if (hw->soc->eint_pin)
- hw->eint->pins = hw->soc->eint_pin;
+ if (!hw->eint->irq) {
+ ret = -EINVAL;
+ goto err_free_eint;
+ }
hw->eint->dev = &pdev->dev;
hw->eint->hw = hw->soc->eint_hw;
hw->eint->pctl = hw;
hw->eint->gpio_xlate = &mtk_eint_xt;
- return mtk_eint_do_init(hw->eint);
+ ret = mtk_eint_do_init(hw->eint);
+ if (ret)
+ goto err_free_eint;
+
+ return 0;
+
+err_free_eint:
+ for (j = 0; j < hw->eint->nbase; j++) {
+ if (hw->eint->base[j])
+ iounmap(hw->eint->base[j]);
+ }
+ if (hw->eint->base)
+ devm_kfree(hw->dev, hw->eint->base);
+ devm_kfree(hw->dev, hw->eint);
+ hw->eint = NULL;
+ return ret;
}
EXPORT_SYMBOL_GPL(mtk_build_eint);
--
2.46.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 2/2] pinctrl: mediatek: adapt to multi-base design
2025-01-24 13:40 [PATCH v3 0/2] Hao Chang
2025-01-24 13:40 ` [PATCH v3 1/2] pinctrl: mediatek: update EINT base retrieval method Hao Chang
@ 2025-01-24 13:40 ` Hao Chang
1 sibling, 0 replies; 5+ messages in thread
From: Hao Chang @ 2025-01-24 13:40 UTC (permalink / raw)
To: Sean Wang, Linus Walleij, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Wenbin Mei, Axe Yang, Qingliang Li, Hanks Chen, Chunhui Li,
linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel,
Hao Chang
The eint num will obtain the operation address through pins.
Change the traversal method of irq handle from traversing a set of
registers to traversing one by one.
Change-Id: I3962b78042d32501a73153201cddf52c6b62a695
Signed-off-by: Hao Chang <ot_chhao.chang@mediatek.com>
Signed-off-by: Qingliang Li <qingliang.li@mediatek.com>
---
drivers/pinctrl/mediatek/mtk-eint.c | 38 +++++++++++++++++++----------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/drivers/pinctrl/mediatek/mtk-eint.c b/drivers/pinctrl/mediatek/mtk-eint.c
index 540245c3128d..949a20196f74 100644
--- a/drivers/pinctrl/mediatek/mtk-eint.c
+++ b/drivers/pinctrl/mediatek/mtk-eint.c
@@ -513,6 +513,7 @@ EXPORT_SYMBOL_GPL(mtk_eint_find_irq);
int mtk_eint_do_init(struct mtk_eint *eint)
{
unsigned int size, i, port;
+ struct mtk_pinctrl *hw = (struct mtk_pinctrl *)eint->pctl;
/* If clients don't assign a specific regs, let's use generic one */
if (!eint->regs)
@@ -523,11 +524,11 @@ int mtk_eint_do_init(struct mtk_eint *eint)
if (!eint->base_pin_num)
return -ENOMEM;
- if (!eint->pins) {
+ if (eint->nbase == 1) {
size = eint->hw->ap_num * sizeof(struct mtk_eint_pin);
eint->pins = devm_kmalloc(eint->dev, size, GFP_KERNEL);
if (!eint->pins)
- return -ENOMEM;
+ goto err_eint;
eint->base_pin_num[0] = eint->hw->ap_num;
for (i = 0; i < eint->hw->ap_num; i++) {
@@ -536,34 +537,29 @@ int mtk_eint_do_init(struct mtk_eint *eint)
eint->pins[i].debounce = (i < eint->hw->db_cnt) ? 1 : 0;
}
} else {
+ eint->pins = hw->soc->eint_pin;
for (i = 0; i < eint->hw->ap_num; i++)
eint->base_pin_num[eint->pins[i].instance]++;
}
eint->wake_mask = devm_kmalloc(eint->dev, eint->nbase * sizeof(u32 *), GFP_KERNEL);
- if (!eint->wake_mask)
- return -ENOMEM;
-
eint->cur_mask = devm_kmalloc(eint->dev, eint->nbase * sizeof(u32 *), GFP_KERNEL);
- if (!eint->wake_mask)
- return -ENOMEM;
+ if (!eint->wake_mask || !eint->wake_mask)
+ goto err_eint;
for (i = 0; i < eint->nbase; i++) {
port = (eint->base_pin_num[i] + 31) / 32;
eint->wake_mask[i] = devm_kzalloc(eint->dev, port * sizeof(u32), GFP_KERNEL);
- if (!eint->wake_mask[i])
- return -ENOMEM;
-
eint->cur_mask[i] = devm_kzalloc(eint->dev, port * sizeof(u32), GFP_KERNEL);
- if (!eint->cur_mask[i])
- return -ENOMEM;
+ if (!eint->cur_mask[i] || !eint->wake_mask[i])
+ goto err_eint;
}
eint->domain = irq_domain_add_linear(eint->dev->of_node,
eint->hw->ap_num,
&irq_domain_simple_ops, NULL);
if (!eint->domain)
- return -ENOMEM;
+ goto err_eint;
if (eint->hw->db_time) {
for (i = 0; i < MTK_EINT_DBNC_MAX; i++)
@@ -585,6 +581,22 @@ int mtk_eint_do_init(struct mtk_eint *eint)
eint);
return 0;
+
+err_eint:
+ for (i = 0; i < eint->nbase; i++) {
+ if (eint->wake_mask[i])
+ devm_kfree(eint->dev, eint->wake_mask[i]);
+ if (eint->cur_mask[i])
+ devm_kfree(eint->dev, eint->cur_mask[i]);
+ }
+ if (eint->cur_mask)
+ devm_kfree(eint->dev, eint->cur_mask);
+ if (eint->wake_mask)
+ devm_kfree(eint->dev, eint->wake_mask);
+ if (eint->nbase == 1)
+ devm_kfree(eint->dev, eint->pins);
+ devm_kfree(eint->dev, eint->base_pin_num);
+ return -ENOMEM;
}
EXPORT_SYMBOL_GPL(mtk_eint_do_init);
--
2.46.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 0/2]
@ 2025-01-24 13:49 Hao Chang
0 siblings, 0 replies; 5+ messages in thread
From: Hao Chang @ 2025-01-24 13:49 UTC (permalink / raw)
To: Sean Wang, Linus Walleij, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Wenbin Mei, Axe Yang, Qingliang Li, Hanks Chen, Chunhui Li,
linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel,
Hao Chang
Change in v3:
1)Add error handling to prevent memory leaks
2)Move the eint pin assignment action to eint for processing
---
This patch depends on
[v3,2/2] pinctrl: mediatek: add mt8196 driver
[v3,1/2] dt-bindings: pinctrl: mediatek: add support for mt8196
Please also accept this patch together with [1]
to avoid build and dt binding check error.
[1]https://patchwork.kernel.org/project/linux-mediatek/list/?series=&submitter=215008&state=&q=v3&archive=&delegate=
---
Hao Chang (2):
pinctrl: mediatek: update EINT base retrieval method
pinctrl: mediatek: adapt to multi-base design
drivers/pinctrl/mediatek/mtk-eint.c | 38 +++++++++-----
.../pinctrl/mediatek/pinctrl-mtk-common-v2.c | 50 +++++++++++++------
2 files changed, 60 insertions(+), 28 deletions(-)
--
2.46.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 0/2]
@ 2024-09-11 2:29 Damon Ding
0 siblings, 0 replies; 5+ messages in thread
From: Damon Ding @ 2024-09-11 2:29 UTC (permalink / raw)
To: heiko
Cc: robh, krzk+dt, conor+dt, macromorgan, jonas, tim, knaerzche,
efectn, andyshrk, jagan, dsimic, megi, sebastian.reichel, alchark,
boris.brezillon, devicetree, linux-arm-kernel, linux-rockchip,
linux-kernel, Damon Ding
Specification:
- Rockchip RK3588S
- RK806-2x2pcs + DiscretePower
- eMMC5.1 + SPI Flash
- Micro SD Card3.0
- 1 x Typec3.0 + 2 x USB2 HOST
- 1 x 1Lane PCIE2.0 Connector(RC Mode)
- Headphone output
- Array Key(MENU/VOL+/VOL-/ESC), Reset, Power on/off Key
- 6 x SARADC
Damon Ding (2):
dt-bindings: arm: rockchip: Add rk3588s evb1 board
arm64: dts: rockchip: Add support for rk3588s evb1 board
Changes in v2:
- rename amplifier nodes to amplifier-headphone and amplifier-speaker
- sort audio and backlight nodes by node name
- format names of regulator nodes to regulator-*
- add CPU/memory regulator coupling
- fix "VOP-" to "VOL-" in commit message
- remove bootargs property in chosen node
Changes in v3:
- remove unevaluated properties:
pcie@fe190000: 'rockchip,skip-scan-in-resume'
pmic@1: regulators: dcdc-reg*: 'regulator-init-microvolt'
phy@fed80000: 'svid'
.../devicetree/bindings/arm/rockchip.yaml | 5 +
arch/arm64/boot/dts/rockchip/Makefile | 1 +
.../boot/dts/rockchip/rk3588s-evb1-v10.dts | 1125 +++++++++++++++++
3 files changed, 1131 insertions(+)
create mode 100644 arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-24 13:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24 13:40 [PATCH v3 0/2] Hao Chang
2025-01-24 13:40 ` [PATCH v3 1/2] pinctrl: mediatek: update EINT base retrieval method Hao Chang
2025-01-24 13:40 ` [PATCH v3 2/2] pinctrl: mediatek: adapt to multi-base design Hao Chang
-- strict thread matches above, loose matches on Subject: below --
2025-01-24 13:49 [PATCH v3 0/2] Hao Chang
2024-09-11 2:29 Damon Ding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox