can: tcan4x5x: Disable the INH pin device-state GPIO is unavailable
Subsystems (2)
PATCH 1/1 can: tcan4x5x: Disable the INH pin device-state GPIO is unavailable
If the device state GPIO is not connected to the host then disable the INH output from the TCAN device per section 8.3.5 of the data sheet.
--- drivers/net/can/m_can/tcan4x5x.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/net/can/m_can/tcan4x5x.c +13 -1
@@ -102,6 +102,7 @@#define TCAN4X5X_MODE_NORMAL BIT(7)#define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30)) +#define TCAN4X5X_DISABLE_INH_MSK BIT(9)#define TCAN4X5X_SW_RESET BIT(2)
@@ -360,6 +361,15 @@ static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) TCAN4X5X_DISABLE_WAKE_MSK, 0x00); } +static int tcan4x5x_disable_state (struct m_can_classdev *cdev) +{ +struct tcan4x5x_priv *tcan4x5x = cdev->device_data; + +return regmap_update_bits (tcan4x5x->regmap,TCAN4X5X_CONFIG , +TCAN4X5X_DISABLE_INH_MSK ,0x01 ); + +} +static int tcan4x5x_parse_config (struct m_can_classdev *cdev) {struct tcan4x5x_priv *tcan4x5x = cdev->device_data;
@@ -383,8 +393,10 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) tcan4x5x->device_state_gpio =devm_gpiod_get_optional (cdev->dev,"device-state" ,GPIOD_IN ); -if (IS_ERR (tcan4x5x->device_state_gpio)) +if (IS_ERR (tcan4x5x->device_state_gpio)) { tcan4x5x->device_state_gpio =NULL ; +tcan4x5x_disable_state (cdev); + }return 0 ; }
Signature · 1 line
2.23.0
Quoted 5 lines · Dan Murphy
If the device state GPIO is not connected to the host then disable the INH output from the TCAN device per section 8.3.5 of the data sheet.
Signed-off-by Dan Murphy <[email protected]>---
Applied to linux-can. With some changes...
Quoted 16 lines
drivers/net/can/m_can/tcan4x5x.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/net/can/m_can/tcan4x5x.c +1
-0@@ -102,6 +102,7 @@#define TCAN4X5X_MODE_NORMAL BIT(7)#define TCAN4X5X_DISABLE_WAKE_MSK (BIT(31) | BIT(30)) +#define TCAN4X5X_DISABLE_INH_MSK BIT(9)#define TCAN4X5X_SW_RESET BIT(2)
drivers/net/can/m_can/tcan4x5x.c static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) · line 370
Quoted 10 lines
drivers/net/can/m_can/tcan4x5x.c +7
-0@@ -360,6 +361,15 @@ static int tcan4x5x_disable_wake(struct m_can_classdev *cdev) TCAN4X5X_DISABLE_WAKE_MSK, 0x00); } +static int tcan4x5x_disable_state (struct m_can_classdev *cdev) +{ +struct tcan4x5x_priv *tcan4x5x = cdev->device_data; + +return regmap_update_bits (tcan4x5x->regmap,TCAN4X5X_CONFIG , +TCAN4X5X_DISABLE_INH_MSK ,0x01 ); +
Removed the stray line while applying.
Quoted 6 lines
drivers/net/can/m_can/tcan4x5x.c +2
-0+} +static int tcan4x5x_parse_config (struct m_can_classdev *cdev) {struct tcan4x5x_priv *tcan4x5x = cdev->device_data;
drivers/net/can/m_can/tcan4x5x.c static int tcan4x5x_parse_config(struct m_can_classdev *cdev) · line 399
Quoted 8 lines
drivers/net/can/m_can/tcan4x5x.c +3
-1@@ -383,8 +393,10 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) tcan4x5x->device_state_gpio =devm_gpiod_get_optional (cdev->dev,"device-state" ,GPIOD_IN ); -if (IS_ERR (tcan4x5x->device_state_gpio)) +if (IS_ERR (tcan4x5x->device_state_gpio)) { tcan4x5x->device_state_gpio =NULL ; +tcan4x5x_disable_state (cdev); + }
For some reason, this hunk doesn't apply, due to the additional:
drivers/net/can/m_can/tcan4x5x.c static int tcan4x5x_parse_config(struct m_can_classdev *cdev) · line 401
Quoted 2 lines
drivers/net/can/m_can/tcan4x5x.c +0
-0> tcan4x5x->power = devm_regulator_get_optional(cdev->dev, >"vsup" );
I've applied the patch manually.
Quoted 4 lines
drivers/net/can/m_can/tcan4x5x.c +0
-0return 0 ;}
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Marc Kleine-Budde
maintainerQuoted 17 lines · Marc Kleine-Budde
drivers/net/can/m_can/tcan4x5x.c static int tcan4x5x_parse_config(struct m_can_classdev *cdev) · line 399
Quoted 12 lines · Dan Murphy
static int
tcan4x5x_parse_config(struct m_can_classdev *cdev){drivers/net/can/m_can/tcan4x5x.c +3
-1struct tcan4x5x_priv *tcan4x5x = cdev->device_data;@@ -383,8 +393,10 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) tcan4x5x->device_state_gpio =devm_gpiod_get_optional (cdev->dev,"device-state" ,GPIOD_IN ); -if (IS_ERR (tcan4x5x->device_state_gpio)) +if (IS_ERR (tcan4x5x->device_state_gpio)) { tcan4x5x->device_state_gpio =NULL ; +tcan4x5x_disable_state (cdev); + }For some reason, this hunk doesn't apply, due to the additional:
Quoted 2 lines
(quoted diff) +0
-0> tcan4x5x->power = devm_regulator_get_optional(cdev->dev, > "vsup");
...which was my fault. :) Please have a look at
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git/log/?h=testing
...if I've collected every m_can related patch.
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Marc
Quoted 16 lines · Marc Kleine-Budde
Quoted 15 lines · Marc Kleine-Budde
drivers/net/can/m_can/tcan4x5x.c static int tcan4x5x_parse_config(struct m_can_classdev *cdev) · line 399
Quoted 12 lines · Dan Murphy
static int tcan4x5x_parse_config(struct m_can_classdev *cdev) { struct tcan4x5x_priv *tcan4x5x = cdev->device_data;drivers/net/can/m_can/tcan4x5x.c +3
-1@@ -383,8 +393,10 @@ static int tcan4x5x_parse_config(struct m_can_classdev *cdev) tcan4x5x->device_state_gpio =devm_gpiod_get_optional (cdev->dev,"device-state" ,GPIOD_IN ); -if (IS_ERR (tcan4x5x->device_state_gpio)) +if (IS_ERR (tcan4x5x->device_state_gpio)) { tcan4x5x->device_state_gpio =NULL ; +tcan4x5x_disable_state (cdev); + }For some reason, this hunk doesn't apply, due to the additional:
Quoted 7 lines
Quoted 2 lines
Review static int tcan4x5x_parse_config(struct m_can_classdev *cdev) · line 401
Quoted 2 lines
(quoted diff) +0
-0> tcan4x5x->power = devm_regulator_get_optional(cdev->dev, > "vsup");...which was my fault. :) Please have a look at
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git/log/?h=testing
...if I've collected every
m_canrelated patch.
Is this still relevant or have you pulled this in?
It looks good to me.
Dan
Marc Kleine-Budde
maintainerQuoted 5 lines · Dan Murphy
Quoted 3 lines
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git/log/?h=testing
...if I've collected every
m_canrelated patch.Is this still relevant or have you pulled this in?
Yes, it's still relevant, because it's upstream in the mean time. If there are any problems left, we should fix them.
Quoted 1 line
It looks good to me.
If you find time, please test.
regards,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |