-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wifi: brcmfmac: acpi: Add support for fetching Apple ACPI properties
On DT platforms, the module-instance and antenna-sku-info properties are passed in the DT. On ACPI platforms, module-instance is passed via the analogous Apple device property mechanism, while the antenna SKU info is instead obtained via an ACPI method that grabs it from non-volatile storage. Add support for this, to allow proper firmware selection on Apple platforms. Signed-off-by: Hector Martin <marcan@marcan.st> Reviewed-by: Julian Calaby <julian.calaby@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230214080034.3828-2-marcan@marcan.st
- Loading branch information
Hector Martin
authored and
Kalle Valo
committed
Feb 27, 2023
1 parent
0d1f7ff
commit 0f48580
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// SPDX-License-Identifier: ISC | ||
/* | ||
* Copyright The Asahi Linux Contributors | ||
*/ | ||
|
||
#include <linux/acpi.h> | ||
#include "debug.h" | ||
#include "core.h" | ||
#include "common.h" | ||
|
||
void brcmf_acpi_probe(struct device *dev, enum brcmf_bus_type bus_type, | ||
struct brcmf_mp_device *settings) | ||
{ | ||
acpi_status status; | ||
const union acpi_object *o; | ||
struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
struct acpi_device *adev = ACPI_COMPANION(dev); | ||
|
||
if (!adev) | ||
return; | ||
|
||
if (!ACPI_FAILURE(acpi_dev_get_property(adev, "module-instance", | ||
ACPI_TYPE_STRING, &o))) { | ||
brcmf_dbg(INFO, "ACPI module-instance=%s\n", o->string.pointer); | ||
settings->board_type = devm_kasprintf(dev, GFP_KERNEL, | ||
"apple,%s", | ||
o->string.pointer); | ||
} else { | ||
brcmf_dbg(INFO, "No ACPI module-instance\n"); | ||
return; | ||
} | ||
|
||
status = acpi_evaluate_object(adev->handle, "RWCV", NULL, &buf); | ||
o = buf.pointer; | ||
if (!ACPI_FAILURE(status) && o && o->type == ACPI_TYPE_BUFFER && | ||
o->buffer.length >= 2) { | ||
char *antenna_sku = devm_kzalloc(dev, 3, GFP_KERNEL); | ||
|
||
if (antenna_sku) { | ||
memcpy(antenna_sku, o->buffer.pointer, 2); | ||
brcmf_dbg(INFO, "ACPI RWCV data=%*phN antenna-sku=%s\n", | ||
(int)o->buffer.length, o->buffer.pointer, | ||
antenna_sku); | ||
settings->antenna_sku = antenna_sku; | ||
} | ||
|
||
kfree(buf.pointer); | ||
} else { | ||
brcmf_dbg(INFO, "No ACPI antenna-sku\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters