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] [thread-next>] [day] [month] [year] [list]
Message-ID: <202006100937.st7V5Pyj%lkp@intel.com>
Date:   Wed, 10 Jun 2020 09:25:34 +0800
From:   kernel test robot <lkp@...el.com>
To:     Wesley Cheng <wcheng@...eaurora.org>,
        heikki.krogerus@...ux.intel.com, gregkh@...uxfoundation.org,
        mark.rutland@....com, robh+dt@...nel.org, agross@...nel.org,
        bjorn.andersson@...aro.org
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org,
        linux-usb@...r.kernel.org
Subject: Re: [PATCH 1/3] usb: typec: Add QCOM PMIC typec detection driver

Hi Wesley,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on robh/for-next v5.7 next-20200609]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Wesley-Cheng/Introduce-PMIC-based-USB-type-C-detection/20200610-050045
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All error/warnings (new ones prefixed by >>, old ones prefixed by <<):

>> drivers/usb/typec/qcom-pmic-typec.c:86:6: warning: no previous prototype for 'qcom_pmic_typec_bh_work' [-Wmissing-prototypes]
86 | void qcom_pmic_typec_bh_work(struct work_struct *w)
|      ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/typec/qcom-pmic-typec.c:116:13: warning: no previous prototype for 'qcom_pmic_typec_interrupt' [-Wmissing-prototypes]
116 | irqreturn_t qcom_pmic_typec_interrupt(int irq, void *_qcom_usb)
|             ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/usb/typec/qcom-pmic-typec.c:7:
drivers/usb/typec/qcom-pmic-typec.c: In function 'qcom_pmic_typec_typec_hw_init':
>> include/linux/build_bug.h:16:51: error: negative width in bit-field '<anonymous>'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
|                                                   ^
include/linux/regmap.h:84:36: note: in definition of macro 'regmap_update_bits'
84 |  regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
|                                    ^~~~
include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr(          |   ^~~~~~~~~~~~~~~~~
include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
39 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
|   ^~~~~~~~~~~~~~~~~~~
>> drivers/usb/typec/qcom-pmic-typec.c:48:34: note: in expansion of macro 'GENMASK'
48 | #define TYPEC_INTR_EN_CFG_1_MASK GENMASK(0, 7)
|                                  ^~~~~~~
>> drivers/usb/typec/qcom-pmic-typec.c:132:7: note: in expansion of macro 'TYPEC_INTR_EN_CFG_1_MASK'
132 |       TYPEC_INTR_EN_CFG_1_MASK, 0);
|       ^~~~~~~~~~~~~~~~~~~~~~~~

vim +/qcom_pmic_typec_bh_work +86 drivers/usb/typec/qcom-pmic-typec.c

    31	
    32	#define TYPEC_BASE			0x1500
    33	#define TYPEC_MISC_STATUS		(TYPEC_BASE + 0xb)
    34	#define CC_ATTACHED			BIT(0)
    35	#define CC_ORIENTATION			BIT(1)
    36	#define SNK_SRC_MODE			BIT(6)
    37	#define TYPEC_MODE_CFG			(TYPEC_BASE + 0x44)
    38	#define TYPEC_DISABLE_CMD		BIT(0)
    39	#define EN_SNK_ONLY			BIT(1)
    40	#define EN_SRC_ONLY			BIT(2)
    41	#define EN_TRY_SNK			BIT(4)
    42	#define TYPEC_VCONN_CONTROL		(TYPEC_BASE + 0x46)
    43	#define VCONN_EN_SRC			BIT(0)
    44	#define VCONN_EN_VAL			BIT(1)
    45	#define TYPEC_EXIT_STATE_CFG		(TYPEC_BASE + 0x50)
    46	#define SEL_SRC_UPPER_REF		BIT(2)
    47	#define TYPEC_INTR_EN_CFG_1		(TYPEC_BASE + 0x5e)
  > 48	#define TYPEC_INTR_EN_CFG_1_MASK	GENMASK(0, 7)
    49	
    50	struct qcom_pmic_typec {
    51		struct device		*dev;
    52		struct fwnode_handle	*fwnode;
    53		struct regmap		*regmap;
    54		struct work_struct	bh_work;
    55	
    56		struct typec_capability *cap;
    57		struct typec_port	*port;
    58		struct usb_role_switch *role_sw;
    59	
    60		struct regulator_desc usb_vbus_rdesc;
    61		struct regulator_dev *usb_vbus_reg;
    62	};
    63	
    64	static int qcom_pmic_typec_vbus_enable(struct qcom_pmic_typec *qcom_usb)
    65	{
    66		int rc;
    67	
    68		rc = regmap_update_bits(qcom_usb->regmap, CMD_OTG, OTG_EN, OTG_EN);
    69		if (rc)
    70			dev_err(qcom_usb->dev, "failed to update OTG_CTL\n");
    71	
    72		return rc;
    73	}
    74	
    75	static int qcom_pmic_typec_vbus_disable(struct qcom_pmic_typec *qcom_usb)
    76	{
    77		int rc;
    78	
    79		rc = regmap_update_bits(qcom_usb->regmap, CMD_OTG, OTG_EN, 0);
    80		if (rc)
    81			dev_err(qcom_usb->dev, "failed to update OTG_CTL\n");
    82	
    83		return rc;
    84	}
    85	
  > 86	void qcom_pmic_typec_bh_work(struct work_struct *w)
    87	{
    88		struct qcom_pmic_typec *qcom_usb = container_of(w,
    89								struct qcom_pmic_typec,
    90								bh_work);
    91		enum typec_orientation orientation;
    92		enum usb_role role;
    93		unsigned int stat;
    94	
    95		regmap_read(qcom_usb->regmap, TYPEC_MISC_STATUS, &stat);
    96	
    97		if (stat & CC_ATTACHED) {
    98			orientation = ((stat & CC_ORIENTATION) >> 1) ?
    99					TYPEC_ORIENTATION_REVERSE :
   100					TYPEC_ORIENTATION_NORMAL;
   101			typec_set_orientation(qcom_usb->port, orientation);
   102	
   103			role = (stat & SNK_SRC_MODE) ? USB_ROLE_HOST : USB_ROLE_DEVICE;
   104			if (role == USB_ROLE_HOST)
   105				qcom_pmic_typec_vbus_enable(qcom_usb);
   106			else
   107				qcom_pmic_typec_vbus_disable(qcom_usb);
   108	
   109			usb_role_switch_set_role(qcom_usb->role_sw, role);
   110		} else {
   111			usb_role_switch_set_role(qcom_usb->role_sw, USB_ROLE_NONE);
   112			qcom_pmic_typec_vbus_disable(qcom_usb);
   113		}
   114	}
   115	
 > 116	irqreturn_t qcom_pmic_typec_interrupt(int irq, void *_qcom_usb)
   117	{
   118		struct qcom_pmic_typec *qcom_usb = _qcom_usb;
   119	
   120		queue_work(system_power_efficient_wq, &qcom_usb->bh_work);
   121	
   122		return IRQ_HANDLED;
   123	}
   124	
   125	static void qcom_pmic_typec_typec_hw_init(struct qcom_pmic_typec *qcom_usb)
   126	{
   127		u8 mode;
   128	
   129		regmap_update_bits(qcom_usb->regmap, TYPE_C_CFG_REG, BC12_START_ON_CC,
   130				   0);
   131		regmap_update_bits(qcom_usb->regmap, TYPEC_INTR_EN_CFG_1,
 > 132				   TYPEC_INTR_EN_CFG_1_MASK, 0);
   133	
   134		if (qcom_usb->cap->type != TYPEC_PORT_DRP)
   135			mode = (qcom_usb->cap->type == TYPEC_PORT_SNK) ?
   136						EN_SNK_ONLY : EN_SRC_ONLY;
   137		else
   138			mode = EN_TRY_SNK;
   139		regmap_update_bits(qcom_usb->regmap, TYPEC_MODE_CFG,
   140				   EN_SNK_ONLY | EN_TRY_SNK | EN_SRC_ONLY, mode);
   141	
   142		regmap_update_bits(qcom_usb->regmap, TYPEC_VCONN_CONTROL,
   143				   VCONN_EN_SRC | VCONN_EN_VAL, VCONN_EN_SRC);
   144		regmap_update_bits(qcom_usb->regmap, TYPEC_VCONN_CONTROL,
   145				   VCONN_EN_SRC | VCONN_EN_VAL, VCONN_EN_SRC);
   146		regmap_update_bits(qcom_usb->regmap, TYPEC_EXIT_STATE_CFG,
   147				   SEL_SRC_UPPER_REF, SEL_SRC_UPPER_REF);
   148		regmap_update_bits(qcom_usb->regmap, OTG_CFG, OTG_EN_SRC_CFG,
   149				   OTG_EN_SRC_CFG);
   150	}
   151	

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

Download attachment ".config.gz" of type "application/gzip" (74956 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ