aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/modem_if_na/modem_link_pm_usb.h
blob: a4d4ea365853b84adce4ac65af1dc122be01a546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Copyright (C) 2012 Samsung Electronics.
 *
 * 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 __MODEM_LINK_PM_USB_H__
#define __MODEM_LINK_PM_USB_H__

#include <linux/platform_data/modem_na.h>
#include "modem_prj.h"
#include "modem_link_device_usb.h"

#define IOCTL_LINK_CONTROL_ENABLE	_IO('o', 0x30)
#define IOCTL_LINK_CONTROL_ACTIVE	_IO('o', 0x31)
#define IOCTL_LINK_GET_HOSTWAKE		_IO('o', 0x32)
#define IOCTL_LINK_CONNECTED		_IO('o', 0x33)
#define IOCTL_LINK_SET_BIAS_CLEAR	_IO('o', 0x34)

#define IOCTL_LINK_PORT_ON		_IO('o', 0x35)
#define IOCTL_LINK_PORT_OFF		_IO('o', 0x36)
#define IOCTL_LINK_BLOCK_AUTOSUSPEND	_IO('o', 0x37)
#define IOCTL_LINK_ENABLE_AUTOSUSPEND	_IO('o', 0x38)

enum hub_status {
	HUB_STATE_OFF,		/* usb3503 0ff*/
	HUB_STATE_RESUMMING,	/* usb3503 on, but enummerattion was not yet*/
	HUB_STATE_PREACTIVE,
	HUB_STATE_ACTIVE,	/* hub and CMC221 enumerate */
};

struct link_pm_data {
	struct miscdevice miscdev;
	struct usb_link_device *usb_ld;
	unsigned gpio_link_active;
	unsigned gpio_link_hostwake;
	unsigned gpio_link_slavewake;
	int (*link_reconnect)(void);
	int link_reconnect_cnt;

	struct workqueue_struct *wq;
	struct completion active_done;
/*USB3503*/
	struct completion hub_active;
	int hub_status;
	bool has_usbhub;
	/* ignore hub on by host wakeup irq before cp power on*/
	int hub_init_lock;
	/* C1 stay disconnect status after send 'a', skip 'a' next enumeration*/
	int hub_handshake_done;
	struct wake_lock hub_lock;
	struct delayed_work link_pm_hub;
	int hub_on_retry_cnt;
	struct device *root_hub;

	struct delayed_work link_pm_work;
	struct delayed_work link_pm_start;
	struct delayed_work link_reconnect_work;
	bool resume_requested;
	bool link_pm_active;

	struct wake_lock l2_wake;
	struct wake_lock boot_wake;
	struct notifier_block pm_notifier;
	bool dpm_suspending;

	int (*port_enable)(int, int);

	int (*cpufreq_lock)(void);
	int (*cpufreq_unlock)(void);

	int autosuspend_delay_ms; /* if zero, the default value is used */
	bool block_autosuspend;
};

bool link_pm_set_active(struct usb_link_device *usb_ld);
bool link_pm_is_connected(struct usb_link_device *usb_ld);
int link_pm_init(struct usb_link_device *usb_ld, void *data);

#endif