22
22
#include <linux/of_device.h>
23
23
#include <linux/of_platform.h>
24
24
#include <linux/clk.h>
25
- #include <linux/pm_runtime.h>
26
25
27
26
#define ULITE_NAME "ttyUL"
28
27
#define ULITE_MAJOR 204
55
54
#define ULITE_CONTROL_RST_TX 0x01
56
55
#define ULITE_CONTROL_RST_RX 0x02
57
56
#define ULITE_CONTROL_IE 0x10
58
- #define UART_AUTOSUSPEND_TIMEOUT 3000
59
57
60
58
/* Static pointer to console port */
61
59
#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
@@ -393,12 +391,12 @@ static int ulite_verify_port(struct uart_port *port, struct serial_struct *ser)
393
391
static void ulite_pm (struct uart_port * port , unsigned int state ,
394
392
unsigned int oldstate )
395
393
{
396
- if (! state ) {
397
- pm_runtime_get_sync ( port -> dev );
398
- } else {
399
- pm_runtime_mark_last_busy ( port -> dev );
400
- pm_runtime_put_autosuspend ( port -> dev );
401
- }
394
+ struct uartlite_data * pdata = port -> private_data ;
395
+
396
+ if (! state )
397
+ clk_enable ( pdata -> clk );
398
+ else
399
+ clk_disable ( pdata -> clk );
402
400
}
403
401
404
402
#ifdef CONFIG_CONSOLE_POLL
@@ -745,32 +743,11 @@ static int __maybe_unused ulite_resume(struct device *dev)
745
743
return 0 ;
746
744
}
747
745
748
- static int __maybe_unused ulite_runtime_suspend (struct device * dev )
749
- {
750
- struct uart_port * port = dev_get_drvdata (dev );
751
- struct uartlite_data * pdata = port -> private_data ;
752
-
753
- clk_disable (pdata -> clk );
754
- return 0 ;
755
- };
756
-
757
- static int __maybe_unused ulite_runtime_resume (struct device * dev )
758
- {
759
- struct uart_port * port = dev_get_drvdata (dev );
760
- struct uartlite_data * pdata = port -> private_data ;
761
-
762
- clk_enable (pdata -> clk );
763
- return 0 ;
764
- }
765
746
/* ---------------------------------------------------------------------
766
747
* Platform bus binding
767
748
*/
768
749
769
- static const struct dev_pm_ops ulite_pm_ops = {
770
- SET_SYSTEM_SLEEP_PM_OPS (ulite_suspend , ulite_resume )
771
- SET_RUNTIME_PM_OPS (ulite_runtime_suspend ,
772
- ulite_runtime_resume , NULL )
773
- };
750
+ static SIMPLE_DEV_PM_OPS (ulite_pm_ops , ulite_suspend , ulite_resume ) ;
774
751
775
752
#if defined(CONFIG_OF )
776
753
/* Match table for of_platform binding */
@@ -843,15 +820,9 @@ static int ulite_probe(struct platform_device *pdev)
843
820
return ret ;
844
821
}
845
822
846
- pm_runtime_use_autosuspend (& pdev -> dev );
847
- pm_runtime_set_autosuspend_delay (& pdev -> dev , UART_AUTOSUSPEND_TIMEOUT );
848
- pm_runtime_set_active (& pdev -> dev );
849
- pm_runtime_enable (& pdev -> dev );
850
-
851
823
ret = ulite_assign (& pdev -> dev , id , res -> start , irq , pdata );
852
824
853
- pm_runtime_mark_last_busy (& pdev -> dev );
854
- pm_runtime_put_autosuspend (& pdev -> dev );
825
+ clk_disable (pdata -> clk );
855
826
856
827
return ret ;
857
828
}
@@ -860,14 +831,9 @@ static int ulite_remove(struct platform_device *pdev)
860
831
{
861
832
struct uart_port * port = dev_get_drvdata (& pdev -> dev );
862
833
struct uartlite_data * pdata = port -> private_data ;
863
- int rc ;
864
834
865
835
clk_disable_unprepare (pdata -> clk );
866
- rc = ulite_release (& pdev -> dev );
867
- pm_runtime_disable (& pdev -> dev );
868
- pm_runtime_set_suspended (& pdev -> dev );
869
- pm_runtime_dont_use_autosuspend (& pdev -> dev );
870
- return rc ;
836
+ return ulite_release (& pdev -> dev );
871
837
}
872
838
873
839
/* work with hotplug and coldplug */
0 commit comments