mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
pinctrl: rockchip: Decode drive strength in the get function
The decoding of the 2-bit and 8-bit level drive-strength values sits in
rockchip_set_drive_perpin(), where it is unreachable: the SoCs whose
banks declare these drive types (RK3506 and RV1103B) take the early
ctrl->type branch in the set path, and the read-and-decode logic in a
set function has no purpose. Meanwhile rockchip_get_drive_perpin()
lacks the decoding, so pin_config_get() and the debugfs output report
-EINVAL for these SoCs.
Move the two cases to rockchip_get_drive_perpin(), where they belong.
Fixes: dbd2317d7b ("pinctrl: rockchip: Add rk3506 pinctrl support")
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
465f276bb9
commit
8aa25c6e88
|
|
@ -3405,6 +3405,25 @@ static int rockchip_get_drive_perpin(struct rockchip_pin_bank *bank,
|
|||
case DRV_TYPE_IO_1V8_ONLY:
|
||||
rmask_bits = RK3288_DRV_BITS_PER_PIN;
|
||||
break;
|
||||
case DRV_TYPE_IO_LEVEL_2_BIT:
|
||||
ret = regmap_read(regmap, reg, &data);
|
||||
if (ret)
|
||||
return ret;
|
||||
data >>= bit;
|
||||
|
||||
return data & 0x3;
|
||||
case DRV_TYPE_IO_LEVEL_8_BIT:
|
||||
ret = regmap_read(regmap, reg, &data);
|
||||
if (ret)
|
||||
return ret;
|
||||
data >>= bit;
|
||||
data &= (1 << 8) - 1;
|
||||
|
||||
ret = hweight8(data);
|
||||
if (ret > 0)
|
||||
return ret - 1;
|
||||
else
|
||||
return -EINVAL;
|
||||
default:
|
||||
dev_err(dev, "unsupported pinctrl drive type: %d\n", drv_type);
|
||||
return -EINVAL;
|
||||
|
|
@ -3528,25 +3547,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank,
|
|||
case DRV_TYPE_IO_1V8_ONLY:
|
||||
rmask_bits = RK3288_DRV_BITS_PER_PIN;
|
||||
break;
|
||||
case DRV_TYPE_IO_LEVEL_2_BIT:
|
||||
ret = regmap_read(regmap, reg, &data);
|
||||
if (ret)
|
||||
return ret;
|
||||
data >>= bit;
|
||||
|
||||
return data & 0x3;
|
||||
case DRV_TYPE_IO_LEVEL_8_BIT:
|
||||
ret = regmap_read(regmap, reg, &data);
|
||||
if (ret)
|
||||
return ret;
|
||||
data >>= bit;
|
||||
data &= (1 << 8) - 1;
|
||||
|
||||
ret = hweight8(data);
|
||||
if (ret > 0)
|
||||
return ret - 1;
|
||||
else
|
||||
return -EINVAL;
|
||||
default:
|
||||
dev_err(dev, "unsupported pinctrl drive type: %d\n", drv_type);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user