Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: aw86927 - add support for Awinic AW86938

Add support for the I2C-connected Awinic AW86938 LRA haptic controller.

The AW86938 has a similar but slightly different register layout. In
particular, the boost mode register values.

The AW86938 also has some extra features that aren't implemented
in this driver yet.

Signed-off-by: Griffin Kroah-Hartman <griffin.kroah@fairphone.com>
Link: https://patch.msgid.link/20260302-aw86938-driver-v4-3-92c865df9cca@fairphone.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Griffin Kroah-Hartman and committed by
Dmitry Torokhov
df53055c b73724b1

+44 -8
+44 -8
drivers/input/misc/aw86927.c
··· 43 43 #define AW86927_PLAYCFG1_BST_VOUT_VREFSET_MASK GENMASK(6, 0) 44 44 #define AW86927_PLAYCFG1_BST_8500MV 0x50 45 45 46 + #define AW86938_PLAYCFG1_REG 0x06 47 + #define AW86938_PLAYCFG1_BST_MODE_MASK GENMASK(5, 5) 48 + #define AW86938_PLAYCFG1_BST_MODE_BYPASS 0 49 + #define AW86938_PLAYCFG1_BST_VOUT_VREFSET_MASK GENMASK(4, 0) 50 + #define AW86938_PLAYCFG1_BST_7000MV 0x11 51 + 46 52 #define AW86927_PLAYCFG2_REG 0x07 47 53 48 54 #define AW86927_PLAYCFG3_REG 0x08 ··· 146 140 #define AW86927_CHIPIDH_REG 0x57 147 141 #define AW86927_CHIPIDL_REG 0x58 148 142 #define AW86927_CHIPID 0x9270 143 + #define AW86938_CHIPID 0x9380 149 144 150 145 #define AW86927_TMCFG_REG 0x5b 151 146 #define AW86927_TMCFG_UNLOCK 0x7d ··· 180 173 AW86927_RAM_MODE, 181 174 }; 182 175 176 + enum aw86927_model { 177 + AW86927, 178 + AW86938, 179 + }; 180 + 183 181 struct aw86927_data { 182 + enum aw86927_model model; 184 183 struct work_struct play_work; 185 184 struct device *dev; 186 185 struct input_dev *input_dev; ··· 578 565 if (err) 579 566 return err; 580 567 581 - err = regmap_update_bits(haptics->regmap, 582 - AW86927_PLAYCFG1_REG, 583 - AW86927_PLAYCFG1_BST_VOUT_VREFSET_MASK, 584 - FIELD_PREP(AW86927_PLAYCFG1_BST_VOUT_VREFSET_MASK, 585 - AW86927_PLAYCFG1_BST_8500MV)); 586 - if (err) 587 - return err; 568 + switch (haptics->model) { 569 + case AW86927: 570 + err = regmap_update_bits(haptics->regmap, 571 + AW86927_PLAYCFG1_REG, 572 + AW86927_PLAYCFG1_BST_VOUT_VREFSET_MASK, 573 + FIELD_PREP(AW86927_PLAYCFG1_BST_VOUT_VREFSET_MASK, 574 + AW86927_PLAYCFG1_BST_8500MV)); 575 + if (err) 576 + return err; 577 + break; 578 + case AW86938: 579 + err = regmap_update_bits(haptics->regmap, 580 + AW86938_PLAYCFG1_REG, 581 + AW86938_PLAYCFG1_BST_VOUT_VREFSET_MASK, 582 + FIELD_PREP(AW86938_PLAYCFG1_BST_VOUT_VREFSET_MASK, 583 + AW86938_PLAYCFG1_BST_7000MV)); 584 + if (err) 585 + return err; 586 + break; 587 + } 588 588 589 589 err = regmap_update_bits(haptics->regmap, 590 590 AW86927_PLAYCFG3_REG, ··· 624 598 AW86927_SYSCTRL3_EN_RAMINIT_MASK, 625 599 FIELD_PREP(AW86927_SYSCTRL3_EN_RAMINIT_MASK, 626 600 AW86927_SYSCTRL3_EN_RAMINIT_ON)); 601 + 602 + /* AW86938 wants a 1ms delay here */ 603 + usleep_range(1000, 1500); 627 604 628 605 /* Set base address for the start of the SRAM waveforms */ 629 606 err = regmap_write(haptics->regmap, ··· 746 717 747 718 chip_id = be16_to_cpu(read_buf); 748 719 749 - if (chip_id != AW86927_CHIPID) { 720 + switch (chip_id) { 721 + case AW86927_CHIPID: 722 + haptics->model = AW86927; 723 + break; 724 + case AW86938_CHIPID: 725 + haptics->model = AW86938; 726 + break; 727 + default: 750 728 dev_err(haptics->dev, "Unexpected CHIPID value 0x%x\n", chip_id); 751 729 return -ENODEV; 752 730 }