diff options
author | Claudiu Beznea <claudiu.beznea@microchip.com> | 2022-02-04 15:57:50 +0200 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2022-02-24 19:05:28 +0100 |
commit | e58cd453d58b20c6a6f34d3591640aa19aa14d25 (patch) | |
tree | a4fef5f5d79575a7a60b516482ee114c1dbc932e /target/linux/at91/patches-5.10/129-regulator-core-return-zero-for-selectors-lower-than-.patch | |
parent | 3ed992a99630457f660761ce199e3d2a00f06168 (diff) | |
download | upstream-e58cd453d58b20c6a6f34d3591640aa19aa14d25.tar.gz upstream-e58cd453d58b20c6a6f34d3591640aa19aa14d25.tar.bz2 upstream-e58cd453d58b20c6a6f34d3591640aa19aa14d25.zip |
at91: add kernel support for sama7g5 soc
Add kernel support for SAMA7G5 by back-porting mainline kernel patches.
Among SAMA7G5 features could be remembered:
- ARM Cortex-A7
- double data rate multi-port dynamic RAM controller supporting DDR2,
DDR3, DDR3L, LPDDR2, LPDDR3 up to 533MHz
- peripherals for audio, video processing
- 1 gigabit + 1 megabit Ethernet controllers
- 6 CAN controllers
- trust zone support
- DVFS for CPU
- criptography IPs
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Diffstat (limited to 'target/linux/at91/patches-5.10/129-regulator-core-return-zero-for-selectors-lower-than-.patch')
-rw-r--r-- | target/linux/at91/patches-5.10/129-regulator-core-return-zero-for-selectors-lower-than-.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/target/linux/at91/patches-5.10/129-regulator-core-return-zero-for-selectors-lower-than-.patch b/target/linux/at91/patches-5.10/129-regulator-core-return-zero-for-selectors-lower-than-.patch new file mode 100644 index 0000000000..b44fa547e1 --- /dev/null +++ b/target/linux/at91/patches-5.10/129-regulator-core-return-zero-for-selectors-lower-than-.patch @@ -0,0 +1,71 @@ +From 0e933ffc049a0e181b5a6c3af1933976d6959ba9 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea <claudiu.beznea@microchip.com> +Date: Wed, 25 Nov 2020 19:25:47 +0200 +Subject: [PATCH 129/247] regulator: core: return zero for selectors lower than + linear_min_sel + +Selectors lower than linear_min_sel should not be considered invalid. +Thus return zero in case _regulator_list_voltage(), +regulator_list_hardware_vsel() or regulator_list_voltage_table() +receives such selectors as argument. + +Fixes: bdcd1177578c ("regulator: core: validate selector against linear_min_sel") +Reported-by: Jon Hunter <jonathanh@nvidia.com> +Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> +Link: https://lore.kernel.org/r/1606325147-606-1-git-send-email-claudiu.beznea@microchip.com +Signed-off-by: Mark Brown <broonie@kernel.org> +--- + drivers/regulator/core.c | 10 ++++++---- + drivers/regulator/helpers.c | 5 +++-- + 2 files changed, 9 insertions(+), 6 deletions(-) + +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c +index 0b7a23cdbcac..65ecf872b4e0 100644 +--- a/drivers/regulator/core.c ++++ b/drivers/regulator/core.c +@@ -2984,9 +2984,10 @@ static int _regulator_list_voltage(struct regulator_dev *rdev, + return rdev->desc->fixed_uV; + + if (ops->list_voltage) { +- if (selector >= rdev->desc->n_voltages || +- selector < rdev->desc->linear_min_sel) ++ if (selector >= rdev->desc->n_voltages) + return -EINVAL; ++ if (selector < rdev->desc->linear_min_sel) ++ return 0; + if (lock) + regulator_lock(rdev); + ret = ops->list_voltage(rdev, selector); +@@ -3136,9 +3137,10 @@ int regulator_list_hardware_vsel(struct regulator *regulator, + struct regulator_dev *rdev = regulator->rdev; + const struct regulator_ops *ops = rdev->desc->ops; + +- if (selector >= rdev->desc->n_voltages || +- selector < rdev->desc->linear_min_sel) ++ if (selector >= rdev->desc->n_voltages) + return -EINVAL; ++ if (selector < rdev->desc->linear_min_sel) ++ return 0; + if (ops->set_voltage_sel != regulator_set_voltage_sel_regmap) + return -EOPNOTSUPP; + +diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c +index 974f1a63993d..f42b394a0c46 100644 +--- a/drivers/regulator/helpers.c ++++ b/drivers/regulator/helpers.c +@@ -647,9 +647,10 @@ int regulator_list_voltage_table(struct regulator_dev *rdev, + return -EINVAL; + } + +- if (selector >= rdev->desc->n_voltages || +- selector < rdev->desc->linear_min_sel) ++ if (selector >= rdev->desc->n_voltages) + return -EINVAL; ++ if (selector < rdev->desc->linear_min_sel) ++ return 0; + + return rdev->desc->volt_table[selector]; + } +-- +2.32.0 + |