aboutsummaryrefslogtreecommitdiff
path: root/drivers/pinctrl/mediatek/pinctrl-moore.c
AgeCommit message (Collapse)AuthorFilesLines
2023-11-04pinctrl: mediatek: moore: drop the wrappers around ↵Bartosz Golaszewski1-6/+1
pinctrl_gpio_direction_input() pinctrl_gpio_direction_input() now has the same signature as the wrappers around it so we can drop them. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Linus Walleij <[email protected]>
2023-11-04treewide: rename pinctrl_gpio_direction_output_new()Bartosz Golaszewski1-1/+1
Now that pinctrl_gpio_direction_output() is no longer used, let's drop the '_new' suffix from its improved variant. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Linus Walleij <[email protected]>
2023-11-04treewide: rename pinctrl_gpio_direction_input_new()Bartosz Golaszewski1-1/+1
Now that pinctrl_gpio_direction_input() is no longer used, let's drop the '_new' suffix from its improved variant. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Linus Walleij <[email protected]>
2023-11-04pinctrl: mediatek: moore: use new pinctrl GPIO helpersBartosz Golaszewski1-2/+2
Replace the pinctrl helpers taking the global GPIO number as argument with the improved variants that instead take a pointer to the GPIO chip and the controller-relative offset. Signed-off-by: Bartosz Golaszewski <[email protected]> Acked-by: Linus Walleij <[email protected]>
2023-09-27pinctrl: mediatek: moore: handle mtk_hw_set_value() errors in ↵Karina Yankevich1-3/+6
mtk_pinmux_set_mux() mtk_pinmux_set_mux() doesn't check the result of mtk_hw_set_value() despite it may return a negative error code. Propagate error code to caller functions. Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool. Signed-off-by: Karina Yankevich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2023-03-23pinctrl: Use of_property_present() for testing DT property presenceRob Herring1-1/+1
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more. Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Jernej Skrabec <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] [Dropped hunk hitting drivers/pinctrl/renesas/pinctrl.c] Signed-off-by: Linus Walleij <[email protected]>
2023-01-16pinctrl: mediatek: Remove duplicate assignment of of_gpio_n_cellsAndy Shevchenko1-1/+0
The of_gpio_n_cells default is 2 when ->of_xlate() callback is not defined. No need to assign it explicitly in the driver. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2022-11-10pinctrl: mediatek: extend pinctrl-moore to support new bias functionsSam Shih1-7/+42
Commit fb34a9ae383a ("pinctrl: mediatek: support rsel feature") introduced SoC specify 'pull_type' attribute to mtk_pinconf_bias_set_combo and mtk_pinconf_bias_get_combo, and make the functions able to support almost all Mediatek SoCs that use pinctrl-mtk-common-v2.c. This patch enables pinctrl_moore to support these functions. Signed-off-by: Sam Shih <[email protected]> Signed-off-by: Frank Wunderlich <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2022-10-24pinctrl: mediatek: Add missing header(s)Andy Shevchenko1-0/+3
Do not imply that some of the generic headers may be always included. Instead, include explicitly what we are direct user of. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
2022-03-15pinctrl: mediatek: pinctrl-moore: Simplify with dev_err_probe()AngeloGioacchino Del Regno1-16/+9
Use the dev_err_probe() helper to simplify error handling during probe. Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2021-12-16pinctrl: Get rid of duplicate of_node assignment in the driversAndy Shevchenko1-4/+3
GPIO library does copy the of_node from the parent device of the GPIO chip, there is no need to repeat this in the individual drivers. Remove these assignment all at once. For the details one may look into the of_gpio_dev_init() implementation. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2021-09-16pinctrl: mediatek: moore: check if pin_desc is valid before useSam Shih1-0/+18
Certain SoC are missing the middle part gpios in consecutive pins, it's better to check if mtk_pin_desc is a valid pin for the extensibility Signed-off-by: Sam Shih <[email protected]> Acked-by: Sean Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2021-04-22pinctrl: mediatek: use spin lock in mtk_rmwTzung-Bi Shih1-1/+1
Commit 42a46434e9b1 ("pinctrl: add lock in mtk_rmw function.") uses mutex lock in mtk_rmw. However the function is possible called from atomic context. For example call trace: mutex_lock+0x28/0x64 mtk_rmw+0x38/0x80 [snip] max98357a_daiops_trigger+0x8c/0x9c soc_pcm_trigger+0x5c/0x10c The max98357a_daiops_trigger() could run in either atomic or non-atomic context. As a result, dmesg shows some similar messages: "BUG: sleeping function called from invalid context at kernel/locking/mutex.c:254". Uses spin lock in mtk_rmw instead. Fixes: 42a46434e9b1 ("pinctrl: add lock in mtk_rmw function.") Signed-off-by: Tzung-Bi Shih <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2021-03-25pinctrl: add lock in mtk_rmw function.Zhiyong Tao1-0/+2
When multiple threads operate on the same register resource which include multiple pin, It will make the register resource wrong to control. So we add lock to avoid the case. Signed-off-by: Zhiyong Tao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2021-01-04pinctrl: mediatek: moore: convert comma to semicolonZheng Yongjun1-2/+2
Replace a comma between expression statements by a semicolon. Signed-off-by: Zheng Yongjun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-09-30pinctrl: mediatek: use devm_platform_ioremap_resource_byname()Wang Xiaojun1-9/+2
Use the devm_platform_ioremap_resource_byname() helper instead of calling platform_get_resource_byname() and devm_ioremap_resource() separately. Signed-off-by: Wang Xiaojun <[email protected]> Acked-by: Sean Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2018-11-09pinctrl: mediatek: clean up indentation issues, add missing tabColin Ian King1-2/+2
Trivial fix to clean up indentation issues, add one level of indentation on two if statements. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-26pinctrl: mediatek: fix check on EINT_NA comparisonColin Ian King1-2/+2
Currently, the check on desc->eint.eint_n == EINT_NA is always false because this is comparing a u16 to -1 which can never be true. Fix this by casting EINT_NA to u16. Detected by CoverityScan, CID#1473610 ("Operands don't affect result") Fixes: fb5fa8dc151b ("pinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.c") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-21pinctrl: mediatek: moore: fix return value check in mtk_moore_pinctrl_probe()Wei Yongjun1-4/+4
In case of error, the function devm_kmalloc_array() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: b7d7f9eeca55 ("pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on") Signed-off-by: Wei Yongjun <[email protected]> Acked-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mtk: Fix up GPIO includesLinus Walleij1-0/+1
Include only <linux/gpio/driver.h> since this is a driver, not a consumer. Cc: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: extend eint build to pinctrl-mtk-common-v2.cSean Wang1-124/+0
Almost all MediaTek SoCs apply the exact same logic to build eint, so move the common functions into pinctrl-mtk-common-v2.c to allow each new pinctrl driver to reuse them. Also, add a protection checker on hw->soc->eint_hw to avoid invalid memory access when there's certain SoC not to define its eint_hw properly in the code flow. Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends onSean Wang1-8/+20
Because the pincrl-mtk-common.c is an implementation for per-pin binding, its pin descriptor includes more information than pinctrl-mtk-common-v2 so far can support. So, we complement these data before writing a driver using pincrl-mtk-common-v2.c for per-pin binding. By the way, the size of struct mtk_pin_desc would be larger than struct pinctrl_pin_desc can hold, so it's necessary to have a copy before the pins information is being registered into the core. Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: add multiple register bases support to ↵Sean Wang1-7/+23
pinctrl-mtk-common-v2.c Certain SoC own multiple register base for accessing each pin groups, it's easy to be done with extend struct mtk_pin_field_calc to support the kind of SoC such as MT8183. Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: use pin descriptor all in pinctrl-mtk-common-v2.cSean Wang1-23/+43
all use pin descriptor instead in pinctrl-mtk-common-v2.c for the consistency and extensibility. Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: add ies register support to pinctrl-mtk-common-v2.cSean Wang1-7/+19
Certain SoCs have to program an extra IES register to configure input enabled mode so that we add it in the existing path as an option. Signed-off-by: Ryder.Lee <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: add advanced pull related support to pinctrl-mtk-common-v2.cSean Wang1-0/+33
There are some specific pins (i.e. MMC/SD) need specific registers to turn on/off the 10K & 50k(75K) resistors when pull up/down. Therefore, this patch adds the custom prarmeters so that the user could control it through device tree. Signed-off-by: Ryder.Lee <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: add pull related support to pinctrl-mtk-common-v2.cSean Wang1-29/+47
Put pull control support related functions to pinctrl-mtk-common-v2.c as these operations might be different by chips and allow different type of driver to reuse them. Signed-off-by: Ryder.Lee <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: add driving strength related support to ↵Sean Wang1-31/+17
pinctrl-mtk-common-v2.c Put driving strength support related functions to pinctrl-mtk-common-v2.c as these operations might be different by chips and allow different type of driver to reuse them. Signed-off-by: Ryder.Lee <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: extend struct mtk_pin_soc to pinctrl-mtk-common-v2.cSean Wang1-2/+2
Add two parameters gpio_m and eint_m for configuring GPIO mode and EINT mode, they might be varying depend on SoC. Signed-off-by: Ryder.Lee <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.cSean Wang1-10/+39
This patch introduces a data structure mtk_pin_desc, which is used to provide information per pin characteristic such as driving current, eint number and a driving index, that is used to lookup table describing the details about the groups of driving current by which the pin is able to adjust the driving strength so that the driver could get the appropriate driving group when calls .pin_config_get()/set(). Signed-off-by: Ryder.Lee <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-09-18pinctrl: mediatek: add pinctrl-moore that implements the generic pinctrl ↵Sean Wang1-0/+687
dt-bindings Add a generic driver pinctrl-moore.c for MT762x SoC and any other SoC that would like to use generic dt-binding. The patch is furtherly refactored from pinctrl-mt7622.c that totally uses the functions back by the generic pinctrl core such as GENERIC_PINCONF, GENERIC_PINCTRL_GROUPS, and GENERIC_PINMUX_FUNCTIONS and its binding also completely follows up pinctrl-bindings.txt in Documentation/devicetree/bindings/pinctrl/ to implement. Signed-off-by: Ryder.Lee <[email protected]> Signed-off-by: Sean Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>