aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
blob: 44ba6765697d891b219d2fc50d28a0933e269982 (plain)
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
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Allwinner SUN8I Thermal Controller Device Tree Bindings

maintainers:
  - Vasily Khoruzhick <anarsoul@gmail.com>
  - Yangtao Li <tiny.windzz@gmail.com>

properties:
  compatible:
    enum:
      - allwinner,sun8i-a83t-ths
      - allwinner,sun8i-h3-ths
      - allwinner,sun8i-r40-ths
      - allwinner,sun50i-a64-ths
      - allwinner,sun50i-h5-ths
      - allwinner,sun50i-h6-ths

  clocks:
    minItems: 1
    maxItems: 2
    items:
      - description: Bus Clock
      - description: Module Clock

  clock-names:
    minItems: 1
    maxItems: 2
    items:
      - const: bus
      - const: mod

  reg:
    maxItems: 1

  interrupts:
    maxItems: 1

  resets:
    maxItems: 1

  nvmem-cells:
    maxItems: 1
    description: Calibration data for thermal sensors

  nvmem-cell-names:
    const: calibration

  # See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for details
  "#thermal-sensor-cells":
    enum:
      - 0
      - 1

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: allwinner,sun50i-h6-ths

    then:
      properties:
        clocks:
          maxItems: 1

        clock-names:
          maxItems: 1

    else:
      properties:
        clocks:
          minItems: 2

        clock-names:
          minItems: 2

  - if:
      properties:
        compatible:
          contains:
            const: allwinner,sun8i-h3-ths

    then:
      properties:
        "#thermal-sensor-cells":
          const: 0

    else:
      properties:
        "#thermal-sensor-cells":
          const: 1

  - if:
      properties:
        compatible:
          contains:
            enum:
              - const: allwinner,sun8i-h3-ths
              - const: allwinner,sun8i-r40-ths
              - const: allwinner,sun50i-a64-ths
              - const: allwinner,sun50i-h5-ths
              - const: allwinner,sun50i-h6-ths

    then:
      required:
        - clocks
        - clock-names
        - resets

required:
  - compatible
  - reg
  - interrupts
  - '#thermal-sensor-cells'

additionalProperties: false

examples:
  - |
    thermal-sensor@1f04000 {
         compatible = "allwinner,sun8i-a83t-ths";
         reg = <0x01f04000 0x100>;
         interrupts = <0 31 0>;
         nvmem-cells = <&ths_calibration>;
         nvmem-cell-names = "calibration";
         #thermal-sensor-cells = <1>;
    };

  - |
    thermal-sensor@1c25000 {
         compatible = "allwinner,sun8i-h3-ths";
         reg = <0x01c25000 0x400>;
         clocks = <&ccu 0>, <&ccu 1>;
         clock-names = "bus", "mod";
         resets = <&ccu 2>;
         interrupts = <0 31 0>;
         nvmem-cells = <&ths_calibration>;
         nvmem-cell-names = "calibration";
         #thermal-sensor-cells = <0>;
    };

  - |
    thermal-sensor@5070400 {
         compatible = "allwinner,sun50i-h6-ths";
         reg = <0x05070400 0x100>;
         clocks = <&ccu 0>;
         clock-names = "bus";
         resets = <&ccu 2>;
         interrupts = <0 15 0>;
         nvmem-cells = <&ths_calibration>;
         nvmem-cell-names = "calibration";
         #thermal-sensor-cells = <1>;
    };

...
ruct ctl_table ipc_table; size_t lenp_bef = *lenp; int rc; memcpy(&ipc_table, table, sizeof(ipc_table)); ipc_table.data = get_ipc(table); rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); if (write && !rc && lenp_bef == *lenp) /* * Tunable has successfully been changed by hand. Disable its * automatic adjustment. This simply requires unregistering * the notifiers that trigger recalculation. */ unregister_ipcns_notifier(current->nsproxy->ipc_ns); return rc; } static int proc_ipc_doulongvec_minmax(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table ipc_table; memcpy(&ipc_table, table, sizeof(ipc_table)); ipc_table.data = get_ipc(table); return proc_doulongvec_minmax(&ipc_table, write, buffer, lenp, ppos); } /* * Routine that is called when the file "auto_msgmni" has successfully been * written. * Two values are allowed: * 0: unregister msgmni's callback routine from the ipc namespace notifier * chain. This means that msgmni won't be recomputed anymore upon memory * add/remove or ipc namespace creation/removal. * 1: register back the callback routine. */ static void ipc_auto_callback(int val) { if (!val) unregister_ipcns_notifier(current->nsproxy->ipc_ns); else { /* * Re-enable automatic recomputing only if not already * enabled. */ recompute_msgmni(current->nsproxy->ipc_ns); cond_register_ipcns_notifier(current->nsproxy->ipc_ns); } } static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { struct ctl_table ipc_table; int oldval; int rc; memcpy(&ipc_table, table, sizeof(ipc_table)); ipc_table.data = get_ipc(table); oldval = *((int *)(ipc_table.data)); rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos); if (write && !rc) { int newval = *((int *)(ipc_table.data)); /* * The file "auto_msgmni" has correctly been set. * React by (un)registering the corresponding tunable, if the * value has changed. */ if (newval != oldval) ipc_auto_callback(newval); } return rc; } #else #define proc_ipc_doulongvec_minmax NULL #define proc_ipc_dointvec NULL #define proc_ipc_dointvec_minmax NULL #define proc_ipc_dointvec_minmax_orphans NULL #define proc_ipc_callback_dointvec_minmax NULL #define proc_ipcauto_dointvec_minmax NULL #endif static int zero; static int one = 1; static int int_max = INT_MAX; static struct ctl_table ipc_kern_table[] = { { .procname = "shmmax", .data = &init_ipc_ns.shm_ctlmax, .maxlen = sizeof(init_ipc_ns.shm_ctlmax), .mode = 0644, .proc_handler = proc_ipc_doulongvec_minmax, }, { .procname = "shmall", .data = &init_ipc_ns.shm_ctlall, .maxlen = sizeof(init_ipc_ns.shm_ctlall), .mode = 0644, .proc_handler = proc_ipc_doulongvec_minmax, }, { .procname = "shmmni", .data = &init_ipc_ns.shm_ctlmni, .maxlen = sizeof(init_ipc_ns.shm_ctlmni), .mode = 0644, .proc_handler = proc_ipc_dointvec, }, { .procname = "shm_rmid_forced", .data = &init_ipc_ns.shm_rmid_forced, .maxlen = sizeof(init_ipc_ns.shm_rmid_forced), .mode = 0644, .proc_handler = proc_ipc_dointvec_minmax_orphans, .extra1 = &zero, .extra2 = &one, }, { .procname = "msgmax", .data = &init_ipc_ns.msg_ctlmax, .maxlen = sizeof(init_ipc_ns.msg_ctlmax), .mode = 0644, .proc_handler = proc_ipc_dointvec_minmax, .extra1 = &zero, .extra2 = &int_max, }, { .procname = "msgmni", .data = &init_ipc_ns.msg_ctlmni, .maxlen = sizeof(init_ipc_ns.msg_ctlmni), .mode = 0644, .proc_handler = proc_ipc_callback_dointvec_minmax, .extra1 = &zero, .extra2 = &int_max, }, { .procname = "msgmnb", .data = &init_ipc_ns.msg_ctlmnb, .maxlen = sizeof(init_ipc_ns.msg_ctlmnb), .mode = 0644, .proc_handler = proc_ipc_dointvec_minmax, .extra1 = &zero, .extra2 = &int_max, }, { .procname = "sem", .data = &init_ipc_ns.sem_ctls, .maxlen = 4*sizeof(int), .mode = 0644, .proc_handler = proc_ipc_dointvec, }, { .procname = "auto_msgmni", .data = &init_ipc_ns.auto_msgmni, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_ipcauto_dointvec_minmax, .extra1 = &zero, .extra2 = &one, }, #ifdef CONFIG_CHECKPOINT_RESTORE { .procname = "sem_next_id", .data = &init_ipc_ns.ids[IPC_SEM_IDS].next_id, .maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id), .mode = 0644, .proc_handler = proc_ipc_dointvec_minmax, .extra1 = &zero, .extra2 = &int_max, }, { .procname = "msg_next_id", .data = &init_ipc_ns.ids[IPC_MSG_IDS].next_id, .maxlen = sizeof(init_ipc_ns.ids[IPC_MSG_IDS].next_id), .mode = 0644, .proc_handler = proc_ipc_dointvec_minmax, .extra1 = &zero, .extra2 = &int_max, }, { .procname = "shm_next_id", .data = &init_ipc_ns.ids[IPC_SHM_IDS].next_id, .maxlen = sizeof(init_ipc_ns.ids[IPC_SHM_IDS].next_id), .mode = 0644, .proc_handler = proc_ipc_dointvec_minmax, .extra1 = &zero, .extra2 = &int_max, }, #endif {} }; static struct ctl_table ipc_root_table[] = { { .procname = "kernel", .mode = 0555, .child = ipc_kern_table, }, {} }; static int __init ipc_sysctl_init(void) { register_sysctl_table(ipc_root_table); return 0; } __initcall(ipc_sysctl_init);