| /* SPDX-License-Identifier: GPL-2.0 */ |
| /* |
| * Copyright (C) 2020 MediaTek Inc. |
| */ |
| |
| #ifndef __EXTCON_KIRKWOOD_USB_H |
| #define __EXTCON_KIRKWOOD_USB_H |
| #include <linux/mutex.h> |
| #include <linux/power_supply.h> |
| #include <linux/usb/typec.h> |
| #include <linux/usb/role.h> |
| |
| struct extcon_kirkwood { |
| struct device *dev; |
| struct mutex ekw_mutex; |
| |
| int bc12_role; |
| unsigned int bc12_cable; |
| |
| struct gpio_desc *good_bat_gpiod; |
| int good_bat_irq; |
| unsigned int good_bat_gpio_dts; |
| unsigned int good_bat_polarity; |
| int good_bat_fixed; |
| |
| struct gpio_desc *sw_open_gpiod; |
| int sw_open_irq; |
| unsigned int sw_open_gpio_dts; |
| unsigned int sw_open_polarity; |
| |
| struct gpio_desc *chg_aln_gpiod; |
| int chg_aln_irq; |
| unsigned int chg_aln_gpio_dts; |
| unsigned int chg_aln_polarity; |
| |
| struct gpio_desc *chg_det_gpiod; |
| int chg_det_irq; |
| unsigned int chg_det_gpio_dts; |
| unsigned int chg_det_polarity; |
| |
| unsigned long debounce_jiffies; |
| struct delayed_work wq_detcable; |
| |
| struct extcon_dev *edev; |
| struct usb_role_switch *usb_role_sw; |
| |
| unsigned int usb_cable; |
| enum usb_role usb_data_role; |
| enum typec_port_data port_data_role; |
| |
| bool usb_hal_ver_en; |
| u32 usb_hal_ver; |
| enum usb_role ban_usb_data_role; |
| /* indicate the usb role is set to NONE from sysfs role_store forcefully, |
| * and can be changed only from role_store, not changeable from role_switch |
| * interface. |
| */ |
| bool forced_role_none; |
| |
| /* Used to export BC1.2 psy status */ |
| struct power_supply *psy; |
| struct power_supply_desc psy_desc; |
| enum power_supply_usb_type bc12_usb_type; |
| |
| #if IS_ENABLED(CONFIG_DEBUG_FS) |
| struct dentry *debugfs_root; |
| char cmd_buf[1024]; |
| #endif |
| }; |
| |
| enum { |
| BC12_DETECTED_NON = 0, |
| BC12_DETECTED_DCP, |
| BC12_DETECTED_CDP, |
| BC12_DETECTED_CDP_B, |
| BC12_DETECTED_SDP, |
| BC12_DETECTED_SDP_B, |
| BC12_DETECTED_BRK, |
| BC12_DETECTED_UNK, |
| }; |
| #endif |