From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753785AbbE1Ipi (ORCPT ); Thu, 28 May 2015 04:45:38 -0400 Received: from ns.mm-sol.com ([37.157.136.199]:50862 "EHLO extserv.mm-sol.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753769AbbE1Ipd (ORCPT ); Thu, 28 May 2015 04:45:33 -0400 Message-ID: <1432802731.2348.25.camel@mm-sol.com> Subject: Re: [PATCH v2 0/2] extcon: Inform the state of both ID and VBUS pin for USB From: "Ivan T. Ivanov" To: Chanwoo Choi Cc: linux-kernel@vger.kernel.org, rogerq@ti.com, r.baldyga@samsung.com, peter.chen@freescale.com, kishon@ti.com, balbi@ti.com, cw00.choi@samsung.com, myungjoo.ham@samsung.com Date: Thu, 28 May 2015 11:45:31 +0300 In-Reply-To: <1432728910-10761-1-git-send-email-cw00.choi@samsung.com> References: <1432728910-10761-1-git-send-email-cw00.choi@samsung.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.13.7-fta1.2~trusty Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chanwoo, On Wed, 2015-05-27 at 21:15 +0900, Chanwoo Choi wrote: > Previously, I discussed how to inform the changed state of both ID > and VBUS pin for USB connector on patch-set[1]. > [1] https://lkml.org/lkml/2015/4/2/310 > > So, this patch adds the extcon_set_cable_line_state() function to inform > the additional state of external connectors without additional register/ > unregister functions. This function uses the existing notifier chain > which is registered by extcon_register_notifier() / extcon_register_interest(). > > The extcon_set_cable_line_state() can inform the new state of both > ID and VBUS pin state through extcon_set_cable_line_state(). > > For exmaple: > - On extcon-usb-gpio.c as extcon provider driver as following: > static void usb_extcon_detect_cable(struct work_struct *work) > { > ... > /* check ID and update cable state */ > id = gpiod_get_value_cansleep(info->id_gpiod); > if (id) { > extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, false); > extcon_set_cable_state_(info->edev, EXTCON_USB, true); > > extcon_set_cable_line_state(info->edev, EXTCON_USB, > EXTCON_USB_ID_HIGH); I am getting more and more confused :-). Why EXTCON_USB is now used for ID notifications? It should be EXTCON_USB_HOST, no? Why we need another function, framework already have required information from the function one line above, do I miss something? > } else { > extcon_set_cable_state_(info->edev, EXTCON_USB, false); > extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, true); > > extcon_set_cable_line_state(info->edev, EXTCON_USB, > EXTCON_USB_ID_LOW); > } > } > > - On specific extcon consumder driver as following: > static int xxx_probe(struct platform_device *pdev) > { > struct notifier_chain nh; > > nb.notifier_call = extcon_usb_notifier; > ret = extcon_register_notifier(edev, EXTCON_USB, &nb); This is bit misleading. 'nb' could not be in stack. Regards, Ivan