1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Profpatsch <mail@profpatsch.de>
Subject: [PATCH 1/6] tolino: core and generic code, merged onto android-4.9-q
The files outside the board support where Tolino's tree and
android-4.9-q both changed the same upstream file and the build reads
it. Files the merge took unchanged from either side are not here: q's
are the base, the vendor's are listed in vendor-files.
Merged by hand among these: init/main.c (the vendor's ntx_init() hook
and NTX banner, on q's main.c), mm/page_alloc.c (the vendor's CMA-first
policy for movable allocations, on q's watermarks).
---
arch/arm64/Kconfig.platforms | 152 ++++++++++++++++++++
arch/arm64/kernel/Makefile | 1 +
arch/x86/Kconfig | 2 +-
block/blk-merge.c | 55 ++++++++
crypto/algif_skcipher.c | 12 +-
drivers/base/core.c | 3 +
drivers/base/power/opp/of.c | 171 +++++++++++++++++++++++
drivers/block/Kconfig | 1 +
drivers/clk/clk.c | 1 +
drivers/clocksource/Kconfig | 3 +-
drivers/clocksource/arm_arch_timer.c | 45 ++++++
drivers/dma/Kconfig | 9 ++
drivers/extcon/extcon.c | 29 +++-
drivers/gpio/Kconfig | 5 +
drivers/gpio/gpiolib-of.c | 11 ++
drivers/gpio/gpiolib.c | 9 +-
drivers/gpio/gpiolib.h | 5 +
drivers/hid/hid-core.c | 2 +-
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-magicmouse.c | 148 ++++++++++++++++++--
drivers/hid/usbhid/hid-core.c | 9 ++
drivers/i2c/busses/Kconfig | 18 +++
drivers/i2c/i2c-core.c | 107 ++++++++++++++
drivers/iommu/iommu.c | 5 +-
drivers/leds/led-class.c | 48 ++++++-
drivers/leds/led-core.c | 3 +
drivers/md/dm-crypt.c | 125 ++++++++++++++++-
drivers/net/phy/Kconfig | 4 +
drivers/spi/Kconfig | 6 +
drivers/staging/android/Kconfig | 14 +-
drivers/staging/android/Makefile | 2 +-
drivers/staging/android/ashmem.c | 2 -
drivers/tty/serial/Kconfig | 26 ++++
drivers/usb/Kconfig | 2 +
drivers/usb/core/config.c | 9 +-
drivers/usb/host/ehci-hcd.c | 27 +++-
drivers/usb/host/ohci-hcd.c | 5 +
fs/debugfs/inode.c | 46 ++++--
fs/file_table.c | 6 +
fs/namei.c | 7 +
fs/namespace.c | 10 +-
fs/sdcardfs/main.c | 2 +
include/asm-generic/vmlinux.lds.h | 7 -
include/linux/blkdev.h | 2 +
include/linux/cpu.h | 6 +
include/linux/crypto.h | 116 +++++++++++++++
include/linux/debugfs.h | 54 ++++---
include/linux/dma-mapping.h | 2 +
include/linux/kref.h | 1 +
include/linux/mmc/host.h | 7 +
include/linux/mmzone.h | 3 +-
include/linux/pci.h | 13 ++
include/linux/regulator/consumer.h | 13 ++
include/linux/regulator/driver.h | 11 +-
include/linux/usb/composite.h | 1 +
include/linux/usb/gadget.h | 8 ++
include/linux/workqueue.h | 2 +
include/uapi/linux/input-event-codes.h | 6 +
kernel/fork.c | 6 -
kernel/futex.c | 6 +-
kernel/panic.c | 24 ++++
kernel/sysctl.c | 1 +
kernel/time/alarmtimer.c | 71 +++++++++-
kernel/time/timekeeping.c | 11 ++
lib/Kconfig.debug | 3 +-
mm/cma.c | 55 ++++++++
mm/slab.h | 6 +
mm/vmstat.c | 1 -
net/core/net_namespace.c | 2 +-
net/ipv4/netfilter/arp_tables.c | 4 -
net/ipv4/netfilter/ip_tables.c | 7 +-
net/ipv6/ip6_output.c | 2 +-
net/ipv6/netfilter/ip6_tables.c | 4 -
net/netlink/af_netlink.c | 4 +-
net/xfrm/xfrm_user.c | 25 ++--
scripts/checkpatch.pl | 8 +-
scripts/mkcompile_h | 1 +
security/keys/encrypted-keys/encrypted.c | 31 ++--
security/security.c | 4 +
sound/usb/mixer.c | 8 --
sound/usb/mixer.h | 2 -
81 files changed, 1508 insertions(+), 178 deletions(-)
mode change 100644 => 100755 drivers/i2c/i2c-core.c
mode change 100644 => 100755 drivers/usb/Kconfig
mode change 100644 => 100755 drivers/usb/core/config.c
mode change 100644 => 100755 drivers/usb/host/ehci-hcd.c
mode change 100644 => 100755 drivers/usb/host/ohci-hcd.c
mode change 100644 => 100755 include/linux/regulator/driver.h
mode change 100644 => 100755 include/linux/usb/composite.h
diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 2f9c2a95c..b34b4f57a 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -1,3 +1,4 @@
+
menu "Platform selection"
config ARCH_SUNXI
@@ -10,6 +11,156 @@ config ARCH_SUNXI
help
This enables support for Allwinner sunxi based SoCs like the A64.
+if ARCH_SUNXI
+choice
+ prompt "Select the architecture of SoC"
+ default ARCH_SUN50I
+ help
+ Select the architecture for SoC
+ sunxi
+ `-- sun50i ----- Cortex-A53 based Family SoCs
+
+ config ARCH_SUN50I
+ bool "Allwinner SUN50I"
+endchoice
+
+# Select the wafer with sun50i
+
+if ARCH_SUN50I
+choice
+ prompt "Select the wafer with arch sun50i"
+ default ARCH_SUN50IW1
+ help
+ Select the wafer with arch sun50i
+
+config ARCH_SUN50IW1
+ bool "Allwinner SUN50IW1 SoCs"
+ help
+ Support for Allwinner SUN50IW1 SoC family
+
+config ARCH_SUN50IW2
+ bool "Allwinner SUN50IW2 SoCs"
+ help
+ Support for Allwinner SUN50IW2 SoC family
+
+config ARCH_SUN50IW3
+ bool "Allwinner SUN50IW3 SoCs"
+ help
+ Support for Allwinner SUN50IW3 SoC family
+
+config ARCH_SUN50IW6
+ bool "Allwinner SUN50IW6 SoCs"
+ help
+ Support for Allwinner SUN50IW6 SoC family
+
+config ARCH_SUN50IW8
+ bool "Allwinner SUN50IW8 SoCs"
+ help
+ Support for Allwinner SUN50IW8 SoC family
+
+endchoice
+endif
+
+# Select the SoC with specific arch and wafer
+
+if ARCH_SUN50IW1
+choice
+ prompt "Select the SoC with wafer ARCH_SUN50IW1"
+ default ARCH_SUN50IW1P1
+ help
+ Select the SoC with wafer ARCH_SUN50IW1
+
+config ARCH_SUN50IW1P1
+ bool "Allwinner SUN50IW1P1"
+ select SUNXI_SMC
+endchoice
+endif
+
+if ARCH_SUN50IW2
+choice
+ prompt "Select the SoC with wafer ARCH_SUN50IW2"
+ default ARCH_SUN50IW2P1
+ help
+ Select the SoC with wafer ARCH_SUN50IW2
+
+config ARCH_SUN50IW2P1
+ bool "Allwinner SUN50IW2P1"
+ select HAVE_UNSTABLE_SCHED_CLOCK
+ select SUNXI_SMC
+endchoice
+endif
+
+if ARCH_SUN50IW3
+choice
+ prompt "Select the SoC with wafer ARCH_SUN50IW3"
+ default ARCH_SUN50IW3P1
+ help
+ Select the SoC with wafer ARCH_SUN50IW3
+
+config ARCH_SUN50IW3P1
+ bool "Allwinner SUN50IW3P1"
+ select SUNXI_SMC
+endchoice
+endif
+
+if ARCH_SUN50IW6
+choice
+ prompt "Select the SoC with wafer ARCH_SUN50IW6"
+ default ARCH_SUN50IW6P1
+ help
+ Select the SoC with wafer ARCH_SUN50IW6
+
+config ARCH_SUN50IW6P1
+ bool "Allwinner SUN50IW6P1"
+ select SUNXI_SMC
+ select ARCH_SUPPORTS_MSI
+endchoice
+endif
+
+if ARCH_SUN50IW8
+choice
+ prompt "Select the SoC with wafer ARCH_SUN50IW8"
+ default ARCH_SUN50IW8P1
+ help
+ Select the SoC with wafer ARCH_SUN50IW8
+
+config ARCH_SUN50IW8P1
+ bool "Allwinner SUN50IW8P1"
+# Will not use smc in FPGA stage
+# select SUNXI_SMC
+endchoice
+endif
+
+# Select the board between FPGA and EVB
+
+choice
+ prompt "Allwinner development boards"
+ depends on ARCH_SUNXI
+ default FPGA_V4_PLATFORM
+
+config FPGA_V4_PLATFORM
+ bool "FPGAv4 board"
+ help
+ Support for Allwinner's FPGAv4 board
+
+ config FPGA_V7_PLATFORM
+ bool "FPGAv7 board"
+ help
+ Support for Allwinner's FPGAv7 board
+
+ config EVB_PLATFORM
+ bool "EVB board"
+ help
+ Support for Allwinner's EVB board
+endchoice
+
+config SUNXI_SOC_NAME
+ string "The name of SUNXI SoC"
+ default ""
+ help
+ Used for /sysfs/.../sysinfo.
+
+endif # end of ARCH_SUNXI
config ARCH_ALPINE
bool "Annapurna Labs Alpine platform"
select ALPINE_MSI if PCI
@@ -232,4 +383,5 @@ config ARCH_ZYNQMP
help
This enables support for Xilinx ZynqMP Family
+
endmenu
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 6dadaaee7..5cc95b0bf 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -35,6 +35,7 @@ arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o
arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o
arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
+arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
arm64-obj-$(CONFIG_CPU_PM) += sleep.o suspend.o
arm64-obj-$(CONFIG_CPU_IDLE) += cpuidle.o
arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6219401ae..735e2e7e7 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -44,7 +44,7 @@ config X86
select ARCH_USE_CMPXCHG_LOCKREF if X86_64
select ARCH_USE_QUEUED_RWLOCKS
select ARCH_USE_QUEUED_SPINLOCKS
- select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
+ select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if SMP
select ARCH_WANTS_DYNAMIC_TASK_STRUCT
select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_IPC_PARSE_VERSION if X86_32
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 66795cca6..1ba72282b 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -11,6 +11,8 @@
#include "blk.h"
+extern int sunxi_crypt_need_crypt(struct bio *bio);
+
static struct bio *blk_bio_discard_split(struct request_queue *q,
struct bio *bio,
struct bio_set *bs,
@@ -486,6 +488,59 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
}
EXPORT_SYMBOL(blk_rq_map_sg);
+int sunxi_blk_rq_map_sg(struct request_queue *q, struct request *rq,
+ struct scatterlist *sglist)
+{
+ struct scatterlist *sg = NULL;
+ int nsegs = 0;
+ int crypt_flags = 0;
+
+ if (rq->bio) {
+#if defined(CONFIG_DM_CRYPT) && defined(CONFIG_SUNXI_EMCE)
+ crypt_flags = sunxi_crypt_need_crypt(rq->bio);
+#endif
+ nsegs = __blk_bios_map_sg(q, rq->bio, sglist, &sg);
+ }
+
+ if (sg && crypt_flags)
+ sglist->offset |= (1 << ((sizeof(sglist->offset) << 3) - 1));
+
+ if (unlikely(rq->cmd_flags & REQ_COPY_USER) &&
+ (blk_rq_bytes(rq) & q->dma_pad_mask)) {
+ unsigned int pad_len =
+ (q->dma_pad_mask & ~blk_rq_bytes(rq)) + 1;
+
+ sg->length += pad_len;
+ rq->extra_len += pad_len;
+ }
+
+ if (q->dma_drain_size && q->dma_drain_needed(rq)) {
+ if (op_is_write(req_op(rq)))
+ memset(q->dma_drain_buffer, 0, q->dma_drain_size);
+
+ sg_unmark_end(sg);
+ sg = sg_next(sg);
+ sg_set_page(sg, virt_to_page(q->dma_drain_buffer),
+ q->dma_drain_size,
+ ((unsigned long)q->dma_drain_buffer) &
+ (PAGE_SIZE - 1));
+ nsegs++;
+ rq->extra_len += q->dma_drain_size;
+ }
+
+ if (sg)
+ sg_mark_end(sg);
+
+ /*
+ * Something must have been wrong if the figured number of
+ * segment is bigger than number of req's physical segments
+ */
+ WARN_ON(nsegs > rq->nr_phys_segments);
+
+ return nsegs;
+}
+EXPORT_SYMBOL(sunxi_blk_rq_map_sg);
+
static inline int ll_new_hw_segment(struct request_queue *q,
struct request *req,
struct bio *bio)
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 931a777a4..41753b42d 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -805,8 +805,8 @@ static int skcipher_sendmsg_nokey(struct socket *sock, struct msghdr *msg,
int err;
err = skcipher_check_key(sock);
- if (err)
- return err;
+ /*if (err)
+ return err;*/ /*ce2.0 dh/rsa/ecc have no single key to set*/
return skcipher_sendmsg(sock, msg, size);
}
@@ -817,8 +817,8 @@ static ssize_t skcipher_sendpage_nokey(struct socket *sock, struct page *page,
int err;
err = skcipher_check_key(sock);
- if (err)
- return err;
+ /*if (err)
+ return err;*/ /*ce2.0 dh/rsa/ecc have no single key to set*/
return skcipher_sendpage(sock, page, offset, size, flags);
}
@@ -829,8 +829,8 @@ static int skcipher_recvmsg_nokey(struct socket *sock, struct msghdr *msg,
int err;
err = skcipher_check_key(sock);
- if (err)
- return err;
+ /*if (err)
+ return err;*/ /*ce2.0 dh/rsa/ecc have no single key to set*/
return skcipher_recvmsg(sock, msg, ignored, flags);
}
diff --git a/drivers/base/core.c b/drivers/base/core.c
index e82a89325..7efc170f4 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -431,6 +431,7 @@ static ssize_t online_show(struct device *dev, struct device_attribute *attr,
bool val;
device_lock(dev);
+ dev->offline = !(!!cpu_online(dev->id));
val = !dev->offline;
device_unlock(dev);
return sprintf(buf, "%u\n", val);
@@ -450,6 +451,8 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr,
if (ret)
return ret;
+ dev->offline = !(!!cpu_online(dev->id));
+
ret = val ? device_online(dev) : device_offline(dev);
unlock_device_hotplug();
return ret < 0 ? ret : count;
diff --git a/drivers/base/power/opp/of.c b/drivers/base/power/opp/of.c
index 69379443e..bddb6bbe0 100644
--- a/drivers/base/power/opp/of.c
+++ b/drivers/base/power/opp/of.c
@@ -285,6 +285,7 @@ static int _opp_add_static_v2(struct device *dev, struct device_node *np)
if (ret)
goto free_opp;
+#if 0
/* OPP to select on device suspend */
if (of_property_read_bool(np, "opp-suspend")) {
if (opp_table->suspend_opp) {
@@ -296,6 +297,7 @@ static int _opp_add_static_v2(struct device *dev, struct device_node *np)
opp_table->suspend_opp = new_opp;
}
}
+#endif
if (new_opp->clock_latency_ns > opp_table->clock_latency_ns_max)
opp_table->clock_latency_ns_max = new_opp->clock_latency_ns;
@@ -610,3 +612,172 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev,
return ret;
}
EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus);
+
+/**
+* copy to _of_get_opp_desc_node().
+* Returns opp descriptor node for a device, caller must do of_node_put()
+*/
+struct device_node *of_get_opp_desc_node_by_soc_bin(struct device *dev,
+ int soc_bin)
+{
+ /*
+ * TODO: Support for multiple OPP tables.
+ *
+ * There support more phandle present in "operating-points-v2"
+ * property.
+ */
+ struct of_phandle_args args;
+
+ if (soc_bin < 0)
+ return NULL;
+
+ of_parse_phandle_with_fixed_args(dev->of_node, "operating-points-v2",
+ 0, soc_bin, &args);
+
+ return args.np;
+}
+
+/*
+ * copy to dev_pm_opp_of_get_sharing_cpus
+ * Works only for OPP v2 bindings.
+ *
+ * Returns -ENOENT if operating-points-v2 bindings aren't supported.
+ */
+int dev_pm_opp_of_get_sharing_cpus_by_soc_bin(struct device *cpu_dev,
+ cpumask_var_t cpumask, int soc_bin)
+{
+ struct device_node *np, *tmp_np;
+ struct device *tcpu_dev;
+ int cpu, ret = 0;
+
+ /* Get OPP descriptor node */
+ np = of_get_opp_desc_node_by_soc_bin(cpu_dev, soc_bin);
+ if (!np) {
+ dev_dbg(cpu_dev, "%s: Couldn't find cpu_dev node.\n", __func__);
+ return -ENOENT;
+ }
+
+ cpumask_set_cpu(cpu_dev->id, cpumask);
+
+ /* OPPs are shared ? */
+ if (!of_property_read_bool(np, "opp-shared"))
+ goto put_cpu_node;
+
+ for_each_possible_cpu(cpu) {
+ if (cpu == cpu_dev->id)
+ continue;
+
+ tcpu_dev = get_cpu_device(cpu);
+ if (!tcpu_dev) {
+ dev_err(cpu_dev, "%s: failed to get cpu%d device\n",
+ __func__, cpu);
+ ret = -ENODEV;
+ goto put_cpu_node;
+ }
+
+ /* Get OPP descriptor node */
+ tmp_np = of_get_opp_desc_node_by_soc_bin(tcpu_dev, soc_bin);
+ if (!tmp_np) {
+ dev_err(tcpu_dev, "%s: Couldn't find tcpu_dev node.\n",
+ __func__);
+ ret = -ENOENT;
+ goto put_cpu_node;
+ }
+
+ /* CPUs are sharing opp node */
+ if (np == tmp_np)
+ cpumask_set_cpu(cpu, cpumask);
+
+ of_node_put(tmp_np);
+ }
+
+put_cpu_node:
+ of_node_put(np);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus_by_soc_bin);
+
+/**
+ * copy to dev_pm_opp_of_add_table()
+ */
+int dev_pm_opp_of_add_table_by_soc_bin(struct device *dev, int soc_bin)
+{
+ struct device_node *opp_np;
+ int ret;
+
+ /*
+ * OPPs have two version of bindings now. The older one is deprecated,
+ * try for the new binding first.
+ */
+ opp_np = of_get_opp_desc_node_by_soc_bin(dev, soc_bin);
+ if (!opp_np) {
+ /*
+ * Try old-deprecated bindings for backward compatibility with
+ * older dtbs.
+ */
+ return _of_add_opp_table_v1(dev);
+ }
+
+ ret = _of_add_opp_table_v2(dev, opp_np);
+ of_node_put(opp_np);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_by_soc_bin);
+
+
+/*
+ * copy to dev_pm_opp_of_cpumask_add_table
+ */
+int
+dev_pm_opp_of_cpumask_add_table_by_soc_bin(cpumask_var_t cpumask, int soc_bin)
+{
+ struct device *cpu_dev;
+ int cpu, ret = 0;
+
+ WARN_ON(cpumask_empty(cpumask));
+
+ for_each_cpu(cpu, cpumask) {
+ cpu_dev = get_cpu_device(cpu);
+ if (!cpu_dev) {
+ pr_err("%s: failed to get cpu%d device\n", __func__,
+ cpu);
+ continue;
+ }
+
+ ret = dev_pm_opp_of_add_table_by_soc_bin(cpu_dev, soc_bin);
+ if (ret) {
+ pr_err("%s: couldn't find opp table for cpu:%d, %d\n",
+ __func__, cpu, ret);
+
+ /* Free all other OPPs */
+ dev_pm_opp_of_cpumask_remove_table(cpumask);
+ break;
+ }
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_add_table_by_soc_bin);
+
+/**
+ * dev_pm_opp_axi_bus_divide_ratio() - Gets the axi_bus_divide_ratio
+ * @opp: opp for which frequency has to be returned for
+ *
+ */
+unsigned long dev_pm_opp_axi_bus_divide_ratio(struct dev_pm_opp *opp)
+{
+ struct dev_pm_opp *tmp_opp;
+ u32 f = 0;
+
+// opp_rcu_lockdep_assert();
+
+ tmp_opp = rcu_dereference(opp);
+ if (IS_ERR_OR_NULL(tmp_opp) || !tmp_opp->available)
+ pr_err("%s: Invalid parameters\n", __func__);
+ else
+ of_property_read_u32(tmp_opp->np, "axi-bus-divide-ratio", &f);
+
+ return f;
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_axi_bus_divide_ratio);
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 3d5cf588c..e6c255d09 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -126,6 +126,7 @@ source "drivers/block/mtip32xx/Kconfig"
source "drivers/block/zram/Kconfig"
+source "modules/nand/Kconfig"
config BLK_CPQ_CISS_DA
tristate "Compaq Smart Array 5xxx support"
depends on PCI
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 9d60b3f21..a37bb1de9 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -275,6 +275,7 @@ unsigned int __clk_get_enable_count(struct clk *clk)
{
return !clk ? 0 : clk->core->enable_count;
}
+EXPORT_SYMBOL_GPL(__clk_get_enable_count);
static unsigned long clk_core_get_rate_nolock(struct clk_core *core)
{
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index ebfc66d1b..182910cdb 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -91,9 +91,10 @@ config ORION_TIMER
Enables the support for the Orion timer driver
config SUN4I_TIMER
- bool "Sun4i timer driver" if COMPILE_TEST
+ bool "Sun4i timer driver"
depends on GENERIC_CLOCKEVENTS
depends on HAS_IOMEM
+ default y
select CLKSRC_MMIO
help
Enables support for the Sun4i timer.
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 2a2c1221c..f15062314 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -387,7 +387,51 @@ static int arch_timer_shutdown_phys_mem(struct clock_event_device *clk)
{
return timer_shutdown(ARCH_TIMER_MEM_PHYS_ACCESS, clk);
}
+#if defined(CONFIG_ARCH_SUN50IW1P1) \
+ || defined(CONFIG_ARCH_SUN50IW2P1)
+#define ARCH_TVAL_TRY_MAX_TIME (12)
+#define ARCH_CVAL_MAX_DELTA (40)
+static __always_inline void set_next_event(const int access, unsigned long evt,
+ struct clock_event_device *clk)
+{
+ unsigned int retry = 0;
+ unsigned long ctrl;
+ unsigned long tval;
+ u64 cnt;
+ u64 cval;
+
+ ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL, clk);
+ ctrl |= ARCH_TIMER_CTRL_ENABLE;
+ ctrl &= ~ARCH_TIMER_CTRL_IT_MASK;
+
+ /* sun50i timer maybe imprecise,
+ * we should try to fix this.
+ */
+ while (retry < ARCH_VCNT_TRY_MAX_TIME) {
+ if (access == ARCH_TIMER_PHYS_ACCESS) {
+ cnt = arch_counter_get_cntpct();
+ arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL, evt, clk);
+ cval = arch_timer_reg_read_cval(access);
+ } else {
+ cnt = arch_counter_get_cntvct();
+ arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL, evt, clk);
+ cval = arch_timer_reg_read_cval(access);
+ }
+ tval = cval - cnt;
+ if ((tval - evt) <= ARCH_CVAL_MAX_DELTA) {
+ /* set tval succeeded, let timer running */
+ arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk);
+ return;
+ }
+ /* tval set value error, try again */
+ retry++;
+ }
+ /* set tval fail, just let timer running */
+ pr_warn("notice: set tval failed.\n");
+ arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk);
+}
+#else
static __always_inline void set_next_event(const int access, unsigned long evt,
struct clock_event_device *clk)
{
@@ -398,6 +442,7 @@ static __always_inline void set_next_event(const int access, unsigned long evt,
arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL, evt, clk);
arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl, clk);
}
+#endif /* CONFIG_ARCH_SUN50I */
#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
static __always_inline void erratum_set_next_event_generic(const int access,
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 9a6da9b2d..58f57f996 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -164,6 +164,15 @@ config DMA_SUN6I
help
Support for the DMA engine first found in Allwinner A31 SoCs.
+config DMA_SUNXI
+ tristate "Sunxi SOC DMA support"
+ depends on ARCH_SUNXI
+ select DMA_ENGINE
+ select DMA_VIRTUAL_CHANNELS
+ help
+ Support for the DMA engine found on Sunxi family SOCs.
+ This DMA engine can only be used with on-chip devices.
+
config EP93XX_DMA
bool "Cirrus Logic EP93xx DMA support"
depends on ARCH_EP93XX || COMPILE_TEST
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 20e24d4b9..e9f91c4c7 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -172,6 +172,21 @@ struct __extcon_info {
.id = EXTCON_DISP_HMD,
.name = "HMD",
},
+ [EXTCON_DISP_CVBS] = {
+ .type = EXTCON_TYPE_DISP,
+ .id = EXTCON_DISP_CVBS,
+ .name = "CVBS",
+ },
+ [EXTCON_DISP_TVD] = {
+ .type = EXTCON_TYPE_DISP,
+ .id = EXTCON_DISP_TVD,
+ .name = "TVD",
+ },
+ [EXTCON_DISP_EDP] = {
+ .type = EXTCON_TYPE_DISP,
+ .id = EXTCON_DISP_EDP,
+ .name = "EDP",
+ },
/* Miscellaneous external connector */
[EXTCON_DOCK] = {
@@ -1056,14 +1071,18 @@ int extcon_dev_register(struct extcon_dev *edev)
edev->dev.class = extcon_class;
edev->dev.release = extcon_dev_release;
- edev->name = dev_name(edev->dev.parent);
if (IS_ERR_OR_NULL(edev->name)) {
- dev_err(&edev->dev,
- "extcon device name is null\n");
- return -EINVAL;
- }
dev_set_name(&edev->dev, "extcon%lu",
(unsigned long)atomic_inc_return(&edev_no));
+ edev->name = dev_name(edev->dev.parent);
+ } else {
+ dev_set_name(&edev->dev, edev->name);
+ }
+
+ if (IS_ERR_OR_NULL(edev->name)) {
+ dev_err(&edev->dev, "extcon device name is null\n");
+ return -EINVAL;
+ }
if (edev->max_supported) {
char buf[10];
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 74dbdcefe..409430edd 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -127,6 +127,11 @@ config GPIO_AXP209
help
Say yes to enable GPIO support for the AXP209 PMIC
+config GPIO_SUNXI
+ tristate "SUNXI GPIO Support"
+ help
+ Say yes if need SUNXI GPIO Support
+
config GPIO_BCM_KONA
bool "Broadcom Kona GPIO"
depends on OF_GPIO && (ARCH_BCM_MOBILE || COMPILE_TEST)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 9e40914c0..fadc7db49 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -127,6 +127,10 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
struct gpio_desc *desc;
unsigned int i;
+#ifdef CONFIG_ARCH_SUNXI
+ struct gpio_config gpio_flags;
+#endif
+
for (i = 0; i < ARRAY_SIZE(gpio_suffixes); i++) {
if (con_id)
snprintf(prop_name, sizeof(prop_name), "%s-%s", con_id,
@@ -135,8 +139,15 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
snprintf(prop_name, sizeof(prop_name), "%s",
gpio_suffixes[i]);
+#ifndef CONFIG_ARCH_SUNXI
desc = of_get_named_gpiod_flags(dev->of_node, prop_name, idx,
&of_flags);
+#else
+ desc = of_get_named_gpiod_flags(dev->of_node, prop_name, idx,
+ (enum of_gpio_flags *)&gpio_flags);
+ of_flags = gpio_flags.data;
+#endif
+
if (!IS_ERR(desc) || (PTR_ERR(desc) != -ENOENT))
break;
}
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 73d02f608..7a85e44c1 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3285,9 +3285,16 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
if (is_of_node(fwnode)) {
enum of_gpio_flags flags;
-
+#ifndef CONFIG_ARCH_SUNXI
desc = of_get_named_gpiod_flags(to_of_node(fwnode), propname, 0,
&flags);
+#else
+ struct gpio_config gpio_flags;
+
+ desc = of_get_named_gpiod_flags(to_of_node(fwnode), propname, 0,
+ (enum of_gpio_flags *)&gpio_flags);
+ flags = gpio_flags.data;
+#endif
if (!IS_ERR(desc)) {
active_low = flags & OF_GPIO_ACTIVE_LOW;
single_ended = flags & OF_GPIO_SINGLE_ENDED;
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 6c4d72872..074f9c731 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -18,6 +18,11 @@
#include <linux/module.h>
#include <linux/cdev.h>
+#ifdef CONFIG_ARCH_SUNXI
+#include <linux/sunxi-gpio.h>
+#endif
+
+
enum of_gpio_flags;
enum gpiod_flags;
enum gpio_lookup_flags;
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 0482446a5..06e0c3731 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -50,7 +50,7 @@ module_param_named(debug, hid_debug, int, 0600);
MODULE_PARM_DESC(debug, "toggle HID debugging messages");
EXPORT_SYMBOL_GPL(hid_debug);
-static int hid_ignore_special_drivers = 0;
+static int hid_ignore_special_drivers = 1;
module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600);
MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver");
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 0239eaaf1..8f8b5af5e 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -87,6 +87,7 @@
#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
#define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e
+#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 0x0265
#define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e
#define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f
#define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index aca3bc15f..cee0a41bf 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Apple "Magic" Wireless Mouse driver
*
@@ -6,10 +7,6 @@
*/
/*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -54,6 +51,8 @@ module_param(report_undeciphered, bool, 0644);
MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event");
#define TRACKPAD_REPORT_ID 0x28
+#define TRACKPAD2_USB_REPORT_ID 0x02
+#define TRACKPAD2_BT_REPORT_ID 0x31
#define MOUSE_REPORT_ID 0x29
#define DOUBLE_REPORT_ID 0xf7
/* These definitions are not precise, but they're close enough. (Bits
@@ -91,6 +90,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
#define TRACKPAD_RES_Y \
((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
+#define TRACKPAD2_DIMENSION_X (float)16000
+#define TRACKPAD2_MIN_X -3678
+#define TRACKPAD2_MAX_X 3934
+#define TRACKPAD2_RES_X \
+ ((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 100))
+#define TRACKPAD2_DIMENSION_Y (float)11490
+#define TRACKPAD2_MIN_Y -2478
+#define TRACKPAD2_MAX_Y 2587
+#define TRACKPAD2_RES_Y \
+ ((TRACKPAD2_MAX_Y - TRACKPAD2_MIN_Y) / (TRACKPAD2_DIMENSION_Y / 100))
+
/**
* struct magicmouse_sc - Tracks Magic Mouse-specific data.
* @input: Input device through which we report events.
@@ -183,6 +193,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
{
struct input_dev *input = msc->input;
int id, x, y, size, orientation, touch_major, touch_minor, state, down;
+ int pressure = 0;
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
@@ -194,6 +205,18 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
touch_minor = tdata[4];
state = tdata[7] & TOUCH_STATE_MASK;
down = state != TOUCH_STATE_NONE;
+
+ } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+ id = tdata[8] & 0xf;
+ x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
+ y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) >> 19);
+ size = tdata[6];
+ orientation = (tdata[8] >> 5) - 4;
+ touch_major = tdata[4];
+ touch_minor = tdata[5];
+ pressure = tdata[7];
+ state = tdata[3] & 0xC0;
+ down = state == 0x80;
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
id = (tdata[7] << 2 | tdata[6] >> 6) & 0xf;
x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
@@ -215,7 +238,8 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
/* If requested, emulate a scroll wheel by detecting small
* vertical touch motions.
*/
- if (emulate_scroll_wheel) {
+ if (emulate_scroll_wheel && (input->id.product !=
+ USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)) {
unsigned long now = jiffies;
int step_x = msc->touches[id].scroll_x - x;
int step_y = msc->touches[id].scroll_y - y;
@@ -269,10 +293,14 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
+ if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)
+ input_report_abs(input, ABS_MT_PRESSURE, pressure);
+
if (report_undeciphered) {
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
input_event(input, EV_MSC, MSC_RAW, tdata[7]);
- else /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
+ else if (input->id.product !=
+ USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)
input_event(input, EV_MSC, MSC_RAW, tdata[8]);
}
}
@@ -287,6 +315,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
switch (data[0]) {
case TRACKPAD_REPORT_ID:
+ case TRACKPAD2_BT_REPORT_ID:
/* Expect four bytes of prefix, and N*9 bytes of touch data. */
if (size < 4 || ((size - 4) % 9) != 0)
return 0;
@@ -308,6 +337,22 @@ static int magicmouse_raw_event(struct hid_device *hdev,
* ts = data[1] >> 6 | data[2] << 2 | data[3] << 10;
*/
break;
+ case TRACKPAD2_USB_REPORT_ID:
+ /* Expect twelve bytes of prefix and N*9 bytes of touch data. */
+ if (size < 12 || ((size - 12) % 9) != 0)
+ return 0;
+ npoints = (size - 12) / 9;
+ if (npoints > 15) {
+ hid_warn(hdev, "invalid size value (%d) for TRACKPAD2_USB_REPORT_ID\n",
+ size);
+ return 0;
+ }
+ msc->ntouches = 0;
+ for (ii = 0; ii < npoints; ii++)
+ magicmouse_emit_touch(msc, ii, data + ii * 9 + 12);
+
+ clicks = data[1];
+ break;
case MOUSE_REPORT_ID:
/* Expect six bytes of prefix, and N*8 bytes of touch data. */
if (size < 6 || ((size - 6) % 8) != 0)
@@ -352,6 +397,9 @@ static int magicmouse_raw_event(struct hid_device *hdev,
magicmouse_emit_buttons(msc, clicks & 3);
input_report_rel(input, REL_X, x);
input_report_rel(input, REL_Y, y);
+ } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+ input_mt_sync_frame(input);
+ input_report_key(input, BTN_MOUSE, clicks & 1);
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
input_report_key(input, BTN_MOUSE, clicks & 1);
input_mt_report_pointer_emulation(input, true);
@@ -364,6 +412,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev)
{
int error;
+ int mt_flags = 0;
__set_bit(EV_KEY, input->evbit);
@@ -380,6 +429,22 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
__set_bit(REL_WHEEL, input->relbit);
__set_bit(REL_HWHEEL, input->relbit);
}
+ } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+ /* setting the device name to ensure the same driver settings
+ * get loaded, whether connected through bluetooth or USB
+ */
+ input->name = "Apple Inc. Magic Trackpad 2";
+
+ __clear_bit(EV_MSC, input->evbit);
+ __clear_bit(BTN_0, input->keybit);
+ __clear_bit(BTN_RIGHT, input->keybit);
+ __clear_bit(BTN_MIDDLE, input->keybit);
+ __set_bit(BTN_MOUSE, input->keybit);
+ __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
+ __set_bit(BTN_TOOL_FINGER, input->keybit);
+
+ mt_flags = INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED |
+ INPUT_MT_TRACK;
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
/* input->keybit is initialized with incorrect button info
* for Magic Trackpad. There really is only one physical
@@ -402,14 +467,13 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
__set_bit(EV_ABS, input->evbit);
- error = input_mt_init_slots(input, 16, 0);
+ error = input_mt_init_slots(input, 16, mt_flags);
if (error)
return error;
input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2,
4, 0);
input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2,
4, 0);
- input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
/* Note: Touch Y position from the device is inverted relative
* to how pointer motion is reported (and relative to how USB
@@ -418,6 +482,7 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
* inverse of the reported Y.
*/
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
+ input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
input_set_abs_params(input, ABS_MT_POSITION_X,
MOUSE_MIN_X, MOUSE_MAX_X, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y,
@@ -427,7 +492,25 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
MOUSE_RES_X);
input_abs_set_res(input, ABS_MT_POSITION_Y,
MOUSE_RES_Y);
+ } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+ input_set_abs_params(input, ABS_MT_PRESSURE, 0, 253, 0, 0);
+ input_set_abs_params(input, ABS_PRESSURE, 0, 253, 0, 0);
+ input_set_abs_params(input, ABS_MT_ORIENTATION, -3, 4, 0, 0);
+ input_set_abs_params(input, ABS_X, TRACKPAD2_MIN_X,
+ TRACKPAD2_MAX_X, 0, 0);
+ input_set_abs_params(input, ABS_Y, TRACKPAD2_MIN_Y,
+ TRACKPAD2_MAX_Y, 0, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_X,
+ TRACKPAD2_MIN_X, TRACKPAD2_MAX_X, 0, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
+ TRACKPAD2_MIN_Y, TRACKPAD2_MAX_Y, 0, 0);
+
+ input_abs_set_res(input, ABS_X, TRACKPAD2_RES_X);
+ input_abs_set_res(input, ABS_Y, TRACKPAD2_RES_Y);
+ input_abs_set_res(input, ABS_MT_POSITION_X, TRACKPAD2_RES_X);
+ input_abs_set_res(input, ABS_MT_POSITION_Y, TRACKPAD2_RES_Y);
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
+ input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0);
input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
TRACKPAD_MAX_X, 4, 0);
input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
@@ -447,7 +530,8 @@ static int magicmouse_setup_input(struct input_dev *input, struct hid_device *hd
input_set_events_per_packet(input, 60);
- if (report_undeciphered) {
+ if (report_undeciphered &&
+ input->id.product != USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
__set_bit(EV_MSC, input->evbit);
__set_bit(MSC_RAW, input->mscbit);
}
@@ -471,7 +555,8 @@ static int magicmouse_input_mapping(struct hid_device *hdev,
msc->input = hi->input;
/* Magic Trackpad does not give relative data after switching to MT */
- if (hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD &&
+ if ((hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD ||
+ hi->input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) &&
field->flags & HID_MAIN_ITEM_RELATIVE)
return -1;
@@ -500,11 +585,20 @@ static int magicmouse_input_configured(struct hid_device *hdev,
static int magicmouse_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
- const u8 feature[] = { 0xd7, 0x01 };
+ const u8 *feature;
+ const u8 feature_mt[] = { 0xD7, 0x01 };
+ const u8 feature_mt_trackpad2_usb[] = { 0x02, 0x01 };
+ const u8 feature_mt_trackpad2_bt[] = { 0xF1, 0x02, 0x01 };
u8 *buf;
struct magicmouse_sc *msc;
struct hid_report *report;
int ret;
+ int feature_size;
+
+ if (id->vendor == USB_VENDOR_ID_APPLE &&
+ id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 &&
+ hdev->type != HID_TYPE_USBMOUSE)
+ return 0;
msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL);
if (msc == NULL) {
@@ -538,7 +632,14 @@ static int magicmouse_probe(struct hid_device *hdev,
if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
report = hid_register_report(hdev, HID_INPUT_REPORT,
MOUSE_REPORT_ID);
- else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
+ else if (id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+ if (id->vendor == BT_VENDOR_ID_APPLE)
+ report = hid_register_report(hdev, HID_INPUT_REPORT,
+ TRACKPAD2_BT_REPORT_ID);
+ else /* USB_VENDOR_ID_APPLE */
+ report = hid_register_report(hdev, HID_INPUT_REPORT,
+ TRACKPAD2_USB_REPORT_ID);
+ } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
report = hid_register_report(hdev, HID_INPUT_REPORT,
TRACKPAD_REPORT_ID);
report = hid_register_report(hdev, HID_INPUT_REPORT,
@@ -552,7 +653,20 @@ static int magicmouse_probe(struct hid_device *hdev,
}
report->size = 6;
- buf = kmemdup(feature, sizeof(feature), GFP_KERNEL);
+ if (id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+ if (id->vendor == BT_VENDOR_ID_APPLE) {
+ feature_size = sizeof(feature_mt_trackpad2_bt);
+ feature = feature_mt_trackpad2_bt;
+ } else { /* USB_VENDOR_ID_APPLE */
+ feature_size = sizeof(feature_mt_trackpad2_usb);
+ feature = feature_mt_trackpad2_usb;
+ }
+ } else {
+ feature_size = sizeof(feature_mt);
+ feature = feature_mt;
+ }
+
+ buf = kmemdup(feature, feature_size, GFP_KERNEL);
if (!buf) {
ret = -ENOMEM;
goto err_stop_hw;
@@ -566,10 +680,10 @@ static int magicmouse_probe(struct hid_device *hdev,
* but there seems to be no other way of switching the mode.
* Thus the super-ugly hacky success check below.
*/
- ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(feature),
+ ret = hid_hw_raw_request(hdev, buf[0], buf, feature_size,
HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
kfree(buf);
- if (ret != -EIO && ret != sizeof(feature)) {
+ if (ret != -EIO && ret != feature_size) {
hid_err(hdev, "unable to request touch data (%d)\n", ret);
goto err_stop_hw;
}
@@ -585,6 +699,10 @@ static const struct hid_device_id magic_mice[] = {
USB_DEVICE_ID_APPLE_MAGICMOUSE), .driver_data = 0 },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
USB_DEVICE_ID_APPLE_MAGICTRACKPAD), .driver_data = 0 },
+ { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE,
+ USB_DEVICE_ID_APPLE_MAGICTRACKPAD2), .driver_data = 0 },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE,
+ USB_DEVICE_ID_APPLE_MAGICTRACKPAD2), .driver_data = 0 },
{ }
};
MODULE_DEVICE_TABLE(hid, magic_mice);
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index cb57ccff3..a8264d81e 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1149,6 +1149,15 @@ static int usbhid_start(struct hid_device *hid)
usb_autopm_put_interface(usbhid->intf);
}
+#if IS_ENABLED(CONFIG_USB_SUNXI_HCI)
+ /* Enable remote wakeup by default for all usb mouse devices. */
+ if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT &&
+ interface->desc.bInterfaceProtocol ==
+ USB_INTERFACE_PROTOCOL_MOUSE) {
+ device_set_wakeup_enable(&dev->dev, 1);
+ }
+#endif
+
/* Some keyboards don't work until their LEDs have been set.
* Since BIOSes do set the LEDs, it must be safe for any device
* that supports the keyboard boot protocol.
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index be4b7b1ad..ec06c6f00 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -715,6 +715,24 @@ config I2C_OMAP
Like OMAP1510/1610/1710/5912 and OMAP242x.
For details see http://www.ti.com/omap.
+config I2C_SUNXI
+ tristate "SUNXI I2C controller"
+ depends on ARCH_SUNXI
+ default y if MACH_SUNXI
+ help
+ If you say yes to this option, support will be included for the
+ I2C interface from Allwinner Technology SUNXI platform.
+
+ This driver can also be built as a module. If so, the module
+ will be called i2c-sunxi.
+
+config I2C_SUNXI_TEST
+ tristate "SUNXI I2C controller test by EEPROM"
+ depends on I2C_SUNXI && (FPGA_V4_PLATFORM || FPGA_V7_PLATFORM)
+ default n
+ help
+ It can Only be used in FPGA board.
+
config I2C_PASEMI
tristate "PA Semi SMBus interface"
depends on PPC_PASEMI && PCI
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
old mode 100644
new mode 100755
index 67e44e990..d31dd9090
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1008,6 +1008,101 @@ static void i2c_device_shutdown(struct device *dev)
disable_irq(client->irq);
}
+#ifdef CONFIG_PM_SLEEP
+static int i2c_legacy_suspend(struct device *dev, pm_message_t mesg)
+{
+ struct i2c_client *client = i2c_verify_client(dev);
+ struct i2c_driver *driver;
+
+ if (!client || !dev->driver)
+ return 0;
+ driver = to_i2c_driver(dev->driver);
+ if (!driver->driver.suspend)
+ return 0;
+ return driver->driver.suspend(dev, mesg);
+}
+
+static int i2c_legacy_resume(struct device *dev)
+{
+ struct i2c_client *client = i2c_verify_client(dev);
+ struct i2c_driver *driver;
+
+ if (!client || !dev->driver)
+ return 0;
+ driver = to_i2c_driver(dev->driver);
+ if (!driver->driver.resume)
+ return 0;
+ return driver->driver.resume(dev);
+}
+
+static int i2c_device_pm_suspend(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm)
+ return pm_generic_suspend(dev);
+ else
+ return i2c_legacy_suspend(dev, PMSG_SUSPEND);
+}
+
+static int i2c_device_pm_resume(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm)
+ return pm_generic_resume(dev);
+ else
+ return i2c_legacy_resume(dev);
+}
+
+static int i2c_device_pm_freeze(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm)
+ return pm_generic_freeze(dev);
+ else
+ return i2c_legacy_suspend(dev, PMSG_FREEZE);
+}
+
+static int i2c_device_pm_thaw(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm)
+ return pm_generic_thaw(dev);
+ else
+ return i2c_legacy_resume(dev);
+}
+
+static int i2c_device_pm_poweroff(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm)
+ return pm_generic_poweroff(dev);
+ else
+ return i2c_legacy_suspend(dev, PMSG_HIBERNATE);
+}
+
+static int i2c_device_pm_restore(struct device *dev)
+{
+ const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+
+ if (pm)
+ return pm_generic_restore(dev);
+ else
+ return i2c_legacy_resume(dev);
+}
+#else /* !CONFIG_PM_SLEEP */
+#define i2c_device_pm_suspend NULL
+#define i2c_device_pm_resume NULL
+#define i2c_device_pm_freeze NULL
+#define i2c_device_pm_thaw NULL
+#define i2c_device_pm_poweroff NULL
+#define i2c_device_pm_restore NULL
+#endif /* !CONFIG_PM_SLEEP */
+
static void i2c_client_dev_release(struct device *dev)
{
kfree(to_i2c_client(dev));
@@ -1042,6 +1137,15 @@ static struct attribute *i2c_dev_attrs[] = {
NULL
};
ATTRIBUTE_GROUPS(i2c_dev);
+static const struct dev_pm_ops i2c_device_pm_ops = {
+ .suspend = i2c_device_pm_suspend,
+ .resume = i2c_device_pm_resume,
+ .freeze = i2c_device_pm_freeze,
+ .thaw = i2c_device_pm_thaw,
+ .poweroff = i2c_device_pm_poweroff,
+ .restore = i2c_device_pm_restore,
+};
+
struct bus_type i2c_bus_type = {
.name = "i2c",
@@ -1049,6 +1153,7 @@ struct bus_type i2c_bus_type = {
.probe = i2c_device_probe,
.remove = i2c_device_remove,
.shutdown = i2c_device_shutdown,
+ .pm = &i2c_device_pm_ops,
};
EXPORT_SYMBOL_GPL(i2c_bus_type);
@@ -2714,9 +2819,11 @@ static int i2c_detect_address(struct i2c_client *temp_client,
if (i2c_check_addr_busy(adapter, addr))
return 0;
+#ifndef CONFIG_ARCH_SUNXI
/* Make sure there is something at this address */
if (!i2c_default_probe(adapter, addr))
return 0;
+#endif
/* Finally call the custom detection function */
memset(&info, 0, sizeof(struct i2c_board_info));
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index d609e14bb..88eada1f1 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1059,6 +1059,7 @@ void iommu_set_fault_handler(struct iommu_domain *domain,
}
EXPORT_SYMBOL_GPL(iommu_set_fault_handler);
+
static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus,
unsigned type)
{
@@ -1402,9 +1403,9 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size)
* or we hit an area that isn't mapped.
*/
while (unmapped < size) {
- size_t pgsize = iommu_pgsize(domain, iova, size - unmapped);
+ size_t left = size - unmapped;
- unmapped_page = domain->ops->unmap(domain, iova, pgsize);
+ unmapped_page = domain->ops->unmap(domain, iova, left);
if (!unmapped_page)
break;
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 7d3f23bad..797eb9f8b 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -22,6 +22,13 @@
#include <linux/timer.h>
#include "leds.h"
+
+#ifdef CONFIG_NTX_LED //[
+extern int ntx_register_ledcdev_green(struct led_classdev *led_cdev);
+extern int ntx_register_ledcdev_red(struct led_classdev *led_cdev);
+extern int ntx_register_ledcdev_blue(struct led_classdev *led_cdev);
+#endif //] CONFIG_NTX_LED
+
static struct class *leds_class;
static ssize_t brightness_show(struct device *dev,
@@ -134,7 +141,7 @@ static int led_suspend(struct device *dev)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
- if (led_cdev->flags & LED_CORE_SUSPENDRESUME)
+ if ( (led_cdev->flags & LED_CORE_SUSPENDRESUME) || (led_cdev->flags & LED_BLINK_SW) )
led_classdev_suspend(led_cdev);
return 0;
@@ -144,7 +151,7 @@ static int led_resume(struct device *dev)
{
struct led_classdev *led_cdev = dev_get_drvdata(dev);
- if (led_cdev->flags & LED_CORE_SUSPENDRESUME)
+ if ( (led_cdev->flags & LED_CORE_SUSPENDRESUME) || (led_cdev->flags & LED_BLINK_SW) )
led_classdev_resume(led_cdev);
return 0;
@@ -217,13 +224,48 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
led_cdev->max_brightness = LED_FULL;
led_update_brightness(led_cdev);
-
led_init_core(led_cdev);
#ifdef CONFIG_LEDS_TRIGGERS
led_trigger_set_default(led_cdev);
+ // lichee -> gpio_leds_create()
#endif
+
+#ifdef CONFIG_NTX_LED //[
+ extern void led_red(int isOn);
+ extern int Get_rohm_linked_status(void);
+ //printk("%s():led_cdev->name=%s,name=%s\n",__FUNCTION__,led_cdev->name,name);
+ if(0==strcmp(led_cdev->name,"GLED") || 0==strcmp(led_cdev->name,"on_led")) {
+ printk("%s():led name=%s register as NTX green led\n",
+ __FUNCTION__,led_cdev->name,name);
+ ntx_register_ledcdev_green(led_cdev);
+ }
+ else
+ if(0==strcmp(led_cdev->name,"RLED")|| 0==strcmp(led_cdev->name,"on_charge")) {
+ printk("%s():led name=%s register as NTX red led\n",
+ __FUNCTION__,led_cdev->name,name);
+ ntx_register_ledcdev_red(led_cdev);
+ if(Get_rohm_linked_status()==0)
+ {
+ led_cdev->brightness = LED_OFF ;
+ led_set_brightness_nopm(led_cdev, 0);
+ led_update_brightness(led_cdev);
+ }
+ else{
+ led_cdev->brightness = LED_FULL;
+ led_set_brightness_nopm(led_cdev, led_cdev->brightness);
+ }
+ }
+ else
+ if(0==strcmp(led_cdev->name,"BLED")) {
+ printk("%s():led name=%s register as NTX blue led\n",
+ __FUNCTION__,led_cdev->name,name);
+ ntx_register_ledcdev_blue(led_cdev);
+ }
+#endif //]CONFIG_NTX_LED
+
+
dev_dbg(parent, "Registered led device: %s\n",
led_cdev->name);
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 454ed4dc6..588eea8d5 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -229,6 +229,8 @@ EXPORT_SYMBOL_GPL(led_stop_software_blink);
void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
+
+ //printk("%s() brightness=%d,@%p\n",__func__,brightness,led_cdev);
/*
* If software blink is active, delay brightness setting
* until the next timer tick.
@@ -249,6 +251,7 @@ void led_set_brightness(struct led_classdev *led_cdev,
return;
}
+ //printk("%s() ==> brightness=%d,@%p\n",__func__,brightness,led_cdev);
led_set_brightness_nosleep(led_cdev, brightness);
}
EXPORT_SYMBOL_GPL(led_set_brightness);
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 9b2cd89fd..c46367331 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -185,6 +185,7 @@ struct crypt_config {
unsigned int key_parts; /* independent parts in key buffer */
unsigned int key_extra_size; /* additional keys length */
u8 key[0];
+ bool emmc_sup_crypto;
};
#define MIN_IOS 64
@@ -192,6 +193,10 @@ struct crypt_config {
static void clone_init(struct dm_crypt_io *, struct bio *);
static void kcryptd_queue_crypt(struct dm_crypt_io *io);
static u8 *iv_of_dmreq(struct crypt_config *cc, struct dm_crypt_request *dmreq);
+#ifdef CONFIG_SUNXI_EMCE
+static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io, int async);
+extern int sunxi_emce_set_key(const u8 *mkey, u32 len);
+#endif
/*
* Use this to access cipher attributes that are the same for each CPU.
@@ -1134,13 +1139,20 @@ static void crypt_endio(struct bio *clone)
/*
* free the processed pages
*/
+#ifndef CONFIG_SUNXI_EMCE
if (rw == WRITE)
+#else
+ if ((!(cc->emmc_sup_crypto)) && (rw == WRITE))
+#endif
crypt_free_buffer_pages(cc, clone);
-
error = clone->bi_error;
bio_put(clone);
+#ifndef CONFIG_SUNXI_EMCE
if (rw == READ && !error) {
+#else
+ if ((!(cc->emmc_sup_crypto)) && (rw == READ && !error)) {
+#endif
kcryptd_queue_crypt(io);
return;
}
@@ -1161,7 +1173,11 @@ static void clone_init(struct dm_crypt_io *io, struct bio *clone)
bio_set_op_attrs(clone, bio_op(io->base_bio), bio_flags(io->base_bio));
}
+#ifndef CONFIG_SUNXI_EMCE
static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
+#else
+static int kcryptd_io_only(struct dm_crypt_io *io, gfp_t gfp)
+#endif
{
struct crypt_config *cc = io->cc;
struct bio *clone;
@@ -1184,6 +1200,12 @@ static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
generic_make_request(clone);
return 0;
}
+#ifdef CONFIG_SUNXI_EMCE
+static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
+{
+ return kcryptd_io_only(io, gfp);
+}
+#endif
static void kcryptd_io_read_work(struct work_struct *work)
{
@@ -1205,9 +1227,19 @@ static void kcryptd_queue_read(struct dm_crypt_io *io)
static void kcryptd_io_write(struct dm_crypt_io *io)
{
+#ifdef CONFIG_SUNXI_EMCE
+ if ((io->cc->emmc_sup_crypto)) {
+ crypt_inc_pending(io);
+ if (kcryptd_io_only(io, GFP_NOIO))
+ io->error = -ENOMEM;
+ crypt_dec_pending(io);
+ } else
+#endif
+ {
struct bio *clone = io->ctx.bio_out;
generic_make_request(clone);
+ }
}
#define crypt_io_from_node(node) rb_entry((node), struct dm_crypt_io, rb_node)
@@ -1757,6 +1789,25 @@ static int crypt_ctr_cipher(struct dm_target *ti,
return -ENOMEM;
}
+#ifdef CONFIG_SUNXI_EMCE
+static void kcryptd_io_read_handle(struct dm_crypt_io *io)
+{
+ if (kcryptd_io_read(io, GFP_NOWAIT))
+ kcryptd_queue_read(io);
+}
+static void kcryptd_io_write_handle(struct dm_crypt_io *io)
+{
+ if (io->cc->emmc_sup_crypto)
+ kcryptd_queue_read(io);
+ else
+ kcryptd_queue_crypt(io);
+}
+int sunxi_crypt_need_crypt(struct bio *bio)
+{
+ return bio->bi_end_io == crypt_endio;
+}
+EXPORT_SYMBOL_GPL(sunxi_crypt_need_crypt);
+#endif
/*
* Construct an encryption mapping:
* <cipher> <key> <iv_offset> <dev_path> <start>
@@ -1767,7 +1818,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
unsigned int key_size, opt_params;
unsigned long long tmpll;
int ret;
- size_t iv_size_padding;
+ size_t iv_size_padding = 0;
struct dm_arg_set as;
const char *opt_string;
char dummy;
@@ -1793,12 +1844,55 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
cc->sector_shift = 0;
ti->private = cc;
+ if (strcmp(argv[3], "/dev/block/by-name/UDISK")) {
ret = crypt_ctr_cipher(ti, argv[0], argv[1]);
if (ret < 0)
goto bad;
+ } else {
+#ifndef CONFIG_SUNXI_EMCE
+ ret = crypt_ctr_cipher(ti, argv[0], argv[1]);
+ if (ret < 0)
+ goto bad;
+#endif
+ }
+#ifdef CONFIG_SUNXI_EMCE
+ if (!strcmp(argv[3], "/dev/block/by-name/UDISK")) {
+ cc->emmc_sup_crypto = 1;
+ /*set key for emce*/
+ if (cc->key_size &&
+ crypt_decode_key(cc->key, argv[1], cc->key_size) < 0) {
+ ti->error = "crypt decode key fail";
+ goto bad;
+ }
+ set_bit(DM_CRYPT_KEY_VALID, &cc->flags);
+
+ if (sunxi_emce_set_key(cc->key, cc->key_size)) {
+ ti->error = "sunxi emce set key fail";
+ goto bad;
+ }
+ } else {
+ cc->emmc_sup_crypto = 0;
cc->dmreq_start = sizeof(struct skcipher_request);
cc->dmreq_start += crypto_skcipher_reqsize(any_tfm(cc));
+ cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request));
+
+ if (crypto_skcipher_alignmask(any_tfm(cc)) < CRYPTO_MINALIGN)
+ /* Allocate the padding exactly */
+ iv_size_padding = -(cc->dmreq_start + sizeof(struct dm_crypt_request))
+ & crypto_skcipher_alignmask(any_tfm(cc));
+ else {
+ /*
+ * If the cipher requires greater alignment than kmalloc
+ * alignment, we don't know the exact position of the
+ * initialization vector. We must assume worst case.
+ */
+ iv_size_padding = crypto_skcipher_alignmask(any_tfm(cc));
+ }
+ }
+#else
+ cc->dmreq_start = sizeof(struct ablkcipher_request);
+ cc->dmreq_start += crypto_skcipher_reqsize(any_tfm(cc));
cc->dmreq_start = ALIGN(cc->dmreq_start, __alignof__(struct dm_crypt_request));
if (crypto_skcipher_alignmask(any_tfm(cc)) < CRYPTO_MINALIGN) {
@@ -1813,6 +1907,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
*/
iv_size_padding = crypto_skcipher_alignmask(any_tfm(cc));
}
+#endif
ret = -ENOMEM;
cc->req_pool = mempool_create_kmalloc_pool(MIN_IOS, cc->dmreq_start +
@@ -1923,6 +2018,8 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
goto bad;
}
+#ifdef CONFIG_MMC_EMCE
+ if (!(cc->emmc_sup_crypto)) {
if (test_bit(DM_CRYPT_SAME_CPU, &cc->flags))
cc->crypt_queue = alloc_workqueue("kcryptd",
WQ_HIGHPRI |
@@ -1937,6 +2034,23 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
ti->error = "Couldn't create kcryptd queue";
goto bad;
}
+ }
+#else
+ if (test_bit(DM_CRYPT_SAME_CPU, &cc->flags))
+ cc->crypt_queue = alloc_workqueue("kcryptd",
+ WQ_HIGHPRI |
+ WQ_MEM_RECLAIM, 1);
+ else
+ cc->crypt_queue = alloc_workqueue("kcryptd",
+ WQ_HIGHPRI |
+ WQ_MEM_RECLAIM |
+ WQ_UNBOUND,
+ num_online_cpus());
+ if (!cc->crypt_queue) {
+ ti->error = "Couldn't create kcryptd queue";
+ goto bad;
+ }
+#endif
init_waitqueue_head(&cc->write_thread_wait);
cc->write_tree = RB_ROOT;
@@ -2000,11 +2114,18 @@ static int crypt_map(struct dm_target *ti, struct bio *bio)
crypt_io_init(io, cc, bio, dm_target_offset(ti, bio->bi_iter.bi_sector));
io->ctx.req = (struct skcipher_request *)(io + 1);
+#ifdef CONFIG_SUNXI_EMCE
+ if (bio_data_dir(io->base_bio) == READ)
+ kcryptd_io_read_handle(io);
+ else
+ kcryptd_io_write_handle(io);
+#else
if (bio_data_dir(io->base_bio) == READ) {
if (kcryptd_io_read(io, GFP_NOWAIT))
kcryptd_queue_read(io);
} else
kcryptd_queue_crypt(io);
+#endif
return DM_MAPIO_SUBMITTED;
}
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 032017bd0..b23a56cb0 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -150,6 +150,10 @@ config MDIO_XGENE
comment "MII PHY device drivers"
+config SUNXI_EPHY
+ tristate "Drivers for Allwinnertech EPHY"
+ depends on MFD_ACX00
+
config AMD_PHY
tristate "AMD PHYs"
---help---
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index e9576658f..1a6e8d06a 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -648,6 +648,12 @@ config SPI_TEGRA20_SLINK
help
SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface.
+config SPI_SUNXI
+ tristate "SUNXI SPI Controller"
+ depends on ARCH_SUNXI && OF
+ help
+ Allwinner Soc SPI controller, present on SUNXI chips.
+
config SPI_THUNDERX
tristate "Cavium ThunderX SPI controller"
depends on PCI && 64BIT && (ARM64 || COMPILE_TEST)
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig
index 8f548691d..cf61a5074 100644
--- a/drivers/staging/android/Kconfig
+++ b/drivers/staging/android/Kconfig
@@ -32,15 +32,15 @@ config ANDROID_LOW_MEMORY_KILLER_AUTODETECT_OOM_ADJ_VALUES
Detect oom_adj values written to
/sys/module/lowmemorykiller/parameters/adj and convert them
to oom_score_adj values.
-
-config ANDROID_VSOC
- tristate "Android Virtual SoC support"
+config ANDROID_INTF_ALARM_DEV
+ bool "Android alarm driver"
+ depends on RTC_CLASS
default n
- depends on PCI_MSI
---help---
- This option adds support for the Virtual SoC driver needed to boot
- a 'cuttlefish' Android image inside QEmu. The driver interacts with
- a QEmu ivshmem device. If built as a module, it will be called vsoc.
+ Provides non-wakeup and rtc backed wakeup alarms based on rtc or
+ elapsed realtime, and a non-wakeup alarm on the monotonic clock.
+ Also exports the alarm interface to user-space.
+
source "drivers/staging/android/ion/Kconfig"
diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index 3482d43c1..b4dc09c35 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -4,4 +4,4 @@ obj-y += ion/
obj-$(CONFIG_ASHMEM) += ashmem.o
obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o
-obj-$(CONFIG_ANDROID_VSOC) += vsoc.o
+obj-$(CONFIG_ANDROID_INTF_ALARM_DEV) += alarm-dev.o
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index c58eae8db..fc676dba5 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -800,12 +800,10 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
break;
case ASHMEM_SET_SIZE:
ret = -EINVAL;
- mutex_lock(&ashmem_mutex);
if (!asma->file) {
ret = 0;
asma->size = (size_t)arg;
}
- mutex_unlock(&ashmem_mutex);
break;
case ASHMEM_GET_SIZE:
ret = asma->size;
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 7ea229cb1..303c3f188 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1664,6 +1664,32 @@ config SERIAL_MVEBU_CONSOLE
and warnings and which allows logins in single user mode)
Otherwise, say 'N'.
+config SERIAL_SUNXI
+ tristate "SUNXI UART Controller"
+ depends on SERIAL_8250=n
+ depends on OF
+ select SERIAL_CORE
+ default y
+ help
+ If you have an Allwinner SOC based board and want to use the
+ built-in UART of the SoC, say Y to this option.
+
+config SERIAL_SUNXI_CONSOLE
+ bool "Console on SUNXI UART port"
+ depends on SERIAL_SUNXI=y
+ select SERIAL_CORE_CONSOLE
+ default SERIAL_SUNXI
+ help
+ Enable a built-in UART port of the Allinner SOC to be the system console.
+
+config SERIAL_SUNXI_EARLYCON
+ bool "Enable sunxi earlycon."
+ depends on SERIAL_SUNXI=y
+ depends on SERIAL_SUNXI_CONSOLE=y
+ select SERIAL_EARLYCON
+ default n
+ help
+ Enable earlycon with boot step. If enable earlycon, kernel cmd (earlycon=uart0,addr) must be add.
endmenu
config SERIAL_MCTRL_GPIO
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
old mode 100644
new mode 100755
index bff5a15e5..4ad7521ae
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -158,6 +158,8 @@ source "drivers/usb/phy/Kconfig"
source "drivers/usb/gadget/Kconfig"
+source "drivers/usb/sunxi_usb/Kconfig"
+
config USB_LED_TRIG
bool "USB LED Triggers"
depends on LEDS_CLASS && USB_COMMON && LEDS_TRIGGERS
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
old mode 100644
new mode 100755
index fc55f7e31..51b8caf36
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -829,18 +829,21 @@ void usb_destroy_configuration(struct usb_device *dev)
return;
if (dev->rawdescriptors) {
- for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
+ for (i = 0; i < dev->descriptor.bNumConfigurations &&
+ i < USB_MAXCONFIG; i++)
kfree(dev->rawdescriptors[i]);
kfree(dev->rawdescriptors);
dev->rawdescriptors = NULL;
}
- for (c = 0; c < dev->descriptor.bNumConfigurations; c++) {
+ for (c = 0; c < dev->descriptor.bNumConfigurations &&
+ c < USB_MAXCONFIG; c++) {
struct usb_host_config *cf = &dev->config[c];
kfree(cf->string);
- for (i = 0; i < cf->desc.bNumInterfaces; i++) {
+ for (i = 0; i < cf->desc.bNumInterfaces &&
+ i < USB_MAXINTERFACES; i++) {
if (cf->intf_cache[i])
kref_put(&cf->intf_cache[i]->ref,
usb_release_interface_cache);
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
old mode 100644
new mode 100755
index 52c4176af..4f474b96f
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -610,11 +610,17 @@ static int ehci_run (struct usb_hcd *hcd)
*/
hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);
if (HCC_64BIT_ADDR(hcc_params)) {
- ehci_writel(ehci, 0, &ehci->regs->segment);
-#if 0
-// this is deeply broken on almost all architectures
+#ifdef CONFIG_ARM64
+ ehci_writel(ehci, ehci->periodic_dma >> 32,
+ &ehci->regs->segment);
+ /*
+ * this is deeply broken on almost all architectures
+ * but arm64 can use it so enable it
+ */
if (!dma_set_mask(hcd->self.controller, DMA_BIT_MASK(64)))
ehci_info(ehci, "enabled 64bit DMA\n");
+#else
+ ehci_writel(ehci, 0, &ehci->regs->segment);
#endif
}
@@ -790,6 +796,16 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
if (status & STS_PCD) {
unsigned i = HCS_N_PORTS (ehci->hcs_params);
u32 ppcd = ~0;
+{
+ int pstatus0 = 0;
+
+ pstatus0 = ehci_readl(ehci, &ehci->regs->port_status[0]);
+
+ if ((pstatus0 & PORT_CONNECT) && (pstatus0 & PORT_CSC))
+ ehci_info(ehci, "ehci_irq: highspeed device connect\n");
+ else if (!(pstatus0 & PORT_CONNECT) && (pstatus0 & PORT_CSC))
+ ehci_info(ehci, "ehci_irq: highspeed device disconnect\n");
+}
/* kick root hub later */
pcd_status = status;
@@ -1321,6 +1337,11 @@ MODULE_LICENSE ("GPL");
#define PLATFORM_DRIVER ehci_mv_driver
#endif
+#if IS_ENABLED(CONFIG_USB_SUNXI_HCI)
+#include "ehci_sunxi.c"
+#define PLATFORM_DRIVER sunxi_ehci_hcd_driver
+#endif
+
static int __init ehci_hcd_init(void)
{
int retval = 0;
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
old mode 100644
new mode 100755
index c1c7df26d..6ba69c946
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1268,6 +1268,11 @@ MODULE_LICENSE ("GPL");
#define PLATFORM_DRIVER ohci_hcd_tilegx_driver
#endif
+#if IS_ENABLED(CONFIG_USB_SUNXI_HCI)
+#include "ohci_sunxi.c"
+#define PLATFORM_DRIVER sunxi_ohci_hcd_driver
+#endif
+
static int __init ohci_hcd_mod_init(void)
{
int retval = 0;
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 20ee61201..c2272e5cd 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -27,14 +27,11 @@
#include <linux/parser.h>
#include <linux/magic.h>
#include <linux/slab.h>
-#include <linux/srcu.h>
#include "internal.h"
#define DEBUGFS_DEFAULT_MODE 0700
-DEFINE_SRCU(debugfs_srcu);
-
static struct vfsmount *debugfs_mount;
static int debugfs_mount_count;
static bool debugfs_registered;
@@ -190,6 +187,11 @@ static const struct super_operations debugfs_super_operations = {
.destroy_inode = debugfs_destroy_inode,
};
+static void debugfs_release_dentry(struct dentry *dentry)
+{
+ kfree(dentry->d_fsdata);
+}
+
static struct vfsmount *debugfs_automount(struct path *path)
{
debugfs_automount_t f;
@@ -199,6 +201,7 @@ static struct vfsmount *debugfs_automount(struct path *path)
static const struct dentry_operations debugfs_dops = {
.d_delete = always_delete_dentry,
+ .d_release = debugfs_release_dentry,
.d_automount = debugfs_automount,
};
@@ -312,24 +315,35 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode,
{
struct dentry *dentry;
struct inode *inode;
+ struct debugfs_fsdata *fsd;
+
+ fsd = kmalloc(sizeof(*fsd), GFP_KERNEL);
+ if (!fsd)
+ return NULL;
if (!(mode & S_IFMT))
mode |= S_IFREG;
BUG_ON(!S_ISREG(mode));
dentry = start_creating(name, parent);
- if (IS_ERR(dentry))
+ if (IS_ERR(dentry)) {
+ kfree(fsd);
return NULL;
+ }
inode = debugfs_get_inode(dentry->d_sb);
- if (unlikely(!inode))
+ if (unlikely(!inode)) {
+ kfree(fsd);
return failed_creating(dentry);
+ }
inode->i_mode = mode;
inode->i_private = data;
inode->i_fop = proxy_fops;
- dentry->d_fsdata = (void *)real_fops;
+ fsd->real_fops = real_fops;
+ refcount_set(&fsd->active_users, 1);
+ dentry->d_fsdata = fsd;
d_instantiate(dentry, inode);
fsnotify_create(d_inode(dentry->d_parent), dentry);
@@ -586,18 +600,34 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
}
EXPORT_SYMBOL_GPL(debugfs_create_symlink);
+static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent)
+{
+ struct debugfs_fsdata *fsd;
+
+ simple_unlink(d_inode(parent), dentry);
+ d_delete(dentry);
+ fsd = dentry->d_fsdata;
+ init_completion(&fsd->active_users_drained);
+ if (!refcount_dec_and_test(&fsd->active_users))
+ wait_for_completion(&fsd->active_users_drained);
+}
+
static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
{
int ret = 0;
if (simple_positive(dentry)) {
dget(dentry);
+ if (!d_is_reg(dentry)) {
if (d_is_dir(dentry))
ret = simple_rmdir(d_inode(parent), dentry);
else
simple_unlink(d_inode(parent), dentry);
if (!ret)
d_delete(dentry);
+ } else {
+ __debugfs_remove_file(dentry, parent);
+ }
dput(dentry);
}
return ret;
@@ -631,8 +661,6 @@ void debugfs_remove(struct dentry *dentry)
inode_unlock(d_inode(parent));
if (!ret)
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
-
- synchronize_srcu(&debugfs_srcu);
}
EXPORT_SYMBOL_GPL(debugfs_remove);
@@ -706,8 +734,6 @@ void debugfs_remove_recursive(struct dentry *dentry)
if (!__debugfs_remove(child, parent))
simple_release_fs(&debugfs_mount, &debugfs_mount_count);
inode_unlock(d_inode(parent));
-
- synchronize_srcu(&debugfs_srcu);
}
EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
diff --git a/fs/file_table.c b/fs/file_table.c
index 747bb386b..3b680ed27 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -31,6 +31,10 @@
#include "internal.h"
+extern void cpu_hotplug_disable(void);
+extern void cpu_hotplug_enable(void);
+
+
/* sysctl tunables... */
struct files_stat_struct files_stat = {
.max_files = NR_FILE
@@ -242,6 +246,7 @@ static void delayed_fput(struct work_struct *unused)
static void ____fput(struct callback_head *work)
{
__fput(container_of(work, struct file, f_u.fu_rcuhead));
+ cpu_hotplug_enable();
}
/*
@@ -267,6 +272,7 @@ void fput_many(struct file *file, unsigned int refs)
struct task_struct *task = current;
if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) {
+ cpu_hotplug_disable();
init_task_work(&file->f_u.fu_rcuhead, ____fput);
if (!task_work_add(task, &file->f_u.fu_rcuhead, true))
return;
diff --git a/fs/namei.c b/fs/namei.c
index 1ef89898c..1b862d6d6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -39,6 +39,8 @@
#include <linux/init_task.h>
#include <asm/uaccess.h>
+#include <linux/fivm.h>
+
#include "internal.h"
#include "mount.h"
@@ -3465,6 +3467,11 @@ static int do_last(struct nameidata *nd,
error = open_check_o_direct(file);
if (!error)
error = ima_file_check(file, op->acc_mode, *opened);
+#ifdef CONFIG_FILE_INTEGRITY
+ error = fivm_open_verify(file, nd->name->name, op->acc_mode);
+ if (error)
+ goto out;
+#endif
if (!error && will_truncate)
error = handle_truncate(file);
out:
diff --git a/fs/namespace.c b/fs/namespace.c
index 8f4ce6c56..fbb482b4f 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -67,6 +67,10 @@ static struct hlist_head *mountpoint_hashtable __read_mostly;
static struct kmem_cache *mnt_cache __read_mostly;
static DECLARE_RWSEM(namespace_sem);
+extern void cpu_hotplug_disable(void);
+extern void cpu_hotplug_enable(void);
+
+
/* /sys/fs */
struct kobject *fs_kobj;
EXPORT_SYMBOL_GPL(fs_kobj);
@@ -227,7 +231,6 @@ static struct mount *alloc_vfsmnt(const char *name)
mnt->mnt_count = 1;
mnt->mnt_writers = 0;
#endif
- mnt->mnt.data = NULL;
INIT_HLIST_NODE(&mnt->mnt_hash);
INIT_LIST_HEAD(&mnt->mnt_child);
@@ -986,6 +989,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
if (!mnt)
return ERR_PTR(-ENOMEM);
+ mnt->mnt.data = NULL;
if (type->alloc_mnt_data) {
mnt->mnt.data = type->alloc_mnt_data();
if (!mnt->mnt.data) {
@@ -999,6 +1003,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
root = mount_fs(type, flags, name, &mnt->mnt, data);
if (IS_ERR(root)) {
+ kfree(mnt->mnt.data);
mnt_free_id(mnt);
free_vfsmnt(mnt);
return ERR_CAST(root);
@@ -1118,6 +1123,7 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
return mnt;
out_free:
+ kfree(mnt->mnt.data);
mnt_free_id(mnt);
free_vfsmnt(mnt);
return ERR_PTR(err);
@@ -1148,6 +1154,7 @@ static void cleanup_mnt(struct mount *mnt)
static void __cleanup_mnt(struct rcu_head *head)
{
cleanup_mnt(container_of(head, struct mount, mnt_rcu));
+ cpu_hotplug_enable();
}
static LLIST_HEAD(delayed_mntput_list);
@@ -1213,6 +1220,7 @@ static void mntput_no_expire(struct mount *mnt)
if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
struct task_struct *task = current;
if (likely(!(task->flags & PF_KTHREAD))) {
+ cpu_hotplug_disable();
init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
if (!task_work_add(task, &mnt->mnt_rcu, true))
return;
diff --git a/fs/sdcardfs/main.c b/fs/sdcardfs/main.c
index d890c5711..0995628f0 100644
--- a/fs/sdcardfs/main.c
+++ b/fs/sdcardfs/main.c
@@ -27,6 +27,7 @@ enum {
Opt_fsuid,
Opt_fsgid,
Opt_gid,
+ Opt_derive_gid,
Opt_debug,
Opt_mask,
Opt_multiuser,
@@ -43,6 +44,7 @@ static const match_table_t sdcardfs_tokens = {
{Opt_fsuid, "fsuid=%u"},
{Opt_fsgid, "fsgid=%u"},
{Opt_gid, "gid=%u"},
+ {Opt_derive_gid, "derive_gid"},
{Opt_debug, "debug"},
{Opt_mask, "mask=%u"},
{Opt_userid, "userid=%d"},
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 1c5b8e306..d40d39cee 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -781,14 +781,7 @@
*/
#define PERCPU_INPUT(cacheline) \
VMLINUX_SYMBOL(__per_cpu_start) = .; \
- VMLINUX_SYMBOL(__per_cpu_user_mapped_start) = .; \
*(.data..percpu..first) \
- . = ALIGN(cacheline); \
- *(.data..percpu..user_mapped) \
- *(.data..percpu..user_mapped..shared_aligned) \
- . = ALIGN(PAGE_SIZE); \
- *(.data..percpu..user_mapped..page_aligned) \
- VMLINUX_SYMBOL(__per_cpu_user_mapped_end) = .; \
. = ALIGN(PAGE_SIZE); \
*(.data..percpu..page_aligned) \
. = ALIGN(cacheline); \
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 92957e08c..0569cdcf9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1059,6 +1059,8 @@ extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fu
extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
+extern int sunxi_blk_rq_map_sg(struct request_queue *, struct request *,
+ struct scatterlist *);
extern void blk_dump_rq_flags(struct request *, char *);
extern long nr_blockdev_pages(void);
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 7139ecb59..131ba40f2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -85,6 +85,10 @@ struct notifier_block;
#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
* lock is dropped */
+#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running.
+ * Called on the new cpu, just before
+ * enabling interrupts. Must not sleep,
+ * must not fail */
#define CPU_BROKEN 0x000B /* CPU (unsigned)v did not die properly,
* perhaps due to preemption. */
@@ -99,6 +103,8 @@ struct notifier_block;
#define CPU_DOWN_PREPARE_FROZEN (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
+#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN)
+#define CPU_STARTING_FROZEN (CPU_STARTING | CPU_TASKS_FROZEN)
#ifdef CONFIG_SMP
extern bool cpuhp_tasks_frozen;
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 81339e184..deace9838 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -201,6 +201,11 @@ struct cipher_desc {
void *info;
};
+struct hash_desc {
+ struct crypto_hash *tfm;
+ u32 flags;
+};
+
/**
* DOC: Block Cipher Algorithm Definitions
*
@@ -565,6 +570,18 @@ struct cipher_tfm {
void (*cit_decrypt_one)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
};
+struct hash_tfm {
+ int (*init)(struct hash_desc *desc);
+ int (*update)(struct hash_desc *desc,
+ struct scatterlist *sg, unsigned int nsg);
+ int (*final)(struct hash_desc *desc, u8 *out);
+ int (*digest)(struct hash_desc *desc, struct scatterlist *sg,
+ unsigned int nsg, u8 *out);
+ int (*setkey)(struct crypto_hash *tfm, const u8 *key,
+ unsigned int keylen);
+ unsigned int digestsize;
+};
+
struct compress_tfm {
int (*cot_compress)(struct crypto_tfm *tfm,
const u8 *src, unsigned int slen,
@@ -577,6 +594,7 @@ struct compress_tfm {
#define crt_ablkcipher crt_u.ablkcipher
#define crt_blkcipher crt_u.blkcipher
#define crt_cipher crt_u.cipher
+#define crt_hash crt_u.hash
#define crt_compress crt_u.compress
struct crypto_tfm {
@@ -587,6 +605,7 @@ struct crypto_tfm {
struct ablkcipher_tfm ablkcipher;
struct blkcipher_tfm blkcipher;
struct cipher_tfm cipher;
+ struct hash_tfm hash;
struct compress_tfm compress;
} crt_u;
@@ -613,6 +632,10 @@ struct crypto_comp {
struct crypto_tfm base;
};
+struct crypto_hash {
+ struct crypto_tfm base;
+};
+
enum {
CRYPTOA_UNSPEC,
CRYPTOA_ALG,
@@ -1587,6 +1610,83 @@ static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
dst, src);
}
+/**
+ * DOC: Synchronous Message Digest API
+ *
+ * The synchronous message digest API is used with the ciphers of type
+ * CRYPTO_ALG_TYPE_HASH (listed as type "hash" in /proc/crypto)
+ */
+
+static inline struct crypto_hash *__crypto_hash_cast(struct crypto_tfm *tfm)
+{
+ return (struct crypto_hash *)tfm;
+}
+
+/**
+ * crypto_alloc_hash() - allocate synchronous message digest handle
+ * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
+ * message digest cipher
+ * @type: specifies the type of the cipher
+ * @mask: specifies the mask for the cipher
+ *
+ * Allocate a cipher handle for a message digest. The returned struct
+ * crypto_hash is the cipher handle that is required for any subsequent
+ * API invocation for that message digest.
+ *
+ * Return: allocated cipher handle in case of success; IS_ERR() is true in case
+ * of an error, PTR_ERR() returns the error code.
+ */
+static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
+ u32 type, u32 mask)
+{
+ type &= ~CRYPTO_ALG_TYPE_MASK;
+ mask &= ~CRYPTO_ALG_TYPE_MASK;
+ type |= CRYPTO_ALG_TYPE_HASH;
+ mask |= CRYPTO_ALG_TYPE_HASH_MASK;
+
+ return __crypto_hash_cast(crypto_alloc_base(alg_name, type, mask));
+}
+
+static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm)
+{
+ return &tfm->base;
+}
+
+/**
+ * crypto_free_hash() - zeroize and free message digest handle
+ * @tfm: cipher handle to be freed
+ */
+static inline void crypto_free_hash(struct crypto_hash *tfm)
+{
+ crypto_free_tfm(crypto_hash_tfm(tfm));
+}
+
+static inline struct hash_tfm *crypto_hash_crt(struct crypto_hash *tfm)
+{
+ return &crypto_hash_tfm(tfm)->crt_hash;
+}
+
+/**
+ * crypto_hash_digest() - calculate message digest for a buffer
+ * @desc: see crypto_hash_final()
+ * @sg: see crypto_hash_update()
+ * @nbytes: see crypto_hash_update()
+ * @out: see crypto_hash_final()
+ *
+ * This function is a "short-hand" for the function calls of crypto_hash_init,
+ * crypto_hash_update and crypto_hash_final. The parameters have the same
+ * meaning as discussed for those separate three functions.
+ *
+ * Return: 0 if the message digest creation was successful; < 0 if an error
+ * occurred
+ */
+static inline int crypto_hash_digest(struct hash_desc *desc,
+ struct scatterlist *sg,
+ unsigned int nbytes, u8 *out)
+{
+ return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out);
+}
+
static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm)
{
return (struct crypto_comp *)tfm;
@@ -1654,5 +1754,21 @@ static inline int crypto_comp_decompress(struct crypto_comp *tfm,
src, slen, dst, dlen);
}
+static inline int crypto_hash_init(struct hash_desc *desc)
+{
+ return crypto_hash_crt(desc->tfm)->init(desc);
+}
+
+static inline int crypto_hash_update(struct hash_desc *desc,
+ struct scatterlist *sg,
+ unsigned int nbytes)
+{
+ return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes);
+}
+
+static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
+{
+ return crypto_hash_crt(desc->tfm)->final(desc, out);
+}
#endif /* _LINUX_CRYPTO_H */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 7aea75053..23409f945 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -9,7 +9,7 @@
* 2 as published by the Free Software Foundation.
*
* debugfs is for people to use instead of /proc or /sys.
- * See Documentation/DocBook/filesystems for more details.
+ * See Documentation/filesystems/ for more details.
*/
#ifndef _DEBUGFS_H_
@@ -23,7 +23,6 @@
struct device;
struct file_operations;
-struct srcu_struct;
struct debugfs_blob_wrapper {
void *data;
@@ -43,25 +42,6 @@ struct debugfs_regset32 {
extern struct dentry *arch_debugfs_dir;
-extern struct srcu_struct debugfs_srcu;
-
-/**
- * debugfs_real_fops - getter for the real file operation
- * @filp: a pointer to a struct file
- *
- * Must only be called under the protection established by
- * debugfs_use_file_start().
- */
-static inline const struct file_operations *debugfs_real_fops(struct file *filp)
- __must_hold(&debugfs_srcu)
-{
- /*
- * Neither the pointer to the struct file_operations, nor its
- * contents ever change -- srcu_dereference() is not needed here.
- */
- return filp->f_path.dentry->d_fsdata;
-}
-
#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \
static int __fops ## _open(struct inode *inode, struct file *file) \
{ \
@@ -74,7 +54,7 @@ static const struct file_operations __fops = { \
.release = simple_attr_release, \
.read = debugfs_attr_read, \
.write = debugfs_attr_write, \
- .llseek = generic_file_llseek, \
+ .llseek = no_llseek, \
}
typedef struct vfsmount *(*debugfs_automount_t)(struct dentry *, void *);
@@ -106,10 +86,11 @@ struct dentry *debugfs_create_automount(const char *name,
void debugfs_remove(struct dentry *dentry);
void debugfs_remove_recursive(struct dentry *dentry);
-int debugfs_use_file_start(const struct dentry *dentry, int *srcu_idx)
- __acquires(&debugfs_srcu);
+const struct file_operations *debugfs_real_fops(const struct file *filp)
+ __must_hold(&debugfs_srcu);
-void debugfs_use_file_finish(int srcu_idx) __releases(&debugfs_srcu);
+int debugfs_file_get(struct dentry *dentry);
+void debugfs_file_put(struct dentry *dentry);
ssize_t debugfs_attr_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos);
@@ -189,6 +170,14 @@ static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
return ERR_PTR(-ENODEV);
}
+static inline struct dentry *debugfs_create_file_unsafe(const char *name,
+ umode_t mode, struct dentry *parent,
+ void *data,
+ const struct file_operations *fops)
+{
+ return ERR_PTR(-ENODEV);
+}
+
static inline struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops,
@@ -224,15 +213,12 @@ static inline void debugfs_remove(struct dentry *dentry)
static inline void debugfs_remove_recursive(struct dentry *dentry)
{ }
-static inline int debugfs_use_file_start(const struct dentry *dentry,
- int *srcu_idx)
- __acquires(&debugfs_srcu)
+static inline int debugfs_file_get(struct dentry *dentry)
{
return 0;
}
-static inline void debugfs_use_file_finish(int srcu_idx)
- __releases(&debugfs_srcu)
+static inline void debugfs_file_put(struct dentry *dentry)
{ }
static inline ssize_t debugfs_attr_read(struct file *file, char __user *buf,
@@ -282,6 +268,14 @@ static inline struct dentry *debugfs_create_u64(const char *name, umode_t mode,
return ERR_PTR(-ENODEV);
}
+static inline struct dentry *debugfs_create_ulong(const char *name,
+ umode_t mode,
+ struct dentry *parent,
+ unsigned long *value)
+{
+ return ERR_PTR(-ENODEV);
+}
+
static inline struct dentry *debugfs_create_x8(const char *name, umode_t mode,
struct dentry *parent,
u8 *value)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 97f817f4e..a580ad7ed 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -606,6 +606,8 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
u64 size, const struct iommu_ops *iommu,
bool coherent) { }
#endif
+extern bool do_iommu_attach(struct device *dev, const struct iommu_ops *ops,
+ u64 dma_base, u64 size);
#ifndef arch_teardown_dma_ops
static inline void arch_teardown_dma_ops(struct device *dev) { }
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 7c88d865f..9f6a664db 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -17,6 +17,7 @@
#include <linux/bug.h>
#include <linux/atomic.h>
+#include <linux/refcount.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1808b7895..76e3010a9 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -215,6 +215,7 @@ struct mmc_pwrseq;
struct mmc_supply {
struct regulator *vmmc; /* Card power supply */
struct regulator *vqmmc; /* Optional Vccq supply */
+ struct regulator *vdmmc; /* Optional card detect pin supply */
};
struct mmc_host {
@@ -290,6 +291,7 @@ struct mmc_host {
#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
+#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
@@ -313,6 +315,11 @@ struct mmc_host {
#define MMC_CAP2_HS400_ES (1 << 20) /* Host supports enhanced strobe */
#define MMC_CAP2_NO_SD (1 << 21) /* Do not send SD commands during initialization */
#define MMC_CAP2_NO_MMC (1 << 22) /* Do not send (e)MMC commands during initialization */
+#define MMC_CAP2_3_3V_ONLY_DDR (1 << 23) /* Only supports 3.3V DDR */
+
+#define MMC_SUNXI_CAP3_DAT3_DET (1 << 0)
+ u32 sunxi_caps3;
+
mmc_pm_flag_t pm_caps; /* supported pm features */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index a78cb6bf5..f41206724 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -124,9 +124,8 @@ enum zone_stat_item {
NR_SLAB_UNRECLAIMABLE,
NR_PAGETABLE, /* used for pagetables */
NR_KERNEL_STACK_KB, /* measured in KiB */
- NR_KAISERTABLE,
- NR_BOUNCE,
/* Second 128 byte cacheline */
+ NR_BOUNCE,
#if IS_ENABLED(CONFIG_ZSMALLOC)
NR_ZSPAGES, /* allocated in zsmalloc */
#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7563261be..217fec32d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -961,6 +961,19 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where,
return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
}
+#ifdef CONFIG_ARCH_SUN50IW6
+struct pci_page {
+ unsigned long offset;
+ void __iomem *mem_base;
+};
+
+struct pci_page sunxi_pcie_bus_cutpage_config(struct pci_dev *dev, int barnum, u32 bar_base, unsigned long offset);
+struct pci_page sunxi_pcie_device_cutpage_config(u32 bar_base, unsigned long offset);
+int sunxi_pcie_cutpage_base(u32 bar_base);
+unsigned long sunxi_pcie_cutpage_spin_lock(void);
+void sunxi_pcie_cutpage_spin_unlock(unsigned long flags);
+#endif
+
int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val);
int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val);
int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val);
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index bab9236e4..fc1b2fbb0 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -262,6 +262,19 @@ void devm_regulator_unregister_notifier(struct regulator *regulator,
void *regulator_get_drvdata(struct regulator *regulator);
void regulator_set_drvdata(struct regulator *regulator, void *data);
+#if defined(CONFIG_AW_AXP)
+extern int axp_get_ldo_name(const char *supply_name, char *ldo_name);
+extern int axp_get_enable_id_count(const char *ldo_name);
+extern int axp_get_enable_id(const char *ldo_name, u32 count, char *enable_id);
+extern int axp_check_enable_id(const char *ldo_name, const char *enalbe_id);
+extern int axp_check_ldo_alwayson(const char *ldo_name);
+extern int axp_set_ldo_alwayson(const char *ldo_name, u32 value);
+extern int axp_regulator_dump(void);
+extern unsigned int axp_regulator_debug;
+extern int axp_mem_save(void);
+extern void axp_mem_restore(void);
+#endif
+
#else
/*
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
old mode 100644
new mode 100755
index 3c3786df0..3e2653618
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -341,6 +341,10 @@ struct regulator_desc {
unsigned int active_discharge_off;
unsigned int active_discharge_mask;
unsigned int active_discharge_reg;
+ unsigned int ramp_reg;
+ unsigned int ramp_mask;
+ const unsigned int *ramp_delay_table;
+ unsigned int n_ramp_values;
unsigned int enable_time;
@@ -372,7 +376,7 @@ struct regulator_desc {
*/
struct regulator_config {
struct device *dev;
- const struct regulator_init_data *init_data;
+ struct regulator_init_data *init_data;
void *driver_data;
struct device_node *of_node;
struct regmap *regmap;
@@ -406,6 +410,10 @@ struct regulator_dev {
/* lists we own */
struct list_head consumer_list; /* consumers we supply */
+#if defined(CONFIG_AW_AXP)
+ struct list_head axp_enable_list; /* supply we enable */
+#endif
+
struct blocking_notifier_head notifier;
struct mutex mutex; /* consumer lock */
struct module *owner;
@@ -478,5 +486,6 @@ int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable);
int regulator_set_active_discharge_regmap(struct regulator_dev *rdev,
bool enable);
void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
+int regulator_set_ramp_delay_regmap(struct regulator_dev *rdev, int ramp_delay);
#endif
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
old mode 100644
new mode 100755
index 652d1b70f..e4c263e90
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -404,6 +404,7 @@ struct usb_composite_driver {
extern int usb_composite_probe(struct usb_composite_driver *driver);
extern void usb_composite_unregister(struct usb_composite_driver *driver);
+extern int usb_composite_unregister_ex(struct usb_composite_driver *driver);
/**
* module_usb_composite_driver() - Helper macro for registering a USB gadget
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 4b810bc7a..4e23abf98 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -111,6 +111,10 @@ struct usb_request {
void *context;
struct list_head list;
+#if IS_ENABLED(CONFIG_USB_SUNXI_UDC0)
+ int dma_flag;
+#endif
+
int status;
unsigned actual;
};
@@ -496,7 +500,11 @@ static inline int gadget_avoids_skb_reserve(struct usb_gadget *g)
*/
static inline int gadget_is_dualspeed(struct usb_gadget *g)
{
+#if IS_ENABLED(CONFIG_USB_SUNXI_UDC0)
+ return 1;
+#else
return g->max_speed >= USB_SPEED_HIGH;
+#endif
}
/**
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index b95c51113..ba53c96ab 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -422,6 +422,8 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
WQ_MEM_RECLAIM, 1, (name))
#define create_singlethread_workqueue(name) \
alloc_ordered_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM, name)
+#define create_highpri_singlethread_workqueue(name) \
+ alloc_ordered_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_HIGHPRI, name)
extern void destroy_workqueue(struct workqueue_struct *wq);
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index fd7cacbfc..1b24569c7 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -806,6 +806,12 @@
#define MSC_TIMESTAMP 0x05
#define MSC_MAX 0x07
#define MSC_CNT (MSC_MAX+1)
+#define MSC_RAW_GSENSOR_PORTRAIT_DOWN 0x17
+#define MSC_RAW_GSENSOR_PORTRAIT_UP 0x18
+#define MSC_RAW_GSENSOR_LANDSCAPE_RIGHT 0x19
+#define MSC_RAW_GSENSOR_LANDSCAPE_LEFT 0x1a
+#define MSC_RAW_GSENSOR_BACK 0x1b
+#define MSC_RAW_GSENSOR_FRONT 0x1c
/*
* LEDs
diff --git a/kernel/fork.c b/kernel/fork.c
index 36e95dc80..12701c85f 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -60,7 +60,6 @@
#include <linux/tsacct_kern.h>
#include <linux/cn_proc.h>
#include <linux/freezer.h>
-#include <linux/kaiser.h>
#include <linux/delayacct.h>
#include <linux/taskstats_kern.h>
#include <linux/random.h>
@@ -220,7 +219,6 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node)
static inline void free_thread_stack(struct task_struct *tsk)
{
- kaiser_unmap_thread_stack(tsk->stack);
#ifdef CONFIG_VMAP_STACK
if (task_stack_vm_area(tsk)) {
unsigned long flags;
@@ -505,10 +503,6 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
* functions again.
*/
tsk->stack = stack;
-
- err= kaiser_map_thread_stack(tsk->stack);
- if (err)
- goto free_stack;
#ifdef CONFIG_VMAP_STACK
tsk->stack_vm_area = stack_vm_area;
#endif
diff --git a/kernel/futex.c b/kernel/futex.c
index b3823736a..b42c4eb85 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2027,9 +2027,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
struct futex_q *this, *next;
WAKE_Q(wake_q);
- if (nr_wake < 0 || nr_requeue < 0)
- return -EINVAL;
-
if (requeue_pi) {
/*
* Requeue PI only works on two distinct uaddrs. This
@@ -2277,6 +2274,9 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
drop_count++;
}
+ if (nr_wake < 0 || nr_requeue < 0)
+ return -EINVAL;
+
/*
* We took an extra initial reference to the pi_state either
* in futex_proxy_trylock_atomic() or in lookup_pi_state(). We
diff --git a/kernel/panic.c b/kernel/panic.c
index 500967672..410520a52 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -25,6 +25,10 @@
#include <linux/init.h>
#include <linux/nmi.h>
#include <linux/console.h>
+#include <linux/cpu.h>
+#include <linux/cpumask.h>
+#include <linux/arisc/arisc.h>
+#include <asm/cacheflush.h>
#include <linux/bug.h>
#define PANIC_TIMER_STEP 100
@@ -290,6 +294,26 @@ void panic(const char *fmt, ...)
}
#endif
pr_emerg("---[ end Kernel panic - not syncing: %s\n", buf);
+
+#if defined(CONFIG_SUNXI_DUMP)
+ flush_cache_all();
+ {
+ unsigned int i;
+
+ for (i = 0; i < num_possible_cpus(); i++) {
+ if (i == smp_processor_id())
+ continue;
+
+ while (1) {
+ if (!cpu_online(i))
+ break;
+ mdelay(10);
+ }
+ }
+ pr_emerg("crashdump enter\n");
+ arisc_set_crashdump_mode();
+ }
+#endif
local_irq_enable();
for (i = 0; ; i += PANIC_TIMER_STEP) {
touch_softlockup_watchdog();
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e3bf1aa05..c73afcaa7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -108,6 +108,7 @@ extern int pid_max;
extern int extra_free_kbytes;
extern int pid_max_min, pid_max_max;
extern int percpu_pagelist_fraction;
+extern int compat_log;
extern int latencytop_enabled;
extern unsigned int sysctl_nr_open_min, sysctl_nr_open_max;
#ifndef CONFIG_MMU
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index d06c1d8dd..d75da999f 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -206,6 +206,18 @@ ktime_t alarm_expires_remaining(const struct alarm *alarm)
EXPORT_SYMBOL_GPL(alarm_expires_remaining);
#ifdef CONFIG_RTC_CLASS
+static int boot_mode; //0:normal boot; 1:charger mode; 2:recovery mode
+static int __init boot_mode_setup(char *str)
+{
+ if (!str)
+ return -EINVAL;
+
+ // androidboot.mode=charger
+ if (!strncmp(str, "charger", strlen("charger")))
+ boot_mode = 1;
+ return 1;
+}
+__setup("androidboot.mode=", boot_mode_setup);
/**
* alarmtimer_suspend - Suspend time callback
* @dev: unused
@@ -280,6 +292,58 @@ static int alarmtimer_resume(struct device *dev)
rtc_timer_cancel(rtc, &rtctimer);
return 0;
}
+static void alarmtimer_shutdown(struct platform_device *dev)
+{
+ struct rtc_time tm;
+ ktime_t min, now;
+ unsigned long flags;
+ struct rtc_device *rtc;
+ int ret;
+ struct alarm_base *base = &alarm_bases[ALARM_REALTIME_SHUTDOWN];
+ // struct alarm_base *base = &alarm_bases[ALARM_BOOTTIME];
+ struct timerqueue_node *next;
+ ktime_t delta;
+
+ spin_lock_irqsave(&freezer_delta_lock, flags);
+ min = freezer_delta;
+ freezer_delta = ktime_set(0, 0);
+ spin_unlock_irqrestore(&freezer_delta_lock, flags);
+
+ rtc = alarmtimer_get_rtcdev();
+ /* If we have no rtcdev, just return */
+ if (!rtc)
+ return;
+
+ /* Find the soonest timer to expire*/
+ spin_lock_irqsave(&base->lock, flags);
+ next = timerqueue_getnext(&base->timerqueue);
+ spin_unlock_irqrestore(&base->lock, flags);
+ if (!next) {
+ printk("[alarmtimer] have no shutdown alarm! %s %d\n", __FUNCTION__, __LINE__);
+ return;
+ }
+ delta = ktime_sub(next->expires, base->gettime());
+ if (!min.tv64 || (delta.tv64 < min.tv64))
+ min = delta;
+
+ /*if the current time is less 50 seconds than the alarm time, the alarm should turn off*/
+ if (ktime_to_ms(min) < 50 * MSEC_PER_SEC) {
+ printk("[alarmtimer] shutdown alarm interval is too short, less than 50s! %s %d\n", __FUNCTION__, __LINE__);
+ return;
+ }
+ /* Setup an rtc timer to fire that far in the future */
+ rtc_timer_cancel(rtc, &rtctimer);
+ rtc_read_time(rtc, &tm);
+ now = rtc_tm_to_ktime(tm);
+ /* make the alarm trigger ahead of the alarm time, because the power on spend about 50s */
+ min = ktime_sub(min, ktime_set(50, 0));
+ printk("[alarmtimer] add shutdown alarm interval=%lldms, %s %d\n", ktime_to_ms(min), __FUNCTION__, __LINE__);
+ now = ktime_add(now, min);
+
+ /* Set alarm, if in the past reject suspend briefly to handle */
+ ret = rtc_timer_start(rtc, &rtctimer, now, ktime_set(0, 0));
+ return;
+}
#else
static int alarmtimer_suspend(struct device *dev)
@@ -830,7 +894,10 @@ static struct platform_driver alarmtimer_driver = {
.driver = {
.name = "alarmtimer",
.pm = &alarmtimer_pm_ops,
- }
+ },
+#ifdef CONFIG_RTC_CLASS
+ .shutdown = alarmtimer_shutdown,
+#endif
};
/**
@@ -864,6 +931,8 @@ static int __init alarmtimer_init(void)
alarm_bases[ALARM_REALTIME].gettime = &ktime_get_real;
alarm_bases[ALARM_BOOTTIME].base_clockid = CLOCK_BOOTTIME;
alarm_bases[ALARM_BOOTTIME].gettime = &ktime_get_boottime;
+ alarm_bases[ALARM_REALTIME_SHUTDOWN].base_clockid = CLOCK_REALTIME;
+ alarm_bases[ALARM_REALTIME_SHUTDOWN].gettime = &ktime_get_real;
for (i = 0; i < ALARM_NUMTYPE; i++) {
timerqueue_init_head(&alarm_bases[i].timerqueue);
spin_lock_init(&alarm_bases[i].lock);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 77ab85ab6..3d6ee754a 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -34,6 +34,7 @@
#define TK_MIRROR (1 << 1)
#define TK_CLOCK_WAS_SET (1 << 2)
+static ktime_t gtKtime_last_resume_time;
/*
* The most important data for readout fits into a single 64 byte
* cache line.
@@ -748,6 +749,11 @@ void getnstimeofday64(struct timespec64 *ts)
}
EXPORT_SYMBOL(getnstimeofday64);
+ktime_t ktime_get_last_resume_time(void)
+{
+ return gtKtime_last_resume_time;
+}
+
ktime_t ktime_get(void)
{
struct timekeeper *tk = &tk_core.timekeeper;
@@ -1567,6 +1573,7 @@ void __init timekeeping_init(void)
write_seqcount_end(&tk_core.seq);
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
+ gtKtime_last_resume_time = ktime_get();
}
/* time in seconds when suspend began for persistent clock */
@@ -1743,6 +1750,9 @@ void timekeeping_resume(void)
tick_resume();
hrtimers_resume();
+
+ gtKtime_last_resume_time = ktime_get();
+ //printk("%s():last resume ktime=%llu\n",__func__,gtKtime_last_resume_time.tv64);
}
int timekeeping_suspend(void)
@@ -1798,6 +1808,7 @@ int timekeeping_suspend(void)
clocksource_suspend();
clockevents_suspend();
+
return 0;
}
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 4699ae990..a96265343 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -258,14 +258,13 @@ config PAGE_OWNER
config DEBUG_FS
bool "Debug Filesystem"
- select SRCU
help
debugfs is a virtual file system that kernel developers use to put
debugging files into. Enable this option to be able to read and
write to these files.
For detailed documentation on the debugfs API, see
- Documentation/DocBook/filesystems.
+ Documentation/filesystems/.
If unsure, say N.
diff --git a/mm/cma.c b/mm/cma.c
index 7cb569a18..3a8fff2f5 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -36,6 +36,7 @@
#include <linux/highmem.h>
#include <linux/io.h>
#include <trace/events/cma.h>
+#include <linux/dma-contiguous.h>
#include "cma.h"
@@ -476,3 +477,57 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count)
return true;
}
+
+#define MAPS_AREA_RANGE ((1U<<20)*20)
+#define MAPS_UNIT_BLOCK 0X100 /* 1MB /4KB =256 */
+#define MAPS_AREA_BLOCK (MAPS_AREA_RANGE>>PAGE_SHIFT)
+
+int dma_contiguous_area_maps(struct seq_file *s)
+{
+ unsigned int i;
+ unsigned int active_bit = 0;
+ unsigned int free_bit = 0;
+ unsigned long base_offset = 0;
+ unsigned long end_offset = 0;
+
+ struct cma *cma = dev_get_cma_area(NULL);
+
+ if (!cma || !cma->count)
+ return (-EINVAL);
+
+ base_offset = cma->base_pfn << PAGE_SHIFT;
+ end_offset = (cma->base_pfn + cma->count) << PAGE_SHIFT;
+ seq_printf(s, "\n 0x%lx: ", base_offset);
+ for (i = 0; i < cma->count; i++) {
+ if (((i + 1) % MAPS_UNIT_BLOCK) == 0) {
+ if ((i + 1) % MAPS_AREA_BLOCK == 0) {
+ if (active_bit)
+ seq_printf(s, " %2x\n", active_bit - 1);
+ else
+ seq_printf(s, " %s\n", "00");
+ seq_printf(s, " 0x%lx: ",
+ base_offset + (i + 1) /
+ MAPS_AREA_BLOCK * MAPS_AREA_RANGE);
+ } else {
+ if (active_bit)
+ seq_printf(s, " %2x", active_bit - 1);
+ else
+ seq_printf(s, " %s", "00");
+ }
+ active_bit = 0;
+ }
+ if (test_bit(i, cma->bitmap))
+ active_bit++;
+ else
+ free_bit++;
+ }
+ seq_printf(s, "\n Cma area start:0x%lx end:0x%lx\n", base_offset,
+ end_offset);
+ seq_printf(s, " Cma area Total:%uMB Free:%uKB ~= %uMB\n",
+ (unsigned int)(cma->count << PAGE_SHIFT) >> 20,
+ (free_bit << PAGE_SHIFT) / 1024,
+ (free_bit << PAGE_SHIFT) >> 20);
+ return 0;
+}
+EXPORT_SYMBOL(dma_contiguous_area_maps);
+
diff --git a/mm/slab.h b/mm/slab.h
index 34929ac0e..3752676ef 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -395,9 +395,15 @@ static inline struct kmem_cache *slab_pre_alloc_hook(struct kmem_cache *s,
if (should_failslab(s, flags))
return NULL;
+#ifdef CONFIG_MEMCG
+ if (!memcg_kmem_enabled() &&
+ ((flags & __GFP_ACCOUNT) || (s->flags & SLAB_ACCOUNT)))
+ return memcg_kmem_get_cache(s);
+#else
if (memcg_kmem_enabled() &&
((flags & __GFP_ACCOUNT) || (s->flags & SLAB_ACCOUNT)))
return memcg_kmem_get_cache(s);
+#endif
return s;
}
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 30e11a311..9d220cfdf 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -932,7 +932,6 @@ const char * const vmstat_text[] = {
"nr_slab_unreclaimable",
"nr_page_table_pages",
"nr_kernel_stack",
- "nr_overhead",
"nr_bounce",
#if IS_ENABLED(CONFIG_ZSMALLOC)
"nr_zspages",
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 48854eae2..3849f2332 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -265,7 +265,7 @@ struct net *get_net_ns_by_id(struct net *net, int id)
spin_lock_irqsave(&net->nsid_lock, flags);
peer = idr_find(&net->netns_ids, id);
if (peer)
- peer = maybe_get_net(peer);
+ get_net(peer);
spin_unlock_irqrestore(&net->nsid_lock, flags);
rcu_read_unlock();
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 5cb5a2957..1fc3e06e1 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -261,10 +261,6 @@ unsigned int arpt_do_table(struct sk_buff *skb,
}
if (table_base + v
!= arpt_next_entry(e)) {
- if (unlikely(stackidx >= private->stacksize)) {
- verdict = NF_DROP;
- break;
- }
jumpstack[stackidx++] = e;
}
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 3096468a1..e4c9954a1 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -345,13 +345,8 @@ ipt_do_table(struct sk_buff *skb,
continue;
}
if (table_base + v != ipt_next_entry(e) &&
- !(e->ip.flags & IPT_F_GOTO)) {
- if (unlikely(stackidx >= private->stacksize)) {
- verdict = NF_DROP;
- break;
- }
+ !(e->ip.flags & IPT_F_GOTO))
jumpstack[stackidx++] = e;
- }
e = get_entry(table_base, v);
continue;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index c4b2ba15c..ff580e0e1 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1823,13 +1823,13 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
cork.base.flags = 0;
cork.base.addr = 0;
cork.base.opt = NULL;
- cork.base.dst = NULL;
v6_cork.opt = NULL;
err = ip6_setup_cork(sk, &cork, &v6_cork, ipc6, rt, fl6);
if (err) {
ip6_cork_release(&cork, &v6_cork);
return ERR_PTR(err);
}
+
if (ipc6->dontfrag < 0)
ipc6->dontfrag = inet6_sk(sk)->dontfrag;
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 4a76411fe..8c0a444a6 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -377,10 +377,6 @@ ip6t_do_table(struct sk_buff *skb,
}
if (table_base + v != ip6t_next_entry(e) &&
!(e->ipv6.flags & IP6T_F_GOTO)) {
- if (unlikely(stackidx >= private->stacksize)) {
- verdict = NF_DROP;
- break;
- }
jumpstack[stackidx++] = e;
}
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 47b1631bf..ee86e8a73 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -264,8 +264,10 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb,
struct sock *sk = skb->sk;
int ret = -ENOMEM;
- if (!net_eq(dev_net(dev), sock_net(sk)))
+ if (!net_eq(dev_net(dev), sock_net(sk)) &&
+ !net_eq(dev_net(dev), &init_net)) {
return 0;
+ }
dev_hold(dev);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 7b8214446..464e9115b 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1808,34 +1808,32 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr
static int xfrm_dump_policy_done(struct netlink_callback *cb)
{
- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
+ struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
struct net *net = sock_net(cb->skb->sk);
xfrm_policy_walk_done(walk, net);
return 0;
}
-static int xfrm_dump_policy_start(struct netlink_callback *cb)
-{
- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
-
- BUILD_BUG_ON(sizeof(*walk) > sizeof(cb->args));
-
- xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
- return 0;
-}
-
static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)
{
struct net *net = sock_net(skb->sk);
- struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args;
+ struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
struct xfrm_dump_info info;
+ BUILD_BUG_ON(sizeof(struct xfrm_policy_walk) >
+ sizeof(cb->args) - sizeof(cb->args[0]));
+
info.in_skb = cb->skb;
info.out_skb = skb;
info.nlmsg_seq = cb->nlh->nlmsg_seq;
info.nlmsg_flags = NLM_F_MULTI;
+ if (!cb->args[0]) {
+ cb->args[0] = 1;
+ xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
+ }
+
(void) xfrm_policy_walk(net, walk, dump_one_policy, &info);
return skb->len;
@@ -2591,7 +2589,6 @@ static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = {
static const struct xfrm_link {
int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **);
- int (*start)(struct netlink_callback *);
int (*dump)(struct sk_buff *, struct netlink_callback *);
int (*done)(struct netlink_callback *);
const struct nla_policy *nla_pol;
@@ -2605,7 +2602,6 @@ static const struct xfrm_link {
[XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy },
[XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy },
[XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy,
- .start = xfrm_dump_policy_start,
.dump = xfrm_dump_policy,
.done = xfrm_dump_policy_done },
[XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi },
@@ -2667,7 +2663,6 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) &&
(nlh->nlmsg_flags & NLM_F_DUMP)) {
struct netlink_dump_control c = {
- .start = link->start,
.dump = link->dump,
.done = link->done,
};
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ce03fe2ff..1a24f83b1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6223,10 +6223,10 @@ sub process {
exit(0);
}
- if (!$is_patch && $file !~ /cover-letter\.patch$/) {
- ERROR("NOT_UNIFIED_DIFF",
- "Does not appear to be a unified-diff format patch\n");
- }
+ #if (!$is_patch && $file !~ /cover-letter\.patch$/) {
+ # ERROR("NOT_UNIFIED_DIFF",
+ # "Does not appear to be a unified-diff format patch\n");
+ #}
if ($is_patch && $has_commit_log && $chk_signoff && $signoff == 0) {
ERROR("MISSING_SIGN_OFF",
"Missing Signed-off-by: line(s)\n");
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index cb7374700..b474d08c7 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -77,6 +77,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version '`\"
+ echo \#define LINUX_VERSION_NTX \"`git rev-parse --verify HEAD`\"
) > .tmpcompile
# Only replace the real compile.h if the new one is different,
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c
index 1f3d60021..ae70e828d 100644
--- a/security/keys/encrypted-keys/encrypted.c
+++ b/security/keys/encrypted-keys/encrypted.c
@@ -141,22 +141,23 @@ static int valid_ecryptfs_desc(const char *ecryptfs_desc)
*/
static int valid_master_desc(const char *new_desc, const char *orig_desc)
{
- int prefix_len;
-
- if (!strncmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN))
- prefix_len = KEY_TRUSTED_PREFIX_LEN;
- else if (!strncmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN))
- prefix_len = KEY_USER_PREFIX_LEN;
- else
- return -EINVAL;
-
- if (!new_desc[prefix_len])
- return -EINVAL;
-
- if (orig_desc && strncmp(new_desc, orig_desc, prefix_len))
- return -EINVAL;
-
+ if (!memcmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN)) {
+ if (strlen(new_desc) == KEY_TRUSTED_PREFIX_LEN)
+ goto out;
+ if (orig_desc)
+ if (memcmp(new_desc, orig_desc, KEY_TRUSTED_PREFIX_LEN))
+ goto out;
+ } else if (!memcmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN)) {
+ if (strlen(new_desc) == KEY_USER_PREFIX_LEN)
+ goto out;
+ if (orig_desc)
+ if (memcmp(new_desc, orig_desc, KEY_USER_PREFIX_LEN))
+ goto out;
+ } else
+ goto out;
return 0;
+out:
+ return -EINVAL;
}
/*
diff --git a/security/security.c b/security/security.c
index d12d14552..fe5a973d0 100644
--- a/security/security.c
+++ b/security/security.c
@@ -21,6 +21,7 @@
#include <linux/integrity.h>
#include <linux/ima.h>
#include <linux/evm.h>
+#include <linux/fivm.h>
#include <linux/fsnotify.h>
#include <linux/mman.h>
#include <linux/mount.h>
@@ -836,6 +837,9 @@ int security_mmap_file(struct file *file, unsigned long prot,
int ret;
ret = call_int_hook(mmap_file, 0, file, prot,
mmap_prot(file, prot), flags);
+ if (ret)
+ return ret;
+ ret = fivm_mmap_verify(file, prot);
if (ret)
return ret;
return ima_file_mmap(file, prot);
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 6913ea27e..6af52b8f2 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2303,9 +2303,6 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
static void snd_usb_mixer_free(struct usb_mixer_interface *mixer)
{
- /* kill pending URBs */
- snd_usb_mixer_disconnect(mixer);
-
kfree(mixer->id_elems);
if (mixer->urb) {
kfree(mixer->urb->transfer_buffer);
@@ -2667,13 +2664,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)
{
- if (mixer->disconnected)
- return;
- if (mixer->urb)
usb_kill_urb(mixer->urb);
- if (mixer->rc_urb)
usb_kill_urb(mixer->rc_urb);
- mixer->disconnected = true;
}
#ifdef CONFIG_PM
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 7d16a9221..7c5a13963 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -22,8 +22,6 @@ struct usb_mixer_interface {
struct urb *rc_urb;
struct usb_ctrlrequest *rc_setup_packet;
u8 rc_buffer[6];
-
- bool disconnected;
};
#define MAX_CHANNELS 16 /* max logical channels */
|