| 1 | |
| 2 | |
| 3 | * Surface System Aggregator Module (SSAM) client device registry.
|
| 4 | *
|
| 5 | * Registry for non-platform/non-ACPI SSAM client devices, i.e. devices that
|
| 6 | * cannot be auto-detected. Provides device-hubs and performs instantiation
|
| 7 | * for these devices.
|
| 8 | *
|
| 9 | * Copyright (C) 2020-2022 Maximilian Luz <[email protected]>
|
| 10 |
|
| 11 |
|
| 12 | #include <linux/acpi.h>
|
| 13 | #include <linux/kernel.h>
|
| 14 | #include <linux/module.h>
|
| 15 | #include <linux/of.h>
|
| 16 | #include <linux/platform_device.h>
|
| 17 | #include <linux/property.h>
|
| 18 | #include <linux/types.h>
|
| 19 |
|
| 20 | #include <linux/surface_aggregator/device.h>
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 | |
| 26 | * SSAM device names follow the SSAM module alias, meaning they are prefixed
|
| 27 | * with 'ssam:', followed by domain, category, target ID, instance ID, and
|
| 28 | * function, each encoded as two-digit hexadecimal, separated by ':'. In other
|
| 29 | * words, it follows the scheme
|
| 30 | *
|
| 31 | * ssam:dd:cc:tt:ii:ff
|
| 32 | *
|
| 33 | * Where, 'dd', 'cc', 'tt', 'ii', and 'ff' are the two-digit hexadecimal
|
| 34 | * values mentioned above, respectively.
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 | static const struct software_node ssam_node_root = {
|
| 39 | .name = "ssam_platform_hub",
|
| 40 | };
|
| 41 |
|
| 42 |
|
| 43 | static const struct software_node ssam_node_hub_kip = {
|
| 44 | .name = "ssam:00:00:01:0e:00",
|
| 45 | .parent = &ssam_node_root,
|
| 46 | };
|
| 47 |
|
| 48 |
|
| 49 | static const struct software_node ssam_node_hub_base = {
|
| 50 | .name = "ssam:00:00:01:11:00",
|
| 51 | .parent = &ssam_node_root,
|
| 52 | };
|
| 53 |
|
| 54 |
|
| 55 | static const struct software_node ssam_node_bat_ac = {
|
| 56 | .name = "ssam:01:02:01:01:01",
|
| 57 | .parent = &ssam_node_root,
|
| 58 | };
|
| 59 |
|
| 60 |
|
| 61 | static const struct software_node ssam_node_bat_main = {
|
| 62 | .name = "ssam:01:02:01:01:00",
|
| 63 | .parent = &ssam_node_root,
|
| 64 | };
|
| 65 |
|
| 66 |
|
| 67 | static const struct software_node ssam_node_bat_sb3base = {
|
| 68 | .name = "ssam:01:02:02:01:00",
|
| 69 | .parent = &ssam_node_hub_base,
|
| 70 | };
|
| 71 |
|
| 72 |
|
| 73 | static const struct software_node ssam_node_tmp_perf_profile = {
|
| 74 | .name = "ssam:01:03:01:00:01",
|
| 75 | .parent = &ssam_node_root,
|
| 76 | };
|
| 77 |
|
| 78 | |
| 79 | * the fan controller profile can also be switched.
|
| 80 |
|
| 81 | static const struct property_entry ssam_node_tmp_perf_profile_has_fan[] = {
|
| 82 | PROPERTY_ENTRY_BOOL("has_fan"),
|
| 83 | { }
|
| 84 | };
|
| 85 |
|
| 86 | static const struct software_node ssam_node_tmp_perf_profile_with_fan = {
|
| 87 | .name = "ssam:01:03:01:00:01",
|
| 88 | .parent = &ssam_node_root,
|
| 89 | .properties = ssam_node_tmp_perf_profile_has_fan,
|
| 90 | };
|
| 91 |
|
| 92 |
|
| 93 | static const struct software_node ssam_node_tmp_sensors = {
|
| 94 | .name = "ssam:01:03:01:00:02",
|
| 95 | .parent = &ssam_node_root,
|
| 96 | };
|
| 97 |
|
| 98 |
|
| 99 | static const struct software_node ssam_node_fan_speed = {
|
| 100 | .name = "ssam:01:05:01:01:01",
|
| 101 | .parent = &ssam_node_root,
|
| 102 | };
|
| 103 |
|
| 104 |
|
| 105 | static const struct software_node ssam_node_kip_tablet_switch = {
|
| 106 | .name = "ssam:01:0e:01:00:01",
|
| 107 | .parent = &ssam_node_root,
|
| 108 | };
|
| 109 |
|
| 110 |
|
| 111 | static const struct software_node ssam_node_bas_dtx = {
|
| 112 | .name = "ssam:01:11:01:00:00",
|
| 113 | .parent = &ssam_node_root,
|
| 114 | };
|
| 115 |
|
| 116 |
|
| 117 | static const struct software_node ssam_node_hid_sam_keyboard = {
|
| 118 | .name = "ssam:01:15:01:01:00",
|
| 119 | .parent = &ssam_node_root,
|
| 120 | };
|
| 121 |
|
| 122 |
|
| 123 | static const struct software_node ssam_node_hid_sam_penstash = {
|
| 124 | .name = "ssam:01:15:01:02:00",
|
| 125 | .parent = &ssam_node_root,
|
| 126 | };
|
| 127 |
|
| 128 |
|
| 129 | static const struct software_node ssam_node_hid_sam_touchpad = {
|
| 130 | .name = "ssam:01:15:01:03:00",
|
| 131 | .parent = &ssam_node_root,
|
| 132 | };
|
| 133 |
|
| 134 |
|
| 135 | static const struct software_node ssam_node_hid_sam_sensors = {
|
| 136 | .name = "ssam:01:15:01:06:00",
|
| 137 | .parent = &ssam_node_root,
|
| 138 | };
|
| 139 |
|
| 140 |
|
| 141 | static const struct software_node ssam_node_hid_sam_ucm_ucsi = {
|
| 142 | .name = "ssam:01:15:01:07:00",
|
| 143 | .parent = &ssam_node_root,
|
| 144 | };
|
| 145 |
|
| 146 |
|
| 147 | static const struct software_node ssam_node_hid_sam_sysctrl = {
|
| 148 | .name = "ssam:01:15:01:08:00",
|
| 149 | .parent = &ssam_node_root,
|
| 150 | };
|
| 151 |
|
| 152 |
|
| 153 | static const struct software_node ssam_node_hid_main_keyboard = {
|
| 154 | .name = "ssam:01:15:02:01:00",
|
| 155 | .parent = &ssam_node_root,
|
| 156 | };
|
| 157 |
|
| 158 |
|
| 159 | static const struct software_node ssam_node_hid_main_touchpad = {
|
| 160 | .name = "ssam:01:15:02:03:00",
|
| 161 | .parent = &ssam_node_root,
|
| 162 | };
|
| 163 |
|
| 164 |
|
| 165 | static const struct software_node ssam_node_hid_main_iid5 = {
|
| 166 | .name = "ssam:01:15:02:05:00",
|
| 167 | .parent = &ssam_node_root,
|
| 168 | };
|
| 169 |
|
| 170 |
|
| 171 | static const struct software_node ssam_node_hid_base_keyboard = {
|
| 172 | .name = "ssam:01:15:02:01:00",
|
| 173 | .parent = &ssam_node_hub_base,
|
| 174 | };
|
| 175 |
|
| 176 |
|
| 177 | static const struct software_node ssam_node_hid_base_touchpad = {
|
| 178 | .name = "ssam:01:15:02:03:00",
|
| 179 | .parent = &ssam_node_hub_base,
|
| 180 | };
|
| 181 |
|
| 182 |
|
| 183 | static const struct software_node ssam_node_hid_base_iid5 = {
|
| 184 | .name = "ssam:01:15:02:05:00",
|
| 185 | .parent = &ssam_node_hub_base,
|
| 186 | };
|
| 187 |
|
| 188 |
|
| 189 | static const struct software_node ssam_node_hid_base_iid6 = {
|
| 190 | .name = "ssam:01:15:02:06:00",
|
| 191 | .parent = &ssam_node_hub_base,
|
| 192 | };
|
| 193 |
|
| 194 |
|
| 195 | static const struct software_node ssam_node_hid_kip_keyboard = {
|
| 196 | .name = "ssam:01:15:02:01:00",
|
| 197 | .parent = &ssam_node_hub_kip,
|
| 198 | };
|
| 199 |
|
| 200 |
|
| 201 | static const struct software_node ssam_node_hid_kip_penstash = {
|
| 202 | .name = "ssam:01:15:02:02:00",
|
| 203 | .parent = &ssam_node_hub_kip,
|
| 204 | };
|
| 205 |
|
| 206 |
|
| 207 | static const struct software_node ssam_node_hid_kip_touchpad = {
|
| 208 | .name = "ssam:01:15:02:03:00",
|
| 209 | .parent = &ssam_node_hub_kip,
|
| 210 | };
|
| 211 |
|
| 212 |
|
| 213 | static const struct software_node ssam_node_hid_kip_fwupd = {
|
| 214 | .name = "ssam:01:15:02:05:00",
|
| 215 | .parent = &ssam_node_hub_kip,
|
| 216 | };
|
| 217 |
|
| 218 |
|
| 219 | static const struct software_node ssam_node_pos_tablet_switch = {
|
| 220 | .name = "ssam:01:26:01:00:01",
|
| 221 | .parent = &ssam_node_root,
|
| 222 | };
|
| 223 |
|
| 224 | |
| 225 | * Devices for 5th- and 6th-generations models:
|
| 226 | * - Surface Book 2,
|
| 227 | * - Surface Laptop 1 and 2,
|
| 228 | * - Surface Pro 5 and 6.
|
| 229 |
|
| 230 | static const struct software_node *ssam_node_group_gen5[] = {
|
| 231 | &ssam_node_root,
|
| 232 | &ssam_node_tmp_perf_profile,
|
| 233 | NULL,
|
| 234 | };
|
| 235 |
|
| 236 |
|
| 237 | static const struct software_node *ssam_node_group_sb3[] = {
|
| 238 | &ssam_node_root,
|
| 239 | &ssam_node_hub_base,
|
| 240 | &ssam_node_bat_ac,
|
| 241 | &ssam_node_bat_main,
|
| 242 | &ssam_node_bat_sb3base,
|
| 243 | &ssam_node_tmp_perf_profile,
|
| 244 | &ssam_node_bas_dtx,
|
| 245 | &ssam_node_hid_base_keyboard,
|
| 246 | &ssam_node_hid_base_touchpad,
|
| 247 | &ssam_node_hid_base_iid5,
|
| 248 | &ssam_node_hid_base_iid6,
|
| 249 | NULL,
|
| 250 | };
|
| 251 |
|
| 252 |
|
| 253 | static const struct software_node *ssam_node_group_sl3[] = {
|
| 254 | &ssam_node_root,
|
| 255 | &ssam_node_bat_ac,
|
| 256 | &ssam_node_bat_main,
|
| 257 | &ssam_node_tmp_perf_profile,
|
| 258 | &ssam_node_hid_main_keyboard,
|
| 259 | &ssam_node_hid_main_touchpad,
|
| 260 | &ssam_node_hid_main_iid5,
|
| 261 | NULL,
|
| 262 | };
|
| 263 |
|
| 264 |
|
| 265 | static const struct software_node *ssam_node_group_sl5[] = {
|
| 266 | &ssam_node_root,
|
| 267 | &ssam_node_bat_ac,
|
| 268 | &ssam_node_bat_main,
|
| 269 | &ssam_node_tmp_perf_profile_with_fan,
|
| 270 | &ssam_node_tmp_sensors,
|
| 271 | &ssam_node_fan_speed,
|
| 272 | &ssam_node_hid_main_keyboard,
|
| 273 | &ssam_node_hid_main_touchpad,
|
| 274 | &ssam_node_hid_main_iid5,
|
| 275 | &ssam_node_hid_sam_ucm_ucsi,
|
| 276 | NULL,
|
| 277 | };
|
| 278 |
|
| 279 |
|
| 280 | static const struct software_node *ssam_node_group_sl6[] = {
|
| 281 | &ssam_node_root,
|
| 282 | &ssam_node_bat_ac,
|
| 283 | &ssam_node_bat_main,
|
| 284 | &ssam_node_tmp_perf_profile_with_fan,
|
| 285 | &ssam_node_tmp_sensors,
|
| 286 | &ssam_node_fan_speed,
|
| 287 | &ssam_node_hid_main_keyboard,
|
| 288 | &ssam_node_hid_main_touchpad,
|
| 289 | &ssam_node_hid_main_iid5,
|
| 290 | &ssam_node_hid_sam_sensors,
|
| 291 | &ssam_node_hid_sam_ucm_ucsi,
|
| 292 | NULL,
|
| 293 | };
|
| 294 |
|
| 295 |
|
| 296 | static const struct software_node *ssam_node_group_sl7[] = {
|
| 297 | &ssam_node_root,
|
| 298 | &ssam_node_tmp_perf_profile_with_fan,
|
| 299 | &ssam_node_fan_speed,
|
| 300 | &ssam_node_hid_sam_keyboard,
|
| 301 |
|
| 302 | NULL,
|
| 303 | };
|
| 304 |
|
| 305 |
|
| 306 | static const struct software_node *ssam_node_group_sls1[] = {
|
| 307 | &ssam_node_root,
|
| 308 | &ssam_node_bat_ac,
|
| 309 | &ssam_node_bat_main,
|
| 310 | &ssam_node_tmp_perf_profile,
|
| 311 | &ssam_node_pos_tablet_switch,
|
| 312 | &ssam_node_hid_sam_keyboard,
|
| 313 | &ssam_node_hid_sam_penstash,
|
| 314 | &ssam_node_hid_sam_touchpad,
|
| 315 | &ssam_node_hid_sam_sensors,
|
| 316 | &ssam_node_hid_sam_ucm_ucsi,
|
| 317 | &ssam_node_hid_sam_sysctrl,
|
| 318 | NULL,
|
| 319 | };
|
| 320 |
|
| 321 |
|
| 322 | static const struct software_node *ssam_node_group_sls2[] = {
|
| 323 | &ssam_node_root,
|
| 324 | &ssam_node_bat_ac,
|
| 325 | &ssam_node_bat_main,
|
| 326 | &ssam_node_tmp_perf_profile_with_fan,
|
| 327 | &ssam_node_tmp_sensors,
|
| 328 | &ssam_node_fan_speed,
|
| 329 | &ssam_node_pos_tablet_switch,
|
| 330 | &ssam_node_hid_sam_keyboard,
|
| 331 | &ssam_node_hid_sam_penstash,
|
| 332 | &ssam_node_hid_sam_sensors,
|
| 333 | &ssam_node_hid_sam_ucm_ucsi,
|
| 334 | NULL,
|
| 335 | };
|
| 336 |
|
| 337 |
|
| 338 | static const struct software_node *ssam_node_group_slg1[] = {
|
| 339 | &ssam_node_root,
|
| 340 | &ssam_node_bat_ac,
|
| 341 | &ssam_node_bat_main,
|
| 342 | &ssam_node_tmp_perf_profile,
|
| 343 | NULL,
|
| 344 | };
|
| 345 |
|
| 346 |
|
| 347 | static const struct software_node *ssam_node_group_sp7[] = {
|
| 348 | &ssam_node_root,
|
| 349 | &ssam_node_bat_ac,
|
| 350 | &ssam_node_bat_main,
|
| 351 | &ssam_node_tmp_perf_profile,
|
| 352 | NULL,
|
| 353 | };
|
| 354 |
|
| 355 |
|
| 356 | static const struct software_node *ssam_node_group_sp8[] = {
|
| 357 | &ssam_node_root,
|
| 358 | &ssam_node_hub_kip,
|
| 359 | &ssam_node_bat_ac,
|
| 360 | &ssam_node_bat_main,
|
| 361 | &ssam_node_tmp_perf_profile,
|
| 362 | &ssam_node_kip_tablet_switch,
|
| 363 | &ssam_node_hid_kip_keyboard,
|
| 364 | &ssam_node_hid_kip_penstash,
|
| 365 | &ssam_node_hid_kip_touchpad,
|
| 366 | &ssam_node_hid_kip_fwupd,
|
| 367 | &ssam_node_hid_sam_sensors,
|
| 368 | &ssam_node_hid_sam_ucm_ucsi,
|
| 369 | NULL,
|
| 370 | };
|
| 371 |
|
| 372 |
|
| 373 | static const struct software_node *ssam_node_group_sp9[] = {
|
| 374 | &ssam_node_root,
|
| 375 | &ssam_node_hub_kip,
|
| 376 | &ssam_node_bat_ac,
|
| 377 | &ssam_node_bat_main,
|
| 378 | &ssam_node_tmp_perf_profile_with_fan,
|
| 379 | &ssam_node_tmp_sensors,
|
| 380 | &ssam_node_fan_speed,
|
| 381 | &ssam_node_pos_tablet_switch,
|
| 382 | &ssam_node_hid_kip_keyboard,
|
| 383 | &ssam_node_hid_kip_penstash,
|
| 384 | &ssam_node_hid_kip_touchpad,
|
| 385 | &ssam_node_hid_kip_fwupd,
|
| 386 | &ssam_node_hid_sam_sensors,
|
| 387 | &ssam_node_hid_sam_ucm_ucsi,
|
| 388 | NULL,
|
| 389 | };
|
| 390 |
|
| 391 |
|
| 392 | static const struct software_node *ssam_node_group_sp9_5g[] = {
|
| 393 | &ssam_node_root,
|
| 394 | &ssam_node_hub_kip,
|
| 395 | &ssam_node_bat_ac,
|
| 396 | &ssam_node_bat_main,
|
| 397 | &ssam_node_tmp_sensors,
|
| 398 | &ssam_node_hid_kip_keyboard,
|
| 399 | &ssam_node_hid_kip_penstash,
|
| 400 | &ssam_node_hid_kip_touchpad,
|
| 401 | &ssam_node_hid_kip_fwupd,
|
| 402 | &ssam_node_hid_sam_sensors,
|
| 403 | &ssam_node_kip_tablet_switch,
|
| 404 | NULL,
|
| 405 | };
|
| 406 |
|
| 407 |
|
| 408 | static const struct software_node *ssam_node_group_sp11[] = {
|
| 409 | &ssam_node_root,
|
| 410 | &ssam_node_hub_kip,
|
| 411 | &ssam_node_bat_ac,
|
| 412 | &ssam_node_bat_main,
|
| 413 | &ssam_node_tmp_sensors,
|
| 414 | &ssam_node_hid_kip_keyboard,
|
| 415 | &ssam_node_hid_kip_penstash,
|
| 416 | &ssam_node_hid_kip_touchpad,
|
| 417 | &ssam_node_hid_kip_fwupd,
|
| 418 | &ssam_node_hid_sam_sensors,
|
| 419 | &ssam_node_kip_tablet_switch,
|
| 420 | NULL,
|
| 421 | };
|
| 422 |
|
| 423 |
|
| 424 | static const struct software_node *ssam_node_group_sp12in[] = {
|
| 425 | &ssam_node_root,
|
| 426 | &ssam_node_hub_kip,
|
| 427 | &ssam_node_tmp_sensors,
|
| 428 | &ssam_node_hid_kip_keyboard,
|
| 429 | &ssam_node_hid_sam_penstash,
|
| 430 | &ssam_node_hid_kip_touchpad,
|
| 431 | &ssam_node_hid_kip_fwupd,
|
| 432 | &ssam_node_pos_tablet_switch,
|
| 433 | NULL,
|
| 434 | };
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 | static const struct acpi_device_id ssam_platform_hub_acpi_match[] = {
|
| 439 |
|
| 440 | { "MSHW0081", (unsigned long)ssam_node_group_gen5 },
|
| 441 |
|
| 442 |
|
| 443 | { "MSHW0111", (unsigned long)ssam_node_group_gen5 },
|
| 444 |
|
| 445 |
|
| 446 | { "MSHW0116", (unsigned long)ssam_node_group_sp7 },
|
| 447 |
|
| 448 |
|
| 449 | { "MSHW0119", (unsigned long)ssam_node_group_sp7 },
|
| 450 |
|
| 451 |
|
| 452 | { "MSHW0263", (unsigned long)ssam_node_group_sp8 },
|
| 453 |
|
| 454 |
|
| 455 | { "MSHW0343", (unsigned long)ssam_node_group_sp9 },
|
| 456 |
|
| 457 |
|
| 458 | { "MSHW0510", (unsigned long)ssam_node_group_sp9 },
|
| 459 |
|
| 460 |
|
| 461 | { "MSHW0583", (unsigned long)ssam_node_group_sp9 },
|
| 462 |
|
| 463 |
|
| 464 | { "MSHW0107", (unsigned long)ssam_node_group_gen5 },
|
| 465 |
|
| 466 |
|
| 467 | { "MSHW0117", (unsigned long)ssam_node_group_sb3 },
|
| 468 |
|
| 469 |
|
| 470 | { "MSHW0086", (unsigned long)ssam_node_group_gen5 },
|
| 471 |
|
| 472 |
|
| 473 | { "MSHW0112", (unsigned long)ssam_node_group_gen5 },
|
| 474 |
|
| 475 |
|
| 476 | { "MSHW0114", (unsigned long)ssam_node_group_sl3 },
|
| 477 |
|
| 478 |
|
| 479 | { "MSHW0110", (unsigned long)ssam_node_group_sl3 },
|
| 480 |
|
| 481 |
|
| 482 | { "MSHW0250", (unsigned long)ssam_node_group_sl3 },
|
| 483 |
|
| 484 |
|
| 485 | { "MSHW0350", (unsigned long)ssam_node_group_sl5 },
|
| 486 |
|
| 487 |
|
| 488 | { "MSHW0530", (unsigned long)ssam_node_group_sl6 },
|
| 489 |
|
| 490 |
|
| 491 | { "MSHW0118", (unsigned long)ssam_node_group_slg1 },
|
| 492 |
|
| 493 |
|
| 494 | { "MSHW0290", (unsigned long)ssam_node_group_slg1 },
|
| 495 |
|
| 496 |
|
| 497 | { "MSHW0440", (unsigned long)ssam_node_group_slg1 },
|
| 498 |
|
| 499 |
|
| 500 | { "MSHW0123", (unsigned long)ssam_node_group_sls1 },
|
| 501 |
|
| 502 |
|
| 503 | { "MSHW0360", (unsigned long)ssam_node_group_sls2 },
|
| 504 |
|
| 505 | { },
|
| 506 | };
|
| 507 | MODULE_DEVICE_TABLE(acpi, ssam_platform_hub_acpi_match);
|
| 508 |
|
| 509 | static const struct of_device_id ssam_platform_hub_of_match[] __maybe_unused = {
|
| 510 |
|
| 511 | { .compatible = "microsoft,arcata", (void *)ssam_node_group_sp9_5g },
|
| 512 |
|
| 513 | { .compatible = "microsoft,denali", (void *)ssam_node_group_sp11 },
|
| 514 |
|
| 515 | { .compatible = "microsoft,surface-pro-12in", (void *)ssam_node_group_sp12in },
|
| 516 |
|
| 517 | { .compatible = "microsoft,romulus13", (void *)ssam_node_group_sl7 },
|
| 518 | { .compatible = "microsoft,romulus15", (void *)ssam_node_group_sl7 },
|
| 519 | { },
|
| 520 | };
|
| 521 |
|
| 522 | static int ssam_platform_hub_probe(struct platform_device *pdev)
|
| 523 | {
|
| 524 | const struct software_node **nodes;
|
| 525 | struct ssam_controller *ctrl;
|
| 526 | struct fwnode_handle *root;
|
| 527 | int status;
|
| 528 |
|
| 529 | nodes = (const struct software_node **)acpi_device_get_match_data(&pdev->dev);
|
| 530 | if (!nodes) {
|
| 531 | nodes = (const struct software_node **)of_machine_get_match_data(ssam_platform_hub_of_match);
|
| 532 | if (!nodes)
|
| 533 | return -ENODEV;
|
| 534 | }
|
| 535 |
|
| 536 | |
| 537 | * As we're adding the SSAM client devices as children under this device
|
| 538 | * and not the SSAM controller, we need to add a device link to the
|
| 539 | * controller to ensure that we remove all of our devices before the
|
| 540 | * controller is removed. This also guarantees proper ordering for
|
| 541 | * suspend/resume of the devices on this hub.
|
| 542 |
|
| 543 | ctrl = ssam_client_bind(&pdev->dev);
|
| 544 | if (IS_ERR(ctrl))
|
| 545 | return PTR_ERR(ctrl) == -ENODEV ? -EPROBE_DEFER : PTR_ERR(ctrl);
|
| 546 |
|
| 547 | status = software_node_register_node_group(nodes);
|
| 548 | if (status)
|
| 549 | return status;
|
| 550 |
|
| 551 | root = software_node_fwnode(&ssam_node_root);
|
| 552 | if (!root) {
|
| 553 | software_node_unregister_node_group(nodes);
|
| 554 | return -ENOENT;
|
| 555 | }
|
| 556 |
|
| 557 | set_secondary_fwnode(&pdev->dev, root);
|
| 558 |
|
| 559 | status = __ssam_register_clients(&pdev->dev, ctrl, root);
|
| 560 | if (status) {
|
| 561 | set_secondary_fwnode(&pdev->dev, NULL);
|
| 562 | software_node_unregister_node_group(nodes);
|
| 563 | }
|
| 564 |
|
| 565 | platform_set_drvdata(pdev, nodes);
|
| 566 | return status;
|
| 567 | }
|
| 568 |
|
| 569 | static void ssam_platform_hub_remove(struct platform_device *pdev)
|
| 570 | {
|
| 571 | const struct software_node **nodes = platform_get_drvdata(pdev);
|
| 572 |
|
| 573 | ssam_remove_clients(&pdev->dev);
|
| 574 | set_secondary_fwnode(&pdev->dev, NULL);
|
| 575 | software_node_unregister_node_group(nodes);
|
| 576 | }
|
| 577 |
|
| 578 | static struct platform_driver ssam_platform_hub_driver = {
|
| 579 | .probe = ssam_platform_hub_probe,
|
| 580 | .remove = ssam_platform_hub_remove,
|
| 581 | .driver = {
|
| 582 | .name = "surface_aggregator_platform_hub",
|
| 583 | .acpi_match_table = ssam_platform_hub_acpi_match,
|
| 584 | .probe_type = PROBE_PREFER_ASYNCHRONOUS,
|
| 585 | },
|
| 586 | };
|
| 587 | module_platform_driver(ssam_platform_hub_driver);
|
| 588 |
|
| 589 | MODULE_ALIAS("platform:surface_aggregator_platform_hub");
|
| 590 | MODULE_AUTHOR("Maximilian Luz <[email protected]>");
|
| 591 | MODULE_DESCRIPTION("Device-registry for Surface System Aggregator Module");
|
| 592 | MODULE_LICENSE("GPL");
|