Re: [RESEND PATCH v2 7/7] usb: typec: qcom: Add a pm8150b TCPM driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Bryan,

I love your patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on robh/for-next linus/master v5.15-rc7 next-20211029]
[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/0day-ci/linux/commits/Bryan-O-Donoghue/Add-pm8150b-TPCM-driver/20211029-010406
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-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/0day-ci/linux/commit/fe4e9d995058581a4428c9c5c91e848eab3beef5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Bryan-O-Donoghue/Add-pm8150b-TPCM-driver/20211029-010406
        git checkout fe4e9d995058581a4428c9c5c91e848eab3beef5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=m68k 

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/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c: In function 'qcom_pmic_tcpm_typec_get_cc':
>> drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:205:24: error: variable 'debounced' set but not used [-Werror=unused-but-set-variable]
     205 |         bool attached, debounced;
         |                        ^~~~~~~~~
   drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c: In function 'qcom_pmic_tcpm_typec_set_cc':
>> drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:296:22: error: variable 'orientation' set but not used [-Werror=unused-but-set-variable]
     296 |         unsigned int orientation, misc;
         |                      ^~~~~~~~~~~
   cc1: all warnings being treated as errors
--
   drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c: In function 'qcom_pmic_tcpm_pdphy_disable':
>> drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:431:24: error: unused variable 'dev' [-Werror=unused-variable]
     431 |         struct device *dev = pmic_pdphy->dev;
         |                        ^~~
   cc1: all warnings being treated as errors


vim +/debounced +205 drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c

   198	
   199	int qcom_pmic_tcpm_typec_get_cc(struct pmic_typec *pmic_typec,
   200					enum typec_cc_status *cc1,
   201					enum typec_cc_status *cc2)
   202	{
   203		struct device *dev = pmic_typec->dev;
   204		unsigned int misc, val;
 > 205		bool attached, debounced;
   206		int ret = 0;
   207	
   208		ret = regmap_read(pmic_typec->regmap,
   209				  pmic_typec->base + TYPEC_MISC_STATUS_REG, &misc);
   210		if (ret)
   211			goto done;
   212	
   213		attached = !!(misc & CC_ATTACHED);
   214		debounced = !!(misc & TYPEC_DEBOUNCE_DONE);
   215	
   216		if (pmic_typec->debouncing_cc) {
   217			ret = -EBUSY;
   218			goto done;
   219		}
   220	
   221		*cc1 = TYPEC_CC_OPEN;
   222		*cc2 = TYPEC_CC_OPEN;
   223	
   224		if (!(attached))
   225			goto done;
   226	
   227		if (misc & SNK_SRC_MODE) {
   228			ret = regmap_read(pmic_typec->regmap,
   229					  pmic_typec->base + TYPEC_SRC_STATUS_REG,
   230					  &val);
   231			if (ret)
   232				goto done;
   233			switch (val & DETECTED_SRC_TYPE_MASK) {
   234			case SRC_RD_OPEN:
   235				val = TYPEC_CC_RD;
   236				break;
   237			case SRC_RD_RA_VCONN:
   238				val = TYPEC_CC_RD;
   239				*cc1 = TYPEC_CC_RA;
   240				*cc2 = TYPEC_CC_RA;
   241				break;
   242			default:
   243				dev_warn(dev, "unexpected src status %.2x\n", val);
   244				val = TYPEC_CC_RD;
   245				break;
   246			}
   247		} else {
   248			ret = regmap_read(pmic_typec->regmap,
   249					  pmic_typec->base + TYPEC_SNK_STATUS_REG,
   250					  &val);
   251			if (ret)
   252				goto done;
   253			switch (val & DETECTED_SNK_TYPE_MASK) {
   254			case SNK_RP_STD:
   255				val = TYPEC_CC_RP_DEF;
   256				break;
   257			case SNK_RP_1P5:
   258				val = TYPEC_CC_RP_1_5;
   259				break;
   260			case SNK_RP_3P0:
   261				val = TYPEC_CC_RP_3_0;
   262				break;
   263			default:
   264				dev_warn(dev, "unexpected snk status %.2x\n", val);
   265				val = TYPEC_CC_RP_DEF;
   266				break;
   267			}
   268			val = TYPEC_CC_RP_DEF;
   269		}
   270	
   271		if (misc & CC_ORIENTATION)
   272			*cc2 = val;
   273		else
   274			*cc1 = val;
   275	
   276	done:
   277		dev_dbg(dev, "get_cc: misc 0x%08x cc1 0x%08x %s cc2 0x%08x %s attached %d cc=%s\n",
   278			misc, *cc1, cc_to_name(*cc1), *cc2, cc_to_name(*cc2), !!(misc & CC_ATTACHED),
   279			misc_to_cc(misc));
   280	
   281		return ret;
   282	}
   283	
   284	static void qcom_pmic_set_cc_debounce(struct pmic_typec *pmic_typec)
   285	{
   286		pmic_typec->debouncing_cc = true;
   287		schedule_delayed_work(&pmic_typec->cc_debounce_dwork,
   288				      msecs_to_jiffies(2));
   289	}
   290	
   291	int qcom_pmic_tcpm_typec_set_cc(struct pmic_typec *pmic_typec,
   292					enum typec_cc_status cc)
   293	{
   294		struct device *dev = pmic_typec->dev;
   295		unsigned int mode, currsrc;
 > 296		unsigned int orientation, misc;
   297		unsigned long flags;
   298		int ret;
   299	
   300		spin_lock_irqsave(&pmic_typec->lock, flags);
   301	
   302		ret = regmap_read(pmic_typec->regmap,
   303				  pmic_typec->base + TYPEC_MISC_STATUS_REG,
   304				  &misc);
   305		if (ret)
   306			goto done;
   307	
   308		orientation = !!(misc & CC_ORIENTATION);
   309	
   310		mode = EN_SRC_ONLY;
   311	
   312		switch (cc) {
   313		case TYPEC_CC_OPEN:
   314			currsrc = TYPEC_SRC_RP_SEL_80UA;
   315			break;
   316		case TYPEC_CC_RP_DEF:
   317			currsrc = TYPEC_SRC_RP_SEL_80UA;
   318			break;
   319		case TYPEC_CC_RP_1_5:
   320			currsrc = TYPEC_SRC_RP_SEL_180UA;
   321			break;
   322		case TYPEC_CC_RP_3_0:
   323			currsrc = TYPEC_SRC_RP_SEL_330UA;
   324			break;
   325		case TYPEC_CC_RD:
   326			currsrc = TYPEC_SRC_RP_SEL_80UA;
   327			mode = EN_SNK_ONLY;
   328			break;
   329		default:
   330			dev_warn(dev, "unexpected set_cc %d\n", cc);
   331			ret = -EINVAL;
   332			goto done;
   333		}
   334	
   335		if (mode == EN_SRC_ONLY) {
   336			ret = regmap_write(pmic_typec->regmap,
   337					   pmic_typec->base + TYPEC_CURRSRC_CFG_REG,
   338					   currsrc);
   339			if (ret)
   340				goto done;
   341		}
   342	
   343		pmic_typec->cc = cc;
   344		qcom_pmic_set_cc_debounce(pmic_typec);
   345		ret = 0;
   346	
   347	done:
   348		spin_unlock_irqrestore(&pmic_typec->lock, flags);
   349	
   350		dev_dbg(dev, "set_cc: currsrc=%x %s mode %s debounce %d attached %d cc=%s\n",
   351			currsrc, rp_sel_to_name(currsrc),
   352			mode == EN_SRC_ONLY ? "EN_SRC_ONLY" : "EN_SNK_ONLY",
   353			pmic_typec->debouncing_cc, !!(misc & CC_ATTACHED),
   354			misc_to_cc(misc));
   355	
   356		return ret;
   357	}
   358	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux