type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define DC_PS_STAT_REG 0x00
defines
#define PS_STAT_VBUS_TRIGGER (1 << 0)
defines
#define PS_STAT_BAT_CHRG_DIR (1 << 2)
defines
#define PS_STAT_VBUS_ABOVE_VHOLD (1 << 3)
defines
#define PS_STAT_VBUS_VALID (1 << 4)
defines
#define PS_STAT_VBUS_PRESENT (1 << 5)
defines
#define DC_BC_GLOBAL_REG 0x2C
defines
#define BC_GLOBAL_RUN (1 << 0)
defines
#define BC_GLOBAL_DET_STAT (1 << 2)
defines
#define BC_GLOBAL_DBP_TOUT (1 << 3)
defines
#define BC_GLOBAL_VLGC_COM_SEL (1 << 4)
defines
#define BC_GLOBAL_DCD_TOUT_MASK 0x60
defines
#define DC_GLOBAL_DCD_TOUT_300MS 0x0
defines
#define DC_GLOBAL_DCD_TOUT_100MS 0x1
defines
#define DC_GLOBAL_DCD_TOUT_500MS 0x2
defines
#define DC_GLOBAL_DCD_TOUT_900MS 0x3
defines
#define BC_GLOBAL_DCD_DET_SEL (1 << 7)
defines
#define DC_BC_VBUS_CNTL_REG 0x2D
defines
#define VBUS_CNTL_DPDM_PD_EN (1 << 4)
defines
#define VBUS_CNTL_DPDM_FD_EN (1 << 5)
defines
#define VBUS_CNTL_FIRST_PO_STAT (1 << 6)
defines
#define DC_BC_USB_STAT_REG 0x2E
defines
#define USB_STAT_BUS_STAT_MASK 0xf
defines
#define USB_STAT_BUS_STAT_POS 0
defines
#define USB_STAT_BUS_STAT_ATHD 0x0
defines
#define USB_STAT_BUS_STAT_CONN 0x1
defines
#define USB_STAT_BUS_STAT_SUSP 0x2
defines
#define USB_STAT_BUS_STAT_CONF 0x3
defines
#define USB_STAT_USB_SS_MODE (1 << 4)
defines
#define USB_STAT_DEAD_BAT_DET (1 << 6)
defines
#define USB_STAT_DBP_UNCFG (1 << 7)
defines
#define DC_BC_DET_STAT_REG 0x2F
defines
#define DET_STAT_MASK 0xE0
defines
#define DET_STAT_POS 5
defines
#define DET_STAT_SDP 0x1
defines
#define DET_STAT_CDP 0x2
defines
#define DET_STAT_DCP 0x3
defines
#define DC_PS_BOOT_REASON_REG 0x2
defines
#define DC_PWRSRC_IRQ_CFG_REG 0x40
defines
#define PWRSRC_IRQ_CFG_MASK 0x1C
defines
#define DC_BC12_IRQ_CFG_REG 0x45
defines
#define BC12_IRQ_CFG_MASK 0x2
defines
#define DC_XPWR_CHARGE_CUR_DCP 2000
defines
#define DC_XPWR_CHARGE_CUR_CDP 1500
defines
#define DC_XPWR_CHARGE_CUR_SDP_500 500
defines
#define DC_XPWR_CHARGE_CUR_SDP_100 100
defines
#define DC_PWRSRC_INTR_NUM 4
defines
#define PWRSRC_DRV_NAME "dollar_cove_pwrsrc"
defines
#define PWRSRC_EXTCON_CABLE_USB "USB"
defines
#define PWRSRC_GPIO_MUX_SEL_PMIC 0
defines
#define PWRSRC_GPIO_MUX_SEL_SOC 1
defines
#define dc_xpwr_pwrsrc_suspend NULL
defines
#define dc_xpwr_pwrsrc_resume NULL
structs
struct dc_pwrsrc_info { struct platform_device *pdev; struct dc_xpwr_pwrsrc_pdata *pdata; int irq[DC_PWRSRC_INTR_NUM]; struct extcon_dev *edev; struct usb_phy *otg; struct notifier_block id_nb; struct notifier_block extcon_nb; struct extcon_specific_cable_nb cable_obj; struct wake_lock wakelock; bool is_sdp;...
functions
void dc_xpwr_pwrsrc_log_rsi(struct platform_device *pdev, char **pwrsrc_rsi_info, int reg_s) { char *rsi_info = pwrsrc_rsi_info[0]; int val, i = 0; int bit_select, clear_mask = 0x0; val = intel_soc_pmic_readb(reg_s); while (rsi_info) { bit_select = (1 << i); if (val & bit_select) { dev_dbg(&pdev-...
functions
int dc_xpwr_vbus_on_status(void) { int ret; ret = intel_soc_pmic_readb(DC_PS_STAT_REG); if (ret < 0) return ret; if (ret & PS_STAT_VBUS_PRESENT) return 1; return 0; }
functions
int handle_pwrsrc_event(struct dc_pwrsrc_info *info) { if (dc_xpwr_vbus_on_status()) { dev_info(&info->pdev->dev, "VBUS attach\n"); if (info->edev) extcon_set_cable_state(info->edev, PWRSRC_EXTCON_CABLE_USB, true); }
functions
int handle_chrg_det_event(struct dc_pwrsrc_info *info) { static bool notify_otg, notify_charger; static struct power_supply_cable_props cable_props; int stat, cfg, ret, vbus_mask = 0; u8 chrg_type; bool vbus_attach = false; ret = intel_soc_pmic_readb(DC_PS_STAT_REG); if (ret < 0) { dev_err(&info->pdev->dev, "...
functions
else if (chrg_type == DET_STAT_CDP) { dev_dbg(&info->pdev->dev, "CDP cable connecetd\n"); notify_otg = true; vbus_mask = 1; notify_charger = true; cable_props.chrg_evt = POWER_SUPPLY_CHARGER_EVENT_CONNECT; cable_props.chrg_type = POWER_SUPPLY_CHARGER_TYPE_USB_CDP; cable_props.ma = DC_XPWR_CHARGE_CUR_C...
functions
else if (chrg_type == DET_STAT_DCP) { dev_dbg(&info->pdev->dev, "DCP cable connecetd\n"); notify_charger = true; cable_props.chrg_evt = POWER_SUPPLY_CHARGER_EVENT_CONNECT; cable_props.chrg_type = POWER_SUPPLY_CHARGER_TYPE_USB_DCP; cable_props.ma = DC_XPWR_CHARGE_CUR_DCP; }
functions
irqreturn_t dc_xpwr_pwrsrc_isr(int irq, void *data) { struct dc_pwrsrc_info *info = data; int i, ret; for (i = 0; i < DC_PWRSRC_INTR_NUM; i++) { if (info->irq[i] == irq) break; }
functions
int dc_pwrsrc_handle_otg_notification(struct notifier_block *nb, unsigned long event, void *param) { struct dc_pwrsrc_info *info = container_of(nb, struct dc_pwrsrc_info, id_nb); int *val = (int *)param; dev_info(&info->pdev->dev, "[OTG notification]evt:%lu val:%d\n", event, val ? *val : -1); if ...
functions
int pwrsrc_otg_registration(struct dc_pwrsrc_info *info) { int ret; /* OTG notification */ info->otg = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR(info->otg)) { dev_warn(&info->pdev->dev, "Failed to get otg transceiver!!\n"); return PTR_ERR(info->otg); }
functions
int pwrsrc_extcon_registration(struct dc_pwrsrc_info *info) { int ret = 0; /* register with extcon */ info->edev = kzalloc(sizeof(struct extcon_dev), GFP_KERNEL); if (!info->edev) { dev_err(&info->pdev->dev, "mem alloc failed\n"); return -ENOMEM; }
functions
bool is_usb_host_mode(struct extcon_dev *evdev) { return !!evdev->state; }
functions
int dc_pwrsrc_handle_extcon_event(struct notifier_block *nb, unsigned long event, void *param) { struct dc_pwrsrc_info *info = container_of(nb, struct dc_pwrsrc_info, extcon_nb); struct extcon_dev *edev = param; int usb_host = is_usb_host_mode(edev); dev_info(&info->pdev->dev, "[extcon notification] ...
functions
int dc_xpwr_pwrsrc_probe(struct platform_device *pdev) { struct dc_pwrsrc_info *info; int ret, i; info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); if (!info) { dev_err(&pdev->dev, "mem alloc failed\n"); return -ENOMEM; }
functions
int dc_xpwr_pwrsrc_remove(struct platform_device *pdev) { struct dc_pwrsrc_info *info = platform_get_drvdata(pdev); int i; for (i = 0; i < DC_PWRSRC_INTR_NUM; i++) free_irq(info->irq[i], info); if (info->pdata->en_chrg_det) { usb_put_phy(info->otg); }
functions
int dc_xpwr_pwrsrc_suspend(struct device *dev) { return 0; }
functions
int dc_xpwr_pwrsrc_resume(struct device *dev) { return 0; }
functions
__init dc_xpwr_pwrsrc_init(void) { return platform_driver_register(&dc_xpwr_pwrsrc_driver); }
functions
__exit dc_xpwr_pwrsrc_exit(void) { platform_driver_unregister(&dc_xpwr_pwrsrc_driver); }
includes
#include <linux/slab.h>
includes
#include <linux/init.h>
includes
#include <linux/module.h>
includes
#include <linux/device.h>
includes
#include <linux/err.h>
includes
#include <linux/platform_device.h>
includes
#include <linux/sched.h>
includes
#include <linux/ratelimit.h>
includes
#include <linux/workqueue.h>
includes
#include <linux/pm_runtime.h>
includes
#include <linux/diagchar.h>
includes
#include <linux/delay.h>
includes
#include <linux/reboot.h>
includes
#include <linux/of.h>
includes
#include <linux/kmemleak.h>
includes
#include <mach/usbdiag.h>
includes
#include <mach/msm_smd.h>
includes
#include <mach/socinfo.h>
includes
#include <mach/restart.h>
defines
#define MODE_CMD 41
defines
#define RESET_ID 2
defines
#define STM_CMD_VERSION_OFFSET 4
defines
#define STM_CMD_MASK_OFFSET 5
defines
#define STM_CMD_DATA_OFFSET 6
defines
#define STM_CMD_NUM_BYTES 7
defines
#define STM_RSP_VALID_INDEX 7
defines
#define STM_RSP_SUPPORTED_INDEX 8
defines
#define STM_RSP_SMD_COMPLY_INDEX 9