Skip to content

Commit e47026f

Browse files
AngeloGioacchino Del RegnoUwe Kleine-König
authored andcommitted
pwm: pwm-mediatek: Add support for PWM IP V3.0.2 in MT6991/MT8196
Add support for the PWM IP version 3.0.2, found in MediaTek's Dimensity 9400 MT6991 and in the MT8196 Chromebook SoC: this needs a new register offset array and also a different offset for the PWM_CK_26M_SEL register. Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent d4f1e7a commit e47026f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/pwm/pwm-mediatek.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define PWM45DWIDTH_FIXUP 0x30
3030
#define PWMTHRES 0x30
3131
#define PWM45THRES_FIXUP 0x34
32+
#define PWM_CK_26M_SEL_V3 0x74
3233
#define PWM_CK_26M_SEL 0x210
3334

3435
#define PWM_CLK_DIV_MAX 7
@@ -64,6 +65,11 @@ static const unsigned int mtk_pwm_reg_offset_v2[] = {
6465
0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x01c0, 0x0200, 0x0240
6566
};
6667

68+
/* PWM IP Version 3.0.2 */
69+
static const unsigned int mtk_pwm_reg_offset_v3[] = {
70+
0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800
71+
};
72+
6773
static inline struct pwm_mediatek_chip *
6874
to_pwm_mediatek_chip(struct pwm_chip *chip)
6975
{
@@ -369,9 +375,17 @@ static const struct pwm_mediatek_of_data mt8516_pwm_data = {
369375
.reg_offset = mtk_pwm_reg_offset_v1,
370376
};
371377

378+
static const struct pwm_mediatek_of_data mt6991_pwm_data = {
379+
.num_pwms = 4,
380+
.pwm45_fixup = false,
381+
.pwm_ck_26m_sel_reg = PWM_CK_26M_SEL_V3,
382+
.reg_offset = mtk_pwm_reg_offset_v3,
383+
};
384+
372385
static const struct of_device_id pwm_mediatek_of_match[] = {
373386
{ .compatible = "mediatek,mt2712-pwm", .data = &mt2712_pwm_data },
374387
{ .compatible = "mediatek,mt6795-pwm", .data = &mt6795_pwm_data },
388+
{ .compatible = "mediatek,mt6991-pwm", .data = &mt6991_pwm_data },
375389
{ .compatible = "mediatek,mt7622-pwm", .data = &mt7622_pwm_data },
376390
{ .compatible = "mediatek,mt7623-pwm", .data = &mt7623_pwm_data },
377391
{ .compatible = "mediatek,mt7628-pwm", .data = &mt7628_pwm_data },

0 commit comments

Comments
 (0)