Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'linux-can-fixes-for-6.16-20250715' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2025-07-15

Brett Werling's patch for the tcan4x5x glue code driver fixes the
detection of chips which are held in reset/sleep and must be woken up
by GPIO prior to communication.

* tag 'linux-can-fixes-for-6.16-20250715' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
can: tcan4x5x: fix reset gpio usage during probe
====================

Link: https://patch.msgid.link/20250715101625.3202690-1-mkl@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+41 -20
+41 -20
drivers/net/can/m_can/tcan4x5x-core.c
··· 343 343 of_property_read_bool(cdev->dev->of_node, "ti,nwkrq-voltage-vio"); 344 344 } 345 345 346 - static int tcan4x5x_get_gpios(struct m_can_classdev *cdev, 347 - const struct tcan4x5x_version_info *version_info) 346 + static int tcan4x5x_get_gpios(struct m_can_classdev *cdev) 348 347 { 349 348 struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev); 350 349 int ret; 351 350 352 - if (version_info->has_wake_pin) { 353 - tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake", 354 - GPIOD_OUT_HIGH); 355 - if (IS_ERR(tcan4x5x->device_wake_gpio)) { 356 - if (PTR_ERR(tcan4x5x->device_wake_gpio) == -EPROBE_DEFER) 357 - return -EPROBE_DEFER; 351 + tcan4x5x->device_wake_gpio = devm_gpiod_get_optional(cdev->dev, 352 + "device-wake", 353 + GPIOD_OUT_HIGH); 354 + if (IS_ERR(tcan4x5x->device_wake_gpio)) { 355 + if (PTR_ERR(tcan4x5x->device_wake_gpio) == -EPROBE_DEFER) 356 + return -EPROBE_DEFER; 358 357 359 - tcan4x5x_disable_wake(cdev); 360 - } 358 + tcan4x5x->device_wake_gpio = NULL; 361 359 } 362 360 363 361 tcan4x5x->reset_gpio = devm_gpiod_get_optional(cdev->dev, "reset", ··· 367 369 if (ret) 368 370 return ret; 369 371 370 - if (version_info->has_state_pin) { 371 - tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, 372 - "device-state", 373 - GPIOD_IN); 374 - if (IS_ERR(tcan4x5x->device_state_gpio)) { 375 - tcan4x5x->device_state_gpio = NULL; 376 - tcan4x5x_disable_state(cdev); 377 - } 372 + tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, 373 + "device-state", 374 + GPIOD_IN); 375 + if (IS_ERR(tcan4x5x->device_state_gpio)) 376 + tcan4x5x->device_state_gpio = NULL; 377 + 378 + return 0; 379 + } 380 + 381 + static int tcan4x5x_check_gpios(struct m_can_classdev *cdev, 382 + const struct tcan4x5x_version_info *version_info) 383 + { 384 + struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev); 385 + int ret; 386 + 387 + if (version_info->has_wake_pin && !tcan4x5x->device_wake_gpio) { 388 + ret = tcan4x5x_disable_wake(cdev); 389 + if (ret) 390 + return ret; 391 + } 392 + 393 + if (version_info->has_state_pin && !tcan4x5x->device_state_gpio) { 394 + ret = tcan4x5x_disable_state(cdev); 395 + if (ret) 396 + return ret; 378 397 } 379 398 380 399 return 0; ··· 483 468 goto out_m_can_class_free_dev; 484 469 } 485 470 471 + ret = tcan4x5x_get_gpios(mcan_class); 472 + if (ret) { 473 + dev_err(&spi->dev, "Getting gpios failed %pe\n", ERR_PTR(ret)); 474 + goto out_power; 475 + } 476 + 486 477 version_info = tcan4x5x_find_version(priv); 487 478 if (IS_ERR(version_info)) { 488 479 ret = PTR_ERR(version_info); 489 480 goto out_power; 490 481 } 491 482 492 - ret = tcan4x5x_get_gpios(mcan_class, version_info); 483 + ret = tcan4x5x_check_gpios(mcan_class, version_info); 493 484 if (ret) { 494 - dev_err(&spi->dev, "Getting gpios failed %pe\n", ERR_PTR(ret)); 485 + dev_err(&spi->dev, "Checking gpios failed %pe\n", ERR_PTR(ret)); 495 486 goto out_power; 496 487 } 497 488