Re: [PATCH 2/3] Input - aw8695: Add driver for AW8695 haptics
From: kernel test robot
Date: Fri Apr 08 2022 - 13:26:06 EST
Hi Luca,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on dtor-input/next]
[also build test ERROR on hid/for-next robh/for-next v5.18-rc1 next-20220408]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Luca-Weiss/dt-bindings-input-Add-bindings-for-Awinic-AW8695-haptics/20220408-195432
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220409/202204090150.l1wQZ8IR-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/df1f510ce633a7d4a6cd3722620980961b39961b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Luca-Weiss/dt-bindings-input-Add-bindings-for-Awinic-AW8695-haptics/20220408-195432
git checkout df1f510ce633a7d4a6cd3722620980961b39961b
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
drivers/input/misc/aw8695-haptics.c: In function 'aw8695_haptic_read_f0':
>> drivers/input/misc/aw8695-haptics.c:795:18: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
795 | f0_reg = FIELD_PREP(AW8695_HIGH_MASK, read_buf);
| ^~~~~~~~~~
drivers/input/misc/aw8695-haptics.c: In function 'aw8695_haptic_get_f0':
>> drivers/input/misc/aw8695-haptics.c:862:25: error: implicit declaration of function 'FIELD_GET'; did you mean 'FOLL_GET'? [-Werror=implicit-function-declaration]
862 | FIELD_GET(AW8695_HIGH_MASK, f0_reg));
| ^~~~~~~~~
| FOLL_GET
cc1: some warnings being treated as errors
vim +/FIELD_PREP +795 drivers/input/misc/aw8695-haptics.c
783
784 static int aw8695_haptic_read_f0(struct aw8695_data *haptics)
785 {
786 struct device *dev = &haptics->client->dev;
787 unsigned long f0;
788 unsigned int f0_reg;
789 unsigned int read_buf;
790 int err;
791
792 err = regmap_read(haptics->regmap, AW8695_F_LRA_F0_H, &read_buf);
793 if (err)
794 return err;
> 795 f0_reg = FIELD_PREP(AW8695_HIGH_MASK, read_buf);
796
797 err = regmap_read(haptics->regmap, AW8695_F_LRA_F0_L, &read_buf);
798 if (err)
799 return err;
800 f0_reg |= FIELD_PREP(AW8695_LOW_MASK, read_buf);
801
802 if (!f0_reg) {
803 dev_err(dev, "Failed to read f0 value!\n");
804 return -EINVAL;
805 }
806
807 f0 = 1000000000 / (f0_reg * haptics->f0_coefficient);
808 dev_dbg(dev, "Read new f0: %d\n", (int)f0);
809
810 return (int)f0;
811 }
812
813 static int aw8695_haptic_get_f0(struct aw8695_data *haptics)
814 {
815 struct device *dev = &haptics->client->dev;
816 unsigned int read_buf;
817 unsigned int f0_trace_ms;
818 unsigned int f0_reg;
819 int f0;
820 int err;
821
822 err = aw8695_haptics_stop(haptics);
823 if (err)
824 return err;
825
826 err = regmap_write(haptics->regmap, AW8695_TRIM_LRA, 0x00);
827 if (err)
828 return err;
829
830 err = aw8695_set_work_mode(haptics, AW8695_CONT_MODE);
831 if (err)
832 return err;
833
834 err = regmap_update_bits(haptics->regmap, AW8695_CONT_CTRL,
835 AW8695_CONT_CTRL_EN_CLOSE_MASK, AW8695_CONT_CTRL_OPEN_PLAYBACK);
836 if (err)
837 return err;
838 err = regmap_update_bits(haptics->regmap, AW8695_CONT_CTRL,
839 AW8695_CONT_CTRL_F0_DETECT_ENABLE, AW8695_CONT_CTRL_F0_DETECT_ENABLE);
840 if (err)
841 return err;
842
843 /* LPF */
844 err = regmap_update_bits(haptics->regmap, AW8695_DATCTRL,
845 AW8695_DATCTRL_FC_MASK, AW8695_DATCTRL_FC_1000HZ);
846 if (err)
847 return err;
848 err = regmap_update_bits(haptics->regmap, AW8695_DATCTRL,
849 AW8695_DATCTRL_LPF_ENABLE_MASK, AW8695_DATCTRL_LPF_ENABLE);
850 if (err)
851 return err;
852
853 /* LRA OSC Source */
854 err = regmap_update_bits(haptics->regmap, AW8695_ANACTRL,
855 AW8695_ANACTRL_LRA_SRC_MASK, AW8695_ANACTRL_LRA_SRC_REG);
856 if (err)
857 return err;
858
859 /* preset f0 */
860 f0_reg = 1000000000 / (haptics->f0_preset * haptics->f0_coefficient);
861 err = regmap_write(haptics->regmap, AW8695_F_PRE_H,
> 862 FIELD_GET(AW8695_HIGH_MASK, f0_reg));
863 if (err)
864 return err;
865 err = regmap_write(haptics->regmap, AW8695_F_PRE_L,
866 FIELD_GET(AW8695_LOW_MASK, f0_reg));
867 if (err)
868 return err;
869
870 /* f0 driver level */
871 err = regmap_write(haptics->regmap, AW8695_DRV_LVL, haptics->drive_level);
872 if (err)
873 return err;
874
875 /* f0 trace parameter */
876 err = regmap_write(haptics->regmap, AW8695_NUM_F0_1,
877 FIELD_PREP(AW8695_NUM_F0_1_PRE_MASK, haptics->f0_det_play) |
878 FIELD_PREP(AW8695_NUM_F0_1_WAIT_MASK, haptics->f0_det_wait));
879 if (err)
880 return err;
881 err = regmap_write(haptics->regmap, AW8695_NUM_F0_2, haptics->f0_det_repeat);
882 if (err)
883 return err;
884 err = regmap_write(haptics->regmap, AW8695_NUM_F0_3, haptics->f0_det_trace);
885 if (err)
886 return err;
887
888 err = aw8695_interrupt_clear(haptics);
889 if (err)
890 return err;
891
892 /* play go and start f0 calibration */
893 err = regmap_update_bits(haptics->regmap, AW8695_GO,
894 AW8695_GO_ENABLE, AW8695_GO_ENABLE);
895 if (err)
896 return err;
897
898 /* f0 trace time */
899 f0_trace_ms =
900 (1000 * 10 / haptics->f0_preset) * (haptics->f0_det_play + haptics->f0_det_wait +
901 (haptics->f0_det_trace + haptics->f0_det_wait) * (haptics->f0_det_repeat - 1));
902 usleep_range(f0_trace_ms * 1000, f0_trace_ms * 1000 + 500);
903
904 err = regmap_read_poll_timeout(haptics->regmap, AW8695_GLB_STATE, read_buf,
905 (read_buf & 0x0f) == 0, 10000, 10000 * 50);
906 if (err) {
907 dev_err(dev, "Did not enter standby: %d\n", err);
908 return err;
909 }
910
911 f0 = aw8695_haptic_read_f0(haptics);
912
913 /* restore default config */
914 err = regmap_update_bits(haptics->regmap, AW8695_CONT_CTRL,
915 AW8695_CONT_CTRL_EN_CLOSE_MASK, AW8695_CONT_CTRL_CLOSE_PLAYBACK);
916 if (err)
917 return err;
918 err = regmap_update_bits(haptics->regmap, AW8695_CONT_CTRL,
919 AW8695_CONT_CTRL_F0_DETECT_ENABLE, 0);
920 if (err)
921 return err;
922
923 return f0;
924 }
925
--
0-DAY CI Kernel Test Service
https://01.org/lkp