From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DD23C282C3 for ; Tue, 22 Jan 2019 04:42:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 320C520861 for ; Tue, 22 Jan 2019 04:42:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CMjGBFJk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbfAVEmX (ORCPT ); Mon, 21 Jan 2019 23:42:23 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34662 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726853AbfAVEmW (ORCPT ); Mon, 21 Jan 2019 23:42:22 -0500 Received: by mail-pf1-f193.google.com with SMTP id h3so11148410pfg.1 for ; Mon, 21 Jan 2019 20:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9cxSpkTnGGhDFtpbuo5KgwEe310Cl8jJZQtU2Bn/L0s=; b=CMjGBFJkmAm62T2PhVmOFGWDd25RJpvN7q5KrUtJBZcEcZS6bKdetC3a975rTtGFGy NE5gsfQ3m6P7FkYZJV7mjJX9AXWmQ/rpO/0FiFgx+VYveMAiy/HTcvxQC+gPE5lIF2rX WauedkQHo5M6WQYT00EEUFCYiHUzPldqh54hRokVb36lSr9zzltHugxA6E8VGZXUXHDf lmnIRYZNpq0Lc8q29cUjK630QoLDUFA/fgF1+noi4xTa3FO1PWZfuuL0jbztbvhF6l3/ 9UeFPtdIkW+fRedRioHN6h+l2yv6IaURq1TpqtQaw7jqrVsVidS6GNRuuA5LnFzwKp0r +EYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9cxSpkTnGGhDFtpbuo5KgwEe310Cl8jJZQtU2Bn/L0s=; b=b2HcVC0yKYT1GJIuAuzA0EbDjhDBUs1rZI7AFL5QU23TpTJz0qTPABOZlwm7sJr2A4 GrZ+wnR6/0cjIPqYBoanvhOHs/5ImnzoZvBg58v4gxNUskkioNX1g8s97Ckl/40gjVhr 3RCDQEijorWejPgKSI3SE6hwM1lN1dd5wqWrA9ssTClANzi7x9ja+MvuTJ45wZ4vAzF7 TReK/YHFxx66jcwEVIw9odXydwCR1OUZIsTVKuSreGnUDWnUwK3t0bQqxiZNvdF+Tk2s wg8f0NToV2PAUY2c4D/bMs5LqqZkAeS+dMmG4iH8n3Hwm49ojLnp31H3zj3VJm4MPz5H VZBg== X-Gm-Message-State: AJcUukcWP55uuoV8PodfuQfpM6HOKfGx3kpvLt+dVW8yJ28tlZfS611p RA0Zeky+2YwxyuCuH/Djbj4= X-Google-Smtp-Source: ALg8bN6++RiDJgLCDQyxyI5cDoBZUtE3Uydo2FygWDAGeLsfZL9/hLU14/FbVZmDPl7hwrmNS/bSLQ== X-Received: by 2002:a62:d448:: with SMTP id u8mr32051072pfl.105.1548132141354; Mon, 21 Jan 2019 20:42:21 -0800 (PST) Received: from chikyu ([106.51.36.2]) by smtp.gmail.com with ESMTPSA id l85sm22551255pfg.161.2019.01.21.20.42.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jan 2019 20:42:20 -0800 (PST) Date: Tue, 22 Jan 2019 10:12:16 +0530 From: Vijai Kumar K To: cw00.choi@samsung.com Cc: kbuild-all@01.org, linux-kernel@vger.kernel.org, myungjoo.ham@samsung.com Subject: Re: [PATCH] drivers: extcon: Add support for ptn5150 Message-ID: <20190122044216.GA23297@chikyu> References: <1548061749-15950-1-git-send-email-vijaikumar.kanagarajan@gmail.com> <201901220830.8kqj0YjW%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201901220830.8kqj0YjW%fengguang.wu@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chanwoo Choi, This is the first time I am sending a driver to LKML. I have a few doubts. Can you please clarify them when you are free? 1. I have developed and tested this patch on 4.14.89 kernel. When trying to mainline the driver should I rebase and send the patch on top of current tree(v5.0-rc2)? 2. Is there any specific git on which I should test this driver on? Like below? https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git Thanks, Vijai Kumar K On Tue, Jan 22, 2019 at 08:05:33AM +0800, kbuild test robot wrote: > Hi Vijai, > > Thank you for the patch! Yet something to improve: > > [auto build test ERROR on chanwoo-extcon/extcon-next] > [also build test ERROR on v5.0-rc2] > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Vijai-Kumar-K/drivers-extcon-Add-support-for-ptn5150/20190122-041153 > base: https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-next > config: sh-allyesconfig (attached as .config) > compiler: sh4-linux-gnu-gcc (Debian 8.2.0-11) 8.2.0 > reproduce: > 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 > GCC_VERSION=8.2.0 make.cross ARCH=sh > > All error/warnings (new ones prefixed by >>): > > drivers//extcon/extcon-ptn5150.c: In function 'ptn5150_irq_work': > >> drivers//extcon/extcon-ptn5150.c:93:5: error: implicit declaration of function 'extcon_set_state_sync'; did you mean 'extcon_get_state'? [-Werror=implicit-function-declaration] > extcon_set_state_sync(info->edev, > ^~~~~~~~~~~~~~~~~~~~~ > extcon_get_state > drivers//extcon/extcon-ptn5150.c: In function 'ptn5150_i2c_probe': > >> drivers//extcon/extcon-ptn5150.c:255:15: error: implicit declaration of function 'devm_extcon_dev_allocate'; did you mean 'extcon_get_state'? [-Werror=implicit-function-declaration] > info->edev = devm_extcon_dev_allocate(info->dev, ptn5150_extcon_cable); > ^~~~~~~~~~~~~~~~~~~~~~~~ > extcon_get_state > >> drivers//extcon/extcon-ptn5150.c:255:13: warning: assignment to 'struct extcon_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion] > info->edev = devm_extcon_dev_allocate(info->dev, ptn5150_extcon_cable); > ^ > >> drivers//extcon/extcon-ptn5150.c:262:8: error: implicit declaration of function 'devm_extcon_dev_register'; did you mean 'devm_pinctrl_register'? [-Werror=implicit-function-declaration] > ret = devm_extcon_dev_register(info->dev, info->edev); > ^~~~~~~~~~~~~~~~~~~~~~~~ > devm_pinctrl_register > cc1: some warnings being treated as errors > > vim +93 drivers//extcon/extcon-ptn5150.c > > 51 > 52 static void ptn5150_irq_work(struct work_struct *work) > 53 { > 54 struct ptn5150_info *info = container_of(work, > 55 struct ptn5150_info, irq_work); > 56 int ret = 0; > 57 unsigned int reg_data; > 58 unsigned int port_status; > 59 unsigned int vbus; > 60 unsigned int cable_attach; > 61 unsigned int int_status; > 62 > 63 if (!info->edev) > 64 return; > 65 > 66 mutex_lock(&info->mutex); > 67 > 68 ret = regmap_read(info->regmap, PTN5150_REG_CC_STATUS, ®_data); > 69 if (ret) { > 70 dev_err(info->dev, > 71 "failed to read CC STATUS %d\n", ret); > 72 mutex_unlock(&info->mutex); > 73 return; > 74 } > 75 /* Clear interrupt. Read would clear the register */ > 76 ret = regmap_read(info->regmap, PTN5150_REG_INT_STATUS, &int_status); > 77 if (ret) { > 78 dev_err(info->dev, > 79 "failed to read INT STATUS %d\n", ret); > 80 mutex_unlock(&info->mutex); > 81 return; > 82 } > 83 > 84 if (int_status) { > 85 cable_attach = int_status & PTN5150_REG_INT_CABLE_ATTACH_MASK; > 86 if (cable_attach) { > 87 port_status = ((reg_data & > 88 PTN5150_REG_CC_PORT_ATTACHMENT_MASK) >> > 89 PTN5150_REG_CC_PORT_ATTACHMENT_SHIFT); > 90 > 91 switch (port_status) { > 92 case PTN5150_DFP_ATTACHED: > > 93 extcon_set_state_sync(info->edev, > 94 EXTCON_USB_HOST, false); > 95 gpiod_set_value(info->vbus_gpiod, 0); > 96 extcon_set_state_sync(info->edev, EXTCON_USB, > 97 true); > 98 break; > 99 case PTN5150_UFP_ATTACHED: > 100 extcon_set_state_sync(info->edev, EXTCON_USB, > 101 false); > 102 vbus = ((reg_data & > 103 PTN5150_REG_CC_VBUS_DETECTION_MASK) >> > 104 PTN5150_REG_CC_VBUS_DETECTION_SHIFT); > 105 if (vbus) > 106 gpiod_set_value(info->vbus_gpiod, 0); > 107 else > 108 gpiod_set_value(info->vbus_gpiod, 1); > 109 > 110 extcon_set_state_sync(info->edev, > 111 EXTCON_USB_HOST, true); > 112 break; > 113 default: > 114 dev_err(info->dev, > 115 "Unknown Port status : %x\n", > 116 port_status); > 117 break; > 118 } > 119 } else { > 120 extcon_set_state_sync(info->edev, > 121 EXTCON_USB_HOST, false); > 122 extcon_set_state_sync(info->edev, > 123 EXTCON_USB, false); > 124 gpiod_set_value(info->vbus_gpiod, 0); > 125 } > 126 } > 127 > 128 /* Clear interrupt. Read would clear the register */ > 129 ret = regmap_read(info->regmap, PTN5150_REG_INT_REG_STATUS, > 130 &int_status); > 131 if (ret) { > 132 dev_err(info->dev, > 133 "failed to read INT REG STATUS %d\n", ret); > 134 mutex_unlock(&info->mutex); > 135 return; > 136 } > 137 > 138 > 139 mutex_unlock(&info->mutex); > 140 } > 141 > 142 > 143 static irqreturn_t ptn5150_irq_handler(int irq, void *data) > 144 { > 145 struct ptn5150_info *info = data; > 146 > 147 schedule_work(&info->irq_work); > 148 > 149 return IRQ_HANDLED; > 150 } > 151 > 152 static int ptn5150_init_dev_type(struct ptn5150_info *info) > 153 { > 154 unsigned int reg_data, vendor_id, version_id; > 155 int ret; > 156 > 157 ret = regmap_read(info->regmap, PTN5150_REG_DEVICE_ID, ®_data); > 158 if (ret) { > 159 dev_err(info->dev, "failed to read DEVICE_ID %d\n", ret); > 160 return -EINVAL; > 161 } > 162 > 163 vendor_id = ((reg_data & PTN5150_REG_DEVICE_ID_VENDOR_MASK) >> > 164 PTN5150_REG_DEVICE_ID_VENDOR_SHIFT); > 165 version_id = ((reg_data & PTN5150_REG_DEVICE_ID_VERSION_MASK) >> > 166 PTN5150_REG_DEVICE_ID_VERSION_SHIFT); > 167 > 168 dev_info(info->dev, "Device type: version: 0x%x, vendor: 0x%x\n", > 169 version_id, vendor_id); > 170 > 171 /* Clear any existing interrupts */ > 172 ret = regmap_read(info->regmap, PTN5150_REG_INT_STATUS, ®_data); > 173 if (ret) { > 174 dev_err(info->dev, > 175 "failed to read PTN5150_REG_INT_STATUS %d\n", > 176 ret); > 177 return -EINVAL; > 178 } > 179 > 180 ret = regmap_read(info->regmap, PTN5150_REG_INT_REG_STATUS, ®_data); > 181 if (ret) { > 182 dev_err(info->dev, > 183 "failed to read PTN5150_REG_INT_REG_STATUS %d\n", ret); > 184 return -EINVAL; > 185 } > 186 > 187 return 0; > 188 } > 189 > 190 static int ptn5150_i2c_probe(struct i2c_client *i2c, > 191 const struct i2c_device_id *id) > 192 { > 193 struct device *dev = &i2c->dev; > 194 struct device_node *np = i2c->dev.of_node; > 195 struct ptn5150_info *info; > 196 int ret; > 197 > 198 if (!np) > 199 return -EINVAL; > 200 > 201 info = devm_kzalloc(&i2c->dev, sizeof(*info), GFP_KERNEL); > 202 if (!info) > 203 return -ENOMEM; > 204 i2c_set_clientdata(i2c, info); > 205 > 206 info->dev = &i2c->dev; > 207 info->i2c = i2c; > 208 info->int_gpiod = devm_gpiod_get(&i2c->dev, "int", GPIOD_IN); > 209 if (!info->int_gpiod) { > 210 dev_err(dev, "failed to get INT GPIO\n"); > 211 return -EINVAL; > 212 } > 213 info->vbus_gpiod = devm_gpiod_get(&i2c->dev, "vbus", GPIOD_IN); > 214 if (!info->vbus_gpiod) { > 215 dev_err(dev, "failed to get VBUS GPIO\n"); > 216 return -EINVAL; > 217 } > 218 ret = gpiod_direction_output(info->vbus_gpiod, 0); > 219 if (ret) { > 220 dev_err(dev, "failed to set VBUS GPIO direction\n"); > 221 return -EINVAL; > 222 } > 223 > 224 mutex_init(&info->mutex); > 225 > 226 INIT_WORK(&info->irq_work, ptn5150_irq_work); > 227 > 228 info->regmap = devm_regmap_init_i2c(i2c, &ptn5150_regmap_config); > 229 if (IS_ERR(info->regmap)) { > 230 ret = PTR_ERR(info->regmap); > 231 dev_err(info->dev, "failed to allocate register map: %d\n", > 232 ret); > 233 return ret; > 234 } > 235 > 236 if (info->int_gpiod) { > 237 info->irq = gpiod_to_irq(info->int_gpiod); > 238 if (info->irq < 0) { > 239 dev_err(dev, "failed to get INTB IRQ\n"); > 240 return info->irq; > 241 } > 242 > 243 ret = devm_request_threaded_irq(dev, info->irq, NULL, > 244 ptn5150_irq_handler, > 245 IRQF_TRIGGER_FALLING | > 246 IRQF_ONESHOT, > 247 i2c->name, info); > 248 if (ret < 0) { > 249 dev_err(dev, "failed to request handler for INTB IRQ\n"); > 250 return ret; > 251 } > 252 } > 253 > 254 /* Allocate extcon device */ > > 255 info->edev = devm_extcon_dev_allocate(info->dev, ptn5150_extcon_cable); > 256 if (IS_ERR(info->edev)) { > 257 dev_err(info->dev, "failed to allocate memory for extcon\n"); > 258 return -ENOMEM; > 259 } > 260 > 261 /* Register extcon device */ > > 262 ret = devm_extcon_dev_register(info->dev, info->edev); > 263 if (ret) { > 264 dev_err(info->dev, "failed to register extcon device\n"); > 265 return ret; > 266 } > 267 > 268 /* Initialize PTN5150 device and print vendor id and version id */ > 269 ret = ptn5150_init_dev_type(info); > 270 if (ret) > 271 return -EINVAL; > 272 > 273 return 0; > 274 } > 275 > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation