Commit 0c3013bb authored by Tan Jui Nee's avatar Tan Jui Nee Committed by Linus Walleij

pinctrl/broxton: enable platform device in the absence of ACPI enumeration

This is to cater the need for non-ACPI system whereby
a platform device has to be created in order to bind
with the Apollo Lake Pinctrl GPIO platform driver.
Signed-off-by: default avatarTan Jui Nee <jui.nee.tan@intel.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 79f28b9f
/* /*
* Intel Broxton SoC pinctrl/GPIO driver * Intel Broxton SoC pinctrl/GPIO driver
* *
* Copyright (C) 2015, Intel Corporation * Copyright (C) 2015, 2016 Intel Corporation
* Author: Mika Westerberg <mika.westerberg@linux.intel.com> * Author: Mika Westerberg <mika.westerberg@linux.intel.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -1003,23 +1003,29 @@ static const struct acpi_device_id bxt_pinctrl_acpi_match[] = { ...@@ -1003,23 +1003,29 @@ static const struct acpi_device_id bxt_pinctrl_acpi_match[] = {
}; };
MODULE_DEVICE_TABLE(acpi, bxt_pinctrl_acpi_match); MODULE_DEVICE_TABLE(acpi, bxt_pinctrl_acpi_match);
static const struct platform_device_id bxt_pinctrl_platform_ids[] = {
{ "apl-pinctrl", (kernel_ulong_t)&apl_pinctrl_soc_data },
{ "broxton-pinctrl", (kernel_ulong_t)&bxt_pinctrl_soc_data },
{ },
};
static int bxt_pinctrl_probe(struct platform_device *pdev) static int bxt_pinctrl_probe(struct platform_device *pdev)
{ {
const struct intel_pinctrl_soc_data *soc_data = NULL; const struct intel_pinctrl_soc_data *soc_data = NULL;
const struct intel_pinctrl_soc_data **soc_table; const struct intel_pinctrl_soc_data **soc_table;
const struct acpi_device_id *id;
struct acpi_device *adev; struct acpi_device *adev;
int i; int i;
adev = ACPI_COMPANION(&pdev->dev); adev = ACPI_COMPANION(&pdev->dev);
if (!adev) if (adev) {
return -ENODEV; const struct acpi_device_id *id;
id = acpi_match_device(bxt_pinctrl_acpi_match, &pdev->dev); id = acpi_match_device(bxt_pinctrl_acpi_match, &pdev->dev);
if (!id) if (!id)
return -ENODEV; return -ENODEV;
soc_table = (const struct intel_pinctrl_soc_data **)id->driver_data; soc_table = (const struct intel_pinctrl_soc_data **)
id->driver_data;
for (i = 0; soc_table[i]; i++) { for (i = 0; soc_table[i]; i++) {
if (!strcmp(adev->pnp.unique_id, soc_table[i]->uid)) { if (!strcmp(adev->pnp.unique_id, soc_table[i]->uid)) {
...@@ -1027,6 +1033,17 @@ static int bxt_pinctrl_probe(struct platform_device *pdev) ...@@ -1027,6 +1033,17 @@ static int bxt_pinctrl_probe(struct platform_device *pdev)
break; break;
} }
} }
} else {
const struct platform_device_id *pid;
pid = platform_get_device_id(pdev);
if (!pid)
return -ENODEV;
soc_table = (const struct intel_pinctrl_soc_data **)
pid->driver_data;
soc_data = soc_table[pdev->id];
}
if (!soc_data) if (!soc_data)
return -ENODEV; return -ENODEV;
...@@ -1047,6 +1064,7 @@ static struct platform_driver bxt_pinctrl_driver = { ...@@ -1047,6 +1064,7 @@ static struct platform_driver bxt_pinctrl_driver = {
.acpi_match_table = bxt_pinctrl_acpi_match, .acpi_match_table = bxt_pinctrl_acpi_match,
.pm = &bxt_pinctrl_pm_ops, .pm = &bxt_pinctrl_pm_ops,
}, },
.id_table = bxt_pinctrl_platform_ids,
}; };
static int __init bxt_pinctrl_init(void) static int __init bxt_pinctrl_init(void)
...@@ -1064,3 +1082,4 @@ module_exit(bxt_pinctrl_exit); ...@@ -1064,3 +1082,4 @@ module_exit(bxt_pinctrl_exit);
MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>"); MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
MODULE_DESCRIPTION("Intel Broxton SoC pinctrl/GPIO driver"); MODULE_DESCRIPTION("Intel Broxton SoC pinctrl/GPIO driver");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:broxton-pinctrl");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment