* Re: [PATCH v4 5/5] HID: mcp2221: add ADC/DAC support via iio subsystem
[not found] <20220921063026.89619-6-matt.ranostay@konsulko.com>
@ 2022-09-22 10:23 ` kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-09-22 10:23 UTC (permalink / raw)
To: Matt Ranostay, gupt21, jic23
Cc: llvm, kbuild-all, linux-i2c, linux-iio, linux-input, Matt Ranostay
Hi Matt,
I love your patch! Yet something to improve:
[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on next-20220921]
[cannot apply to hid/for-next wsa/i2c/for-next linus/master v6.0-rc6]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matt-Ranostay/HID-mcp2221-iio-support-and-device-resource-management/20220921-143207
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: hexagon-randconfig-r023-20220921 (https://download.01.org/0day-ci/archive/20220922/202209221851.IOfsmA0z-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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/9576b88476cb586e6d9f8ef77969f1acd5e4a241
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Matt-Ranostay/HID-mcp2221-iio-support-and-device-resource-management/20220921-143207
git checkout 9576b88476cb586e6d9f8ef77969f1acd5e4a241
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/hid/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/hid/hid-mcp2221.c:879:10: error: no member named 'dac_scale' in 'struct mcp2221'
mcp->dac_scale = tmp + 4;
~~~ ^
drivers/hid/hid-mcp2221.c:881:10: error: no member named 'dac_scale' in 'struct mcp2221'
mcp->dac_scale = 5;
~~~ ^
>> drivers/hid/hid-mcp2221.c:886:10: error: no member named 'adc_scale' in 'struct mcp2221'
mcp->adc_scale = tmp - 1;
~~~ ^
drivers/hid/hid-mcp2221.c:888:10: error: no member named 'adc_scale' in 'struct mcp2221'
mcp->adc_scale = 0;
~~~ ^
4 errors generated.
vim +879 drivers/hid/hid-mcp2221.c
720
721 /*
722 * MCP2221 uses interrupt endpoint for input reports. This function
723 * is called by HID layer when it receives i/p report from mcp2221,
724 * which is actually a response to the previously sent command.
725 *
726 * MCP2221A firmware specific return codes are parsed and 0 or
727 * appropriate negative error code is returned. Delayed response
728 * results in timeout error and stray reponses results in -EIO.
729 */
730 static int mcp2221_raw_event(struct hid_device *hdev,
731 struct hid_report *report, u8 *data, int size)
732 {
733 u8 *buf, tmp;
734 struct mcp2221 *mcp = hid_get_drvdata(hdev);
735
736 switch (data[0]) {
737
738 case MCP2221_I2C_WR_DATA:
739 case MCP2221_I2C_WR_NO_STOP:
740 case MCP2221_I2C_RD_DATA:
741 case MCP2221_I2C_RD_RPT_START:
742 switch (data[1]) {
743 case MCP2221_SUCCESS:
744 mcp->status = 0;
745 break;
746 default:
747 mcp->status = mcp_get_i2c_eng_state(mcp, data, 2);
748 }
749 complete(&mcp->wait_in_report);
750 break;
751
752 case MCP2221_I2C_PARAM_OR_STATUS:
753 switch (data[1]) {
754 case MCP2221_SUCCESS:
755 if ((mcp->txbuf[3] == MCP2221_I2C_SET_SPEED) &&
756 (data[3] != MCP2221_I2C_SET_SPEED)) {
757 mcp->status = -EAGAIN;
758 break;
759 }
760 if (data[20] & MCP2221_I2C_MASK_ADDR_NACK) {
761 mcp->status = -ENXIO;
762 break;
763 }
764 mcp->status = mcp_get_i2c_eng_state(mcp, data, 8);
765 #if IS_REACHABLE(CONFIG_IIO)
766 memcpy(&mcp->adc_values, &data[50], sizeof(mcp->adc_values));
767 #endif
768 break;
769 default:
770 mcp->status = -EIO;
771 }
772 complete(&mcp->wait_in_report);
773 break;
774
775 case MCP2221_I2C_GET_DATA:
776 switch (data[1]) {
777 case MCP2221_SUCCESS:
778 if (data[2] == MCP2221_I2C_ADDR_NACK) {
779 mcp->status = -ENXIO;
780 break;
781 }
782 if (!mcp_get_i2c_eng_state(mcp, data, 2)
783 && (data[3] == 0)) {
784 mcp->status = 0;
785 break;
786 }
787 if (data[3] == 127) {
788 mcp->status = -EIO;
789 break;
790 }
791 if (data[2] == MCP2221_I2C_READ_COMPL) {
792 buf = mcp->rxbuf;
793 memcpy(&buf[mcp->rxbuf_idx], &data[4], data[3]);
794 mcp->rxbuf_idx = mcp->rxbuf_idx + data[3];
795 mcp->status = 0;
796 break;
797 }
798 mcp->status = -EIO;
799 break;
800 default:
801 mcp->status = -EIO;
802 }
803 complete(&mcp->wait_in_report);
804 break;
805
806 case MCP2221_GPIO_GET:
807 switch (data[1]) {
808 case MCP2221_SUCCESS:
809 if ((data[mcp->gp_idx] == MCP2221_ALT_F_NOT_GPIOV) ||
810 (data[mcp->gp_idx + 1] == MCP2221_ALT_F_NOT_GPIOD)) {
811 mcp->status = -ENOENT;
812 } else {
813 mcp->status = !!data[mcp->gp_idx];
814 mcp->gpio_dir = data[mcp->gp_idx + 1];
815 }
816 break;
817 default:
818 mcp->status = -EAGAIN;
819 }
820 complete(&mcp->wait_in_report);
821 break;
822
823 case MCP2221_GPIO_SET:
824 switch (data[1]) {
825 case MCP2221_SUCCESS:
826 if ((data[mcp->gp_idx] == MCP2221_ALT_F_NOT_GPIOV) ||
827 (data[mcp->gp_idx - 1] == MCP2221_ALT_F_NOT_GPIOV)) {
828 mcp->status = -ENOENT;
829 } else {
830 mcp->status = 0;
831 }
832 break;
833 default:
834 mcp->status = -EAGAIN;
835 }
836 complete(&mcp->wait_in_report);
837 break;
838
839 case MCP2221_SET_SRAM_SETTINGS:
840 switch (data[1]) {
841 case MCP2221_SUCCESS:
842 mcp->status = 0;
843 break;
844 default:
845 mcp->status = -EAGAIN;
846 }
847 complete(&mcp->wait_in_report);
848 break;
849
850 case MCP2221_GET_SRAM_SETTINGS:
851 switch (data[1]) {
852 case MCP2221_SUCCESS:
853 memcpy(&mcp->mode, &data[22], 4);
854 #if IS_REACHABLE(CONFIG_IIO)
855 mcp->dac_value = data[6] & GENMASK(4, 0);
856 #endif
857 mcp->status = 0;
858 break;
859 default:
860 mcp->status = -EAGAIN;
861 }
862 complete(&mcp->wait_in_report);
863 break;
864
865 case MCP2221_READ_FLASH_DATA:
866 switch (data[1]) {
867 case MCP2221_SUCCESS:
868 mcp->status = 0;
869
870 /* Only handles CHIP SETTINGS subpage currently */
871 if (mcp->txbuf[1] != 0) {
872 mcp->status = -EIO;
873 break;
874 }
875
876 /* DAC scale value */
877 tmp = (data[6] >> 6) & 0x3;
878 if ((data[6] & BIT(5)) && tmp)
> 879 mcp->dac_scale = tmp + 4;
880 else
881 mcp->dac_scale = 5;
882
883 /* ADC scale value */
884 tmp = (data[7] >> 3) & 0x3;
885 if ((data[7] & BIT(2)) && tmp)
> 886 mcp->adc_scale = tmp - 1;
887 else
888 mcp->adc_scale = 0;
889
890 break;
891 default:
892 mcp->status = -EAGAIN;
893 }
894 complete(&mcp->wait_in_report);
895 break;
896
897 default:
898 mcp->status = -EIO;
899 complete(&mcp->wait_in_report);
900 }
901
902 return 1;
903 }
904
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread