Received: by 10.213.65.16 with SMTP id m16csp172456imf; Sun, 11 Mar 2018 22:24:04 -0700 (PDT) X-Google-Smtp-Source: AG47ELvC4g70WWSjiDHOWRrh7duOiAyEnl2ZtHAb4ZkgEWfyYOGJ6rP9CjLZ7XdD+BWpr06OAPTS X-Received: by 2002:a17:902:8602:: with SMTP id f2-v6mr6884484plo.6.1520832244454; Sun, 11 Mar 2018 22:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520832244; cv=none; d=google.com; s=arc-20160816; b=JGlBrD+vG+W3JPKNkKnesbPg83/i+NyDkoo9LSXDc3+asp+40e7+yyPcjJ+nwsM2Qm dJzMAL+VbudxTHv9cnuDXuNTiHsKdHcY8FcOcJ1DxoYFfjsVWfJdGdL32REvlR8RBNPA 4n5x4ZruTtqAIsW2PTLaL2fVo9nldsNRbjPn95olVgD2sZKkwU2iyeTB3tURXh0qodNz 3PnNSv7RTBCF0P631i76BVN671O9I6Kp5imk7+63PJnsC4X8yDGNcT/zpOgd6JxCX8cx ahjcgLT2UtZSNTJO7Iq4MYJp5iQqAmvbsZVzmt02kU0oywNCPm5FscOTVkpcgisuwzXQ YA/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=cvbzJKGjrwRn7q6NKUR6PYVv1hrhRVHgi5j3Fvk2uQ0=; b=iXb9RGs+p8GgB2RWxIAQy/87A0FR2rJ+PN/fJnZDF7euXrFuI5gBBrlQd3Rvi/8RS7 3hCIbbWLkCEivl9rSQDT/Glp5TnJN112Wu6Wq/P+8UylqCDNqoM4TNfHHT5bE7Nm4x9q NCn+fKCadYVAZb0MyRR6mwtCe5f4grzrGWanuY8cTAe1SX3jwhAzJ3KF4OKEMESPSGfe os0Y/aP62b8WjG9qsnqg7UW5GQQXvBEG1Y7jHUjsopR0hfbHwkqM3RGADVEgy29rNqDG E8lYxnwciZfwr4Ji2ZTwGEzAUf5TEZtPBhfbI7b4yZaHAan70hDj7EJVIylspv0OGAVa wCqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u4iLnPKM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a33-v6si5343731pld.653.2018.03.11.22.23.39; Sun, 11 Mar 2018 22:24:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u4iLnPKM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751373AbeCLFWN (ORCPT + 99 others); Mon, 12 Mar 2018 01:22:13 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:33612 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbeCLFWM (ORCPT ); Mon, 12 Mar 2018 01:22:12 -0400 Received: by mail-qk0-f196.google.com with SMTP id f25so10162818qkm.0; Sun, 11 Mar 2018 22:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=cvbzJKGjrwRn7q6NKUR6PYVv1hrhRVHgi5j3Fvk2uQ0=; b=u4iLnPKMiyAmmoa5vacK/N0B6LzbToHrnQg2fbfiRu4qzSTFs5NwJ0qQECUzNhKThQ ybJV4DNRZDyzJNHiP+g+39RrxEQ3bee3UmSgpi4Tv1oRH42hMJCqNLdEUi8RZZb1SF3u X6wIgL4Ozcy7d10P63JZRg7cthStw+IyGI8dRsdKjkBIbr085LPzTqKCB7+hMrAP2ZYM 1fAtF59UMiaK1IQL4oG+r7pUA+GdOuK7lIb8+jvco8NryzPmlEMeTqD0+BP0LVh0mhzX 507eSfb6UyVrntzn+HBRDI2993diuwjrTpyOCFhbibQi0xejF1/6IW/ZHEzE3/JfzUET 1gAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=cvbzJKGjrwRn7q6NKUR6PYVv1hrhRVHgi5j3Fvk2uQ0=; b=FQvW803K5qwwGsEOeTZClezjQ25KLBA2WExgxl+Ywf6g/YSo9Kp7f5BIJlHV/ROmzf vQE5rCU+jlbIfaNl3HcRh9hW5ReDfSCBJjj058ZhcoOij66wMBDMN6vm48/X3D5F+6Iq GwBQn/nC/sDnoDMASqzouwdJeZxCyR4Cohyu778kknMo9lT+VZ79JMtFzs7o7IwfhqZj WBKs8VORxp1PeOip9ndnzwUkh5AK6Rp6g8NSCQmMEKDU3/ZVh4k35yGEhEGDiK2vnv1E /5y9MFA7eiwHInIut8ua5OhDkg8CHyRSNutu4oRHUcixbiP9vfBJdOsLP5uxJ71uN1Jv sb+g== X-Gm-Message-State: AElRT7HEuXHQEZ/K3fRaIjRBEtj4V5Wtnip8wV8OWXPZLw3OYvDsdKIa Gg5lvg0k+sk5NJ6dtK/S9SJmFhWA8bT4b4LVTZjXchoD X-Received: by 10.55.198.14 with SMTP id b14mr4975574qkj.174.1520832131205; Sun, 11 Mar 2018 22:22:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.53.183 with HTTP; Sun, 11 Mar 2018 22:22:10 -0700 (PDT) In-Reply-To: References: <1520301032-10109-1-git-send-email-leechu729@gmail.com> From: =?UTF-8?B?5p2O5pu45biG?= Date: Mon, 12 Mar 2018 13:22:10 +0800 Message-ID: Subject: Re: [PATCH v7] staging: typec: handle vendor defined part and modify drp toggling flow To: Jun Li Cc: Greg Kroah-Hartman , "heikki.krogerus@linux.intel.com" , "linux@roeck-us.net" , "greg@kroah.com" , "shufan_lee@richtek.com" , "cy_huang@richtek.com" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jun, Thank you. 2018-03-12 12:33 GMT+08:00 Jun Li : > Hi, > >> +static irqreturn_t _tcpci_irq(int irq, void *dev_id) { >> + struct tcpci *tcpci =3D dev_id; >> + >> + return tcpci_irq(tcpci); >> +} >> > ... > >> + err =3D devm_request_threaded_irq(&client->dev, client->irq, NULL, >> + _tcpci_irq, >> IRQF_ONESHOT | IRQF_TRIGGER_LOW, >> - dev_name(tcpci->dev), tcpci); >> + dev_name(&client->dev), chip); > > - dev_name(&client->dev), chip); > + dev_name(&client->dev), chip->tcpci); > > Did you ever test this patch? I've tested this patch with tcpci_rt1711h.c that will be sent out for reviewing in the next patch after tcpci's modification is passed. Because interrupt handler is registered in tcpci_rt1711h.c, here is the place I didn't notice. The interrupt handler for tcpci.c should be modified as following: static irqreturn_t _tcpci_irq(int irq, void *dev_id) { - struct tcpci *tcpci =3D dev_id; + struct tcpci_chip *chip =3D dev_id; - return tcpci_irq(tcpci); + return tcpci_irq(chip->tcpci); } > > I noticed Greg already picked this patch[1]: > [1] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit= /?h=3Dusb-testing&id=3D8f94390226487bcb86c554ddc12eef0d27bdec3b > > One more minor comment below. > > Jun Li > >> diff --git a/drivers/staging/typec/tcpci.h b/drivers/staging/typec/tcpci= .h index >> fdfb06c..a2c1754 100644 >> --- a/drivers/staging/typec/tcpci.h >> +++ b/drivers/staging/typec/tcpci.h >> @@ -59,6 +59,7 @@ >> #define TCPC_POWER_CTRL_VCONN_ENABLE BIT(0) >> >> #define TCPC_CC_STATUS 0x1d >> +#define TCPC_CC_STATUS_DRPRST BIT(5) > > Defined but not used. This definition can be removed for now. > >> #define TCPC_CC_STATUS_TERM BIT(4) >> #define TCPC_CC_STATUS_CC2_SHIFT 2 >> #define TCPC_CC_STATUS_CC2_MASK 0x3 >> @@ -121,4 +122,18 @@ >> #define TCPC_VBUS_VOLTAGE_ALARM_HI_CFG 0x76 >> #define TCPC_VBUS_VOLTAGE_ALARM_LO_CFG 0x78 >> >> +struct tcpci; >> +struct tcpci_data { >> + struct regmap *regmap; >> + int (*init)(struct tcpci *tcpci, struct tcpci_data *data); >> + int (*set_vconn)(struct tcpci *tcpci, struct tcpci_data *data, >> + bool enable); >> + int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *= data, >> + enum typec_cc_status cc); >> +}; >> + >> +struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data >> +*data); void tcpci_unregister_port(struct tcpci *tcpci); irqreturn_t >> +tcpci_irq(struct tcpci *tcpci); >> + >> #endif /* __LINUX_USB_TCPCI_H */ >> -- >> 1.9.1 > --=20 Best Regards, =E6=9B=B8=E5=B8=86