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: <CAGTfZH07XJ3QNcrAVOR0hpCkcXtsyO=tAP7FtROof_Ft5g4Spg@mail.gmail.com>
Date:	Wed, 27 May 2015 23:19:21 +0900
From:	Chanwoo Choi <cwchoi00@...il.com>
To:	Roger Quadros <rogerq@...com>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>,
	Robert Baldyga <r.baldyga@...sung.com>,
	Peter Chen <peter.chen@...escale.com>,
	Kishon Vijay Abraham I <kishon@...com>,
	Felipe Balbi <balbi@...com>, iivanov@...sol.com,
	"myungjoo.ham@...sung.com" <myungjoo.ham@...sung.com>
Subject: Re: [PATCH v2 0/2] extcon: Inform the state of both ID and VBUS pin
 for USB

On Wed, May 27, 2015 at 11:09 PM, Roger Quadros <rogerq@...com> wrote:
> Chanwoo,
>
> On 27/05/15 15:15, 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);
>
>
> Now that all USB line states can be captured by a single cable type
> can we get rid of EXTCON_USB_HOST?

EXTCON_USB_HOST is necessary to inform the event to the user-space by uevent.
For example, when the USB mouse device is attached, extcon have to inform
the staet to user-space. The role of extcon should inform the state of
all external connectors.

>
> That way the extcon driver doesn't need to make any decisions as to
> what mode we're in (host/cable) and this is best left to the USB driver.

The extcon just infrom the new event to the user-space.
If the notification of USB_HOST is not necessary in kernel space,
both device driver and framework in kernel space cannot register the notifier.

Thanks,
Chanwoo Choi

>
> cheers,
> -roger
>
>
>>                          extcon_set_cable_state_(info->edev, EXTCON_USB,
>> true);
>>
>>                          extcon_set_cable_line_state(info->edev,
>> EXTCON_USB,
>>
>> EXTCON_USB_ID_HIGH);
>>                  } 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);
>>                  ...
>>          }
>>
>>          static int extcon_usb_notifier(struct notifier_block *self,
>>                  unsigned long event, void *ptr)
>>          {
>>                  switch (event) {
>>                  case EXTCON_DETACHED:
>>                          printk("USB is detached\n");
>>                          break;
>>                  case EXTCON_ATTACHED:
>>                          printk("USB is attached\n");
>>                          break;
>>
>>                  case EXTCON_USB_ID_LOW:
>>                          printk("USB's ID pin is low state\n");
>>                          break;
>>                  case EXTCON_USB_ID_HIGH:
>>                          printk("USB's ID pin is high state\n");
>>                          break;
>>                  case EXTCON_USB_VBUS_LOW:
>>                          printk("USB's VBUS pin is high state\n");
>>                          break;
>>                  case EXTCON_USB_VBUS_HIGH:
>>                          printk("USB's VBUS pin is high state\n");
>>                          break;
>>                  default:
>>                          return -EINVAL;
>>                  };
>>          }
>>
>> Changes from v1:
>> - Use dev_warn() instead of dev_info() if set the same extcon_line_state
>> value.
>>
>> Chanwoo Choi (2):
>>    extcon: Add extcon_set_cable_line_state() to inform the additional
>> state of external connectors
>>    extcon: usb-gpio: Update the ID pin state of USB when cable state is
>> changed
>>
>>   drivers/extcon/extcon-usb-gpio.c |  6 ++++
>>   drivers/extcon/extcon.c          | 74
>> +++++++++++++++++++++++++++++++++++++++-
>>   include/linux/extcon.h           | 24 +++++++++++++
>>   3 files changed, 103 insertions(+), 1 deletion(-)
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ