Files
Lucas Wei f698052e43 Merge android-4.14-q (4.14.232) into android-msm-pixel-4.14-lts
Merge 4.14.232 into android-4.14-q
Linux 4.14.232
    USB: CDC-ACM: fix poison/unpoison imbalance
    net: hso: fix NULL-deref on disconnect regression
    x86/crash: Fix crash_setup_memmap_entries() out-of-bounds access
    ia64: tools: remove duplicate definition of ia64_mf() on ia64
    ia64: fix discontig.c section mismatches
    cavium/liquidio: Fix duplicate argument
    xen-netback: Check for hotplug-status existence before watching
    s390/entry: save the caller of psw_idle
    net: geneve: check skb is large enough for IPv4/IPv6 header
    ARM: dts: Fix swapped mmc order for omap3
    HID: wacom: Assign boolean values to a bool variable
    HID: alps: fix error return code in alps_input_configured()
    pinctrl: lewisburg: Update number of pins in community
  * ext4: correct error label in ext4_rename()
      fs/ext4/namei.c
    net: hso: fix null-ptr-deref during tty device unregistration
  * gup: document and work around "COW can break either way" issue
      mm/gup.c
    ARM: 9071/1: uprobes: Don't hook on thumb instructions
    ARM: footbridge: fix PCI interrupt mapping
    ibmvnic: remove duplicate napi_schedule call in open function
    ibmvnic: remove duplicate napi_schedule call in do_reset function
    ibmvnic: avoid calling napi_disable() twice
    i40e: fix the panic when running bpf in xdpdrv mode
  * net: sit: Unregister catch-all devices
      net/ipv6/sit.c
    net: davicom: Fix regulator not turned off on failed probe
    netfilter: nft_limit: avoid possible divide error in nft_limit_init
  * netfilter: conntrack: do not print icmpv6 as unknown via /proc
      net/netfilter/nf_conntrack_standalone.c
    scsi: libsas: Reset num_scatter if libata marks qc as NODATA
  * arm64: alternatives: Move length validation in alternative_{insn, endif}
      arch/arm64/include/asm/alternative.h
  * arm64: fix inline asm in load_unaligned_zeropad()
      arch/arm64/include/asm/word-at-a-time.h
  * readdir: make sure to verify directory entry for legacy interfaces too
      fs/readdir.c
    HID: wacom: set EV_KEY and EV_ABS only for non-HID_GENERIC type of devices
    Input: i8042 - fix Pegatron C15B ID entry
    mac80211: clear sta->fast_rx when STA removed from 4-addr VLAN
    usbip: Fix incorrect double assignment to udc->ud.tcp_rx
    pcnet32: Use pci_resource_len to validate PCI resource
    net: ieee802154: forbid monitor for add llsec seclevel
    net: ieee802154: stop dump llsec seclevels for monitors
    net: ieee802154: forbid monitor for add llsec devkey
    net: ieee802154: stop dump llsec devkeys for monitors
    net: ieee802154: forbid monitor for add llsec dev
    net: ieee802154: stop dump llsec devs for monitors
    net: ieee802154: stop dump llsec keys for monitors
    scsi: scsi_transport_srp: Don't block target in SRP_PORT_LOST state
    ASoC: fsl_esai: Fix TDM slot setup for I2S mode
    ARM: keystone: fix integer overflow warning
  * neighbour: Disregard DEAD dst in neigh_update
      net/core/neighbour.c
    arc: kernel: Return -EFAULT if copy_to_user() fails
    ARM: dts: Fix moving mmc devices with aliases for omap4 & 5
  * dmaengine: dw: Make it dependent to HAS_IOMEM
      drivers/dma/dw/Kconfig
    Input: nspire-keypad - enable interrupts only when opened
  * net/sctp: fix race condition in sctp_destroy_sock
      net/sctp/socket.c
    Merge 4.14.231 into android-4.14-q
Linux 4.14.231
    xen/events: fix setting irq affinity
    perf map: Tighten snprintf() string precision to pass gcc check on some 32-bit arches
  * netfilter: x_tables: fix compat match/target pad out-of-bound write
      net/ipv4/netfilter/arp_tables.c
      net/ipv4/netfilter/ip_tables.c
      net/ipv6/netfilter/ip6_tables.c
      net/netfilter/x_tables.c
    net: phy: broadcom: Only advertise EEE for supported modes
  * block: only update parent bi_status when bio fail
      block/bio.c
    gfs2: report "already frozen/thawed" errors
    drm/imx: imx-ldb: fix out of bounds array access warning
  * KVM: arm64: Disable guest access to trace filter controls
      arch/arm64/include/asm/kvm_arm.h
  * KVM: arm64: Hide system instruction access to Trace registers
      arch/arm64/kernel/cpufeature.c
    Revert "cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath."
    net: ieee802154: stop dump llsec params for monitors
    net: ieee802154: forbid monitor for del llsec seclevel
    net: ieee802154: forbid monitor for set llsec params
    net: ieee802154: fix nl802154 del llsec devkey
    net: ieee802154: fix nl802154 add llsec key
    net: ieee802154: fix nl802154 del llsec dev
    net: ieee802154: fix nl802154 del llsec key
    net: ieee802154: nl-mac: fix check on panid
    net: mac802154: Fix general protection fault
    drivers: net: fix memory leak in peak_usb_create_dev
    drivers: net: fix memory leak in atusb_probe
  * net: tun: set tun->dev->addr_len during TUNSETLINK processing
      drivers/net/tun.c
  * cfg80211: remove WARN_ON() in cfg80211_sme_connect
      net/wireless/sme.c
    usbip: fix vudc usbip_sockfd_store races leading to gpf
    net/ncsi: Avoid GFP_KERNEL in response handler
    net/ncsi: Refactor MAC, VLAN filters
    net/ncsi: Add generic netlink family
    net/ncsi: Don't return error on normal response
    net/ncsi: Improve general state logging
    net/ncsi: Make local function ncsi_get_filter() static
    clk: socfpga: fix iomem pointer cast on 64-bit
    RDMA/cxgb4: check for ipv6 address properly while destroying listener
    net/mlx5: Fix placement of log_max_flow_counter
    s390/cpcmd: fix inline assembly register clobbering
  * workqueue: Move the position of debug_work_activate() in __queue_work()
      kernel/workqueue.c
  * clk: fix invalid usage of list cursor in unregister
      drivers/clk/clk.c
  * clk: fix invalid usage of list cursor in register
      drivers/clk/clk.c
    soc/fsl: qbman: fix conflicting alignment attributes
    ASoC: sunxi: sun4i-codec: fill ASoC card owner
    net/ncsi: Avoid channel_monitor hrtimer deadlock
    ARM: dts: imx6: pbab01: Set vmmc supply for both SD interfaces
    net:tipc: Fix a double free in tipc_sk_mcast_rcv
    gianfar: Handle error code at MAC address change
    sch_red: fix off-by-one checks in red_check_params()
    amd-xgbe: Update DMA coherency values
    ASoC: wm8960: Fix wrong bclk and lrclk with pll enabled for some chips
    regulator: bd9571mwv: Fix AVS and DVFS voltage range
  * i2c: turn recovery error on init to debug
      drivers/i2c/i2c-core-base.c
    usbip: synchronize event handler with sysfs code paths
    usbip: stub-dev synchronize sysfs code paths
    usbip: add sysfs_lock to synchronize sysfs code paths
    net: sched: sch_teql: fix null-pointer dereference
  * net: ensure mac header is set in virtio_net_hdr_to_skb()
      include/linux/virtio_net.h
    batman-adv: initialize "struct batadv_tvlv_tt_vlan_data"->reserved field
    ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
    parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers
  * parisc: parisc-agp requires SBA IOMMU driver
      drivers/char/agp/Kconfig
  * fs: direct-io: fix missing sdio->boundary
      fs/direct-io.c
    ocfs2: fix deadlock between setattr and dio_end_io_write
    ia64: fix user_stack_pointer() for ptrace()
  * net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh
      net/ipv6/route.c
    xen/evtchn: Change irq_info lock to raw_spinlock_t
    nfc: Avoid endless loops caused by repeated llcp_sock_connect()
    nfc: fix memory leak in llcp_sock_connect()
    nfc: fix refcount leak in llcp_sock_connect()
    nfc: fix refcount leak in llcp_sock_bind()
    ASoC: intel: atom: Stop advertising non working S24LE support
    ALSA: aloop: Fix initialization of controls
    Merge 4.14.230 into android-4.14-q
Linux 4.14.230
    can: flexcan: flexcan_chip_freeze(): fix chip freeze for missing bitrate
  * init/Kconfig: make COMPILE_TEST depend on HAS_IOMEM
      init/Kconfig
  * init/Kconfig: make COMPILE_TEST depend on !S390
      init/Kconfig
    bpf, x86: Validate computation of branch displacements for x86-64
    cifs: Silently ignore unknown oplock break handle
    cifs: revalidate mapping when we open files for SMB1 POSIX
    ia64: mca: allocate early mca with GFP_ATOMIC
    scsi: target: pscsi: Clean up after failure in pscsi_map_sg()
    x86/build: Turn off -fcf-protection for realmode targets
    platform/x86: thinkpad_acpi: Allow the FnLock LED to change state
  * drm/msm: Ratelimit invalid-fence message
      drivers/gpu/drm/msm/msm_fence.c
    mac80211: choose first enabled channel for monitor
    mISDN: fix crash in fritzpci
    net: pxa168_eth: Fix a potential data race in pxa168_eth_remove
    ARM: dts: am33xx: add aliases for mmc interfaces
    Merge 4.14.229 into android-4.14-q
Linux 4.14.229
    drivers: video: fbcon: fix NULL dereference in fbcon_cursor()
    staging: rtl8192e: Change state information from u16 to u8
    staging: rtl8192e: Fix incorrect source in memcpy()
    usb: gadget: udc: amd5536udc_pci fix null-ptr-dereference
    USB: cdc-acm: fix use-after-free after probe failure
    USB: cdc-acm: downgrade message to debug
    USB: cdc-acm: untangle a circular dependency between callback and softint
    cdc-acm: fix BREAK rx code path adding necessary calls
    usb: xhci-mtk: fix broken streams issue on 0.96 xHCI
    usb: musb: Fix suspend with devices connected for a64
  * USB: quirks: ignore remote wake-up on Fibocom L850-GL LTE modem
      drivers/usb/core/quirks.c
    usbip: vhci_hcd fix shift out-of-bounds in vhci_hub_control()
    firewire: nosy: Fix a use-after-free bug in nosy_ioctl()
  * extcon: Fix error handling in extcon_dev_register
      drivers/extcon/extcon.c
  * extcon: Add stubs for extcon_register_notifier_all() functions
      include/linux/extcon.h
    pinctrl: rockchip: fix restore error in resume
  * mm: writeback: use exact memcg dirty counts
      include/linux/memcontrol.h
  * mm: fix oom_kill event handling
      include/linux/memcontrol.h
      mm/oom_kill.c
  * mem_cgroup: make sure moving_account, move_lock_task and stat_cpu in the same cacheline
      include/linux/memcontrol.h
  * mm: memcg: make sure memory.events is uptodate when waking pollers
      include/linux/memcontrol.h
      mm/vmscan.c
  * mm: memcontrol: fix NR_WRITEBACK leak in memcg and system stats
      include/linux/memcontrol.h
    reiserfs: update reiserfs_xattrs_initialized() condition
    drm/amdgpu: check alignment on CPU page for bo map
    drm/amdgpu: fix offset calculation in amdgpu_vm_bo_clear_mappings()
  * mm: fix race by making init_zero_pfn() early_initcall
      mm/memory.c
  * tracing: Fix stack trace event size
      kernel/trace/trace.c
    ALSA: hda/realtek: call alc_update_headset_mode() in hp_automute_hook
    ALSA: hda/realtek: fix a determine_headset_type issue for a Dell AIO
  * ALSA: usb-audio: Apply sample rate quirk to Logitech Connect
      sound/usb/quirks.c
  * bpf: Remove MTU check in __bpf_skb_max_len
      net/core/filter.c
    net: wan/lmc: unregister device when no matching device is found
    appletalk: Fix skb allocation size in loopback case
    net: ethernet: aquantia: Handle error cleanup of start on open
    brcmfmac: clear EAP/association status bits on linkdown events
  * ext4: do not iput inode under running transaction in ext4_rename()
      fs/ext4/namei.c
    ASoC: rt5659: Update MCLK rate in set_sysclk()
    staging: comedi: cb_pcidas64: fix request_irq() warn
    staging: comedi: cb_pcidas: fix request_irq() warn
    scsi: qla2xxx: Fix broken #endif placement
    scsi: st: Fix a use after free in st_open()
    vhost: Fix vhost_vq_reset()
    powerpc: Force inlining of cpu_has_feature() to avoid build failure
    ASoC: cs42l42: Always wait at least 3ms after reset
    ASoC: cs42l42: Fix mixer volume control
    ASoC: es8316: Simplify adc_pga_gain_tlv table
    ASoC: sgtl5000: set DAP_AVC_CTRL register to correct default value on probe
    ASoC: rt5651: Fix dac- and adc- vol-tlv values being off by a factor of 10
    ASoC: rt5640: Fix dac- and adc- vol-tlv values being off by a factor of 10
    rpc: fix NULL dereference on kmalloc failure
  * ext4: fix bh ref count on error paths
      fs/ext4/inode.c
  * ipv6: weaken the v4mapped source check
      net/ipv6/ip6_input.c
      net/ipv6/tcp_ipv6.c
    selinux: vsock: Set SID for socket returned by accept()

Bug: 187007303
Change-Id: Idd56a9915b91e0e5b5be70ceb326126c6f47f7af
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-05-19 21:05:47 +08:00

471 lines
14 KiB
C

/*
* External Connector (extcon) framework
*
* Copyright (C) 2015 Samsung Electronics
* Author: Chanwoo Choi <cw00.choi@samsung.com>
*
* Copyright (C) 2012 Samsung Electronics
* Author: Donggeun Kim <dg77.kim@samsung.com>
* Author: MyungJoo Ham <myungjoo.ham@samsung.com>
*
* based on switch class driver
* Copyright (C) 2008 Google, Inc.
* Author: Mike Lockwood <lockwood@android.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __LINUX_EXTCON_H__
#define __LINUX_EXTCON_H__
#include <linux/device.h>
/*
* Define the type of supported external connectors
*/
#define EXTCON_TYPE_USB BIT(0) /* USB connector */
#define EXTCON_TYPE_CHG BIT(1) /* Charger connector */
#define EXTCON_TYPE_JACK BIT(2) /* Jack connector */
#define EXTCON_TYPE_DISP BIT(3) /* Display connector */
#define EXTCON_TYPE_MISC BIT(4) /* Miscellaneous connector */
/*
* Define the unique id of supported external connectors
*/
#define EXTCON_NONE 0
/* USB external connector */
#define EXTCON_USB 1
#define EXTCON_USB_HOST 2
/*
* Charging external connector
*
* When one SDP charger connector was reported, we should also report
* the USB connector, which means EXTCON_CHG_USB_SDP should always
* appear together with EXTCON_USB. The same as ACA charger connector,
* EXTCON_CHG_USB_ACA would normally appear with EXTCON_USB_HOST.
*
* The EXTCON_CHG_USB_SLOW connector can provide at least 500mA of
* current at 5V. The EXTCON_CHG_USB_FAST connector can provide at
* least 1A of current at 5V.
*/
#define EXTCON_CHG_USB_SDP 5 /* Standard Downstream Port */
#define EXTCON_CHG_USB_DCP 6 /* Dedicated Charging Port */
#define EXTCON_CHG_USB_CDP 7 /* Charging Downstream Port */
#define EXTCON_CHG_USB_ACA 8 /* Accessory Charger Adapter */
#define EXTCON_CHG_USB_FAST 9
#define EXTCON_CHG_USB_SLOW 10
#define EXTCON_CHG_WPT 11 /* Wireless Power Transfer */
#define EXTCON_CHG_USB_PD 12 /* USB Power Delivery */
/* Jack external connector */
#define EXTCON_JACK_MICROPHONE 20
#define EXTCON_JACK_HEADPHONE 21
#define EXTCON_JACK_LINE_IN 22
#define EXTCON_JACK_LINE_OUT 23
#define EXTCON_JACK_VIDEO_IN 24
#define EXTCON_JACK_VIDEO_OUT 25
#define EXTCON_JACK_SPDIF_IN 26 /* Sony Philips Digital InterFace */
#define EXTCON_JACK_SPDIF_OUT 27
/* Display external connector */
#define EXTCON_DISP_HDMI 40 /* High-Definition Multimedia Interface */
#define EXTCON_DISP_MHL 41 /* Mobile High-Definition Link */
#define EXTCON_DISP_DVI 42 /* Digital Visual Interface */
#define EXTCON_DISP_VGA 43 /* Video Graphics Array */
#define EXTCON_DISP_DP 44 /* Display Port */
#define EXTCON_DISP_HMD 45 /* Head-Mounted Display */
/* Miscellaneous external connector */
#define EXTCON_DOCK 60
#define EXTCON_JIG 61
#define EXTCON_MECHANICAL 62
#define EXTCON_NUM 63
/*
* Define the properties of supported external connectors.
*
* When adding the new extcon property, they *must* have
* the type/value/default information. Also, you *have to*
* modify the EXTCON_PROP_[type]_START/END definitions
* which mean the range of the supported properties
* for each extcon type.
*
* The naming style of property
* : EXTCON_PROP_[type]_[property name]
*
* EXTCON_PROP_USB_[property name] : USB property
* EXTCON_PROP_CHG_[property name] : Charger property
* EXTCON_PROP_JACK_[property name] : Jack property
* EXTCON_PROP_DISP_[property name] : Display property
*/
/*
* Properties of EXTCON_TYPE_USB.
*
* - EXTCON_PROP_USB_VBUS
* @type: integer (intval)
* @value: 0 (low) or 1 (high)
* @default: 0 (low)
* - EXTCON_PROP_USB_TYPEC_POLARITY
* @type: integer (intval)
* @value: 0 (normal) or 1 (flip)
* @default: 0 (normal)
* - EXTCON_PROP_USB_SS (SuperSpeed)
* @type: integer (intval)
* @value: 0 (USB/USB2) or 1 (USB3)
* @default: 0 (USB/USB2)
* - EXTCON_PROP_USB_TYPEC_MED_HIGH_CURRENT
* @type: integer (intval)
* @value: 0 (default current), 1 (medium or high current)
* @default: 0 (default current)
*
*/
#define EXTCON_PROP_USB_VBUS 0
#define EXTCON_PROP_USB_TYPEC_POLARITY 1
#define EXTCON_PROP_USB_SS 2
#define EXTCON_PROP_USB_TYPEC_MED_HIGH_CURRENT 3
#define EXTCON_PROP_USB_MIN 0
#define EXTCON_PROP_USB_MAX 3
#define EXTCON_PROP_USB_CNT (EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)
/* Properties of EXTCON_TYPE_CHG. */
#define EXTCON_PROP_CHG_MIN 50
#define EXTCON_PROP_CHG_MAX 50
#define EXTCON_PROP_CHG_CNT (EXTCON_PROP_CHG_MAX - EXTCON_PROP_CHG_MIN + 1)
/* Properties of EXTCON_TYPE_JACK. */
#define EXTCON_PROP_JACK_MIN 100
#define EXTCON_PROP_JACK_MAX 100
#define EXTCON_PROP_JACK_CNT (EXTCON_PROP_JACK_MAX - EXTCON_PROP_JACK_MIN + 1)
/*
* Properties of EXTCON_TYPE_DISP.
*
* - EXTCON_PROP_DISP_HPD (Hot Plug Detect)
* @type: integer (intval)
* @value: 0 (no hpd) or 1 (hpd)
* @default: 0 (no hpd)
*
*/
#define EXTCON_PROP_DISP_HPD 150
/* Properties of EXTCON_TYPE_DISP. */
#define EXTCON_PROP_DISP_MIN 150
#define EXTCON_PROP_DISP_MAX 151
#define EXTCON_PROP_DISP_CNT (EXTCON_PROP_DISP_MAX - EXTCON_PROP_DISP_MIN + 1)
/*
* Define the type of property's value.
*
* Define the property's value as union type. Because each property
* would need the different data type to store it.
*/
union extcon_property_value {
int intval; /* type : integer (intval) */
};
struct extcon_cable;
struct extcon_dev;
#if IS_ENABLED(CONFIG_EXTCON)
/* Following APIs register/unregister the extcon device. */
extern int extcon_dev_register(struct extcon_dev *edev);
extern void extcon_dev_unregister(struct extcon_dev *edev);
extern int devm_extcon_dev_register(struct device *dev,
struct extcon_dev *edev);
extern void devm_extcon_dev_unregister(struct device *dev,
struct extcon_dev *edev);
/* Following APIs allocate/free the memory of the extcon device. */
extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
extern void extcon_dev_free(struct extcon_dev *edev);
extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
const unsigned int *cable);
extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
/* Synchronize the state and property value for each external connector. */
extern int extcon_sync(struct extcon_dev *edev, unsigned int id);
/*
* Following APIs get/set the connected state of each external connector.
* The 'id' argument indicates the defined external connector.
*/
extern int extcon_get_state(struct extcon_dev *edev, unsigned int id);
extern int extcon_set_state(struct extcon_dev *edev, unsigned int id,
bool state);
extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
bool state);
/*
* Following APIs get/set the property of each external connector.
* The 'id' argument indicates the defined external connector
* and the 'prop' indicates the extcon property.
*
* And extcon_get/set_property_capability() set the capability of the property
* for each external connector. They are used to set the capability of the
* property of each external connector based on the id and property.
*/
extern int extcon_get_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value *prop_val);
extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value prop_val);
extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value prop_val);
extern int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
extern int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
/*
* Following APIs set array of mutually exclusive.
* The 'exclusive' argument indicates the array of mutually exclusive set
* of cables that cannot be attached simultaneously.
*/
extern int extcon_set_mutually_exclusive(struct extcon_dev *edev,
const u32 *exclusive);
/*
* Following APIs register the notifier block in order to detect
* the change of both state and property value for each external connector.
*
* extcon_register_notifier(*edev, id, *nb) : Register a notifier block
* for specific external connector of the extcon.
* extcon_register_notifier_all(*edev, *nb) : Register a notifier block
* for all supported external connectors of the extcon.
*/
extern int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
extern int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
extern int extcon_register_blocking_notifier(struct extcon_dev *edev,
unsigned int id, struct notifier_block *nb);
extern int extcon_unregister_blocking_notifier(struct extcon_dev *edev,
unsigned int id, struct notifier_block *nb);
extern int devm_extcon_register_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
extern void devm_extcon_unregister_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
extern int extcon_register_notifier_all(struct extcon_dev *edev,
struct notifier_block *nb);
extern int extcon_unregister_notifier_all(struct extcon_dev *edev,
struct notifier_block *nb);
extern int devm_extcon_register_notifier_all(struct device *dev,
struct extcon_dev *edev,
struct notifier_block *nb);
extern void devm_extcon_unregister_notifier_all(struct device *dev,
struct extcon_dev *edev,
struct notifier_block *nb);
/*
* Following APIs get the extcon_dev from devicetree or by through extcon name.
*/
extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
int index);
/* Following API get the name of extcon device. */
extern const char *extcon_get_edev_name(struct extcon_dev *edev);
extern int extcon_blocking_sync(struct extcon_dev *edev, unsigned int id,
u8 val);
#else /* CONFIG_EXTCON */
static inline int extcon_dev_register(struct extcon_dev *edev)
{
return 0;
}
static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
static inline int devm_extcon_dev_register(struct device *dev,
struct extcon_dev *edev)
{
return -EINVAL;
}
static inline void devm_extcon_dev_unregister(struct device *dev,
struct extcon_dev *edev) { }
static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
{
return ERR_PTR(-ENOSYS);
}
static inline void extcon_dev_free(struct extcon_dev *edev) { }
static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
const unsigned int *cable)
{
return ERR_PTR(-ENOSYS);
}
static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id)
{
return 0;
}
static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
bool state)
{
return 0;
}
static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
bool state)
{
return 0;
}
static inline int extcon_sync(struct extcon_dev *edev, unsigned int id)
{
return 0;
}
static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value *prop_val)
{
return 0;
}
static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value prop_val)
{
return 0;
}
static inline int extcon_set_property_sync(struct extcon_dev *edev,
unsigned int id, unsigned int prop,
union extcon_property_value prop_val)
{
return 0;
}
static inline int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop)
{
return 0;
}
static inline int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop)
{
return 0;
}
static inline int extcon_register_notifier(struct extcon_dev *edev,
unsigned int id, struct notifier_block *nb)
{
return 0;
}
static inline int extcon_unregister_notifier(struct extcon_dev *edev,
unsigned int id, struct notifier_block *nb)
{
return 0;
}
static inline int extcon_register_blocking_notifier(struct extcon_dev *edev,
unsigned int id,
struct notifier_block *nb)
{
return 0;
}
static inline int extcon_unregister_blocking_notifier(struct extcon_dev *edev,
unsigned int id,
struct notifier_block *nb)
{
return 0;
}
static inline int devm_extcon_register_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb)
{
return -ENOSYS;
}
static inline void devm_extcon_unregister_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb) { }
static inline int extcon_register_notifier_all(struct extcon_dev *edev,
struct notifier_block *nb)
{
return 0;
}
static inline int extcon_unregister_notifier_all(struct extcon_dev *edev,
struct notifier_block *nb)
{
return 0;
}
static inline int devm_extcon_register_notifier_all(struct device *dev,
struct extcon_dev *edev,
struct notifier_block *nb)
{
return 0;
}
static inline void devm_extcon_unregister_notifier_all(struct device *dev,
struct extcon_dev *edev,
struct notifier_block *nb) { }
static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
{
return ERR_PTR(-ENODEV);
}
static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
int index)
{
return ERR_PTR(-ENODEV);
}
#endif /* CONFIG_EXTCON */
/*
* Following structure and API are deprecated. EXTCON remains the function
* definition to prevent the build break.
*/
struct extcon_specific_cable_nb {
struct notifier_block *user_nb;
int cable_index;
struct extcon_dev *edev;
unsigned long previous_value;
};
static inline int extcon_register_interest(struct extcon_specific_cable_nb *obj,
const char *extcon_name, const char *cable_name,
struct notifier_block *nb)
{
return -EINVAL;
}
static inline int extcon_unregister_interest(struct extcon_specific_cable_nb *obj)
{
return -EINVAL;
}
#endif /* __LINUX_EXTCON_H__ */