Message ID | 20220830171332.3.I4ff95ba7e884a486d7814ee888bf864be2ebdef4@changeid (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | acpi: i2c: Use SharedAndWake and ExclusiveAndWake to enable wake irq | expand |
Hi Raul,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on hid/for-next]
[also build test ERROR on brgl/gpio/for-next rafael-pm/linux-next linus/master v6.0-rc3 next-20220830]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Raul-E-Rangel/acpi-i2c-Use-SharedAndWake-and-ExclusiveAndWake-to-enable-wake-irq/20220831-071916
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20220831/202208311235.pxWOoHPE-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/131a07025a591f4ca6d7540f1055bc03f8cf64af
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Raul-E-Rangel/acpi-i2c-Use-SharedAndWake-and-ExclusiveAndWake-to-enable-wake-irq/20220831-071916
git checkout 131a07025a591f4ca6d7540f1055bc03f8cf64af
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash drivers/net/ethernet/mellanox/mlxbf_gige/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c: In function 'mlxbf_gige_probe':
>> drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c:343:19: error: too few arguments to function 'acpi_dev_gpio_irq_get_by'
343 | phy_irq = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(&pdev->dev), "phy-gpios", 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c:8:
include/linux/acpi.h:1212:19: note: declared here
1212 | static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev,
| ^~~~~~~~~~~~~~~~~~~~~~~~
vim +/acpi_dev_gpio_irq_get_by +343 drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
f92e1869d74e1a David Thompson 2021-06-24 272
f92e1869d74e1a David Thompson 2021-06-24 273 static int mlxbf_gige_probe(struct platform_device *pdev)
f92e1869d74e1a David Thompson 2021-06-24 274 {
f92e1869d74e1a David Thompson 2021-06-24 275 struct phy_device *phydev;
f92e1869d74e1a David Thompson 2021-06-24 276 struct net_device *netdev;
f92e1869d74e1a David Thompson 2021-06-24 277 struct mlxbf_gige *priv;
f92e1869d74e1a David Thompson 2021-06-24 278 void __iomem *llu_base;
f92e1869d74e1a David Thompson 2021-06-24 279 void __iomem *plu_base;
f92e1869d74e1a David Thompson 2021-06-24 280 void __iomem *base;
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 281 int addr, phy_irq;
f92e1869d74e1a David Thompson 2021-06-24 282 u64 control;
f92e1869d74e1a David Thompson 2021-06-24 283 int err;
f92e1869d74e1a David Thompson 2021-06-24 284
464a57281f29af Cai Huoqing 2021-08-31 285 base = devm_platform_ioremap_resource(pdev, MLXBF_GIGE_RES_MAC);
f92e1869d74e1a David Thompson 2021-06-24 286 if (IS_ERR(base))
f92e1869d74e1a David Thompson 2021-06-24 287 return PTR_ERR(base);
f92e1869d74e1a David Thompson 2021-06-24 288
464a57281f29af Cai Huoqing 2021-08-31 289 llu_base = devm_platform_ioremap_resource(pdev, MLXBF_GIGE_RES_LLU);
f92e1869d74e1a David Thompson 2021-06-24 290 if (IS_ERR(llu_base))
f92e1869d74e1a David Thompson 2021-06-24 291 return PTR_ERR(llu_base);
f92e1869d74e1a David Thompson 2021-06-24 292
464a57281f29af Cai Huoqing 2021-08-31 293 plu_base = devm_platform_ioremap_resource(pdev, MLXBF_GIGE_RES_PLU);
f92e1869d74e1a David Thompson 2021-06-24 294 if (IS_ERR(plu_base))
f92e1869d74e1a David Thompson 2021-06-24 295 return PTR_ERR(plu_base);
f92e1869d74e1a David Thompson 2021-06-24 296
f92e1869d74e1a David Thompson 2021-06-24 297 /* Perform general init of GigE block */
f92e1869d74e1a David Thompson 2021-06-24 298 control = readq(base + MLXBF_GIGE_CONTROL);
f92e1869d74e1a David Thompson 2021-06-24 299 control |= MLXBF_GIGE_CONTROL_PORT_EN;
f92e1869d74e1a David Thompson 2021-06-24 300 writeq(control, base + MLXBF_GIGE_CONTROL);
f92e1869d74e1a David Thompson 2021-06-24 301
f92e1869d74e1a David Thompson 2021-06-24 302 netdev = devm_alloc_etherdev(&pdev->dev, sizeof(*priv));
f92e1869d74e1a David Thompson 2021-06-24 303 if (!netdev)
f92e1869d74e1a David Thompson 2021-06-24 304 return -ENOMEM;
f92e1869d74e1a David Thompson 2021-06-24 305
f92e1869d74e1a David Thompson 2021-06-24 306 SET_NETDEV_DEV(netdev, &pdev->dev);
f92e1869d74e1a David Thompson 2021-06-24 307 netdev->netdev_ops = &mlxbf_gige_netdev_ops;
f92e1869d74e1a David Thompson 2021-06-24 308 netdev->ethtool_ops = &mlxbf_gige_ethtool_ops;
f92e1869d74e1a David Thompson 2021-06-24 309 priv = netdev_priv(netdev);
f92e1869d74e1a David Thompson 2021-06-24 310 priv->netdev = netdev;
f92e1869d74e1a David Thompson 2021-06-24 311
f92e1869d74e1a David Thompson 2021-06-24 312 platform_set_drvdata(pdev, priv);
f92e1869d74e1a David Thompson 2021-06-24 313 priv->dev = &pdev->dev;
f92e1869d74e1a David Thompson 2021-06-24 314 priv->pdev = pdev;
f92e1869d74e1a David Thompson 2021-06-24 315
f92e1869d74e1a David Thompson 2021-06-24 316 spin_lock_init(&priv->lock);
f92e1869d74e1a David Thompson 2021-06-24 317
f92e1869d74e1a David Thompson 2021-06-24 318 /* Attach MDIO device */
f92e1869d74e1a David Thompson 2021-06-24 319 err = mlxbf_gige_mdio_probe(pdev, priv);
f92e1869d74e1a David Thompson 2021-06-24 320 if (err)
f92e1869d74e1a David Thompson 2021-06-24 321 return err;
f92e1869d74e1a David Thompson 2021-06-24 322
f92e1869d74e1a David Thompson 2021-06-24 323 priv->base = base;
f92e1869d74e1a David Thompson 2021-06-24 324 priv->llu_base = llu_base;
f92e1869d74e1a David Thompson 2021-06-24 325 priv->plu_base = plu_base;
f92e1869d74e1a David Thompson 2021-06-24 326
f92e1869d74e1a David Thompson 2021-06-24 327 priv->rx_q_entries = MLXBF_GIGE_DEFAULT_RXQ_SZ;
f92e1869d74e1a David Thompson 2021-06-24 328 priv->tx_q_entries = MLXBF_GIGE_DEFAULT_TXQ_SZ;
f92e1869d74e1a David Thompson 2021-06-24 329
f92e1869d74e1a David Thompson 2021-06-24 330 /* Write initial MAC address to hardware */
f92e1869d74e1a David Thompson 2021-06-24 331 mlxbf_gige_initial_mac(priv);
f92e1869d74e1a David Thompson 2021-06-24 332
f92e1869d74e1a David Thompson 2021-06-24 333 err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
f92e1869d74e1a David Thompson 2021-06-24 334 if (err) {
f92e1869d74e1a David Thompson 2021-06-24 335 dev_err(&pdev->dev, "DMA configuration failed: 0x%x\n", err);
f92e1869d74e1a David Thompson 2021-06-24 336 goto out;
f92e1869d74e1a David Thompson 2021-06-24 337 }
f92e1869d74e1a David Thompson 2021-06-24 338
f92e1869d74e1a David Thompson 2021-06-24 339 priv->error_irq = platform_get_irq(pdev, MLXBF_GIGE_ERROR_INTR_IDX);
f92e1869d74e1a David Thompson 2021-06-24 340 priv->rx_irq = platform_get_irq(pdev, MLXBF_GIGE_RECEIVE_PKT_INTR_IDX);
f92e1869d74e1a David Thompson 2021-06-24 341 priv->llu_plu_irq = platform_get_irq(pdev, MLXBF_GIGE_LLU_PLU_INTR_IDX);
f92e1869d74e1a David Thompson 2021-06-24 342
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 @343 phy_irq = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(&pdev->dev), "phy-gpios", 0);
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 344 if (phy_irq < 0) {
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 345 dev_err(&pdev->dev, "Error getting PHY irq. Use polling instead");
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 346 phy_irq = PHY_POLL;
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 347 }
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 348
f92e1869d74e1a David Thompson 2021-06-24 349 phydev = phy_find_first(priv->mdiobus);
f92e1869d74e1a David Thompson 2021-06-24 350 if (!phydev) {
f92e1869d74e1a David Thompson 2021-06-24 351 err = -ENODEV;
f92e1869d74e1a David Thompson 2021-06-24 352 goto out;
f92e1869d74e1a David Thompson 2021-06-24 353 }
f92e1869d74e1a David Thompson 2021-06-24 354
f92e1869d74e1a David Thompson 2021-06-24 355 addr = phydev->mdio.addr;
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 356 priv->mdiobus->irq[addr] = phy_irq;
6c2a6ddca76327 Asmaa Mnebhi 2021-10-15 357 phydev->irq = phy_irq;
f92e1869d74e1a David Thompson 2021-06-24 358
f92e1869d74e1a David Thompson 2021-06-24 359 err = phy_connect_direct(netdev, phydev,
f92e1869d74e1a David Thompson 2021-06-24 360 mlxbf_gige_adjust_link,
f92e1869d74e1a David Thompson 2021-06-24 361 PHY_INTERFACE_MODE_GMII);
f92e1869d74e1a David Thompson 2021-06-24 362 if (err) {
f92e1869d74e1a David Thompson 2021-06-24 363 dev_err(&pdev->dev, "Could not attach to PHY\n");
f92e1869d74e1a David Thompson 2021-06-24 364 goto out;
f92e1869d74e1a David Thompson 2021-06-24 365 }
f92e1869d74e1a David Thompson 2021-06-24 366
f92e1869d74e1a David Thompson 2021-06-24 367 /* MAC only supports 1000T full duplex mode */
f92e1869d74e1a David Thompson 2021-06-24 368 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT);
f92e1869d74e1a David Thompson 2021-06-24 369 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Full_BIT);
f92e1869d74e1a David Thompson 2021-06-24 370 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
f92e1869d74e1a David Thompson 2021-06-24 371 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT);
f92e1869d74e1a David Thompson 2021-06-24 372 phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT);
f92e1869d74e1a David Thompson 2021-06-24 373
f92e1869d74e1a David Thompson 2021-06-24 374 /* Only symmetric pause with flow control enabled is supported so no
f92e1869d74e1a David Thompson 2021-06-24 375 * need to negotiate pause.
f92e1869d74e1a David Thompson 2021-06-24 376 */
f92e1869d74e1a David Thompson 2021-06-24 377 linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->advertising);
f92e1869d74e1a David Thompson 2021-06-24 378 linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->advertising);
f92e1869d74e1a David Thompson 2021-06-24 379
f92e1869d74e1a David Thompson 2021-06-24 380 /* Display information about attached PHY device */
f92e1869d74e1a David Thompson 2021-06-24 381 phy_attached_info(phydev);
f92e1869d74e1a David Thompson 2021-06-24 382
f92e1869d74e1a David Thompson 2021-06-24 383 err = register_netdev(netdev);
f92e1869d74e1a David Thompson 2021-06-24 384 if (err) {
f92e1869d74e1a David Thompson 2021-06-24 385 dev_err(&pdev->dev, "Failed to register netdev\n");
f92e1869d74e1a David Thompson 2021-06-24 386 phy_disconnect(phydev);
f92e1869d74e1a David Thompson 2021-06-24 387 goto out;
f92e1869d74e1a David Thompson 2021-06-24 388 }
f92e1869d74e1a David Thompson 2021-06-24 389
f92e1869d74e1a David Thompson 2021-06-24 390 return 0;
f92e1869d74e1a David Thompson 2021-06-24 391
f92e1869d74e1a David Thompson 2021-06-24 392 out:
f92e1869d74e1a David Thompson 2021-06-24 393 mlxbf_gige_mdio_remove(priv);
f92e1869d74e1a David Thompson 2021-06-24 394 return err;
f92e1869d74e1a David Thompson 2021-06-24 395 }
f92e1869d74e1a David Thompson 2021-06-24 396
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index ecd7d169470b06..df02c3eb34a294 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -130,7 +130,8 @@ static int pca953x_acpi_get_irq(struct device *dev) if (ret) dev_warn(dev, "can't add GPIO ACPI mapping\n"); - ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0); + ret = acpi_dev_gpio_irq_get_by(ACPI_COMPANION(dev), "irq-gpios", 0, + NULL); if (ret < 0) return ret; diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 9be1376f9a627f..5cda2fcf7f43df 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -741,6 +741,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) lookup->info.pin_config = agpio->pin_config; lookup->info.debounce = agpio->debounce_timeout; lookup->info.gpioint = gpioint; + lookup->info.wake_capable = agpio->wake_capable; /* * Polarity and triggering are only specified for GpioInt @@ -991,6 +992,7 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, * @adev: pointer to a ACPI device to get IRQ from * @name: optional name of GpioInt resource * @index: index of GpioInt resource (starting from %0) + * @wake_capable: Set to 1 if the IRQ is wake capable * * If the device has one or more GpioInt resources, this function can be * used to translate from the GPIO offset in the resource to the Linux IRQ @@ -1002,9 +1004,13 @@ struct gpio_desc *acpi_node_get_gpiod(struct fwnode_handle *fwnode, * The function takes optional @name parameter. If the resource has a property * name, then only those will be taken into account. * + * The GPIO is considered wake capable if GpioInt specifies SharedAndWake or + * ExclusiveAndWake. + * * Return: Linux IRQ number (> %0) on success, negative errno on failure. */ -int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index) +int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, + int index, int *wake_capable) { int idx, i; unsigned int irq_flags; @@ -1061,6 +1067,9 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int ind dev_dbg(&adev->dev, "IRQ %d already in use\n", irq); } + if (wake_capable) + *wake_capable = info.wake_capable; + return irq; } diff --git a/drivers/gpio/gpiolib-acpi.h b/drivers/gpio/gpiolib-acpi.h index e476558d947136..1ac6816839dbce 100644 --- a/drivers/gpio/gpiolib-acpi.h +++ b/drivers/gpio/gpiolib-acpi.h @@ -18,6 +18,7 @@ struct acpi_device; * @pin_config: pin bias as provided by ACPI * @polarity: interrupt polarity as provided by ACPI * @triggering: triggering type as provided by ACPI + * @wake_capable: wake capability as provided by ACPI * @debounce: debounce timeout as provided by ACPI * @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping */ @@ -28,6 +29,7 @@ struct acpi_gpio_info { int pin_config; int polarity; int triggering; + bool wake_capable; unsigned int debounce; unsigned int quirks; }; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6f64b2f3dc5479..7ee946758c5bcc 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1202,7 +1202,8 @@ bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio); bool acpi_gpio_get_io_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio); -int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int index); +int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, + int index, int *wake_capable); #else static inline bool acpi_gpio_get_irq_resource(struct acpi_resource *ares, struct acpi_resource_gpio **agpio) @@ -1215,7 +1216,8 @@ static inline bool acpi_gpio_get_io_resource(struct acpi_resource *ares, return false; } static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, - const char *name, int index) + const char *name, int index, + int *wake_capable) { return -ENXIO; } @@ -1223,7 +1225,13 @@ static inline int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) { - return acpi_dev_gpio_irq_get_by(adev, NULL, index); + return acpi_dev_gpio_irq_get_by(adev, NULL, index, NULL); +} + +static inline int acpi_dev_gpio_irq_get_wake(struct acpi_device *adev, + int index, int *wake_capable) +{ + return acpi_dev_gpio_irq_get_by(adev, NULL, index, wake_capable); } /* Device properties */
The ACPI spec defines the SharedAndWake and ExclusiveAndWake share type keywords. This is an indication that the GPIO IRQ can also be used as a wake source. This change exposes the wake_capable bit so drivers can correctly enable wake functionality instead of making an assumption. Signed-off-by: Raul E Rangel <rrangel@chromium.org> --- drivers/gpio/gpio-pca953x.c | 3 ++- drivers/gpio/gpiolib-acpi.c | 11 ++++++++++- drivers/gpio/gpiolib-acpi.h | 2 ++ include/linux/acpi.h | 14 +++++++++++--- 4 files changed, 25 insertions(+), 5 deletions(-)