pinctrl: tegra: add suspend-resume support
Subsystems (3)
PATCH 1/2 pinctrl: tegra: add suspend-resume support
From: Pritesh Raithatha <[email protected]>
This patch adds suspend and resume callbacks to the pinctrl-tegra driver.
--- drivers/pinctrl/pinctrl-tegra.c | 56 ++++++++++++++++++++++++++++++++++++-- drivers/pinctrl/pinctrl-tegra.h | 3 +- drivers/pinctrl/pinctrl-tegra114.c | 3 ++ drivers/pinctrl/pinctrl-tegra20.c | 3 ++ drivers/pinctrl/pinctrl-tegra30.c | 2 ++ 5 files changed, 64 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-tegra.c +54 -2
@@ -29,6 +29,7 @@#include <linux/pinctrl/pinmux.h> #include <linux/pinctrl/pinconf.h> #include <linux/slab.h> +#include <linux/pm.h> #include "core.h" #include "pinctrl-tegra.h"
@@ -41,6 +42,8 @@ struct tegra_pmx {int nbanks;void __iomem **regs; +int *regs_size; +u32 *pg_data; };static inline u32 pmx_readl (struct tegra_pmx *pmx,u32 bank,u32 reg)
@@ -701,12 +704,42 @@ static struct pinctrl_desc tegra_pinctrl_desc = { .owner = THIS_MODULE, }; +int pinctrl_suspend (struct device *dev) +{ +int i, j; +struct tegra_pmx *pmx =dev_get_drvdata (dev); +u32 *pg_data = pmx->pg_data; +u32 *regs; + +for (i =0 ; i < pmx->nbanks; i++) { + regs = pmx->regs[i]; +for (j =0 ; j < pmx->regs_size[i] /4 ; j++) + *pg_data++ =readl (regs++); + } +return 0 ; +} + +int pinctrl_resume (struct device *dev) +{ +int i, j; +struct tegra_pmx *pmx =dev_get_drvdata (dev); +u32 *pg_data = pmx->pg_data; +u32 *regs; + +for (i =0 ; i < pmx->nbanks; i++) { + regs = pmx->regs[i]; +for (j =0 ; j < pmx->regs_size[i] /4 ; j++) +writel (*pg_data++, regs++); + } +return 0 ; +} +int tegra_pinctrl_probe (struct platform_device *pdev,const struct tegra_pinctrl_soc_data *soc_data) { -struct tegra_pmx *pmx;struct resource *res; -int i; +struct tegra_pmx *pmx; +int i, pg_data_size =0 ; pmx =devm_kzalloc (&pdev->dev,sizeof (*pmx),GFP_KERNEL );if (!pmx) {
@@ -725,6 +758,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev, res =platform_get_resource (pdev,IORESOURCE_MEM , i);if (!res)break ; + pg_data_size +=resource_size (res); } pmx->nbanks = i;
@@ -735,6 +769,21 @@ int tegra_pinctrl_probe(struct platform_device *pdev,return -ENODEV ; } +if (IS_ENABLED (CONFIG_PM_SLEEP )) + pmx->regs_size =devm_kzalloc (&pdev->dev, + pmx->nbanks *sizeof (*(pmx->regs_size)), +GFP_KERNEL ); +if (!pmx->regs_size) { +dev_err (&pdev->dev,"Can't alloc regs pointer\n" ); +return -ENODEV ; + } + + pmx->pg_data =devm_kzalloc (&pdev->dev, pg_data_size,GFP_KERNEL ); +if (!pmx->pg_data) { +dev_err (&pdev->dev,"Can't alloc pingroup data pointer\n" ); +return -ENODEV ; + } +for (i =0 ; i < pmx->nbanks; i++) { res =platform_get_resource (pdev,IORESOURCE_MEM , i);if (!res) {
@@ -756,6 +805,9 @@ int tegra_pinctrl_probe(struct platform_device *pdev,dev_err (&pdev->dev,"Couldn't ioremap regs %d\n" , i);return -ENODEV ; } + +if (IS_ENABLED (CONFIG_PM_SLEEP )) + pmx->regs_size[i] =resource_size (res); } pmx->pctl =pinctrl_register (&tegra_pinctrl_desc, &pdev->dev, pmx);
drivers/pinctrl/pinctrl-tegra.h +2 -1
@@ -202,5 +202,6 @@ struct tegra_pinctrl_soc_data {int tegra_pinctrl_probe (struct platform_device *pdev,const struct tegra_pinctrl_soc_data *soc_data);int tegra_pinctrl_remove (struct platform_device *pdev); - +int pinctrl_suspend (struct device *dev); +int pinctrl_resume (struct device *dev);#endif
drivers/pinctrl/pinctrl-tegra114.c +3 -0
@@ -2752,10 +2752,13 @@ static struct of_device_id tegra114_pinctrl_of_match[] = { };MODULE_DEVICE_TABLE (of, tegra114_pinctrl_of_match); +static SIMPLE_DEV_PM_OPS(pinctrl_dev_pm_ops, pinctrl_suspend, pinctrl_resume); +static struct platform_driver tegra114_pinctrl_driver = { .driver = { .name ="tegra114-pinctrl" , .owner =THIS_MODULE , + .pm = &pinctrl_dev_pm_ops, .of_match_table = tegra114_pinctrl_of_match, }, .probe = tegra114_pinctrl_probe,
drivers/pinctrl/pinctrl-tegra20.c +3 -0
@@ -2872,10 +2872,13 @@ static struct of_device_id tegra20_pinctrl_of_match[] = { { }, }; +static SIMPLE_DEV_PM_OPS(pinctrl_dev_pm_ops, pinctrl_suspend, pinctrl_resume); +static struct platform_driver tegra20_pinctrl_driver = { .driver = { .name ="tegra20-pinctrl" , .owner =THIS_MODULE , + .pm = &pinctrl_dev_pm_ops, .of_match_table = tegra20_pinctrl_of_match, }, .probe = tegra20_pinctrl_probe,
drivers/pinctrl/pinctrl-tegra30.c +2 -0
@@ -3736,6 +3736,8 @@ static struct of_device_id tegra30_pinctrl_of_match[] = { { }, }; +static SIMPLE_DEV_PM_OPS(pinctrl_dev_pm_ops, pinctrl_suspend, pinctrl_resume); +static struct platform_driver tegra30_pinctrl_driver = { .driver = { .name ="tegra30-pinctrl" ,
Signature · 1 line
1.8.1.5
PATCH 2/2 ARM: DT: tegra: pinctrl suspend resume hook
Make pinmux as the first node of tegra DT
so as to achieve pinctrl as last device to suspend and first device to resume.
--- arch/arm/boot/dts/tegra114.dtsi | 12 ++++++------ arch/arm/boot/dts/tegra20.dtsi | 16 ++++++++-------- arch/arm/boot/dts/tegra30.dtsi | 13 +++++++------ 3 files changed, 21 insertions(+), 20 deletions(-)
arch/arm/boot/dts/tegra114.dtsi +6 -6
@@ -11,6 +11,12 @@ serial3 = &uartd; }; + pinmux: pinmux { + compatible = "nvidia,tegra114-pinmux"; + reg = <0x70000868 0x148 /* Pad control registers */ + 0x70003000 0x40c>; /* Mux registers */ + }; + host1x { compatible = "nvidia,tegra114-host1x", "simple-bus"; reg = <0x50000000 0x00028000>;
@@ -165,12 +171,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra114-pinmux"; - reg = <0x70000868 0x148 /* Pad control registers */ - 0x70003000 0x40c>; /* Mux registers */ - }; - /* * There are two serial driver i.e. 8250 based simple serial * driver and APB DMA based serial driver for higher baudrate
arch/arm/boot/dts/tegra20.dtsi +8 -8
@@ -12,6 +12,14 @@ serial4 = &uarte; }; + pinmux: pinmux { + compatible = "nvidia,tegra20-pinmux"; + reg = <0x70000014 0x10 /* Tri-state registers */ + 0x70000080 0x20 /* Mux registers */ + 0x700000a0 0x14 /* Pull-up/down registers */ + 0x70000868 0xa8>; /* Pad control registers */ + }; + host1x { compatible = "nvidia,tegra20-host1x", "simple-bus"; reg = <0x50000000 0x00024000>;
@@ -196,14 +204,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra20-pinmux"; - reg = <0x70000014 0x10 /* Tri-state registers */ - 0x70000080 0x20 /* Mux registers */ - 0x700000a0 0x14 /* Pull-up/down registers */ - 0x70000868 0xa8>; /* Pad control registers */ - }; - das { compatible = "nvidia,tegra20-das"; reg = <0x70000c00 0x80>;
arch/arm/boot/dts/tegra30.dtsi +7 -6
@@ -12,6 +12,13 @@ serial4 = &uarte; }; + pinmux: pinmux { + compatible = "nvidia,tegra30-pinmux"; + reg = <0x70000868 0xd4 /* Pad control registers */ + 0x70003000 0x3e4>; /* Mux registers */ + }; + + host1x { compatible = "nvidia,tegra30-host1x", "simple-bus"; reg = <0x50000000 0x00024000>;
@@ -216,12 +223,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra30-pinmux"; - reg = <0x70000868 0xd4 /* Pad control registers */ - 0x70003000 0x3e4>; /* Mux registers */ - }; - /* * There are two serial driver i.e. 8250 based simple serial * driver and APB DMA based serial driver for higher baudrate
Signature · 1 line
1.8.1.5
Re: [PATCH 2/2] ARM: DT: tegra: pinctrl suspend resume hook
Quoted 3 lines · Bibek Basu
Make pinmux as the first node of tegra DT
so as to achieve pinctrl as last device to suspend and first device to resume.
I don't think this is a good idea. For one it encodes Linux specific implementation details within the device tree. Furthermore I seem to remember that the device tree makes no guarantees that the order of nodes in the blob is the same as the order in the DTS.
That said I don't have a good alternative. Perhaps one solution would be to use suspend_late() and resume_early() for the pinmux driver since they will be called after and before the suspend() and resume() callbacks of all other devices, respectively. Other than that I wasn't able to find anything about forcing a particular order during suspend and resume.
Cc'ing Rafael and the linux-pm mailing list, maybe somebody among them knows a proper solution.
Thierry
Quoted 112 lines
Signed-off-by Bibek Basu <[email protected]>--- arch/arm/boot/dts/tegra114.dtsi | 12 ++++++------ arch/arm/boot/dts/tegra20.dtsi | 16 ++++++++-------- arch/arm/boot/dts/tegra30.dtsi | 13 +++++++------ 3 files changed, 21 insertions(+), 20 deletions(-)arch/arm/boot/dts/tegra114.dtsi +6
-6@@ -11,6 +11,12 @@ serial3 = &uartd; }; + pinmux: pinmux { + compatible = "nvidia,tegra114-pinmux"; + reg = <0x70000868 0x148 /* Pad control registers */ + 0x70003000 0x40c>; /* Mux registers */ + }; + host1x { compatible = "nvidia,tegra114-host1x", "simple-bus"; reg = <0x50000000 0x00028000>;@@ -165,12 +171,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra114-pinmux"; - reg = <0x70000868 0x148 /* Pad control registers */ - 0x70003000 0x40c>; /* Mux registers */ - }; - /* * There are two serial driver i.e. 8250 based simple serial * driver and APB DMA based serial driver for higher baudratearch/arm/boot/dts/tegra20.dtsi +8
-8@@ -12,6 +12,14 @@ serial4 = &uarte; }; + pinmux: pinmux { + compatible = "nvidia,tegra20-pinmux"; + reg = <0x70000014 0x10 /* Tri-state registers */ + 0x70000080 0x20 /* Mux registers */ + 0x700000a0 0x14 /* Pull-up/down registers */ + 0x70000868 0xa8>; /* Pad control registers */ + }; + host1x { compatible = "nvidia,tegra20-host1x", "simple-bus"; reg = <0x50000000 0x00024000>;@@ -196,14 +204,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra20-pinmux"; - reg = <0x70000014 0x10 /* Tri-state registers */ - 0x70000080 0x20 /* Mux registers */ - 0x700000a0 0x14 /* Pull-up/down registers */ - 0x70000868 0xa8>; /* Pad control registers */ - }; - das { compatible = "nvidia,tegra20-das"; reg = <0x70000c00 0x80>;arch/arm/boot/dts/tegra30.dtsi +7
-6@@ -12,6 +12,13 @@ serial4 = &uarte; }; + pinmux: pinmux { + compatible = "nvidia,tegra30-pinmux"; + reg = <0x70000868 0xd4 /* Pad control registers */ + 0x70003000 0x3e4>; /* Mux registers */ + }; + + host1x { compatible = "nvidia,tegra30-host1x", "simple-bus"; reg = <0x50000000 0x00024000>;@@ -216,12 +223,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra30-pinmux"; - reg = <0x70000868 0xd4 /* Pad control registers */ - 0x70003000 0x3e4>; /* Mux registers */ - }; - /* * There are two serial driver i.e. 8250 based simple serial * driver and APB DMA based serial driver for higher baudrateSignature · 6 lines
1.8.1.5 -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/2] ARM: DT: tegra: pinctrl suspend resume hook
Quoted 20 lines
-----Original Message-----
From: Thierry Reding [mailto:[email protected]]
Sent: Saturday, April 27, 2013 1:19 AM
To: Bibek Basu
Cc: Rafael J. Wysocki; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH 2/2] ARM: DT: tegra: pinctrl suspend resume hook* PGP Signed by an unknown key
Quoted 2 lines · Bibek Basu
Make pinmux as the first node of tegra DT so as to achieve pinctrl as last device to suspend and first device to resume.
I don't think this is a good idea. For one it encodes Linux specific implementation details within the device tree. Furthermore I seem to remember that the device tree makes no guarantees that the order of nodes in the blob is the same as the order in the DTS.
Quoted 9 lines
That said I don't have a good alternative. Perhaps one solution would be to use
suspend_late()andresume_early()for the pinmux driver since they will be called after and before thesuspend()andresume()callbacks of all other devices, respectively. Other than that I wasn't able to find anything about forcing a particular order during suspend and resume.Cc'ing Rafael and the linux-pm mailing list, maybe somebody among them knows a proper solution.
Stephen actually suggested me earlier to add dummy pinmux state on all dependent devices node. And that will make sure that dependency of driver prevails. I tried that but I was not getting the desired result.
Can anyone tell me correct syntax for adding dummy state?
Regards
Bibek
Quoted 120 lines
Thierry
Quoted 13 lines
Signed-off-by Bibek Basu <[email protected]>--- arch/arm/boot/dts/tegra114.dtsi | 12 ++++++------ arch/arm/boot/dts/tegra20.dtsi | 16 ++++++++-------- arch/arm/boot/dts/tegra30.dtsi | 13 +++++++------ 3 files changed, 21 insertions(+), 20 deletions(-)(quoted diff) +0
-0
b/arch/arm/boot/dts/tegra114.dtsiindex a58a761..36596ae 100644arch/arm/boot/dts/tegra114.dtsi line 16
Quoted 6 lines
arch/arm/boot/dts/tegra114.dtsi +3
-0@@ -11,6 +11,12 @@ serial3 = &uartd; }; + pinmux: pinmux { + compatible = "nvidia,tegra114-pinmux"; + reg = <0x70000868 0x148 /* Pad controlregisters */
arch/arm/boot/dts/tegra114.dtsi line 170
Quoted 13 lines
arch/arm/boot/dts/tegra114.dtsi +3
-3+ 0x70003000 0x40c>; /* Mux registers */ + }; + host1x { compatible = "nvidia,tegra114-host1x", "simple-bus"; reg = <0x50000000 0x00028000>;@@ -165,12 +171,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra114-pinmux"; - reg = <0x70000868 0x148 /* Pad controlregisters */
Quoted 74 lines
arch/arm/boot/dts/tegra114.dtsi +0
-4- 0x70003000 0x40c>; /* Mux registers */ - }; - /* * There are two serial driver i.e. 8250 based simple serial * driver and APB DMA based serial driver for higher baudrate diff --git a/arch/arm/boot/dts/tegra20.dtsi
b/arch/arm/boot/dts/tegra20.dtsiindex a5a9615..6d8a663 100644arch/arm/boot/dts/tegra20.dtsi +8
-8@@ -12,6 +12,14 @@ serial4 = &uarte; }; + pinmux: pinmux { + compatible = "nvidia,tegra20-pinmux"; + reg = <0x70000014 0x10 /* Tri-state registers */ + 0x70000080 0x20 /* Mux registers */ + 0x700000a0 0x14 /* Pull-up/down registers */ + 0x70000868 0xa8>; /* Pad control registers */ + }; + host1x { compatible = "nvidia,tegra20-host1x", "simple-bus"; reg = <0x50000000 0x00024000>;@@ -196,14 +204,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra20-pinmux"; - reg = <0x70000014 0x10 /* Tri-state registers */ - 0x70000080 0x20 /* Mux registers */ - 0x700000a0 0x14 /* Pull-up/down registers */ - 0x70000868 0xa8>; /* Pad control registers */ - }; - das { compatible = "nvidia,tegra20-das"; reg = <0x70000c00 0x80>;(quoted diff) +0
-0
b/arch/arm/boot/dts/tegra30.dtsiindex 9f33086..b4b79f0 100644arch/arm/boot/dts/tegra30.dtsi +7
-7@@ -12,6 +12,13 @@ serial4 = &uarte; }; + pinmux: pinmux { + compatible = "nvidia,tegra30-pinmux"; + reg = <0x70000868 0xd4 /* Pad control registers */ + 0x70003000 0x3e4>; /* Mux registers */ + }; + + host1x { compatible = "nvidia,tegra30-host1x", "simple-bus"; reg = <0x50000000 0x00024000>;@@ -216,12 +223,6 @@ interrupt-controller; }; - pinmux: pinmux { - compatible = "nvidia,tegra30-pinmux"; - reg = <0x70000868 0xd4 /* Pad control registers */ - 0x70003000 0x3e4>; /* Mux registers */ - }; - /* * There are two serial driver i.e. 8250 based simple serial * driver and APB DMA based serial driver for higher baudrate --1.8.1.5
Quoted 3 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] Moremajordomo
Quoted 3 lines
* Unknown Key
*0x7F3EB3A1
Re: [PATCH 2/2] ARM: DT: tegra: pinctrl suspend resume hook
Quoted 26 lines · Bibek Basu
Quoted 26 lines
-----Original Message-----
From: Thierry Reding [mailto:[email protected]]
Sent: Saturday, April 27, 2013 1:19 AM
To: Bibek Basu
Cc: Rafael J. Wysocki; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH 2/2] ARM: DT: tegra: pinctrl suspend resume hook* PGP Signed by an unknown key
Quoted 2 lines · Bibek Basu
Make pinmux as the first node of tegra DT so as to achieve pinctrl as last device to suspend and first device to resume.
I don't think this is a good idea. For one it encodes Linux specific implementation details within the device tree. Furthermore I seem to remember that the device tree makes no guarantees that the order of nodes in the blob is the same as the order in the DTS.
That said I don't have a good alternative. Perhaps one solution would be to use
suspend_late()andresume_early()for the pinmux driver since they will be called after and before thesuspend()andresume()callbacks of all other devices, respectively. Other than that I wasn't able to find anything about forcing a particular order during suspend and resume.
Quoted 6 lines
Quoted 2 lines
Cc'ing Rafael and the linux-pm mailing list, maybe somebody among them knows a proper solution.
Stephen actually suggested me earlier to add dummy pinmux state on all dependent devices node. And that will make sure that dependency of driver prevails. I tried that but I was not getting the desired result.
Can anyone tell me correct syntax for adding dummy state?
I agree with Thierry that this patch is not the correct approach.
A dummy pinctrl state would look something like the following in each affected device node:
pinctrl-names = "default";
pinctrl-0 = <>;Quoted 1 line
drivers/pinctrl/pinctrl-tegra.c +0
-0
[...]
drivers/pinctrl/pinctrl-tegra.c struct tegra_pmx { · line 45
Quoted 5 lines
drivers/pinctrl/pinctrl-tegra.c +1
-0@@ -41,6 +42,8 @@ struct tegra_pmx {int nbanks;void __iomem **regs; +int *regs_size;
Perhaps this should be unsigned int *. The values stored in this array will never be negative, right?
drivers/pinctrl/pinctrl-tegra.c static struct pinctrl_desc tegra_pinctrl_desc = { · line 742
Quoted 8 lines
drivers/pinctrl/pinctrl-tegra.c +2
-2int tegra_pinctrl_probe (struct platform_device *pdev,const struct tegra_pinctrl_soc_data *soc_data) { -struct tegra_pmx *pmx;struct resource *res; -int i; +struct tegra_pmx *pmx; +int i, pg_data_size =0 ;
There's a needless move of the pmx variable declaration here.
Quoted 8 lines
drivers/pinctrl/pinctrl-tegra.c +4
-0@@ -735,6 +769,21 @@ int tegra_pinctrl_probe(struct platform_device *pdev,return -ENODEV ; } +if (IS_ENABLED (CONFIG_PM_SLEEP )) + pmx->regs_size =devm_kzalloc (&pdev->dev, + pmx->nbanks *sizeof (*(pmx->regs_size)), +GFP_KERNEL );
drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device *pdev, · line 785
Quoted 10 lines
drivers/pinctrl/pinctrl-tegra.c +10
-0+if (!pmx->regs_size) { +dev_err (&pdev->dev,"Can't alloc regs pointer\n" ); +return -ENODEV ; + } + + pmx->pg_data =devm_kzalloc (&pdev->dev, pg_data_size,GFP_KERNEL ); +if (!pmx->pg_data) { +dev_err (&pdev->dev,"Can't alloc pingroup data pointer\n" ); +return -ENODEV ; + }
I don't think this works the way you expect it to. The line
if (IS_ENABLED(CONFIG_PM_SLEEP))
is a standard conditional and therefore needs to be properly indented and use { and } to delimit the block.
drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device *pdev, · line 810
Quoted 7 lines
drivers/pinctrl/pinctrl-tegra.c +3
-0@@ -756,6 +805,9 @@ int tegra_pinctrl_probe(struct platform_device *pdev,dev_err (&pdev->dev,"Couldn't ioremap regs %d\n" , i);return -ENODEV ; } + +if (IS_ENABLED (CONFIG_PM_SLEEP )) + pmx->regs_size[i] =resource_size (res);
In this case it will actually work as expected, but the if () should be properly indented.
Thierry
Quoted 13 lines
-----Original Message-----
From: Thierry Reding [mailto:[email protected]]
Sent: Wednesday, April 24, 2013 12:14 AM
To: Bibek Basu
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; Pritesh Raithatha
Subject: Re: [PATCH 1/2] pinctrl: tegra: add suspend-resume support* PGP Signed by an unknown key
Quoted 2 lines
drivers/pinctrl/pinctrl-tegra.c +0
-0[...]
Quoted 8 lines
drivers/pinctrl/pinctrl-tegra.c struct tegra_pmx { · line 45
Quoted 5 lines
drivers/pinctrl/pinctrl-tegra.c +1
-0@@ -41,6 +42,8 @@ struct tegra_pmx {int nbanks;void __iomem **regs; +int *regs_size;Perhaps this should be unsigned int *. The values stored in this array will never be negative, right?
Agree.
Quoted 10 lines
drivers/pinctrl/pinctrl-tegra.c static struct pinctrl_desc tegra_pinctrl_desc = { · line 742
Quoted 8 lines
drivers/pinctrl/pinctrl-tegra.c +2
-2int tegra_pinctrl_probe (struct platform_device *pdev,const struct tegra_pinctrl_soc_data *soc_data) { -struct tegra_pmx *pmx;struct resource *res; -int i; +struct tegra_pmx *pmx; +int i, pg_data_size =0 ;There's a needless move of the pmx variable declaration here.
Agree
Quoted 24 lines
drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device
Quoted 2 lines
drivers/pinctrl/pinctrl-tegra.c +0
-0@@ -735,6 +769,21 @@ int tegra_pinctrl_probe(struct platform_device*pdev,
drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device *pdev,
Quoted 13 lines
drivers/pinctrl/pinctrl-tegra.c +10
-0return -ENODEV ; } +if (IS_ENABLED (CONFIG_PM_SLEEP )) + pmx->regs_size =devm_kzalloc (&pdev->dev, + pmx->nbanks *sizeof (*(pmx->regs_size)), +GFP_KERNEL ); +if (!pmx->regs_size) { +dev_err (&pdev->dev,"Can't alloc regs pointer\n" ); +return -ENODEV ; + } + + pmx->pg_data = devm_kzalloc(&pdev->dev, pg_data_size,
GFP_KERNEL);drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device *pdev, · line 785
Quoted 4 lines
drivers/pinctrl/pinctrl-tegra.c +4
-0+if (!pmx->pg_data) { +dev_err (&pdev->dev,"Can't alloc pingroup data pointer\n" ); +return -ENODEV ; + }I don't think this works the way you expect it to. The line
Quoted 5 lines
if (
IS_ENABLED(CONFIG_PM_SLEEP))is a standard conditional and therefore needs to be properly indented and use { and } to delimit the block.
My Bad. Will fix
Quoted 13 lines
drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device
Quoted 1 line
drivers/pinctrl/pinctrl-tegra.c +0
-0@@ -756,6 +805,9 @@ int tegra_pinctrl_probe(struct platform_device*pdev,
drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device · line 805
Quoted 1 line
drivers/pinctrl/pinctrl-tegra.c +0
-0dev_err(&pdev->dev, "Couldn't ioremap regs %d\n",i);
drivers/pinctrl/pinctrl-tegra.c int tegra_pinctrl_probe(struct platform_device *pdev, · line 810
Quoted 5 lines
drivers/pinctrl/pinctrl-tegra.c +3
-0return -ENODEV ; } + +if (IS_ENABLED (CONFIG_PM_SLEEP )) + pmx->regs_size[i] =resource_size (res);In this case it will actually work as expected, but the if () should be properly indented.
Quoted 2 lines
Thierry
Thanks for the review
Bibek
Quoted 2 lines
* Unknown Key
*0x7F3EB3A1