@@ -358,9 +358,7 @@ static int armada_37xx_pmx_set_by_name(struct pinctrl_dev *pctldev,
358
358
359
359
val = grp -> val [func ];
360
360
361
- regmap_update_bits (info -> regmap , reg , mask , val );
362
-
363
- return 0 ;
361
+ return regmap_update_bits (info -> regmap , reg , mask , val );
364
362
}
365
363
366
364
static int armada_37xx_pmx_set (struct pinctrl_dev * pctldev ,
@@ -402,10 +400,13 @@ static int armada_37xx_gpio_get_direction(struct gpio_chip *chip,
402
400
struct armada_37xx_pinctrl * info = gpiochip_get_data (chip );
403
401
unsigned int reg = OUTPUT_EN ;
404
402
unsigned int val , mask ;
403
+ int ret ;
405
404
406
405
armada_37xx_update_reg (& reg , & offset );
407
406
mask = BIT (offset );
408
- regmap_read (info -> regmap , reg , & val );
407
+ ret = regmap_read (info -> regmap , reg , & val );
408
+ if (ret )
409
+ return ret ;
409
410
410
411
if (val & mask )
411
412
return GPIO_LINE_DIRECTION_OUT ;
@@ -417,31 +418,37 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip,
417
418
unsigned int offset , int value )
418
419
{
419
420
struct armada_37xx_pinctrl * info = gpiochip_get_data (chip );
420
- unsigned int reg = OUTPUT_EN ;
421
+ unsigned int en_offset = offset ;
422
+ unsigned int reg = OUTPUT_VAL ;
421
423
unsigned int mask , val , ret ;
422
424
423
425
armada_37xx_update_reg (& reg , & offset );
424
426
mask = BIT (offset );
427
+ val = value ? mask : 0 ;
425
428
426
- ret = regmap_update_bits (info -> regmap , reg , mask , mask );
429
+ ret = regmap_update_bits (info -> regmap , reg , mask , val );
427
430
if (ret )
428
431
return ret ;
429
432
430
- reg = OUTPUT_VAL ;
431
- val = value ? mask : 0 ;
432
- return regmap_update_bits (info -> regmap , reg , mask , val );
433
+ reg = OUTPUT_EN ;
434
+ armada_37xx_update_reg (& reg , & en_offset );
435
+
436
+ return regmap_update_bits (info -> regmap , reg , mask , mask );
433
437
}
434
438
435
439
static int armada_37xx_gpio_get (struct gpio_chip * chip , unsigned int offset )
436
440
{
437
441
struct armada_37xx_pinctrl * info = gpiochip_get_data (chip );
438
442
unsigned int reg = INPUT_VAL ;
439
443
unsigned int val , mask ;
444
+ int ret ;
440
445
441
446
armada_37xx_update_reg (& reg , & offset );
442
447
mask = BIT (offset );
443
448
444
- regmap_read (info -> regmap , reg , & val );
449
+ ret = regmap_read (info -> regmap , reg , & val );
450
+ if (ret )
451
+ return ret ;
445
452
446
453
return (val & mask ) != 0 ;
447
454
}
@@ -466,16 +473,17 @@ static int armada_37xx_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
466
473
{
467
474
struct armada_37xx_pinctrl * info = pinctrl_dev_get_drvdata (pctldev );
468
475
struct gpio_chip * chip = range -> gc ;
476
+ int ret ;
469
477
470
478
dev_dbg (info -> dev , "gpio_direction for pin %u as %s-%d to %s\n" ,
471
479
offset , range -> name , offset , input ? "input" : "output" );
472
480
473
481
if (input )
474
- armada_37xx_gpio_direction_input (chip , offset );
482
+ ret = armada_37xx_gpio_direction_input (chip , offset );
475
483
else
476
- armada_37xx_gpio_direction_output (chip , offset , 0 );
484
+ ret = armada_37xx_gpio_direction_output (chip , offset , 0 );
477
485
478
- return 0 ;
486
+ return ret ;
479
487
}
480
488
481
489
static int armada_37xx_gpio_request_enable (struct pinctrl_dev * pctldev ,
0 commit comments