* [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel In an effort to give some love to the apparently forgotten MT6795 SoC, I am upstreaming more components that are necessary to support platforms powered by this one apart from a simple boot to serial console. This series performs some cleanups in mtk-pmic-keys and adds support for the MT6331 PMIC's keys. Adding support to each driver in each subsystem is done in different patch series as to avoid spamming uninteresting patches to maintainers. This series depends on another two series series [1], [2] named "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. [1]: https://lore.kernel.org/lkml/20220520124039.228314-1-angelogioacchino.delregno@collabora.com/T/#t [2]: https://lore.kernel.org/lkml/20220520124617.228808-1-angelogioacchino.delregno@collabora.com/T/#t Changes in v2: - Dropped first two patches, as Dmitry pushed a different solution - Refactored on top of [3] - Dropped Mattijs R-b tags from patches [1/3], [2/3] due to the refactoring [3]: https://patchwork.kernel.org/project/linux-mediatek/list/?series=644484 AngeloGioacchino Del Regno (3): Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs Input: mtk-pmic-keys - Add support for MT6331 PMIC keys drivers/input/keyboard/mtk-pmic-keys.c | 66 +++++++++++++++++++------- 1 file changed, 49 insertions(+), 17 deletions(-) -- 2.35.1 ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel In an effort to give some love to the apparently forgotten MT6795 SoC, I am upstreaming more components that are necessary to support platforms powered by this one apart from a simple boot to serial console. This series performs some cleanups in mtk-pmic-keys and adds support for the MT6331 PMIC's keys. Adding support to each driver in each subsystem is done in different patch series as to avoid spamming uninteresting patches to maintainers. This series depends on another two series series [1], [2] named "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. [1]: https://lore.kernel.org/lkml/20220520124039.228314-1-angelogioacchino.delregno@collabora.com/T/#t [2]: https://lore.kernel.org/lkml/20220520124617.228808-1-angelogioacchino.delregno@collabora.com/T/#t Changes in v2: - Dropped first two patches, as Dmitry pushed a different solution - Refactored on top of [3] - Dropped Mattijs R-b tags from patches [1/3], [2/3] due to the refactoring [3]: https://patchwork.kernel.org/project/linux-mediatek/list/?series=644484 AngeloGioacchino Del Regno (3): Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs Input: mtk-pmic-keys - Add support for MT6331 PMIC keys drivers/input/keyboard/mtk-pmic-keys.c | 66 +++++++++++++++++++------- 1 file changed, 49 insertions(+), 17 deletions(-) -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel In an effort to give some love to the apparently forgotten MT6795 SoC, I am upstreaming more components that are necessary to support platforms powered by this one apart from a simple boot to serial console. This series performs some cleanups in mtk-pmic-keys and adds support for the MT6331 PMIC's keys. Adding support to each driver in each subsystem is done in different patch series as to avoid spamming uninteresting patches to maintainers. This series depends on another two series series [1], [2] named "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. [1]: https://lore.kernel.org/lkml/20220520124039.228314-1-angelogioacchino.delregno@collabora.com/T/#t [2]: https://lore.kernel.org/lkml/20220520124617.228808-1-angelogioacchino.delregno@collabora.com/T/#t Changes in v2: - Dropped first two patches, as Dmitry pushed a different solution - Refactored on top of [3] - Dropped Mattijs R-b tags from patches [1/3], [2/3] due to the refactoring [3]: https://patchwork.kernel.org/project/linux-mediatek/list/?series=644484 AngeloGioacchino Del Regno (3): Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs Input: mtk-pmic-keys - Add support for MT6331 PMIC keys drivers/input/keyboard/mtk-pmic-keys.c | 66 +++++++++++++++++++------- 1 file changed, 49 insertions(+), 17 deletions(-) -- 2.35.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs 2022-05-24 9:35 ` AngeloGioacchino Del Regno (?) @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno -1 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Place the key bit in struct mtk_pmic_keys_regs to enhance this driver's flexibility, in preparation for adding support for more PMICs. While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as we are now dynamically setting the keymask relatively to the keys that are defined in the newly added rst_en_mask variable, on a per-key basis. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index d2f0db245ff6..2509a349a173 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -20,7 +20,6 @@ #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) #define MTK_PMIC_RST_DU_SHIFT 8 -#define MTK_PMIC_RST_KEY_MASK GENMASK(6, 5) #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) @@ -33,15 +32,17 @@ struct mtk_pmic_keys_regs { u32 deb_mask; u32 intsel_reg; u32 intsel_mask; + u32 rst_en_mask; }; #define MTK_PMIC_KEYS_REGS(_deb_reg, _deb_mask, \ - _intsel_reg, _intsel_mask) \ + _intsel_reg, _intsel_mask, _rst_mask) \ { \ .deb_reg = _deb_reg, \ .deb_mask = _deb_mask, \ .intsel_reg = _intsel_reg, \ .intsel_mask = _intsel_mask, \ + .rst_en_mask = _rst_mask, \ } struct mtk_pmic_regs { @@ -52,30 +53,32 @@ struct mtk_pmic_regs { static const struct mtk_pmic_regs mt6397_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6397_CHRSTATUS, - 0x8, MT6397_INT_RSV, 0x10), + 0x8, MT6397_INT_RSV, 0x10, MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, - 0x10, MT6397_INT_RSV, 0x8), + 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6397_TOP_RST_MISC, }; static const struct mtk_pmic_regs mt6323_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, - 0x2, MT6323_INT_MISC_CON, 0x10), + 0x2, MT6323_INT_MISC_CON, 0x10, MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, - 0x4, MT6323_INT_MISC_CON, 0x8), + 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6323_TOP_RST_MISC, }; static const struct mtk_pmic_regs mt6358_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, - 0x2, MT6358_PSC_TOP_INT_CON0, 0x5), + 0x2, MT6358_PSC_TOP_INT_CON0, 0x5, + MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, - 0x8, MT6358_PSC_TOP_INT_CON0, 0xa), + 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, + MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6358_TOP_RST_MISC, }; @@ -104,10 +107,14 @@ enum mtk_pmic_keys_lp_mode { static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, u32 pmic_rst_reg) { + const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; u32 long_press_mode, long_press_debounce; u32 value, mask; int error; + kregs_home = keys->keys[MTK_PMIC_HOMEKEY_INDEX].regs; + kregs_pwr = keys->keys[MTK_PMIC_PWRKEY_INDEX].regs; + error = of_property_read_u32(keys->dev->of_node, "power-off-time-sec", &long_press_debounce); if (error) @@ -124,15 +131,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, switch (long_press_mode) { case LP_TWOKEY: - value |= MTK_PMIC_HOMEKEY_RST; + value |= kregs_home->rst_en_mask; fallthrough; case LP_ONEKEY: - value |= MTK_PMIC_PWRKEY_RST; + value |= kregs_pwr->rst_en_mask; fallthrough; case LP_DISABLE: - mask |= MTK_PMIC_RST_KEY_MASK; + mask |= kregs_home->rst_en_mask; + mask |= kregs_pwr->rst_en_mask; break; default: -- 2.35.1 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Place the key bit in struct mtk_pmic_keys_regs to enhance this driver's flexibility, in preparation for adding support for more PMICs. While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as we are now dynamically setting the keymask relatively to the keys that are defined in the newly added rst_en_mask variable, on a per-key basis. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index d2f0db245ff6..2509a349a173 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -20,7 +20,6 @@ #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) #define MTK_PMIC_RST_DU_SHIFT 8 -#define MTK_PMIC_RST_KEY_MASK GENMASK(6, 5) #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) @@ -33,15 +32,17 @@ struct mtk_pmic_keys_regs { u32 deb_mask; u32 intsel_reg; u32 intsel_mask; + u32 rst_en_mask; }; #define MTK_PMIC_KEYS_REGS(_deb_reg, _deb_mask, \ - _intsel_reg, _intsel_mask) \ + _intsel_reg, _intsel_mask, _rst_mask) \ { \ .deb_reg = _deb_reg, \ .deb_mask = _deb_mask, \ .intsel_reg = _intsel_reg, \ .intsel_mask = _intsel_mask, \ + .rst_en_mask = _rst_mask, \ } struct mtk_pmic_regs { @@ -52,30 +53,32 @@ struct mtk_pmic_regs { static const struct mtk_pmic_regs mt6397_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6397_CHRSTATUS, - 0x8, MT6397_INT_RSV, 0x10), + 0x8, MT6397_INT_RSV, 0x10, MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, - 0x10, MT6397_INT_RSV, 0x8), + 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6397_TOP_RST_MISC, }; static const struct mtk_pmic_regs mt6323_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, - 0x2, MT6323_INT_MISC_CON, 0x10), + 0x2, MT6323_INT_MISC_CON, 0x10, MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, - 0x4, MT6323_INT_MISC_CON, 0x8), + 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6323_TOP_RST_MISC, }; static const struct mtk_pmic_regs mt6358_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, - 0x2, MT6358_PSC_TOP_INT_CON0, 0x5), + 0x2, MT6358_PSC_TOP_INT_CON0, 0x5, + MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, - 0x8, MT6358_PSC_TOP_INT_CON0, 0xa), + 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, + MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6358_TOP_RST_MISC, }; @@ -104,10 +107,14 @@ enum mtk_pmic_keys_lp_mode { static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, u32 pmic_rst_reg) { + const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; u32 long_press_mode, long_press_debounce; u32 value, mask; int error; + kregs_home = keys->keys[MTK_PMIC_HOMEKEY_INDEX].regs; + kregs_pwr = keys->keys[MTK_PMIC_PWRKEY_INDEX].regs; + error = of_property_read_u32(keys->dev->of_node, "power-off-time-sec", &long_press_debounce); if (error) @@ -124,15 +131,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, switch (long_press_mode) { case LP_TWOKEY: - value |= MTK_PMIC_HOMEKEY_RST; + value |= kregs_home->rst_en_mask; fallthrough; case LP_ONEKEY: - value |= MTK_PMIC_PWRKEY_RST; + value |= kregs_pwr->rst_en_mask; fallthrough; case LP_DISABLE: - mask |= MTK_PMIC_RST_KEY_MASK; + mask |= kregs_home->rst_en_mask; + mask |= kregs_pwr->rst_en_mask; break; default: -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Place the key bit in struct mtk_pmic_keys_regs to enhance this driver's flexibility, in preparation for adding support for more PMICs. While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as we are now dynamically setting the keymask relatively to the keys that are defined in the newly added rst_en_mask variable, on a per-key basis. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index d2f0db245ff6..2509a349a173 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -20,7 +20,6 @@ #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) #define MTK_PMIC_RST_DU_SHIFT 8 -#define MTK_PMIC_RST_KEY_MASK GENMASK(6, 5) #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) @@ -33,15 +32,17 @@ struct mtk_pmic_keys_regs { u32 deb_mask; u32 intsel_reg; u32 intsel_mask; + u32 rst_en_mask; }; #define MTK_PMIC_KEYS_REGS(_deb_reg, _deb_mask, \ - _intsel_reg, _intsel_mask) \ + _intsel_reg, _intsel_mask, _rst_mask) \ { \ .deb_reg = _deb_reg, \ .deb_mask = _deb_mask, \ .intsel_reg = _intsel_reg, \ .intsel_mask = _intsel_mask, \ + .rst_en_mask = _rst_mask, \ } struct mtk_pmic_regs { @@ -52,30 +53,32 @@ struct mtk_pmic_regs { static const struct mtk_pmic_regs mt6397_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6397_CHRSTATUS, - 0x8, MT6397_INT_RSV, 0x10), + 0x8, MT6397_INT_RSV, 0x10, MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, - 0x10, MT6397_INT_RSV, 0x8), + 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6397_TOP_RST_MISC, }; static const struct mtk_pmic_regs mt6323_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, - 0x2, MT6323_INT_MISC_CON, 0x10), + 0x2, MT6323_INT_MISC_CON, 0x10, MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, - 0x4, MT6323_INT_MISC_CON, 0x8), + 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6323_TOP_RST_MISC, }; static const struct mtk_pmic_regs mt6358_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, - 0x2, MT6358_PSC_TOP_INT_CON0, 0x5), + 0x2, MT6358_PSC_TOP_INT_CON0, 0x5, + MTK_PMIC_PWRKEY_RST), .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, - 0x8, MT6358_PSC_TOP_INT_CON0, 0xa), + 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, + MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6358_TOP_RST_MISC, }; @@ -104,10 +107,14 @@ enum mtk_pmic_keys_lp_mode { static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, u32 pmic_rst_reg) { + const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; u32 long_press_mode, long_press_debounce; u32 value, mask; int error; + kregs_home = keys->keys[MTK_PMIC_HOMEKEY_INDEX].regs; + kregs_pwr = keys->keys[MTK_PMIC_PWRKEY_INDEX].regs; + error = of_property_read_u32(keys->dev->of_node, "power-off-time-sec", &long_press_debounce); if (error) @@ -124,15 +131,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, switch (long_press_mode) { case LP_TWOKEY: - value |= MTK_PMIC_HOMEKEY_RST; + value |= kregs_home->rst_en_mask; fallthrough; case LP_ONEKEY: - value |= MTK_PMIC_PWRKEY_RST; + value |= kregs_pwr->rst_en_mask; fallthrough; case LP_DISABLE: - mask |= MTK_PMIC_RST_KEY_MASK; + mask |= kregs_home->rst_en_mask; + mask |= kregs_pwr->rst_en_mask; break; default: -- 2.35.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs 2022-05-24 9:35 ` AngeloGioacchino Del Regno (?) @ 2022-05-24 12:05 ` Mattijs Korpershoek -1 siblings, 0 replies; 30+ messages in thread From: Mattijs Korpershoek @ 2022-05-24 12:05 UTC (permalink / raw) To: AngeloGioacchino Del Regno, dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On mar., mai 24, 2022 at 11:35, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > Place the key bit in struct mtk_pmic_keys_regs to enhance this > driver's flexibility, in preparation for adding support for more > PMICs. > > While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as > we are now dynamically setting the keymask relatively to the keys > that are defined in the newly added rst_en_mask variable, on a > per-key basis. > > This commit brings no functional changes. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/keyboard/mtk-pmic-keys.c | 30 ++++++++++++++++---------- > 1 file changed, 19 insertions(+), 11 deletions(-) > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c > index d2f0db245ff6..2509a349a173 100644 > --- a/drivers/input/keyboard/mtk-pmic-keys.c > +++ b/drivers/input/keyboard/mtk-pmic-keys.c > @@ -20,7 +20,6 @@ > > #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) > #define MTK_PMIC_RST_DU_SHIFT 8 > -#define MTK_PMIC_RST_KEY_MASK GENMASK(6, 5) > #define MTK_PMIC_PWRKEY_RST BIT(6) > #define MTK_PMIC_HOMEKEY_RST BIT(5) > > @@ -33,15 +32,17 @@ struct mtk_pmic_keys_regs { > u32 deb_mask; > u32 intsel_reg; > u32 intsel_mask; > + u32 rst_en_mask; > }; > > #define MTK_PMIC_KEYS_REGS(_deb_reg, _deb_mask, \ > - _intsel_reg, _intsel_mask) \ > + _intsel_reg, _intsel_mask, _rst_mask) \ > { \ > .deb_reg = _deb_reg, \ > .deb_mask = _deb_mask, \ > .intsel_reg = _intsel_reg, \ > .intsel_mask = _intsel_mask, \ > + .rst_en_mask = _rst_mask, \ > } > > struct mtk_pmic_regs { > @@ -52,30 +53,32 @@ struct mtk_pmic_regs { > static const struct mtk_pmic_regs mt6397_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6397_CHRSTATUS, > - 0x8, MT6397_INT_RSV, 0x10), > + 0x8, MT6397_INT_RSV, 0x10, MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, > - 0x10, MT6397_INT_RSV, 0x8), > + 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6397_TOP_RST_MISC, > }; > > static const struct mtk_pmic_regs mt6323_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > - 0x2, MT6323_INT_MISC_CON, 0x10), > + 0x2, MT6323_INT_MISC_CON, 0x10, MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > - 0x4, MT6323_INT_MISC_CON, 0x8), > + 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6323_TOP_RST_MISC, > }; > > static const struct mtk_pmic_regs mt6358_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, > - 0x2, MT6358_PSC_TOP_INT_CON0, 0x5), > + 0x2, MT6358_PSC_TOP_INT_CON0, 0x5, > + MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, > - 0x8, MT6358_PSC_TOP_INT_CON0, 0xa), > + 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, > + MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6358_TOP_RST_MISC, > }; > > @@ -104,10 +107,14 @@ enum mtk_pmic_keys_lp_mode { > static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > u32 pmic_rst_reg) > { > + const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; > u32 long_press_mode, long_press_debounce; > u32 value, mask; > int error; > > + kregs_home = keys->keys[MTK_PMIC_HOMEKEY_INDEX].regs; > + kregs_pwr = keys->keys[MTK_PMIC_PWRKEY_INDEX].regs; > + > error = of_property_read_u32(keys->dev->of_node, "power-off-time-sec", > &long_press_debounce); > if (error) > @@ -124,15 +131,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > > switch (long_press_mode) { > case LP_TWOKEY: > - value |= MTK_PMIC_HOMEKEY_RST; > + value |= kregs_home->rst_en_mask; > fallthrough; > > case LP_ONEKEY: > - value |= MTK_PMIC_PWRKEY_RST; > + value |= kregs_pwr->rst_en_mask; > fallthrough; > > case LP_DISABLE: > - mask |= MTK_PMIC_RST_KEY_MASK; > + mask |= kregs_home->rst_en_mask; > + mask |= kregs_pwr->rst_en_mask; > break; > > default: > -- > 2.35.1 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-24 12:05 ` Mattijs Korpershoek 0 siblings, 0 replies; 30+ messages in thread From: Mattijs Korpershoek @ 2022-05-24 12:05 UTC (permalink / raw) To: AngeloGioacchino Del Regno, dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On mar., mai 24, 2022 at 11:35, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > Place the key bit in struct mtk_pmic_keys_regs to enhance this > driver's flexibility, in preparation for adding support for more > PMICs. > > While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as > we are now dynamically setting the keymask relatively to the keys > that are defined in the newly added rst_en_mask variable, on a > per-key basis. > > This commit brings no functional changes. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/keyboard/mtk-pmic-keys.c | 30 ++++++++++++++++---------- > 1 file changed, 19 insertions(+), 11 deletions(-) > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c > index d2f0db245ff6..2509a349a173 100644 > --- a/drivers/input/keyboard/mtk-pmic-keys.c > +++ b/drivers/input/keyboard/mtk-pmic-keys.c > @@ -20,7 +20,6 @@ > > #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) > #define MTK_PMIC_RST_DU_SHIFT 8 > -#define MTK_PMIC_RST_KEY_MASK GENMASK(6, 5) > #define MTK_PMIC_PWRKEY_RST BIT(6) > #define MTK_PMIC_HOMEKEY_RST BIT(5) > > @@ -33,15 +32,17 @@ struct mtk_pmic_keys_regs { > u32 deb_mask; > u32 intsel_reg; > u32 intsel_mask; > + u32 rst_en_mask; > }; > > #define MTK_PMIC_KEYS_REGS(_deb_reg, _deb_mask, \ > - _intsel_reg, _intsel_mask) \ > + _intsel_reg, _intsel_mask, _rst_mask) \ > { \ > .deb_reg = _deb_reg, \ > .deb_mask = _deb_mask, \ > .intsel_reg = _intsel_reg, \ > .intsel_mask = _intsel_mask, \ > + .rst_en_mask = _rst_mask, \ > } > > struct mtk_pmic_regs { > @@ -52,30 +53,32 @@ struct mtk_pmic_regs { > static const struct mtk_pmic_regs mt6397_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6397_CHRSTATUS, > - 0x8, MT6397_INT_RSV, 0x10), > + 0x8, MT6397_INT_RSV, 0x10, MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, > - 0x10, MT6397_INT_RSV, 0x8), > + 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6397_TOP_RST_MISC, > }; > > static const struct mtk_pmic_regs mt6323_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > - 0x2, MT6323_INT_MISC_CON, 0x10), > + 0x2, MT6323_INT_MISC_CON, 0x10, MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > - 0x4, MT6323_INT_MISC_CON, 0x8), > + 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6323_TOP_RST_MISC, > }; > > static const struct mtk_pmic_regs mt6358_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, > - 0x2, MT6358_PSC_TOP_INT_CON0, 0x5), > + 0x2, MT6358_PSC_TOP_INT_CON0, 0x5, > + MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, > - 0x8, MT6358_PSC_TOP_INT_CON0, 0xa), > + 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, > + MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6358_TOP_RST_MISC, > }; > > @@ -104,10 +107,14 @@ enum mtk_pmic_keys_lp_mode { > static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > u32 pmic_rst_reg) > { > + const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; > u32 long_press_mode, long_press_debounce; > u32 value, mask; > int error; > > + kregs_home = keys->keys[MTK_PMIC_HOMEKEY_INDEX].regs; > + kregs_pwr = keys->keys[MTK_PMIC_PWRKEY_INDEX].regs; > + > error = of_property_read_u32(keys->dev->of_node, "power-off-time-sec", > &long_press_debounce); > if (error) > @@ -124,15 +131,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > > switch (long_press_mode) { > case LP_TWOKEY: > - value |= MTK_PMIC_HOMEKEY_RST; > + value |= kregs_home->rst_en_mask; > fallthrough; > > case LP_ONEKEY: > - value |= MTK_PMIC_PWRKEY_RST; > + value |= kregs_pwr->rst_en_mask; > fallthrough; > > case LP_DISABLE: > - mask |= MTK_PMIC_RST_KEY_MASK; > + mask |= kregs_home->rst_en_mask; > + mask |= kregs_pwr->rst_en_mask; > break; > > default: > -- > 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-24 12:05 ` Mattijs Korpershoek 0 siblings, 0 replies; 30+ messages in thread From: Mattijs Korpershoek @ 2022-05-24 12:05 UTC (permalink / raw) To: AngeloGioacchino Del Regno, dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On mar., mai 24, 2022 at 11:35, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > Place the key bit in struct mtk_pmic_keys_regs to enhance this > driver's flexibility, in preparation for adding support for more > PMICs. > > While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as > we are now dynamically setting the keymask relatively to the keys > that are defined in the newly added rst_en_mask variable, on a > per-key basis. > > This commit brings no functional changes. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/keyboard/mtk-pmic-keys.c | 30 ++++++++++++++++---------- > 1 file changed, 19 insertions(+), 11 deletions(-) > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c > index d2f0db245ff6..2509a349a173 100644 > --- a/drivers/input/keyboard/mtk-pmic-keys.c > +++ b/drivers/input/keyboard/mtk-pmic-keys.c > @@ -20,7 +20,6 @@ > > #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) > #define MTK_PMIC_RST_DU_SHIFT 8 > -#define MTK_PMIC_RST_KEY_MASK GENMASK(6, 5) > #define MTK_PMIC_PWRKEY_RST BIT(6) > #define MTK_PMIC_HOMEKEY_RST BIT(5) > > @@ -33,15 +32,17 @@ struct mtk_pmic_keys_regs { > u32 deb_mask; > u32 intsel_reg; > u32 intsel_mask; > + u32 rst_en_mask; > }; > > #define MTK_PMIC_KEYS_REGS(_deb_reg, _deb_mask, \ > - _intsel_reg, _intsel_mask) \ > + _intsel_reg, _intsel_mask, _rst_mask) \ > { \ > .deb_reg = _deb_reg, \ > .deb_mask = _deb_mask, \ > .intsel_reg = _intsel_reg, \ > .intsel_mask = _intsel_mask, \ > + .rst_en_mask = _rst_mask, \ > } > > struct mtk_pmic_regs { > @@ -52,30 +53,32 @@ struct mtk_pmic_regs { > static const struct mtk_pmic_regs mt6397_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6397_CHRSTATUS, > - 0x8, MT6397_INT_RSV, 0x10), > + 0x8, MT6397_INT_RSV, 0x10, MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, > - 0x10, MT6397_INT_RSV, 0x8), > + 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6397_TOP_RST_MISC, > }; > > static const struct mtk_pmic_regs mt6323_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > - 0x2, MT6323_INT_MISC_CON, 0x10), > + 0x2, MT6323_INT_MISC_CON, 0x10, MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > - 0x4, MT6323_INT_MISC_CON, 0x8), > + 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6323_TOP_RST_MISC, > }; > > static const struct mtk_pmic_regs mt6358_regs = { > .keys_regs[MTK_PMIC_PWRKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, > - 0x2, MT6358_PSC_TOP_INT_CON0, 0x5), > + 0x2, MT6358_PSC_TOP_INT_CON0, 0x5, > + MTK_PMIC_PWRKEY_RST), > .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = > MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, > - 0x8, MT6358_PSC_TOP_INT_CON0, 0xa), > + 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, > + MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6358_TOP_RST_MISC, > }; > > @@ -104,10 +107,14 @@ enum mtk_pmic_keys_lp_mode { > static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > u32 pmic_rst_reg) > { > + const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; > u32 long_press_mode, long_press_debounce; > u32 value, mask; > int error; > > + kregs_home = keys->keys[MTK_PMIC_HOMEKEY_INDEX].regs; > + kregs_pwr = keys->keys[MTK_PMIC_PWRKEY_INDEX].regs; > + > error = of_property_read_u32(keys->dev->of_node, "power-off-time-sec", > &long_press_debounce); > if (error) > @@ -124,15 +131,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > > switch (long_press_mode) { > case LP_TWOKEY: > - value |= MTK_PMIC_HOMEKEY_RST; > + value |= kregs_home->rst_en_mask; > fallthrough; > > case LP_ONEKEY: > - value |= MTK_PMIC_PWRKEY_RST; > + value |= kregs_pwr->rst_en_mask; > fallthrough; > > case LP_DISABLE: > - mask |= MTK_PMIC_RST_KEY_MASK; > + mask |= kregs_home->rst_en_mask; > + mask |= kregs_pwr->rst_en_mask; > break; > > default: > -- > 2.35.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs 2022-05-24 9:35 ` AngeloGioacchino Del Regno (?) @ 2022-05-27 5:34 ` Dmitry Torokhov -1 siblings, 0 replies; 30+ messages in thread From: Dmitry Torokhov @ 2022-05-27 5:34 UTC (permalink / raw) To: AngeloGioacchino Del Regno Cc: matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On Tue, May 24, 2022 at 11:35:03AM +0200, AngeloGioacchino Del Regno wrote: > Place the key bit in struct mtk_pmic_keys_regs to enhance this > driver's flexibility, in preparation for adding support for more > PMICs. > > While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as > we are now dynamically setting the keymask relatively to the keys > that are defined in the newly added rst_en_mask variable, on a > per-key basis. > > This commit brings no functional changes. AngeloGioacchino, Could you please tell me if these devices (currently supported by the driver) have 2 fully independent reset settings for HOME and PWR keys, or is there are actually 2 separate bits, one to enable/disable key reset, and another controlling what keys will cause the reset - only PWR or either PWR or HOME? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-27 5:34 ` Dmitry Torokhov 0 siblings, 0 replies; 30+ messages in thread From: Dmitry Torokhov @ 2022-05-27 5:34 UTC (permalink / raw) To: AngeloGioacchino Del Regno Cc: matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On Tue, May 24, 2022 at 11:35:03AM +0200, AngeloGioacchino Del Regno wrote: > Place the key bit in struct mtk_pmic_keys_regs to enhance this > driver's flexibility, in preparation for adding support for more > PMICs. > > While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as > we are now dynamically setting the keymask relatively to the keys > that are defined in the newly added rst_en_mask variable, on a > per-key basis. > > This commit brings no functional changes. AngeloGioacchino, Could you please tell me if these devices (currently supported by the driver) have 2 fully independent reset settings for HOME and PWR keys, or is there are actually 2 separate bits, one to enable/disable key reset, and another controlling what keys will cause the reset - only PWR or either PWR or HOME? Thanks. -- Dmitry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-27 5:34 ` Dmitry Torokhov 0 siblings, 0 replies; 30+ messages in thread From: Dmitry Torokhov @ 2022-05-27 5:34 UTC (permalink / raw) To: AngeloGioacchino Del Regno Cc: matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On Tue, May 24, 2022 at 11:35:03AM +0200, AngeloGioacchino Del Regno wrote: > Place the key bit in struct mtk_pmic_keys_regs to enhance this > driver's flexibility, in preparation for adding support for more > PMICs. > > While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as > we are now dynamically setting the keymask relatively to the keys > that are defined in the newly added rst_en_mask variable, on a > per-key basis. > > This commit brings no functional changes. AngeloGioacchino, Could you please tell me if these devices (currently supported by the driver) have 2 fully independent reset settings for HOME and PWR keys, or is there are actually 2 separate bits, one to enable/disable key reset, and another controlling what keys will cause the reset - only PWR or either PWR or HOME? Thanks. -- Dmitry _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs 2022-05-27 5:34 ` Dmitry Torokhov (?) @ 2022-05-30 9:00 ` AngeloGioacchino Del Regno -1 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-30 9:00 UTC (permalink / raw) To: Dmitry Torokhov Cc: matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Il 27/05/22 07:34, Dmitry Torokhov ha scritto: > On Tue, May 24, 2022 at 11:35:03AM +0200, AngeloGioacchino Del Regno wrote: >> Place the key bit in struct mtk_pmic_keys_regs to enhance this >> driver's flexibility, in preparation for adding support for more >> PMICs. >> >> While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as >> we are now dynamically setting the keymask relatively to the keys >> that are defined in the newly added rst_en_mask variable, on a >> per-key basis. >> >> This commit brings no functional changes. > > AngeloGioacchino, > > Could you please tell me if these devices (currently supported by the > driver) have 2 fully independent reset settings for HOME and PWR keys, > or is there are actually 2 separate bits, one to enable/disable key > reset, and another controlling what keys will cause the reset - only PWR > or either PWR or HOME? > > Thanks. > Hello Dmitry, there are two separate bits for the "Long Press Reset", you can achieve reset with either holding the power button, volume up button (register name is HOMEKEY because on very old devices this was a "home" button), or both - for a certain amount of time. If both {HOME,PWR}KEY_RST_EN bits are *not set*, the long press reset PMIC trigger will be disabled. Long-press time is controlled with the RST_DU register. Regards, Angelo ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-30 9:00 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-30 9:00 UTC (permalink / raw) To: Dmitry Torokhov Cc: matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Il 27/05/22 07:34, Dmitry Torokhov ha scritto: > On Tue, May 24, 2022 at 11:35:03AM +0200, AngeloGioacchino Del Regno wrote: >> Place the key bit in struct mtk_pmic_keys_regs to enhance this >> driver's flexibility, in preparation for adding support for more >> PMICs. >> >> While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as >> we are now dynamically setting the keymask relatively to the keys >> that are defined in the newly added rst_en_mask variable, on a >> per-key basis. >> >> This commit brings no functional changes. > > AngeloGioacchino, > > Could you please tell me if these devices (currently supported by the > driver) have 2 fully independent reset settings for HOME and PWR keys, > or is there are actually 2 separate bits, one to enable/disable key > reset, and another controlling what keys will cause the reset - only PWR > or either PWR or HOME? > > Thanks. > Hello Dmitry, there are two separate bits for the "Long Press Reset", you can achieve reset with either holding the power button, volume up button (register name is HOMEKEY because on very old devices this was a "home" button), or both - for a certain amount of time. If both {HOME,PWR}KEY_RST_EN bits are *not set*, the long press reset PMIC trigger will be disabled. Long-press time is controlled with the RST_DU register. Regards, Angelo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs @ 2022-05-30 9:00 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-30 9:00 UTC (permalink / raw) To: Dmitry Torokhov Cc: matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Il 27/05/22 07:34, Dmitry Torokhov ha scritto: > On Tue, May 24, 2022 at 11:35:03AM +0200, AngeloGioacchino Del Regno wrote: >> Place the key bit in struct mtk_pmic_keys_regs to enhance this >> driver's flexibility, in preparation for adding support for more >> PMICs. >> >> While at it, remove the definition of MTK_PMIC_RST_KEY_MASK as >> we are now dynamically setting the keymask relatively to the keys >> that are defined in the newly added rst_en_mask variable, on a >> per-key basis. >> >> This commit brings no functional changes. > > AngeloGioacchino, > > Could you please tell me if these devices (currently supported by the > driver) have 2 fully independent reset settings for HOME and PWR keys, > or is there are actually 2 separate bits, one to enable/disable key > reset, and another controlling what keys will cause the reset - only PWR > or either PWR or HOME? > > Thanks. > Hello Dmitry, there are two separate bits for the "Long Press Reset", you can achieve reset with either holding the power button, volume up button (register name is HOMEKEY because on very old devices this was a "home" button), or both - for a certain amount of time. If both {HOME,PWR}KEY_RST_EN bits are *not set*, the long press reset PMIC trigger will be disabled. Long-press time is controlled with the RST_DU register. Regards, Angelo _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 2/3] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs 2022-05-24 9:35 ` AngeloGioacchino Del Regno (?) @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno -1 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel As the second and last step of preparation to add support for more PMICs in this driver, move the long press debounce mask to struct mtk_pmic_regs and use that in mtk_pmic_keys_lp_reset_setup() instead of directly using the definition. While at it, remove the definition for MTK_PMIC_RST_DU_SHIFT as we are able to calculate it dynamically and spares us some unnecessary new definitions around for future per-PMIC variations of RST_DU_MASK. Lastly, it was necessary to change the function signature of mtk_pmic_keys_lp_reset_setup() to now pass a pointer to the main mtk_pmic_regs structure, since that's where the reset debounce mask now resides. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 2509a349a173..6404081253ea 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -19,7 +19,6 @@ #include <linux/regmap.h> #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) -#define MTK_PMIC_RST_DU_SHIFT 8 #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) @@ -48,6 +47,7 @@ struct mtk_pmic_keys_regs { struct mtk_pmic_regs { const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT]; u32 pmic_rst_reg; + u32 rst_lprst_mask; /* Long-press reset timeout bitmask */ }; static const struct mtk_pmic_regs mt6397_regs = { @@ -58,6 +58,7 @@ static const struct mtk_pmic_regs mt6397_regs = { MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6397_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; static const struct mtk_pmic_regs mt6323_regs = { @@ -68,6 +69,7 @@ static const struct mtk_pmic_regs mt6323_regs = { MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6323_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; static const struct mtk_pmic_regs mt6358_regs = { @@ -80,6 +82,7 @@ static const struct mtk_pmic_regs mt6358_regs = { 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6358_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; struct mtk_pmic_keys_info { @@ -105,7 +108,7 @@ enum mtk_pmic_keys_lp_mode { }; static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, - u32 pmic_rst_reg) + const struct mtk_pmic_regs *regs) { const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; u32 long_press_mode, long_press_debounce; @@ -120,8 +123,8 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, if (error) long_press_debounce = 0; - mask = MTK_PMIC_RST_DU_MASK; - value = long_press_debounce << MTK_PMIC_RST_DU_SHIFT; + mask = regs->rst_lprst_mask; + value = long_press_debounce << (ffs(regs->rst_lprst_mask) - 1); error = of_property_read_u32(keys->dev->of_node, "mediatek,long-press-mode", @@ -147,7 +150,7 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, break; } - regmap_update_bits(keys->regmap, pmic_rst_reg, mask, value); + regmap_update_bits(keys->regmap, regs->pmic_rst_reg, mask, value); } static irqreturn_t mtk_pmic_keys_irq_handler_thread(int irq, void *data) @@ -351,7 +354,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) return error; } - mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs->pmic_rst_reg); + mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs); platform_set_drvdata(pdev, keys); -- 2.35.1 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 2/3] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel As the second and last step of preparation to add support for more PMICs in this driver, move the long press debounce mask to struct mtk_pmic_regs and use that in mtk_pmic_keys_lp_reset_setup() instead of directly using the definition. While at it, remove the definition for MTK_PMIC_RST_DU_SHIFT as we are able to calculate it dynamically and spares us some unnecessary new definitions around for future per-PMIC variations of RST_DU_MASK. Lastly, it was necessary to change the function signature of mtk_pmic_keys_lp_reset_setup() to now pass a pointer to the main mtk_pmic_regs structure, since that's where the reset debounce mask now resides. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 2509a349a173..6404081253ea 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -19,7 +19,6 @@ #include <linux/regmap.h> #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) -#define MTK_PMIC_RST_DU_SHIFT 8 #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) @@ -48,6 +47,7 @@ struct mtk_pmic_keys_regs { struct mtk_pmic_regs { const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT]; u32 pmic_rst_reg; + u32 rst_lprst_mask; /* Long-press reset timeout bitmask */ }; static const struct mtk_pmic_regs mt6397_regs = { @@ -58,6 +58,7 @@ static const struct mtk_pmic_regs mt6397_regs = { MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6397_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; static const struct mtk_pmic_regs mt6323_regs = { @@ -68,6 +69,7 @@ static const struct mtk_pmic_regs mt6323_regs = { MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6323_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; static const struct mtk_pmic_regs mt6358_regs = { @@ -80,6 +82,7 @@ static const struct mtk_pmic_regs mt6358_regs = { 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6358_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; struct mtk_pmic_keys_info { @@ -105,7 +108,7 @@ enum mtk_pmic_keys_lp_mode { }; static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, - u32 pmic_rst_reg) + const struct mtk_pmic_regs *regs) { const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; u32 long_press_mode, long_press_debounce; @@ -120,8 +123,8 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, if (error) long_press_debounce = 0; - mask = MTK_PMIC_RST_DU_MASK; - value = long_press_debounce << MTK_PMIC_RST_DU_SHIFT; + mask = regs->rst_lprst_mask; + value = long_press_debounce << (ffs(regs->rst_lprst_mask) - 1); error = of_property_read_u32(keys->dev->of_node, "mediatek,long-press-mode", @@ -147,7 +150,7 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, break; } - regmap_update_bits(keys->regmap, pmic_rst_reg, mask, value); + regmap_update_bits(keys->regmap, regs->pmic_rst_reg, mask, value); } static irqreturn_t mtk_pmic_keys_irq_handler_thread(int irq, void *data) @@ -351,7 +354,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) return error; } - mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs->pmic_rst_reg); + mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs); platform_set_drvdata(pdev, keys); -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 2/3] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel As the second and last step of preparation to add support for more PMICs in this driver, move the long press debounce mask to struct mtk_pmic_regs and use that in mtk_pmic_keys_lp_reset_setup() instead of directly using the definition. While at it, remove the definition for MTK_PMIC_RST_DU_SHIFT as we are able to calculate it dynamically and spares us some unnecessary new definitions around for future per-PMIC variations of RST_DU_MASK. Lastly, it was necessary to change the function signature of mtk_pmic_keys_lp_reset_setup() to now pass a pointer to the main mtk_pmic_regs structure, since that's where the reset debounce mask now resides. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 2509a349a173..6404081253ea 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -19,7 +19,6 @@ #include <linux/regmap.h> #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) -#define MTK_PMIC_RST_DU_SHIFT 8 #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) @@ -48,6 +47,7 @@ struct mtk_pmic_keys_regs { struct mtk_pmic_regs { const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT]; u32 pmic_rst_reg; + u32 rst_lprst_mask; /* Long-press reset timeout bitmask */ }; static const struct mtk_pmic_regs mt6397_regs = { @@ -58,6 +58,7 @@ static const struct mtk_pmic_regs mt6397_regs = { MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6397_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; static const struct mtk_pmic_regs mt6323_regs = { @@ -68,6 +69,7 @@ static const struct mtk_pmic_regs mt6323_regs = { MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6323_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; static const struct mtk_pmic_regs mt6358_regs = { @@ -80,6 +82,7 @@ static const struct mtk_pmic_regs mt6358_regs = { 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, MTK_PMIC_HOMEKEY_RST), .pmic_rst_reg = MT6358_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; struct mtk_pmic_keys_info { @@ -105,7 +108,7 @@ enum mtk_pmic_keys_lp_mode { }; static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, - u32 pmic_rst_reg) + const struct mtk_pmic_regs *regs) { const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; u32 long_press_mode, long_press_debounce; @@ -120,8 +123,8 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, if (error) long_press_debounce = 0; - mask = MTK_PMIC_RST_DU_MASK; - value = long_press_debounce << MTK_PMIC_RST_DU_SHIFT; + mask = regs->rst_lprst_mask; + value = long_press_debounce << (ffs(regs->rst_lprst_mask) - 1); error = of_property_read_u32(keys->dev->of_node, "mediatek,long-press-mode", @@ -147,7 +150,7 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, break; } - regmap_update_bits(keys->regmap, pmic_rst_reg, mask, value); + regmap_update_bits(keys->regmap, regs->pmic_rst_reg, mask, value); } static irqreturn_t mtk_pmic_keys_irq_handler_thread(int irq, void *data) @@ -351,7 +354,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) return error; } - mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs->pmic_rst_reg); + mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs); platform_set_drvdata(pdev, keys); -- 2.35.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v2 2/3] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs 2022-05-24 9:35 ` AngeloGioacchino Del Regno (?) @ 2022-05-24 12:05 ` Mattijs Korpershoek -1 siblings, 0 replies; 30+ messages in thread From: Mattijs Korpershoek @ 2022-05-24 12:05 UTC (permalink / raw) To: AngeloGioacchino Del Regno, dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On mar., mai 24, 2022 at 11:35, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > As the second and last step of preparation to add support for more > PMICs in this driver, move the long press debounce mask to struct > mtk_pmic_regs and use that in mtk_pmic_keys_lp_reset_setup() instead > of directly using the definition. > > While at it, remove the definition for MTK_PMIC_RST_DU_SHIFT as we > are able to calculate it dynamically and spares us some unnecessary > new definitions around for future per-PMIC variations of RST_DU_MASK. > > Lastly, it was necessary to change the function signature of > mtk_pmic_keys_lp_reset_setup() to now pass a pointer to the main > mtk_pmic_regs structure, since that's where the reset debounce > mask now resides. > > This commit brings no functional changes. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/keyboard/mtk-pmic-keys.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c > index 2509a349a173..6404081253ea 100644 > --- a/drivers/input/keyboard/mtk-pmic-keys.c > +++ b/drivers/input/keyboard/mtk-pmic-keys.c > @@ -19,7 +19,6 @@ > #include <linux/regmap.h> > > #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) > -#define MTK_PMIC_RST_DU_SHIFT 8 > #define MTK_PMIC_PWRKEY_RST BIT(6) > #define MTK_PMIC_HOMEKEY_RST BIT(5) > > @@ -48,6 +47,7 @@ struct mtk_pmic_keys_regs { > struct mtk_pmic_regs { > const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT]; > u32 pmic_rst_reg; > + u32 rst_lprst_mask; /* Long-press reset timeout bitmask */ > }; > > static const struct mtk_pmic_regs mt6397_regs = { > @@ -58,6 +58,7 @@ static const struct mtk_pmic_regs mt6397_regs = { > MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, > 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6397_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > static const struct mtk_pmic_regs mt6323_regs = { > @@ -68,6 +69,7 @@ static const struct mtk_pmic_regs mt6323_regs = { > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6323_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > static const struct mtk_pmic_regs mt6358_regs = { > @@ -80,6 +82,7 @@ static const struct mtk_pmic_regs mt6358_regs = { > 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, > MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6358_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > struct mtk_pmic_keys_info { > @@ -105,7 +108,7 @@ enum mtk_pmic_keys_lp_mode { > }; > > static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > - u32 pmic_rst_reg) > + const struct mtk_pmic_regs *regs) > { > const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; > u32 long_press_mode, long_press_debounce; > @@ -120,8 +123,8 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > if (error) > long_press_debounce = 0; > > - mask = MTK_PMIC_RST_DU_MASK; > - value = long_press_debounce << MTK_PMIC_RST_DU_SHIFT; > + mask = regs->rst_lprst_mask; > + value = long_press_debounce << (ffs(regs->rst_lprst_mask) - 1); > > error = of_property_read_u32(keys->dev->of_node, > "mediatek,long-press-mode", > @@ -147,7 +150,7 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > break; > } > > - regmap_update_bits(keys->regmap, pmic_rst_reg, mask, value); > + regmap_update_bits(keys->regmap, regs->pmic_rst_reg, mask, value); > } > > static irqreturn_t mtk_pmic_keys_irq_handler_thread(int irq, void *data) > @@ -351,7 +354,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) > return error; > } > > - mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs->pmic_rst_reg); > + mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs); > > platform_set_drvdata(pdev, keys); > > -- > 2.35.1 ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 2/3] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs @ 2022-05-24 12:05 ` Mattijs Korpershoek 0 siblings, 0 replies; 30+ messages in thread From: Mattijs Korpershoek @ 2022-05-24 12:05 UTC (permalink / raw) To: AngeloGioacchino Del Regno, dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On mar., mai 24, 2022 at 11:35, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > As the second and last step of preparation to add support for more > PMICs in this driver, move the long press debounce mask to struct > mtk_pmic_regs and use that in mtk_pmic_keys_lp_reset_setup() instead > of directly using the definition. > > While at it, remove the definition for MTK_PMIC_RST_DU_SHIFT as we > are able to calculate it dynamically and spares us some unnecessary > new definitions around for future per-PMIC variations of RST_DU_MASK. > > Lastly, it was necessary to change the function signature of > mtk_pmic_keys_lp_reset_setup() to now pass a pointer to the main > mtk_pmic_regs structure, since that's where the reset debounce > mask now resides. > > This commit brings no functional changes. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/keyboard/mtk-pmic-keys.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c > index 2509a349a173..6404081253ea 100644 > --- a/drivers/input/keyboard/mtk-pmic-keys.c > +++ b/drivers/input/keyboard/mtk-pmic-keys.c > @@ -19,7 +19,6 @@ > #include <linux/regmap.h> > > #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) > -#define MTK_PMIC_RST_DU_SHIFT 8 > #define MTK_PMIC_PWRKEY_RST BIT(6) > #define MTK_PMIC_HOMEKEY_RST BIT(5) > > @@ -48,6 +47,7 @@ struct mtk_pmic_keys_regs { > struct mtk_pmic_regs { > const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT]; > u32 pmic_rst_reg; > + u32 rst_lprst_mask; /* Long-press reset timeout bitmask */ > }; > > static const struct mtk_pmic_regs mt6397_regs = { > @@ -58,6 +58,7 @@ static const struct mtk_pmic_regs mt6397_regs = { > MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, > 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6397_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > static const struct mtk_pmic_regs mt6323_regs = { > @@ -68,6 +69,7 @@ static const struct mtk_pmic_regs mt6323_regs = { > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6323_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > static const struct mtk_pmic_regs mt6358_regs = { > @@ -80,6 +82,7 @@ static const struct mtk_pmic_regs mt6358_regs = { > 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, > MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6358_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > struct mtk_pmic_keys_info { > @@ -105,7 +108,7 @@ enum mtk_pmic_keys_lp_mode { > }; > > static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > - u32 pmic_rst_reg) > + const struct mtk_pmic_regs *regs) > { > const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; > u32 long_press_mode, long_press_debounce; > @@ -120,8 +123,8 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > if (error) > long_press_debounce = 0; > > - mask = MTK_PMIC_RST_DU_MASK; > - value = long_press_debounce << MTK_PMIC_RST_DU_SHIFT; > + mask = regs->rst_lprst_mask; > + value = long_press_debounce << (ffs(regs->rst_lprst_mask) - 1); > > error = of_property_read_u32(keys->dev->of_node, > "mediatek,long-press-mode", > @@ -147,7 +150,7 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > break; > } > > - regmap_update_bits(keys->regmap, pmic_rst_reg, mask, value); > + regmap_update_bits(keys->regmap, regs->pmic_rst_reg, mask, value); > } > > static irqreturn_t mtk_pmic_keys_irq_handler_thread(int irq, void *data) > @@ -351,7 +354,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) > return error; > } > > - mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs->pmic_rst_reg); > + mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs); > > platform_set_drvdata(pdev, keys); > > -- > 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 2/3] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs @ 2022-05-24 12:05 ` Mattijs Korpershoek 0 siblings, 0 replies; 30+ messages in thread From: Mattijs Korpershoek @ 2022-05-24 12:05 UTC (permalink / raw) To: AngeloGioacchino Del Regno, dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel On mar., mai 24, 2022 at 11:35, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > As the second and last step of preparation to add support for more > PMICs in this driver, move the long press debounce mask to struct > mtk_pmic_regs and use that in mtk_pmic_keys_lp_reset_setup() instead > of directly using the definition. > > While at it, remove the definition for MTK_PMIC_RST_DU_SHIFT as we > are able to calculate it dynamically and spares us some unnecessary > new definitions around for future per-PMIC variations of RST_DU_MASK. > > Lastly, it was necessary to change the function signature of > mtk_pmic_keys_lp_reset_setup() to now pass a pointer to the main > mtk_pmic_regs structure, since that's where the reset debounce > mask now resides. > > This commit brings no functional changes. > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/keyboard/mtk-pmic-keys.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c > index 2509a349a173..6404081253ea 100644 > --- a/drivers/input/keyboard/mtk-pmic-keys.c > +++ b/drivers/input/keyboard/mtk-pmic-keys.c > @@ -19,7 +19,6 @@ > #include <linux/regmap.h> > > #define MTK_PMIC_RST_DU_MASK GENMASK(9, 8) > -#define MTK_PMIC_RST_DU_SHIFT 8 > #define MTK_PMIC_PWRKEY_RST BIT(6) > #define MTK_PMIC_HOMEKEY_RST BIT(5) > > @@ -48,6 +47,7 @@ struct mtk_pmic_keys_regs { > struct mtk_pmic_regs { > const struct mtk_pmic_keys_regs keys_regs[MTK_PMIC_MAX_KEY_COUNT]; > u32 pmic_rst_reg; > + u32 rst_lprst_mask; /* Long-press reset timeout bitmask */ > }; > > static const struct mtk_pmic_regs mt6397_regs = { > @@ -58,6 +58,7 @@ static const struct mtk_pmic_regs mt6397_regs = { > MTK_PMIC_KEYS_REGS(MT6397_OCSTATUS2, > 0x10, MT6397_INT_RSV, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6397_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > static const struct mtk_pmic_regs mt6323_regs = { > @@ -68,6 +69,7 @@ static const struct mtk_pmic_regs mt6323_regs = { > MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS, > 0x4, MT6323_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6323_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > static const struct mtk_pmic_regs mt6358_regs = { > @@ -80,6 +82,7 @@ static const struct mtk_pmic_regs mt6358_regs = { > 0x8, MT6358_PSC_TOP_INT_CON0, 0xa, > MTK_PMIC_HOMEKEY_RST), > .pmic_rst_reg = MT6358_TOP_RST_MISC, > + .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, > }; > > struct mtk_pmic_keys_info { > @@ -105,7 +108,7 @@ enum mtk_pmic_keys_lp_mode { > }; > > static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > - u32 pmic_rst_reg) > + const struct mtk_pmic_regs *regs) > { > const struct mtk_pmic_keys_regs *kregs_home, *kregs_pwr; > u32 long_press_mode, long_press_debounce; > @@ -120,8 +123,8 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > if (error) > long_press_debounce = 0; > > - mask = MTK_PMIC_RST_DU_MASK; > - value = long_press_debounce << MTK_PMIC_RST_DU_SHIFT; > + mask = regs->rst_lprst_mask; > + value = long_press_debounce << (ffs(regs->rst_lprst_mask) - 1); > > error = of_property_read_u32(keys->dev->of_node, > "mediatek,long-press-mode", > @@ -147,7 +150,7 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys, > break; > } > > - regmap_update_bits(keys->regmap, pmic_rst_reg, mask, value); > + regmap_update_bits(keys->regmap, regs->pmic_rst_reg, mask, value); > } > > static irqreturn_t mtk_pmic_keys_irq_handler_thread(int irq, void *data) > @@ -351,7 +354,7 @@ static int mtk_pmic_keys_probe(struct platform_device *pdev) > return error; > } > > - mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs->pmic_rst_reg); > + mtk_pmic_keys_lp_reset_setup(keys, mtk_pmic_regs); > > platform_set_drvdata(pdev, keys); > > -- > 2.35.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v2 3/3] Input: mtk-pmic-keys - Add support for MT6331 PMIC keys 2022-05-24 9:35 ` AngeloGioacchino Del Regno (?) @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno -1 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Add support for PMIC Keys of the MT6331 PMIC. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 6404081253ea..9b34da0ec260 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -9,6 +9,7 @@ #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mfd/mt6323/registers.h> +#include <linux/mfd/mt6331/registers.h> #include <linux/mfd/mt6358/registers.h> #include <linux/mfd/mt6397/core.h> #include <linux/mfd/mt6397/registers.h> @@ -22,6 +23,10 @@ #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) +#define MTK_PMIC_MT6331_RST_DU_MASK GENMASK(13, 12) +#define MTK_PMIC_MT6331_PWRKEY_RST BIT(9) +#define MTK_PMIC_MT6331_HOMEKEY_RST BIT(8) + #define MTK_PMIC_PWRKEY_INDEX 0 #define MTK_PMIC_HOMEKEY_INDEX 1 #define MTK_PMIC_MAX_KEY_COUNT 2 @@ -72,6 +77,19 @@ static const struct mtk_pmic_regs mt6323_regs = { .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; +static const struct mtk_pmic_regs mt6331_regs = { + .keys_regs[MTK_PMIC_PWRKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6331_TOPSTATUS, 0x2, + MT6331_INT_MISC_CON, 0x4, + MTK_PMIC_MT6331_PWRKEY_RST), + .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6331_TOPSTATUS, 0x4, + MT6331_INT_MISC_CON, 0x2, + MTK_PMIC_MT6331_HOMEKEY_RST), + .pmic_rst_reg = MT6331_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_MT6331_RST_DU_MASK, +}; + static const struct mtk_pmic_regs mt6358_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, @@ -255,6 +273,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = { }, { .compatible = "mediatek,mt6323-keys", .data = &mt6323_regs, + }, { + .compatible = "mediatek,mt6331-keys", + .data = &mt6331_regs, }, { .compatible = "mediatek,mt6358-keys", .data = &mt6358_regs, -- 2.35.1 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 3/3] Input: mtk-pmic-keys - Add support for MT6331 PMIC keys @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Add support for PMIC Keys of the MT6331 PMIC. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 6404081253ea..9b34da0ec260 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -9,6 +9,7 @@ #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mfd/mt6323/registers.h> +#include <linux/mfd/mt6331/registers.h> #include <linux/mfd/mt6358/registers.h> #include <linux/mfd/mt6397/core.h> #include <linux/mfd/mt6397/registers.h> @@ -22,6 +23,10 @@ #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) +#define MTK_PMIC_MT6331_RST_DU_MASK GENMASK(13, 12) +#define MTK_PMIC_MT6331_PWRKEY_RST BIT(9) +#define MTK_PMIC_MT6331_HOMEKEY_RST BIT(8) + #define MTK_PMIC_PWRKEY_INDEX 0 #define MTK_PMIC_HOMEKEY_INDEX 1 #define MTK_PMIC_MAX_KEY_COUNT 2 @@ -72,6 +77,19 @@ static const struct mtk_pmic_regs mt6323_regs = { .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; +static const struct mtk_pmic_regs mt6331_regs = { + .keys_regs[MTK_PMIC_PWRKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6331_TOPSTATUS, 0x2, + MT6331_INT_MISC_CON, 0x4, + MTK_PMIC_MT6331_PWRKEY_RST), + .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6331_TOPSTATUS, 0x4, + MT6331_INT_MISC_CON, 0x2, + MTK_PMIC_MT6331_HOMEKEY_RST), + .pmic_rst_reg = MT6331_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_MT6331_RST_DU_MASK, +}; + static const struct mtk_pmic_regs mt6358_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, @@ -255,6 +273,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = { }, { .compatible = "mediatek,mt6323-keys", .data = &mt6323_regs, + }, { + .compatible = "mediatek,mt6331-keys", + .data = &mt6331_regs, }, { .compatible = "mediatek,mt6358-keys", .data = &mt6358_regs, -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH v2 3/3] Input: mtk-pmic-keys - Add support for MT6331 PMIC keys @ 2022-05-24 9:35 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-24 9:35 UTC (permalink / raw) To: dmitry.torokhov Cc: matthias.bgg, angelogioacchino.delregno, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Add support for PMIC Keys of the MT6331 PMIC. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> --- drivers/input/keyboard/mtk-pmic-keys.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c index 6404081253ea..9b34da0ec260 100644 --- a/drivers/input/keyboard/mtk-pmic-keys.c +++ b/drivers/input/keyboard/mtk-pmic-keys.c @@ -9,6 +9,7 @@ #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mfd/mt6323/registers.h> +#include <linux/mfd/mt6331/registers.h> #include <linux/mfd/mt6358/registers.h> #include <linux/mfd/mt6397/core.h> #include <linux/mfd/mt6397/registers.h> @@ -22,6 +23,10 @@ #define MTK_PMIC_PWRKEY_RST BIT(6) #define MTK_PMIC_HOMEKEY_RST BIT(5) +#define MTK_PMIC_MT6331_RST_DU_MASK GENMASK(13, 12) +#define MTK_PMIC_MT6331_PWRKEY_RST BIT(9) +#define MTK_PMIC_MT6331_HOMEKEY_RST BIT(8) + #define MTK_PMIC_PWRKEY_INDEX 0 #define MTK_PMIC_HOMEKEY_INDEX 1 #define MTK_PMIC_MAX_KEY_COUNT 2 @@ -72,6 +77,19 @@ static const struct mtk_pmic_regs mt6323_regs = { .rst_lprst_mask = MTK_PMIC_RST_DU_MASK, }; +static const struct mtk_pmic_regs mt6331_regs = { + .keys_regs[MTK_PMIC_PWRKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6331_TOPSTATUS, 0x2, + MT6331_INT_MISC_CON, 0x4, + MTK_PMIC_MT6331_PWRKEY_RST), + .keys_regs[MTK_PMIC_HOMEKEY_INDEX] = + MTK_PMIC_KEYS_REGS(MT6331_TOPSTATUS, 0x4, + MT6331_INT_MISC_CON, 0x2, + MTK_PMIC_MT6331_HOMEKEY_RST), + .pmic_rst_reg = MT6331_TOP_RST_MISC, + .rst_lprst_mask = MTK_PMIC_MT6331_RST_DU_MASK, +}; + static const struct mtk_pmic_regs mt6358_regs = { .keys_regs[MTK_PMIC_PWRKEY_INDEX] = MTK_PMIC_KEYS_REGS(MT6358_TOPSTATUS, @@ -255,6 +273,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = { }, { .compatible = "mediatek,mt6323-keys", .data = &mt6323_regs, + }, { + .compatible = "mediatek,mt6331-keys", + .data = &mt6331_regs, }, { .compatible = "mediatek,mt6358-keys", .data = &mt6358_regs, -- 2.35.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys 2022-05-24 9:35 ` AngeloGioacchino Del Regno (?) @ 2022-05-26 11:08 ` Pavel Machek -1 siblings, 0 replies; 30+ messages in thread From: Pavel Machek @ 2022-05-26 11:08 UTC (permalink / raw) To: AngeloGioacchino Del Regno Cc: dmitry.torokhov, matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Hi! > In an effort to give some love to the apparently forgotten MT6795 SoC, > I am upstreaming more components that are necessary to support platforms > powered by this one apart from a simple boot to serial console. > > This series performs some cleanups in mtk-pmic-keys and adds support for > the MT6331 PMIC's keys. > > Adding support to each driver in each subsystem is done in different > patch series as to avoid spamming uninteresting patches to maintainers. > > This series depends on another two series series [1], [2] named > "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and > "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" > > Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. Please cc phone-devel with phone stuff... ...and thanks for all the work. I guess we still don't have an android phone with basic phone functionality working on mainline...? Best regards, Pavel -- ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys @ 2022-05-26 11:08 ` Pavel Machek 0 siblings, 0 replies; 30+ messages in thread From: Pavel Machek @ 2022-05-26 11:08 UTC (permalink / raw) To: AngeloGioacchino Del Regno Cc: dmitry.torokhov, matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Hi! > In an effort to give some love to the apparently forgotten MT6795 SoC, > I am upstreaming more components that are necessary to support platforms > powered by this one apart from a simple boot to serial console. > > This series performs some cleanups in mtk-pmic-keys and adds support for > the MT6331 PMIC's keys. > > Adding support to each driver in each subsystem is done in different > patch series as to avoid spamming uninteresting patches to maintainers. > > This series depends on another two series series [1], [2] named > "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and > "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" > > Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. Please cc phone-devel with phone stuff... ...and thanks for all the work. I guess we still don't have an android phone with basic phone functionality working on mainline...? Best regards, Pavel -- _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys @ 2022-05-26 11:08 ` Pavel Machek 0 siblings, 0 replies; 30+ messages in thread From: Pavel Machek @ 2022-05-26 11:08 UTC (permalink / raw) To: AngeloGioacchino Del Regno Cc: dmitry.torokhov, matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Hi! > In an effort to give some love to the apparently forgotten MT6795 SoC, > I am upstreaming more components that are necessary to support platforms > powered by this one apart from a simple boot to serial console. > > This series performs some cleanups in mtk-pmic-keys and adds support for > the MT6331 PMIC's keys. > > Adding support to each driver in each subsystem is done in different > patch series as to avoid spamming uninteresting patches to maintainers. > > This series depends on another two series series [1], [2] named > "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and > "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" > > Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. Please cc phone-devel with phone stuff... ...and thanks for all the work. I guess we still don't have an android phone with basic phone functionality working on mainline...? Best regards, Pavel -- _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys 2022-05-26 11:08 ` Pavel Machek (?) @ 2022-05-30 9:47 ` AngeloGioacchino Del Regno -1 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-30 9:47 UTC (permalink / raw) To: Pavel Machek Cc: dmitry.torokhov, matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Il 26/05/22 13:08, Pavel Machek ha scritto: > Hi! > >> In an effort to give some love to the apparently forgotten MT6795 SoC, >> I am upstreaming more components that are necessary to support platforms >> powered by this one apart from a simple boot to serial console. >> >> This series performs some cleanups in mtk-pmic-keys and adds support for >> the MT6331 PMIC's keys. >> >> Adding support to each driver in each subsystem is done in different >> patch series as to avoid spamming uninteresting patches to maintainers. >> >> This series depends on another two series series [1], [2] named >> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and >> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" >> >> Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. > > Please cc phone-devel with phone stuff... > > ...and thanks for all the work. I guess we still don't have an android > phone with basic phone functionality working on mainline...? > > Best regards, > Pavel Hello Pavel, I'm sorry, I've been sending a lot of things lately and I forgot to add that list to the Cc on some series... Btw, we don't have any MediaTek android phone working at all on mainline: the one that I'm in the process of upstreaming would be the first one ever, the hope is that doing this will encourage other developers to do the same with other platforms. Speaking of them all... I don't think that there's any retail smartphone that comes with Android having any phone call ability... I'm aware of some Qualcomm smartphones being able to use mobile data and SMS, but no calling. Unless anything changed and unless I'm unaware of recent developments. Aside from that, MediaTek chips should be a little simpler in this regard, so I think that we can (and I would love to) get that working, so that smartphones can still be smart -- phones -- on mainline as well... but I have a hunch that this will require quite some time. Regards, Angelo ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys @ 2022-05-30 9:47 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-30 9:47 UTC (permalink / raw) To: Pavel Machek Cc: dmitry.torokhov, matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Il 26/05/22 13:08, Pavel Machek ha scritto: > Hi! > >> In an effort to give some love to the apparently forgotten MT6795 SoC, >> I am upstreaming more components that are necessary to support platforms >> powered by this one apart from a simple boot to serial console. >> >> This series performs some cleanups in mtk-pmic-keys and adds support for >> the MT6331 PMIC's keys. >> >> Adding support to each driver in each subsystem is done in different >> patch series as to avoid spamming uninteresting patches to maintainers. >> >> This series depends on another two series series [1], [2] named >> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and >> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" >> >> Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. > > Please cc phone-devel with phone stuff... > > ...and thanks for all the work. I guess we still don't have an android > phone with basic phone functionality working on mainline...? > > Best regards, > Pavel Hello Pavel, I'm sorry, I've been sending a lot of things lately and I forgot to add that list to the Cc on some series... Btw, we don't have any MediaTek android phone working at all on mainline: the one that I'm in the process of upstreaming would be the first one ever, the hope is that doing this will encourage other developers to do the same with other platforms. Speaking of them all... I don't think that there's any retail smartphone that comes with Android having any phone call ability... I'm aware of some Qualcomm smartphones being able to use mobile data and SMS, but no calling. Unless anything changed and unless I'm unaware of recent developments. Aside from that, MediaTek chips should be a little simpler in this regard, so I think that we can (and I would love to) get that working, so that smartphones can still be smart -- phones -- on mainline as well... but I have a hunch that this will require quite some time. Regards, Angelo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys @ 2022-05-30 9:47 ` AngeloGioacchino Del Regno 0 siblings, 0 replies; 30+ messages in thread From: AngeloGioacchino Del Regno @ 2022-05-30 9:47 UTC (permalink / raw) To: Pavel Machek Cc: dmitry.torokhov, matthias.bgg, mkorpershoek, linux-input, linux-arm-kernel, linux-mediatek, linux-kernel Il 26/05/22 13:08, Pavel Machek ha scritto: > Hi! > >> In an effort to give some love to the apparently forgotten MT6795 SoC, >> I am upstreaming more components that are necessary to support platforms >> powered by this one apart from a simple boot to serial console. >> >> This series performs some cleanups in mtk-pmic-keys and adds support for >> the MT6331 PMIC's keys. >> >> Adding support to each driver in each subsystem is done in different >> patch series as to avoid spamming uninteresting patches to maintainers. >> >> This series depends on another two series series [1], [2] named >> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper" and >> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration" >> >> Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone. > > Please cc phone-devel with phone stuff... > > ...and thanks for all the work. I guess we still don't have an android > phone with basic phone functionality working on mainline...? > > Best regards, > Pavel Hello Pavel, I'm sorry, I've been sending a lot of things lately and I forgot to add that list to the Cc on some series... Btw, we don't have any MediaTek android phone working at all on mainline: the one that I'm in the process of upstreaming would be the first one ever, the hope is that doing this will encourage other developers to do the same with other platforms. Speaking of them all... I don't think that there's any retail smartphone that comes with Android having any phone call ability... I'm aware of some Qualcomm smartphones being able to use mobile data and SMS, but no calling. Unless anything changed and unless I'm unaware of recent developments. Aside from that, MediaTek chips should be a little simpler in this regard, so I think that we can (and I would love to) get that working, so that smartphones can still be smart -- phones -- on mainline as well... but I have a hunch that this will require quite some time. Regards, Angelo _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek ^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2022-05-30 9:48 UTC | newest] Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-05-24 9:35 [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-24 9:35 ` [PATCH v2 1/3] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-24 12:05 ` Mattijs Korpershoek 2022-05-24 12:05 ` Mattijs Korpershoek 2022-05-24 12:05 ` Mattijs Korpershoek 2022-05-27 5:34 ` Dmitry Torokhov 2022-05-27 5:34 ` Dmitry Torokhov 2022-05-27 5:34 ` Dmitry Torokhov 2022-05-30 9:00 ` AngeloGioacchino Del Regno 2022-05-30 9:00 ` AngeloGioacchino Del Regno 2022-05-30 9:00 ` AngeloGioacchino Del Regno 2022-05-24 9:35 ` [PATCH v2 2/3] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-24 12:05 ` Mattijs Korpershoek 2022-05-24 12:05 ` Mattijs Korpershoek 2022-05-24 12:05 ` Mattijs Korpershoek 2022-05-24 9:35 ` [PATCH v2 3/3] Input: mtk-pmic-keys - Add support for MT6331 PMIC keys AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-24 9:35 ` AngeloGioacchino Del Regno 2022-05-26 11:08 ` [PATCH v2 0/3] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys Pavel Machek 2022-05-26 11:08 ` Pavel Machek 2022-05-26 11:08 ` Pavel Machek 2022-05-30 9:47 ` AngeloGioacchino Del Regno 2022-05-30 9:47 ` AngeloGioacchino Del Regno 2022-05-30 9:47 ` AngeloGioacchino Del Regno
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.