cregit-Linux how code gets into the kernel

Release 4.16 drivers/usb/dwc3/drd.c

Directory: drivers/usb/dwc3
// SPDX-License-Identifier: GPL-2.0
/**
 * drd.c - DesignWare USB3 DRD Controller Dual-role support
 *
 * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com
 *
 * Authors: Roger Quadros <rogerq@ti.com>
 */

#include <linux/extcon.h>

#include "debug.h"
#include "core.h"
#include "gadget.h"


static void dwc3_drd_update(struct dwc3 *dwc) { int id; id = extcon_get_state(dwc->edev, EXTCON_USB_HOST); if (id < 0) id = 0; dwc3_set_mode(dwc, id ? DWC3_GCTL_PRTCAP_HOST : DWC3_GCTL_PRTCAP_DEVICE); }

Contributors

PersonTokensPropCommitsCommitProp
Roger Quadros46100.00%1100.00%
Total46100.00%1100.00%


static int dwc3_drd_notifier(struct notifier_block *nb, unsigned long event, void *ptr) { struct dwc3 *dwc = container_of(nb, struct dwc3, edev_nb); dwc3_set_mode(dwc, event ? DWC3_GCTL_PRTCAP_HOST : DWC3_GCTL_PRTCAP_DEVICE); return NOTIFY_DONE; }

Contributors

PersonTokensPropCommitsCommitProp
Roger Quadros48100.00%1100.00%
Total48100.00%1100.00%


int dwc3_drd_init(struct dwc3 *dwc) { int ret; if (dwc->dev->of_node) { if (of_property_read_bool(dwc->dev->of_node, "extcon")) dwc->edev = extcon_get_edev_by_phandle(dwc->dev, 0); if (IS_ERR(dwc->edev)) return PTR_ERR(dwc->edev); dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, &dwc->edev_nb); if (ret < 0) { dev_err(dwc->dev, "couldn't register cable notifier\n"); return ret; } } dwc3_drd_update(dwc); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Roger Quadros118100.00%1100.00%
Total118100.00%1100.00%


void dwc3_drd_exit(struct dwc3 *dwc) { extcon_unregister_notifier(dwc->edev, EXTCON_USB_HOST, &dwc->edev_nb); dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); flush_work(&dwc->drd_work); dwc3_gadget_exit(dwc); }

Contributors

PersonTokensPropCommitsCommitProp
Roger Quadros44100.00%1100.00%
Total44100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Roger Quadros26899.26%133.33%
Greg Kroah-Hartman20.74%266.67%
Total270100.00%3100.00%
Directory: drivers/usb/dwc3
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.