Re: [PATCH V2 1/2] usb: typec: Support sprd_pmic_typec driver

From: kernel test robot
Date: Mon Dec 11 2023 - 13:51:38 EST


Hi Xinhu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus robh/for-next westeri-thunderbolt/next linus/master v6.7-rc5 next-20231211]
[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/Xinhu-Wu/usb-typec-Support-sprd_pmic_typec-driver/20231211-154328
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20231211074120.27958-2-xinhu.wu%40unisoc.com
patch subject: [PATCH V2 1/2] usb: typec: Support sprd_pmic_typec driver
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231212/202312120229.fONhCYBI-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231212/202312120229.fONhCYBI-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312120229.fONhCYBI-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/usb/typec/sprd_pmic_typec.c: In function 'sprd_pmic_typec_connect':
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_DETACHED_SNK' not handled in switch [-Wswitch]
184 | switch (sc->state) {
| ^~~~~~
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_ATTACHWAIT_SNK' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_DETACHED_SRC' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_ATTACHWAIT_SRC' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_POWERED_CABLE' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_AUDIO_CABLE' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_DEBUG_CABLE' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_TOGGLE_SLEEP' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_ERR_RECOV' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_DISABLED' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_TRY_SNK' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_TRY_WAIT_SRC' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_TRY_SRC' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_TRY_WAIT_SNK' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_UNSUPOORT_ACC' not handled in switch [-Wswitch]
>> drivers/usb/typec/sprd_pmic_typec.c:184:9: warning: enumeration value 'TYPEC_ORIENTED_DEBUG' not handled in switch [-Wswitch]


vim +/TYPEC_DETACHED_SNK +184 drivers/usb/typec/sprd_pmic_typec.c

173
174 static int sprd_pmic_typec_connect(struct sprd_pmic_typec *sc, u32 status)
175 {
176 enum typec_data_role data_role = TYPEC_DEVICE;
177 enum typec_role power_role = TYPEC_SINK;
178 enum typec_role vconn_role = TYPEC_SINK;
179 struct typec_partner_desc desc;
180
181 if (sc->partner)
182 return 0;
183
> 184 switch (sc->state) {
185 case TYPEC_ATTACHED_SNK:
186 power_role = TYPEC_SINK;
187 data_role = TYPEC_DEVICE;
188 vconn_role = TYPEC_SINK;
189 break;
190 case TYPEC_ATTACHED_SRC:
191 power_role = TYPEC_SOURCE;
192 data_role = TYPEC_HOST;
193 vconn_role = TYPEC_SOURCE;
194 break;
195 }
196
197 desc.usb_pd = 0;
198 desc.identity = NULL;
199 if (sc->state == TYPEC_AUDIO_CABLE)
200 desc.accessory = TYPEC_ACCESSORY_AUDIO;
201 else if (sc->state == TYPEC_DEBUG_CABLE)
202 desc.accessory = TYPEC_ACCESSORY_DEBUG;
203 else
204 desc.accessory = TYPEC_ACCESSORY_NONE;
205
206 sc->partner = typec_register_partner(sc->port, &desc);
207 if (!sc->partner)
208 return -ENODEV;
209
210 typec_set_pwr_opmode(sc->port, TYPEC_PWR_MODE_USB);
211 typec_set_pwr_role(sc->port, power_role);
212 typec_set_data_role(sc->port, data_role);
213 typec_set_vconn_role(sc->port, vconn_role);
214
215 switch (sc->state) {
216 case TYPEC_ATTACHED_SNK:
217 sc->pre_state = TYPEC_ATTACHED_SNK;
218 /*notify USB, USB PHY, charger, and bc1p2 driver*/
219 extcon_set_state_sync(sc->edev, EXTCON_USB, true);
220 break;
221 case TYPEC_ATTACHED_SRC:
222 sc->pre_state = TYPEC_ATTACHED_SRC;
223 /*notify USB, USB PHY driver*/
224 extcon_set_state_sync(sc->edev, EXTCON_USB_HOST, true);
225 break;
226 case TYPEC_AUDIO_CABLE:
227 /*notify analog audio driver*/
228 sc->pre_state = TYPEC_AUDIO_CABLE;
229 extcon_set_state_sync(sc->edev, EXTCON_JACK_HEADPHONE, true);
230 break;
231 default:
232 break;
233 }
234
235 spin_lock(&sc->lock);
236 sc->partner_connected = true;
237 spin_unlock(&sc->lock);
238 sprd_pmic_typec_set_cc_polarity_role(sc);
239
240 return 0;
241 }
242

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