123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- /*
- * include/linux/muic/common/muic_notifier.h
- *
- * header file supporting MUIC notifier call chain information
- *
- * Copyright (C) 2010 Samsung Electronics
- * Seung-Jin Hahn <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
- #ifndef __MUIC_NOTIFIER_H__
- #define __MUIC_NOTIFIER_H__
- #include <linux/muic/common/muic.h>
- #if IS_ENABLED(CONFIG_PDIC_NOTIFIER)
- #include <linux/usb/typec/common/pdic_notifier.h>
- #endif
- /* MUIC notifier call chain command */
- typedef enum {
- MUIC_NOTIFY_CMD_DETACH = 0,
- MUIC_NOTIFY_CMD_ATTACH,
- MUIC_NOTIFY_CMD_LOGICALLY_DETACH,
- MUIC_NOTIFY_CMD_LOGICALLY_ATTACH,
- MUIC_PDIC_NOTIFY_CMD_ATTACH,
- MUIC_PDIC_NOTIFY_CMD_DETACH,
- PDIC_MUIC_NOTIFY_CMD_JIG_ATTACH,
- PDIC_MUIC_NOTIFY_CMD_JIG_DETACH,
- } muic_notifier_cmd_t;
- /* MUIC notifier call sequence,
- * largest priority number device will be called first. */
- typedef enum {
- MUIC_NOTIFY_DEV_DOCK = 0,
- MUIC_NOTIFY_DEV_MHL,
- MUIC_NOTIFY_DEV_USB,
- MUIC_NOTIFY_DEV_TSP,
- MUIC_NOTIFY_DEV_CHARGER,
- MUIC_NOTIFY_DEV_PDIC,
- MUIC_NOTIFY_DEV_CPUIDLE,
- MUIC_NOTIFY_DEV_CPUFREQ,
- #if IS_ENABLED(CONFIG_USB_TYPEC_MANAGER_NOTIFIER)
- MUIC_NOTIFY_DEV_MANAGER,
- #endif
- MUIC_NOTIFY_DEV_CABLE_DATA,
- } muic_notifier_device_t;
- struct muic_notifier_struct {
- muic_attached_dev_t attached_dev;
- muic_notifier_cmd_t cmd;
- #if IS_ENABLED(CONFIG_PDIC_NOTIFIER)
- PD_NOTI_ATTACH_TYPEDEF cxt;
- #if IS_ENABLED(CONFIG_MUIC_POGO)
- PD_NOTI_ATTACH_TYPEDEF pogo_cxt;
- #endif /* CONFIG_MUIC_POGO */
- #endif
- struct blocking_notifier_head notifier_call_chain;
- };
- #define MUIC_NOTIFIER_BLOCK(name) \
- struct notifier_block (name)
- /* muic notifier init/notify function
- * this function is for JUST MUIC device driver.
- * DON'T use function anywhrer else!!
- */
- extern struct device *switch_device;
- extern void muic_notifier_attach_attached_dev(muic_attached_dev_t new_dev);
- extern void muic_notifier_detach_attached_dev(muic_attached_dev_t cur_dev);
- extern void muic_pdic_notifier_attach_attached_dev(muic_attached_dev_t new_dev);
- extern void muic_pdic_notifier_detach_attached_dev(muic_attached_dev_t new_dev);
- extern void muic_notifier_logically_attach_attached_dev(muic_attached_dev_t new_dev);
- extern void muic_notifier_logically_detach_attached_dev(muic_attached_dev_t cur_dev);
- #if IS_ENABLED(CONFIG_VIRTUAL_MUIC)
- extern void vt_muic_notifier_attach_attached_dev(muic_attached_dev_t new_dev);
- extern void vt_muic_notifier_detach_attached_dev(muic_attached_dev_t cur_dev);
- #endif
- #if IS_ENABLED(CONFIG_PDIC_SLSI_NON_MCU)
- extern int muic_pdic_notifier_register(struct notifier_block *nb,
- notifier_fn_t notifier, muic_notifier_device_t listener);
- extern int muic_pdic_notifier_unregister(struct notifier_block *nb);
- #endif
- /* muic notifier register/unregister API
- * for used any where want to receive muic attached device attach/detach. */
- extern int muic_notifier_register(struct notifier_block *nb,
- notifier_fn_t notifier, muic_notifier_device_t listener);
- extern int muic_notifier_unregister(struct notifier_block *nb);
- /* Choose a proper noti. interface for a test */
- extern void muic_notifier_set_new_noti(bool flag);
- #if IS_ENABLED(CONFIG_MUIC_POGO)
- extern void muic_pogo_notifier_attach_attached_dev(muic_attached_dev_t new_dev);
- extern void muic_pogo_notifier_detach_attached_dev(muic_attached_dev_t cur_dev);
- #endif /* CONFIG_MUIC_POGO */
- #endif /* __MUIC_NOTIFIER_H__ */
|