aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2005-10-28 12:52:56 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:56 -0400
commit9480e307cd88ef09ec9294c7d97ebec18e6d2221 (patch)
tree967e26d3a23c24dd52b114d672312c207714308c /arch
parenta3a3395e487abc4c1371fe319a8ecbb3913a70a4 (diff)
[PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
In PM v1, all devices were called at SUSPEND_DISABLE level. Then all devices were called at SUSPEND_SAVE_STATE level, and finally SUSPEND_POWER_DOWN level. However, with PM v2, to maintain compatibility for platform devices, I arranged for the PM v2 suspend/resume callbacks to call the old PM v1 suspend/resume callbacks three times with each level in order so that existing drivers continued to work. Since this is obsolete infrastructure which is no longer necessary, we can remove it. Here's an (untested) patch to do exactly that. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/common/locomo.c10
-rw-r--r--arch/arm/common/sa1111.c11
-rw-r--r--arch/arm/common/scoop.c24
-rw-r--r--arch/arm/mach-pxa/corgi_ssp.c24
-rw-r--r--arch/arm/mach-sa1100/neponset.c30
5 files changed, 38 insertions, 61 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index e8053d16829b..5cdb4122f057 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -550,15 +550,12 @@ struct locomo_save_data {
550 u16 LCM_SPIMD; 550 u16 LCM_SPIMD;
551}; 551};
552 552
553static int locomo_suspend(struct device *dev, pm_message_t state, u32 level) 553static int locomo_suspend(struct device *dev, pm_message_t state)
554{ 554{
555 struct locomo *lchip = dev_get_drvdata(dev); 555 struct locomo *lchip = dev_get_drvdata(dev);
556 struct locomo_save_data *save; 556 struct locomo_save_data *save;
557 unsigned long flags; 557 unsigned long flags;
558 558
559 if (level != SUSPEND_DISABLE)
560 return 0;
561
562 save = kmalloc(sizeof(struct locomo_save_data), GFP_KERNEL); 559 save = kmalloc(sizeof(struct locomo_save_data), GFP_KERNEL);
563 if (!save) 560 if (!save)
564 return -ENOMEM; 561 return -ENOMEM;
@@ -597,16 +594,13 @@ static int locomo_suspend(struct device *dev, pm_message_t state, u32 level)
597 return 0; 594 return 0;
598} 595}
599 596
600static int locomo_resume(struct device *dev, u32 level) 597static int locomo_resume(struct device *dev)
601{ 598{
602 struct locomo *lchip = dev_get_drvdata(dev); 599 struct locomo *lchip = dev_get_drvdata(dev);
603 struct locomo_save_data *save; 600 struct locomo_save_data *save;
604 unsigned long r; 601 unsigned long r;
605 unsigned long flags; 602 unsigned long flags;
606 603
607 if (level != RESUME_ENABLE)
608 return 0;
609
610 save = (struct locomo_save_data *) dev->power.saved_state; 604 save = (struct locomo_save_data *) dev->power.saved_state;
611 if (!save) 605 if (!save)
612 return 0; 606 return 0;
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 1a47fbf9cbbc..21e2a518ad3a 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -801,7 +801,7 @@ struct sa1111_save_data {
801 801
802#ifdef CONFIG_PM 802#ifdef CONFIG_PM
803 803
804static int sa1111_suspend(struct device *dev, pm_message_t state, u32 level) 804static int sa1111_suspend(struct device *dev, pm_message_t state)
805{ 805{
806 struct sa1111 *sachip = dev_get_drvdata(dev); 806 struct sa1111 *sachip = dev_get_drvdata(dev);
807 struct sa1111_save_data *save; 807 struct sa1111_save_data *save;
@@ -809,9 +809,6 @@ static int sa1111_suspend(struct device *dev, pm_message_t state, u32 level)
809 unsigned int val; 809 unsigned int val;
810 void __iomem *base; 810 void __iomem *base;
811 811
812 if (level != SUSPEND_DISABLE)
813 return 0;
814
815 save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); 812 save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
816 if (!save) 813 if (!save)
817 return -ENOMEM; 814 return -ENOMEM;
@@ -856,23 +853,19 @@ static int sa1111_suspend(struct device *dev, pm_message_t state, u32 level)
856/* 853/*
857 * sa1111_resume - Restore the SA1111 device state. 854 * sa1111_resume - Restore the SA1111 device state.
858 * @dev: device to restore 855 * @dev: device to restore
859 * @level: resume level
860 * 856 *
861 * Restore the general state of the SA1111; clock control and 857 * Restore the general state of the SA1111; clock control and
862 * interrupt controller. Other parts of the SA1111 must be 858 * interrupt controller. Other parts of the SA1111 must be
863 * restored by their respective drivers, and must be called 859 * restored by their respective drivers, and must be called
864 * via LDM after this function. 860 * via LDM after this function.
865 */ 861 */
866static int sa1111_resume(struct device *dev, u32 level) 862static int sa1111_resume(struct device *dev)
867{ 863{
868 struct sa1111 *sachip = dev_get_drvdata(dev); 864 struct sa1111 *sachip = dev_get_drvdata(dev);
869 struct sa1111_save_data *save; 865 struct sa1111_save_data *save;
870 unsigned long flags, id; 866 unsigned long flags, id;
871 void __iomem *base; 867 void __iomem *base;
872 868
873 if (level != RESUME_ENABLE)
874 return 0;
875
876 save = (struct sa1111_save_data *)dev->power.saved_state; 869 save = (struct sa1111_save_data *)dev->power.saved_state;
877 if (!save) 870 if (!save)
878 return 0; 871 return 0;
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 9e5245c702de..e8356b76d7c6 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -102,26 +102,24 @@ static void check_scoop_reg(struct scoop_dev *sdev)
102} 102}
103 103
104#ifdef CONFIG_PM 104#ifdef CONFIG_PM
105static int scoop_suspend(struct device *dev, pm_message_t state, uint32_t level) 105static int scoop_suspend(struct device *dev, pm_message_t state)
106{ 106{
107 if (level == SUSPEND_POWER_DOWN) { 107 struct scoop_dev *sdev = dev_get_drvdata(dev);
108 struct scoop_dev *sdev = dev_get_drvdata(dev); 108
109 check_scoop_reg(sdev);
110 sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
111 SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set;
109 112
110 check_scoop_reg(sdev);
111 sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
112 SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set;
113 }
114 return 0; 113 return 0;
115} 114}
116 115
117static int scoop_resume(struct device *dev, uint32_t level) 116static int scoop_resume(struct device *dev)
118{ 117{
119 if (level == RESUME_POWER_ON) { 118 struct scoop_dev *sdev = dev_get_drvdata(dev);
120 struct scoop_dev *sdev = dev_get_drvdata(dev); 119
120 check_scoop_reg(sdev);
121 SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
121 122
122 check_scoop_reg(sdev);
123 SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
124 }
125 return 0; 123 return 0;
126} 124}
127#else 125#else
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c
index 0ef428287055..136c269db0b7 100644
--- a/arch/arm/mach-pxa/corgi_ssp.c
+++ b/arch/arm/mach-pxa/corgi_ssp.c
@@ -222,24 +222,22 @@ static int corgi_ssp_remove(struct device *dev)
222 return 0; 222 return 0;
223} 223}
224 224
225static int corgi_ssp_suspend(struct device *dev, pm_message_t state, u32 level) 225static int corgi_ssp_suspend(struct device *dev, pm_message_t state)
226{ 226{
227 if (level == SUSPEND_POWER_DOWN) { 227 ssp_flush(&corgi_ssp_dev);
228 ssp_flush(&corgi_ssp_dev); 228 ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state);
229 ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state); 229
230 }
231 return 0; 230 return 0;
232} 231}
233 232
234static int corgi_ssp_resume(struct device *dev, u32 level) 233static int corgi_ssp_resume(struct device *dev)
235{ 234{
236 if (level == RESUME_POWER_ON) { 235 GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */
237 GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */ 236 GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/
238 GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/ 237 GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); /* High - Disable ADS7846*/
239 GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); /* High - Disable ADS7846*/ 238 ssp_restore_state(&corgi_ssp_dev,&corgi_ssp_state);
240 ssp_restore_state(&corgi_ssp_dev,&corgi_ssp_state); 239 ssp_enable(&corgi_ssp_dev);
241 ssp_enable(&corgi_ssp_dev); 240
242 }
243 return 0; 241 return 0;
244} 242}
245 243
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index fc061641b7be..7609d69cf1cc 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -178,33 +178,27 @@ static int neponset_probe(struct device *dev)
178/* 178/*
179 * LDM power management. 179 * LDM power management.
180 */ 180 */
181static int neponset_suspend(struct device *dev, pm_message_t state, u32 level) 181static int neponset_suspend(struct device *dev, pm_message_t state)
182{ 182{
183 /* 183 /*
184 * Save state. 184 * Save state.
185 */ 185 */
186 if (level == SUSPEND_SAVE_STATE || 186 if (!dev->power.saved_state)
187 level == SUSPEND_DISABLE || 187 dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
188 level == SUSPEND_POWER_DOWN) { 188 if (!dev->power.saved_state)
189 if (!dev->power.saved_state) 189 return -ENOMEM;
190 dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL); 190
191 if (!dev->power.saved_state) 191 *(unsigned int *)dev->power.saved_state = NCR_0;
192 return -ENOMEM;
193
194 *(unsigned int *)dev->power.saved_state = NCR_0;
195 }
196 192
197 return 0; 193 return 0;
198} 194}
199 195
200static int neponset_resume(struct device *dev, u32 level) 196static int neponset_resume(struct device *dev)
201{ 197{
202 if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) { 198 if (dev->power.saved_state) {
203 if (dev->power.saved_state) { 199 NCR_0 = *(unsigned int *)dev->power.saved_state;
204 NCR_0 = *(unsigned int *)dev->power.saved_state; 200 kfree(dev->power.saved_state);
205 kfree(dev->power.saved_state); 201 dev->power.saved_state = NULL;
206 dev->power.saved_state = NULL;
207 }
208 } 202 }
209 203
210 return 0; 204 return 0;