linux/drivers/extcon/extcon-intel-cht-wc.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Extcon charger detection driver for Intel Cherrytrail Whiskey Cove PMIC
 * Copyright (C) 2017 Hans de Goede <[email protected]>
 *
 * Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
 * Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
 */

#include <linux/extcon-provider.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/intel_soc_pmic.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/usb/role.h>

#include "extcon-intel.h"

#define CHT_WC_PHYCTRL

#define CHT_WC_CHGRCTRL0
#define CHT_WC_CHGRCTRL0_CHGRRESET
#define CHT_WC_CHGRCTRL0_EMRGCHREN
#define CHT_WC_CHGRCTRL0_EXTCHRDIS
#define CHT_WC_CHGRCTRL0_SWCONTROL
#define CHT_WC_CHGRCTRL0_TTLCK
#define CHT_WC_CHGRCTRL0_CCSM_OFF
#define CHT_WC_CHGRCTRL0_DBPOFF
#define CHT_WC_CHGRCTRL0_CHR_WDT_NOKICK

#define CHT_WC_CHGRCTRL1
#define CHT_WC_CHGRCTRL1_FUSB_INLMT_100
#define CHT_WC_CHGRCTRL1_FUSB_INLMT_150
#define CHT_WC_CHGRCTRL1_FUSB_INLMT_500
#define CHT_WC_CHGRCTRL1_FUSB_INLMT_900
#define CHT_WC_CHGRCTRL1_FUSB_INLMT_1500
#define CHT_WC_CHGRCTRL1_FTEMP_EVENT
#define CHT_WC_CHGRCTRL1_OTGMODE
#define CHT_WC_CHGRCTRL1_DBPEN

#define CHT_WC_USBSRC
#define CHT_WC_USBSRC_STS_MASK
#define CHT_WC_USBSRC_STS_SUCCESS
#define CHT_WC_USBSRC_STS_FAIL
#define CHT_WC_USBSRC_TYPE_SHIFT
#define CHT_WC_USBSRC_TYPE_MASK
#define CHT_WC_USBSRC_TYPE_NONE
#define CHT_WC_USBSRC_TYPE_SDP
#define CHT_WC_USBSRC_TYPE_DCP
#define CHT_WC_USBSRC_TYPE_CDP
#define CHT_WC_USBSRC_TYPE_ACA
#define CHT_WC_USBSRC_TYPE_SE1
#define CHT_WC_USBSRC_TYPE_MHL
#define CHT_WC_USBSRC_TYPE_FLOATING
#define CHT_WC_USBSRC_TYPE_OTHER
#define CHT_WC_USBSRC_TYPE_DCP_EXTPHY

#define CHT_WC_CHGDISCTRL
#define CHT_WC_CHGDISCTRL_OUT
/* 0 - open drain, 1 - regular push-pull output */
#define CHT_WC_CHGDISCTRL_DRV
/* 0 - pin is controlled by SW, 1 - by HW */
#define CHT_WC_CHGDISCTRL_FN

#define CHT_WC_PWRSRC_IRQ
#define CHT_WC_PWRSRC_IRQ_MASK
#define CHT_WC_PWRSRC_STS
#define CHT_WC_PWRSRC_VBUS
#define CHT_WC_PWRSRC_DC
#define CHT_WC_PWRSRC_BATT
#define CHT_WC_PWRSRC_USBID_MASK
#define CHT_WC_PWRSRC_USBID_SHIFT
#define CHT_WC_PWRSRC_RID_ACA
#define CHT_WC_PWRSRC_RID_GND
#define CHT_WC_PWRSRC_RID_FLOAT

#define CHT_WC_VBUS_GPIO_CTLO
#define CHT_WC_VBUS_GPIO_CTLO_OUTPUT
#define CHT_WC_VBUS_GPIO_CTLO_DRV_OD
#define CHT_WC_VBUS_GPIO_CTLO_DIR_OUT

enum cht_wc_mux_select {};

static const unsigned int cht_wc_extcon_cables[] =;

struct cht_wc_extcon_data {};

static int cht_wc_extcon_get_id(struct cht_wc_extcon_data *ext, int pwrsrc_sts)
{}

static int cht_wc_extcon_get_charger(struct cht_wc_extcon_data *ext,
				     bool ignore_errors)
{}

static void cht_wc_extcon_set_phymux(struct cht_wc_extcon_data *ext, u8 state)
{}

static void cht_wc_extcon_set_5v_boost(struct cht_wc_extcon_data *ext,
				       bool enable)
{}

static void cht_wc_extcon_set_otgmode(struct cht_wc_extcon_data *ext,
				      bool enable)
{}

static void cht_wc_extcon_enable_charging(struct cht_wc_extcon_data *ext,
					  bool enable)
{}

/* Small helper to sync EXTCON_CHG_USB_SDP and EXTCON_USB state */
static void cht_wc_extcon_set_state(struct cht_wc_extcon_data *ext,
				    unsigned int cable, bool state)
{}

static void cht_wc_extcon_pwrsrc_event(struct cht_wc_extcon_data *ext)
{}

static irqreturn_t cht_wc_extcon_isr(int irq, void *data)
{}

static int cht_wc_extcon_sw_control(struct cht_wc_extcon_data *ext, bool enable)
{}

static int cht_wc_extcon_find_role_sw(struct cht_wc_extcon_data *ext)
{}

static void cht_wc_extcon_put_role_sw(void *data)
{}

/* Some boards require controlling the role-sw and Vbus based on the id-pin */
static int cht_wc_extcon_get_role_sw_and_regulator(struct cht_wc_extcon_data *ext)
{}

static int cht_wc_extcon_psy_get_prop(struct power_supply *psy,
				      enum power_supply_property psp,
				      union power_supply_propval *val)
{}

static const enum power_supply_usb_type cht_wc_extcon_psy_usb_types[] =;

static const enum power_supply_property cht_wc_extcon_psy_props[] =;

static const struct power_supply_desc cht_wc_extcon_psy_desc =;

static int cht_wc_extcon_register_psy(struct cht_wc_extcon_data *ext)
{}

static int cht_wc_extcon_probe(struct platform_device *pdev)
{}

static void cht_wc_extcon_remove(struct platform_device *pdev)
{}

static const struct platform_device_id cht_wc_extcon_table[] =;
MODULE_DEVICE_TABLE(platform, cht_wc_extcon_table);

static struct platform_driver cht_wc_extcon_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();