lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202312110337.uzelx86z-lkp@intel.com>
Date:   Mon, 11 Dec 2023 04:05:38 +0800
From:   kernel test robot <lkp@...el.com>
To:     Neil Armstrong <neil.armstrong@...aro.org>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Neil Armstrong <neil.armstrong@...aro.org>
Subject: Re: [PATCH 2/2] usb: typec: mux: add Qualcomm WCD939X USB SubSystem
 Altmode Mux driver

Hi Neil,

kernel test robot noticed the following build errors:

[auto build test ERROR on bc63de6e6ba0b16652c5fb4b9c9916b9e7ca1f23]

url:    https://github.com/intel-lab-lkp/linux/commits/Neil-Armstrong/dt-bindings-usb-Document-WCD939x-USB-SubSystem-Altmode-Analog-Audio-Switch/20231208-232926
base:   bc63de6e6ba0b16652c5fb4b9c9916b9e7ca1f23
patch link:    https://lore.kernel.org/r/20231208-topic-sm8650-upstream-wcd939x-usbss-v1-2-91d1ba680fe0%40linaro.org
patch subject: [PATCH 2/2] usb: typec: mux: add Qualcomm WCD939X USB SubSystem Altmode Mux driver
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20231211/202312110337.uzelx86z-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231211/202312110337.uzelx86z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312110337.uzelx86z-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/usb/typec/mux/wcd939x-usbss.c:353:7: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                            FIELD_PREP(WCD_USBSS_USB_SS_CNTL_USB_SS_MODE,
                                            ^
   drivers/usb/typec/mux/wcd939x-usbss.c:456:6: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                    FIELD_PREP(WCD_USBSS_USB_SS_CNTL_USB_SS_MODE,
                                    ^
>> drivers/usb/typec/mux/wcd939x-usbss.c:602:22: error: call to undeclared function 'devm_gpiod_get_optional'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
           usbss->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
                               ^
   drivers/usb/typec/mux/wcd939x-usbss.c:602:22: note: did you mean 'devm_regulator_get_optional'?
   include/linux/regulator/consumer.h:163:32: note: 'devm_regulator_get_optional' declared here
   struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
                                  ^
>> drivers/usb/typec/mux/wcd939x-usbss.c:602:60: error: use of undeclared identifier 'GPIOD_OUT_LOW'
           usbss->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
                                                                     ^
>> drivers/usb/typec/mux/wcd939x-usbss.c:627:2: error: call to undeclared function 'gpiod_set_value'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
           gpiod_set_value(usbss->reset_gpio, 1);
           ^
   drivers/usb/typec/mux/wcd939x-usbss.c:650:6: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                    FIELD_PREP(WCD_USBSS_FUNCTION_ENABLE_SOURCE_SELECT,
                                    ^
   6 errors generated.


vim +/FIELD_PREP +353 drivers/usb/typec/mux/wcd939x-usbss.c

   237	
   238	static int wcd939x_usbss_set(struct wcd939x_usbss *usbss)
   239	{
   240		bool reverse = (usbss->orientation == TYPEC_ORIENTATION_REVERSE);
   241		bool enable_audio = false;
   242		bool enable_usb = false;
   243		bool enable_dp = false;
   244		int ret;
   245	
   246		/* USB Mode */
   247		if (usbss->mode < TYPEC_STATE_MODAL ||
   248		    (!usbss->svid && (usbss->mode == TYPEC_MODE_USB2 ||
   249				      usbss->mode == TYPEC_MODE_USB3))) {
   250			enable_usb = true;
   251		} else if (usbss->svid) {
   252			switch (usbss->mode) {
   253			/* DP Only */
   254			case TYPEC_DP_STATE_C:
   255			case TYPEC_DP_STATE_E:
   256				enable_dp = true;
   257				break;
   258	
   259			/* DP + USB */
   260			case TYPEC_DP_STATE_D:
   261			case TYPEC_DP_STATE_F:
   262				enable_usb = true;
   263				enable_dp = true;
   264				break;
   265	
   266			default:
   267				return -EOPNOTSUPP;
   268			}
   269		} else if (usbss->mode == TYPEC_MODE_AUDIO) {
   270			enable_audio = true;
   271		} else {
   272			return -EOPNOTSUPP;
   273		}
   274	
   275		/* Disable all switches */
   276		ret = regmap_clear_bits(usbss->regmap, WCD_USBSS_SWITCH_SETTINGS_ENABLE,
   277					WCD_USBSS_SWITCH_SETTINGS_ENABLE_DP_AUXP_TO_MGX_SWITCHES |
   278					WCD_USBSS_SWITCH_SETTINGS_ENABLE_DP_AUXM_TO_MGX_SWITCHES |
   279					WCD_USBSS_SWITCH_SETTINGS_ENABLE_DPR_SWITCHES |
   280					WCD_USBSS_SWITCH_SETTINGS_ENABLE_DNL_SWITCHES |
   281					WCD_USBSS_SWITCH_SETTINGS_ENABLE_SENSE_SWITCHES |
   282					WCD_USBSS_SWITCH_SETTINGS_ENABLE_MIC_SWITCHES |
   283					WCD_USBSS_SWITCH_SETTINGS_ENABLE_AGND_SWITCHES);
   284		if (ret)
   285			return ret;
   286	
   287		/* Clear switches */
   288		ret = regmap_clear_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT0,
   289					WCD_USBSS_SWITCH_SELECT0_DP_AUXP_SWITCHES |
   290					WCD_USBSS_SWITCH_SELECT0_DP_AUXM_SWITCHES |
   291					WCD_USBSS_SWITCH_SELECT0_DPR_SWITCHES |
   292					WCD_USBSS_SWITCH_SELECT0_DNL_SWITCHES |
   293					WCD_USBSS_SWITCH_SELECT0_SENSE_SWITCHES |
   294					WCD_USBSS_SWITCH_SELECT0_MIC_SWITCHES);
   295		if (ret)
   296			return ret;
   297	
   298		ret = regmap_clear_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT1,
   299					WCD_USBSS_SWITCH_SELECT1_AGND_SWITCHES);
   300		if (ret)
   301			return ret;
   302	
   303		/* Enable OVP_MG1_BIAS PCOMP_DYN_BST_EN */
   304		ret = regmap_set_bits(usbss->regmap, WCD_USBSS_MG1_BIAS,
   305				      WCD_USBSS_MG1_BIAS_PCOMP_DYN_BST_EN);
   306		if (ret)
   307			return ret;
   308	
   309		/* Enable OVP_MG2_BIAS PCOMP_DYN_BST_EN */
   310		ret = regmap_set_bits(usbss->regmap, WCD_USBSS_MG2_BIAS,
   311				      WCD_USBSS_MG2_BIAS_PCOMP_DYN_BST_EN);
   312		if (ret)
   313			return ret;
   314	
   315		/* Disable Equalizer in safe mode */
   316		ret = regmap_clear_bits(usbss->regmap, WCD_USBSS_EQUALIZER1,
   317					WCD_USBSS_EQUALIZER1_EQ_EN);
   318		if (ret)
   319			return ret;
   320	
   321		/* Start FSM with all disabled, force write */
   322		ret = regmap_write_bits(usbss->regmap, WCD_USBSS_AUDIO_FSM_START,
   323					WCD_USBSS_AUDIO_FSM_START_AUDIO_FSM_AUDIO_TRIG,
   324					WCD_USBSS_AUDIO_FSM_START_AUDIO_FSM_AUDIO_TRIG);
   325	
   326		/* 35us to allow the SBU switch to turn off */
   327		usleep_range(35, 1000);
   328	
   329		/* Setup Audio Accessory mux/switch */
   330		if (enable_audio) {
   331			int i;
   332	
   333			/*
   334			 * AATC switch configuration:
   335			 * "Normal":
   336			 * - R: DNR
   337			 * - L: DNL
   338			 * - Sense: GSBU2
   339			 * - Mic: MG1
   340			 * - AGND: MG2
   341			 * "Swapped":
   342			 * - R: DNR
   343			 * - L: DNL
   344			 * - Sense: GSBU1
   345			 * - Mic: MG2
   346			 * - AGND: MG1
   347			 * Swapped information is given by the codec MBHC logic
   348			 */
   349	
   350			/* Set AATC mode */
   351			ret = regmap_update_bits(usbss->regmap, WCD_USBSS_USB_SS_CNTL,
   352						 WCD_USBSS_USB_SS_CNTL_USB_SS_MODE,
 > 353						 FIELD_PREP(WCD_USBSS_USB_SS_CNTL_USB_SS_MODE,
   354							    WCD_USBSS_USB_SS_CNTL_USB_SS_MODE_AATC));
   355			if (ret)
   356				return ret;
   357	
   358			/* Select L for DNL_SWITCHES and R for DPR_SWITCHES */
   359			ret = regmap_update_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT0,
   360					WCD_USBSS_SWITCH_SELECT0_DPR_SWITCHES |
   361					WCD_USBSS_SWITCH_SELECT0_DNL_SWITCHES,
   362					FIELD_PREP(WCD_USBSS_SWITCH_SELECT0_DNL_SWITCHES,
   363						WCD_USBSS_SWITCH_SELECT0_DNL_SWITCH_L) |
   364					FIELD_PREP(WCD_USBSS_SWITCH_SELECT0_DPR_SWITCHES,
   365						WCD_USBSS_SWITCH_SELECT0_DPR_SWITCH_R));
   366			if (ret)
   367				return ret;
   368	
   369			if (reverse)
   370				/* Select MG2 for MIC, SBU1 for Sense */
   371				ret = regmap_update_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT0,
   372							 WCD_USBSS_SWITCH_SELECT0_MIC_SWITCHES,
   373							 WCD_USBSS_SWITCH_SELECT0_MIC_SWITCHES);
   374			else
   375				/* Select MG1 for MIC, SBU2 for Sense */
   376				ret = regmap_update_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT0,
   377							 WCD_USBSS_SWITCH_SELECT0_SENSE_SWITCHES,
   378							 WCD_USBSS_SWITCH_SELECT0_SENSE_SWITCHES);
   379			if (ret)
   380				return ret;
   381	
   382			if (reverse)
   383				/* Disable OVP_MG1_BIAS PCOMP_DYN_BST_EN */
   384				ret = regmap_clear_bits(usbss->regmap, WCD_USBSS_MG1_BIAS,
   385							WCD_USBSS_MG1_BIAS_PCOMP_DYN_BST_EN);
   386			else
   387				/* Disable OVP_MG2_BIAS PCOMP_DYN_BST_EN */
   388				ret = regmap_clear_bits(usbss->regmap, WCD_USBSS_MG2_BIAS,
   389							WCD_USBSS_MG2_BIAS_PCOMP_DYN_BST_EN);
   390			if (ret)
   391				return ret;
   392	
   393			/*  Enable SENSE, MIC switches */
   394			ret = regmap_set_bits(usbss->regmap, WCD_USBSS_SWITCH_SETTINGS_ENABLE,
   395					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_SENSE_SWITCHES |
   396					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_MIC_SWITCHES);
   397			if (ret)
   398				return ret;
   399	
   400			if (reverse)
   401				/* Select MG1 for AGND_SWITCHES */
   402				ret = regmap_clear_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT1,
   403							WCD_USBSS_SWITCH_SELECT1_AGND_SWITCHES);
   404			else
   405				/* Select MG2 for AGND_SWITCHES */
   406				ret = regmap_set_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT1,
   407						      WCD_USBSS_SWITCH_SELECT1_AGND_SWITCHES);
   408			if (ret)
   409				return ret;
   410	
   411			/* Enable AGND switches */
   412			ret = regmap_set_bits(usbss->regmap, WCD_USBSS_SWITCH_SETTINGS_ENABLE,
   413					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_AGND_SWITCHES);
   414			if (ret)
   415				return ret;
   416	
   417			/* Enable DPR, DNL switches */
   418			ret = regmap_set_bits(usbss->regmap, WCD_USBSS_SWITCH_SETTINGS_ENABLE,
   419					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_DNL_SWITCHES |
   420					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_DPR_SWITCHES);
   421			if (ret)
   422				return ret;
   423	
   424			/* Setup FSM delays */
   425			ret = regmap_write(usbss->regmap, WCD_USBSS_DELAY_L_SW, 0x02);
   426			if (ret)
   427				return ret;
   428	
   429			ret = regmap_write(usbss->regmap, WCD_USBSS_DELAY_R_SW, 0x02);
   430			if (ret)
   431				return ret;
   432	
   433			ret = regmap_write(usbss->regmap, WCD_USBSS_DELAY_MIC_SW, 0x01);
   434			if (ret)
   435				return ret;
   436	
   437			/* Start FSM, force write */
   438			ret = regmap_write_bits(usbss->regmap, WCD_USBSS_AUDIO_FSM_START,
   439						WCD_USBSS_AUDIO_FSM_START_AUDIO_FSM_AUDIO_TRIG,
   440						WCD_USBSS_AUDIO_FSM_START_AUDIO_FSM_AUDIO_TRIG);
   441			if (ret)
   442				return ret;
   443	
   444			/* Default Linearlizer coefficients */
   445			for (i = 0; i < ARRAY_SIZE(wcd939x_usbss_coeff_init); ++i)
   446				regmap_update_bits(usbss->regmap,
   447						   wcd939x_usbss_coeff_init[i].offset,
   448						   wcd939x_usbss_coeff_init[i].mask,
   449						   wcd939x_usbss_coeff_init[i].value);
   450	
   451			return 0;
   452		}
   453	
   454		ret = regmap_update_bits(usbss->regmap, WCD_USBSS_USB_SS_CNTL,
   455					 WCD_USBSS_USB_SS_CNTL_USB_SS_MODE,
   456					 FIELD_PREP(WCD_USBSS_USB_SS_CNTL_USB_SS_MODE,
   457						    WCD_USBSS_USB_SS_CNTL_USB_SS_MODE_USB));
   458		if (ret)
   459			return ret;
   460	
   461		/* Enable USB muxes */
   462		if (enable_usb) {
   463			/* Do not enable Equalizer in safe mode */
   464			if (usbss->mode != TYPEC_STATE_SAFE) {
   465				ret = regmap_set_bits(usbss->regmap, WCD_USBSS_EQUALIZER1,
   466						      WCD_USBSS_EQUALIZER1_EQ_EN);
   467				if (ret)
   468					return ret;
   469			}
   470	
   471			/* Select DN for DNL_SWITCHES and DP for DPR_SWITCHES */
   472			ret = regmap_update_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT0,
   473						 WCD_USBSS_SWITCH_SELECT0_DPR_SWITCHES |
   474						 WCD_USBSS_SWITCH_SELECT0_DNL_SWITCHES,
   475						 FIELD_PREP(WCD_USBSS_SWITCH_SELECT0_DNL_SWITCHES,
   476							    WCD_USBSS_SWITCH_SELECT0_DNL_SWITCH_DN) |
   477						 FIELD_PREP(WCD_USBSS_SWITCH_SELECT0_DPR_SWITCHES,
   478							    WCD_USBSS_SWITCH_SELECT0_DPR_SWITCH_DP));
   479			if (ret)
   480				return ret;
   481	
   482			/* Enable DNL_SWITCHES and DPR_SWITCHES */
   483			ret = regmap_set_bits(usbss->regmap, WCD_USBSS_SWITCH_SETTINGS_ENABLE,
   484					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_DPR_SWITCHES |
   485					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_DNL_SWITCHES);
   486			if (ret)
   487				return ret;
   488		}
   489	
   490		/* Enable DP AUX muxes */
   491		if (enable_dp) {
   492			/* Update Leakage Canceller Coefficient for AUXP pins */
   493			ret = regmap_update_bits(usbss->regmap, WCD_USBSS_DISP_AUXP_CTL,
   494						 WCD_USBSS_DISP_AUXP_CTL_LK_CANCEL_TRK_COEFF,
   495						 FIELD_PREP(WCD_USBSS_DISP_AUXP_CTL_LK_CANCEL_TRK_COEFF,
   496							    5));
   497			if (ret)
   498				return ret;
   499	
   500			ret = regmap_set_bits(usbss->regmap, WCD_USBSS_DISP_AUXP_THRESH,
   501					      WCD_USBSS_DISP_AUXP_THRESH_DISP_AUXP_OVPON_CM);
   502			if (ret)
   503				return ret;
   504	
   505			if (reverse)
   506				/* Select MG2 for AUXP and MG1 for AUXM */
   507				ret = regmap_update_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT0,
   508							 WCD_USBSS_SWITCH_SELECT0_DP_AUXP_SWITCHES |
   509							 WCD_USBSS_SWITCH_SELECT0_DP_AUXM_SWITCHES,
   510							 WCD_USBSS_SWITCH_SELECT0_DP_AUXP_SWITCHES);
   511			else
   512				/* Select MG1 for AUXP and MG2 for AUXM */
   513				ret = regmap_update_bits(usbss->regmap, WCD_USBSS_SWITCH_SELECT0,
   514							 WCD_USBSS_SWITCH_SELECT0_DP_AUXP_SWITCHES |
   515							 WCD_USBSS_SWITCH_SELECT0_DP_AUXM_SWITCHES,
   516							 WCD_USBSS_SWITCH_SELECT0_DP_AUXM_SWITCHES);
   517			if (ret)
   518				return ret;
   519	
   520			/* Enable DP_AUXP_TO_MGX and DP_AUXM_TO_MGX switches */
   521			ret = regmap_set_bits(usbss->regmap, WCD_USBSS_SWITCH_SETTINGS_ENABLE,
   522					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_DP_AUXP_TO_MGX_SWITCHES |
   523					      WCD_USBSS_SWITCH_SETTINGS_ENABLE_DP_AUXM_TO_MGX_SWITCHES);
   524	
   525			/* 15us to allow the SBU switch to turn on again */
   526			usleep_range(15, 1000);
   527		}
   528	
   529		return 0;
   530	}
   531	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ