mirror of https://github.com/torvalds/linux.git
gpio: elkhartlake: Convert to auxiliary driver
Since PCI device should not be abusing platform device, MFD parent to platform child path is no longer being pursued for this driver. Convert it to auxiliary driver, which will be used by EHL PSE auxiliary device. Signed-off-by: Raag Jadav <raag.jadav@intel.com> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20251112034040.457801-3-raag.jadav@intel.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
a0c83150ee
commit
10c1529690
|
|
@ -1412,7 +1412,7 @@ config HTC_EGPIO
|
||||||
|
|
||||||
config GPIO_ELKHARTLAKE
|
config GPIO_ELKHARTLAKE
|
||||||
tristate "Intel Elkhart Lake PSE GPIO support"
|
tristate "Intel Elkhart Lake PSE GPIO support"
|
||||||
depends on X86 || COMPILE_TEST
|
depends on INTEL_EHL_PSE_IO
|
||||||
select GPIO_TANGIER
|
select GPIO_TANGIER
|
||||||
help
|
help
|
||||||
Select this option to enable GPIO support for Intel Elkhart Lake
|
Select this option to enable GPIO support for Intel Elkhart Lake
|
||||||
|
|
|
||||||
|
|
@ -2,43 +2,46 @@
|
||||||
/*
|
/*
|
||||||
* Intel Elkhart Lake PSE GPIO driver
|
* Intel Elkhart Lake PSE GPIO driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2023 Intel Corporation.
|
* Copyright (c) 2023, 2025 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Authors: Pandith N <pandith.n@intel.com>
|
* Authors: Pandith N <pandith.n@intel.com>
|
||||||
* Raag Jadav <raag.jadav@intel.com>
|
* Raag Jadav <raag.jadav@intel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/auxiliary_bus.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/platform_device.h>
|
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
|
|
||||||
|
#include <linux/ehl_pse_io_aux.h>
|
||||||
|
|
||||||
#include "gpio-tangier.h"
|
#include "gpio-tangier.h"
|
||||||
|
|
||||||
/* Each Intel EHL PSE GPIO Controller has 30 GPIO pins */
|
/* Each Intel EHL PSE GPIO Controller has 30 GPIO pins */
|
||||||
#define EHL_PSE_NGPIO 30
|
#define EHL_PSE_NGPIO 30
|
||||||
|
|
||||||
static int ehl_gpio_probe(struct platform_device *pdev)
|
static int ehl_gpio_probe(struct auxiliary_device *adev, const struct auxiliary_device_id *id)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &adev->dev;
|
||||||
|
struct ehl_pse_io_data *data;
|
||||||
struct tng_gpio *priv;
|
struct tng_gpio *priv;
|
||||||
int irq, ret;
|
int ret;
|
||||||
|
|
||||||
irq = platform_get_irq(pdev, 0);
|
data = dev_get_platdata(dev);
|
||||||
if (irq < 0)
|
if (!data)
|
||||||
return irq;
|
return -ENODATA;
|
||||||
|
|
||||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
priv->reg_base = devm_platform_ioremap_resource(pdev, 0);
|
priv->reg_base = devm_ioremap_resource(dev, &data->mem);
|
||||||
if (IS_ERR(priv->reg_base))
|
if (IS_ERR(priv->reg_base))
|
||||||
return PTR_ERR(priv->reg_base);
|
return PTR_ERR(priv->reg_base);
|
||||||
|
|
||||||
priv->dev = dev;
|
priv->dev = dev;
|
||||||
priv->irq = irq;
|
priv->irq = data->irq;
|
||||||
|
|
||||||
priv->info.base = -1;
|
priv->info.base = -1;
|
||||||
priv->info.ngpio = EHL_PSE_NGPIO;
|
priv->info.ngpio = EHL_PSE_NGPIO;
|
||||||
|
|
@ -51,25 +54,24 @@ static int ehl_gpio_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return dev_err_probe(dev, ret, "tng_gpio_probe error\n");
|
return dev_err_probe(dev, ret, "tng_gpio_probe error\n");
|
||||||
|
|
||||||
platform_set_drvdata(pdev, priv);
|
auxiliary_set_drvdata(adev, priv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct platform_device_id ehl_gpio_ids[] = {
|
static const struct auxiliary_device_id ehl_gpio_ids[] = {
|
||||||
{ "gpio-elkhartlake" },
|
{ EHL_PSE_IO_NAME "." EHL_PSE_GPIO_NAME },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(platform, ehl_gpio_ids);
|
MODULE_DEVICE_TABLE(auxiliary, ehl_gpio_ids);
|
||||||
|
|
||||||
static struct platform_driver ehl_gpio_driver = {
|
static struct auxiliary_driver ehl_gpio_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "gpio-elkhartlake",
|
|
||||||
.pm = pm_sleep_ptr(&tng_gpio_pm_ops),
|
.pm = pm_sleep_ptr(&tng_gpio_pm_ops),
|
||||||
},
|
},
|
||||||
.probe = ehl_gpio_probe,
|
.probe = ehl_gpio_probe,
|
||||||
.id_table = ehl_gpio_ids,
|
.id_table = ehl_gpio_ids,
|
||||||
};
|
};
|
||||||
module_platform_driver(ehl_gpio_driver);
|
module_auxiliary_driver(ehl_gpio_driver);
|
||||||
|
|
||||||
MODULE_AUTHOR("Pandith N <pandith.n@intel.com>");
|
MODULE_AUTHOR("Pandith N <pandith.n@intel.com>");
|
||||||
MODULE_AUTHOR("Raag Jadav <raag.jadav@intel.com>");
|
MODULE_AUTHOR("Raag Jadav <raag.jadav@intel.com>");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue