/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __LINUX_EXTCON_INTERNAL_H__2#define __LINUX_EXTCON_INTERNAL_H__34#include <linux/extcon-provider.h>56/**7* struct extcon_dev - An extcon device represents one external connector.8* @name: The name of this extcon device. Parent device name is9* used if NULL.10* @supported_cable: Array of supported cable names ending with EXTCON_NONE.11* If supported_cable is NULL, cable name related APIs12* are disabled.13* @mutually_exclusive: Array of mutually exclusive set of cables that cannot14* be attached simultaneously. The array should be15* ending with 0 or be NULL (no mutually exclusive cables).16* For example, if it is {0x7, 0x30, 0}, then,17* {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot18* be attached simulataneously. {0x7, 0} is equivalent to19* {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there20* can be no simultaneous connections.21* @dev: Device of this extcon.22* @id: Unique device ID of this extcon.23* @state: Attach/detach state of this extcon. Do not provide at24* register-time.25* @nh_all: Notifier for the state change events for all supported26* external connectors from this extcon.27* @nh: Notifier for the state change events from this extcon28* @entry: To support list of extcon devices so that users can29* search for extcon devices based on the extcon name.30* @lock: Protects device state and serialises device registration31* @max_supported: Internal value to store the number of cables.32* @extcon_dev_type: Device_type struct to provide attribute_groups33* customized for each extcon device.34* @cables: Sysfs subdirectories. Each represents one cable.35*36* In most cases, users only need to provide "User initializing data" of37* this struct when registering an extcon. In some exceptional cases,38* optional callbacks may be needed. However, the values in "internal data"39* are overwritten by register function.40*/41struct extcon_dev {42/* Optional user initializing data */43const char *name;44const unsigned int *supported_cable;45const u32 *mutually_exclusive;4647/* Internal data. Please do not set. */48struct device dev;49unsigned int id;50struct raw_notifier_head nh_all;51struct raw_notifier_head *nh;52struct list_head entry;53int max_supported;54spinlock_t lock; /* could be called by irq handler */55u32 state;5657/* /sys/class/extcon/.../cable.n/... */58struct device_type extcon_dev_type;59struct extcon_cable *cables;6061/* /sys/class/extcon/.../mutually_exclusive/... */62struct attribute_group attr_g_muex;63struct attribute **attrs_muex;64struct device_attribute *d_attrs_muex;65};6667#endif /* __LINUX_EXTCON_INTERNAL_H__ */686970