Searched refs:info (Results 1 - 200 of 6617) sorted by relevance

1234567891011>>

/linux-4.4.14/arch/x86/um/asm/
H A Dmm_context.h37 #define LDT_entry_a(info) \
38 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
40 #define LDT_entry_b(info) \
41 (((info)->base_addr & 0xff000000) | \
42 (((info)->base_addr & 0x00ff0000) >> 16) | \
43 ((info)->limit & 0xf0000) | \
44 (((info)->read_exec_only ^ 1) << 9) | \
45 ((info)->contents << 10) | \
46 (((info)->seg_not_present ^ 1) << 15) | \
47 ((info)->seg_32bit << 22) | \
48 ((info)->limit_in_pages << 23) | \
49 ((info)->useable << 20) | \
52 #define _LDT_empty(info) (\
53 (info)->base_addr == 0 && \
54 (info)->limit == 0 && \
55 (info)->contents == 0 && \
56 (info)->read_exec_only == 1 && \
57 (info)->seg_32bit == 0 && \
58 (info)->limit_in_pages == 0 && \
59 (info)->seg_not_present == 1 && \
60 (info)->useable == 0 )
63 #define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0))
65 #define LDT_empty(info) (_LDT_empty(info))
H A Ddesc.h6 #define LDT_empty(info) (\
7 (info)->base_addr == 0 && \
8 (info)->limit == 0 && \
9 (info)->contents == 0 && \
10 (info)->read_exec_only == 1 && \
11 (info)->seg_32bit == 0 && \
12 (info)->limit_in_pages == 0 && \
13 (info)->seg_not_present == 1 && \
14 (info)->useable == 0 )
/linux-4.4.14/include/drm/
H A Di915_pciids.h38 #define INTEL_VGA_DEVICE(id, info) { \
42 (unsigned long) info }
44 #define INTEL_QUANTA_VGA_DEVICE(info) { \
48 (unsigned long) info }
50 #define INTEL_I830_IDS(info) \
51 INTEL_VGA_DEVICE(0x3577, info)
53 #define INTEL_I845G_IDS(info) \
54 INTEL_VGA_DEVICE(0x2562, info)
56 #define INTEL_I85X_IDS(info) \
57 INTEL_VGA_DEVICE(0x3582, info), /* I855_GM */ \
58 INTEL_VGA_DEVICE(0x358e, info)
60 #define INTEL_I865G_IDS(info) \
61 INTEL_VGA_DEVICE(0x2572, info) /* I865_G */
63 #define INTEL_I915G_IDS(info) \
64 INTEL_VGA_DEVICE(0x2582, info), /* I915_G */ \
65 INTEL_VGA_DEVICE(0x258a, info) /* E7221_G */
67 #define INTEL_I915GM_IDS(info) \
68 INTEL_VGA_DEVICE(0x2592, info) /* I915_GM */
70 #define INTEL_I945G_IDS(info) \
71 INTEL_VGA_DEVICE(0x2772, info) /* I945_G */
73 #define INTEL_I945GM_IDS(info) \
74 INTEL_VGA_DEVICE(0x27a2, info), /* I945_GM */ \
75 INTEL_VGA_DEVICE(0x27ae, info) /* I945_GME */
77 #define INTEL_I965G_IDS(info) \
78 INTEL_VGA_DEVICE(0x2972, info), /* I946_GZ */ \
79 INTEL_VGA_DEVICE(0x2982, info), /* G35_G */ \
80 INTEL_VGA_DEVICE(0x2992, info), /* I965_Q */ \
81 INTEL_VGA_DEVICE(0x29a2, info) /* I965_G */
83 #define INTEL_G33_IDS(info) \
84 INTEL_VGA_DEVICE(0x29b2, info), /* Q35_G */ \
85 INTEL_VGA_DEVICE(0x29c2, info), /* G33_G */ \
86 INTEL_VGA_DEVICE(0x29d2, info) /* Q33_G */
88 #define INTEL_I965GM_IDS(info) \
89 INTEL_VGA_DEVICE(0x2a02, info), /* I965_GM */ \
90 INTEL_VGA_DEVICE(0x2a12, info) /* I965_GME */
92 #define INTEL_GM45_IDS(info) \
93 INTEL_VGA_DEVICE(0x2a42, info) /* GM45_G */
95 #define INTEL_G45_IDS(info) \
96 INTEL_VGA_DEVICE(0x2e02, info), /* IGD_E_G */ \
97 INTEL_VGA_DEVICE(0x2e12, info), /* Q45_G */ \
98 INTEL_VGA_DEVICE(0x2e22, info), /* G45_G */ \
99 INTEL_VGA_DEVICE(0x2e32, info), /* G41_G */ \
100 INTEL_VGA_DEVICE(0x2e42, info), /* B43_G */ \
101 INTEL_VGA_DEVICE(0x2e92, info) /* B43_G.1 */
103 #define INTEL_PINEVIEW_IDS(info) \
104 INTEL_VGA_DEVICE(0xa001, info), \
105 INTEL_VGA_DEVICE(0xa011, info)
107 #define INTEL_IRONLAKE_D_IDS(info) \
108 INTEL_VGA_DEVICE(0x0042, info)
110 #define INTEL_IRONLAKE_M_IDS(info) \
111 INTEL_VGA_DEVICE(0x0046, info)
113 #define INTEL_SNB_D_IDS(info) \
114 INTEL_VGA_DEVICE(0x0102, info), \
115 INTEL_VGA_DEVICE(0x0112, info), \
116 INTEL_VGA_DEVICE(0x0122, info), \
117 INTEL_VGA_DEVICE(0x010A, info)
119 #define INTEL_SNB_M_IDS(info) \
120 INTEL_VGA_DEVICE(0x0106, info), \
121 INTEL_VGA_DEVICE(0x0116, info), \
122 INTEL_VGA_DEVICE(0x0126, info)
124 #define INTEL_IVB_M_IDS(info) \
125 INTEL_VGA_DEVICE(0x0156, info), /* GT1 mobile */ \
126 INTEL_VGA_DEVICE(0x0166, info) /* GT2 mobile */
128 #define INTEL_IVB_D_IDS(info) \
129 INTEL_VGA_DEVICE(0x0152, info), /* GT1 desktop */ \
130 INTEL_VGA_DEVICE(0x0162, info), /* GT2 desktop */ \
131 INTEL_VGA_DEVICE(0x015a, info), /* GT1 server */ \
132 INTEL_VGA_DEVICE(0x016a, info) /* GT2 server */
134 #define INTEL_IVB_Q_IDS(info) \
135 INTEL_QUANTA_VGA_DEVICE(info) /* Quanta transcode */
137 #define INTEL_HSW_D_IDS(info) \
138 INTEL_VGA_DEVICE(0x0402, info), /* GT1 desktop */ \
139 INTEL_VGA_DEVICE(0x0412, info), /* GT2 desktop */ \
140 INTEL_VGA_DEVICE(0x0422, info), /* GT3 desktop */ \
141 INTEL_VGA_DEVICE(0x040a, info), /* GT1 server */ \
142 INTEL_VGA_DEVICE(0x041a, info), /* GT2 server */ \
143 INTEL_VGA_DEVICE(0x042a, info), /* GT3 server */ \
144 INTEL_VGA_DEVICE(0x040B, info), /* GT1 reserved */ \
145 INTEL_VGA_DEVICE(0x041B, info), /* GT2 reserved */ \
146 INTEL_VGA_DEVICE(0x042B, info), /* GT3 reserved */ \
147 INTEL_VGA_DEVICE(0x040E, info), /* GT1 reserved */ \
148 INTEL_VGA_DEVICE(0x041E, info), /* GT2 reserved */ \
149 INTEL_VGA_DEVICE(0x042E, info), /* GT3 reserved */ \
150 INTEL_VGA_DEVICE(0x0C02, info), /* SDV GT1 desktop */ \
151 INTEL_VGA_DEVICE(0x0C12, info), /* SDV GT2 desktop */ \
152 INTEL_VGA_DEVICE(0x0C22, info), /* SDV GT3 desktop */ \
153 INTEL_VGA_DEVICE(0x0C0A, info), /* SDV GT1 server */ \
154 INTEL_VGA_DEVICE(0x0C1A, info), /* SDV GT2 server */ \
155 INTEL_VGA_DEVICE(0x0C2A, info), /* SDV GT3 server */ \
156 INTEL_VGA_DEVICE(0x0C0B, info), /* SDV GT1 reserved */ \
157 INTEL_VGA_DEVICE(0x0C1B, info), /* SDV GT2 reserved */ \
158 INTEL_VGA_DEVICE(0x0C2B, info), /* SDV GT3 reserved */ \
159 INTEL_VGA_DEVICE(0x0C0E, info), /* SDV GT1 reserved */ \
160 INTEL_VGA_DEVICE(0x0C1E, info), /* SDV GT2 reserved */ \
161 INTEL_VGA_DEVICE(0x0C2E, info), /* SDV GT3 reserved */ \
162 INTEL_VGA_DEVICE(0x0A02, info), /* ULT GT1 desktop */ \
163 INTEL_VGA_DEVICE(0x0A12, info), /* ULT GT2 desktop */ \
164 INTEL_VGA_DEVICE(0x0A22, info), /* ULT GT3 desktop */ \
165 INTEL_VGA_DEVICE(0x0A0A, info), /* ULT GT1 server */ \
166 INTEL_VGA_DEVICE(0x0A1A, info), /* ULT GT2 server */ \
167 INTEL_VGA_DEVICE(0x0A2A, info), /* ULT GT3 server */ \
168 INTEL_VGA_DEVICE(0x0A0B, info), /* ULT GT1 reserved */ \
169 INTEL_VGA_DEVICE(0x0A1B, info), /* ULT GT2 reserved */ \
170 INTEL_VGA_DEVICE(0x0A2B, info), /* ULT GT3 reserved */ \
171 INTEL_VGA_DEVICE(0x0D02, info), /* CRW GT1 desktop */ \
172 INTEL_VGA_DEVICE(0x0D12, info), /* CRW GT2 desktop */ \
173 INTEL_VGA_DEVICE(0x0D22, info), /* CRW GT3 desktop */ \
174 INTEL_VGA_DEVICE(0x0D0A, info), /* CRW GT1 server */ \
175 INTEL_VGA_DEVICE(0x0D1A, info), /* CRW GT2 server */ \
176 INTEL_VGA_DEVICE(0x0D2A, info), /* CRW GT3 server */ \
177 INTEL_VGA_DEVICE(0x0D0B, info), /* CRW GT1 reserved */ \
178 INTEL_VGA_DEVICE(0x0D1B, info), /* CRW GT2 reserved */ \
179 INTEL_VGA_DEVICE(0x0D2B, info), /* CRW GT3 reserved */ \
180 INTEL_VGA_DEVICE(0x0D0E, info), /* CRW GT1 reserved */ \
181 INTEL_VGA_DEVICE(0x0D1E, info), /* CRW GT2 reserved */ \
182 INTEL_VGA_DEVICE(0x0D2E, info) /* CRW GT3 reserved */ \
184 #define INTEL_HSW_M_IDS(info) \
185 INTEL_VGA_DEVICE(0x0406, info), /* GT1 mobile */ \
186 INTEL_VGA_DEVICE(0x0416, info), /* GT2 mobile */ \
187 INTEL_VGA_DEVICE(0x0426, info), /* GT2 mobile */ \
188 INTEL_VGA_DEVICE(0x0C06, info), /* SDV GT1 mobile */ \
189 INTEL_VGA_DEVICE(0x0C16, info), /* SDV GT2 mobile */ \
190 INTEL_VGA_DEVICE(0x0C26, info), /* SDV GT3 mobile */ \
191 INTEL_VGA_DEVICE(0x0A06, info), /* ULT GT1 mobile */ \
192 INTEL_VGA_DEVICE(0x0A16, info), /* ULT GT2 mobile */ \
193 INTEL_VGA_DEVICE(0x0A26, info), /* ULT GT3 mobile */ \
194 INTEL_VGA_DEVICE(0x0A0E, info), /* ULX GT1 mobile */ \
195 INTEL_VGA_DEVICE(0x0A1E, info), /* ULX GT2 mobile */ \
196 INTEL_VGA_DEVICE(0x0A2E, info), /* ULT GT3 reserved */ \
197 INTEL_VGA_DEVICE(0x0D06, info), /* CRW GT1 mobile */ \
198 INTEL_VGA_DEVICE(0x0D16, info), /* CRW GT2 mobile */ \
199 INTEL_VGA_DEVICE(0x0D26, info) /* CRW GT3 mobile */
201 #define INTEL_VLV_M_IDS(info) \
202 INTEL_VGA_DEVICE(0x0f30, info), \
203 INTEL_VGA_DEVICE(0x0f31, info), \
204 INTEL_VGA_DEVICE(0x0f32, info), \
205 INTEL_VGA_DEVICE(0x0f33, info), \
206 INTEL_VGA_DEVICE(0x0157, info)
208 #define INTEL_VLV_D_IDS(info) \
209 INTEL_VGA_DEVICE(0x0155, info)
211 #define INTEL_BDW_GT12M_IDS(info) \
212 INTEL_VGA_DEVICE(0x1602, info), /* GT1 ULT */ \
213 INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \
214 INTEL_VGA_DEVICE(0x160B, info), /* GT1 Iris */ \
215 INTEL_VGA_DEVICE(0x160E, info), /* GT1 ULX */ \
216 INTEL_VGA_DEVICE(0x1612, info), /* GT2 Halo */ \
217 INTEL_VGA_DEVICE(0x1616, info), /* GT2 ULT */ \
218 INTEL_VGA_DEVICE(0x161B, info), /* GT2 ULT */ \
219 INTEL_VGA_DEVICE(0x161E, info) /* GT2 ULX */
221 #define INTEL_BDW_GT12D_IDS(info) \
222 INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \
223 INTEL_VGA_DEVICE(0x160D, info), /* GT1 Workstation */ \
224 INTEL_VGA_DEVICE(0x161A, info), /* GT2 Server */ \
225 INTEL_VGA_DEVICE(0x161D, info) /* GT2 Workstation */
227 #define INTEL_BDW_GT3M_IDS(info) \
228 INTEL_VGA_DEVICE(0x1622, info), /* ULT */ \
229 INTEL_VGA_DEVICE(0x1626, info), /* ULT */ \
230 INTEL_VGA_DEVICE(0x162B, info), /* Iris */ \
231 INTEL_VGA_DEVICE(0x162E, info) /* ULX */
233 #define INTEL_BDW_GT3D_IDS(info) \
234 INTEL_VGA_DEVICE(0x162A, info), /* Server */ \
235 INTEL_VGA_DEVICE(0x162D, info) /* Workstation */
237 #define INTEL_BDW_RSVDM_IDS(info) \
238 INTEL_VGA_DEVICE(0x1632, info), /* ULT */ \
239 INTEL_VGA_DEVICE(0x1636, info), /* ULT */ \
240 INTEL_VGA_DEVICE(0x163B, info), /* Iris */ \
241 INTEL_VGA_DEVICE(0x163E, info) /* ULX */
243 #define INTEL_BDW_RSVDD_IDS(info) \
244 INTEL_VGA_DEVICE(0x163A, info), /* Server */ \
245 INTEL_VGA_DEVICE(0x163D, info) /* Workstation */
247 #define INTEL_BDW_M_IDS(info) \
248 INTEL_BDW_GT12M_IDS(info), \
249 INTEL_BDW_GT3M_IDS(info), \
250 INTEL_BDW_RSVDM_IDS(info)
252 #define INTEL_BDW_D_IDS(info) \
253 INTEL_BDW_GT12D_IDS(info), \
254 INTEL_BDW_GT3D_IDS(info), \
255 INTEL_BDW_RSVDD_IDS(info)
257 #define INTEL_CHV_IDS(info) \
258 INTEL_VGA_DEVICE(0x22b0, info), \
259 INTEL_VGA_DEVICE(0x22b1, info), \
260 INTEL_VGA_DEVICE(0x22b2, info), \
261 INTEL_VGA_DEVICE(0x22b3, info)
263 #define INTEL_SKL_GT1_IDS(info) \
264 INTEL_VGA_DEVICE(0x1906, info), /* ULT GT1 */ \
265 INTEL_VGA_DEVICE(0x190E, info), /* ULX GT1 */ \
266 INTEL_VGA_DEVICE(0x1902, info), /* DT GT1 */ \
267 INTEL_VGA_DEVICE(0x190B, info), /* Halo GT1 */ \
268 INTEL_VGA_DEVICE(0x190A, info) /* SRV GT1 */
270 #define INTEL_SKL_GT2_IDS(info) \
271 INTEL_VGA_DEVICE(0x1916, info), /* ULT GT2 */ \
272 INTEL_VGA_DEVICE(0x1921, info), /* ULT GT2F */ \
273 INTEL_VGA_DEVICE(0x191E, info), /* ULX GT2 */ \
274 INTEL_VGA_DEVICE(0x1912, info), /* DT GT2 */ \
275 INTEL_VGA_DEVICE(0x191B, info), /* Halo GT2 */ \
276 INTEL_VGA_DEVICE(0x191A, info), /* SRV GT2 */ \
277 INTEL_VGA_DEVICE(0x191D, info) /* WKS GT2 */
279 #define INTEL_SKL_GT3_IDS(info) \
280 INTEL_VGA_DEVICE(0x1926, info), /* ULT GT3 */ \
281 INTEL_VGA_DEVICE(0x192B, info), /* Halo GT3 */ \
282 INTEL_VGA_DEVICE(0x192A, info) /* SRV GT3 */ \
284 #define INTEL_SKL_IDS(info) \
285 INTEL_SKL_GT1_IDS(info), \
286 INTEL_SKL_GT2_IDS(info), \
287 INTEL_SKL_GT3_IDS(info)
289 #define INTEL_BXT_IDS(info) \
290 INTEL_VGA_DEVICE(0x0A84, info), \
291 INTEL_VGA_DEVICE(0x1A84, info), \
292 INTEL_VGA_DEVICE(0x5A84, info)
/linux-4.4.14/net/wireless/
H A Dethtool.c6 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) cfg80211_get_drvinfo() argument
10 strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name, cfg80211_get_drvinfo()
11 sizeof(info->driver)); cfg80211_get_drvinfo()
13 strlcpy(info->version, init_utsname()->release, sizeof(info->version)); cfg80211_get_drvinfo()
16 strlcpy(info->fw_version, wdev->wiphy->fw_version, cfg80211_get_drvinfo()
17 sizeof(info->fw_version)); cfg80211_get_drvinfo()
19 strlcpy(info->fw_version, "N/A", sizeof(info->fw_version)); cfg80211_get_drvinfo()
21 strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)), cfg80211_get_drvinfo()
22 sizeof(info->bus_info)); cfg80211_get_drvinfo()
H A Dlib80211.c44 static void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *info,
46 static void lib80211_crypt_quiescing(struct lib80211_crypt_info *info);
49 int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name, lib80211_crypt_info_init() argument
52 memset(info, 0, sizeof(*info)); lib80211_crypt_info_init()
54 info->name = name; lib80211_crypt_info_init()
55 info->lock = lock; lib80211_crypt_info_init()
57 INIT_LIST_HEAD(&info->crypt_deinit_list); lib80211_crypt_info_init()
58 setup_timer(&info->crypt_deinit_timer, lib80211_crypt_deinit_handler, lib80211_crypt_info_init()
59 (unsigned long)info); lib80211_crypt_info_init()
65 void lib80211_crypt_info_free(struct lib80211_crypt_info *info) lib80211_crypt_info_free() argument
69 lib80211_crypt_quiescing(info); lib80211_crypt_info_free()
70 del_timer_sync(&info->crypt_deinit_timer); lib80211_crypt_info_free()
71 lib80211_crypt_deinit_entries(info, 1); lib80211_crypt_info_free()
74 struct lib80211_crypt_data *crypt = info->crypt[i]; lib80211_crypt_info_free()
81 info->crypt[i] = NULL; lib80211_crypt_info_free()
87 static void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *info, lib80211_crypt_deinit_entries() argument
93 spin_lock_irqsave(info->lock, flags); lib80211_crypt_deinit_entries()
94 list_for_each_entry_safe(entry, next, &info->crypt_deinit_list, list) { lib80211_crypt_deinit_entries()
106 spin_unlock_irqrestore(info->lock, flags); lib80211_crypt_deinit_entries()
110 static void lib80211_crypt_quiescing(struct lib80211_crypt_info *info) lib80211_crypt_quiescing() argument
114 spin_lock_irqsave(info->lock, flags); lib80211_crypt_quiescing()
115 info->crypt_quiesced = 1; lib80211_crypt_quiescing()
116 spin_unlock_irqrestore(info->lock, flags); lib80211_crypt_quiescing()
121 struct lib80211_crypt_info *info = (struct lib80211_crypt_info *)data; lib80211_crypt_deinit_handler() local
124 lib80211_crypt_deinit_entries(info, 0); lib80211_crypt_deinit_handler()
126 spin_lock_irqsave(info->lock, flags); lib80211_crypt_deinit_handler()
127 if (!list_empty(&info->crypt_deinit_list) && !info->crypt_quiesced) { lib80211_crypt_deinit_handler()
129 "deletion list\n", info->name); lib80211_crypt_deinit_handler()
130 info->crypt_deinit_timer.expires = jiffies + HZ; lib80211_crypt_deinit_handler()
131 add_timer(&info->crypt_deinit_timer); lib80211_crypt_deinit_handler()
133 spin_unlock_irqrestore(info->lock, flags); lib80211_crypt_deinit_handler()
136 void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info, lib80211_crypt_delayed_deinit() argument
152 spin_lock_irqsave(info->lock, flags); lib80211_crypt_delayed_deinit()
153 if (!info->crypt_quiesced) { lib80211_crypt_delayed_deinit()
154 list_add(&tmp->list, &info->crypt_deinit_list); lib80211_crypt_delayed_deinit()
155 if (!timer_pending(&info->crypt_deinit_timer)) { lib80211_crypt_delayed_deinit()
156 info->crypt_deinit_timer.expires = jiffies + HZ; lib80211_crypt_delayed_deinit()
157 add_timer(&info->crypt_deinit_timer); lib80211_crypt_delayed_deinit()
160 spin_unlock_irqrestore(info->lock, flags); lib80211_crypt_delayed_deinit()
H A Dwext-compat.h14 struct iw_request_info *info,
17 struct iw_request_info *info,
20 struct iw_request_info *info,
23 struct iw_request_info *info,
26 struct iw_request_info *info,
29 struct iw_request_info *info,
33 struct iw_request_info *info,
36 struct iw_request_info *info,
39 struct iw_request_info *info,
42 struct iw_request_info *info,
45 struct iw_request_info *info,
48 struct iw_request_info *info,
52 struct iw_request_info *info,
55 struct iw_request_info *info,
/linux-4.4.14/drivers/nfc/nxp-nci/
H A Dcore.c45 struct nxp_nci_info *info = nci_get_drvdata(ndev); nxp_nci_open() local
48 mutex_lock(&info->info_lock); nxp_nci_open()
50 if (info->mode != NXP_NCI_MODE_COLD) { nxp_nci_open()
55 if (info->phy_ops->set_mode) nxp_nci_open()
56 r = info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_NCI); nxp_nci_open()
58 info->mode = NXP_NCI_MODE_NCI; nxp_nci_open()
61 mutex_unlock(&info->info_lock); nxp_nci_open()
67 struct nxp_nci_info *info = nci_get_drvdata(ndev); nxp_nci_close() local
70 mutex_lock(&info->info_lock); nxp_nci_close()
72 if (info->phy_ops->set_mode) nxp_nci_close()
73 r = info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_COLD); nxp_nci_close()
75 info->mode = NXP_NCI_MODE_COLD; nxp_nci_close()
77 mutex_unlock(&info->info_lock); nxp_nci_close()
83 struct nxp_nci_info *info = nci_get_drvdata(ndev); nxp_nci_send() local
86 if (!info->phy_ops->write) { nxp_nci_send()
91 if (info->mode != NXP_NCI_MODE_NCI) { nxp_nci_send()
96 r = info->phy_ops->write(info->phy_id, skb); nxp_nci_send()
116 struct nxp_nci_info *info; nxp_nci_probe() local
119 info = devm_kzalloc(pdev, sizeof(struct nxp_nci_info), GFP_KERNEL); nxp_nci_probe()
120 if (!info) { nxp_nci_probe()
125 info->phy_id = phy_id; nxp_nci_probe()
126 info->pdev = pdev; nxp_nci_probe()
127 info->phy_ops = phy_ops; nxp_nci_probe()
128 info->max_payload = max_payload; nxp_nci_probe()
129 INIT_WORK(&info->fw_info.work, nxp_nci_fw_work); nxp_nci_probe()
130 init_completion(&info->fw_info.cmd_completion); nxp_nci_probe()
131 mutex_init(&info->info_lock); nxp_nci_probe()
133 if (info->phy_ops->set_mode) { nxp_nci_probe()
134 r = info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_COLD); nxp_nci_probe()
139 info->mode = NXP_NCI_MODE_COLD; nxp_nci_probe()
141 info->ndev = nci_allocate_device(&nxp_nci_ops, NXP_NCI_NFC_PROTOCOLS, nxp_nci_probe()
143 if (!info->ndev) { nxp_nci_probe()
148 nci_set_parent_dev(info->ndev, pdev); nxp_nci_probe()
149 nci_set_drvdata(info->ndev, info); nxp_nci_probe()
150 r = nci_register_device(info->ndev); nxp_nci_probe()
154 *ndev = info->ndev; nxp_nci_probe()
159 nci_free_device(info->ndev); nxp_nci_probe()
167 struct nxp_nci_info *info = nci_get_drvdata(ndev); nxp_nci_remove() local
169 if (info->mode == NXP_NCI_MODE_FW) nxp_nci_remove()
170 nxp_nci_fw_work_complete(info, -ESHUTDOWN); nxp_nci_remove()
171 cancel_work_sync(&info->fw_info.work); nxp_nci_remove()
173 mutex_lock(&info->info_lock); nxp_nci_remove()
175 if (info->phy_ops->set_mode) nxp_nci_remove()
176 info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_COLD); nxp_nci_remove()
181 mutex_unlock(&info->info_lock); nxp_nci_remove()
/linux-4.4.14/arch/x86/xen/
H A Dvga.c11 void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size) xen_init_vga() argument
25 switch (info->video_type) { xen_init_vga()
28 + sizeof(info->u.text_mode_3)) xen_init_vga()
30 screen_info->orig_video_lines = info->u.text_mode_3.rows; xen_init_vga()
31 screen_info->orig_video_cols = info->u.text_mode_3.columns; xen_init_vga()
32 screen_info->orig_x = info->u.text_mode_3.cursor_x; xen_init_vga()
33 screen_info->orig_y = info->u.text_mode_3.cursor_y; xen_init_vga()
35 info->u.text_mode_3.font_height; xen_init_vga()
44 screen_info->lfb_width = info->u.vesa_lfb.width; xen_init_vga()
45 screen_info->lfb_height = info->u.vesa_lfb.height; xen_init_vga()
46 screen_info->lfb_depth = info->u.vesa_lfb.bits_per_pixel; xen_init_vga()
47 screen_info->lfb_base = info->u.vesa_lfb.lfb_base; xen_init_vga()
48 screen_info->lfb_size = info->u.vesa_lfb.lfb_size; xen_init_vga()
49 screen_info->lfb_linelength = info->u.vesa_lfb.bytes_per_line; xen_init_vga()
50 screen_info->red_size = info->u.vesa_lfb.red_size; xen_init_vga()
51 screen_info->red_pos = info->u.vesa_lfb.red_pos; xen_init_vga()
52 screen_info->green_size = info->u.vesa_lfb.green_size; xen_init_vga()
53 screen_info->green_pos = info->u.vesa_lfb.green_pos; xen_init_vga()
54 screen_info->blue_size = info->u.vesa_lfb.blue_size; xen_init_vga()
55 screen_info->blue_pos = info->u.vesa_lfb.blue_pos; xen_init_vga()
56 screen_info->rsvd_size = info->u.vesa_lfb.rsvd_size; xen_init_vga()
57 screen_info->rsvd_pos = info->u.vesa_lfb.rsvd_pos; xen_init_vga()
59 if (info->video_type == XEN_VGATYPE_EFI_LFB) { xen_init_vga()
66 + sizeof(info->u.vesa_lfb.gbl_caps)) xen_init_vga()
67 screen_info->capabilities = info->u.vesa_lfb.gbl_caps; xen_init_vga()
70 + sizeof(info->u.vesa_lfb.mode_attrs)) xen_init_vga()
71 screen_info->vesa_attributes = info->u.vesa_lfb.mode_attrs; xen_init_vga()
/linux-4.4.14/drivers/tty/
H A Dsynclinkmp.c529 static void hdlcdev_tx_done(SLMP_INFO *info);
530 static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size);
531 static int hdlcdev_init(SLMP_INFO *info);
532 static void hdlcdev_exit(SLMP_INFO *info);
537 static int get_stats(SLMP_INFO *info, struct mgsl_icount __user *user_icount);
538 static int get_params(SLMP_INFO *info, MGSL_PARAMS __user *params);
539 static int set_params(SLMP_INFO *info, MGSL_PARAMS __user *params);
540 static int get_txidle(SLMP_INFO *info, int __user *idle_mode);
541 static int set_txidle(SLMP_INFO *info, int idle_mode);
542 static int tx_enable(SLMP_INFO *info, int enable);
543 static int tx_abort(SLMP_INFO *info);
544 static int rx_enable(SLMP_INFO *info, int enable);
545 static int modem_input_wait(SLMP_INFO *info,int arg);
546 static int wait_mgsl_event(SLMP_INFO *info, int __user *mask_ptr);
552 static void add_device(SLMP_INFO *info);
554 static int claim_resources(SLMP_INFO *info);
555 static void release_resources(SLMP_INFO *info);
557 static int startup(SLMP_INFO *info);
558 static int block_til_ready(struct tty_struct *tty, struct file * filp,SLMP_INFO *info);
560 static void shutdown(SLMP_INFO *info);
561 static void program_hw(SLMP_INFO *info);
562 static void change_params(SLMP_INFO *info);
564 static bool init_adapter(SLMP_INFO *info);
565 static bool register_test(SLMP_INFO *info);
566 static bool irq_test(SLMP_INFO *info);
567 static bool loopback_test(SLMP_INFO *info);
568 static int adapter_test(SLMP_INFO *info);
569 static bool memory_test(SLMP_INFO *info);
571 static void reset_adapter(SLMP_INFO *info);
572 static void reset_port(SLMP_INFO *info);
573 static void async_mode(SLMP_INFO *info);
574 static void hdlc_mode(SLMP_INFO *info);
576 static void rx_stop(SLMP_INFO *info);
577 static void rx_start(SLMP_INFO *info);
578 static void rx_reset_buffers(SLMP_INFO *info);
579 static void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last);
580 static bool rx_get_frame(SLMP_INFO *info);
582 static void tx_start(SLMP_INFO *info);
583 static void tx_stop(SLMP_INFO *info);
584 static void tx_load_fifo(SLMP_INFO *info);
585 static void tx_set_idle(SLMP_INFO *info);
586 static void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count);
588 static void get_signals(SLMP_INFO *info);
589 static void set_signals(SLMP_INFO *info);
590 static void enable_loopback(SLMP_INFO *info, int enable);
591 static void set_rate(SLMP_INFO *info, u32 data_rate);
593 static int bh_action(SLMP_INFO *info);
595 static void bh_receive(SLMP_INFO *info);
596 static void bh_transmit(SLMP_INFO *info);
597 static void bh_status(SLMP_INFO *info);
598 static void isr_timer(SLMP_INFO *info);
599 static void isr_rxint(SLMP_INFO *info);
600 static void isr_rxrdy(SLMP_INFO *info);
601 static void isr_txint(SLMP_INFO *info);
602 static void isr_txrdy(SLMP_INFO *info);
603 static void isr_rxdmaok(SLMP_INFO *info);
604 static void isr_rxdmaerror(SLMP_INFO *info);
605 static void isr_txdmaok(SLMP_INFO *info);
606 static void isr_txdmaerror(SLMP_INFO *info);
607 static void isr_io_pin(SLMP_INFO *info, u16 status);
609 static int alloc_dma_bufs(SLMP_INFO *info);
610 static void free_dma_bufs(SLMP_INFO *info);
611 static int alloc_buf_list(SLMP_INFO *info);
612 static int alloc_frame_bufs(SLMP_INFO *info, SCADESC *list, SCADESC_EX *list_ex,int count);
613 static int alloc_tmp_rx_buf(SLMP_INFO *info);
614 static void free_tmp_rx_buf(SLMP_INFO *info);
616 static void load_pci_memory(SLMP_INFO *info, char* dest, const char* src, unsigned short count);
617 static void trace_block(SLMP_INFO *info, const char* data, int count, int xmit);
621 static unsigned char read_reg(SLMP_INFO *info, unsigned char addr);
622 static void write_reg(SLMP_INFO *info, unsigned char addr, unsigned char val);
623 static u16 read_reg16(SLMP_INFO *info, unsigned char addr);
624 static void write_reg16(SLMP_INFO *info, unsigned char addr, u16 val);
625 static unsigned char read_status_reg(SLMP_INFO * info);
626 static void write_control_reg(SLMP_INFO * info);
664 static inline int sanity_check(SLMP_INFO *info, sanity_check() argument
673 if (!info) { sanity_check()
677 if (info->magic != MGSL_MAGIC) { sanity_check()
682 if (!info) sanity_check()
715 SLMP_INFO *info; install() local
724 info = synclinkmp_device_list; install()
725 while (info && info->line != line) install()
726 info = info->next_device; install()
727 if (sanity_check(info, tty->name, "open")) install()
729 if (info->init_error) { install()
731 __FILE__, __LINE__, info->device_name, install()
732 info->init_error); install()
736 tty->driver_data = info; install()
738 return tty_port_install(&info->port, driver, tty); install()
745 SLMP_INFO *info = tty->driver_data; open() local
749 info->port.tty = tty; open()
753 __FILE__,__LINE__,tty->driver->name, info->port.count); open()
755 info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; open()
757 spin_lock_irqsave(&info->netlock, flags); open()
758 if (info->netcount) { open()
760 spin_unlock_irqrestore(&info->netlock, flags); open()
763 info->port.count++; open()
764 spin_unlock_irqrestore(&info->netlock, flags); open()
766 if (info->port.count == 1) { open()
768 retval = startup(info); open()
773 retval = block_til_ready(tty, filp, info); open()
777 __FILE__,__LINE__, info->device_name, retval); open()
783 __FILE__,__LINE__, info->device_name); open()
789 info->port.tty = NULL; /* tty layer will release tty struct */ open()
790 if(info->port.count) open()
791 info->port.count--; open()
802 SLMP_INFO * info = tty->driver_data; close() local
804 if (sanity_check(info, tty->name, "close")) close()
809 __FILE__,__LINE__, info->device_name, info->port.count); close()
811 if (tty_port_close_start(&info->port, tty, filp) == 0) close()
814 mutex_lock(&info->port.mutex); close()
815 if (info->port.flags & ASYNC_INITIALIZED) close()
816 wait_until_sent(tty, info->timeout); close()
820 shutdown(info); close()
821 mutex_unlock(&info->port.mutex); close()
823 tty_port_close_end(&info->port, tty); close()
824 info->port.tty = NULL; close()
828 tty->driver->name, info->port.count); close()
836 SLMP_INFO *info = tty->driver_data; hangup() local
841 __FILE__,__LINE__, info->device_name ); hangup()
843 if (sanity_check(info, tty->name, "hangup")) hangup()
846 mutex_lock(&info->port.mutex); hangup()
848 shutdown(info); hangup()
850 spin_lock_irqsave(&info->port.lock, flags); hangup()
851 info->port.count = 0; hangup()
852 info->port.flags &= ~ASYNC_NORMAL_ACTIVE; hangup()
853 info->port.tty = NULL; hangup()
854 spin_unlock_irqrestore(&info->port.lock, flags); hangup()
855 mutex_unlock(&info->port.mutex); hangup()
857 wake_up_interruptible(&info->port.open_wait); hangup()
864 SLMP_INFO *info = tty->driver_data; set_termios() local
871 change_params(info); set_termios()
876 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); set_termios()
877 spin_lock_irqsave(&info->lock,flags); set_termios()
878 set_signals(info); set_termios()
879 spin_unlock_irqrestore(&info->lock,flags); set_termios()
885 info->serial_signals |= SerialSignal_DTR; set_termios()
888 info->serial_signals |= SerialSignal_RTS; set_termios()
890 spin_lock_irqsave(&info->lock,flags); set_termios()
891 set_signals(info); set_termios()
892 spin_unlock_irqrestore(&info->lock,flags); set_termios()
917 SLMP_INFO *info = tty->driver_data; write() local
922 __FILE__,__LINE__,info->device_name,count); write()
924 if (sanity_check(info, tty->name, "write")) write()
927 if (!info->tx_buf) write()
930 if (info->params.mode == MGSL_MODE_HDLC) { write()
931 if (count > info->max_frame_size) { write()
935 if (info->tx_active) write()
937 if (info->tx_count) { write()
940 tx_load_dma_buffer(info, info->tx_buf, info->tx_count); write()
943 ret = info->tx_count = count; write()
944 tx_load_dma_buffer(info, buf, count); write()
950 min(info->max_frame_size - info->tx_count - 1, write()
951 info->max_frame_size - info->tx_put)); write()
955 memcpy(info->tx_buf + info->tx_put, buf, c); write()
957 spin_lock_irqsave(&info->lock,flags); write()
958 info->tx_put += c; write()
959 if (info->tx_put >= info->max_frame_size) write()
960 info->tx_put -= info->max_frame_size; write()
961 info->tx_count += c; write()
962 spin_unlock_irqrestore(&info->lock,flags); write()
969 if (info->params.mode == MGSL_MODE_HDLC) { write()
971 ret = info->tx_count = 0; write()
974 tx_load_dma_buffer(info, info->tx_buf, info->tx_count); write()
977 if (info->tx_count && !tty->stopped && !tty->hw_stopped) { write()
978 spin_lock_irqsave(&info->lock,flags); write()
979 if (!info->tx_active) write()
980 tx_start(info); write()
981 spin_unlock_irqrestore(&info->lock,flags); write()
987 __FILE__,__LINE__,info->device_name,ret); write()
995 SLMP_INFO *info = tty->driver_data; put_char() local
1001 __FILE__,__LINE__,info->device_name,ch); put_char()
1004 if (sanity_check(info, tty->name, "put_char")) put_char()
1007 if (!info->tx_buf) put_char()
1010 spin_lock_irqsave(&info->lock,flags); put_char()
1012 if ( (info->params.mode != MGSL_MODE_HDLC) || put_char()
1013 !info->tx_active ) { put_char()
1015 if (info->tx_count < info->max_frame_size - 1) { put_char()
1016 info->tx_buf[info->tx_put++] = ch; put_char()
1017 if (info->tx_put >= info->max_frame_size) put_char()
1018 info->tx_put -= info->max_frame_size; put_char()
1019 info->tx_count++; put_char()
1024 spin_unlock_irqrestore(&info->lock,flags); put_char()
1032 SLMP_INFO *info = tty->driver_data; send_xchar() local
1037 __FILE__,__LINE__, info->device_name, ch ); send_xchar()
1039 if (sanity_check(info, tty->name, "send_xchar")) send_xchar()
1042 info->x_char = ch; send_xchar()
1045 spin_lock_irqsave(&info->lock,flags); send_xchar()
1046 if (!info->tx_enabled) send_xchar()
1047 tx_start(info); send_xchar()
1048 spin_unlock_irqrestore(&info->lock,flags); send_xchar()
1056 SLMP_INFO * info = tty->driver_data; wait_until_sent() local
1059 if (!info ) wait_until_sent()
1064 __FILE__,__LINE__, info->device_name ); wait_until_sent()
1066 if (sanity_check(info, tty->name, "wait_until_sent")) wait_until_sent()
1069 if (!test_bit(ASYNCB_INITIALIZED, &info->port.flags)) wait_until_sent()
1080 if ( info->params.data_rate ) { wait_until_sent()
1081 char_time = info->timeout/(32 * 5); wait_until_sent()
1090 if ( info->params.mode == MGSL_MODE_HDLC ) { wait_until_sent()
1091 while (info->tx_active) { wait_until_sent()
1103 while ( info->tx_active && info->tx_enabled) { wait_until_sent()
1115 __FILE__,__LINE__, info->device_name ); wait_until_sent()
1122 SLMP_INFO *info = tty->driver_data; write_room() local
1125 if (sanity_check(info, tty->name, "write_room")) write_room()
1128 if (info->params.mode == MGSL_MODE_HDLC) { write_room()
1129 ret = (info->tx_active) ? 0 : HDLC_MAX_FRAME_SIZE; write_room()
1131 ret = info->max_frame_size - info->tx_count - 1; write_room()
1138 __FILE__, __LINE__, info->device_name, ret); write_room()
1147 SLMP_INFO *info = tty->driver_data; flush_chars() local
1152 __FILE__,__LINE__,info->device_name,info->tx_count); flush_chars()
1154 if (sanity_check(info, tty->name, "flush_chars")) flush_chars()
1157 if (info->tx_count <= 0 || tty->stopped || tty->hw_stopped || flush_chars()
1158 !info->tx_buf) flush_chars()
1163 __FILE__,__LINE__,info->device_name ); flush_chars()
1165 spin_lock_irqsave(&info->lock,flags); flush_chars()
1167 if (!info->tx_active) { flush_chars()
1168 if ( (info->params.mode == MGSL_MODE_HDLC) && flush_chars()
1169 info->tx_count ) { flush_chars()
1173 tx_load_dma_buffer(info, flush_chars()
1174 info->tx_buf,info->tx_count); flush_chars()
1176 tx_start(info); flush_chars()
1179 spin_unlock_irqrestore(&info->lock,flags); flush_chars()
1186 SLMP_INFO *info = tty->driver_data; flush_buffer() local
1191 __FILE__,__LINE__, info->device_name ); flush_buffer()
1193 if (sanity_check(info, tty->name, "flush_buffer")) flush_buffer()
1196 spin_lock_irqsave(&info->lock,flags); flush_buffer()
1197 info->tx_count = info->tx_put = info->tx_get = 0; flush_buffer()
1198 del_timer(&info->tx_timer); flush_buffer()
1199 spin_unlock_irqrestore(&info->lock,flags); flush_buffer()
1208 SLMP_INFO *info = tty->driver_data; tx_hold() local
1211 if (sanity_check(info, tty->name, "tx_hold")) tx_hold()
1216 __FILE__,__LINE__,info->device_name); tx_hold()
1218 spin_lock_irqsave(&info->lock,flags); tx_hold()
1219 if (info->tx_enabled) tx_hold()
1220 tx_stop(info); tx_hold()
1221 spin_unlock_irqrestore(&info->lock,flags); tx_hold()
1228 SLMP_INFO *info = tty->driver_data; tx_release() local
1231 if (sanity_check(info, tty->name, "tx_release")) tx_release()
1236 __FILE__,__LINE__,info->device_name); tx_release()
1238 spin_lock_irqsave(&info->lock,flags); tx_release()
1239 if (!info->tx_enabled) tx_release()
1240 tx_start(info); tx_release()
1241 spin_unlock_irqrestore(&info->lock,flags); tx_release()
1257 SLMP_INFO *info = tty->driver_data; ioctl() local
1262 info->device_name, cmd ); ioctl()
1264 if (sanity_check(info, tty->name, "ioctl")) ioctl()
1275 return get_params(info, argp); ioctl()
1277 return set_params(info, argp); ioctl()
1279 return get_txidle(info, argp); ioctl()
1281 return set_txidle(info, (int)arg); ioctl()
1283 return tx_enable(info, (int)arg); ioctl()
1285 return rx_enable(info, (int)arg); ioctl()
1287 return tx_abort(info); ioctl()
1289 return get_stats(info, argp); ioctl()
1291 return wait_mgsl_event(info, argp); ioctl()
1298 return modem_input_wait(info,(int)arg); ioctl()
1315 SLMP_INFO *info = tty->driver_data; get_icount() local
1319 spin_lock_irqsave(&info->lock,flags); get_icount()
1320 cnow = info->icount; get_icount()
1321 spin_unlock_irqrestore(&info->lock,flags); get_icount()
1342 static inline void line_info(struct seq_file *m, SLMP_INFO *info) line_info() argument
1349 info->device_name, line_info()
1350 info->phys_sca_base, line_info()
1351 info->phys_memory_base, line_info()
1352 info->phys_statctrl_base, line_info()
1353 info->phys_lcr_base, line_info()
1354 info->irq_level, line_info()
1355 info->max_frame_size ); line_info()
1358 spin_lock_irqsave(&info->lock,flags); line_info()
1359 get_signals(info); line_info()
1360 spin_unlock_irqrestore(&info->lock,flags); line_info()
1364 if (info->serial_signals & SerialSignal_RTS) line_info()
1366 if (info->serial_signals & SerialSignal_CTS) line_info()
1368 if (info->serial_signals & SerialSignal_DTR) line_info()
1370 if (info->serial_signals & SerialSignal_DSR) line_info()
1372 if (info->serial_signals & SerialSignal_DCD) line_info()
1374 if (info->serial_signals & SerialSignal_RI) line_info()
1377 if (info->params.mode == MGSL_MODE_HDLC) { line_info()
1379 info->icount.txok, info->icount.rxok); line_info()
1380 if (info->icount.txunder) line_info()
1381 seq_printf(m, " txunder:%d", info->icount.txunder); line_info()
1382 if (info->icount.txabort) line_info()
1383 seq_printf(m, " txabort:%d", info->icount.txabort); line_info()
1384 if (info->icount.rxshort) line_info()
1385 seq_printf(m, " rxshort:%d", info->icount.rxshort); line_info()
1386 if (info->icount.rxlong) line_info()
1387 seq_printf(m, " rxlong:%d", info->icount.rxlong); line_info()
1388 if (info->icount.rxover) line_info()
1389 seq_printf(m, " rxover:%d", info->icount.rxover); line_info()
1390 if (info->icount.rxcrc) line_info()
1391 seq_printf(m, " rxlong:%d", info->icount.rxcrc); line_info()
1394 info->icount.tx, info->icount.rx); line_info()
1395 if (info->icount.frame) line_info()
1396 seq_printf(m, " fe:%d", info->icount.frame); line_info()
1397 if (info->icount.parity) line_info()
1398 seq_printf(m, " pe:%d", info->icount.parity); line_info()
1399 if (info->icount.brk) line_info()
1400 seq_printf(m, " brk:%d", info->icount.brk); line_info()
1401 if (info->icount.overrun) line_info()
1402 seq_printf(m, " oe:%d", info->icount.overrun); line_info()
1409 info->tx_active,info->bh_requested,info->bh_running, line_info()
1410 info->pending_bh); line_info()
1417 SLMP_INFO *info; synclinkmp_proc_show() local
1421 info = synclinkmp_device_list; synclinkmp_proc_show()
1422 while( info ) { synclinkmp_proc_show()
1423 line_info(m, info); synclinkmp_proc_show()
1424 info = info->next_device; synclinkmp_proc_show()
1446 SLMP_INFO *info = tty->driver_data; chars_in_buffer() local
1448 if (sanity_check(info, tty->name, "chars_in_buffer")) chars_in_buffer()
1453 __FILE__, __LINE__, info->device_name, info->tx_count); chars_in_buffer()
1455 return info->tx_count; chars_in_buffer()
1462 SLMP_INFO *info = tty->driver_data; throttle() local
1467 __FILE__,__LINE__, info->device_name ); throttle()
1469 if (sanity_check(info, tty->name, "throttle")) throttle()
1476 spin_lock_irqsave(&info->lock,flags); throttle()
1477 info->serial_signals &= ~SerialSignal_RTS; throttle()
1478 set_signals(info); throttle()
1479 spin_unlock_irqrestore(&info->lock,flags); throttle()
1487 SLMP_INFO *info = tty->driver_data; unthrottle() local
1492 __FILE__,__LINE__, info->device_name ); unthrottle()
1494 if (sanity_check(info, tty->name, "unthrottle")) unthrottle()
1498 if (info->x_char) unthrottle()
1499 info->x_char = 0; unthrottle()
1505 spin_lock_irqsave(&info->lock,flags); unthrottle()
1506 info->serial_signals |= SerialSignal_RTS; unthrottle()
1507 set_signals(info); unthrottle()
1508 spin_unlock_irqrestore(&info->lock,flags); unthrottle()
1518 SLMP_INFO * info = tty->driver_data; set_break() local
1523 __FILE__,__LINE__, info->device_name, break_state); set_break()
1525 if (sanity_check(info, tty->name, "set_break")) set_break()
1528 spin_lock_irqsave(&info->lock,flags); set_break()
1529 RegValue = read_reg(info, CTL); set_break()
1534 write_reg(info, CTL, RegValue); set_break()
1535 spin_unlock_irqrestore(&info->lock,flags); set_break()
1554 SLMP_INFO *info = dev_to_port(dev); hdlcdev_attach() local
1559 if (info->port.count) hdlcdev_attach()
1580 info->params.encoding = new_encoding; hdlcdev_attach()
1581 info->params.crc_type = new_crctype; hdlcdev_attach()
1584 if (info->netcount) hdlcdev_attach()
1585 program_hw(info); hdlcdev_attach()
1599 SLMP_INFO *info = dev_to_port(dev); hdlcdev_xmit() local
1609 info->tx_count = skb->len; hdlcdev_xmit()
1610 tx_load_dma_buffer(info, skb->data, skb->len); hdlcdev_xmit()
1623 spin_lock_irqsave(&info->lock,flags); hdlcdev_xmit()
1624 if (!info->tx_active) hdlcdev_xmit()
1625 tx_start(info); hdlcdev_xmit()
1626 spin_unlock_irqrestore(&info->lock,flags); hdlcdev_xmit()
1641 SLMP_INFO *info = dev_to_port(dev); hdlcdev_open() local
1654 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
1655 if (info->port.count != 0 || info->netcount != 0) { hdlcdev_open()
1657 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
1660 info->netcount=1; hdlcdev_open()
1661 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
1664 if ((rc = startup(info)) != 0) { hdlcdev_open()
1665 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
1666 info->netcount=0; hdlcdev_open()
1667 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
1672 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; hdlcdev_open()
1673 program_hw(info); hdlcdev_open()
1680 spin_lock_irqsave(&info->lock, flags); hdlcdev_open()
1681 get_signals(info); hdlcdev_open()
1682 spin_unlock_irqrestore(&info->lock, flags); hdlcdev_open()
1683 if (info->serial_signals & SerialSignal_DCD) hdlcdev_open()
1700 SLMP_INFO *info = dev_to_port(dev); hdlcdev_close() local
1709 shutdown(info); hdlcdev_close()
1713 spin_lock_irqsave(&info->netlock, flags); hdlcdev_close()
1714 info->netcount=0; hdlcdev_close()
1715 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_close()
1734 SLMP_INFO *info = dev_to_port(dev); hdlcdev_ioctl() local
1741 if (info->port.count) hdlcdev_ioctl()
1756 flags = info->params.flags & (HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
1770 new_line.clock_rate = info->params.clock_speed; hdlcdev_ioctl()
1771 new_line.loopback = info->params.loopback ? 1:0; hdlcdev_ioctl()
1790 case CLOCK_DEFAULT: flags = info->params.flags & hdlcdev_ioctl()
1801 info->params.flags &= ~(HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
1805 info->params.flags |= flags; hdlcdev_ioctl()
1807 info->params.loopback = new_line.loopback; hdlcdev_ioctl()
1810 info->params.clock_speed = new_line.clock_rate; hdlcdev_ioctl()
1812 info->params.clock_speed = 0; hdlcdev_ioctl()
1815 if (info->netcount) hdlcdev_ioctl()
1816 program_hw(info); hdlcdev_ioctl()
1831 SLMP_INFO *info = dev_to_port(dev); hdlcdev_tx_timeout() local
1840 spin_lock_irqsave(&info->lock,flags); hdlcdev_tx_timeout()
1841 tx_stop(info); hdlcdev_tx_timeout()
1842 spin_unlock_irqrestore(&info->lock,flags); hdlcdev_tx_timeout()
1851 * info pointer to device instance information
1853 static void hdlcdev_tx_done(SLMP_INFO *info) hdlcdev_tx_done() argument
1855 if (netif_queue_stopped(info->netdev)) hdlcdev_tx_done()
1856 netif_wake_queue(info->netdev); hdlcdev_tx_done()
1863 * info pointer to device instance information
1867 static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size) hdlcdev_rx() argument
1870 struct net_device *dev = info->netdev; hdlcdev_rx()
1905 * info pointer to device instance information
1909 static int hdlcdev_init(SLMP_INFO *info) hdlcdev_init() argument
1917 dev = alloc_hdlcdev(info); hdlcdev_init()
1924 dev->mem_start = info->phys_sca_base; hdlcdev_init()
1925 dev->mem_end = info->phys_sca_base + SCA_BASE_SIZE - 1; hdlcdev_init()
1926 dev->irq = info->irq_level; hdlcdev_init()
1946 info->netdev = dev; hdlcdev_init()
1954 * info pointer to device instance information
1956 static void hdlcdev_exit(SLMP_INFO *info) hdlcdev_exit() argument
1958 unregister_hdlc_device(info->netdev); hdlcdev_exit()
1959 free_netdev(info->netdev); hdlcdev_exit()
1960 info->netdev = NULL; hdlcdev_exit()
1969 static int bh_action(SLMP_INFO *info) bh_action() argument
1974 spin_lock_irqsave(&info->lock,flags); bh_action()
1976 if (info->pending_bh & BH_RECEIVE) { bh_action()
1977 info->pending_bh &= ~BH_RECEIVE; bh_action()
1979 } else if (info->pending_bh & BH_TRANSMIT) { bh_action()
1980 info->pending_bh &= ~BH_TRANSMIT; bh_action()
1982 } else if (info->pending_bh & BH_STATUS) { bh_action()
1983 info->pending_bh &= ~BH_STATUS; bh_action()
1989 info->bh_running = false; bh_action()
1990 info->bh_requested = false; bh_action()
1993 spin_unlock_irqrestore(&info->lock,flags); bh_action()
2002 SLMP_INFO *info = container_of(work, SLMP_INFO, task); bh_handler() local
2007 __FILE__,__LINE__,info->device_name); bh_handler()
2009 info->bh_running = true; bh_handler()
2011 while((action = bh_action(info)) != 0) { bh_handler()
2016 __FILE__,__LINE__,info->device_name, action); bh_handler()
2021 bh_receive(info); bh_handler()
2024 bh_transmit(info); bh_handler()
2027 bh_status(info); bh_handler()
2032 __FILE__,__LINE__,info->device_name,action); bh_handler()
2039 __FILE__,__LINE__,info->device_name); bh_handler()
2042 static void bh_receive(SLMP_INFO *info) bh_receive() argument
2046 __FILE__,__LINE__,info->device_name); bh_receive()
2048 while( rx_get_frame(info) ); bh_receive()
2051 static void bh_transmit(SLMP_INFO *info) bh_transmit() argument
2053 struct tty_struct *tty = info->port.tty; bh_transmit()
2057 __FILE__,__LINE__,info->device_name); bh_transmit()
2063 static void bh_status(SLMP_INFO *info) bh_status() argument
2067 __FILE__,__LINE__,info->device_name); bh_status()
2069 info->ri_chkcount = 0; bh_status()
2070 info->dsr_chkcount = 0; bh_status()
2071 info->dcd_chkcount = 0; bh_status()
2072 info->cts_chkcount = 0; bh_status()
2075 static void isr_timer(SLMP_INFO * info) isr_timer() argument
2077 unsigned char timer = (info->port_num & 1) ? TIMER2 : TIMER0; isr_timer()
2080 write_reg(info, IER2, 0); isr_timer()
2092 write_reg(info, (unsigned char)(timer + TMCS), 0); isr_timer()
2094 info->irq_occurred = true; isr_timer()
2098 __FILE__,__LINE__,info->device_name); isr_timer()
2101 static void isr_rxint(SLMP_INFO * info) isr_rxint() argument
2103 struct tty_struct *tty = info->port.tty; isr_rxint()
2104 struct mgsl_icount *icount = &info->icount; isr_rxint()
2105 unsigned char status = read_reg(info, SR1) & info->ie1_value & (FLGD + IDLD + CDCD + BRKD); isr_rxint()
2106 unsigned char status2 = read_reg(info, SR2) & info->ie2_value & OVRN; isr_rxint()
2110 write_reg(info, SR1, status); isr_rxint()
2113 write_reg(info, SR2, status2); isr_rxint()
2117 __FILE__,__LINE__,info->device_name,status,status2); isr_rxint()
2119 if (info->params.mode == MGSL_MODE_ASYNC) { isr_rxint()
2126 if (!(status & info->ignore_status_mask1)) { isr_rxint()
2127 if (info->read_status_mask1 & BRKD) { isr_rxint()
2128 tty_insert_flip_char(&info->port, 0, TTY_BREAK); isr_rxint()
2129 if (tty && (info->port.flags & ASYNC_SAK)) isr_rxint()
2138 info->icount.exithunt++; isr_rxint()
2140 info->icount.rxidle++; isr_rxint()
2141 wake_up_interruptible(&info->event_wait_q); isr_rxint()
2149 get_signals( info ); isr_rxint()
2150 isr_io_pin(info, isr_rxint()
2151 MISCSTATUS_DCD_LATCHED|(info->serial_signals&SerialSignal_DCD)); isr_rxint()
2158 static void isr_rxrdy(SLMP_INFO * info) isr_rxrdy() argument
2162 struct mgsl_icount *icount = &info->icount; isr_rxrdy()
2166 __FILE__,__LINE__,info->device_name); isr_rxrdy()
2168 while((status = read_reg(info,CST0)) & BIT0) isr_rxrdy()
2172 DataByte = read_reg(info,TRB); isr_rxrdy()
2178 __FILE__,__LINE__,info->device_name,status); isr_rxrdy()
2189 if (status & info->ignore_status_mask2) isr_rxrdy()
2192 status &= info->read_status_mask2; isr_rxrdy()
2207 tty_insert_flip_char(&info->port, DataByte, flag); isr_rxrdy()
2209 tty_insert_flip_char(&info->port, 0, TTY_OVERRUN); isr_rxrdy()
2214 __FILE__,__LINE__,info->device_name, isr_rxrdy()
2219 tty_flip_buffer_push(&info->port); isr_rxrdy()
2222 static void isr_txeom(SLMP_INFO * info, unsigned char status) isr_txeom() argument
2226 __FILE__,__LINE__,info->device_name,status); isr_txeom()
2228 write_reg(info, TXDMA + DIR, 0x00); /* disable Tx DMA IRQs */ isr_txeom()
2229 write_reg(info, TXDMA + DSR, 0xc0); /* clear IRQs and disable DMA */ isr_txeom()
2230 write_reg(info, TXDMA + DCMD, SWABORT); /* reset/init DMA channel */ isr_txeom()
2233 write_reg(info, CMD, TXRESET); isr_txeom()
2234 write_reg(info, CMD, TXENABLE); isr_txeom()
2236 write_reg(info, CMD, TXBUFCLR); isr_txeom()
2239 info->ie0_value &= ~TXRDYE; isr_txeom()
2240 info->ie1_value &= ~(IDLE + UDRN); isr_txeom()
2241 write_reg16(info, IE0, (unsigned short)((info->ie1_value << 8) + info->ie0_value)); isr_txeom()
2242 write_reg(info, SR1, (unsigned char)(UDRN + IDLE)); isr_txeom()
2244 if ( info->tx_active ) { isr_txeom()
2245 if (info->params.mode != MGSL_MODE_ASYNC) { isr_txeom()
2247 info->icount.txunder++; isr_txeom()
2249 info->icount.txok++; isr_txeom()
2252 info->tx_active = false; isr_txeom()
2253 info->tx_count = info->tx_put = info->tx_get = 0; isr_txeom()
2255 del_timer(&info->tx_timer); isr_txeom()
2257 if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done ) { isr_txeom()
2258 info->serial_signals &= ~SerialSignal_RTS; isr_txeom()
2259 info->drop_rts_on_tx_done = false; isr_txeom()
2260 set_signals(info); isr_txeom()
2264 if (info->netcount) isr_txeom()
2265 hdlcdev_tx_done(info); isr_txeom()
2269 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { isr_txeom()
2270 tx_stop(info); isr_txeom()
2273 info->pending_bh |= BH_TRANSMIT; isr_txeom()
2282 static void isr_txint(SLMP_INFO * info) isr_txint() argument
2284 unsigned char status = read_reg(info, SR1) & info->ie1_value & (UDRN + IDLE + CCTS); isr_txint()
2287 write_reg(info, SR1, status); isr_txint()
2291 __FILE__,__LINE__,info->device_name,status); isr_txint()
2294 isr_txeom(info, status); isr_txint()
2300 get_signals( info ); isr_txint()
2301 isr_io_pin(info, isr_txint()
2302 MISCSTATUS_CTS_LATCHED|(info->serial_signals&SerialSignal_CTS)); isr_txint()
2310 static void isr_txrdy(SLMP_INFO * info) isr_txrdy() argument
2314 __FILE__,__LINE__,info->device_name,info->tx_count); isr_txrdy()
2316 if (info->params.mode != MGSL_MODE_ASYNC) { isr_txrdy()
2318 info->ie0_value &= ~TXRDYE; isr_txrdy()
2319 info->ie1_value |= IDLE; isr_txrdy()
2320 write_reg16(info, IE0, (unsigned short)((info->ie1_value << 8) + info->ie0_value)); isr_txrdy()
2324 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { isr_txrdy()
2325 tx_stop(info); isr_txrdy()
2329 if ( info->tx_count ) isr_txrdy()
2330 tx_load_fifo( info ); isr_txrdy()
2332 info->tx_active = false; isr_txrdy()
2333 info->ie0_value &= ~TXRDYE; isr_txrdy()
2334 write_reg(info, IE0, info->ie0_value); isr_txrdy()
2337 if (info->tx_count < WAKEUP_CHARS) isr_txrdy()
2338 info->pending_bh |= BH_TRANSMIT; isr_txrdy()
2341 static void isr_rxdmaok(SLMP_INFO * info) isr_rxdmaok() argument
2346 unsigned char status = read_reg(info,RXDMA + DSR) & 0xc0; isr_rxdmaok()
2349 write_reg(info, RXDMA + DSR, (unsigned char)(status | 1)); isr_rxdmaok()
2353 __FILE__,__LINE__,info->device_name,status); isr_rxdmaok()
2355 info->pending_bh |= BH_RECEIVE; isr_rxdmaok()
2358 static void isr_rxdmaerror(SLMP_INFO * info) isr_rxdmaerror() argument
2363 unsigned char status = read_reg(info,RXDMA + DSR) & 0x30; isr_rxdmaerror()
2366 write_reg(info, RXDMA + DSR, (unsigned char)(status | 1)); isr_rxdmaerror()
2370 __FILE__,__LINE__,info->device_name,status); isr_rxdmaerror()
2372 info->rx_overflow = true; isr_rxdmaerror()
2373 info->pending_bh |= BH_RECEIVE; isr_rxdmaerror()
2376 static void isr_txdmaok(SLMP_INFO * info) isr_txdmaok() argument
2378 unsigned char status_reg1 = read_reg(info, SR1); isr_txdmaok()
2380 write_reg(info, TXDMA + DIR, 0x00); /* disable Tx DMA IRQs */ isr_txdmaok()
2381 write_reg(info, TXDMA + DSR, 0xc0); /* clear IRQs and disable DMA */ isr_txdmaok()
2382 write_reg(info, TXDMA + DCMD, SWABORT); /* reset/init DMA channel */ isr_txdmaok()
2386 __FILE__,__LINE__,info->device_name,status_reg1); isr_txdmaok()
2389 write_reg16(info, TRC0, 0); isr_txdmaok()
2390 info->ie0_value |= TXRDYE; isr_txdmaok()
2391 write_reg(info, IE0, info->ie0_value); isr_txdmaok()
2394 static void isr_txdmaerror(SLMP_INFO * info) isr_txdmaerror() argument
2399 unsigned char status = read_reg(info,TXDMA + DSR) & 0x30; isr_txdmaerror()
2402 write_reg(info, TXDMA + DSR, (unsigned char)(status | 1)); isr_txdmaerror()
2406 __FILE__,__LINE__,info->device_name,status); isr_txdmaerror()
2411 static void isr_io_pin( SLMP_INFO *info, u16 status ) isr_io_pin() argument
2421 icount = &info->icount; isr_io_pin()
2426 info->input_signal_events.ri_up++; isr_io_pin()
2428 info->input_signal_events.ri_down++; isr_io_pin()
2433 info->input_signal_events.dsr_up++; isr_io_pin()
2435 info->input_signal_events.dsr_down++; isr_io_pin()
2438 if ((info->dcd_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) { isr_io_pin()
2439 info->ie1_value &= ~CDCD; isr_io_pin()
2440 write_reg(info, IE1, info->ie1_value); isr_io_pin()
2444 info->input_signal_events.dcd_up++; isr_io_pin()
2446 info->input_signal_events.dcd_down++; isr_io_pin()
2448 if (info->netcount) { isr_io_pin()
2450 netif_carrier_on(info->netdev); isr_io_pin()
2452 netif_carrier_off(info->netdev); isr_io_pin()
2458 if ((info->cts_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) { isr_io_pin()
2459 info->ie1_value &= ~CCTS; isr_io_pin()
2460 write_reg(info, IE1, info->ie1_value); isr_io_pin()
2464 info->input_signal_events.cts_up++; isr_io_pin()
2466 info->input_signal_events.cts_down++; isr_io_pin()
2468 wake_up_interruptible(&info->status_event_wait_q); isr_io_pin()
2469 wake_up_interruptible(&info->event_wait_q); isr_io_pin()
2471 if ( (info->port.flags & ASYNC_CHECK_CD) && isr_io_pin()
2474 printk("%s CD now %s...", info->device_name, isr_io_pin()
2477 wake_up_interruptible(&info->port.open_wait); isr_io_pin()
2481 if (info->port.tty) isr_io_pin()
2482 tty_hangup(info->port.tty); isr_io_pin()
2486 if (tty_port_cts_enabled(&info->port) && isr_io_pin()
2488 if ( info->port.tty ) { isr_io_pin()
2489 if (info->port.tty->hw_stopped) { isr_io_pin()
2493 info->port.tty->hw_stopped = 0; isr_io_pin()
2494 tx_start(info); isr_io_pin()
2495 info->pending_bh |= BH_TRANSMIT; isr_io_pin()
2502 info->port.tty->hw_stopped = 1; isr_io_pin()
2503 tx_stop(info); isr_io_pin()
2510 info->pending_bh |= BH_STATUS; isr_io_pin()
2522 SLMP_INFO *info = dev_id; synclinkmp_interrupt() local
2532 __FILE__, __LINE__, info->irq_level); synclinkmp_interrupt()
2534 spin_lock(&info->lock); synclinkmp_interrupt()
2539 tmp = read_reg16(info, ISR0); /* get ISR0 and ISR1 in one read */ synclinkmp_interrupt()
2542 timerstatus0 = read_reg(info, ISR2); synclinkmp_interrupt()
2546 __FILE__, __LINE__, info->device_name, synclinkmp_interrupt()
2549 if (info->port_count == 4) { synclinkmp_interrupt()
2551 tmp = read_reg16(info->port_array[2], ISR0); synclinkmp_interrupt()
2554 timerstatus1 = read_reg(info->port_array[2], ISR2); synclinkmp_interrupt()
2558 __FILE__,__LINE__,info->device_name, synclinkmp_interrupt()
2566 for(i=0; i < info->port_count ; i++) { synclinkmp_interrupt()
2567 if (info->port_array[i] == NULL) synclinkmp_interrupt()
2580 isr_rxrdy(info->port_array[i]); synclinkmp_interrupt()
2582 isr_txrdy(info->port_array[i]); synclinkmp_interrupt()
2584 isr_rxint(info->port_array[i]); synclinkmp_interrupt()
2586 isr_txint(info->port_array[i]); synclinkmp_interrupt()
2589 isr_rxdmaerror(info->port_array[i]); synclinkmp_interrupt()
2591 isr_rxdmaok(info->port_array[i]); synclinkmp_interrupt()
2593 isr_txdmaerror(info->port_array[i]); synclinkmp_interrupt()
2595 isr_txdmaok(info->port_array[i]); synclinkmp_interrupt()
2599 isr_timer(info->port_array[0]); synclinkmp_interrupt()
2601 isr_timer(info->port_array[1]); synclinkmp_interrupt()
2603 isr_timer(info->port_array[2]); synclinkmp_interrupt()
2605 isr_timer(info->port_array[3]); synclinkmp_interrupt()
2608 for(i=0; i < info->port_count ; i++) { synclinkmp_interrupt()
2609 SLMP_INFO * port = info->port_array[i]; synclinkmp_interrupt()
2629 spin_unlock(&info->lock); synclinkmp_interrupt()
2633 __FILE__, __LINE__, info->irq_level); synclinkmp_interrupt()
2639 static int startup(SLMP_INFO * info) startup() argument
2642 printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name); startup()
2644 if (info->port.flags & ASYNC_INITIALIZED) startup()
2647 if (!info->tx_buf) { startup()
2648 info->tx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); startup()
2649 if (!info->tx_buf) { startup()
2651 __FILE__,__LINE__,info->device_name); startup()
2656 info->pending_bh = 0; startup()
2658 memset(&info->icount, 0, sizeof(info->icount)); startup()
2661 reset_port(info); startup()
2663 change_params(info); startup()
2665 mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10)); startup()
2667 if (info->port.tty) startup()
2668 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); startup()
2670 info->port.flags |= ASYNC_INITIALIZED; startup()
2677 static void shutdown(SLMP_INFO * info) shutdown() argument
2681 if (!(info->port.flags & ASYNC_INITIALIZED)) shutdown()
2686 __FILE__,__LINE__, info->device_name ); shutdown()
2690 wake_up_interruptible(&info->status_event_wait_q); shutdown()
2691 wake_up_interruptible(&info->event_wait_q); shutdown()
2693 del_timer(&info->tx_timer); shutdown()
2694 del_timer(&info->status_timer); shutdown()
2696 kfree(info->tx_buf); shutdown()
2697 info->tx_buf = NULL; shutdown()
2699 spin_lock_irqsave(&info->lock,flags); shutdown()
2701 reset_port(info); shutdown()
2703 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { shutdown()
2704 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); shutdown()
2705 set_signals(info); shutdown()
2708 spin_unlock_irqrestore(&info->lock,flags); shutdown()
2710 if (info->port.tty) shutdown()
2711 set_bit(TTY_IO_ERROR, &info->port.tty->flags); shutdown()
2713 info->port.flags &= ~ASYNC_INITIALIZED; shutdown()
2716 static void program_hw(SLMP_INFO *info) program_hw() argument
2720 spin_lock_irqsave(&info->lock,flags); program_hw()
2722 rx_stop(info); program_hw()
2723 tx_stop(info); program_hw()
2725 info->tx_count = info->tx_put = info->tx_get = 0; program_hw()
2727 if (info->params.mode == MGSL_MODE_HDLC || info->netcount) program_hw()
2728 hdlc_mode(info); program_hw()
2730 async_mode(info); program_hw()
2732 set_signals(info); program_hw()
2734 info->dcd_chkcount = 0; program_hw()
2735 info->cts_chkcount = 0; program_hw()
2736 info->ri_chkcount = 0; program_hw()
2737 info->dsr_chkcount = 0; program_hw()
2739 info->ie1_value |= (CDCD|CCTS); program_hw()
2740 write_reg(info, IE1, info->ie1_value); program_hw()
2742 get_signals(info); program_hw()
2744 if (info->netcount || (info->port.tty && info->port.tty->termios.c_cflag & CREAD) ) program_hw()
2745 rx_start(info); program_hw()
2747 spin_unlock_irqrestore(&info->lock,flags); program_hw()
2752 static void change_params(SLMP_INFO *info) change_params() argument
2757 if (!info->port.tty) change_params()
2762 __FILE__,__LINE__, info->device_name ); change_params()
2764 cflag = info->port.tty->termios.c_cflag; change_params()
2769 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; change_params()
2771 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); change_params()
2776 case CS5: info->params.data_bits = 5; break; change_params()
2777 case CS6: info->params.data_bits = 6; break; change_params()
2778 case CS7: info->params.data_bits = 7; break; change_params()
2779 case CS8: info->params.data_bits = 8; break; change_params()
2781 default: info->params.data_bits = 7; break; change_params()
2785 info->params.stop_bits = 2; change_params()
2787 info->params.stop_bits = 1; change_params()
2789 info->params.parity = ASYNC_PARITY_NONE; change_params()
2792 info->params.parity = ASYNC_PARITY_ODD; change_params()
2794 info->params.parity = ASYNC_PARITY_EVEN; change_params()
2797 info->params.parity = ASYNC_PARITY_SPACE; change_params()
2804 bits_per_char = info->params.data_bits + change_params()
2805 info->params.stop_bits + 1; change_params()
2811 if (info->params.data_rate <= 460800) { change_params()
2812 info->params.data_rate = tty_get_baud_rate(info->port.tty); change_params()
2815 if ( info->params.data_rate ) { change_params()
2816 info->timeout = (32*HZ*bits_per_char) / change_params()
2817 info->params.data_rate; change_params()
2819 info->timeout += HZ/50; /* Add .02 seconds of slop */ change_params()
2822 info->port.flags |= ASYNC_CTS_FLOW; change_params()
2824 info->port.flags &= ~ASYNC_CTS_FLOW; change_params()
2827 info->port.flags &= ~ASYNC_CHECK_CD; change_params()
2829 info->port.flags |= ASYNC_CHECK_CD; change_params()
2833 info->read_status_mask2 = OVRN; change_params()
2834 if (I_INPCK(info->port.tty)) change_params()
2835 info->read_status_mask2 |= PE | FRME; change_params()
2836 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) change_params()
2837 info->read_status_mask1 |= BRKD; change_params()
2838 if (I_IGNPAR(info->port.tty)) change_params()
2839 info->ignore_status_mask2 |= PE | FRME; change_params()
2840 if (I_IGNBRK(info->port.tty)) { change_params()
2841 info->ignore_status_mask1 |= BRKD; change_params()
2845 if (I_IGNPAR(info->port.tty)) change_params()
2846 info->ignore_status_mask2 |= OVRN; change_params()
2849 program_hw(info); change_params()
2852 static int get_stats(SLMP_INFO * info, struct mgsl_icount __user *user_icount) get_stats() argument
2858 __FILE__,__LINE__, info->device_name); get_stats()
2861 memset(&info->icount, 0, sizeof(info->icount)); get_stats()
2863 mutex_lock(&info->port.mutex); get_stats()
2864 COPY_TO_USER(err, user_icount, &info->icount, sizeof(struct mgsl_icount)); get_stats()
2865 mutex_unlock(&info->port.mutex); get_stats()
2873 static int get_params(SLMP_INFO * info, MGSL_PARAMS __user *user_params) get_params() argument
2878 __FILE__,__LINE__, info->device_name); get_params()
2880 mutex_lock(&info->port.mutex); get_params()
2881 COPY_TO_USER(err,user_params, &info->params, sizeof(MGSL_PARAMS)); get_params()
2882 mutex_unlock(&info->port.mutex); get_params()
2886 __FILE__,__LINE__,info->device_name); get_params()
2893 static int set_params(SLMP_INFO * info, MGSL_PARAMS __user *new_params) set_params() argument
2901 __FILE__,__LINE__,info->device_name ); set_params()
2906 __FILE__,__LINE__,info->device_name); set_params()
2910 mutex_lock(&info->port.mutex); set_params()
2911 spin_lock_irqsave(&info->lock,flags); set_params()
2912 memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); set_params()
2913 spin_unlock_irqrestore(&info->lock,flags); set_params()
2915 change_params(info); set_params()
2916 mutex_unlock(&info->port.mutex); set_params()
2921 static int get_txidle(SLMP_INFO * info, int __user *idle_mode) get_txidle() argument
2927 __FILE__,__LINE__, info->device_name, info->idle_mode); get_txidle()
2929 COPY_TO_USER(err,idle_mode, &info->idle_mode, sizeof(int)); get_txidle()
2933 __FILE__,__LINE__,info->device_name); get_txidle()
2940 static int set_txidle(SLMP_INFO * info, int idle_mode) set_txidle() argument
2946 __FILE__,__LINE__,info->device_name, idle_mode ); set_txidle()
2948 spin_lock_irqsave(&info->lock,flags); set_txidle()
2949 info->idle_mode = idle_mode; set_txidle()
2950 tx_set_idle( info ); set_txidle()
2951 spin_unlock_irqrestore(&info->lock,flags); set_txidle()
2955 static int tx_enable(SLMP_INFO * info, int enable) tx_enable() argument
2961 __FILE__,__LINE__,info->device_name, enable); tx_enable()
2963 spin_lock_irqsave(&info->lock,flags); tx_enable()
2965 if ( !info->tx_enabled ) { tx_enable()
2966 tx_start(info); tx_enable()
2969 if ( info->tx_enabled ) tx_enable()
2970 tx_stop(info); tx_enable()
2972 spin_unlock_irqrestore(&info->lock,flags); tx_enable()
2978 static int tx_abort(SLMP_INFO * info) tx_abort() argument
2984 __FILE__,__LINE__,info->device_name); tx_abort()
2986 spin_lock_irqsave(&info->lock,flags); tx_abort()
2987 if ( info->tx_active && info->params.mode == MGSL_MODE_HDLC ) { tx_abort()
2988 info->ie1_value &= ~UDRN; tx_abort()
2989 info->ie1_value |= IDLE; tx_abort()
2990 write_reg(info, IE1, info->ie1_value); /* disable tx status interrupts */ tx_abort()
2991 write_reg(info, SR1, (unsigned char)(IDLE + UDRN)); /* clear pending */ tx_abort()
2993 write_reg(info, TXDMA + DSR, 0); /* disable DMA channel */ tx_abort()
2994 write_reg(info, TXDMA + DCMD, SWABORT); /* reset/init DMA channel */ tx_abort()
2996 write_reg(info, CMD, TXABORT); tx_abort()
2998 spin_unlock_irqrestore(&info->lock,flags); tx_abort()
3002 static int rx_enable(SLMP_INFO * info, int enable) rx_enable() argument
3008 __FILE__,__LINE__,info->device_name,enable); rx_enable()
3010 spin_lock_irqsave(&info->lock,flags); rx_enable()
3012 if ( !info->rx_enabled ) rx_enable()
3013 rx_start(info); rx_enable()
3015 if ( info->rx_enabled ) rx_enable()
3016 rx_stop(info); rx_enable()
3018 spin_unlock_irqrestore(&info->lock,flags); rx_enable()
3024 static int wait_mgsl_event(SLMP_INFO * info, int __user *mask_ptr) wait_mgsl_event() argument
3042 __FILE__,__LINE__,info->device_name,mask); wait_mgsl_event()
3044 spin_lock_irqsave(&info->lock,flags); wait_mgsl_event()
3047 get_signals(info); wait_mgsl_event()
3048 s = info->serial_signals; wait_mgsl_event()
3056 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
3061 cprev = info->icount; wait_mgsl_event()
3062 oldsigs = info->input_signal_events; wait_mgsl_event()
3066 unsigned char oldval = info->ie1_value; wait_mgsl_event()
3071 info->ie1_value = newval; wait_mgsl_event()
3072 write_reg(info, IE1, info->ie1_value); wait_mgsl_event()
3077 add_wait_queue(&info->event_wait_q, &wait); wait_mgsl_event()
3079 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
3089 spin_lock_irqsave(&info->lock,flags); wait_mgsl_event()
3090 cnow = info->icount; wait_mgsl_event()
3091 newsigs = info->input_signal_events; wait_mgsl_event()
3093 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
3128 remove_wait_queue(&info->event_wait_q, &wait); wait_mgsl_event()
3133 spin_lock_irqsave(&info->lock,flags); wait_mgsl_event()
3134 if (!waitqueue_active(&info->event_wait_q)) { wait_mgsl_event()
3136 info->ie1_value &= ~(FLGD|IDLD); wait_mgsl_event()
3137 write_reg(info, IE1, info->ie1_value); wait_mgsl_event()
3139 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
3148 static int modem_input_wait(SLMP_INFO *info,int arg) modem_input_wait() argument
3156 spin_lock_irqsave(&info->lock,flags); modem_input_wait()
3157 cprev = info->icount; modem_input_wait()
3158 add_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
3160 spin_unlock_irqrestore(&info->lock,flags); modem_input_wait()
3170 spin_lock_irqsave(&info->lock,flags); modem_input_wait()
3171 cnow = info->icount; modem_input_wait()
3173 spin_unlock_irqrestore(&info->lock,flags); modem_input_wait()
3193 remove_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
3202 SLMP_INFO *info = tty->driver_data; tiocmget() local
3206 spin_lock_irqsave(&info->lock,flags); tiocmget()
3207 get_signals(info); tiocmget()
3208 spin_unlock_irqrestore(&info->lock,flags); tiocmget()
3210 result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS : 0) | tiocmget()
3211 ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR : 0) | tiocmget()
3212 ((info->serial_signals & SerialSignal_DCD) ? TIOCM_CAR : 0) | tiocmget()
3213 ((info->serial_signals & SerialSignal_RI) ? TIOCM_RNG : 0) | tiocmget()
3214 ((info->serial_signals & SerialSignal_DSR) ? TIOCM_DSR : 0) | tiocmget()
3215 ((info->serial_signals & SerialSignal_CTS) ? TIOCM_CTS : 0); tiocmget()
3219 __FILE__,__LINE__, info->device_name, result ); tiocmget()
3228 SLMP_INFO *info = tty->driver_data; tiocmset() local
3233 __FILE__,__LINE__,info->device_name, set, clear); tiocmset()
3236 info->serial_signals |= SerialSignal_RTS; tiocmset()
3238 info->serial_signals |= SerialSignal_DTR; tiocmset()
3240 info->serial_signals &= ~SerialSignal_RTS; tiocmset()
3242 info->serial_signals &= ~SerialSignal_DTR; tiocmset()
3244 spin_lock_irqsave(&info->lock,flags); tiocmset()
3245 set_signals(info); tiocmset()
3246 spin_unlock_irqrestore(&info->lock,flags); tiocmset()
3253 SLMP_INFO *info = container_of(port, SLMP_INFO, port); carrier_raised() local
3256 spin_lock_irqsave(&info->lock,flags); carrier_raised()
3257 get_signals(info); carrier_raised()
3258 spin_unlock_irqrestore(&info->lock,flags); carrier_raised()
3260 return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; carrier_raised()
3265 SLMP_INFO *info = container_of(port, SLMP_INFO, port); dtr_rts() local
3268 spin_lock_irqsave(&info->lock,flags); dtr_rts()
3270 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; dtr_rts()
3272 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); dtr_rts()
3273 set_signals(info); dtr_rts()
3274 spin_unlock_irqrestore(&info->lock,flags); dtr_rts()
3280 SLMP_INFO *info) block_til_ready()
3287 struct tty_port *port = &info->port; block_til_ready()
3317 spin_lock_irqsave(&info->lock, flags); block_til_ready()
3319 spin_unlock_irqrestore(&info->lock, flags); block_til_ready()
3368 static int alloc_dma_bufs(SLMP_INFO *info) alloc_dma_bufs() argument
3378 info->port_array[0]->last_mem_alloc = (SCA_MEM_SIZE/4) * info->port_num; alloc_dma_bufs()
3385 BuffersPerFrame = (unsigned short)(info->max_frame_size/SCABUFSIZE); alloc_dma_bufs()
3386 if ( info->max_frame_size % SCABUFSIZE ) alloc_dma_bufs()
3400 info->tx_buf_count = BuffersPerFrame + 1; alloc_dma_bufs()
3403 if (info->tx_buf_count > (BufferCount/2)) alloc_dma_bufs()
3404 info->tx_buf_count = BufferCount/2; alloc_dma_bufs()
3406 if (info->tx_buf_count > SCAMAXDESC) alloc_dma_bufs()
3407 info->tx_buf_count = SCAMAXDESC; alloc_dma_bufs()
3410 info->rx_buf_count = BufferCount - info->tx_buf_count; alloc_dma_bufs()
3412 if (info->rx_buf_count > SCAMAXDESC) alloc_dma_bufs()
3413 info->rx_buf_count = SCAMAXDESC; alloc_dma_bufs()
3417 __FILE__,__LINE__, info->device_name, alloc_dma_bufs()
3418 info->tx_buf_count,info->rx_buf_count); alloc_dma_bufs()
3420 if ( alloc_buf_list( info ) < 0 || alloc_dma_bufs()
3421 alloc_frame_bufs(info, alloc_dma_bufs()
3422 info->rx_buf_list, alloc_dma_bufs()
3423 info->rx_buf_list_ex, alloc_dma_bufs()
3424 info->rx_buf_count) < 0 || alloc_dma_bufs()
3425 alloc_frame_bufs(info, alloc_dma_bufs()
3426 info->tx_buf_list, alloc_dma_bufs()
3427 info->tx_buf_list_ex, alloc_dma_bufs()
3428 info->tx_buf_count) < 0 || alloc_dma_bufs()
3429 alloc_tmp_rx_buf(info) < 0 ) { alloc_dma_bufs()
3431 __FILE__,__LINE__, info->device_name); alloc_dma_bufs()
3435 rx_reset_buffers( info ); alloc_dma_bufs()
3442 static int alloc_buf_list(SLMP_INFO *info) alloc_buf_list() argument
3447 info->buffer_list = info->memory_base + info->port_array[0]->last_mem_alloc; alloc_buf_list()
3448 info->buffer_list_phys = info->port_array[0]->last_mem_alloc; alloc_buf_list()
3449 info->port_array[0]->last_mem_alloc += BUFFERLISTSIZE; alloc_buf_list()
3451 memset(info->buffer_list, 0, BUFFERLISTSIZE); alloc_buf_list()
3456 info->rx_buf_list = (SCADESC *)info->buffer_list; alloc_buf_list()
3458 info->tx_buf_list = (SCADESC *)info->buffer_list; alloc_buf_list()
3459 info->tx_buf_list += info->rx_buf_count; alloc_buf_list()
3467 for ( i = 0; i < info->rx_buf_count; i++ ) { alloc_buf_list()
3469 info->rx_buf_list_ex[i].phys_entry = alloc_buf_list()
3470 info->buffer_list_phys + (i * SCABUFSIZE); alloc_buf_list()
3474 info->rx_buf_list[i].next = info->buffer_list_phys; alloc_buf_list()
3475 if ( i < info->rx_buf_count - 1 ) alloc_buf_list()
3476 info->rx_buf_list[i].next += (i + 1) * sizeof(SCADESC); alloc_buf_list()
3478 info->rx_buf_list[i].length = SCABUFSIZE; alloc_buf_list()
3481 for ( i = 0; i < info->tx_buf_count; i++ ) { alloc_buf_list()
3483 info->tx_buf_list_ex[i].phys_entry = info->buffer_list_phys + alloc_buf_list()
3484 ((info->rx_buf_count + i) * sizeof(SCADESC)); alloc_buf_list()
3489 info->tx_buf_list[i].next = info->buffer_list_phys + alloc_buf_list()
3490 info->rx_buf_count * sizeof(SCADESC); alloc_buf_list()
3492 if ( i < info->tx_buf_count - 1 ) alloc_buf_list()
3493 info->tx_buf_list[i].next += (i + 1) * sizeof(SCADESC); alloc_buf_list()
3501 static int alloc_frame_bufs(SLMP_INFO *info, SCADESC *buf_list,SCADESC_EX *buf_list_ex,int count) alloc_frame_bufs() argument
3507 buf_list_ex[i].virt_addr = info->memory_base + info->port_array[0]->last_mem_alloc; alloc_frame_bufs()
3508 phys_addr = info->port_array[0]->last_mem_alloc; alloc_frame_bufs()
3509 info->port_array[0]->last_mem_alloc += SCABUFSIZE; alloc_frame_bufs()
3518 static void free_dma_bufs(SLMP_INFO *info) free_dma_bufs() argument
3520 info->buffer_list = NULL; free_dma_bufs()
3521 info->rx_buf_list = NULL; free_dma_bufs()
3522 info->tx_buf_list = NULL; free_dma_bufs()
3528 static int alloc_tmp_rx_buf(SLMP_INFO *info) alloc_tmp_rx_buf() argument
3530 info->tmp_rx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); alloc_tmp_rx_buf()
3531 if (info->tmp_rx_buf == NULL) alloc_tmp_rx_buf()
3534 info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL); alloc_tmp_rx_buf()
3535 if (!info->flag_buf) { alloc_tmp_rx_buf()
3536 kfree(info->tmp_rx_buf); alloc_tmp_rx_buf()
3537 info->tmp_rx_buf = NULL; alloc_tmp_rx_buf()
3543 static void free_tmp_rx_buf(SLMP_INFO *info) free_tmp_rx_buf() argument
3545 kfree(info->tmp_rx_buf); free_tmp_rx_buf()
3546 info->tmp_rx_buf = NULL; free_tmp_rx_buf()
3547 kfree(info->flag_buf); free_tmp_rx_buf()
3548 info->flag_buf = NULL; free_tmp_rx_buf()
3551 static int claim_resources(SLMP_INFO *info) claim_resources() argument
3553 if (request_mem_region(info->phys_memory_base,SCA_MEM_SIZE,"synclinkmp") == NULL) { claim_resources()
3555 __FILE__,__LINE__,info->device_name, info->phys_memory_base); claim_resources()
3556 info->init_error = DiagStatus_AddressConflict; claim_resources()
3560 info->shared_mem_requested = true; claim_resources()
3562 if (request_mem_region(info->phys_lcr_base + info->lcr_offset,128,"synclinkmp") == NULL) { claim_resources()
3564 __FILE__,__LINE__,info->device_name, info->phys_lcr_base); claim_resources()
3565 info->init_error = DiagStatus_AddressConflict; claim_resources()
3569 info->lcr_mem_requested = true; claim_resources()
3571 if (request_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE,"synclinkmp") == NULL) { claim_resources()
3573 __FILE__,__LINE__,info->device_name, info->phys_sca_base); claim_resources()
3574 info->init_error = DiagStatus_AddressConflict; claim_resources()
3578 info->sca_base_requested = true; claim_resources()
3580 if (request_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE,"synclinkmp") == NULL) { claim_resources()
3582 __FILE__,__LINE__,info->device_name, info->phys_statctrl_base); claim_resources()
3583 info->init_error = DiagStatus_AddressConflict; claim_resources()
3587 info->sca_statctrl_requested = true; claim_resources()
3589 info->memory_base = ioremap_nocache(info->phys_memory_base, claim_resources()
3591 if (!info->memory_base) { claim_resources()
3593 __FILE__,__LINE__,info->device_name, info->phys_memory_base ); claim_resources()
3594 info->init_error = DiagStatus_CantAssignPciResources; claim_resources()
3598 info->lcr_base = ioremap_nocache(info->phys_lcr_base, PAGE_SIZE); claim_resources()
3599 if (!info->lcr_base) { claim_resources()
3601 __FILE__,__LINE__,info->device_name, info->phys_lcr_base ); claim_resources()
3602 info->init_error = DiagStatus_CantAssignPciResources; claim_resources()
3605 info->lcr_base += info->lcr_offset; claim_resources()
3607 info->sca_base = ioremap_nocache(info->phys_sca_base, PAGE_SIZE); claim_resources()
3608 if (!info->sca_base) { claim_resources()
3610 __FILE__,__LINE__,info->device_name, info->phys_sca_base ); claim_resources()
3611 info->init_error = DiagStatus_CantAssignPciResources; claim_resources()
3614 info->sca_base += info->sca_offset; claim_resources()
3616 info->statctrl_base = ioremap_nocache(info->phys_statctrl_base, claim_resources()
3618 if (!info->statctrl_base) { claim_resources()
3620 __FILE__,__LINE__,info->device_name, info->phys_statctrl_base ); claim_resources()
3621 info->init_error = DiagStatus_CantAssignPciResources; claim_resources()
3624 info->statctrl_base += info->statctrl_offset; claim_resources()
3626 if ( !memory_test(info) ) { claim_resources()
3628 __FILE__,__LINE__,info->device_name, info->phys_memory_base ); claim_resources()
3629 info->init_error = DiagStatus_MemoryError; claim_resources()
3636 release_resources( info ); claim_resources()
3640 static void release_resources(SLMP_INFO *info) release_resources() argument
3644 __FILE__,__LINE__,info->device_name ); release_resources()
3646 if ( info->irq_requested ) { release_resources()
3647 free_irq(info->irq_level, info); release_resources()
3648 info->irq_requested = false; release_resources()
3651 if ( info->shared_mem_requested ) { release_resources()
3652 release_mem_region(info->phys_memory_base,SCA_MEM_SIZE); release_resources()
3653 info->shared_mem_requested = false; release_resources()
3655 if ( info->lcr_mem_requested ) { release_resources()
3656 release_mem_region(info->phys_lcr_base + info->lcr_offset,128); release_resources()
3657 info->lcr_mem_requested = false; release_resources()
3659 if ( info->sca_base_requested ) { release_resources()
3660 release_mem_region(info->phys_sca_base + info->sca_offset,SCA_BASE_SIZE); release_resources()
3661 info->sca_base_requested = false; release_resources()
3663 if ( info->sca_statctrl_requested ) { release_resources()
3664 release_mem_region(info->phys_statctrl_base + info->statctrl_offset,SCA_REG_SIZE); release_resources()
3665 info->sca_statctrl_requested = false; release_resources()
3668 if (info->memory_base){ release_resources()
3669 iounmap(info->memory_base); release_resources()
3670 info->memory_base = NULL; release_resources()
3673 if (info->sca_base) { release_resources()
3674 iounmap(info->sca_base - info->sca_offset); release_resources()
3675 info->sca_base=NULL; release_resources()
3678 if (info->statctrl_base) { release_resources()
3679 iounmap(info->statctrl_base - info->statctrl_offset); release_resources()
3680 info->statctrl_base=NULL; release_resources()
3683 if (info->lcr_base){ release_resources()
3684 iounmap(info->lcr_base - info->lcr_offset); release_resources()
3685 info->lcr_base = NULL; release_resources()
3690 __FILE__,__LINE__,info->device_name ); release_resources()
3696 static void add_device(SLMP_INFO *info) add_device() argument
3698 info->next_device = NULL; add_device()
3699 info->line = synclinkmp_device_count; add_device()
3700 sprintf(info->device_name,"ttySLM%dp%d",info->adapter_num,info->port_num); add_device()
3702 if (info->line < MAX_DEVICES) { add_device()
3703 if (maxframe[info->line]) add_device()
3704 info->max_frame_size = maxframe[info->line]; add_device()
3710 synclinkmp_device_list = info; add_device()
3715 current_dev->next_device = info; add_device()
3718 if ( info->max_frame_size < 4096 ) add_device()
3719 info->max_frame_size = 4096; add_device()
3720 else if ( info->max_frame_size > 65535 ) add_device()
3721 info->max_frame_size = 65535; add_device()
3725 info->device_name, add_device()
3726 info->phys_sca_base, add_device()
3727 info->phys_memory_base, add_device()
3728 info->phys_statctrl_base, add_device()
3729 info->phys_lcr_base, add_device()
3730 info->irq_level, add_device()
3731 info->max_frame_size ); add_device()
3734 hdlcdev_init(info); add_device()
3749 SLMP_INFO *info; alloc_dev() local
3751 info = kzalloc(sizeof(SLMP_INFO), alloc_dev()
3754 if (!info) { alloc_dev()
3758 tty_port_init(&info->port); alloc_dev()
3759 info->port.ops = &port_ops; alloc_dev()
3760 info->magic = MGSL_MAGIC; alloc_dev()
3761 INIT_WORK(&info->task, bh_handler); alloc_dev()
3762 info->max_frame_size = 4096; alloc_dev()
3763 info->port.close_delay = 5*HZ/10; alloc_dev()
3764 info->port.closing_wait = 30*HZ; alloc_dev()
3765 init_waitqueue_head(&info->status_event_wait_q); alloc_dev()
3766 init_waitqueue_head(&info->event_wait_q); alloc_dev()
3767 spin_lock_init(&info->netlock); alloc_dev()
3768 memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS)); alloc_dev()
3769 info->idle_mode = HDLC_TXIDLE_FLAGS; alloc_dev()
3770 info->adapter_num = adapter_num; alloc_dev()
3771 info->port_num = port_num; alloc_dev()
3773 /* Copy configuration info to device instance data */ alloc_dev()
3774 info->irq_level = pdev->irq; alloc_dev()
3775 info->phys_lcr_base = pci_resource_start(pdev,0); alloc_dev()
3776 info->phys_sca_base = pci_resource_start(pdev,2); alloc_dev()
3777 info->phys_memory_base = pci_resource_start(pdev,3); alloc_dev()
3778 info->phys_statctrl_base = pci_resource_start(pdev,4); alloc_dev()
3784 info->lcr_offset = info->phys_lcr_base & (PAGE_SIZE-1); alloc_dev()
3785 info->phys_lcr_base &= ~(PAGE_SIZE-1); alloc_dev()
3787 info->sca_offset = info->phys_sca_base & (PAGE_SIZE-1); alloc_dev()
3788 info->phys_sca_base &= ~(PAGE_SIZE-1); alloc_dev()
3790 info->statctrl_offset = info->phys_statctrl_base & (PAGE_SIZE-1); alloc_dev()
3791 info->phys_statctrl_base &= ~(PAGE_SIZE-1); alloc_dev()
3793 info->bus_type = MGSL_BUS_TYPE_PCI; alloc_dev()
3794 info->irq_flags = IRQF_SHARED; alloc_dev()
3796 setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info); alloc_dev()
3797 setup_timer(&info->status_timer, status_timeout, alloc_dev()
3798 (unsigned long)info); alloc_dev()
3809 info->misc_ctrl_value = 0x087e4546; alloc_dev()
3817 info->init_error = -1; alloc_dev()
3820 return info; alloc_dev()
3910 SLMP_INFO *info; synclinkmp_cleanup() local
3924 info = synclinkmp_device_list; synclinkmp_cleanup()
3925 while(info) { synclinkmp_cleanup()
3926 reset_port(info); synclinkmp_cleanup()
3927 info = info->next_device; synclinkmp_cleanup()
3931 info = synclinkmp_device_list; synclinkmp_cleanup()
3932 while(info) { synclinkmp_cleanup()
3934 hdlcdev_exit(info); synclinkmp_cleanup()
3936 free_dma_bufs(info); synclinkmp_cleanup()
3937 free_tmp_rx_buf(info); synclinkmp_cleanup()
3938 if ( info->port_num == 0 ) { synclinkmp_cleanup()
3939 if (info->sca_base) synclinkmp_cleanup()
3940 write_reg(info, LPR, 1); /* set low power mode */ synclinkmp_cleanup()
3941 release_resources(info); synclinkmp_cleanup()
3943 tmp = info; synclinkmp_cleanup()
3944 info = info->next_device; synclinkmp_cleanup()
4023 static void enable_loopback(SLMP_INFO *info, int enable) enable_loopback() argument
4029 write_reg(info, MD2, (unsigned char)(read_reg(info, MD2) | (BIT1 + BIT0))); enable_loopback()
4032 info->port_array[0]->ctrlreg_value |= (BIT0 << (info->port_num * 2)); enable_loopback()
4033 write_control_reg(info); enable_loopback()
4040 write_reg(info, RXS, 0x40); enable_loopback()
4041 write_reg(info, TXS, 0x40); enable_loopback()
4047 write_reg(info, MD2, (unsigned char)(read_reg(info, MD2) & ~(BIT1 + BIT0))); enable_loopback()
4054 write_reg(info, RXS, 0x00); enable_loopback()
4055 write_reg(info, TXS, 0x00); enable_loopback()
4059 if (info->params.clock_speed) enable_loopback()
4060 set_rate(info, info->params.clock_speed); enable_loopback()
4062 set_rate(info, 3686400); enable_loopback()
4070 static void set_rate( SLMP_INFO *info, u32 data_rate ) set_rate() argument
4101 write_reg(info, TXS, set_rate()
4102 (unsigned char)((read_reg(info, TXS) & 0xf0) | BRValue)); set_rate()
4103 write_reg(info, RXS, set_rate()
4104 (unsigned char)((read_reg(info, RXS) & 0xf0) | BRValue)); set_rate()
4105 write_reg(info, TMC, (unsigned char)TMCValue); set_rate()
4108 write_reg(info, TXS,0); set_rate()
4109 write_reg(info, RXS,0); set_rate()
4110 write_reg(info, TMC, 0); set_rate()
4116 static void rx_stop(SLMP_INFO *info) rx_stop() argument
4120 __FILE__,__LINE__, info->device_name ); rx_stop()
4122 write_reg(info, CMD, RXRESET); rx_stop()
4124 info->ie0_value &= ~RXRDYE; rx_stop()
4125 write_reg(info, IE0, info->ie0_value); /* disable Rx data interrupts */ rx_stop()
4127 write_reg(info, RXDMA + DSR, 0); /* disable Rx DMA */ rx_stop()
4128 write_reg(info, RXDMA + DCMD, SWABORT); /* reset/init Rx DMA */ rx_stop()
4129 write_reg(info, RXDMA + DIR, 0); /* disable Rx DMA interrupts */ rx_stop()
4131 info->rx_enabled = false; rx_stop()
4132 info->rx_overflow = false; rx_stop()
4137 static void rx_start(SLMP_INFO *info) rx_start() argument
4143 __FILE__,__LINE__, info->device_name ); rx_start()
4145 write_reg(info, CMD, RXRESET); rx_start()
4147 if ( info->params.mode == MGSL_MODE_HDLC ) { rx_start()
4149 info->ie0_value &= ~RXRDYE; rx_start()
4150 write_reg(info, IE0, info->ie0_value); rx_start()
4153 write_reg(info, RXDMA + DSR, 0); /* disable Rx DMA */ rx_start()
4154 write_reg(info, RXDMA + DCMD, SWABORT); /* reset/init Rx DMA */ rx_start()
4156 for (i = 0; i < info->rx_buf_count; i++) { rx_start()
4157 info->rx_buf_list[i].status = 0xff; rx_start()
4162 read_status_reg(info); rx_start()
4164 info->current_rx_buf = 0; rx_start()
4167 write_reg16(info, RXDMA + CDA, rx_start()
4168 info->rx_buf_list_ex[0].phys_entry); rx_start()
4171 write_reg16(info, RXDMA + EDA, rx_start()
4172 info->rx_buf_list_ex[info->rx_buf_count - 1].phys_entry); rx_start()
4175 write_reg16(info, RXDMA + BFL, SCABUFSIZE); rx_start()
4177 write_reg(info, RXDMA + DIR, 0x60); /* enable Rx DMA interrupts (EOM/BOF) */ rx_start()
4178 write_reg(info, RXDMA + DSR, 0xf2); /* clear Rx DMA IRQs, enable Rx DMA */ rx_start()
4181 info->ie0_value |= RXRDYE; rx_start()
4182 write_reg(info, IE0, info->ie0_value); rx_start()
4185 write_reg(info, CMD, RXENABLE); rx_start()
4187 info->rx_overflow = false; rx_start()
4188 info->rx_enabled = true; rx_start()
4194 static void tx_start(SLMP_INFO *info) tx_start() argument
4198 __FILE__,__LINE__, info->device_name,info->tx_count ); tx_start()
4200 if (!info->tx_enabled ) { tx_start()
4201 write_reg(info, CMD, TXRESET); tx_start()
4202 write_reg(info, CMD, TXENABLE); tx_start()
4203 info->tx_enabled = true; tx_start()
4206 if ( info->tx_count ) { tx_start()
4212 info->drop_rts_on_tx_done = false; tx_start()
4214 if (info->params.mode != MGSL_MODE_ASYNC) { tx_start()
4216 if ( info->params.flags & HDLC_FLAG_AUTO_RTS ) { tx_start()
4217 get_signals( info ); tx_start()
4218 if ( !(info->serial_signals & SerialSignal_RTS) ) { tx_start()
4219 info->serial_signals |= SerialSignal_RTS; tx_start()
4220 set_signals( info ); tx_start()
4221 info->drop_rts_on_tx_done = true; tx_start()
4225 write_reg16(info, TRC0, tx_start()
4228 write_reg(info, TXDMA + DSR, 0); /* disable DMA channel */ tx_start()
4229 write_reg(info, TXDMA + DCMD, SWABORT); /* reset/init DMA channel */ tx_start()
4232 write_reg16(info, TXDMA + CDA, tx_start()
4233 info->tx_buf_list_ex[0].phys_entry); tx_start()
4236 write_reg16(info, TXDMA + EDA, tx_start()
4237 info->tx_buf_list_ex[info->last_tx_buf].phys_entry); tx_start()
4240 info->ie1_value &= ~IDLE; tx_start()
4241 info->ie1_value |= UDRN; tx_start()
4242 write_reg(info, IE1, info->ie1_value); tx_start()
4243 write_reg(info, SR1, (unsigned char)(IDLE + UDRN)); tx_start()
4245 write_reg(info, TXDMA + DIR, 0x40); /* enable Tx DMA interrupts (EOM) */ tx_start()
4246 write_reg(info, TXDMA + DSR, 0xf2); /* clear Tx DMA IRQs, enable Tx DMA */ tx_start()
4248 mod_timer(&info->tx_timer, jiffies + tx_start()
4252 tx_load_fifo(info); tx_start()
4254 info->ie0_value |= TXRDYE; tx_start()
4255 write_reg(info, IE0, info->ie0_value); tx_start()
4258 info->tx_active = true; tx_start()
4264 static void tx_stop( SLMP_INFO *info ) tx_stop()
4268 __FILE__,__LINE__, info->device_name ); tx_stop()
4270 del_timer(&info->tx_timer); tx_stop()
4272 write_reg(info, TXDMA + DSR, 0); /* disable DMA channel */ tx_stop()
4273 write_reg(info, TXDMA + DCMD, SWABORT); /* reset/init DMA channel */ tx_stop()
4275 write_reg(info, CMD, TXRESET); tx_stop()
4277 info->ie1_value &= ~(UDRN + IDLE); tx_stop()
4278 write_reg(info, IE1, info->ie1_value); /* disable tx status interrupts */ tx_stop()
4279 write_reg(info, SR1, (unsigned char)(IDLE + UDRN)); /* clear pending */ tx_stop()
4281 info->ie0_value &= ~TXRDYE; tx_stop()
4282 write_reg(info, IE0, info->ie0_value); /* disable tx data interrupts */ tx_stop()
4284 info->tx_enabled = false; tx_stop()
4285 info->tx_active = false; tx_stop()
4291 static void tx_load_fifo(SLMP_INFO *info) tx_load_fifo() argument
4297 if ( !info->tx_count && !info->x_char ) tx_load_fifo()
4302 while( info->tx_count && (read_reg(info,SR0) & BIT1) ) { tx_load_fifo()
4307 if ( (info->tx_count > 1) && !info->x_char ) { tx_load_fifo()
4309 TwoBytes[0] = info->tx_buf[info->tx_get++]; tx_load_fifo()
4310 if (info->tx_get >= info->max_frame_size) tx_load_fifo()
4311 info->tx_get -= info->max_frame_size; tx_load_fifo()
4312 TwoBytes[1] = info->tx_buf[info->tx_get++]; tx_load_fifo()
4313 if (info->tx_get >= info->max_frame_size) tx_load_fifo()
4314 info->tx_get -= info->max_frame_size; tx_load_fifo()
4316 write_reg16(info, TRB, *((u16 *)TwoBytes)); tx_load_fifo()
4318 info->tx_count -= 2; tx_load_fifo()
4319 info->icount.tx += 2; tx_load_fifo()
4323 if (info->x_char) { tx_load_fifo()
4325 write_reg(info, TRB, info->x_char); tx_load_fifo()
4326 info->x_char = 0; tx_load_fifo()
4328 write_reg(info, TRB, info->tx_buf[info->tx_get++]); tx_load_fifo()
4329 if (info->tx_get >= info->max_frame_size) tx_load_fifo()
4330 info->tx_get -= info->max_frame_size; tx_load_fifo()
4331 info->tx_count--; tx_load_fifo()
4333 info->icount.tx++; tx_load_fifo()
4340 static void reset_port(SLMP_INFO *info) reset_port() argument
4342 if (info->sca_base) { reset_port()
4344 tx_stop(info); reset_port()
4345 rx_stop(info); reset_port()
4347 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); reset_port()
4348 set_signals(info); reset_port()
4351 info->ie0_value = 0; reset_port()
4352 info->ie1_value = 0; reset_port()
4353 info->ie2_value = 0; reset_port()
4354 write_reg(info, IE0, info->ie0_value); reset_port()
4355 write_reg(info, IE1, info->ie1_value); reset_port()
4356 write_reg(info, IE2, info->ie2_value); reset_port()
4358 write_reg(info, CMD, CHRESET); reset_port()
4364 static void reset_adapter(SLMP_INFO *info) reset_adapter() argument
4369 if (info->port_array[i]) reset_adapter()
4370 reset_port(info->port_array[i]); reset_adapter()
4376 static void async_mode(SLMP_INFO *info) async_mode() argument
4381 tx_stop(info); async_mode()
4382 rx_stop(info); async_mode()
4395 if (info->params.stop_bits != 1) async_mode()
4397 write_reg(info, MD0, RegValue); async_mode()
4409 switch (info->params.data_bits) { async_mode()
4414 if (info->params.parity != ASYNC_PARITY_NONE) { async_mode()
4416 if (info->params.parity == ASYNC_PARITY_ODD) async_mode()
4419 write_reg(info, MD1, RegValue); async_mode()
4429 if (info->params.loopback) async_mode()
4431 write_reg(info, MD2, RegValue); async_mode()
4440 write_reg(info, RXS, RegValue); async_mode()
4449 write_reg(info, TXS, RegValue); async_mode()
4455 info->port_array[0]->ctrlreg_value |= (BIT0 << (info->port_num * 2)); async_mode()
4456 write_control_reg(info); async_mode()
4458 tx_set_idle(info); async_mode()
4465 write_reg(info, RRC, 0x00); async_mode()
4472 write_reg(info, TRC0, 0x10); async_mode()
4479 write_reg(info, TRC1, 0x1e); async_mode()
4494 if (!(info->serial_signals & SerialSignal_RTS)) async_mode()
4496 write_reg(info, CTL, RegValue); async_mode()
4499 info->ie0_value |= TXINTE + RXINTE; async_mode()
4500 write_reg(info, IE0, info->ie0_value); async_mode()
4503 info->ie1_value = BRKD; async_mode()
4504 write_reg(info, IE1, info->ie1_value); async_mode()
4507 info->ie2_value = OVRN; async_mode()
4508 write_reg(info, IE2, info->ie2_value); async_mode()
4510 set_rate( info, info->params.data_rate * 16 ); async_mode()
4515 static void hdlc_mode(SLMP_INFO *info) hdlc_mode() argument
4524 info->params.flags &= ~(HDLC_FLAG_TXC_DPLL + HDLC_FLAG_RXC_DPLL); hdlc_mode()
4527 write_reg(info, TXDMA + DIR, 0); hdlc_mode()
4528 write_reg(info, RXDMA + DIR, 0); hdlc_mode()
4542 if (info->params.flags & HDLC_FLAG_AUTO_CTS) hdlc_mode()
4544 if (info->params.flags & HDLC_FLAG_AUTO_DCD) hdlc_mode()
4546 if (info->params.crc_type == HDLC_CRC_16_CCITT) hdlc_mode()
4548 write_reg(info, MD0, RegValue); hdlc_mode()
4560 write_reg(info, MD1, RegValue); hdlc_mode()
4573 switch(info->params.encoding) { hdlc_mode()
4584 if ( info->params.flags & HDLC_FLAG_DPLL_DIV16 ) { hdlc_mode()
4587 } else if ( info->params.flags & HDLC_FLAG_DPLL_DIV8 ) { hdlc_mode()
4593 write_reg(info, MD2, RegValue); hdlc_mode()
4603 if (info->params.flags & HDLC_FLAG_RXC_BRG) hdlc_mode()
4605 if (info->params.flags & HDLC_FLAG_RXC_DPLL) hdlc_mode()
4607 write_reg(info, RXS, RegValue); hdlc_mode()
4616 if (info->params.flags & HDLC_FLAG_TXC_BRG) hdlc_mode()
4618 if (info->params.flags & HDLC_FLAG_TXC_DPLL) hdlc_mode()
4620 write_reg(info, TXS, RegValue); hdlc_mode()
4622 if (info->params.flags & HDLC_FLAG_RXC_DPLL) hdlc_mode()
4623 set_rate(info, info->params.clock_speed * DpllDivisor); hdlc_mode()
4625 set_rate(info, info->params.clock_speed); hdlc_mode()
4631 if (info->params.flags & HDLC_FLAG_TXC_BRG) hdlc_mode()
4632 info->port_array[0]->ctrlreg_value |= (BIT0 << (info->port_num * 2)); hdlc_mode()
4634 info->port_array[0]->ctrlreg_value &= ~(BIT0 << (info->port_num * 2)); hdlc_mode()
4635 write_control_reg(info); hdlc_mode()
4642 write_reg(info, RRC, rx_active_fifo_level); hdlc_mode()
4649 write_reg(info, TRC0, tx_active_fifo_level); hdlc_mode()
4656 write_reg(info, TRC1, (unsigned char)(tx_negate_fifo_level - 1)); hdlc_mode()
4669 write_reg(info, TXDMA + DMR, 0x14); hdlc_mode()
4670 write_reg(info, RXDMA + DMR, 0x14); hdlc_mode()
4673 write_reg(info, RXDMA + CPB, hdlc_mode()
4674 (unsigned char)(info->buffer_list_phys >> 16)); hdlc_mode()
4677 write_reg(info, TXDMA + CPB, hdlc_mode()
4678 (unsigned char)(info->buffer_list_phys >> 16)); hdlc_mode()
4683 info->ie0_value |= TXINTE + RXINTE; hdlc_mode()
4684 write_reg(info, IE0, info->ie0_value); hdlc_mode()
4699 if (!(info->serial_signals & SerialSignal_RTS)) hdlc_mode()
4701 write_reg(info, CTL, RegValue); hdlc_mode()
4705 tx_set_idle(info); hdlc_mode()
4706 tx_stop(info); hdlc_mode()
4707 rx_stop(info); hdlc_mode()
4709 set_rate(info, info->params.clock_speed); hdlc_mode()
4711 if (info->params.loopback) hdlc_mode()
4712 enable_loopback(info,1); hdlc_mode()
4717 static void tx_set_idle(SLMP_INFO *info) tx_set_idle() argument
4722 switch(info->idle_mode) { tx_set_idle()
4732 write_reg(info, IDL, RegValue); tx_set_idle()
4737 static void get_signals(SLMP_INFO *info) get_signals() argument
4739 u16 status = read_reg(info, SR3); get_signals()
4740 u16 gpstatus = read_status_reg(info); get_signals()
4744 info->serial_signals &= SerialSignal_RTS | SerialSignal_DTR; get_signals()
4749 info->serial_signals |= SerialSignal_CTS; get_signals()
4752 info->serial_signals |= SerialSignal_DCD; get_signals()
4754 testbit = BIT1 << (info->port_num * 2); // Port 0..3 RI is GPDATA<1,3,5,7> get_signals()
4756 info->serial_signals |= SerialSignal_RI; get_signals()
4758 testbit = BIT0 << (info->port_num * 2); // Port 0..3 DSR is GPDATA<0,2,4,6> get_signals()
4760 info->serial_signals |= SerialSignal_DSR; get_signals()
4766 static void set_signals(SLMP_INFO *info) set_signals() argument
4771 RegValue = read_reg(info, CTL); set_signals()
4772 if (info->serial_signals & SerialSignal_RTS) set_signals()
4776 write_reg(info, CTL, RegValue); set_signals()
4779 EnableBit = BIT1 << (info->port_num*2); set_signals()
4780 if (info->serial_signals & SerialSignal_DTR) set_signals()
4781 info->port_array[0]->ctrlreg_value &= ~EnableBit; set_signals()
4783 info->port_array[0]->ctrlreg_value |= EnableBit; set_signals()
4784 write_control_reg(info); set_signals()
4795 static void rx_reset_buffers(SLMP_INFO *info) rx_reset_buffers() argument
4797 rx_free_frame_buffers(info, 0, info->rx_buf_count - 1); rx_reset_buffers()
4802 * info pointer to device instance data
4806 static void rx_free_frame_buffers(SLMP_INFO *info, unsigned int first, unsigned int last) rx_free_frame_buffers() argument
4812 info->rx_buf_list[first].status = 0xff; rx_free_frame_buffers()
4817 write_reg16(info, RXDMA + EDA, info->rx_buf_list_ex[first].phys_entry); rx_free_frame_buffers()
4821 if (first == info->rx_buf_count) rx_free_frame_buffers()
4826 info->current_rx_buf = first; rx_free_frame_buffers()
4834 static bool rx_get_frame(SLMP_INFO *info) rx_get_frame() argument
4841 struct tty_struct *tty = info->port.tty; rx_get_frame()
4857 StartIndex = EndIndex = info->current_rx_buf; rx_get_frame()
4860 desc = &info->rx_buf_list[EndIndex]; rx_get_frame()
4861 desc_ex = &info->rx_buf_list_ex[EndIndex]; rx_get_frame()
4866 if (framesize == 0 && info->params.addr_filter != 0xff) rx_get_frame()
4876 if (EndIndex == info->rx_buf_count) rx_get_frame()
4879 if (EndIndex == info->current_rx_buf) { rx_get_frame()
4882 if ( info->rx_enabled ){ rx_get_frame()
4883 spin_lock_irqsave(&info->lock,flags); rx_get_frame()
4884 rx_start(info); rx_get_frame()
4885 spin_unlock_irqrestore(&info->lock,flags); rx_get_frame()
4908 if (info->params.crc_type == HDLC_CRC_NONE) rx_get_frame()
4912 (addr_field != 0xff && addr_field != info->params.addr_filter)) { rx_get_frame()
4916 rx_free_frame_buffers(info, StartIndex, EndIndex); rx_get_frame()
4928 info->icount.rxshort++; rx_get_frame()
4930 info->icount.rxabort++; rx_get_frame()
4932 info->icount.rxover++; rx_get_frame()
4934 info->icount.rxcrc++; rx_get_frame()
4939 info->netdev->stats.rx_errors++; rx_get_frame()
4940 info->netdev->stats.rx_frame_errors++; rx_get_frame()
4947 __FILE__,__LINE__,info->device_name,status,framesize); rx_get_frame()
4950 trace_block(info,info->rx_buf_list_ex[StartIndex].virt_addr, rx_get_frame()
4954 if (framesize > info->max_frame_size) rx_get_frame()
4955 info->icount.rxlong++; rx_get_frame()
4960 unsigned char *ptmp = info->tmp_rx_buf; rx_get_frame()
4961 info->tmp_rx_buf_count = framesize; rx_get_frame()
4963 info->icount.rxok++; rx_get_frame()
4968 info->rx_buf_list_ex[index].virt_addr, rx_get_frame()
4973 if ( ++index == info->rx_buf_count ) rx_get_frame()
4978 if (info->netcount) rx_get_frame()
4979 hdlcdev_rx(info,info->tmp_rx_buf,framesize); rx_get_frame()
4982 ldisc_receive_buf(tty,info->tmp_rx_buf, rx_get_frame()
4983 info->flag_buf, framesize); rx_get_frame()
4987 rx_free_frame_buffers( info, StartIndex, EndIndex ); rx_get_frame()
4992 if ( info->rx_enabled && info->rx_overflow ) { rx_get_frame()
4996 if (info->rx_buf_list[EndIndex].status == 0xff) { rx_get_frame()
4997 spin_lock_irqsave(&info->lock,flags); rx_get_frame()
4998 rx_start(info); rx_get_frame()
4999 spin_unlock_irqrestore(&info->lock,flags); rx_get_frame()
5008 static void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count) tx_load_dma_buffer() argument
5016 trace_block(info, buf, min_t(unsigned int, count, SCABUFSIZE), 1); tx_load_dma_buffer()
5025 desc = &info->tx_buf_list[i]; tx_load_dma_buffer()
5026 desc_ex = &info->tx_buf_list_ex[i]; tx_load_dma_buffer()
5028 load_pci_memory(info, desc_ex->virt_addr,buf,copy_count); tx_load_dma_buffer()
5040 if (i >= info->tx_buf_count) tx_load_dma_buffer()
5044 info->tx_buf_list[i].status = 0x81; /* set EOM and EOT status */ tx_load_dma_buffer()
5045 info->last_tx_buf = ++i; tx_load_dma_buffer()
5048 static bool register_test(SLMP_INFO *info) register_test() argument
5056 spin_lock_irqsave(&info->lock,flags); register_test()
5057 reset_port(info); register_test()
5060 info->init_error = DiagStatus_AddressFailure; register_test()
5066 write_reg(info, TMC, testval[i]); register_test()
5067 write_reg(info, IDL, testval[(i+1)%count]); register_test()
5068 write_reg(info, SA0, testval[(i+2)%count]); register_test()
5069 write_reg(info, SA1, testval[(i+3)%count]); register_test()
5071 if ( (read_reg(info, TMC) != testval[i]) || register_test()
5072 (read_reg(info, IDL) != testval[(i+1)%count]) || register_test()
5073 (read_reg(info, SA0) != testval[(i+2)%count]) || register_test()
5074 (read_reg(info, SA1) != testval[(i+3)%count]) ) register_test()
5081 reset_port(info); register_test()
5082 spin_unlock_irqrestore(&info->lock,flags); register_test()
5087 static bool irq_test(SLMP_INFO *info) irq_test() argument
5092 unsigned char timer = (info->port_num & 1) ? TIMER2 : TIMER0; irq_test()
5094 spin_lock_irqsave(&info->lock,flags); irq_test()
5095 reset_port(info); irq_test()
5098 info->init_error = DiagStatus_IrqFailure; irq_test()
5099 info->irq_occurred = false; irq_test()
5104 write_reg(info, IER2, (unsigned char)((info->port_num & 1) ? BIT6 : BIT4)); irq_test()
5106 write_reg(info, (unsigned char)(timer + TEPR), 0); /* timer expand prescale */ irq_test()
5107 write_reg16(info, (unsigned char)(timer + TCONR), 1); /* timer constant */ irq_test()
5120 write_reg(info, (unsigned char)(timer + TMCS), 0x50); irq_test()
5122 spin_unlock_irqrestore(&info->lock,flags); irq_test()
5125 while( timeout-- && !info->irq_occurred ) { irq_test()
5129 spin_lock_irqsave(&info->lock,flags); irq_test()
5130 reset_port(info); irq_test()
5131 spin_unlock_irqrestore(&info->lock,flags); irq_test()
5133 return info->irq_occurred; irq_test()
5138 static bool sca_init(SLMP_INFO *info) sca_init() argument
5141 write_reg(info, PABR0, 0); /* wait controller addr boundary 0 */ sca_init()
5142 write_reg(info, PABR1, 0); /* wait controller addr boundary 1 */ sca_init()
5143 write_reg(info, WCRL, 0); /* wait controller low range */ sca_init()
5144 write_reg(info, WCRM, 0); /* wait controller mid range */ sca_init()
5145 write_reg(info, WCRH, 0); /* wait controller high range */ sca_init()
5156 write_reg(info, DPCR, dma_priority); sca_init()
5159 write_reg(info, DMER, 0x80); sca_init()
5162 write_reg(info, IER0, 0xff); /* TxRDY,RxRDY,TxINT,RxINT (ports 0-1) */ sca_init()
5163 write_reg(info, IER1, 0xff); /* DMIB,DMIA (channels 0-3) */ sca_init()
5164 write_reg(info, IER2, 0xf0); /* TIRQ (timers 0-3) */ sca_init()
5172 write_reg(info, ITCR, 0); sca_init()
5179 static bool init_adapter(SLMP_INFO *info) init_adapter() argument
5184 volatile u32 *MiscCtrl = (u32 *)(info->lcr_base + 0x50); init_adapter()
5187 info->misc_ctrl_value |= BIT30; init_adapter()
5188 *MiscCtrl = info->misc_ctrl_value; init_adapter()
5198 info->misc_ctrl_value &= ~BIT30; init_adapter()
5199 *MiscCtrl = info->misc_ctrl_value; init_adapter()
5202 info->ctrlreg_value = 0xaa; init_adapter()
5203 write_control_reg(info); init_adapter()
5206 volatile u32 *LCR1BRDR = (u32 *)(info->lcr_base + 0x2c); init_adapter()
5229 sca_init(info->port_array[0]); init_adapter()
5230 sca_init(info->port_array[2]); init_adapter()
5238 static bool loopback_test(SLMP_INFO *info) loopback_test() argument
5248 struct tty_struct *oldtty = info->port.tty; loopback_test()
5249 u32 speed = info->params.clock_speed; loopback_test()
5251 info->params.clock_speed = 3686400; loopback_test()
5252 info->port.tty = NULL; loopback_test()
5255 info->init_error = DiagStatus_DmaFailure; loopback_test()
5261 memset(info->tmp_rx_buf,0,TESTFRAMESIZE); loopback_test()
5264 spin_lock_irqsave(&info->lock,flags); loopback_test()
5265 hdlc_mode(info); loopback_test()
5266 enable_loopback(info,1); loopback_test()
5267 rx_start(info); loopback_test()
5268 info->tx_count = count; loopback_test()
5269 tx_load_dma_buffer(info,buf,count); loopback_test()
5270 tx_start(info); loopback_test()
5271 spin_unlock_irqrestore(&info->lock,flags); loopback_test()
5278 if (rx_get_frame(info)) { loopback_test()
5286 ( info->tmp_rx_buf_count != count || loopback_test()
5287 memcmp(buf, info->tmp_rx_buf,count))) { loopback_test()
5291 spin_lock_irqsave(&info->lock,flags); loopback_test()
5292 reset_adapter(info); loopback_test()
5293 spin_unlock_irqrestore(&info->lock,flags); loopback_test()
5295 info->params.clock_speed = speed; loopback_test()
5296 info->port.tty = oldtty; loopback_test()
5303 static int adapter_test( SLMP_INFO *info ) adapter_test()
5308 __FILE__,__LINE__,info->device_name ); adapter_test()
5310 spin_lock_irqsave(&info->lock,flags); adapter_test()
5311 init_adapter(info); adapter_test()
5312 spin_unlock_irqrestore(&info->lock,flags); adapter_test()
5314 info->port_array[0]->port_count = 0; adapter_test()
5316 if ( register_test(info->port_array[0]) && adapter_test()
5317 register_test(info->port_array[1])) { adapter_test()
5319 info->port_array[0]->port_count = 2; adapter_test()
5321 if ( register_test(info->port_array[2]) && adapter_test()
5322 register_test(info->port_array[3]) ) adapter_test()
5323 info->port_array[0]->port_count += 2; adapter_test()
5327 __FILE__,__LINE__,info->device_name, (unsigned long)(info->phys_sca_base)); adapter_test()
5331 if ( !irq_test(info->port_array[0]) || adapter_test()
5332 !irq_test(info->port_array[1]) || adapter_test()
5333 (info->port_count == 4 && !irq_test(info->port_array[2])) || adapter_test()
5334 (info->port_count == 4 && !irq_test(info->port_array[3]))) { adapter_test()
5336 __FILE__,__LINE__,info->device_name, (unsigned short)(info->irq_level) ); adapter_test()
5340 if (!loopback_test(info->port_array[0]) || adapter_test()
5341 !loopback_test(info->port_array[1]) || adapter_test()
5342 (info->port_count == 4 && !loopback_test(info->port_array[2])) || adapter_test()
5343 (info->port_count == 4 && !loopback_test(info->port_array[3]))) { adapter_test()
5345 __FILE__,__LINE__,info->device_name); adapter_test()
5351 __FILE__,__LINE__,info->device_name ); adapter_test()
5353 info->port_array[0]->init_error = 0; adapter_test()
5354 info->port_array[1]->init_error = 0; adapter_test()
5355 if ( info->port_count > 2 ) { adapter_test()
5356 info->port_array[2]->init_error = 0; adapter_test()
5357 info->port_array[3]->init_error = 0; adapter_test()
5365 static bool memory_test(SLMP_INFO *info) memory_test() argument
5372 unsigned long * addr = (unsigned long *)info->memory_base; memory_test()
5390 addr = (unsigned long *)info->memory_base; memory_test()
5398 memset( info->memory_base, 0, SCA_MEM_SIZE ); memory_test()
5417 static void load_pci_memory(SLMP_INFO *info, char* dest, const char* src, unsigned short count) load_pci_memory() argument
5428 read_status_reg(info); load_pci_memory()
5436 static void trace_block(SLMP_INFO *info,const char* data, int count, int xmit) trace_block() argument
5441 printk("%s tx data:\n",info->device_name); trace_block()
5443 printk("%s rx data:\n",info->device_name); trace_block()
5473 SLMP_INFO *info = (SLMP_INFO*)context; tx_timeout() local
5478 __FILE__,__LINE__,info->device_name); tx_timeout()
5479 if(info->tx_active && info->params.mode == MGSL_MODE_HDLC) { tx_timeout()
5480 info->icount.txtimeout++; tx_timeout()
5482 spin_lock_irqsave(&info->lock,flags); tx_timeout()
5483 info->tx_active = false; tx_timeout()
5484 info->tx_count = info->tx_put = info->tx_get = 0; tx_timeout()
5486 spin_unlock_irqrestore(&info->lock,flags); tx_timeout()
5489 if (info->netcount) tx_timeout()
5490 hdlcdev_tx_done(info); tx_timeout()
5493 bh_transmit(info); tx_timeout()
5501 SLMP_INFO *info = (SLMP_INFO*)context; status_timeout() local
5506 spin_lock_irqsave(&info->lock,flags); status_timeout()
5507 get_signals(info); status_timeout()
5508 spin_unlock_irqrestore(&info->lock,flags); status_timeout()
5512 delta = info->old_signals ^ info->serial_signals; status_timeout()
5513 info->old_signals = info->serial_signals; status_timeout()
5516 status |= MISCSTATUS_DSR_LATCHED|(info->serial_signals&SerialSignal_DSR); status_timeout()
5519 status |= MISCSTATUS_RI_LATCHED|(info->serial_signals&SerialSignal_RI); status_timeout()
5522 status |= MISCSTATUS_DCD_LATCHED|(info->serial_signals&SerialSignal_DCD); status_timeout()
5525 status |= MISCSTATUS_CTS_LATCHED|(info->serial_signals&SerialSignal_CTS); status_timeout()
5528 isr_io_pin(info,status); status_timeout()
5530 mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10)); status_timeout()
5538 unsigned char * RegAddr = (unsigned char*)(info->sca_base + Addr); \
5539 if (info->port_num > 1) \
5541 if ( info->port_num & 1) { \
5549 static unsigned char read_reg(SLMP_INFO * info, unsigned char Addr) read_reg() argument
5554 static void write_reg(SLMP_INFO * info, unsigned char Addr, unsigned char Value) write_reg() argument
5560 static u16 read_reg16(SLMP_INFO * info, unsigned char Addr) read_reg16() argument
5566 static void write_reg16(SLMP_INFO * info, unsigned char Addr, u16 Value) write_reg16() argument
5572 static unsigned char read_status_reg(SLMP_INFO * info) read_status_reg() argument
5574 unsigned char *RegAddr = (unsigned char *)info->statctrl_base; read_status_reg()
5578 static void write_control_reg(SLMP_INFO * info) write_control_reg() argument
5580 unsigned char *RegAddr = (unsigned char *)info->statctrl_base; write_control_reg()
5581 *RegAddr = info->port_array[0]->ctrlreg_value; write_control_reg()
3279 block_til_ready(struct tty_struct *tty, struct file *filp, SLMP_INFO *info) block_til_ready() argument
H A Dsynclink_gt.c42 #define DBGDATA(info, buf, size, label) if (debug_level >= DEBUG_LEVEL_DATA) trace_block((info), (buf), (size), (label))
43 /*#define DBGTBUF(info) dump_tbufs(info)*/
44 /*#define DBGRBUF(info) dump_rbufs(info)*/
167 static void hdlcdev_tx_done(struct slgt_info *info);
168 static void hdlcdev_rx(struct slgt_info *info, char *buf, int size);
169 static int hdlcdev_init(struct slgt_info *info);
170 static void hdlcdev_exit(struct slgt_info *info);
427 #define slgt_irq_on(info, mask) \
428 wr_reg16((info), SCR, (unsigned short)(rd_reg16((info), SCR) | (mask)))
429 #define slgt_irq_off(info, mask) \
430 wr_reg16((info), SCR, (unsigned short)(rd_reg16((info), SCR) & ~(mask)))
432 static __u8 rd_reg8(struct slgt_info *info, unsigned int addr);
433 static void wr_reg8(struct slgt_info *info, unsigned int addr, __u8 value);
434 static __u16 rd_reg16(struct slgt_info *info, unsigned int addr);
435 static void wr_reg16(struct slgt_info *info, unsigned int addr, __u16 value);
436 static __u32 rd_reg32(struct slgt_info *info, unsigned int addr);
437 static void wr_reg32(struct slgt_info *info, unsigned int addr, __u32 value);
439 static void msc_set_vcr(struct slgt_info *info);
441 static int startup(struct slgt_info *info);
442 static int block_til_ready(struct tty_struct *tty, struct file * filp,struct slgt_info *info);
443 static void shutdown(struct slgt_info *info);
444 static void program_hw(struct slgt_info *info);
445 static void change_params(struct slgt_info *info);
447 static int register_test(struct slgt_info *info);
448 static int irq_test(struct slgt_info *info);
449 static int loopback_test(struct slgt_info *info);
450 static int adapter_test(struct slgt_info *info);
452 static void reset_adapter(struct slgt_info *info);
453 static void reset_port(struct slgt_info *info);
454 static void async_mode(struct slgt_info *info);
455 static void sync_mode(struct slgt_info *info);
457 static void rx_stop(struct slgt_info *info);
458 static void rx_start(struct slgt_info *info);
459 static void reset_rbufs(struct slgt_info *info);
460 static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last);
461 static void rdma_reset(struct slgt_info *info);
462 static bool rx_get_frame(struct slgt_info *info);
463 static bool rx_get_buf(struct slgt_info *info);
465 static void tx_start(struct slgt_info *info);
466 static void tx_stop(struct slgt_info *info);
467 static void tx_set_idle(struct slgt_info *info);
468 static unsigned int free_tbuf_count(struct slgt_info *info);
469 static unsigned int tbuf_bytes(struct slgt_info *info);
470 static void reset_tbufs(struct slgt_info *info);
471 static void tdma_reset(struct slgt_info *info);
472 static bool tx_load(struct slgt_info *info, const char *buf, unsigned int count);
474 static void get_signals(struct slgt_info *info);
475 static void set_signals(struct slgt_info *info);
476 static void enable_loopback(struct slgt_info *info);
477 static void set_rate(struct slgt_info *info, u32 data_rate);
479 static int bh_action(struct slgt_info *info);
481 static void bh_transmit(struct slgt_info *info);
482 static void isr_serial(struct slgt_info *info);
483 static void isr_rdma(struct slgt_info *info);
484 static void isr_txeom(struct slgt_info *info, unsigned short status);
485 static void isr_tdma(struct slgt_info *info);
487 static int alloc_dma_bufs(struct slgt_info *info);
488 static void free_dma_bufs(struct slgt_info *info);
489 static int alloc_desc(struct slgt_info *info);
490 static void free_desc(struct slgt_info *info);
491 static int alloc_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count);
492 static void free_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count);
494 static int alloc_tmp_rbuf(struct slgt_info *info);
495 static void free_tmp_rbuf(struct slgt_info *info);
503 static int get_stats(struct slgt_info *info, struct mgsl_icount __user *user_icount);
504 static int get_params(struct slgt_info *info, MGSL_PARAMS __user *params);
505 static int set_params(struct slgt_info *info, MGSL_PARAMS __user *params);
506 static int get_txidle(struct slgt_info *info, int __user *idle_mode);
507 static int set_txidle(struct slgt_info *info, int idle_mode);
508 static int tx_enable(struct slgt_info *info, int enable);
509 static int tx_abort(struct slgt_info *info);
510 static int rx_enable(struct slgt_info *info, int enable);
511 static int modem_input_wait(struct slgt_info *info,int arg);
512 static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr);
517 static int get_interface(struct slgt_info *info, int __user *if_mode);
518 static int set_interface(struct slgt_info *info, int if_mode);
519 static int set_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
520 static int get_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
521 static int wait_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
522 static int get_xsync(struct slgt_info *info, int __user *if_mode);
523 static int set_xsync(struct slgt_info *info, int if_mode);
524 static int get_xctrl(struct slgt_info *info, int __user *if_mode);
525 static int set_xctrl(struct slgt_info *info, int if_mode);
530 static void add_device(struct slgt_info *info);
532 static int claim_resources(struct slgt_info *info);
533 static void release_resources(struct slgt_info *info);
552 static void trace_block(struct slgt_info *info, const char *data, int count, const char *label) trace_block() argument
556 printk("%s %s data:\n",info->device_name, label); trace_block()
575 #define DBGDATA(info, buf, size, label)
579 static void dump_tbufs(struct slgt_info *info) dump_tbufs() argument
582 printk("tbuf_current=%d\n", info->tbuf_current); dump_tbufs()
583 for (i=0 ; i < info->tbuf_count ; i++) { dump_tbufs()
585 i, le16_to_cpu(info->tbufs[i].count), le16_to_cpu(info->tbufs[i].status)); dump_tbufs()
589 #define DBGTBUF(info)
593 static void dump_rbufs(struct slgt_info *info) dump_rbufs() argument
596 printk("rbuf_current=%d\n", info->rbuf_current); dump_rbufs()
597 for (i=0 ; i < info->rbuf_count ; i++) { dump_rbufs()
599 i, le16_to_cpu(info->rbufs[i].count), le16_to_cpu(info->rbufs[i].status)); dump_rbufs()
603 #define DBGRBUF(info)
606 static inline int sanity_check(struct slgt_info *info, char *devname, const char *name) sanity_check() argument
609 if (!info) { sanity_check()
613 if (info->magic != MGSL_MAGIC) { sanity_check()
618 if (!info) sanity_check()
650 struct slgt_info *info; open() local
660 info = slgt_device_list; open()
661 while(info && info->line != line) open()
662 info = info->next_device; open()
663 if (sanity_check(info, tty->name, "open")) open()
665 if (info->init_error) { open()
666 DBGERR(("%s init error=%d\n", info->device_name, info->init_error)); open()
670 tty->driver_data = info; open()
671 info->port.tty = tty; open()
673 DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->port.count)); open()
675 mutex_lock(&info->port.mutex); open()
676 info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; open()
678 spin_lock_irqsave(&info->netlock, flags); open()
679 if (info->netcount) { open()
681 spin_unlock_irqrestore(&info->netlock, flags); open()
682 mutex_unlock(&info->port.mutex); open()
685 info->port.count++; open()
686 spin_unlock_irqrestore(&info->netlock, flags); open()
688 if (info->port.count == 1) { open()
690 retval = startup(info); open()
692 mutex_unlock(&info->port.mutex); open()
696 mutex_unlock(&info->port.mutex); open()
697 retval = block_til_ready(tty, filp, info); open()
699 DBGINFO(("%s block_til_ready rc=%d\n", info->device_name, retval)); open()
708 info->port.tty = NULL; /* tty layer will release tty struct */ open()
709 if(info->port.count) open()
710 info->port.count--; open()
713 DBGINFO(("%s open rc=%d\n", info->device_name, retval)); open()
719 struct slgt_info *info = tty->driver_data; close() local
721 if (sanity_check(info, tty->name, "close")) close()
723 DBGINFO(("%s close entry, count=%d\n", info->device_name, info->port.count)); close()
725 if (tty_port_close_start(&info->port, tty, filp) == 0) close()
728 mutex_lock(&info->port.mutex); close()
729 if (info->port.flags & ASYNC_INITIALIZED) close()
730 wait_until_sent(tty, info->timeout); close()
734 shutdown(info); close()
735 mutex_unlock(&info->port.mutex); close()
737 tty_port_close_end(&info->port, tty); close()
738 info->port.tty = NULL; close()
740 DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->port.count)); close()
745 struct slgt_info *info = tty->driver_data; hangup() local
748 if (sanity_check(info, tty->name, "hangup")) hangup()
750 DBGINFO(("%s hangup\n", info->device_name)); hangup()
754 mutex_lock(&info->port.mutex); hangup()
755 shutdown(info); hangup()
757 spin_lock_irqsave(&info->port.lock, flags); hangup()
758 info->port.count = 0; hangup()
759 info->port.flags &= ~ASYNC_NORMAL_ACTIVE; hangup()
760 info->port.tty = NULL; hangup()
761 spin_unlock_irqrestore(&info->port.lock, flags); hangup()
762 mutex_unlock(&info->port.mutex); hangup()
764 wake_up_interruptible(&info->port.open_wait); hangup()
769 struct slgt_info *info = tty->driver_data; set_termios() local
774 change_params(info); set_termios()
779 info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); set_termios()
780 spin_lock_irqsave(&info->lock,flags); set_termios()
781 set_signals(info); set_termios()
782 spin_unlock_irqrestore(&info->lock,flags); set_termios()
788 info->signals |= SerialSignal_DTR; set_termios()
791 info->signals |= SerialSignal_RTS; set_termios()
793 spin_lock_irqsave(&info->lock,flags); set_termios()
794 set_signals(info); set_termios()
795 spin_unlock_irqrestore(&info->lock,flags); set_termios()
806 static void update_tx_timer(struct slgt_info *info) update_tx_timer() argument
812 if (info->params.mode == MGSL_MODE_HDLC) { update_tx_timer()
813 int timeout = (tbuf_bytes(info) * 7) + 1000; update_tx_timer()
814 mod_timer(&info->tx_timer, jiffies + msecs_to_jiffies(timeout)); update_tx_timer()
822 struct slgt_info *info = tty->driver_data; write() local
825 if (sanity_check(info, tty->name, "write")) write()
828 DBGINFO(("%s write count=%d\n", info->device_name, count)); write()
830 if (!info->tx_buf || (count > info->max_frame_size)) write()
836 spin_lock_irqsave(&info->lock, flags); write()
838 if (info->tx_count) { write()
840 if (!tx_load(info, info->tx_buf, info->tx_count)) write()
842 info->tx_count = 0; write()
845 if (tx_load(info, buf, count)) write()
849 spin_unlock_irqrestore(&info->lock, flags); write()
850 DBGINFO(("%s write rc=%d\n", info->device_name, ret)); write()
856 struct slgt_info *info = tty->driver_data; put_char() local
860 if (sanity_check(info, tty->name, "put_char")) put_char()
862 DBGINFO(("%s put_char(%d)\n", info->device_name, ch)); put_char()
863 if (!info->tx_buf) put_char()
865 spin_lock_irqsave(&info->lock,flags); put_char()
866 if (info->tx_count < info->max_frame_size) { put_char()
867 info->tx_buf[info->tx_count++] = ch; put_char()
870 spin_unlock_irqrestore(&info->lock,flags); put_char()
876 struct slgt_info *info = tty->driver_data; send_xchar() local
879 if (sanity_check(info, tty->name, "send_xchar")) send_xchar()
881 DBGINFO(("%s send_xchar(%d)\n", info->device_name, ch)); send_xchar()
882 info->x_char = ch; send_xchar()
884 spin_lock_irqsave(&info->lock,flags); send_xchar()
885 if (!info->tx_enabled) send_xchar()
886 tx_start(info); send_xchar()
887 spin_unlock_irqrestore(&info->lock,flags); send_xchar()
893 struct slgt_info *info = tty->driver_data; wait_until_sent() local
896 if (!info ) wait_until_sent()
898 if (sanity_check(info, tty->name, "wait_until_sent")) wait_until_sent()
900 DBGINFO(("%s wait_until_sent entry\n", info->device_name)); wait_until_sent()
901 if (!(info->port.flags & ASYNC_INITIALIZED)) wait_until_sent()
912 if (info->params.data_rate) { wait_until_sent()
913 char_time = info->timeout/(32 * 5); wait_until_sent()
922 while (info->tx_active) { wait_until_sent()
930 DBGINFO(("%s wait_until_sent exit\n", info->device_name)); wait_until_sent()
935 struct slgt_info *info = tty->driver_data; write_room() local
938 if (sanity_check(info, tty->name, "write_room")) write_room()
940 ret = (info->tx_active) ? 0 : HDLC_MAX_FRAME_SIZE; write_room()
941 DBGINFO(("%s write_room=%d\n", info->device_name, ret)); write_room()
947 struct slgt_info *info = tty->driver_data; flush_chars() local
950 if (sanity_check(info, tty->name, "flush_chars")) flush_chars()
952 DBGINFO(("%s flush_chars entry tx_count=%d\n", info->device_name, info->tx_count)); flush_chars()
954 if (info->tx_count <= 0 || tty->stopped || flush_chars()
955 tty->hw_stopped || !info->tx_buf) flush_chars()
958 DBGINFO(("%s flush_chars start transmit\n", info->device_name)); flush_chars()
960 spin_lock_irqsave(&info->lock,flags); flush_chars()
961 if (info->tx_count && tx_load(info, info->tx_buf, info->tx_count)) flush_chars()
962 info->tx_count = 0; flush_chars()
963 spin_unlock_irqrestore(&info->lock,flags); flush_chars()
968 struct slgt_info *info = tty->driver_data; flush_buffer() local
971 if (sanity_check(info, tty->name, "flush_buffer")) flush_buffer()
973 DBGINFO(("%s flush_buffer\n", info->device_name)); flush_buffer()
975 spin_lock_irqsave(&info->lock, flags); flush_buffer()
976 info->tx_count = 0; flush_buffer()
977 spin_unlock_irqrestore(&info->lock, flags); flush_buffer()
987 struct slgt_info *info = tty->driver_data; tx_hold() local
990 if (sanity_check(info, tty->name, "tx_hold")) tx_hold()
992 DBGINFO(("%s tx_hold\n", info->device_name)); tx_hold()
993 spin_lock_irqsave(&info->lock,flags); tx_hold()
994 if (info->tx_enabled && info->params.mode == MGSL_MODE_ASYNC) tx_hold()
995 tx_stop(info); tx_hold()
996 spin_unlock_irqrestore(&info->lock,flags); tx_hold()
1004 struct slgt_info *info = tty->driver_data; tx_release() local
1007 if (sanity_check(info, tty->name, "tx_release")) tx_release()
1009 DBGINFO(("%s tx_release\n", info->device_name)); tx_release()
1010 spin_lock_irqsave(&info->lock, flags); tx_release()
1011 if (info->tx_count && tx_load(info, info->tx_buf, info->tx_count)) tx_release()
1012 info->tx_count = 0; tx_release()
1013 spin_unlock_irqrestore(&info->lock, flags); tx_release()
1030 struct slgt_info *info = tty->driver_data; ioctl() local
1034 if (sanity_check(info, tty->name, "ioctl")) ioctl()
1036 DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd)); ioctl()
1046 return wait_mgsl_event(info, argp); ioctl()
1048 return modem_input_wait(info,(int)arg); ioctl()
1050 return set_gpio(info, argp); ioctl()
1052 return get_gpio(info, argp); ioctl()
1054 return wait_gpio(info, argp); ioctl()
1056 return get_xsync(info, argp); ioctl()
1058 return set_xsync(info, (int)arg); ioctl()
1060 return get_xctrl(info, argp); ioctl()
1062 return set_xctrl(info, (int)arg); ioctl()
1064 mutex_lock(&info->port.mutex); ioctl()
1067 ret = get_params(info, argp); ioctl()
1070 ret = set_params(info, argp); ioctl()
1073 ret = get_txidle(info, argp); ioctl()
1076 ret = set_txidle(info, (int)arg); ioctl()
1079 ret = tx_enable(info, (int)arg); ioctl()
1082 ret = rx_enable(info, (int)arg); ioctl()
1085 ret = tx_abort(info); ioctl()
1088 ret = get_stats(info, argp); ioctl()
1091 ret = get_interface(info, argp); ioctl()
1094 ret = set_interface(info,(int)arg); ioctl()
1099 mutex_unlock(&info->port.mutex); ioctl()
1107 struct slgt_info *info = tty->driver_data; get_icount() local
1111 spin_lock_irqsave(&info->lock,flags); get_icount()
1112 cnow = info->icount; get_icount()
1113 spin_unlock_irqrestore(&info->lock,flags); get_icount()
1134 static long get_params32(struct slgt_info *info, struct MGSL_PARAMS32 __user *user_params) get_params32() argument
1138 DBGINFO(("%s get_params32\n", info->device_name)); get_params32()
1140 tmp_params.mode = (compat_ulong_t)info->params.mode; get_params32()
1141 tmp_params.loopback = info->params.loopback; get_params32()
1142 tmp_params.flags = info->params.flags; get_params32()
1143 tmp_params.encoding = info->params.encoding; get_params32()
1144 tmp_params.clock_speed = (compat_ulong_t)info->params.clock_speed; get_params32()
1145 tmp_params.addr_filter = info->params.addr_filter; get_params32()
1146 tmp_params.crc_type = info->params.crc_type; get_params32()
1147 tmp_params.preamble_length = info->params.preamble_length; get_params32()
1148 tmp_params.preamble = info->params.preamble; get_params32()
1149 tmp_params.data_rate = (compat_ulong_t)info->params.data_rate; get_params32()
1150 tmp_params.data_bits = info->params.data_bits; get_params32()
1151 tmp_params.stop_bits = info->params.stop_bits; get_params32()
1152 tmp_params.parity = info->params.parity; get_params32()
1158 static long set_params32(struct slgt_info *info, struct MGSL_PARAMS32 __user *new_params) set_params32() argument
1162 DBGINFO(("%s set_params32\n", info->device_name)); set_params32()
1166 spin_lock(&info->lock); set_params32()
1168 info->base_clock = tmp_params.clock_speed; set_params32()
1170 info->params.mode = tmp_params.mode; set_params32()
1171 info->params.loopback = tmp_params.loopback; set_params32()
1172 info->params.flags = tmp_params.flags; set_params32()
1173 info->params.encoding = tmp_params.encoding; set_params32()
1174 info->params.clock_speed = tmp_params.clock_speed; set_params32()
1175 info->params.addr_filter = tmp_params.addr_filter; set_params32()
1176 info->params.crc_type = tmp_params.crc_type; set_params32()
1177 info->params.preamble_length = tmp_params.preamble_length; set_params32()
1178 info->params.preamble = tmp_params.preamble; set_params32()
1179 info->params.data_rate = tmp_params.data_rate; set_params32()
1180 info->params.data_bits = tmp_params.data_bits; set_params32()
1181 info->params.stop_bits = tmp_params.stop_bits; set_params32()
1182 info->params.parity = tmp_params.parity; set_params32()
1184 spin_unlock(&info->lock); set_params32()
1186 program_hw(info); set_params32()
1194 struct slgt_info *info = tty->driver_data; slgt_compat_ioctl() local
1197 if (sanity_check(info, tty->name, "compat_ioctl")) slgt_compat_ioctl()
1199 DBGINFO(("%s compat_ioctl() cmd=%08X\n", info->device_name, cmd)); slgt_compat_ioctl()
1204 rc = set_params32(info, compat_ptr(arg)); slgt_compat_ioctl()
1208 rc = get_params32(info, compat_ptr(arg)); slgt_compat_ioctl()
1234 DBGINFO(("%s compat_ioctl() cmd=%08X rc=%d\n", info->device_name, cmd, rc)); slgt_compat_ioctl()
1244 static inline void line_info(struct seq_file *m, struct slgt_info *info) line_info() argument
1250 info->device_name, info->phys_reg_addr, line_info()
1251 info->irq_level, info->max_frame_size); line_info()
1254 spin_lock_irqsave(&info->lock,flags); line_info()
1255 get_signals(info); line_info()
1256 spin_unlock_irqrestore(&info->lock,flags); line_info()
1260 if (info->signals & SerialSignal_RTS) line_info()
1262 if (info->signals & SerialSignal_CTS) line_info()
1264 if (info->signals & SerialSignal_DTR) line_info()
1266 if (info->signals & SerialSignal_DSR) line_info()
1268 if (info->signals & SerialSignal_DCD) line_info()
1270 if (info->signals & SerialSignal_RI) line_info()
1273 if (info->params.mode != MGSL_MODE_ASYNC) { line_info()
1275 info->icount.txok, info->icount.rxok); line_info()
1276 if (info->icount.txunder) line_info()
1277 seq_printf(m, " txunder:%d", info->icount.txunder); line_info()
1278 if (info->icount.txabort) line_info()
1279 seq_printf(m, " txabort:%d", info->icount.txabort); line_info()
1280 if (info->icount.rxshort) line_info()
1281 seq_printf(m, " rxshort:%d", info->icount.rxshort); line_info()
1282 if (info->icount.rxlong) line_info()
1283 seq_printf(m, " rxlong:%d", info->icount.rxlong); line_info()
1284 if (info->icount.rxover) line_info()
1285 seq_printf(m, " rxover:%d", info->icount.rxover); line_info()
1286 if (info->icount.rxcrc) line_info()
1287 seq_printf(m, " rxcrc:%d", info->icount.rxcrc); line_info()
1290 info->icount.tx, info->icount.rx); line_info()
1291 if (info->icount.frame) line_info()
1292 seq_printf(m, " fe:%d", info->icount.frame); line_info()
1293 if (info->icount.parity) line_info()
1294 seq_printf(m, " pe:%d", info->icount.parity); line_info()
1295 if (info->icount.brk) line_info()
1296 seq_printf(m, " brk:%d", info->icount.brk); line_info()
1297 if (info->icount.overrun) line_info()
1298 seq_printf(m, " oe:%d", info->icount.overrun); line_info()
1305 info->tx_active,info->bh_requested,info->bh_running, line_info()
1306 info->pending_bh); line_info()
1313 struct slgt_info *info; synclink_gt_proc_show() local
1317 info = slgt_device_list; synclink_gt_proc_show()
1318 while( info ) { synclink_gt_proc_show()
1319 line_info(m, info); synclink_gt_proc_show()
1320 info = info->next_device; synclink_gt_proc_show()
1343 struct slgt_info *info = tty->driver_data; chars_in_buffer() local
1345 if (sanity_check(info, tty->name, "chars_in_buffer")) chars_in_buffer()
1347 count = tbuf_bytes(info); chars_in_buffer()
1348 DBGINFO(("%s chars_in_buffer()=%d\n", info->device_name, count)); chars_in_buffer()
1357 struct slgt_info *info = tty->driver_data; throttle() local
1360 if (sanity_check(info, tty->name, "throttle")) throttle()
1362 DBGINFO(("%s throttle\n", info->device_name)); throttle()
1366 spin_lock_irqsave(&info->lock,flags); throttle()
1367 info->signals &= ~SerialSignal_RTS; throttle()
1368 set_signals(info); throttle()
1369 spin_unlock_irqrestore(&info->lock,flags); throttle()
1378 struct slgt_info *info = tty->driver_data; unthrottle() local
1381 if (sanity_check(info, tty->name, "unthrottle")) unthrottle()
1383 DBGINFO(("%s unthrottle\n", info->device_name)); unthrottle()
1385 if (info->x_char) unthrottle()
1386 info->x_char = 0; unthrottle()
1391 spin_lock_irqsave(&info->lock,flags); unthrottle()
1392 info->signals |= SerialSignal_RTS; unthrottle()
1393 set_signals(info); unthrottle()
1394 spin_unlock_irqrestore(&info->lock,flags); unthrottle()
1404 struct slgt_info *info = tty->driver_data; set_break() local
1408 if (sanity_check(info, tty->name, "set_break")) set_break()
1410 DBGINFO(("%s set_break(%d)\n", info->device_name, break_state)); set_break()
1412 spin_lock_irqsave(&info->lock,flags); set_break()
1413 value = rd_reg16(info, TCR); set_break()
1418 wr_reg16(info, TCR, value); set_break()
1419 spin_unlock_irqrestore(&info->lock,flags); set_break()
1438 struct slgt_info *info = dev_to_port(dev); hdlcdev_attach() local
1443 if (info->port.count) hdlcdev_attach()
1446 DBGINFO(("%s hdlcdev_attach\n", info->device_name)); hdlcdev_attach()
1466 info->params.encoding = new_encoding; hdlcdev_attach()
1467 info->params.crc_type = new_crctype; hdlcdev_attach()
1470 if (info->netcount) hdlcdev_attach()
1471 program_hw(info); hdlcdev_attach()
1485 struct slgt_info *info = dev_to_port(dev); hdlcdev_xmit() local
1503 spin_lock_irqsave(&info->lock, flags); hdlcdev_xmit()
1504 tx_load(info, skb->data, skb->len); hdlcdev_xmit()
1505 spin_unlock_irqrestore(&info->lock, flags); hdlcdev_xmit()
1523 struct slgt_info *info = dev_to_port(dev); hdlcdev_open() local
1538 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
1539 if (info->port.count != 0 || info->netcount != 0) { hdlcdev_open()
1541 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
1544 info->netcount=1; hdlcdev_open()
1545 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
1548 if ((rc = startup(info)) != 0) { hdlcdev_open()
1549 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
1550 info->netcount=0; hdlcdev_open()
1551 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
1556 info->signals |= SerialSignal_RTS | SerialSignal_DTR; hdlcdev_open()
1557 program_hw(info); hdlcdev_open()
1564 spin_lock_irqsave(&info->lock, flags); hdlcdev_open()
1565 get_signals(info); hdlcdev_open()
1566 spin_unlock_irqrestore(&info->lock, flags); hdlcdev_open()
1567 if (info->signals & SerialSignal_DCD) hdlcdev_open()
1584 struct slgt_info *info = dev_to_port(dev); hdlcdev_close() local
1592 shutdown(info); hdlcdev_close()
1596 spin_lock_irqsave(&info->netlock, flags); hdlcdev_close()
1597 info->netcount=0; hdlcdev_close()
1598 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_close()
1618 struct slgt_info *info = dev_to_port(dev); hdlcdev_ioctl() local
1624 if (info->port.count) hdlcdev_ioctl()
1641 flags = info->params.flags & (HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
1654 new_line.clock_rate = info->params.clock_speed; hdlcdev_ioctl()
1655 new_line.loopback = info->params.loopback ? 1:0; hdlcdev_ioctl()
1674 case CLOCK_DEFAULT: flags = info->params.flags & hdlcdev_ioctl()
1685 info->params.flags &= ~(HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
1689 info->params.flags |= flags; hdlcdev_ioctl()
1691 info->params.loopback = new_line.loopback; hdlcdev_ioctl()
1694 info->params.clock_speed = new_line.clock_rate; hdlcdev_ioctl()
1696 info->params.clock_speed = 0; hdlcdev_ioctl()
1699 if (info->netcount) hdlcdev_ioctl()
1700 program_hw(info); hdlcdev_ioctl()
1715 struct slgt_info *info = dev_to_port(dev); hdlcdev_tx_timeout() local
1723 spin_lock_irqsave(&info->lock,flags); hdlcdev_tx_timeout()
1724 tx_stop(info); hdlcdev_tx_timeout()
1725 spin_unlock_irqrestore(&info->lock,flags); hdlcdev_tx_timeout()
1734 * info pointer to device instance information
1736 static void hdlcdev_tx_done(struct slgt_info *info) hdlcdev_tx_done() argument
1738 if (netif_queue_stopped(info->netdev)) hdlcdev_tx_done()
1739 netif_wake_queue(info->netdev); hdlcdev_tx_done()
1746 * info pointer to device instance information
1750 static void hdlcdev_rx(struct slgt_info *info, char *buf, int size) hdlcdev_rx() argument
1753 struct net_device *dev = info->netdev; hdlcdev_rx()
1786 * info pointer to device instance information
1790 static int hdlcdev_init(struct slgt_info *info) hdlcdev_init() argument
1798 dev = alloc_hdlcdev(info); hdlcdev_init()
1800 printk(KERN_ERR "%s hdlc device alloc failure\n", info->device_name); hdlcdev_init()
1805 dev->mem_start = info->phys_reg_addr; hdlcdev_init()
1806 dev->mem_end = info->phys_reg_addr + SLGT_REG_SIZE - 1; hdlcdev_init()
1807 dev->irq = info->irq_level; hdlcdev_init()
1827 info->netdev = dev; hdlcdev_init()
1835 * info pointer to device instance information
1837 static void hdlcdev_exit(struct slgt_info *info) hdlcdev_exit() argument
1839 unregister_hdlc_device(info->netdev); hdlcdev_exit()
1840 free_netdev(info->netdev); hdlcdev_exit()
1841 info->netdev = NULL; hdlcdev_exit()
1849 static void rx_async(struct slgt_info *info) rx_async() argument
1851 struct mgsl_icount *icount = &info->icount; rx_async()
1855 struct slgt_desc *bufs = info->rbufs; rx_async()
1861 start = end = info->rbuf_current; rx_async()
1864 count = desc_count(bufs[end]) - info->rbuf_index; rx_async()
1865 p = bufs[end].buf + info->rbuf_index; rx_async()
1867 DBGISR(("%s rx_async count=%d\n", info->device_name, count)); rx_async()
1868 DBGDATA(info, p, count, "rx"); rx_async()
1883 if (status & info->ignore_status_mask) rx_async()
1890 tty_insert_flip_char(&info->port, ch, stat); rx_async()
1896 info->rbuf_index += i; rx_async()
1897 mod_timer(&info->rx_timer, jiffies + 1); rx_async()
1901 info->rbuf_index = 0; rx_async()
1902 free_rbufs(info, end, end); rx_async()
1904 if (++end == info->rbuf_count) rx_async()
1913 tty_flip_buffer_push(&info->port); rx_async()
1919 static int bh_action(struct slgt_info *info) bh_action() argument
1924 spin_lock_irqsave(&info->lock,flags); bh_action()
1926 if (info->pending_bh & BH_RECEIVE) { bh_action()
1927 info->pending_bh &= ~BH_RECEIVE; bh_action()
1929 } else if (info->pending_bh & BH_TRANSMIT) { bh_action()
1930 info->pending_bh &= ~BH_TRANSMIT; bh_action()
1932 } else if (info->pending_bh & BH_STATUS) { bh_action()
1933 info->pending_bh &= ~BH_STATUS; bh_action()
1937 info->bh_running = false; bh_action()
1938 info->bh_requested = false; bh_action()
1942 spin_unlock_irqrestore(&info->lock,flags); bh_action()
1952 struct slgt_info *info = container_of(work, struct slgt_info, task); bh_handler() local
1955 info->bh_running = true; bh_handler()
1957 while((action = bh_action(info))) { bh_handler()
1960 DBGBH(("%s bh receive\n", info->device_name)); bh_handler()
1961 switch(info->params.mode) { bh_handler()
1963 rx_async(info); bh_handler()
1966 while(rx_get_frame(info)); bh_handler()
1972 while(rx_get_buf(info)); bh_handler()
1976 if (info->rx_restart) bh_handler()
1977 rx_start(info); bh_handler()
1980 bh_transmit(info); bh_handler()
1983 DBGBH(("%s bh status\n", info->device_name)); bh_handler()
1984 info->ri_chkcount = 0; bh_handler()
1985 info->dsr_chkcount = 0; bh_handler()
1986 info->dcd_chkcount = 0; bh_handler()
1987 info->cts_chkcount = 0; bh_handler()
1990 DBGBH(("%s unknown action\n", info->device_name)); bh_handler()
1994 DBGBH(("%s bh_handler exit\n", info->device_name)); bh_handler()
1997 static void bh_transmit(struct slgt_info *info) bh_transmit() argument
1999 struct tty_struct *tty = info->port.tty; bh_transmit()
2001 DBGBH(("%s bh_transmit\n", info->device_name)); bh_transmit()
2006 static void dsr_change(struct slgt_info *info, unsigned short status) dsr_change() argument
2009 info->signals |= SerialSignal_DSR; dsr_change()
2010 info->input_signal_events.dsr_up++; dsr_change()
2012 info->signals &= ~SerialSignal_DSR; dsr_change()
2013 info->input_signal_events.dsr_down++; dsr_change()
2015 DBGISR(("dsr_change %s signals=%04X\n", info->device_name, info->signals)); dsr_change()
2016 if ((info->dsr_chkcount)++ == IO_PIN_SHUTDOWN_LIMIT) { dsr_change()
2017 slgt_irq_off(info, IRQ_DSR); dsr_change()
2020 info->icount.dsr++; dsr_change()
2021 wake_up_interruptible(&info->status_event_wait_q); dsr_change()
2022 wake_up_interruptible(&info->event_wait_q); dsr_change()
2023 info->pending_bh |= BH_STATUS; dsr_change()
2026 static void cts_change(struct slgt_info *info, unsigned short status) cts_change() argument
2029 info->signals |= SerialSignal_CTS; cts_change()
2030 info->input_signal_events.cts_up++; cts_change()
2032 info->signals &= ~SerialSignal_CTS; cts_change()
2033 info->input_signal_events.cts_down++; cts_change()
2035 DBGISR(("cts_change %s signals=%04X\n", info->device_name, info->signals)); cts_change()
2036 if ((info->cts_chkcount)++ == IO_PIN_SHUTDOWN_LIMIT) { cts_change()
2037 slgt_irq_off(info, IRQ_CTS); cts_change()
2040 info->icount.cts++; cts_change()
2041 wake_up_interruptible(&info->status_event_wait_q); cts_change()
2042 wake_up_interruptible(&info->event_wait_q); cts_change()
2043 info->pending_bh |= BH_STATUS; cts_change()
2045 if (tty_port_cts_enabled(&info->port)) { cts_change()
2046 if (info->port.tty) { cts_change()
2047 if (info->port.tty->hw_stopped) { cts_change()
2048 if (info->signals & SerialSignal_CTS) { cts_change()
2049 info->port.tty->hw_stopped = 0; cts_change()
2050 info->pending_bh |= BH_TRANSMIT; cts_change()
2054 if (!(info->signals & SerialSignal_CTS)) cts_change()
2055 info->port.tty->hw_stopped = 1; cts_change()
2061 static void dcd_change(struct slgt_info *info, unsigned short status) dcd_change() argument
2064 info->signals |= SerialSignal_DCD; dcd_change()
2065 info->input_signal_events.dcd_up++; dcd_change()
2067 info->signals &= ~SerialSignal_DCD; dcd_change()
2068 info->input_signal_events.dcd_down++; dcd_change()
2070 DBGISR(("dcd_change %s signals=%04X\n", info->device_name, info->signals)); dcd_change()
2071 if ((info->dcd_chkcount)++ == IO_PIN_SHUTDOWN_LIMIT) { dcd_change()
2072 slgt_irq_off(info, IRQ_DCD); dcd_change()
2075 info->icount.dcd++; dcd_change()
2077 if (info->netcount) { dcd_change()
2078 if (info->signals & SerialSignal_DCD) dcd_change()
2079 netif_carrier_on(info->netdev); dcd_change()
2081 netif_carrier_off(info->netdev); dcd_change()
2084 wake_up_interruptible(&info->status_event_wait_q); dcd_change()
2085 wake_up_interruptible(&info->event_wait_q); dcd_change()
2086 info->pending_bh |= BH_STATUS; dcd_change()
2088 if (info->port.flags & ASYNC_CHECK_CD) { dcd_change()
2089 if (info->signals & SerialSignal_DCD) dcd_change()
2090 wake_up_interruptible(&info->port.open_wait); dcd_change()
2092 if (info->port.tty) dcd_change()
2093 tty_hangup(info->port.tty); dcd_change()
2098 static void ri_change(struct slgt_info *info, unsigned short status) ri_change() argument
2101 info->signals |= SerialSignal_RI; ri_change()
2102 info->input_signal_events.ri_up++; ri_change()
2104 info->signals &= ~SerialSignal_RI; ri_change()
2105 info->input_signal_events.ri_down++; ri_change()
2107 DBGISR(("ri_change %s signals=%04X\n", info->device_name, info->signals)); ri_change()
2108 if ((info->ri_chkcount)++ == IO_PIN_SHUTDOWN_LIMIT) { ri_change()
2109 slgt_irq_off(info, IRQ_RI); ri_change()
2112 info->icount.rng++; ri_change()
2113 wake_up_interruptible(&info->status_event_wait_q); ri_change()
2114 wake_up_interruptible(&info->event_wait_q); ri_change()
2115 info->pending_bh |= BH_STATUS; ri_change()
2118 static void isr_rxdata(struct slgt_info *info) isr_rxdata() argument
2120 unsigned int count = info->rbuf_fill_count; isr_rxdata()
2121 unsigned int i = info->rbuf_fill_index; isr_rxdata()
2124 while (rd_reg16(info, SSR) & IRQ_RXDATA) { isr_rxdata()
2125 reg = rd_reg16(info, RDR); isr_rxdata()
2126 DBGISR(("isr_rxdata %s RDR=%04X\n", info->device_name, reg)); isr_rxdata()
2127 if (desc_complete(info->rbufs[i])) { isr_rxdata()
2129 rx_stop(info); isr_rxdata()
2130 info->rx_restart = 1; isr_rxdata()
2133 info->rbufs[i].buf[count++] = (unsigned char)reg; isr_rxdata()
2135 if (info->params.mode == MGSL_MODE_ASYNC) isr_rxdata()
2136 info->rbufs[i].buf[count++] = (unsigned char)(reg >> 8); isr_rxdata()
2137 if (count == info->rbuf_fill_level || (reg & BIT10)) { isr_rxdata()
2139 set_desc_count(info->rbufs[i], count); isr_rxdata()
2140 set_desc_status(info->rbufs[i], BIT15 | (reg >> 8)); isr_rxdata()
2141 info->rbuf_fill_count = count = 0; isr_rxdata()
2142 if (++i == info->rbuf_count) isr_rxdata()
2144 info->pending_bh |= BH_RECEIVE; isr_rxdata()
2148 info->rbuf_fill_index = i; isr_rxdata()
2149 info->rbuf_fill_count = count; isr_rxdata()
2152 static void isr_serial(struct slgt_info *info) isr_serial() argument
2154 unsigned short status = rd_reg16(info, SSR); isr_serial()
2156 DBGISR(("%s isr_serial status=%04X\n", info->device_name, status)); isr_serial()
2158 wr_reg16(info, SSR, status); /* clear pending */ isr_serial()
2160 info->irq_occurred = true; isr_serial()
2162 if (info->params.mode == MGSL_MODE_ASYNC) { isr_serial()
2164 if (info->tx_active) isr_serial()
2165 isr_txeom(info, status); isr_serial()
2167 if (info->rx_pio && (status & IRQ_RXDATA)) isr_serial()
2168 isr_rxdata(info); isr_serial()
2170 info->icount.brk++; isr_serial()
2172 if (info->port.tty) { isr_serial()
2173 if (!(status & info->ignore_status_mask)) { isr_serial()
2174 if (info->read_status_mask & MASK_BREAK) { isr_serial()
2175 tty_insert_flip_char(&info->port, 0, TTY_BREAK); isr_serial()
2176 if (info->port.flags & ASYNC_SAK) isr_serial()
2177 do_SAK(info->port.tty); isr_serial()
2184 isr_txeom(info, status); isr_serial()
2185 if (info->rx_pio && (status & IRQ_RXDATA)) isr_serial()
2186 isr_rxdata(info); isr_serial()
2189 info->icount.rxidle++; isr_serial()
2191 info->icount.exithunt++; isr_serial()
2192 wake_up_interruptible(&info->event_wait_q); isr_serial()
2196 rx_start(info); isr_serial()
2200 dsr_change(info, status); isr_serial()
2202 cts_change(info, status); isr_serial()
2204 dcd_change(info, status); isr_serial()
2206 ri_change(info, status); isr_serial()
2209 static void isr_rdma(struct slgt_info *info) isr_rdma() argument
2211 unsigned int status = rd_reg32(info, RDCSR); isr_rdma()
2213 DBGISR(("%s isr_rdma status=%08x\n", info->device_name, status)); isr_rdma()
2226 wr_reg32(info, RDCSR, status); /* clear pending */ isr_rdma()
2229 DBGISR(("%s isr_rdma rx_restart=1\n", info->device_name)); isr_rdma()
2230 info->rx_restart = true; isr_rdma()
2232 info->pending_bh |= BH_RECEIVE; isr_rdma()
2235 static void isr_tdma(struct slgt_info *info) isr_tdma() argument
2237 unsigned int status = rd_reg32(info, TDCSR); isr_tdma()
2239 DBGISR(("%s isr_tdma status=%08x\n", info->device_name, status)); isr_tdma()
2251 wr_reg32(info, TDCSR, status); /* clear pending */ isr_tdma()
2256 info->pending_bh |= BH_TRANSMIT; isr_tdma()
2263 * if there are unsent buffers then info->tbuf_start
2266 static bool unsent_tbufs(struct slgt_info *info) unsent_tbufs() argument
2268 unsigned int i = info->tbuf_current; unsent_tbufs()
2280 i = info->tbuf_count - 1; unsent_tbufs()
2281 if (!desc_count(info->tbufs[i])) unsent_tbufs()
2283 info->tbuf_start = i; unsent_tbufs()
2285 } while (i != info->tbuf_current); unsent_tbufs()
2290 static void isr_txeom(struct slgt_info *info, unsigned short status) isr_txeom() argument
2292 DBGISR(("%s txeom status=%04x\n", info->device_name, status)); isr_txeom()
2294 slgt_irq_off(info, IRQ_TXDATA + IRQ_TXIDLE + IRQ_TXUNDER); isr_txeom()
2295 tdma_reset(info); isr_txeom()
2297 unsigned short val = rd_reg16(info, TCR); isr_txeom()
2298 wr_reg16(info, TCR, (unsigned short)(val | BIT2)); /* set reset bit */ isr_txeom()
2299 wr_reg16(info, TCR, val); /* clear reset bit */ isr_txeom()
2302 if (info->tx_active) { isr_txeom()
2303 if (info->params.mode != MGSL_MODE_ASYNC) { isr_txeom()
2305 info->icount.txunder++; isr_txeom()
2307 info->icount.txok++; isr_txeom()
2310 if (unsent_tbufs(info)) { isr_txeom()
2311 tx_start(info); isr_txeom()
2312 update_tx_timer(info); isr_txeom()
2315 info->tx_active = false; isr_txeom()
2317 del_timer(&info->tx_timer); isr_txeom()
2319 if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) { isr_txeom()
2320 info->signals &= ~SerialSignal_RTS; isr_txeom()
2321 info->drop_rts_on_tx_done = false; isr_txeom()
2322 set_signals(info); isr_txeom()
2326 if (info->netcount) isr_txeom()
2327 hdlcdev_tx_done(info); isr_txeom()
2331 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { isr_txeom()
2332 tx_stop(info); isr_txeom()
2335 info->pending_bh |= BH_TRANSMIT; isr_txeom()
2340 static void isr_gpio(struct slgt_info *info, unsigned int changed, unsigned int state) isr_gpio() argument
2345 for (w = info->gpio_wait_q, prev = NULL ; w != NULL ; w = w->next) { isr_gpio()
2352 info->gpio_wait_q = w->next; isr_gpio()
2365 struct slgt_info *info = dev_id; slgt_interrupt() local
2369 DBGISR(("slgt_interrupt irq=%d entry\n", info->irq_level)); slgt_interrupt()
2371 while((gsr = rd_reg32(info, GSR) & 0xffffff00)) { slgt_interrupt()
2372 DBGISR(("%s gsr=%08x\n", info->device_name, gsr)); slgt_interrupt()
2373 info->irq_occurred = true; slgt_interrupt()
2374 for(i=0; i < info->port_count ; i++) { slgt_interrupt()
2375 if (info->port_array[i] == NULL) slgt_interrupt()
2377 spin_lock(&info->port_array[i]->lock); slgt_interrupt()
2379 isr_serial(info->port_array[i]); slgt_interrupt()
2381 isr_rdma(info->port_array[i]); slgt_interrupt()
2383 isr_tdma(info->port_array[i]); slgt_interrupt()
2384 spin_unlock(&info->port_array[i]->lock); slgt_interrupt()
2388 if (info->gpio_present) { slgt_interrupt()
2391 spin_lock(&info->lock); slgt_interrupt()
2392 while ((changed = rd_reg32(info, IOSR)) != 0) { slgt_interrupt()
2393 DBGISR(("%s iosr=%08x\n", info->device_name, changed)); slgt_interrupt()
2395 state = rd_reg32(info, IOVR); slgt_interrupt()
2397 wr_reg32(info, IOSR, changed); slgt_interrupt()
2398 for (i=0 ; i < info->port_count ; i++) { slgt_interrupt()
2399 if (info->port_array[i] != NULL) slgt_interrupt()
2400 isr_gpio(info->port_array[i], changed, state); slgt_interrupt()
2403 spin_unlock(&info->lock); slgt_interrupt()
2406 for(i=0; i < info->port_count ; i++) { slgt_interrupt()
2407 struct slgt_info *port = info->port_array[i]; slgt_interrupt()
2421 DBGISR(("slgt_interrupt irq=%d exit\n", info->irq_level)); slgt_interrupt()
2425 static int startup(struct slgt_info *info) startup() argument
2427 DBGINFO(("%s startup\n", info->device_name)); startup()
2429 if (info->port.flags & ASYNC_INITIALIZED) startup()
2432 if (!info->tx_buf) { startup()
2433 info->tx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); startup()
2434 if (!info->tx_buf) { startup()
2435 DBGERR(("%s can't allocate tx buffer\n", info->device_name)); startup()
2440 info->pending_bh = 0; startup()
2442 memset(&info->icount, 0, sizeof(info->icount)); startup()
2445 change_params(info); startup()
2447 if (info->port.tty) startup()
2448 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); startup()
2450 info->port.flags |= ASYNC_INITIALIZED; startup()
2458 static void shutdown(struct slgt_info *info) shutdown() argument
2462 if (!(info->port.flags & ASYNC_INITIALIZED)) shutdown()
2465 DBGINFO(("%s shutdown\n", info->device_name)); shutdown()
2469 wake_up_interruptible(&info->status_event_wait_q); shutdown()
2470 wake_up_interruptible(&info->event_wait_q); shutdown()
2472 del_timer_sync(&info->tx_timer); shutdown()
2473 del_timer_sync(&info->rx_timer); shutdown()
2475 kfree(info->tx_buf); shutdown()
2476 info->tx_buf = NULL; shutdown()
2478 spin_lock_irqsave(&info->lock,flags); shutdown()
2480 tx_stop(info); shutdown()
2481 rx_stop(info); shutdown()
2483 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); shutdown()
2485 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { shutdown()
2486 info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); shutdown()
2487 set_signals(info); shutdown()
2490 flush_cond_wait(&info->gpio_wait_q); shutdown()
2492 spin_unlock_irqrestore(&info->lock,flags); shutdown()
2494 if (info->port.tty) shutdown()
2495 set_bit(TTY_IO_ERROR, &info->port.tty->flags); shutdown()
2497 info->port.flags &= ~ASYNC_INITIALIZED; shutdown()
2500 static void program_hw(struct slgt_info *info) program_hw() argument
2504 spin_lock_irqsave(&info->lock,flags); program_hw()
2506 rx_stop(info); program_hw()
2507 tx_stop(info); program_hw()
2509 if (info->params.mode != MGSL_MODE_ASYNC || program_hw()
2510 info->netcount) program_hw()
2511 sync_mode(info); program_hw()
2513 async_mode(info); program_hw()
2515 set_signals(info); program_hw()
2517 info->dcd_chkcount = 0; program_hw()
2518 info->cts_chkcount = 0; program_hw()
2519 info->ri_chkcount = 0; program_hw()
2520 info->dsr_chkcount = 0; program_hw()
2522 slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI); program_hw()
2523 get_signals(info); program_hw()
2525 if (info->netcount || program_hw()
2526 (info->port.tty && info->port.tty->termios.c_cflag & CREAD)) program_hw()
2527 rx_start(info); program_hw()
2529 spin_unlock_irqrestore(&info->lock,flags); program_hw()
2535 static void change_params(struct slgt_info *info) change_params() argument
2540 if (!info->port.tty) change_params()
2542 DBGINFO(("%s change_params\n", info->device_name)); change_params()
2544 cflag = info->port.tty->termios.c_cflag; change_params()
2549 info->signals |= SerialSignal_RTS | SerialSignal_DTR; change_params()
2551 info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); change_params()
2556 case CS5: info->params.data_bits = 5; break; change_params()
2557 case CS6: info->params.data_bits = 6; break; change_params()
2558 case CS7: info->params.data_bits = 7; break; change_params()
2559 case CS8: info->params.data_bits = 8; break; change_params()
2560 default: info->params.data_bits = 7; break; change_params()
2563 info->params.stop_bits = (cflag & CSTOPB) ? 2 : 1; change_params()
2566 info->params.parity = (cflag & PARODD) ? ASYNC_PARITY_ODD : ASYNC_PARITY_EVEN; change_params()
2568 info->params.parity = ASYNC_PARITY_NONE; change_params()
2573 bits_per_char = info->params.data_bits + change_params()
2574 info->params.stop_bits + 1; change_params()
2576 info->params.data_rate = tty_get_baud_rate(info->port.tty); change_params()
2578 if (info->params.data_rate) { change_params()
2579 info->timeout = (32*HZ*bits_per_char) / change_params()
2580 info->params.data_rate; change_params()
2582 info->timeout += HZ/50; /* Add .02 seconds of slop */ change_params()
2585 info->port.flags |= ASYNC_CTS_FLOW; change_params()
2587 info->port.flags &= ~ASYNC_CTS_FLOW; change_params()
2590 info->port.flags &= ~ASYNC_CHECK_CD; change_params()
2592 info->port.flags |= ASYNC_CHECK_CD; change_params()
2596 info->read_status_mask = IRQ_RXOVER; change_params()
2597 if (I_INPCK(info->port.tty)) change_params()
2598 info->read_status_mask |= MASK_PARITY | MASK_FRAMING; change_params()
2599 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) change_params()
2600 info->read_status_mask |= MASK_BREAK; change_params()
2601 if (I_IGNPAR(info->port.tty)) change_params()
2602 info->ignore_status_mask |= MASK_PARITY | MASK_FRAMING; change_params()
2603 if (I_IGNBRK(info->port.tty)) { change_params()
2604 info->ignore_status_mask |= MASK_BREAK; change_params()
2608 if (I_IGNPAR(info->port.tty)) change_params()
2609 info->ignore_status_mask |= MASK_OVERRUN; change_params()
2612 program_hw(info); change_params()
2615 static int get_stats(struct slgt_info *info, struct mgsl_icount __user *user_icount) get_stats() argument
2617 DBGINFO(("%s get_stats\n", info->device_name)); get_stats()
2619 memset(&info->icount, 0, sizeof(info->icount)); get_stats()
2621 if (copy_to_user(user_icount, &info->icount, sizeof(struct mgsl_icount))) get_stats()
2627 static int get_params(struct slgt_info *info, MGSL_PARAMS __user *user_params) get_params() argument
2629 DBGINFO(("%s get_params\n", info->device_name)); get_params()
2630 if (copy_to_user(user_params, &info->params, sizeof(MGSL_PARAMS))) get_params()
2635 static int set_params(struct slgt_info *info, MGSL_PARAMS __user *new_params) set_params() argument
2640 DBGINFO(("%s set_params\n", info->device_name)); set_params()
2644 spin_lock_irqsave(&info->lock, flags); set_params()
2646 info->base_clock = tmp_params.clock_speed; set_params()
2648 memcpy(&info->params, &tmp_params, sizeof(MGSL_PARAMS)); set_params()
2649 spin_unlock_irqrestore(&info->lock, flags); set_params()
2651 program_hw(info); set_params()
2656 static int get_txidle(struct slgt_info *info, int __user *idle_mode) get_txidle() argument
2658 DBGINFO(("%s get_txidle=%d\n", info->device_name, info->idle_mode)); get_txidle()
2659 if (put_user(info->idle_mode, idle_mode)) get_txidle()
2664 static int set_txidle(struct slgt_info *info, int idle_mode) set_txidle() argument
2667 DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode)); set_txidle()
2668 spin_lock_irqsave(&info->lock,flags); set_txidle()
2669 info->idle_mode = idle_mode; set_txidle()
2670 if (info->params.mode != MGSL_MODE_ASYNC) set_txidle()
2671 tx_set_idle(info); set_txidle()
2672 spin_unlock_irqrestore(&info->lock,flags); set_txidle()
2676 static int tx_enable(struct slgt_info *info, int enable) tx_enable() argument
2679 DBGINFO(("%s tx_enable(%d)\n", info->device_name, enable)); tx_enable()
2680 spin_lock_irqsave(&info->lock,flags); tx_enable()
2682 if (!info->tx_enabled) tx_enable()
2683 tx_start(info); tx_enable()
2685 if (info->tx_enabled) tx_enable()
2686 tx_stop(info); tx_enable()
2688 spin_unlock_irqrestore(&info->lock,flags); tx_enable()
2695 static int tx_abort(struct slgt_info *info) tx_abort() argument
2698 DBGINFO(("%s tx_abort\n", info->device_name)); tx_abort()
2699 spin_lock_irqsave(&info->lock,flags); tx_abort()
2700 tdma_reset(info); tx_abort()
2701 spin_unlock_irqrestore(&info->lock,flags); tx_abort()
2705 static int rx_enable(struct slgt_info *info, int enable) rx_enable() argument
2709 DBGINFO(("%s rx_enable(%08x)\n", info->device_name, enable)); rx_enable()
2710 spin_lock_irqsave(&info->lock,flags); rx_enable()
2719 spin_unlock_irqrestore(&info->lock, flags); rx_enable()
2722 info->rbuf_fill_level = rbuf_fill_level; rx_enable()
2724 info->rx_pio = 1; /* PIO mode */ rx_enable()
2726 info->rx_pio = 0; /* DMA mode */ rx_enable()
2727 rx_stop(info); /* restart receiver to use new fill level */ rx_enable()
2738 if (!info->rx_enabled) rx_enable()
2739 rx_start(info); rx_enable()
2742 wr_reg16(info, RCR, rd_reg16(info, RCR) | BIT3); rx_enable()
2745 if (info->rx_enabled) rx_enable()
2746 rx_stop(info); rx_enable()
2748 spin_unlock_irqrestore(&info->lock,flags); rx_enable()
2755 static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr) wait_mgsl_event() argument
2769 DBGINFO(("%s wait_mgsl_event(%d)\n", info->device_name, mask)); wait_mgsl_event()
2771 spin_lock_irqsave(&info->lock,flags); wait_mgsl_event()
2774 get_signals(info); wait_mgsl_event()
2775 s = info->signals; wait_mgsl_event()
2783 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
2788 cprev = info->icount; wait_mgsl_event()
2789 oldsigs = info->input_signal_events; wait_mgsl_event()
2793 unsigned short val = rd_reg16(info, SCR); wait_mgsl_event()
2795 wr_reg16(info, SCR, (unsigned short)(val | IRQ_RXIDLE)); wait_mgsl_event()
2799 add_wait_queue(&info->event_wait_q, &wait); wait_mgsl_event()
2801 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
2811 spin_lock_irqsave(&info->lock,flags); wait_mgsl_event()
2812 cnow = info->icount; wait_mgsl_event()
2813 newsigs = info->input_signal_events; wait_mgsl_event()
2815 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
2850 remove_wait_queue(&info->event_wait_q, &wait); wait_mgsl_event()
2855 spin_lock_irqsave(&info->lock,flags); wait_mgsl_event()
2856 if (!waitqueue_active(&info->event_wait_q)) { wait_mgsl_event()
2858 wr_reg16(info, SCR, wait_mgsl_event()
2859 (unsigned short)(rd_reg16(info, SCR) & ~IRQ_RXIDLE)); wait_mgsl_event()
2861 spin_unlock_irqrestore(&info->lock,flags); wait_mgsl_event()
2869 static int get_interface(struct slgt_info *info, int __user *if_mode) get_interface() argument
2871 DBGINFO(("%s get_interface=%x\n", info->device_name, info->if_mode)); get_interface()
2872 if (put_user(info->if_mode, if_mode)) get_interface()
2877 static int set_interface(struct slgt_info *info, int if_mode) set_interface() argument
2882 DBGINFO(("%s set_interface=%x)\n", info->device_name, if_mode)); set_interface()
2883 spin_lock_irqsave(&info->lock,flags); set_interface()
2884 info->if_mode = if_mode; set_interface()
2886 msc_set_vcr(info); set_interface()
2889 val = rd_reg16(info, TCR); set_interface()
2890 if (info->if_mode & MGSL_INTERFACE_RTS_EN) set_interface()
2894 wr_reg16(info, TCR, val); set_interface()
2896 spin_unlock_irqrestore(&info->lock,flags); set_interface()
2900 static int get_xsync(struct slgt_info *info, int __user *xsync) get_xsync() argument
2902 DBGINFO(("%s get_xsync=%x\n", info->device_name, info->xsync)); get_xsync()
2903 if (put_user(info->xsync, xsync)) get_xsync()
2914 static int set_xsync(struct slgt_info *info, int xsync) set_xsync() argument
2918 DBGINFO(("%s set_xsync=%x)\n", info->device_name, xsync)); set_xsync()
2919 spin_lock_irqsave(&info->lock, flags); set_xsync()
2920 info->xsync = xsync; set_xsync()
2921 wr_reg32(info, XSR, xsync); set_xsync()
2922 spin_unlock_irqrestore(&info->lock, flags); set_xsync()
2926 static int get_xctrl(struct slgt_info *info, int __user *xctrl) get_xctrl() argument
2928 DBGINFO(("%s get_xctrl=%x\n", info->device_name, info->xctrl)); get_xctrl()
2929 if (put_user(info->xctrl, xctrl)) get_xctrl()
2951 static int set_xctrl(struct slgt_info *info, int xctrl) set_xctrl() argument
2955 DBGINFO(("%s set_xctrl=%x)\n", info->device_name, xctrl)); set_xctrl()
2956 spin_lock_irqsave(&info->lock, flags); set_xctrl()
2957 info->xctrl = xctrl; set_xctrl()
2958 wr_reg32(info, XCR, xctrl); set_xctrl()
2959 spin_unlock_irqrestore(&info->lock, flags); set_xctrl()
2972 static int set_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio) set_gpio() argument
2978 if (!info->gpio_present) set_gpio()
2983 info->device_name, gpio.state, gpio.smask, set_gpio()
2986 spin_lock_irqsave(&info->port_array[0]->lock, flags); set_gpio()
2988 data = rd_reg32(info, IODR); set_gpio()
2991 wr_reg32(info, IODR, data); set_gpio()
2994 data = rd_reg32(info, IOVR); set_gpio()
2997 wr_reg32(info, IOVR, data); set_gpio()
2999 spin_unlock_irqrestore(&info->port_array[0]->lock, flags); set_gpio()
3007 static int get_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio) get_gpio() argument
3010 if (!info->gpio_present) get_gpio()
3012 gpio.state = rd_reg32(info, IOVR); get_gpio()
3014 gpio.dir = rd_reg32(info, IODR); get_gpio()
3019 info->device_name, gpio.state, gpio.dir)); get_gpio()
3081 static int wait_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio) wait_gpio() argument
3089 if (!info->gpio_present) wait_gpio()
3094 info->device_name, gpio.state, gpio.smask)); wait_gpio()
3096 if ((gpio.smask &= ~rd_reg32(info, IODR)) == 0) wait_gpio()
3100 spin_lock_irqsave(&info->port_array[0]->lock, flags); wait_gpio()
3102 wr_reg32(info, IOER, rd_reg32(info, IOER) | gpio.smask); wait_gpio()
3104 state = rd_reg32(info, IOVR); wait_gpio()
3111 add_cond_wait(&info->gpio_wait_q, &wait); wait_gpio()
3112 spin_unlock_irqrestore(&info->port_array[0]->lock, flags); wait_gpio()
3118 spin_lock_irqsave(&info->port_array[0]->lock, flags); wait_gpio()
3119 remove_cond_wait(&info->gpio_wait_q, &wait); wait_gpio()
3123 if (info->gpio_wait_q == NULL) wait_gpio()
3124 wr_reg32(info, IOER, 0); wait_gpio()
3125 spin_unlock_irqrestore(&info->port_array[0]->lock, flags); wait_gpio()
3132 static int modem_input_wait(struct slgt_info *info,int arg) modem_input_wait() argument
3140 spin_lock_irqsave(&info->lock,flags); modem_input_wait()
3141 cprev = info->icount; modem_input_wait()
3142 add_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
3144 spin_unlock_irqrestore(&info->lock,flags); modem_input_wait()
3154 spin_lock_irqsave(&info->lock,flags); modem_input_wait()
3155 cnow = info->icount; modem_input_wait()
3157 spin_unlock_irqrestore(&info->lock,flags); modem_input_wait()
3177 remove_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
3187 struct slgt_info *info = tty->driver_data; tiocmget() local
3191 spin_lock_irqsave(&info->lock,flags); tiocmget()
3192 get_signals(info); tiocmget()
3193 spin_unlock_irqrestore(&info->lock,flags); tiocmget()
3195 result = ((info->signals & SerialSignal_RTS) ? TIOCM_RTS:0) + tiocmget()
3196 ((info->signals & SerialSignal_DTR) ? TIOCM_DTR:0) + tiocmget()
3197 ((info->signals & SerialSignal_DCD) ? TIOCM_CAR:0) + tiocmget()
3198 ((info->signals & SerialSignal_RI) ? TIOCM_RNG:0) + tiocmget()
3199 ((info->signals & SerialSignal_DSR) ? TIOCM_DSR:0) + tiocmget()
3200 ((info->signals & SerialSignal_CTS) ? TIOCM_CTS:0); tiocmget()
3202 DBGINFO(("%s tiocmget value=%08X\n", info->device_name, result)); tiocmget()
3216 struct slgt_info *info = tty->driver_data; tiocmset() local
3219 DBGINFO(("%s tiocmset(%x,%x)\n", info->device_name, set, clear)); tiocmset()
3222 info->signals |= SerialSignal_RTS; tiocmset()
3224 info->signals |= SerialSignal_DTR; tiocmset()
3226 info->signals &= ~SerialSignal_RTS; tiocmset()
3228 info->signals &= ~SerialSignal_DTR; tiocmset()
3230 spin_lock_irqsave(&info->lock,flags); tiocmset()
3231 set_signals(info); tiocmset()
3232 spin_unlock_irqrestore(&info->lock,flags); tiocmset()
3239 struct slgt_info *info = container_of(port, struct slgt_info, port); carrier_raised() local
3241 spin_lock_irqsave(&info->lock,flags); carrier_raised()
3242 get_signals(info); carrier_raised()
3243 spin_unlock_irqrestore(&info->lock,flags); carrier_raised()
3244 return (info->signals & SerialSignal_DCD) ? 1 : 0; carrier_raised()
3250 struct slgt_info *info = container_of(port, struct slgt_info, port); dtr_rts() local
3252 spin_lock_irqsave(&info->lock,flags); dtr_rts()
3254 info->signals |= SerialSignal_RTS | SerialSignal_DTR; dtr_rts()
3256 info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); dtr_rts()
3257 set_signals(info); dtr_rts()
3258 spin_unlock_irqrestore(&info->lock,flags); dtr_rts()
3266 struct slgt_info *info) block_til_ready()
3273 struct tty_port *port = &info->port; block_til_ready()
3296 spin_lock_irqsave(&info->lock, flags); block_til_ready()
3298 spin_unlock_irqrestore(&info->lock, flags); block_til_ready()
3348 static int alloc_tmp_rbuf(struct slgt_info *info) alloc_tmp_rbuf() argument
3350 info->tmp_rbuf = kmalloc(info->max_frame_size + 5, GFP_KERNEL); alloc_tmp_rbuf()
3351 if (info->tmp_rbuf == NULL) alloc_tmp_rbuf()
3354 info->flag_buf = kzalloc(info->max_frame_size + 5, GFP_KERNEL); alloc_tmp_rbuf()
3355 if (!info->flag_buf) { alloc_tmp_rbuf()
3356 kfree(info->tmp_rbuf); alloc_tmp_rbuf()
3357 info->tmp_rbuf = NULL; alloc_tmp_rbuf()
3363 static void free_tmp_rbuf(struct slgt_info *info) free_tmp_rbuf() argument
3365 kfree(info->tmp_rbuf); free_tmp_rbuf()
3366 info->tmp_rbuf = NULL; free_tmp_rbuf()
3367 kfree(info->flag_buf); free_tmp_rbuf()
3368 info->flag_buf = NULL; free_tmp_rbuf()
3374 static int alloc_desc(struct slgt_info *info) alloc_desc() argument
3380 info->bufs = pci_zalloc_consistent(info->pdev, DESC_LIST_SIZE, alloc_desc()
3381 &info->bufs_dma_addr); alloc_desc()
3382 if (info->bufs == NULL) alloc_desc()
3385 info->rbufs = (struct slgt_desc*)info->bufs; alloc_desc()
3386 info->tbufs = ((struct slgt_desc*)info->bufs) + info->rbuf_count; alloc_desc()
3388 pbufs = (unsigned int)info->bufs_dma_addr; alloc_desc()
3394 for (i=0; i < info->rbuf_count; i++) { alloc_desc()
3396 info->rbufs[i].pdesc = pbufs + (i * sizeof(struct slgt_desc)); alloc_desc()
3399 if (i == info->rbuf_count - 1) alloc_desc()
3400 info->rbufs[i].next = cpu_to_le32(pbufs); alloc_desc()
3402 info->rbufs[i].next = cpu_to_le32(pbufs + ((i+1) * sizeof(struct slgt_desc))); alloc_desc()
3403 set_desc_count(info->rbufs[i], DMABUFSIZE); alloc_desc()
3406 for (i=0; i < info->tbuf_count; i++) { alloc_desc()
3408 info->tbufs[i].pdesc = pbufs + ((info->rbuf_count + i) * sizeof(struct slgt_desc)); alloc_desc()
3411 if (i == info->tbuf_count - 1) alloc_desc()
3412 info->tbufs[i].next = cpu_to_le32(pbufs + info->rbuf_count * sizeof(struct slgt_desc)); alloc_desc()
3414 info->tbufs[i].next = cpu_to_le32(pbufs + ((info->rbuf_count + i + 1) * sizeof(struct slgt_desc))); alloc_desc()
3420 static void free_desc(struct slgt_info *info) free_desc() argument
3422 if (info->bufs != NULL) { free_desc()
3423 pci_free_consistent(info->pdev, DESC_LIST_SIZE, info->bufs, info->bufs_dma_addr); free_desc()
3424 info->bufs = NULL; free_desc()
3425 info->rbufs = NULL; free_desc()
3426 info->tbufs = NULL; free_desc()
3430 static int alloc_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count) alloc_bufs() argument
3434 if ((bufs[i].buf = pci_alloc_consistent(info->pdev, DMABUFSIZE, &bufs[i].buf_dma_addr)) == NULL) alloc_bufs()
3441 static void free_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count) free_bufs() argument
3447 pci_free_consistent(info->pdev, DMABUFSIZE, bufs[i].buf, bufs[i].buf_dma_addr); free_bufs()
3452 static int alloc_dma_bufs(struct slgt_info *info) alloc_dma_bufs() argument
3454 info->rbuf_count = 32; alloc_dma_bufs()
3455 info->tbuf_count = 32; alloc_dma_bufs()
3457 if (alloc_desc(info) < 0 || alloc_dma_bufs()
3458 alloc_bufs(info, info->rbufs, info->rbuf_count) < 0 || alloc_dma_bufs()
3459 alloc_bufs(info, info->tbufs, info->tbuf_count) < 0 || alloc_dma_bufs()
3460 alloc_tmp_rbuf(info) < 0) { alloc_dma_bufs()
3461 DBGERR(("%s DMA buffer alloc fail\n", info->device_name)); alloc_dma_bufs()
3464 reset_rbufs(info); alloc_dma_bufs()
3468 static void free_dma_bufs(struct slgt_info *info) free_dma_bufs() argument
3470 if (info->bufs) { free_dma_bufs()
3471 free_bufs(info, info->rbufs, info->rbuf_count); free_dma_bufs()
3472 free_bufs(info, info->tbufs, info->tbuf_count); free_dma_bufs()
3473 free_desc(info); free_dma_bufs()
3475 free_tmp_rbuf(info); free_dma_bufs()
3478 static int claim_resources(struct slgt_info *info) claim_resources() argument
3480 if (request_mem_region(info->phys_reg_addr, SLGT_REG_SIZE, "synclink_gt") == NULL) { claim_resources()
3482 info->device_name, info->phys_reg_addr)); claim_resources()
3483 info->init_error = DiagStatus_AddressConflict; claim_resources()
3487 info->reg_addr_requested = true; claim_resources()
3489 info->reg_addr = ioremap_nocache(info->phys_reg_addr, SLGT_REG_SIZE); claim_resources()
3490 if (!info->reg_addr) { claim_resources()
3492 info->device_name, info->phys_reg_addr)); claim_resources()
3493 info->init_error = DiagStatus_CantAssignPciResources; claim_resources()
3499 release_resources(info); claim_resources()
3503 static void release_resources(struct slgt_info *info) release_resources() argument
3505 if (info->irq_requested) { release_resources()
3506 free_irq(info->irq_level, info); release_resources()
3507 info->irq_requested = false; release_resources()
3510 if (info->reg_addr_requested) { release_resources()
3511 release_mem_region(info->phys_reg_addr, SLGT_REG_SIZE); release_resources()
3512 info->reg_addr_requested = false; release_resources()
3515 if (info->reg_addr) { release_resources()
3516 iounmap(info->reg_addr); release_resources()
3517 info->reg_addr = NULL; release_resources()
3524 static void add_device(struct slgt_info *info) add_device() argument
3528 info->next_device = NULL; add_device()
3529 info->line = slgt_device_count; add_device()
3530 sprintf(info->device_name, "%s%d", tty_dev_prefix, info->line); add_device()
3532 if (info->line < MAX_DEVICES) { add_device()
3533 if (maxframe[info->line]) add_device()
3534 info->max_frame_size = maxframe[info->line]; add_device()
3540 slgt_device_list = info; add_device()
3545 current_dev->next_device = info; add_device()
3548 if (info->max_frame_size < 4096) add_device()
3549 info->max_frame_size = 4096; add_device()
3550 else if (info->max_frame_size > 65535) add_device()
3551 info->max_frame_size = 65535; add_device()
3553 switch(info->pdev->device) { add_device()
3565 info->params.mode = MGSL_MODE_ASYNC; add_device()
3571 devstr, info->device_name, info->phys_reg_addr, add_device()
3572 info->irq_level, info->max_frame_size); add_device()
3575 hdlcdev_init(info); add_device()
3589 struct slgt_info *info; alloc_dev() local
3591 info = kzalloc(sizeof(struct slgt_info), GFP_KERNEL); alloc_dev()
3593 if (!info) { alloc_dev()
3597 tty_port_init(&info->port); alloc_dev()
3598 info->port.ops = &slgt_port_ops; alloc_dev()
3599 info->magic = MGSL_MAGIC; alloc_dev()
3600 INIT_WORK(&info->task, bh_handler); alloc_dev()
3601 info->max_frame_size = 4096; alloc_dev()
3602 info->base_clock = 14745600; alloc_dev()
3603 info->rbuf_fill_level = DMABUFSIZE; alloc_dev()
3604 info->port.close_delay = 5*HZ/10; alloc_dev()
3605 info->port.closing_wait = 30*HZ; alloc_dev()
3606 init_waitqueue_head(&info->status_event_wait_q); alloc_dev()
3607 init_waitqueue_head(&info->event_wait_q); alloc_dev()
3608 spin_lock_init(&info->netlock); alloc_dev()
3609 memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS)); alloc_dev()
3610 info->idle_mode = HDLC_TXIDLE_FLAGS; alloc_dev()
3611 info->adapter_num = adapter_num; alloc_dev()
3612 info->port_num = port_num; alloc_dev()
3614 setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info); alloc_dev()
3615 setup_timer(&info->rx_timer, rx_timeout, (unsigned long)info); alloc_dev()
3617 /* Copy configuration info to device instance data */ alloc_dev()
3618 info->pdev = pdev; alloc_dev()
3619 info->irq_level = pdev->irq; alloc_dev()
3620 info->phys_reg_addr = pci_resource_start(pdev,0); alloc_dev()
3622 info->bus_type = MGSL_BUS_TYPE_PCI; alloc_dev()
3623 info->irq_flags = IRQF_SHARED; alloc_dev()
3625 info->init_error = -1; /* assume error, set to 0 on successful init */ alloc_dev()
3628 return info; alloc_dev()
3693 struct slgt_info *info = port_array[i]; device_init() local
3694 tty_port_register_device(&info->port, serial_driver, info->line, device_init()
3695 &info->pdev->dev); device_init()
3744 struct slgt_info *info; slgt_cleanup() local
3750 for (info=slgt_device_list ; info != NULL ; info=info->next_device) slgt_cleanup()
3751 tty_unregister_device(serial_driver, info->line); slgt_cleanup()
3759 info = slgt_device_list; slgt_cleanup()
3760 while(info) { slgt_cleanup()
3761 reset_port(info); slgt_cleanup()
3762 info = info->next_device; slgt_cleanup()
3766 info = slgt_device_list; slgt_cleanup()
3767 while(info) { slgt_cleanup()
3769 hdlcdev_exit(info); slgt_cleanup()
3771 free_dma_bufs(info); slgt_cleanup()
3772 free_tmp_rbuf(info); slgt_cleanup()
3773 if (info->port_num == 0) slgt_cleanup()
3774 release_resources(info); slgt_cleanup()
3775 tmp = info; slgt_cleanup()
3776 info = info->next_device; slgt_cleanup()
3855 unsigned long reg_addr = ((unsigned long)info->reg_addr) + addr; \
3857 reg_addr += (info->port_num) * 32; \
3859 reg_addr += (info->port_num) * 16;
3861 static __u8 rd_reg8(struct slgt_info *info, unsigned int addr) rd_reg8() argument
3867 static void wr_reg8(struct slgt_info *info, unsigned int addr, __u8 value) wr_reg8() argument
3873 static __u16 rd_reg16(struct slgt_info *info, unsigned int addr) rd_reg16() argument
3879 static void wr_reg16(struct slgt_info *info, unsigned int addr, __u16 value) wr_reg16() argument
3885 static __u32 rd_reg32(struct slgt_info *info, unsigned int addr) rd_reg32() argument
3891 static void wr_reg32(struct slgt_info *info, unsigned int addr, __u32 value) wr_reg32() argument
3897 static void rdma_reset(struct slgt_info *info) rdma_reset() argument
3902 wr_reg32(info, RDCSR, BIT1); rdma_reset()
3906 if (!(rd_reg32(info, RDCSR) & BIT0)) rdma_reset()
3910 static void tdma_reset(struct slgt_info *info) tdma_reset() argument
3915 wr_reg32(info, TDCSR, BIT1); tdma_reset()
3919 if (!(rd_reg32(info, TDCSR) & BIT0)) tdma_reset()
3928 static void enable_loopback(struct slgt_info *info) enable_loopback() argument
3931 wr_reg16(info, SCR, (unsigned short)(rd_reg16(info, SCR) | BIT2)); enable_loopback()
3933 if (info->params.mode != MGSL_MODE_ASYNC) { enable_loopback()
3942 wr_reg8(info, CCR, 0x49); enable_loopback()
3945 if (info->params.clock_speed) enable_loopback()
3946 set_rate(info, info->params.clock_speed); enable_loopback()
3948 set_rate(info, 3686400); enable_loopback()
3955 static void set_rate(struct slgt_info *info, u32 rate) set_rate() argument
3958 unsigned int osc = info->base_clock; set_rate()
3970 wr_reg16(info, BDR, (unsigned short)div); set_rate()
3974 static void rx_stop(struct slgt_info *info) rx_stop() argument
3979 val = rd_reg16(info, RCR) & ~BIT1; /* clear enable bit */ rx_stop()
3980 wr_reg16(info, RCR, (unsigned short)(val | BIT2)); /* set reset bit */ rx_stop()
3981 wr_reg16(info, RCR, val); /* clear reset bit */ rx_stop()
3983 slgt_irq_off(info, IRQ_RXOVER + IRQ_RXDATA + IRQ_RXIDLE); rx_stop()
3986 wr_reg16(info, SSR, IRQ_RXIDLE + IRQ_RXOVER); rx_stop()
3988 rdma_reset(info); rx_stop()
3990 info->rx_enabled = false; rx_stop()
3991 info->rx_restart = false; rx_stop()
3994 static void rx_start(struct slgt_info *info) rx_start() argument
3998 slgt_irq_off(info, IRQ_RXOVER + IRQ_RXDATA); rx_start()
4001 wr_reg16(info, SSR, IRQ_RXOVER); rx_start()
4004 val = rd_reg16(info, RCR) & ~BIT1; /* clear enable bit */ rx_start()
4005 wr_reg16(info, RCR, (unsigned short)(val | BIT2)); /* set reset bit */ rx_start()
4006 wr_reg16(info, RCR, val); /* clear reset bit */ rx_start()
4008 rdma_reset(info); rx_start()
4009 reset_rbufs(info); rx_start()
4011 if (info->rx_pio) { rx_start()
4013 wr_reg16(info, SCR, (unsigned short)(rd_reg16(info, SCR) & ~BIT14)); rx_start()
4014 slgt_irq_on(info, IRQ_RXDATA); rx_start()
4015 if (info->params.mode == MGSL_MODE_ASYNC) { rx_start()
4017 wr_reg32(info, RDCSR, BIT6); rx_start()
4021 wr_reg16(info, SCR, (unsigned short)(rd_reg16(info, SCR) | BIT14)); rx_start()
4023 wr_reg32(info, RDDAR, info->rbufs[0].pdesc); rx_start()
4025 if (info->params.mode != MGSL_MODE_ASYNC) { rx_start()
4027 wr_reg32(info, RDCSR, (BIT2 + BIT0)); rx_start()
4030 wr_reg32(info, RDCSR, (BIT6 + BIT2 + BIT0)); rx_start()
4034 slgt_irq_on(info, IRQ_RXOVER); rx_start()
4037 wr_reg16(info, RCR, (unsigned short)(rd_reg16(info, RCR) | BIT1)); rx_start()
4039 info->rx_restart = false; rx_start()
4040 info->rx_enabled = true; rx_start()
4043 static void tx_start(struct slgt_info *info) tx_start() argument
4045 if (!info->tx_enabled) { tx_start()
4046 wr_reg16(info, TCR, tx_start()
4047 (unsigned short)((rd_reg16(info, TCR) | BIT1) & ~BIT2)); tx_start()
4048 info->tx_enabled = true; tx_start()
4051 if (desc_count(info->tbufs[info->tbuf_start])) { tx_start()
4052 info->drop_rts_on_tx_done = false; tx_start()
4054 if (info->params.mode != MGSL_MODE_ASYNC) { tx_start()
4055 if (info->params.flags & HDLC_FLAG_AUTO_RTS) { tx_start()
4056 get_signals(info); tx_start()
4057 if (!(info->signals & SerialSignal_RTS)) { tx_start()
4058 info->signals |= SerialSignal_RTS; tx_start()
4059 set_signals(info); tx_start()
4060 info->drop_rts_on_tx_done = true; tx_start()
4064 slgt_irq_off(info, IRQ_TXDATA); tx_start()
4065 slgt_irq_on(info, IRQ_TXUNDER + IRQ_TXIDLE); tx_start()
4067 wr_reg16(info, SSR, (unsigned short)(IRQ_TXIDLE + IRQ_TXUNDER)); tx_start()
4069 slgt_irq_off(info, IRQ_TXDATA); tx_start()
4070 slgt_irq_on(info, IRQ_TXIDLE); tx_start()
4072 wr_reg16(info, SSR, IRQ_TXIDLE); tx_start()
4075 wr_reg32(info, TDDAR, info->tbufs[info->tbuf_start].pdesc); tx_start()
4076 wr_reg32(info, TDCSR, BIT2 + BIT0); tx_start()
4077 info->tx_active = true; tx_start()
4081 static void tx_stop(struct slgt_info *info) tx_stop() argument
4085 del_timer(&info->tx_timer); tx_stop()
4087 tdma_reset(info); tx_stop()
4090 val = rd_reg16(info, TCR) & ~BIT1; /* clear enable bit */ tx_stop()
4091 wr_reg16(info, TCR, (unsigned short)(val | BIT2)); /* set reset bit */ tx_stop()
4093 slgt_irq_off(info, IRQ_TXDATA + IRQ_TXIDLE + IRQ_TXUNDER); tx_stop()
4096 wr_reg16(info, SSR, (unsigned short)(IRQ_TXIDLE + IRQ_TXUNDER)); tx_stop()
4098 reset_tbufs(info); tx_stop()
4100 info->tx_enabled = false; tx_stop()
4101 info->tx_active = false; tx_stop()
4104 static void reset_port(struct slgt_info *info) reset_port() argument
4106 if (!info->reg_addr) reset_port()
4109 tx_stop(info); reset_port()
4110 rx_stop(info); reset_port()
4112 info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); reset_port()
4113 set_signals(info); reset_port()
4115 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); reset_port()
4118 static void reset_adapter(struct slgt_info *info) reset_adapter() argument
4121 for (i=0; i < info->port_count; ++i) { reset_adapter()
4122 if (info->port_array[i]) reset_adapter()
4123 reset_port(info->port_array[i]); reset_adapter()
4127 static void async_mode(struct slgt_info *info) async_mode() argument
4131 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); async_mode()
4132 tx_stop(info); async_mode()
4133 rx_stop(info); async_mode()
4155 if (info->if_mode & MGSL_INTERFACE_RTS_EN) async_mode()
4158 if (info->params.parity != ASYNC_PARITY_NONE) { async_mode()
4160 if (info->params.parity == ASYNC_PARITY_ODD) async_mode()
4164 switch (info->params.data_bits) async_mode()
4171 if (info->params.stop_bits != 1) async_mode()
4174 if (info->params.flags & HDLC_FLAG_AUTO_CTS) async_mode()
4177 wr_reg16(info, TCR, val); async_mode()
4198 if (info->params.parity != ASYNC_PARITY_NONE) { async_mode()
4200 if (info->params.parity == ASYNC_PARITY_ODD) async_mode()
4204 switch (info->params.data_bits) async_mode()
4211 if (info->params.flags & HDLC_FLAG_AUTO_DCD) async_mode()
4214 wr_reg16(info, RCR, val); async_mode()
4225 wr_reg8(info, CCR, 0x69); async_mode()
4227 msc_set_vcr(info); async_mode()
4250 if ((rd_reg32(info, JCR) & BIT8) && info->params.data_rate && async_mode()
4251 ((info->base_clock < (info->params.data_rate * 16)) || async_mode()
4252 (info->base_clock % (info->params.data_rate * 16)))) { async_mode()
4255 set_rate(info, info->params.data_rate * 8); async_mode()
4258 set_rate(info, info->params.data_rate * 16); async_mode()
4260 wr_reg16(info, SCR, val); async_mode()
4262 slgt_irq_on(info, IRQ_RXBREAK | IRQ_RXOVER); async_mode()
4264 if (info->params.loopback) async_mode()
4265 enable_loopback(info); async_mode()
4268 static void sync_mode(struct slgt_info *info) sync_mode() argument
4272 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); sync_mode()
4273 tx_stop(info); sync_mode()
4274 rx_stop(info); sync_mode()
4298 switch(info->params.mode) { sync_mode()
4306 if (info->if_mode & MGSL_INTERFACE_RTS_EN) sync_mode()
4309 switch(info->params.encoding) sync_mode()
4320 switch (info->params.crc_type & HDLC_CRC_MASK) sync_mode()
4326 if (info->params.preamble != HDLC_PREAMBLE_PATTERN_NONE) sync_mode()
4329 switch (info->params.preamble_length) sync_mode()
4336 if (info->params.flags & HDLC_FLAG_AUTO_CTS) sync_mode()
4339 wr_reg16(info, TCR, val); sync_mode()
4343 switch (info->params.preamble) sync_mode()
4352 wr_reg8(info, TPR, (unsigned char)val); sync_mode()
4373 switch(info->params.mode) { sync_mode()
4382 switch(info->params.encoding) sync_mode()
4393 switch (info->params.crc_type & HDLC_CRC_MASK) sync_mode()
4399 if (info->params.flags & HDLC_FLAG_AUTO_DCD) sync_mode()
4402 wr_reg16(info, RCR, val); sync_mode()
4413 if (info->params.flags & HDLC_FLAG_TXC_BRG) sync_mode()
4418 if (info->params.flags & HDLC_FLAG_RXC_DPLL) sync_mode()
4423 else if (info->params.flags & HDLC_FLAG_TXC_DPLL) sync_mode()
4425 else if (info->params.flags & HDLC_FLAG_TXC_RXCPIN) sync_mode()
4428 if (info->params.flags & HDLC_FLAG_RXC_BRG) sync_mode()
4430 else if (info->params.flags & HDLC_FLAG_RXC_DPLL) sync_mode()
4432 else if (info->params.flags & HDLC_FLAG_RXC_TXCPIN) sync_mode()
4435 if (info->params.clock_speed) sync_mode()
4438 wr_reg8(info, CCR, (unsigned char)val); sync_mode()
4440 if (info->params.flags & (HDLC_FLAG_TXC_DPLL + HDLC_FLAG_RXC_DPLL)) sync_mode()
4443 switch(info->params.encoding) sync_mode()
4453 wr_reg16(info, RCR, (unsigned short)(rd_reg16(info, RCR) | val)); sync_mode()
4456 set_rate(info, info->params.clock_speed * 16); sync_mode()
4459 set_rate(info, info->params.clock_speed); sync_mode()
4461 tx_set_idle(info); sync_mode()
4463 msc_set_vcr(info); sync_mode()
4484 wr_reg16(info, SCR, BIT15 + BIT14 + BIT0); sync_mode()
4486 if (info->params.loopback) sync_mode()
4487 enable_loopback(info); sync_mode()
4493 static void tx_set_idle(struct slgt_info *info) tx_set_idle() argument
4501 tcr = rd_reg16(info, TCR); tx_set_idle()
4502 if (info->idle_mode & HDLC_TXIDLE_CUSTOM_16) { tx_set_idle()
4506 wr_reg8(info, TPR, (unsigned char)((info->idle_mode >> 8) & 0xff)); tx_set_idle()
4511 wr_reg16(info, TCR, tcr); tx_set_idle()
4513 if (info->idle_mode & (HDLC_TXIDLE_CUSTOM_8 | HDLC_TXIDLE_CUSTOM_16)) { tx_set_idle()
4515 val = (unsigned char)(info->idle_mode & 0xff); tx_set_idle()
4518 switch(info->idle_mode) tx_set_idle()
4529 wr_reg8(info, TIR, val); tx_set_idle()
4535 static void get_signals(struct slgt_info *info) get_signals() argument
4537 unsigned short status = rd_reg16(info, SSR); get_signals()
4540 info->signals &= SerialSignal_RTS | SerialSignal_DTR; get_signals()
4543 info->signals |= SerialSignal_DSR; get_signals()
4545 info->signals |= SerialSignal_CTS; get_signals()
4547 info->signals |= SerialSignal_DCD; get_signals()
4549 info->signals |= SerialSignal_RI; get_signals()
4555 static void msc_set_vcr(struct slgt_info *info) msc_set_vcr() argument
4568 switch(info->if_mode & MGSL_INTERFACE_MASK) msc_set_vcr()
4581 if (info->if_mode & MGSL_INTERFACE_MSB_FIRST) msc_set_vcr()
4583 if (info->signals & SerialSignal_DTR) msc_set_vcr()
4585 if (info->signals & SerialSignal_RTS) msc_set_vcr()
4587 if (info->if_mode & MGSL_INTERFACE_LL) msc_set_vcr()
4589 if (info->if_mode & MGSL_INTERFACE_RL) msc_set_vcr()
4591 wr_reg8(info, VCR, val); msc_set_vcr()
4597 static void set_signals(struct slgt_info *info) set_signals() argument
4599 unsigned char val = rd_reg8(info, VCR); set_signals()
4600 if (info->signals & SerialSignal_DTR) set_signals()
4604 if (info->signals & SerialSignal_RTS) set_signals()
4608 wr_reg8(info, VCR, val); set_signals()
4614 static void free_rbufs(struct slgt_info *info, unsigned int i, unsigned int last) free_rbufs() argument
4620 info->rbufs[i].status = 0; free_rbufs()
4621 set_desc_count(info->rbufs[i], info->rbuf_fill_level); free_rbufs()
4624 if (++i == info->rbuf_count) free_rbufs()
4627 info->rbuf_current = i; free_rbufs()
4633 static void reset_rbufs(struct slgt_info *info) reset_rbufs() argument
4635 free_rbufs(info, 0, info->rbuf_count - 1); reset_rbufs()
4636 info->rbuf_fill_index = 0; reset_rbufs()
4637 info->rbuf_fill_count = 0; reset_rbufs()
4645 static bool rx_get_frame(struct slgt_info *info) rx_get_frame() argument
4651 struct tty_struct *tty = info->port.tty; rx_get_frame()
4655 switch (info->params.crc_type & HDLC_CRC_MASK) { rx_get_frame()
4664 start = end = info->rbuf_current; rx_get_frame()
4667 if (!desc_complete(info->rbufs[end])) rx_get_frame()
4670 if (framesize == 0 && info->params.addr_filter != 0xff) rx_get_frame()
4671 addr_field = info->rbufs[end].buf[0]; rx_get_frame()
4673 framesize += desc_count(info->rbufs[end]); rx_get_frame()
4675 if (desc_eof(info->rbufs[end])) rx_get_frame()
4678 if (++end == info->rbuf_count) rx_get_frame()
4681 if (end == info->rbuf_current) { rx_get_frame()
4682 if (info->rx_enabled){ rx_get_frame()
4683 spin_lock_irqsave(&info->lock,flags); rx_get_frame()
4684 rx_start(info); rx_get_frame()
4685 spin_unlock_irqrestore(&info->lock,flags); rx_get_frame()
4700 status = desc_status(info->rbufs[end]); rx_get_frame()
4703 if ((info->params.crc_type & HDLC_CRC_MASK) == HDLC_CRC_NONE) rx_get_frame()
4707 (addr_field != 0xff && addr_field != info->params.addr_filter)) { rx_get_frame()
4708 free_rbufs(info, start, end); rx_get_frame()
4713 info->icount.rxshort++; rx_get_frame()
4716 info->icount.rxcrc++; rx_get_frame()
4717 if (!(info->params.crc_type & HDLC_CRC_RETURN_EX)) rx_get_frame()
4723 info->netdev->stats.rx_errors++; rx_get_frame()
4724 info->netdev->stats.rx_frame_errors++; rx_get_frame()
4729 info->device_name, status, framesize)); rx_get_frame()
4730 DBGDATA(info, info->rbufs[start].buf, min_t(int, framesize, info->rbuf_fill_level), "rx"); rx_get_frame()
4733 if (!(info->params.crc_type & HDLC_CRC_RETURN_EX)) { rx_get_frame()
4738 if (framesize > info->max_frame_size + crc_size) rx_get_frame()
4739 info->icount.rxlong++; rx_get_frame()
4744 unsigned char *p = info->tmp_rbuf; rx_get_frame()
4745 info->tmp_rbuf_count = framesize; rx_get_frame()
4747 info->icount.rxok++; rx_get_frame()
4750 int partial_count = min_t(int, copy_count, info->rbuf_fill_level); rx_get_frame()
4751 memcpy(p, info->rbufs[i].buf, partial_count); rx_get_frame()
4754 if (++i == info->rbuf_count) rx_get_frame()
4758 if (info->params.crc_type & HDLC_CRC_RETURN_EX) { rx_get_frame()
4764 if (info->netcount) rx_get_frame()
4765 hdlcdev_rx(info,info->tmp_rbuf, framesize); rx_get_frame()
4768 ldisc_receive_buf(tty, info->tmp_rbuf, info->flag_buf, framesize); rx_get_frame()
4771 free_rbufs(info, start, end); rx_get_frame()
4782 static bool rx_get_buf(struct slgt_info *info) rx_get_buf() argument
4784 unsigned int i = info->rbuf_current; rx_get_buf()
4787 if (!desc_complete(info->rbufs[i])) rx_get_buf()
4789 count = desc_count(info->rbufs[i]); rx_get_buf()
4790 switch(info->params.mode) { rx_get_buf()
4795 if (desc_residue(info->rbufs[i])) rx_get_buf()
4799 DBGDATA(info, info->rbufs[i].buf, count, "rx"); rx_get_buf()
4802 ldisc_receive_buf(info->port.tty, info->rbufs[i].buf, rx_get_buf()
4803 info->flag_buf, count); rx_get_buf()
4804 free_rbufs(info, i, i); rx_get_buf()
4808 static void reset_tbufs(struct slgt_info *info) reset_tbufs() argument
4811 info->tbuf_current = 0; reset_tbufs()
4812 for (i=0 ; i < info->tbuf_count ; i++) { reset_tbufs()
4813 info->tbufs[i].status = 0; reset_tbufs()
4814 info->tbufs[i].count = 0; reset_tbufs()
4821 static unsigned int free_tbuf_count(struct slgt_info *info) free_tbuf_count() argument
4824 unsigned int i = info->tbuf_current; free_tbuf_count()
4828 if (desc_count(info->tbufs[i])) free_tbuf_count()
4831 if (++i == info->tbuf_count) free_tbuf_count()
4833 } while (i != info->tbuf_current); free_tbuf_count()
4836 if (count && (rd_reg32(info, TDCSR) & BIT0)) free_tbuf_count()
4846 static unsigned int tbuf_bytes(struct slgt_info *info) tbuf_bytes() argument
4849 unsigned int i = info->tbuf_current; tbuf_bytes()
4866 count = desc_count(info->tbufs[i]); tbuf_bytes()
4870 active_buf_count = info->tbufs[i].buf_count; tbuf_bytes()
4871 if (++i == info->tbuf_count) tbuf_bytes()
4873 } while (i != info->tbuf_current); tbuf_bytes()
4876 reg_value = rd_reg32(info, TDCSR); tbuf_bytes()
4886 if (info->tx_active) tbuf_bytes()
4896 static bool tx_load(struct slgt_info *info, const char *buf, unsigned int size) tx_load() argument
4903 if (DIV_ROUND_UP(size, DMABUFSIZE) > free_tbuf_count(info)) tx_load()
4906 DBGDATA(info, buf, size, "tx"); tx_load()
4919 info->tbuf_start = i = info->tbuf_current; tx_load()
4922 d = &info->tbufs[i]; tx_load()
4934 if ((!size && info->params.mode == MGSL_MODE_HDLC) || tx_load()
4935 info->params.mode == MGSL_MODE_RAW) tx_load()
4941 if (i != info->tbuf_start) tx_load()
4945 if (++i == info->tbuf_count) tx_load()
4949 info->tbuf_current = i; tx_load()
4952 d = &info->tbufs[info->tbuf_start]; tx_load()
4956 if (!info->tx_active) tx_load()
4957 tx_start(info); tx_load()
4958 update_tx_timer(info); tx_load()
4963 static int register_test(struct slgt_info *info) register_test() argument
4972 wr_reg16(info, TIR, patterns[i]); register_test()
4973 wr_reg16(info, BDR, patterns[(i+1)%count]); register_test()
4974 if ((rd_reg16(info, TIR) != patterns[i]) || register_test()
4975 (rd_reg16(info, BDR) != patterns[(i+1)%count])) { register_test()
4980 info->gpio_present = (rd_reg32(info, JCR) & BIT5) ? 1 : 0; register_test()
4981 info->init_error = rc ? 0 : DiagStatus_AddressFailure; register_test()
4985 static int irq_test(struct slgt_info *info) irq_test() argument
4989 struct tty_struct *oldtty = info->port.tty; irq_test()
4990 u32 speed = info->params.data_rate; irq_test()
4992 info->params.data_rate = 921600; irq_test()
4993 info->port.tty = NULL; irq_test()
4995 spin_lock_irqsave(&info->lock, flags); irq_test()
4996 async_mode(info); irq_test()
4997 slgt_irq_on(info, IRQ_TXIDLE); irq_test()
5000 wr_reg16(info, TCR, irq_test()
5001 (unsigned short)(rd_reg16(info, TCR) | BIT1)); irq_test()
5004 wr_reg16(info, TDR, 0); irq_test()
5007 info->init_error = DiagStatus_IrqFailure; irq_test()
5008 info->irq_occurred = false; irq_test()
5010 spin_unlock_irqrestore(&info->lock, flags); irq_test()
5013 while(timeout-- && !info->irq_occurred) irq_test()
5016 spin_lock_irqsave(&info->lock,flags); irq_test()
5017 reset_port(info); irq_test()
5018 spin_unlock_irqrestore(&info->lock,flags); irq_test()
5020 info->params.data_rate = speed; irq_test()
5021 info->port.tty = oldtty; irq_test()
5023 info->init_error = info->irq_occurred ? 0 : DiagStatus_IrqFailure; irq_test()
5024 return info->irq_occurred ? 0 : -ENODEV; irq_test()
5027 static int loopback_test_rx(struct slgt_info *info) loopback_test_rx() argument
5032 if (desc_complete(info->rbufs[0])) { loopback_test_rx()
5033 count = desc_count(info->rbufs[0]); loopback_test_rx()
5034 src = info->rbufs[0].buf; loopback_test_rx()
5035 dest = info->tmp_rbuf; loopback_test_rx()
5042 info->tmp_rbuf_count++; loopback_test_rx()
5045 DBGDATA(info, info->tmp_rbuf, info->tmp_rbuf_count, "rx"); loopback_test_rx()
5051 static int loopback_test(struct slgt_info *info) loopback_test() argument
5061 struct tty_struct *oldtty = info->port.tty; loopback_test()
5064 memcpy(&params, &info->params, sizeof(params)); loopback_test()
5066 info->params.mode = MGSL_MODE_ASYNC; loopback_test()
5067 info->params.data_rate = 921600; loopback_test()
5068 info->params.loopback = 1; loopback_test()
5069 info->port.tty = NULL; loopback_test()
5075 info->tmp_rbuf_count = 0; loopback_test()
5076 memset(info->tmp_rbuf, 0, TESTFRAMESIZE); loopback_test()
5079 spin_lock_irqsave(&info->lock,flags); loopback_test()
5080 async_mode(info); loopback_test()
5081 rx_start(info); loopback_test()
5082 tx_load(info, buf, count); loopback_test()
5083 spin_unlock_irqrestore(&info->lock, flags); loopback_test()
5088 if (loopback_test_rx(info)) { loopback_test()
5095 if (!rc && (info->tmp_rbuf_count != count || loopback_test()
5096 memcmp(buf, info->tmp_rbuf, count))) { loopback_test()
5100 spin_lock_irqsave(&info->lock,flags); loopback_test()
5101 reset_adapter(info); loopback_test()
5102 spin_unlock_irqrestore(&info->lock,flags); loopback_test()
5104 memcpy(&info->params, &params, sizeof(info->params)); loopback_test()
5105 info->port.tty = oldtty; loopback_test()
5107 info->init_error = rc ? DiagStatus_DmaFailure : 0; loopback_test()
5111 static int adapter_test(struct slgt_info *info) adapter_test() argument
5113 DBGINFO(("testing %s\n", info->device_name)); adapter_test()
5114 if (register_test(info) < 0) { adapter_test()
5116 info->device_name, info->phys_reg_addr); adapter_test()
5117 } else if (irq_test(info) < 0) { adapter_test()
5119 info->device_name, info->irq_level); adapter_test()
5120 } else if (loopback_test(info) < 0) { adapter_test()
5121 printk("loopback test failure %s\n", info->device_name); adapter_test()
5123 return info->init_error; adapter_test()
5131 struct slgt_info *info = (struct slgt_info*)context; tx_timeout() local
5134 DBGINFO(("%s tx_timeout\n", info->device_name)); tx_timeout()
5135 if(info->tx_active && info->params.mode == MGSL_MODE_HDLC) { tx_timeout()
5136 info->icount.txtimeout++; tx_timeout()
5138 spin_lock_irqsave(&info->lock,flags); tx_timeout()
5139 tx_stop(info); tx_timeout()
5140 spin_unlock_irqrestore(&info->lock,flags); tx_timeout()
5143 if (info->netcount) tx_timeout()
5144 hdlcdev_tx_done(info); tx_timeout()
5147 bh_transmit(info); tx_timeout()
5155 struct slgt_info *info = (struct slgt_info*)context; rx_timeout() local
5158 DBGINFO(("%s rx_timeout\n", info->device_name)); rx_timeout()
5159 spin_lock_irqsave(&info->lock, flags); rx_timeout()
5160 info->pending_bh |= BH_RECEIVE; rx_timeout()
5161 spin_unlock_irqrestore(&info->lock, flags); rx_timeout()
5162 bh_handler(&info->task); rx_timeout()
3265 block_til_ready(struct tty_struct *tty, struct file *filp, struct slgt_info *info) block_til_ready() argument
H A Dsynclink.c601 void usc_DisableMasterIrqBit( struct mgsl_struct *info );
602 void usc_EnableMasterIrqBit( struct mgsl_struct *info );
603 void usc_EnableInterrupts( struct mgsl_struct *info, u16 IrqMask );
604 void usc_DisableInterrupts( struct mgsl_struct *info, u16 IrqMask );
605 void usc_ClearIrqPendingBits( struct mgsl_struct *info, u16 IrqMask );
665 static u16 usc_InDmaReg( struct mgsl_struct *info, u16 Port );
666 static void usc_OutDmaReg( struct mgsl_struct *info, u16 Port, u16 Value );
667 static void usc_DmaCmd( struct mgsl_struct *info, u16 Cmd );
669 static u16 usc_InReg( struct mgsl_struct *info, u16 Port );
670 static void usc_OutReg( struct mgsl_struct *info, u16 Port, u16 Value );
671 static void usc_RTCmd( struct mgsl_struct *info, u16 Cmd );
672 void usc_RCmd( struct mgsl_struct *info, u16 Cmd );
673 void usc_TCmd( struct mgsl_struct *info, u16 Cmd );
680 static void usc_process_rxoverrun_sync( struct mgsl_struct *info );
681 static void usc_start_receiver( struct mgsl_struct *info );
682 static void usc_stop_receiver( struct mgsl_struct *info );
684 static void usc_start_transmitter( struct mgsl_struct *info );
685 static void usc_stop_transmitter( struct mgsl_struct *info );
686 static void usc_set_txidle( struct mgsl_struct *info );
687 static void usc_load_txfifo( struct mgsl_struct *info );
689 static void usc_enable_aux_clock( struct mgsl_struct *info, u32 DataRate );
690 static void usc_enable_loopback( struct mgsl_struct *info, int enable );
692 static void usc_get_serial_signals( struct mgsl_struct *info );
693 static void usc_set_serial_signals( struct mgsl_struct *info );
695 static void usc_reset( struct mgsl_struct *info );
697 static void usc_set_sync_mode( struct mgsl_struct *info );
698 static void usc_set_sdlc_mode( struct mgsl_struct *info );
699 static void usc_set_async_mode( struct mgsl_struct *info );
700 static void usc_enable_async_clock( struct mgsl_struct *info, u32 DataRate );
702 static void usc_loopback_frame( struct mgsl_struct *info );
707 static void usc_loopmode_cancel_transmit( struct mgsl_struct * info );
708 static void usc_loopmode_insert_request( struct mgsl_struct * info );
709 static int usc_loopmode_active( struct mgsl_struct * info);
710 static void usc_loopmode_send_done( struct mgsl_struct * info );
712 static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg);
716 static void hdlcdev_tx_done(struct mgsl_struct *info);
717 static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size);
718 static int hdlcdev_init(struct mgsl_struct *info);
719 static void hdlcdev_exit(struct mgsl_struct *info);
738 static void mgsl_trace_block(struct mgsl_struct *info,const char* data, int count, int xmit);
743 static bool mgsl_register_test( struct mgsl_struct *info );
744 static bool mgsl_irq_test( struct mgsl_struct *info );
745 static bool mgsl_dma_test( struct mgsl_struct *info );
746 static bool mgsl_memory_test( struct mgsl_struct *info );
747 static int mgsl_adapter_test( struct mgsl_struct *info );
752 static int mgsl_claim_resources(struct mgsl_struct *info);
753 static void mgsl_release_resources(struct mgsl_struct *info);
754 static void mgsl_add_device(struct mgsl_struct *info);
760 static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int StartIndex, unsigned int EndIndex );
761 static bool mgsl_get_rx_frame( struct mgsl_struct *info );
762 static bool mgsl_get_raw_rx_frame( struct mgsl_struct *info );
763 static void mgsl_reset_rx_dma_buffers( struct mgsl_struct *info );
764 static void mgsl_reset_tx_dma_buffers( struct mgsl_struct *info );
765 static int num_free_tx_dma_buffers(struct mgsl_struct *info);
766 static void mgsl_load_tx_dma_buffer( struct mgsl_struct *info, const char *Buffer, unsigned int BufferSize);
772 static int mgsl_allocate_dma_buffers(struct mgsl_struct *info);
773 static void mgsl_free_dma_buffers(struct mgsl_struct *info);
774 static int mgsl_alloc_frame_memory(struct mgsl_struct *info, DMABUFFERENTRY *BufferList,int Buffercount);
775 static void mgsl_free_frame_memory(struct mgsl_struct *info, DMABUFFERENTRY *BufferList,int Buffercount);
776 static int mgsl_alloc_buffer_list_memory(struct mgsl_struct *info);
777 static void mgsl_free_buffer_list_memory(struct mgsl_struct *info);
778 static int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info);
779 static void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info);
780 static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info);
781 static void mgsl_free_intermediate_txbuffer_memory(struct mgsl_struct *info);
782 static bool load_next_tx_holding_buffer(struct mgsl_struct *info);
783 static int save_tx_buffer_request(struct mgsl_struct *info,const char *Buffer, unsigned int BufferSize);
789 static void mgsl_bh_receive(struct mgsl_struct *info);
790 static void mgsl_bh_transmit(struct mgsl_struct *info);
791 static void mgsl_bh_status(struct mgsl_struct *info);
796 static void mgsl_isr_null( struct mgsl_struct *info );
797 static void mgsl_isr_transmit_data( struct mgsl_struct *info );
798 static void mgsl_isr_receive_data( struct mgsl_struct *info );
799 static void mgsl_isr_receive_status( struct mgsl_struct *info );
800 static void mgsl_isr_transmit_status( struct mgsl_struct *info );
801 static void mgsl_isr_io_pin( struct mgsl_struct *info );
802 static void mgsl_isr_misc( struct mgsl_struct *info );
803 static void mgsl_isr_receive_dma( struct mgsl_struct *info );
804 static void mgsl_isr_transmit_dma( struct mgsl_struct *info );
825 static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount
827 static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS __user *user_params);
828 static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS __user *new_params);
829 static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode);
830 static int mgsl_set_txidle(struct mgsl_struct * info, int idle_mode);
831 static int mgsl_txenable(struct mgsl_struct * info, int enable);
832 static int mgsl_txabort(struct mgsl_struct * info);
833 static int mgsl_rxenable(struct mgsl_struct * info, int enable);
834 static int mgsl_wait_event(struct mgsl_struct * info, int __user *mask);
835 static int mgsl_loopmode_send_done( struct mgsl_struct * info );
909 static void mgsl_change_params(struct mgsl_struct *info);
923 static inline int mgsl_paranoia_check(struct mgsl_struct *info, mgsl_paranoia_check() argument
932 if (!info) { mgsl_paranoia_check()
936 if (info->magic != MGSL_MAGIC) { mgsl_paranoia_check()
941 if (!info) mgsl_paranoia_check()
972 * Arguments: tty pointer to tty info structure
977 struct mgsl_struct *info = tty->driver_data; mgsl_stop() local
980 if (mgsl_paranoia_check(info, tty->name, "mgsl_stop")) mgsl_stop()
984 printk("mgsl_stop(%s)\n",info->device_name); mgsl_stop()
986 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_stop()
987 if (info->tx_enabled) mgsl_stop()
988 usc_stop_transmitter(info); mgsl_stop()
989 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_stop()
995 * Arguments: tty pointer to tty info structure
1000 struct mgsl_struct *info = tty->driver_data; mgsl_start() local
1003 if (mgsl_paranoia_check(info, tty->name, "mgsl_start")) mgsl_start()
1007 printk("mgsl_start(%s)\n",info->device_name); mgsl_start()
1009 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_start()
1010 if (!info->tx_enabled) mgsl_start()
1011 usc_start_transmitter(info); mgsl_start()
1012 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_start()
1023 static int mgsl_bh_action(struct mgsl_struct *info) mgsl_bh_action() argument
1028 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_bh_action()
1030 if (info->pending_bh & BH_RECEIVE) { mgsl_bh_action()
1031 info->pending_bh &= ~BH_RECEIVE; mgsl_bh_action()
1033 } else if (info->pending_bh & BH_TRANSMIT) { mgsl_bh_action()
1034 info->pending_bh &= ~BH_TRANSMIT; mgsl_bh_action()
1036 } else if (info->pending_bh & BH_STATUS) { mgsl_bh_action()
1037 info->pending_bh &= ~BH_STATUS; mgsl_bh_action()
1043 info->bh_running = false; mgsl_bh_action()
1044 info->bh_requested = false; mgsl_bh_action()
1047 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_bh_action()
1057 struct mgsl_struct *info = mgsl_bh_handler() local
1063 __FILE__,__LINE__,info->device_name); mgsl_bh_handler()
1065 info->bh_running = true; mgsl_bh_handler()
1067 while((action = mgsl_bh_action(info)) != 0) { mgsl_bh_handler()
1077 mgsl_bh_receive(info); mgsl_bh_handler()
1080 mgsl_bh_transmit(info); mgsl_bh_handler()
1083 mgsl_bh_status(info); mgsl_bh_handler()
1094 __FILE__,__LINE__,info->device_name); mgsl_bh_handler()
1097 static void mgsl_bh_receive(struct mgsl_struct *info) mgsl_bh_receive() argument
1099 bool (*get_rx_frame)(struct mgsl_struct *info) = mgsl_bh_receive()
1100 (info->params.mode == MGSL_MODE_HDLC ? mgsl_get_rx_frame : mgsl_get_raw_rx_frame); mgsl_bh_receive()
1104 __FILE__,__LINE__,info->device_name); mgsl_bh_receive()
1108 if (info->rx_rcc_underrun) { mgsl_bh_receive()
1110 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_bh_receive()
1111 usc_start_receiver(info); mgsl_bh_receive()
1112 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_bh_receive()
1115 } while(get_rx_frame(info)); mgsl_bh_receive()
1118 static void mgsl_bh_transmit(struct mgsl_struct *info) mgsl_bh_transmit() argument
1120 struct tty_struct *tty = info->port.tty; mgsl_bh_transmit()
1125 __FILE__,__LINE__,info->device_name); mgsl_bh_transmit()
1133 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_bh_transmit()
1134 if ( !info->tx_active && info->loopmode_send_done_requested ) mgsl_bh_transmit()
1135 usc_loopmode_send_done( info ); mgsl_bh_transmit()
1136 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_bh_transmit()
1139 static void mgsl_bh_status(struct mgsl_struct *info) mgsl_bh_status() argument
1143 __FILE__,__LINE__,info->device_name); mgsl_bh_status()
1145 info->ri_chkcount = 0; mgsl_bh_status()
1146 info->dsr_chkcount = 0; mgsl_bh_status()
1147 info->dcd_chkcount = 0; mgsl_bh_status()
1148 info->cts_chkcount = 0; mgsl_bh_status()
1157 * Arguments: info pointer to device instance data
1160 static void mgsl_isr_receive_status( struct mgsl_struct *info ) mgsl_isr_receive_status()
1162 u16 status = usc_InReg( info, RCSR ); mgsl_isr_receive_status()
1169 info->loopmode_insert_requested && mgsl_isr_receive_status()
1170 usc_loopmode_active(info) ) mgsl_isr_receive_status()
1172 ++info->icount.rxabort; mgsl_isr_receive_status()
1173 info->loopmode_insert_requested = false; mgsl_isr_receive_status()
1176 info->cmr_value &= ~BIT13; mgsl_isr_receive_status()
1177 usc_OutReg(info, CMR, info->cmr_value); mgsl_isr_receive_status()
1180 usc_OutReg(info, RICR, mgsl_isr_receive_status()
1181 (usc_InReg(info, RICR) & ~RXSTATUS_ABORT_RECEIVED)); mgsl_isr_receive_status()
1186 info->icount.exithunt++; mgsl_isr_receive_status()
1188 info->icount.rxidle++; mgsl_isr_receive_status()
1189 wake_up_interruptible(&info->event_wait_q); mgsl_isr_receive_status()
1193 info->icount.rxover++; mgsl_isr_receive_status()
1194 usc_process_rxoverrun_sync( info ); mgsl_isr_receive_status()
1197 usc_ClearIrqPendingBits( info, RECEIVE_STATUS ); mgsl_isr_receive_status()
1198 usc_UnlatchRxstatusBits( info, status ); mgsl_isr_receive_status()
1209 * Arguments: info pointer to device instance data
1212 static void mgsl_isr_transmit_status( struct mgsl_struct *info ) mgsl_isr_transmit_status()
1214 u16 status = usc_InReg( info, TCSR ); mgsl_isr_transmit_status()
1220 usc_ClearIrqPendingBits( info, TRANSMIT_STATUS ); mgsl_isr_transmit_status()
1221 usc_UnlatchTxstatusBits( info, status ); mgsl_isr_transmit_status()
1230 usc_DmaCmd( info, DmaCmd_ResetTxChannel ); mgsl_isr_transmit_status()
1231 usc_RTCmd( info, RTCmd_PurgeTxFifo ); mgsl_isr_transmit_status()
1235 info->icount.txok++; mgsl_isr_transmit_status()
1237 info->icount.txunder++; mgsl_isr_transmit_status()
1239 info->icount.txabort++; mgsl_isr_transmit_status()
1241 info->icount.txunder++; mgsl_isr_transmit_status()
1243 info->tx_active = false; mgsl_isr_transmit_status()
1244 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; mgsl_isr_transmit_status()
1245 del_timer(&info->tx_timer); mgsl_isr_transmit_status()
1247 if ( info->drop_rts_on_tx_done ) { mgsl_isr_transmit_status()
1248 usc_get_serial_signals( info ); mgsl_isr_transmit_status()
1249 if ( info->serial_signals & SerialSignal_RTS ) { mgsl_isr_transmit_status()
1250 info->serial_signals &= ~SerialSignal_RTS; mgsl_isr_transmit_status()
1251 usc_set_serial_signals( info ); mgsl_isr_transmit_status()
1253 info->drop_rts_on_tx_done = false; mgsl_isr_transmit_status()
1257 if (info->netcount) mgsl_isr_transmit_status()
1258 hdlcdev_tx_done(info); mgsl_isr_transmit_status()
1262 if (info->port.tty->stopped || info->port.tty->hw_stopped) { mgsl_isr_transmit_status()
1263 usc_stop_transmitter(info); mgsl_isr_transmit_status()
1266 info->pending_bh |= BH_TRANSMIT; mgsl_isr_transmit_status()
1276 * Arguments: info pointer to device instance data
1279 static void mgsl_isr_io_pin( struct mgsl_struct *info ) mgsl_isr_io_pin()
1282 u16 status = usc_InReg( info, MISR ); mgsl_isr_io_pin()
1288 usc_ClearIrqPendingBits( info, IO_PIN ); mgsl_isr_io_pin()
1289 usc_UnlatchIostatusBits( info, status ); mgsl_isr_io_pin()
1293 icount = &info->icount; mgsl_isr_io_pin()
1296 if ((info->ri_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) mgsl_isr_io_pin()
1297 usc_DisablestatusIrqs(info,SICR_RI); mgsl_isr_io_pin()
1300 info->input_signal_events.ri_up++; mgsl_isr_io_pin()
1302 info->input_signal_events.ri_down++; mgsl_isr_io_pin()
1305 if ((info->dsr_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) mgsl_isr_io_pin()
1306 usc_DisablestatusIrqs(info,SICR_DSR); mgsl_isr_io_pin()
1309 info->input_signal_events.dsr_up++; mgsl_isr_io_pin()
1311 info->input_signal_events.dsr_down++; mgsl_isr_io_pin()
1314 if ((info->dcd_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) mgsl_isr_io_pin()
1315 usc_DisablestatusIrqs(info,SICR_DCD); mgsl_isr_io_pin()
1318 info->input_signal_events.dcd_up++; mgsl_isr_io_pin()
1320 info->input_signal_events.dcd_down++; mgsl_isr_io_pin()
1322 if (info->netcount) { mgsl_isr_io_pin()
1324 netif_carrier_on(info->netdev); mgsl_isr_io_pin()
1326 netif_carrier_off(info->netdev); mgsl_isr_io_pin()
1332 if ((info->cts_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) mgsl_isr_io_pin()
1333 usc_DisablestatusIrqs(info,SICR_CTS); mgsl_isr_io_pin()
1336 info->input_signal_events.cts_up++; mgsl_isr_io_pin()
1338 info->input_signal_events.cts_down++; mgsl_isr_io_pin()
1340 wake_up_interruptible(&info->status_event_wait_q); mgsl_isr_io_pin()
1341 wake_up_interruptible(&info->event_wait_q); mgsl_isr_io_pin()
1343 if ( (info->port.flags & ASYNC_CHECK_CD) && mgsl_isr_io_pin()
1346 printk("%s CD now %s...", info->device_name, mgsl_isr_io_pin()
1349 wake_up_interruptible(&info->port.open_wait); mgsl_isr_io_pin()
1353 if (info->port.tty) mgsl_isr_io_pin()
1354 tty_hangup(info->port.tty); mgsl_isr_io_pin()
1358 if (tty_port_cts_enabled(&info->port) && mgsl_isr_io_pin()
1360 if (info->port.tty->hw_stopped) { mgsl_isr_io_pin()
1364 if (info->port.tty) mgsl_isr_io_pin()
1365 info->port.tty->hw_stopped = 0; mgsl_isr_io_pin()
1366 usc_start_transmitter(info); mgsl_isr_io_pin()
1367 info->pending_bh |= BH_TRANSMIT; mgsl_isr_io_pin()
1374 if (info->port.tty) mgsl_isr_io_pin()
1375 info->port.tty->hw_stopped = 1; mgsl_isr_io_pin()
1376 usc_stop_transmitter(info); mgsl_isr_io_pin()
1382 info->pending_bh |= BH_STATUS; mgsl_isr_io_pin()
1386 usc_OutReg( info, SICR, mgsl_isr_io_pin()
1387 (unsigned short)(usc_InReg(info,SICR) & ~(SICR_TXC_ACTIVE+SICR_TXC_INACTIVE)) ); mgsl_isr_io_pin()
1388 usc_UnlatchIostatusBits( info, MISCSTATUS_TXC_LATCHED ); mgsl_isr_io_pin()
1389 info->irq_occurred = true; mgsl_isr_io_pin()
1398 * Arguments: info pointer to device instance data
1401 static void mgsl_isr_transmit_data( struct mgsl_struct *info ) mgsl_isr_transmit_data()
1405 __FILE__,__LINE__,info->xmit_cnt); mgsl_isr_transmit_data()
1407 usc_ClearIrqPendingBits( info, TRANSMIT_DATA ); mgsl_isr_transmit_data()
1409 if (info->port.tty->stopped || info->port.tty->hw_stopped) { mgsl_isr_transmit_data()
1410 usc_stop_transmitter(info); mgsl_isr_transmit_data()
1414 if ( info->xmit_cnt ) mgsl_isr_transmit_data()
1415 usc_load_txfifo( info ); mgsl_isr_transmit_data()
1417 info->tx_active = false; mgsl_isr_transmit_data()
1419 if (info->xmit_cnt < WAKEUP_CHARS) mgsl_isr_transmit_data()
1420 info->pending_bh |= BH_TRANSMIT; mgsl_isr_transmit_data()
1430 * Arguments: info pointer to device instance data
1433 static void mgsl_isr_receive_data( struct mgsl_struct *info ) mgsl_isr_receive_data()
1439 struct mgsl_icount *icount = &info->icount; mgsl_isr_receive_data()
1445 usc_ClearIrqPendingBits( info, RECEIVE_DATA ); mgsl_isr_receive_data()
1448 usc_RCmd( info, RCmd_SelectRicrRxFifostatus ); mgsl_isr_receive_data()
1452 usc_OutReg( info, RICR+LSBONLY, (u16)(usc_InReg(info, RICR+LSBONLY) & ~BIT3 )); mgsl_isr_receive_data()
1456 while( (Fifocount = (usc_InReg(info,RICR) >> 8)) ) { mgsl_isr_receive_data()
1460 outw( (inw(info->io_base + CCAR) & 0x0780) | (RDR+LSBONLY), mgsl_isr_receive_data()
1461 info->io_base + CCAR ); mgsl_isr_receive_data()
1462 DataByte = inb( info->io_base + CCAR ); mgsl_isr_receive_data()
1465 status = usc_InReg(info, RCSR); mgsl_isr_receive_data()
1468 usc_UnlatchRxstatusBits(info,RXSTATUS_ALL); mgsl_isr_receive_data()
1487 usc_RTCmd(info,RTCmd_PurgeRxFifo); mgsl_isr_receive_data()
1492 if (status & info->ignore_status_mask) mgsl_isr_receive_data()
1495 status &= info->read_status_mask; mgsl_isr_receive_data()
1499 if (info->port.flags & ASYNC_SAK) mgsl_isr_receive_data()
1500 do_SAK(info->port.tty); mgsl_isr_receive_data()
1506 tty_insert_flip_char(&info->port, DataByte, flag); mgsl_isr_receive_data()
1512 work += tty_insert_flip_char(&info->port, 0, TTY_OVERRUN); mgsl_isr_receive_data()
1523 tty_flip_buffer_push(&info->port); mgsl_isr_receive_data()
1530 * Arguments: info pointer to device extension (instance data)
1533 static void mgsl_isr_misc( struct mgsl_struct *info ) mgsl_isr_misc()
1535 u16 status = usc_InReg( info, MISR ); mgsl_isr_misc()
1542 (info->params.mode == MGSL_MODE_HDLC)) { mgsl_isr_misc()
1545 usc_EnableReceiver(info,DISABLE_UNCONDITIONAL); mgsl_isr_misc()
1546 usc_DmaCmd(info, DmaCmd_ResetRxChannel); mgsl_isr_misc()
1547 usc_UnlatchRxstatusBits(info, RXSTATUS_ALL); mgsl_isr_misc()
1548 usc_ClearIrqPendingBits(info, RECEIVE_DATA | RECEIVE_STATUS); mgsl_isr_misc()
1549 usc_DisableInterrupts(info, RECEIVE_DATA | RECEIVE_STATUS); mgsl_isr_misc()
1552 info->pending_bh |= BH_RECEIVE; mgsl_isr_misc()
1553 info->rx_rcc_underrun = true; mgsl_isr_misc()
1556 usc_ClearIrqPendingBits( info, MISC ); mgsl_isr_misc()
1557 usc_UnlatchMiscstatusBits( info, status ); mgsl_isr_misc()
1566 * Arguments: info pointer to device extension (instance data)
1569 static void mgsl_isr_null( struct mgsl_struct *info ) mgsl_isr_null()
1590 * Arguments: info pointer to device instance data
1593 static void mgsl_isr_receive_dma( struct mgsl_struct *info ) mgsl_isr_receive_dma()
1598 usc_OutDmaReg( info, CDIR, BIT9 | BIT1 ); mgsl_isr_receive_dma()
1602 status = usc_InDmaReg( info, RDMR ); mgsl_isr_receive_dma()
1606 __FILE__,__LINE__,info->device_name,status); mgsl_isr_receive_dma()
1608 info->pending_bh |= BH_RECEIVE; mgsl_isr_receive_dma()
1611 info->rx_overflow = true; mgsl_isr_receive_dma()
1612 info->icount.buf_overrun++; mgsl_isr_receive_dma()
1634 * Arguments: info pointer to device instance data
1637 static void mgsl_isr_transmit_dma( struct mgsl_struct *info ) mgsl_isr_transmit_dma()
1642 usc_OutDmaReg(info, CDIR, BIT8 | BIT0 ); mgsl_isr_transmit_dma()
1647 status = usc_InDmaReg( info, TDMR ); mgsl_isr_transmit_dma()
1651 __FILE__,__LINE__,info->device_name,status); mgsl_isr_transmit_dma()
1654 --info->tx_dma_buffers_used; mgsl_isr_transmit_dma()
1659 if ( load_next_tx_holding_buffer(info) ) { mgsl_isr_transmit_dma()
1663 info->pending_bh |= BH_TRANSMIT; mgsl_isr_transmit_dma()
1682 struct mgsl_struct *info = dev_id; mgsl_interrupt() local
1688 __FILE__, __LINE__, info->irq_level); mgsl_interrupt()
1690 spin_lock(&info->irq_spinlock); mgsl_interrupt()
1694 UscVector = usc_InReg(info, IVR) >> 9; mgsl_interrupt()
1695 DmaVector = usc_InDmaReg(info, DIVR); mgsl_interrupt()
1699 __FILE__,__LINE__,info->device_name,UscVector,DmaVector); mgsl_interrupt()
1706 (*UscIsrTable[UscVector])(info); mgsl_interrupt()
1708 mgsl_isr_transmit_dma(info); mgsl_interrupt()
1710 mgsl_isr_receive_dma(info); mgsl_interrupt()
1712 if ( info->isr_overflow ) { mgsl_interrupt()
1714 __FILE__, __LINE__, info->device_name, info->irq_level); mgsl_interrupt()
1715 usc_DisableMasterIrqBit(info); mgsl_interrupt()
1716 usc_DisableDmaInterrupts(info,DICR_MASTER); mgsl_interrupt()
1725 if ( info->pending_bh && !info->bh_running && !info->bh_requested ) { mgsl_interrupt()
1728 __FILE__,__LINE__,info->device_name); mgsl_interrupt()
1729 schedule_work(&info->task); mgsl_interrupt()
1730 info->bh_requested = true; mgsl_interrupt()
1733 spin_unlock(&info->irq_spinlock); mgsl_interrupt()
1737 __FILE__, __LINE__, info->irq_level); mgsl_interrupt()
1746 * Arguments: info pointer to device instance data
1749 static int startup(struct mgsl_struct * info) startup() argument
1754 printk("%s(%d):mgsl_startup(%s)\n",__FILE__,__LINE__,info->device_name); startup()
1756 if (info->port.flags & ASYNC_INITIALIZED) startup()
1759 if (!info->xmit_buf) { startup()
1761 info->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); startup()
1762 if (!info->xmit_buf) { startup()
1764 __FILE__,__LINE__,info->device_name); startup()
1769 info->pending_bh = 0; startup()
1771 memset(&info->icount, 0, sizeof(info->icount)); startup()
1773 setup_timer(&info->tx_timer, mgsl_tx_timeout, (unsigned long)info); startup()
1776 retval = mgsl_claim_resources(info); startup()
1780 retval = mgsl_adapter_test(info); startup()
1783 if (capable(CAP_SYS_ADMIN) && info->port.tty) startup()
1784 set_bit(TTY_IO_ERROR, &info->port.tty->flags); startup()
1785 mgsl_release_resources(info); startup()
1790 mgsl_change_params(info); startup()
1792 if (info->port.tty) startup()
1793 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); startup()
1795 info->port.flags |= ASYNC_INITIALIZED; startup()
1805 * Arguments: info pointer to device instance data
1808 static void shutdown(struct mgsl_struct * info) shutdown() argument
1812 if (!(info->port.flags & ASYNC_INITIALIZED)) shutdown()
1817 __FILE__,__LINE__, info->device_name ); shutdown()
1821 wake_up_interruptible(&info->status_event_wait_q); shutdown()
1822 wake_up_interruptible(&info->event_wait_q); shutdown()
1824 del_timer_sync(&info->tx_timer); shutdown()
1826 if (info->xmit_buf) { shutdown()
1827 free_page((unsigned long) info->xmit_buf); shutdown()
1828 info->xmit_buf = NULL; shutdown()
1831 spin_lock_irqsave(&info->irq_spinlock,flags); shutdown()
1832 usc_DisableMasterIrqBit(info); shutdown()
1833 usc_stop_receiver(info); shutdown()
1834 usc_stop_transmitter(info); shutdown()
1835 usc_DisableInterrupts(info,RECEIVE_DATA | RECEIVE_STATUS | shutdown()
1837 usc_DisableDmaInterrupts(info,DICR_MASTER + DICR_TRANSMIT + DICR_RECEIVE); shutdown()
1842 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT15) | BIT14)); shutdown()
1847 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12)); shutdown()
1849 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { shutdown()
1850 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); shutdown()
1851 usc_set_serial_signals(info); shutdown()
1854 spin_unlock_irqrestore(&info->irq_spinlock,flags); shutdown()
1856 mgsl_release_resources(info); shutdown()
1858 if (info->port.tty) shutdown()
1859 set_bit(TTY_IO_ERROR, &info->port.tty->flags); shutdown()
1861 info->port.flags &= ~ASYNC_INITIALIZED; shutdown()
1865 static void mgsl_program_hw(struct mgsl_struct *info) mgsl_program_hw() argument
1869 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_program_hw()
1871 usc_stop_receiver(info); mgsl_program_hw()
1872 usc_stop_transmitter(info); mgsl_program_hw()
1873 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; mgsl_program_hw()
1875 if (info->params.mode == MGSL_MODE_HDLC || mgsl_program_hw()
1876 info->params.mode == MGSL_MODE_RAW || mgsl_program_hw()
1877 info->netcount) mgsl_program_hw()
1878 usc_set_sync_mode(info); mgsl_program_hw()
1880 usc_set_async_mode(info); mgsl_program_hw()
1882 usc_set_serial_signals(info); mgsl_program_hw()
1884 info->dcd_chkcount = 0; mgsl_program_hw()
1885 info->cts_chkcount = 0; mgsl_program_hw()
1886 info->ri_chkcount = 0; mgsl_program_hw()
1887 info->dsr_chkcount = 0; mgsl_program_hw()
1889 usc_EnableStatusIrqs(info,SICR_CTS+SICR_DSR+SICR_DCD+SICR_RI); mgsl_program_hw()
1890 usc_EnableInterrupts(info, IO_PIN); mgsl_program_hw()
1891 usc_get_serial_signals(info); mgsl_program_hw()
1893 if (info->netcount || info->port.tty->termios.c_cflag & CREAD) mgsl_program_hw()
1894 usc_start_receiver(info); mgsl_program_hw()
1896 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_program_hw()
1901 static void mgsl_change_params(struct mgsl_struct *info) mgsl_change_params() argument
1906 if (!info->port.tty) mgsl_change_params()
1911 __FILE__,__LINE__, info->device_name ); mgsl_change_params()
1913 cflag = info->port.tty->termios.c_cflag; mgsl_change_params()
1918 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; mgsl_change_params()
1920 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); mgsl_change_params()
1925 case CS5: info->params.data_bits = 5; break; mgsl_change_params()
1926 case CS6: info->params.data_bits = 6; break; mgsl_change_params()
1927 case CS7: info->params.data_bits = 7; break; mgsl_change_params()
1928 case CS8: info->params.data_bits = 8; break; mgsl_change_params()
1930 default: info->params.data_bits = 7; break; mgsl_change_params()
1934 info->params.stop_bits = 2; mgsl_change_params()
1936 info->params.stop_bits = 1; mgsl_change_params()
1938 info->params.parity = ASYNC_PARITY_NONE; mgsl_change_params()
1941 info->params.parity = ASYNC_PARITY_ODD; mgsl_change_params()
1943 info->params.parity = ASYNC_PARITY_EVEN; mgsl_change_params()
1946 info->params.parity = ASYNC_PARITY_SPACE; mgsl_change_params()
1953 bits_per_char = info->params.data_bits + mgsl_change_params()
1954 info->params.stop_bits + 1; mgsl_change_params()
1960 if (info->params.data_rate <= 460800) mgsl_change_params()
1961 info->params.data_rate = tty_get_baud_rate(info->port.tty); mgsl_change_params()
1963 if ( info->params.data_rate ) { mgsl_change_params()
1964 info->timeout = (32*HZ*bits_per_char) / mgsl_change_params()
1965 info->params.data_rate; mgsl_change_params()
1967 info->timeout += HZ/50; /* Add .02 seconds of slop */ mgsl_change_params()
1970 info->port.flags |= ASYNC_CTS_FLOW; mgsl_change_params()
1972 info->port.flags &= ~ASYNC_CTS_FLOW; mgsl_change_params()
1975 info->port.flags &= ~ASYNC_CHECK_CD; mgsl_change_params()
1977 info->port.flags |= ASYNC_CHECK_CD; mgsl_change_params()
1981 info->read_status_mask = RXSTATUS_OVERRUN; mgsl_change_params()
1982 if (I_INPCK(info->port.tty)) mgsl_change_params()
1983 info->read_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; mgsl_change_params()
1984 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) mgsl_change_params()
1985 info->read_status_mask |= RXSTATUS_BREAK_RECEIVED; mgsl_change_params()
1987 if (I_IGNPAR(info->port.tty)) mgsl_change_params()
1988 info->ignore_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; mgsl_change_params()
1989 if (I_IGNBRK(info->port.tty)) { mgsl_change_params()
1990 info->ignore_status_mask |= RXSTATUS_BREAK_RECEIVED; mgsl_change_params()
1994 if (I_IGNPAR(info->port.tty)) mgsl_change_params()
1995 info->ignore_status_mask |= RXSTATUS_OVERRUN; mgsl_change_params()
1998 mgsl_program_hw(info); mgsl_change_params()
2013 struct mgsl_struct *info = tty->driver_data; mgsl_put_char() local
2019 __FILE__, __LINE__, ch, info->device_name); mgsl_put_char()
2022 if (mgsl_paranoia_check(info, tty->name, "mgsl_put_char")) mgsl_put_char()
2025 if (!info->xmit_buf) mgsl_put_char()
2028 spin_lock_irqsave(&info->irq_spinlock, flags); mgsl_put_char()
2030 if ((info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active) { mgsl_put_char()
2031 if (info->xmit_cnt < SERIAL_XMIT_SIZE - 1) { mgsl_put_char()
2032 info->xmit_buf[info->xmit_head++] = ch; mgsl_put_char()
2033 info->xmit_head &= SERIAL_XMIT_SIZE-1; mgsl_put_char()
2034 info->xmit_cnt++; mgsl_put_char()
2038 spin_unlock_irqrestore(&info->irq_spinlock, flags); mgsl_put_char()
2053 struct mgsl_struct *info = tty->driver_data; mgsl_flush_chars() local
2058 __FILE__,__LINE__,info->device_name,info->xmit_cnt); mgsl_flush_chars()
2060 if (mgsl_paranoia_check(info, tty->name, "mgsl_flush_chars")) mgsl_flush_chars()
2063 if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || mgsl_flush_chars()
2064 !info->xmit_buf) mgsl_flush_chars()
2069 __FILE__,__LINE__,info->device_name ); mgsl_flush_chars()
2071 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_flush_chars()
2073 if (!info->tx_active) { mgsl_flush_chars()
2074 if ( (info->params.mode == MGSL_MODE_HDLC || mgsl_flush_chars()
2075 info->params.mode == MGSL_MODE_RAW) && info->xmit_cnt ) { mgsl_flush_chars()
2079 mgsl_load_tx_dma_buffer(info, mgsl_flush_chars()
2080 info->xmit_buf,info->xmit_cnt); mgsl_flush_chars()
2082 usc_start_transmitter(info); mgsl_flush_chars()
2085 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_flush_chars()
2105 struct mgsl_struct *info = tty->driver_data; mgsl_write() local
2110 __FILE__,__LINE__,info->device_name,count); mgsl_write()
2112 if (mgsl_paranoia_check(info, tty->name, "mgsl_write")) mgsl_write()
2115 if (!info->xmit_buf) mgsl_write()
2118 if ( info->params.mode == MGSL_MODE_HDLC || mgsl_write()
2119 info->params.mode == MGSL_MODE_RAW ) { mgsl_write()
2121 if (info->tx_active) { mgsl_write()
2123 if ( info->params.mode == MGSL_MODE_HDLC ) { mgsl_write()
2132 if (info->tx_holding_count >= info->num_tx_holding_buffers ) { mgsl_write()
2140 save_tx_buffer_request(info,buf,count); mgsl_write()
2145 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_write()
2146 load_next_tx_holding_buffer(info); mgsl_write()
2147 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_write()
2155 if ( (info->params.flags & HDLC_FLAG_HDLC_LOOPMODE) && mgsl_write()
2156 !usc_loopmode_active(info) ) mgsl_write()
2162 if ( info->xmit_cnt ) { mgsl_write()
2169 mgsl_load_tx_dma_buffer(info, mgsl_write()
2170 info->xmit_buf,info->xmit_cnt); mgsl_write()
2173 __FILE__,__LINE__,info->device_name); mgsl_write()
2177 __FILE__,__LINE__,info->device_name); mgsl_write()
2179 info->xmit_cnt = count; mgsl_write()
2180 mgsl_load_tx_dma_buffer(info,buf,count); mgsl_write()
2184 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_write()
2186 min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, mgsl_write()
2187 SERIAL_XMIT_SIZE - info->xmit_head)); mgsl_write()
2189 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_write()
2192 memcpy(info->xmit_buf + info->xmit_head, buf, c); mgsl_write()
2193 info->xmit_head = ((info->xmit_head + c) & mgsl_write()
2195 info->xmit_cnt += c; mgsl_write()
2196 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_write()
2203 if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) { mgsl_write()
2204 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_write()
2205 if (!info->tx_active) mgsl_write()
2206 usc_start_transmitter(info); mgsl_write()
2207 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_write()
2212 __FILE__,__LINE__,info->device_name,ret); mgsl_write()
2222 * Arguments: tty pointer to tty info structure
2227 struct mgsl_struct *info = tty->driver_data; mgsl_write_room() local
2230 if (mgsl_paranoia_check(info, tty->name, "mgsl_write_room")) mgsl_write_room()
2232 ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; mgsl_write_room()
2238 __FILE__,__LINE__, info->device_name,ret ); mgsl_write_room()
2240 if ( info->params.mode == MGSL_MODE_HDLC || mgsl_write_room()
2241 info->params.mode == MGSL_MODE_RAW ) { mgsl_write_room()
2243 if ( info->tx_active ) mgsl_write_room()
2257 * Arguments: tty pointer to tty info structure
2262 struct mgsl_struct *info = tty->driver_data; mgsl_chars_in_buffer() local
2266 __FILE__,__LINE__, info->device_name ); mgsl_chars_in_buffer()
2268 if (mgsl_paranoia_check(info, tty->name, "mgsl_chars_in_buffer")) mgsl_chars_in_buffer()
2273 __FILE__,__LINE__, info->device_name,info->xmit_cnt ); mgsl_chars_in_buffer()
2275 if ( info->params.mode == MGSL_MODE_HDLC || mgsl_chars_in_buffer()
2276 info->params.mode == MGSL_MODE_RAW ) { mgsl_chars_in_buffer()
2278 if ( info->tx_active ) mgsl_chars_in_buffer()
2279 return info->max_frame_size; mgsl_chars_in_buffer()
2284 return info->xmit_cnt; mgsl_chars_in_buffer()
2291 * Arguments: tty pointer to tty info structure
2296 struct mgsl_struct *info = tty->driver_data; mgsl_flush_buffer() local
2301 __FILE__,__LINE__, info->device_name ); mgsl_flush_buffer()
2303 if (mgsl_paranoia_check(info, tty->name, "mgsl_flush_buffer")) mgsl_flush_buffer()
2306 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_flush_buffer()
2307 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; mgsl_flush_buffer()
2308 del_timer(&info->tx_timer); mgsl_flush_buffer()
2309 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_flush_buffer()
2318 * Arguments: tty pointer to tty info structure
2324 struct mgsl_struct *info = tty->driver_data; mgsl_send_xchar() local
2329 __FILE__,__LINE__, info->device_name, ch ); mgsl_send_xchar()
2331 if (mgsl_paranoia_check(info, tty->name, "mgsl_send_xchar")) mgsl_send_xchar()
2334 info->x_char = ch; mgsl_send_xchar()
2337 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_send_xchar()
2338 if (!info->tx_enabled) mgsl_send_xchar()
2339 usc_start_transmitter(info); mgsl_send_xchar()
2340 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_send_xchar()
2348 * Arguments: tty pointer to tty info structure
2353 struct mgsl_struct *info = tty->driver_data; mgsl_throttle() local
2358 __FILE__,__LINE__, info->device_name ); mgsl_throttle()
2360 if (mgsl_paranoia_check(info, tty->name, "mgsl_throttle")) mgsl_throttle()
2367 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_throttle()
2368 info->serial_signals &= ~SerialSignal_RTS; mgsl_throttle()
2369 usc_set_serial_signals(info); mgsl_throttle()
2370 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_throttle()
2378 * Arguments: tty pointer to tty info structure
2383 struct mgsl_struct *info = tty->driver_data; mgsl_unthrottle() local
2388 __FILE__,__LINE__, info->device_name ); mgsl_unthrottle()
2390 if (mgsl_paranoia_check(info, tty->name, "mgsl_unthrottle")) mgsl_unthrottle()
2394 if (info->x_char) mgsl_unthrottle()
2395 info->x_char = 0; mgsl_unthrottle()
2401 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_unthrottle()
2402 info->serial_signals |= SerialSignal_RTS; mgsl_unthrottle()
2403 usc_set_serial_signals(info); mgsl_unthrottle()
2404 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_unthrottle()
2413 * Arguments: info pointer to device instance data
2418 static int mgsl_get_stats(struct mgsl_struct * info, struct mgsl_icount __user *user_icount) mgsl_get_stats() argument
2424 __FILE__,__LINE__, info->device_name); mgsl_get_stats()
2427 memset(&info->icount, 0, sizeof(info->icount)); mgsl_get_stats()
2429 mutex_lock(&info->port.mutex); mgsl_get_stats()
2430 COPY_TO_USER(err, user_icount, &info->icount, sizeof(struct mgsl_icount)); mgsl_get_stats()
2431 mutex_unlock(&info->port.mutex); mgsl_get_stats()
2444 * Arguments: info pointer to device instance data
2449 static int mgsl_get_params(struct mgsl_struct * info, MGSL_PARAMS __user *user_params) mgsl_get_params() argument
2454 __FILE__,__LINE__, info->device_name); mgsl_get_params()
2456 mutex_lock(&info->port.mutex); mgsl_get_params()
2457 COPY_TO_USER(err,user_params, &info->params, sizeof(MGSL_PARAMS)); mgsl_get_params()
2458 mutex_unlock(&info->port.mutex); mgsl_get_params()
2462 __FILE__,__LINE__,info->device_name); mgsl_get_params()
2476 * info pointer to device instance data
2481 static int mgsl_set_params(struct mgsl_struct * info, MGSL_PARAMS __user *new_params) mgsl_set_params() argument
2489 info->device_name ); mgsl_set_params()
2494 __FILE__,__LINE__,info->device_name); mgsl_set_params()
2498 mutex_lock(&info->port.mutex); mgsl_set_params()
2499 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_set_params()
2500 memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); mgsl_set_params()
2501 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_set_params()
2503 mgsl_change_params(info); mgsl_set_params()
2504 mutex_unlock(&info->port.mutex); mgsl_set_params()
2514 * Arguments: info pointer to device instance data
2519 static int mgsl_get_txidle(struct mgsl_struct * info, int __user *idle_mode) mgsl_get_txidle() argument
2525 __FILE__,__LINE__, info->device_name, info->idle_mode); mgsl_get_txidle()
2527 COPY_TO_USER(err,idle_mode, &info->idle_mode, sizeof(int)); mgsl_get_txidle()
2531 __FILE__,__LINE__,info->device_name); mgsl_get_txidle()
2541 * Arguments: info pointer to device instance data
2546 static int mgsl_set_txidle(struct mgsl_struct * info, int idle_mode) mgsl_set_txidle() argument
2552 info->device_name, idle_mode ); mgsl_set_txidle()
2554 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_set_txidle()
2555 info->idle_mode = idle_mode; mgsl_set_txidle()
2556 usc_set_txidle( info ); mgsl_set_txidle()
2557 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_set_txidle()
2568 * info pointer to device instance data
2573 static int mgsl_txenable(struct mgsl_struct * info, int enable) mgsl_txenable() argument
2579 info->device_name, enable); mgsl_txenable()
2581 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_txenable()
2583 if ( !info->tx_enabled ) { mgsl_txenable()
2585 usc_start_transmitter(info); mgsl_txenable()
2593 if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) mgsl_txenable()
2594 usc_loopmode_insert_request( info ); mgsl_txenable()
2597 if ( info->tx_enabled ) mgsl_txenable()
2598 usc_stop_transmitter(info); mgsl_txenable()
2600 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_txenable()
2607 * Arguments: info pointer to device instance data
2610 static int mgsl_txabort(struct mgsl_struct * info) mgsl_txabort() argument
2616 info->device_name); mgsl_txabort()
2618 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_txabort()
2619 if ( info->tx_active && info->params.mode == MGSL_MODE_HDLC ) mgsl_txabort()
2621 if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) mgsl_txabort()
2622 usc_loopmode_cancel_transmit( info ); mgsl_txabort()
2624 usc_TCmd(info,TCmd_SendAbort); mgsl_txabort()
2626 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_txabort()
2633 * Arguments: info pointer to device instance data
2637 static int mgsl_rxenable(struct mgsl_struct * info, int enable) mgsl_rxenable() argument
2643 info->device_name, enable); mgsl_rxenable()
2645 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_rxenable()
2647 if ( !info->rx_enabled ) mgsl_rxenable()
2648 usc_start_receiver(info); mgsl_rxenable()
2650 if ( info->rx_enabled ) mgsl_rxenable()
2651 usc_stop_receiver(info); mgsl_rxenable()
2653 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_rxenable()
2660 * Arguments: info pointer to device instance data
2666 static int mgsl_wait_event(struct mgsl_struct * info, int __user * mask_ptr) mgsl_wait_event() argument
2684 info->device_name, mask); mgsl_wait_event()
2686 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_wait_event()
2689 usc_get_serial_signals(info); mgsl_wait_event()
2690 s = info->serial_signals; mgsl_wait_event()
2697 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_wait_event()
2702 cprev = info->icount; mgsl_wait_event()
2703 oldsigs = info->input_signal_events; mgsl_wait_event()
2707 u16 oldreg = usc_InReg(info,RICR); mgsl_wait_event()
2712 usc_OutReg(info, RICR, newreg); mgsl_wait_event()
2716 add_wait_queue(&info->event_wait_q, &wait); mgsl_wait_event()
2718 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_wait_event()
2729 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_wait_event()
2730 cnow = info->icount; mgsl_wait_event()
2731 newsigs = info->input_signal_events; mgsl_wait_event()
2733 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_wait_event()
2768 remove_wait_queue(&info->event_wait_q, &wait); mgsl_wait_event()
2772 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_wait_event()
2773 if (!waitqueue_active(&info->event_wait_q)) { mgsl_wait_event()
2775 usc_OutReg(info, RICR, usc_InReg(info,RICR) & mgsl_wait_event()
2778 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_wait_event()
2788 static int modem_input_wait(struct mgsl_struct *info,int arg) modem_input_wait() argument
2796 spin_lock_irqsave(&info->irq_spinlock,flags); modem_input_wait()
2797 cprev = info->icount; modem_input_wait()
2798 add_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
2800 spin_unlock_irqrestore(&info->irq_spinlock,flags); modem_input_wait()
2810 spin_lock_irqsave(&info->irq_spinlock,flags); modem_input_wait()
2811 cnow = info->icount; modem_input_wait()
2813 spin_unlock_irqrestore(&info->irq_spinlock,flags); modem_input_wait()
2833 remove_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
2842 struct mgsl_struct *info = tty->driver_data; tiocmget() local
2846 spin_lock_irqsave(&info->irq_spinlock,flags); tiocmget()
2847 usc_get_serial_signals(info); tiocmget()
2848 spin_unlock_irqrestore(&info->irq_spinlock,flags); tiocmget()
2850 result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS:0) + tiocmget()
2851 ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR:0) + tiocmget()
2852 ((info->serial_signals & SerialSignal_DCD) ? TIOCM_CAR:0) + tiocmget()
2853 ((info->serial_signals & SerialSignal_RI) ? TIOCM_RNG:0) + tiocmget()
2854 ((info->serial_signals & SerialSignal_DSR) ? TIOCM_DSR:0) + tiocmget()
2855 ((info->serial_signals & SerialSignal_CTS) ? TIOCM_CTS:0); tiocmget()
2859 __FILE__,__LINE__, info->device_name, result ); tiocmget()
2868 struct mgsl_struct *info = tty->driver_data; tiocmset() local
2873 __FILE__,__LINE__,info->device_name, set, clear); tiocmset()
2876 info->serial_signals |= SerialSignal_RTS; tiocmset()
2878 info->serial_signals |= SerialSignal_DTR; tiocmset()
2880 info->serial_signals &= ~SerialSignal_RTS; tiocmset()
2882 info->serial_signals &= ~SerialSignal_DTR; tiocmset()
2884 spin_lock_irqsave(&info->irq_spinlock,flags); tiocmset()
2885 usc_set_serial_signals(info); tiocmset()
2886 spin_unlock_irqrestore(&info->irq_spinlock,flags); tiocmset()
2899 struct mgsl_struct * info = tty->driver_data; mgsl_break() local
2904 __FILE__,__LINE__, info->device_name, break_state); mgsl_break()
2906 if (mgsl_paranoia_check(info, tty->name, "mgsl_break")) mgsl_break()
2909 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_break()
2911 usc_OutReg(info,IOCR,(u16)(usc_InReg(info,IOCR) | BIT7)); mgsl_break()
2913 usc_OutReg(info,IOCR,(u16)(usc_InReg(info,IOCR) & ~BIT7)); mgsl_break()
2914 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_break()
2929 struct mgsl_struct * info = tty->driver_data; msgl_get_icount() local
2933 spin_lock_irqsave(&info->irq_spinlock,flags); msgl_get_icount()
2934 cnow = info->icount; msgl_get_icount()
2935 spin_unlock_irqrestore(&info->irq_spinlock,flags); msgl_get_icount()
2964 struct mgsl_struct * info = tty->driver_data; mgsl_ioctl() local
2968 info->device_name, cmd ); mgsl_ioctl()
2970 if (mgsl_paranoia_check(info, tty->name, "mgsl_ioctl")) mgsl_ioctl()
2979 return mgsl_ioctl_common(info, cmd, arg); mgsl_ioctl()
2982 static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg) mgsl_ioctl_common() argument
2988 return mgsl_get_params(info, argp); mgsl_ioctl_common()
2990 return mgsl_set_params(info, argp); mgsl_ioctl_common()
2992 return mgsl_get_txidle(info, argp); mgsl_ioctl_common()
2994 return mgsl_set_txidle(info,(int)arg); mgsl_ioctl_common()
2996 return mgsl_txenable(info,(int)arg); mgsl_ioctl_common()
2998 return mgsl_rxenable(info,(int)arg); mgsl_ioctl_common()
3000 return mgsl_txabort(info); mgsl_ioctl_common()
3002 return mgsl_get_stats(info, argp); mgsl_ioctl_common()
3004 return mgsl_wait_event(info, argp); mgsl_ioctl_common()
3006 return mgsl_loopmode_send_done(info); mgsl_ioctl_common()
3011 return modem_input_wait(info,(int)arg); mgsl_ioctl_common()
3032 struct mgsl_struct *info = tty->driver_data; mgsl_set_termios() local
3039 mgsl_change_params(info); mgsl_set_termios()
3044 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); mgsl_set_termios()
3045 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_set_termios()
3046 usc_set_serial_signals(info); mgsl_set_termios()
3047 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_set_termios()
3053 info->serial_signals |= SerialSignal_DTR; mgsl_set_termios()
3056 info->serial_signals |= SerialSignal_RTS; mgsl_set_termios()
3058 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_set_termios()
3059 usc_set_serial_signals(info); mgsl_set_termios()
3060 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_set_termios()
3086 struct mgsl_struct * info = tty->driver_data; mgsl_close() local
3088 if (mgsl_paranoia_check(info, tty->name, "mgsl_close")) mgsl_close()
3093 __FILE__,__LINE__, info->device_name, info->port.count); mgsl_close()
3095 if (tty_port_close_start(&info->port, tty, filp) == 0) mgsl_close()
3098 mutex_lock(&info->port.mutex); mgsl_close()
3099 if (info->port.flags & ASYNC_INITIALIZED) mgsl_close()
3100 mgsl_wait_until_sent(tty, info->timeout); mgsl_close()
3103 shutdown(info); mgsl_close()
3104 mutex_unlock(&info->port.mutex); mgsl_close()
3106 tty_port_close_end(&info->port, tty); mgsl_close()
3107 info->port.tty = NULL; mgsl_close()
3111 tty->driver->name, info->port.count); mgsl_close()
3121 * tty pointer to tty info structure
3128 struct mgsl_struct * info = tty->driver_data; mgsl_wait_until_sent() local
3131 if (!info ) mgsl_wait_until_sent()
3136 __FILE__,__LINE__, info->device_name ); mgsl_wait_until_sent()
3138 if (mgsl_paranoia_check(info, tty->name, "mgsl_wait_until_sent")) mgsl_wait_until_sent()
3141 if (!(info->port.flags & ASYNC_INITIALIZED)) mgsl_wait_until_sent()
3152 if ( info->params.data_rate ) { mgsl_wait_until_sent()
3153 char_time = info->timeout/(32 * 5); mgsl_wait_until_sent()
3162 if ( info->params.mode == MGSL_MODE_HDLC || mgsl_wait_until_sent()
3163 info->params.mode == MGSL_MODE_RAW ) { mgsl_wait_until_sent()
3164 while (info->tx_active) { mgsl_wait_until_sent()
3172 while (!(usc_InReg(info,TCSR) & TXSTATUS_ALL_SENT) && mgsl_wait_until_sent()
3173 info->tx_enabled) { mgsl_wait_until_sent()
3185 __FILE__,__LINE__, info->device_name ); mgsl_wait_until_sent()
3199 struct mgsl_struct * info = tty->driver_data; mgsl_hangup() local
3203 __FILE__,__LINE__, info->device_name ); mgsl_hangup()
3205 if (mgsl_paranoia_check(info, tty->name, "mgsl_hangup")) mgsl_hangup()
3209 shutdown(info); mgsl_hangup()
3211 info->port.count = 0; mgsl_hangup()
3212 info->port.flags &= ~ASYNC_NORMAL_ACTIVE; mgsl_hangup()
3213 info->port.tty = NULL; mgsl_hangup()
3215 wake_up_interruptible(&info->port.open_wait); mgsl_hangup()
3228 struct mgsl_struct *info = container_of(port, struct mgsl_struct, port); carrier_raised() local
3230 spin_lock_irqsave(&info->irq_spinlock, flags); carrier_raised()
3231 usc_get_serial_signals(info); carrier_raised()
3232 spin_unlock_irqrestore(&info->irq_spinlock, flags); carrier_raised()
3233 return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; carrier_raised()
3238 struct mgsl_struct *info = container_of(port, struct mgsl_struct, port); dtr_rts() local
3241 spin_lock_irqsave(&info->irq_spinlock,flags); dtr_rts()
3243 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; dtr_rts()
3245 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); dtr_rts()
3246 usc_set_serial_signals(info); dtr_rts()
3247 spin_unlock_irqrestore(&info->irq_spinlock,flags); dtr_rts()
3258 * tty pointer to tty info structure
3260 * info pointer to device instance data
3265 struct mgsl_struct *info) block_til_ready()
3272 struct tty_port *port = &info->port; block_til_ready()
3301 spin_lock_irqsave(&info->irq_spinlock, flags); block_til_ready()
3303 spin_unlock_irqrestore(&info->irq_spinlock, flags); block_til_ready()
3318 dcd = tty_port_carrier_raised(&info->port); block_til_ready()
3357 struct mgsl_struct *info; mgsl_install() local
3367 /* find the info structure for the specified line */ mgsl_install()
3368 info = mgsl_device_list; mgsl_install()
3369 while (info && info->line != line) mgsl_install()
3370 info = info->next_device; mgsl_install()
3371 if (mgsl_paranoia_check(info, tty->name, "mgsl_open")) mgsl_install()
3373 tty->driver_data = info; mgsl_install()
3375 return tty_port_install(&info->port, driver, tty); mgsl_install()
3383 * Arguments: tty pointer to tty info structure
3390 struct mgsl_struct *info = tty->driver_data; mgsl_open() local
3394 info->port.tty = tty; mgsl_open()
3398 __FILE__,__LINE__,tty->driver->name, info->port.count); mgsl_open()
3400 info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; mgsl_open()
3402 spin_lock_irqsave(&info->netlock, flags); mgsl_open()
3403 if (info->netcount) { mgsl_open()
3405 spin_unlock_irqrestore(&info->netlock, flags); mgsl_open()
3408 info->port.count++; mgsl_open()
3409 spin_unlock_irqrestore(&info->netlock, flags); mgsl_open()
3411 if (info->port.count == 1) { mgsl_open()
3413 retval = startup(info); mgsl_open()
3418 retval = block_til_ready(tty, filp, info); mgsl_open()
3422 __FILE__,__LINE__, info->device_name, retval); mgsl_open()
3428 __FILE__,__LINE__, info->device_name); mgsl_open()
3434 info->port.tty = NULL; /* tty layer will release tty struct */ mgsl_open()
3435 if(info->port.count) mgsl_open()
3436 info->port.count--; mgsl_open()
3447 static inline void line_info(struct seq_file *m, struct mgsl_struct *info) line_info() argument
3452 if (info->bus_type == MGSL_BUS_TYPE_PCI) { line_info()
3454 info->device_name, info->io_base, info->irq_level, line_info()
3455 info->phys_memory_base, info->phys_lcr_base); line_info()
3458 info->device_name, info->io_base, line_info()
3459 info->irq_level, info->dma_level); line_info()
3463 spin_lock_irqsave(&info->irq_spinlock,flags); line_info()
3464 usc_get_serial_signals(info); line_info()
3465 spin_unlock_irqrestore(&info->irq_spinlock,flags); line_info()
3469 if (info->serial_signals & SerialSignal_RTS) line_info()
3471 if (info->serial_signals & SerialSignal_CTS) line_info()
3473 if (info->serial_signals & SerialSignal_DTR) line_info()
3475 if (info->serial_signals & SerialSignal_DSR) line_info()
3477 if (info->serial_signals & SerialSignal_DCD) line_info()
3479 if (info->serial_signals & SerialSignal_RI) line_info()
3482 if (info->params.mode == MGSL_MODE_HDLC || line_info()
3483 info->params.mode == MGSL_MODE_RAW ) { line_info()
3485 info->icount.txok, info->icount.rxok); line_info()
3486 if (info->icount.txunder) line_info()
3487 seq_printf(m, " txunder:%d", info->icount.txunder); line_info()
3488 if (info->icount.txabort) line_info()
3489 seq_printf(m, " txabort:%d", info->icount.txabort); line_info()
3490 if (info->icount.rxshort) line_info()
3491 seq_printf(m, " rxshort:%d", info->icount.rxshort); line_info()
3492 if (info->icount.rxlong) line_info()
3493 seq_printf(m, " rxlong:%d", info->icount.rxlong); line_info()
3494 if (info->icount.rxover) line_info()
3495 seq_printf(m, " rxover:%d", info->icount.rxover); line_info()
3496 if (info->icount.rxcrc) line_info()
3497 seq_printf(m, " rxcrc:%d", info->icount.rxcrc); line_info()
3500 info->icount.tx, info->icount.rx); line_info()
3501 if (info->icount.frame) line_info()
3502 seq_printf(m, " fe:%d", info->icount.frame); line_info()
3503 if (info->icount.parity) line_info()
3504 seq_printf(m, " pe:%d", info->icount.parity); line_info()
3505 if (info->icount.brk) line_info()
3506 seq_printf(m, " brk:%d", info->icount.brk); line_info()
3507 if (info->icount.overrun) line_info()
3508 seq_printf(m, " oe:%d", info->icount.overrun); line_info()
3515 info->tx_active,info->bh_requested,info->bh_running, line_info()
3516 info->pending_bh); line_info()
3518 spin_lock_irqsave(&info->irq_spinlock,flags); line_info()
3520 u16 Tcsr = usc_InReg( info, TCSR ); line_info()
3521 u16 Tdmr = usc_InDmaReg( info, TDMR ); line_info()
3522 u16 Ticr = usc_InReg( info, TICR ); line_info()
3523 u16 Rscr = usc_InReg( info, RCSR ); line_info()
3524 u16 Rdmr = usc_InDmaReg( info, RDMR ); line_info()
3525 u16 Ricr = usc_InReg( info, RICR ); line_info()
3526 u16 Icr = usc_InReg( info, ICR ); line_info()
3527 u16 Dccr = usc_InReg( info, DCCR ); line_info()
3528 u16 Tmr = usc_InReg( info, TMR ); line_info()
3529 u16 Tccr = usc_InReg( info, TCCR ); line_info()
3530 u16 Ccar = inw( info->io_base + CCAR ); line_info()
3535 spin_unlock_irqrestore(&info->irq_spinlock,flags); line_info()
3541 struct mgsl_struct *info; mgsl_proc_show() local
3545 info = mgsl_device_list; mgsl_proc_show()
3546 while( info ) { mgsl_proc_show()
3547 line_info(m, info); mgsl_proc_show()
3548 info = info->next_device; mgsl_proc_show()
3571 * Arguments: info pointer to device instance data
3574 static int mgsl_allocate_dma_buffers(struct mgsl_struct *info) mgsl_allocate_dma_buffers() argument
3578 info->last_mem_alloc = 0; mgsl_allocate_dma_buffers()
3585 BuffersPerFrame = (unsigned short)(info->max_frame_size/DMABUFFERSIZE); mgsl_allocate_dma_buffers()
3586 if ( info->max_frame_size % DMABUFFERSIZE ) mgsl_allocate_dma_buffers()
3589 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { mgsl_allocate_dma_buffers()
3612 info->tx_buffer_count = info->num_tx_dma_buffers * BuffersPerFrame; mgsl_allocate_dma_buffers()
3613 info->rx_buffer_count = 62 - info->tx_buffer_count; mgsl_allocate_dma_buffers()
3625 info->tx_buffer_count = info->num_tx_dma_buffers * BuffersPerFrame; mgsl_allocate_dma_buffers()
3626 info->rx_buffer_count = (BuffersPerFrame * MAXRXFRAMES) + 6; mgsl_allocate_dma_buffers()
3633 if ( (info->tx_buffer_count + info->rx_buffer_count) > 62 ) mgsl_allocate_dma_buffers()
3634 info->rx_buffer_count = 62 - info->tx_buffer_count; mgsl_allocate_dma_buffers()
3640 __FILE__,__LINE__, info->tx_buffer_count,info->rx_buffer_count); mgsl_allocate_dma_buffers()
3642 if ( mgsl_alloc_buffer_list_memory( info ) < 0 || mgsl_allocate_dma_buffers()
3643 mgsl_alloc_frame_memory(info, info->rx_buffer_list, info->rx_buffer_count) < 0 || mgsl_allocate_dma_buffers()
3644 mgsl_alloc_frame_memory(info, info->tx_buffer_list, info->tx_buffer_count) < 0 || mgsl_allocate_dma_buffers()
3645 mgsl_alloc_intermediate_rxbuffer_memory(info) < 0 || mgsl_allocate_dma_buffers()
3646 mgsl_alloc_intermediate_txbuffer_memory(info) < 0 ) { mgsl_allocate_dma_buffers()
3651 mgsl_reset_rx_dma_buffers( info ); mgsl_allocate_dma_buffers()
3652 mgsl_reset_tx_dma_buffers( info ); mgsl_allocate_dma_buffers()
3666 * (plus some other info about the buffer).
3678 * Arguments: info pointer to device instance data
3681 static int mgsl_alloc_buffer_list_memory( struct mgsl_struct *info ) mgsl_alloc_buffer_list_memory()
3685 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { mgsl_alloc_buffer_list_memory()
3687 info->buffer_list = info->memory_base + info->last_mem_alloc; mgsl_alloc_buffer_list_memory()
3688 info->buffer_list_phys = info->last_mem_alloc; mgsl_alloc_buffer_list_memory()
3689 info->last_mem_alloc += BUFFERLISTSIZE; mgsl_alloc_buffer_list_memory()
3697 info->buffer_list = dma_alloc_coherent(NULL, BUFFERLISTSIZE, &info->buffer_list_dma_addr, GFP_KERNEL); mgsl_alloc_buffer_list_memory()
3698 if (info->buffer_list == NULL) mgsl_alloc_buffer_list_memory()
3700 info->buffer_list_phys = (u32)(info->buffer_list_dma_addr); mgsl_alloc_buffer_list_memory()
3705 memset( info->buffer_list, 0, BUFFERLISTSIZE ); mgsl_alloc_buffer_list_memory()
3710 info->rx_buffer_list = (DMABUFFERENTRY *)info->buffer_list; mgsl_alloc_buffer_list_memory()
3711 info->tx_buffer_list = (DMABUFFERENTRY *)info->buffer_list; mgsl_alloc_buffer_list_memory()
3712 info->tx_buffer_list += info->rx_buffer_count; mgsl_alloc_buffer_list_memory()
3723 for ( i = 0; i < info->rx_buffer_count; i++ ) { mgsl_alloc_buffer_list_memory()
3725 info->rx_buffer_list[i].phys_entry = mgsl_alloc_buffer_list_memory()
3726 info->buffer_list_phys + (i * sizeof(DMABUFFERENTRY)); mgsl_alloc_buffer_list_memory()
3731 info->rx_buffer_list[i].link = info->buffer_list_phys; mgsl_alloc_buffer_list_memory()
3733 if ( i < info->rx_buffer_count - 1 ) mgsl_alloc_buffer_list_memory()
3734 info->rx_buffer_list[i].link += (i + 1) * sizeof(DMABUFFERENTRY); mgsl_alloc_buffer_list_memory()
3737 for ( i = 0; i < info->tx_buffer_count; i++ ) { mgsl_alloc_buffer_list_memory()
3739 info->tx_buffer_list[i].phys_entry = info->buffer_list_phys + mgsl_alloc_buffer_list_memory()
3740 ((info->rx_buffer_count + i) * sizeof(DMABUFFERENTRY)); mgsl_alloc_buffer_list_memory()
3745 info->tx_buffer_list[i].link = info->buffer_list_phys + mgsl_alloc_buffer_list_memory()
3746 info->rx_buffer_count * sizeof(DMABUFFERENTRY); mgsl_alloc_buffer_list_memory()
3748 if ( i < info->tx_buffer_count - 1 ) mgsl_alloc_buffer_list_memory()
3749 info->tx_buffer_list[i].link += (i + 1) * sizeof(DMABUFFERENTRY); mgsl_alloc_buffer_list_memory()
3765 static void mgsl_free_buffer_list_memory( struct mgsl_struct *info ) mgsl_free_buffer_list_memory()
3767 if (info->buffer_list && info->bus_type != MGSL_BUS_TYPE_PCI) mgsl_free_buffer_list_memory()
3768 dma_free_coherent(NULL, BUFFERLISTSIZE, info->buffer_list, info->buffer_list_dma_addr); mgsl_free_buffer_list_memory()
3770 info->buffer_list = NULL; mgsl_free_buffer_list_memory()
3771 info->rx_buffer_list = NULL; mgsl_free_buffer_list_memory()
3772 info->tx_buffer_list = NULL; mgsl_free_buffer_list_memory()
3786 * info pointer to device instance data
3792 static int mgsl_alloc_frame_memory(struct mgsl_struct *info,DMABUFFERENTRY *BufferList,int Buffercount) mgsl_alloc_frame_memory() argument
3800 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { mgsl_alloc_frame_memory()
3802 BufferList[i].virt_addr = info->memory_base + info->last_mem_alloc; mgsl_alloc_frame_memory()
3803 phys_addr = info->last_mem_alloc; mgsl_alloc_frame_memory()
3804 info->last_mem_alloc += DMABUFFERSIZE; mgsl_alloc_frame_memory()
3827 * info pointer to device instance data
3833 static void mgsl_free_frame_memory(struct mgsl_struct *info, DMABUFFERENTRY *BufferList, int Buffercount) mgsl_free_frame_memory() argument
3840 if ( info->bus_type != MGSL_BUS_TYPE_PCI ) mgsl_free_frame_memory()
3853 * Arguments: info pointer to device instance data
3856 static void mgsl_free_dma_buffers( struct mgsl_struct *info ) mgsl_free_dma_buffers()
3858 mgsl_free_frame_memory( info, info->rx_buffer_list, info->rx_buffer_count ); mgsl_free_dma_buffers()
3859 mgsl_free_frame_memory( info, info->tx_buffer_list, info->tx_buffer_count ); mgsl_free_dma_buffers()
3860 mgsl_free_buffer_list_memory( info ); mgsl_free_dma_buffers()
3873 * info pointer to device instance data
3877 static int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info) mgsl_alloc_intermediate_rxbuffer_memory() argument
3879 info->intermediate_rxbuffer = kmalloc(info->max_frame_size, GFP_KERNEL | GFP_DMA); mgsl_alloc_intermediate_rxbuffer_memory()
3880 if ( info->intermediate_rxbuffer == NULL ) mgsl_alloc_intermediate_rxbuffer_memory()
3883 info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL); mgsl_alloc_intermediate_rxbuffer_memory()
3884 if (!info->flag_buf) { mgsl_alloc_intermediate_rxbuffer_memory()
3885 kfree(info->intermediate_rxbuffer); mgsl_alloc_intermediate_rxbuffer_memory()
3886 info->intermediate_rxbuffer = NULL; mgsl_alloc_intermediate_rxbuffer_memory()
3899 * info pointer to device instance data
3903 static void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info) mgsl_free_intermediate_rxbuffer_memory() argument
3905 kfree(info->intermediate_rxbuffer); mgsl_free_intermediate_rxbuffer_memory()
3906 info->intermediate_rxbuffer = NULL; mgsl_free_intermediate_rxbuffer_memory()
3907 kfree(info->flag_buf); mgsl_free_intermediate_rxbuffer_memory()
3908 info->flag_buf = NULL; mgsl_free_intermediate_rxbuffer_memory()
3921 * info pointer to device instance data
3925 static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info) mgsl_alloc_intermediate_txbuffer_memory() argument
3931 info->device_name, __FILE__,__LINE__,info->num_tx_holding_buffers); mgsl_alloc_intermediate_txbuffer_memory()
3933 memset(info->tx_holding_buffers,0,sizeof(info->tx_holding_buffers)); mgsl_alloc_intermediate_txbuffer_memory()
3935 for ( i=0; i<info->num_tx_holding_buffers; ++i) { mgsl_alloc_intermediate_txbuffer_memory()
3936 info->tx_holding_buffers[i].buffer = mgsl_alloc_intermediate_txbuffer_memory()
3937 kmalloc(info->max_frame_size, GFP_KERNEL); mgsl_alloc_intermediate_txbuffer_memory()
3938 if (info->tx_holding_buffers[i].buffer == NULL) { mgsl_alloc_intermediate_txbuffer_memory()
3940 kfree(info->tx_holding_buffers[i].buffer); mgsl_alloc_intermediate_txbuffer_memory()
3941 info->tx_holding_buffers[i].buffer = NULL; mgsl_alloc_intermediate_txbuffer_memory()
3957 * info pointer to device instance data
3961 static void mgsl_free_intermediate_txbuffer_memory(struct mgsl_struct *info) mgsl_free_intermediate_txbuffer_memory() argument
3965 for ( i=0; i<info->num_tx_holding_buffers; ++i ) { mgsl_free_intermediate_txbuffer_memory()
3966 kfree(info->tx_holding_buffers[i].buffer); mgsl_free_intermediate_txbuffer_memory()
3967 info->tx_holding_buffers[i].buffer = NULL; mgsl_free_intermediate_txbuffer_memory()
3970 info->get_tx_holding_index = 0; mgsl_free_intermediate_txbuffer_memory()
3971 info->put_tx_holding_index = 0; mgsl_free_intermediate_txbuffer_memory()
3972 info->tx_holding_count = 0; mgsl_free_intermediate_txbuffer_memory()
3985 * info pointer to device instance data
3991 static bool load_next_tx_holding_buffer(struct mgsl_struct *info) load_next_tx_holding_buffer() argument
3995 if ( info->tx_holding_count ) { load_next_tx_holding_buffer()
4000 &info->tx_holding_buffers[info->get_tx_holding_index]; load_next_tx_holding_buffer()
4001 int num_free = num_free_tx_dma_buffers(info); load_next_tx_holding_buffer()
4007 info->xmit_cnt = ptx->buffer_size; load_next_tx_holding_buffer()
4008 mgsl_load_tx_dma_buffer(info,ptx->buffer,ptx->buffer_size); load_next_tx_holding_buffer()
4010 --info->tx_holding_count; load_next_tx_holding_buffer()
4011 if ( ++info->get_tx_holding_index >= info->num_tx_holding_buffers) load_next_tx_holding_buffer()
4012 info->get_tx_holding_index=0; load_next_tx_holding_buffer()
4015 mod_timer(&info->tx_timer, jiffies + msecs_to_jiffies(5000)); load_next_tx_holding_buffer()
4031 * info pointer to device instance data
4037 static int save_tx_buffer_request(struct mgsl_struct *info,const char *Buffer, unsigned int BufferSize) save_tx_buffer_request() argument
4041 if ( info->tx_holding_count >= info->num_tx_holding_buffers ) { save_tx_buffer_request()
4045 ptx = &info->tx_holding_buffers[info->put_tx_holding_index]; save_tx_buffer_request()
4049 ++info->tx_holding_count; save_tx_buffer_request()
4050 if ( ++info->put_tx_holding_index >= info->num_tx_holding_buffers) save_tx_buffer_request()
4051 info->put_tx_holding_index=0; save_tx_buffer_request()
4056 static int mgsl_claim_resources(struct mgsl_struct *info) mgsl_claim_resources() argument
4058 if (request_region(info->io_base,info->io_addr_size,"synclink") == NULL) { mgsl_claim_resources()
4060 __FILE__,__LINE__,info->device_name, info->io_base); mgsl_claim_resources()
4063 info->io_addr_requested = true; mgsl_claim_resources()
4065 if ( request_irq(info->irq_level,mgsl_interrupt,info->irq_flags, mgsl_claim_resources()
4066 info->device_name, info ) < 0 ) { mgsl_claim_resources()
4068 __FILE__,__LINE__,info->device_name, info->irq_level ); mgsl_claim_resources()
4071 info->irq_requested = true; mgsl_claim_resources()
4073 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { mgsl_claim_resources()
4074 if (request_mem_region(info->phys_memory_base,0x40000,"synclink") == NULL) { mgsl_claim_resources()
4076 __FILE__,__LINE__,info->device_name, info->phys_memory_base); mgsl_claim_resources()
4079 info->shared_mem_requested = true; mgsl_claim_resources()
4080 if (request_mem_region(info->phys_lcr_base + info->lcr_offset,128,"synclink") == NULL) { mgsl_claim_resources()
4082 __FILE__,__LINE__,info->device_name, info->phys_lcr_base + info->lcr_offset); mgsl_claim_resources()
4085 info->lcr_mem_requested = true; mgsl_claim_resources()
4087 info->memory_base = ioremap_nocache(info->phys_memory_base, mgsl_claim_resources()
4089 if (!info->memory_base) { mgsl_claim_resources()
4091 __FILE__,__LINE__,info->device_name, info->phys_memory_base ); mgsl_claim_resources()
4095 if ( !mgsl_memory_test(info) ) { mgsl_claim_resources()
4097 __FILE__,__LINE__,info->device_name, info->phys_memory_base ); mgsl_claim_resources()
4101 info->lcr_base = ioremap_nocache(info->phys_lcr_base, mgsl_claim_resources()
4103 if (!info->lcr_base) { mgsl_claim_resources()
4105 __FILE__,__LINE__,info->device_name, info->phys_lcr_base ); mgsl_claim_resources()
4108 info->lcr_base += info->lcr_offset; mgsl_claim_resources()
4113 if (request_dma(info->dma_level,info->device_name) < 0){ mgsl_claim_resources()
4115 __FILE__,__LINE__,info->device_name, info->dma_level ); mgsl_claim_resources()
4116 mgsl_release_resources( info ); mgsl_claim_resources()
4119 info->dma_requested = true; mgsl_claim_resources()
4122 set_dma_mode(info->dma_level,DMA_MODE_CASCADE); mgsl_claim_resources()
4123 enable_dma(info->dma_level); mgsl_claim_resources()
4126 if ( mgsl_allocate_dma_buffers(info) < 0 ) { mgsl_claim_resources()
4128 __FILE__,__LINE__,info->device_name, info->dma_level ); mgsl_claim_resources()
4134 mgsl_release_resources(info); mgsl_claim_resources()
4139 static void mgsl_release_resources(struct mgsl_struct *info) mgsl_release_resources() argument
4143 __FILE__,__LINE__,info->device_name ); mgsl_release_resources()
4145 if ( info->irq_requested ) { mgsl_release_resources()
4146 free_irq(info->irq_level, info); mgsl_release_resources()
4147 info->irq_requested = false; mgsl_release_resources()
4149 if ( info->dma_requested ) { mgsl_release_resources()
4150 disable_dma(info->dma_level); mgsl_release_resources()
4151 free_dma(info->dma_level); mgsl_release_resources()
4152 info->dma_requested = false; mgsl_release_resources()
4154 mgsl_free_dma_buffers(info); mgsl_release_resources()
4155 mgsl_free_intermediate_rxbuffer_memory(info); mgsl_release_resources()
4156 mgsl_free_intermediate_txbuffer_memory(info); mgsl_release_resources()
4158 if ( info->io_addr_requested ) { mgsl_release_resources()
4159 release_region(info->io_base,info->io_addr_size); mgsl_release_resources()
4160 info->io_addr_requested = false; mgsl_release_resources()
4162 if ( info->shared_mem_requested ) { mgsl_release_resources()
4163 release_mem_region(info->phys_memory_base,0x40000); mgsl_release_resources()
4164 info->shared_mem_requested = false; mgsl_release_resources()
4166 if ( info->lcr_mem_requested ) { mgsl_release_resources()
4167 release_mem_region(info->phys_lcr_base + info->lcr_offset,128); mgsl_release_resources()
4168 info->lcr_mem_requested = false; mgsl_release_resources()
4170 if (info->memory_base){ mgsl_release_resources()
4171 iounmap(info->memory_base); mgsl_release_resources()
4172 info->memory_base = NULL; mgsl_release_resources()
4174 if (info->lcr_base){ mgsl_release_resources()
4175 iounmap(info->lcr_base - info->lcr_offset); mgsl_release_resources()
4176 info->lcr_base = NULL; mgsl_release_resources()
4181 __FILE__,__LINE__,info->device_name ); mgsl_release_resources()
4190 * Arguments: info pointer to device instance data
4193 static void mgsl_add_device( struct mgsl_struct *info ) mgsl_add_device()
4195 info->next_device = NULL; mgsl_add_device()
4196 info->line = mgsl_device_count; mgsl_add_device()
4197 sprintf(info->device_name,"ttySL%d",info->line); mgsl_add_device()
4199 if (info->line < MAX_TOTAL_DEVICES) { mgsl_add_device()
4200 if (maxframe[info->line]) mgsl_add_device()
4201 info->max_frame_size = maxframe[info->line]; mgsl_add_device()
4203 if (txdmabufs[info->line]) { mgsl_add_device()
4204 info->num_tx_dma_buffers = txdmabufs[info->line]; mgsl_add_device()
4205 if (info->num_tx_dma_buffers < 1) mgsl_add_device()
4206 info->num_tx_dma_buffers = 1; mgsl_add_device()
4209 if (txholdbufs[info->line]) { mgsl_add_device()
4210 info->num_tx_holding_buffers = txholdbufs[info->line]; mgsl_add_device()
4211 if (info->num_tx_holding_buffers < 1) mgsl_add_device()
4212 info->num_tx_holding_buffers = 1; mgsl_add_device()
4213 else if (info->num_tx_holding_buffers > MAX_TX_HOLDING_BUFFERS) mgsl_add_device()
4214 info->num_tx_holding_buffers = MAX_TX_HOLDING_BUFFERS; mgsl_add_device()
4221 mgsl_device_list = info; mgsl_add_device()
4226 current_dev->next_device = info; mgsl_add_device()
4229 if ( info->max_frame_size < 4096 ) mgsl_add_device()
4230 info->max_frame_size = 4096; mgsl_add_device()
4231 else if ( info->max_frame_size > 65535 ) mgsl_add_device()
4232 info->max_frame_size = 65535; mgsl_add_device()
4234 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { mgsl_add_device()
4236 info->hw_version + 1, info->device_name, info->io_base, info->irq_level, mgsl_add_device()
4237 info->phys_memory_base, info->phys_lcr_base, mgsl_add_device()
4238 info->max_frame_size ); mgsl_add_device()
4241 info->device_name, info->io_base, info->irq_level, info->dma_level, mgsl_add_device()
4242 info->max_frame_size ); mgsl_add_device()
4246 hdlcdev_init(info); mgsl_add_device()
4266 struct mgsl_struct *info; mgsl_allocate_device() local
4268 info = kzalloc(sizeof(struct mgsl_struct), mgsl_allocate_device()
4271 if (!info) { mgsl_allocate_device()
4274 tty_port_init(&info->port); mgsl_allocate_device()
4275 info->port.ops = &mgsl_port_ops; mgsl_allocate_device()
4276 info->magic = MGSL_MAGIC; mgsl_allocate_device()
4277 INIT_WORK(&info->task, mgsl_bh_handler); mgsl_allocate_device()
4278 info->max_frame_size = 4096; mgsl_allocate_device()
4279 info->port.close_delay = 5*HZ/10; mgsl_allocate_device()
4280 info->port.closing_wait = 30*HZ; mgsl_allocate_device()
4281 init_waitqueue_head(&info->status_event_wait_q); mgsl_allocate_device()
4282 init_waitqueue_head(&info->event_wait_q); mgsl_allocate_device()
4283 spin_lock_init(&info->irq_spinlock); mgsl_allocate_device()
4284 spin_lock_init(&info->netlock); mgsl_allocate_device()
4285 memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS)); mgsl_allocate_device()
4286 info->idle_mode = HDLC_TXIDLE_FLAGS; mgsl_allocate_device()
4287 info->num_tx_dma_buffers = 1; mgsl_allocate_device()
4288 info->num_tx_holding_buffers = 0; mgsl_allocate_device()
4291 return info; mgsl_allocate_device()
4363 struct mgsl_struct *info; mgsl_enum_isa_devices() local
4373 info = mgsl_allocate_device(); mgsl_enum_isa_devices()
4374 if ( !info ) { mgsl_enum_isa_devices()
4381 /* Copy user configuration info to device instance data */ mgsl_enum_isa_devices()
4382 info->io_base = (unsigned int)io[i]; mgsl_enum_isa_devices()
4383 info->irq_level = (unsigned int)irq[i]; mgsl_enum_isa_devices()
4384 info->irq_level = irq_canonicalize(info->irq_level); mgsl_enum_isa_devices()
4385 info->dma_level = (unsigned int)dma[i]; mgsl_enum_isa_devices()
4386 info->bus_type = MGSL_BUS_TYPE_ISA; mgsl_enum_isa_devices()
4387 info->io_addr_size = 16; mgsl_enum_isa_devices()
4388 info->irq_flags = 0; mgsl_enum_isa_devices()
4390 mgsl_add_device( info ); mgsl_enum_isa_devices()
4397 struct mgsl_struct *info; synclink_cleanup() local
4410 info = mgsl_device_list; synclink_cleanup()
4411 while(info) { synclink_cleanup()
4413 hdlcdev_exit(info); synclink_cleanup()
4415 mgsl_release_resources(info); synclink_cleanup()
4416 tmp = info; synclink_cleanup()
4417 info = info->next_device; synclink_cleanup()
4475 * info pointer to device information structure
4482 static void usc_RTCmd( struct mgsl_struct *info, u16 Cmd ) usc_RTCmd() argument
4487 outw( Cmd + info->loopback_bits, info->io_base + CCAR ); usc_RTCmd()
4490 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_RTCmd()
4491 inw( info->io_base + CCAR ); usc_RTCmd()
4502 * info pointer to device information structure
4509 static void usc_DmaCmd( struct mgsl_struct *info, u16 Cmd ) usc_DmaCmd() argument
4512 outw( Cmd + info->mbre_bit, info->io_base ); usc_DmaCmd()
4515 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_DmaCmd()
4516 inw( info->io_base ); usc_DmaCmd()
4527 * info pointer to device info structure
4536 static void usc_OutDmaReg( struct mgsl_struct *info, u16 RegAddr, u16 RegValue ) usc_OutDmaReg() argument
4541 outw( RegAddr + info->mbre_bit, info->io_base ); usc_OutDmaReg()
4542 outw( RegValue, info->io_base ); usc_OutDmaReg()
4545 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_OutDmaReg()
4546 inw( info->io_base ); usc_OutDmaReg()
4557 * info pointer to device info structure
4565 static u16 usc_InDmaReg( struct mgsl_struct *info, u16 RegAddr ) usc_InDmaReg() argument
4570 outw( RegAddr + info->mbre_bit, info->io_base ); usc_InDmaReg()
4571 return inw( info->io_base ); usc_InDmaReg()
4583 * info pointer to device info structure
4592 static void usc_OutReg( struct mgsl_struct *info, u16 RegAddr, u16 RegValue ) usc_OutReg() argument
4594 outw( RegAddr + info->loopback_bits, info->io_base + CCAR ); usc_OutReg()
4595 outw( RegValue, info->io_base + CCAR ); usc_OutReg()
4598 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_OutReg()
4599 inw( info->io_base + CCAR ); usc_OutReg()
4610 * info pointer to device extension
4617 static u16 usc_InReg( struct mgsl_struct *info, u16 RegAddr ) usc_InReg() argument
4619 outw( RegAddr + info->loopback_bits, info->io_base + CCAR ); usc_InReg()
4620 return inw( info->io_base + CCAR ); usc_InReg()
4628 * Arguments: info pointer to device instance data
4631 static void usc_set_sdlc_mode( struct mgsl_struct *info ) usc_set_sdlc_mode()
4645 usc_OutReg(info,TMCR,0x1f); usc_set_sdlc_mode()
4646 RegValue=usc_InReg(info,TMDR); usc_set_sdlc_mode()
4649 if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) usc_set_sdlc_mode()
4683 if (info->params.mode == MGSL_MODE_RAW) { usc_set_sdlc_mode()
4686 usc_OutReg( info, IOCR, /* Set IOCR DCD is RxSync Detect Input */ usc_set_sdlc_mode()
4687 (unsigned short)((usc_InReg(info, IOCR) & ~(BIT13|BIT12)) | BIT12)); usc_set_sdlc_mode()
4707 if ( info->params.flags & HDLC_FLAG_UNDERRUN_ABORT15 ) usc_set_sdlc_mode()
4709 else if ( info->params.flags & HDLC_FLAG_UNDERRUN_FLAG ) usc_set_sdlc_mode()
4711 else if ( info->params.flags & HDLC_FLAG_UNDERRUN_CRC ) usc_set_sdlc_mode()
4715 if ( info->params.preamble != HDLC_PREAMBLE_PATTERN_NONE ) usc_set_sdlc_mode()
4719 if ( info->params.mode == MGSL_MODE_HDLC && usc_set_sdlc_mode()
4720 (info->params.flags & HDLC_FLAG_SHARE_ZERO) ) usc_set_sdlc_mode()
4723 if ( info->params.addr_filter != 0xff ) usc_set_sdlc_mode()
4726 usc_OutReg( info, RSR, info->params.addr_filter ); usc_set_sdlc_mode()
4730 usc_OutReg( info, CMR, RegValue ); usc_set_sdlc_mode()
4731 info->cmr_value = RegValue; usc_set_sdlc_mode()
4750 switch ( info->params.encoding ) { usc_set_sdlc_mode()
4760 if ( (info->params.crc_type & HDLC_CRC_MASK) == HDLC_CRC_16_CCITT ) usc_set_sdlc_mode()
4762 else if ( (info->params.crc_type & HDLC_CRC_MASK) == HDLC_CRC_32_CCITT ) usc_set_sdlc_mode()
4765 usc_OutReg( info, RMR, RegValue ); usc_set_sdlc_mode()
4774 usc_OutReg( info, RCLR, RCLRVALUE ); usc_set_sdlc_mode()
4776 usc_RCmd( info, RCmd_SelectRicrdma_level ); usc_set_sdlc_mode()
4796 RegValue = usc_InReg( info, RICR ) & 0xc0; usc_set_sdlc_mode()
4798 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_set_sdlc_mode()
4799 usc_OutReg( info, RICR, (u16)(0x030a | RegValue) ); usc_set_sdlc_mode()
4801 usc_OutReg( info, RICR, (u16)(0x140a | RegValue) ); usc_set_sdlc_mode()
4805 usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_set_sdlc_mode()
4806 usc_ClearIrqPendingBits( info, RECEIVE_STATUS ); usc_set_sdlc_mode()
4825 switch ( info->params.encoding ) { usc_set_sdlc_mode()
4835 if ( (info->params.crc_type & HDLC_CRC_MASK) == HDLC_CRC_16_CCITT ) usc_set_sdlc_mode()
4837 else if ( (info->params.crc_type & HDLC_CRC_MASK) == HDLC_CRC_32_CCITT ) usc_set_sdlc_mode()
4840 usc_OutReg( info, TMR, RegValue ); usc_set_sdlc_mode()
4842 usc_set_txidle( info ); usc_set_sdlc_mode()
4845 usc_TCmd( info, TCmd_SelectTicrdma_level ); usc_set_sdlc_mode()
4862 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_set_sdlc_mode()
4863 usc_OutReg( info, TICR, 0x0736 ); usc_set_sdlc_mode()
4865 usc_OutReg( info, TICR, 0x1436 ); usc_set_sdlc_mode()
4867 usc_UnlatchTxstatusBits( info, TXSTATUS_ALL ); usc_set_sdlc_mode()
4868 usc_ClearIrqPendingBits( info, TRANSMIT_STATUS ); usc_set_sdlc_mode()
4887 info->tcsr_value = 0; usc_set_sdlc_mode()
4890 info->tcsr_value |= TCSR_UNDERWAIT; usc_set_sdlc_mode()
4892 usc_OutReg( info, TCSR, info->tcsr_value ); usc_set_sdlc_mode()
4909 if ( info->params.flags & HDLC_FLAG_RXC_DPLL ) usc_set_sdlc_mode()
4911 else if ( info->params.flags & HDLC_FLAG_RXC_BRG ) usc_set_sdlc_mode()
4913 else if ( info->params.flags & HDLC_FLAG_RXC_TXCPIN) usc_set_sdlc_mode()
4918 if ( info->params.flags & HDLC_FLAG_TXC_DPLL ) usc_set_sdlc_mode()
4920 else if ( info->params.flags & HDLC_FLAG_TXC_BRG ) usc_set_sdlc_mode()
4922 else if ( info->params.flags & HDLC_FLAG_TXC_RXCPIN) usc_set_sdlc_mode()
4927 usc_OutReg( info, CMCR, RegValue ); usc_set_sdlc_mode()
4947 if ( info->params.flags & (HDLC_FLAG_RXC_DPLL | HDLC_FLAG_TXC_DPLL) ) { usc_set_sdlc_mode()
4955 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_set_sdlc_mode()
4960 if ( info->params.flags & HDLC_FLAG_DPLL_DIV16 ) { usc_set_sdlc_mode()
4964 else if ( info->params.flags & HDLC_FLAG_DPLL_DIV8 ) { usc_set_sdlc_mode()
4985 if ( info->params.clock_speed ) usc_set_sdlc_mode()
4987 Tc = (u16)((XtalSpeed/DpllDivisor)/info->params.clock_speed); usc_set_sdlc_mode()
4988 if ( !((((XtalSpeed/DpllDivisor) % info->params.clock_speed) * 2) usc_set_sdlc_mode()
4989 / info->params.clock_speed) ) usc_set_sdlc_mode()
4997 usc_OutReg( info, TC1R, Tc ); usc_set_sdlc_mode()
5001 switch ( info->params.encoding ) { usc_set_sdlc_mode()
5013 usc_OutReg( info, HCR, RegValue ); usc_set_sdlc_mode()
5034 usc_OutReg( info, CCSR, 0x1020 ); usc_set_sdlc_mode()
5037 if ( info->params.flags & HDLC_FLAG_AUTO_CTS ) { usc_set_sdlc_mode()
5038 usc_OutReg( info, SICR, usc_set_sdlc_mode()
5039 (u16)(usc_InReg(info,SICR) | SICR_CTS_INACTIVE) ); usc_set_sdlc_mode()
5044 usc_EnableMasterIrqBit( info ); usc_set_sdlc_mode()
5046 usc_ClearIrqPendingBits( info, RECEIVE_STATUS | RECEIVE_DATA | usc_set_sdlc_mode()
5050 usc_OutReg(info, SICR, (u16)(usc_InReg(info,SICR) | BIT3)); usc_set_sdlc_mode()
5051 usc_EnableInterrupts(info, MISC); usc_set_sdlc_mode()
5053 info->mbre_bit = 0; usc_set_sdlc_mode()
5054 outw( 0, info->io_base ); /* clear Master Bus Enable (DCAR) */ usc_set_sdlc_mode()
5055 usc_DmaCmd( info, DmaCmd_ResetAllChannels ); /* disable both DMA channels */ usc_set_sdlc_mode()
5056 info->mbre_bit = BIT8; usc_set_sdlc_mode()
5057 outw( BIT8, info->io_base ); /* set Master Bus Enable (DCAR) */ usc_set_sdlc_mode()
5059 if (info->bus_type == MGSL_BUS_TYPE_ISA) { usc_set_sdlc_mode()
5062 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT15) & ~BIT14)); usc_set_sdlc_mode()
5087 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { usc_set_sdlc_mode()
5089 usc_OutDmaReg( info, DCR, 0xa00b ); usc_set_sdlc_mode()
5092 usc_OutDmaReg( info, DCR, 0x800b ); usc_set_sdlc_mode()
5108 usc_OutDmaReg( info, RDMR, 0xf200 ); usc_set_sdlc_mode()
5124 usc_OutDmaReg( info, TDMR, 0xf200 ); usc_set_sdlc_mode()
5140 usc_OutDmaReg( info, DICR, 0x9000 ); usc_set_sdlc_mode()
5142 usc_InDmaReg( info, RDMR ); /* clear pending receive DMA IRQ bits */ usc_set_sdlc_mode()
5143 usc_InDmaReg( info, TDMR ); /* clear pending transmit DMA IRQ bits */ usc_set_sdlc_mode()
5144 usc_OutDmaReg( info, CDIR, 0x0303 ); /* clear IUS and Pending for Tx and Rx */ usc_set_sdlc_mode()
5162 switch ( info->params.preamble_length ) { usc_set_sdlc_mode()
5168 switch ( info->params.preamble ) { usc_set_sdlc_mode()
5175 usc_OutReg( info, CCR, RegValue ); usc_set_sdlc_mode()
5185 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { usc_set_sdlc_mode()
5187 usc_OutDmaReg( info, BDCR, 0x0000 ); usc_set_sdlc_mode()
5190 usc_OutDmaReg( info, BDCR, 0x2000 ); usc_set_sdlc_mode()
5192 usc_stop_transmitter(info); usc_set_sdlc_mode()
5193 usc_stop_receiver(info); usc_set_sdlc_mode()
5203 * Arguments: info pointer to device instance data
5207 static void usc_enable_loopback(struct mgsl_struct *info, int enable) usc_enable_loopback() argument
5211 usc_OutReg(info,IOCR,usc_InReg(info,IOCR) | (BIT7 | BIT6)); usc_enable_loopback()
5226 usc_OutReg( info, CMCR, 0x0f64 ); usc_enable_loopback()
5230 if (info->params.clock_speed) { usc_enable_loopback()
5231 if (info->bus_type == MGSL_BUS_TYPE_PCI) usc_enable_loopback()
5232 usc_OutReg(info, TC0R, (u16)((11059200/info->params.clock_speed)-1)); usc_enable_loopback()
5234 usc_OutReg(info, TC0R, (u16)((14745600/info->params.clock_speed)-1)); usc_enable_loopback()
5236 usc_OutReg(info, TC0R, (u16)8); usc_enable_loopback()
5240 usc_OutReg( info, HCR, (u16)((usc_InReg( info, HCR ) & ~BIT1) | BIT0) ); usc_enable_loopback()
5243 usc_OutReg(info, IOCR, (u16)((usc_InReg(info, IOCR) & 0xfff8) | 0x0004)); usc_enable_loopback()
5246 info->loopback_bits = 0x300; usc_enable_loopback()
5247 outw( 0x0300, info->io_base + CCAR ); usc_enable_loopback()
5250 usc_OutReg(info,IOCR,usc_InReg(info,IOCR) & ~(BIT7 | BIT6)); usc_enable_loopback()
5253 info->loopback_bits = 0; usc_enable_loopback()
5254 outw( 0,info->io_base + CCAR ); usc_enable_loopback()
5265 * info pointer to device extension
5271 static void usc_enable_aux_clock( struct mgsl_struct *info, u32 data_rate ) usc_enable_aux_clock() argument
5277 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_enable_aux_clock()
5295 usc_OutReg( info, TC0R, Tc ); usc_enable_aux_clock()
5303 usc_OutReg( info, HCR, (u16)((usc_InReg( info, HCR ) & ~BIT1) | BIT0) ); usc_enable_aux_clock()
5306 usc_OutReg( info, IOCR, (u16)((usc_InReg(info, IOCR) & 0xfff8) | 0x0004) ); usc_enable_aux_clock()
5309 usc_OutReg( info, HCR, (u16)(usc_InReg( info, HCR ) & ~BIT0) ); usc_enable_aux_clock()
5324 * info pointer to device extension
5328 static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) usc_process_rxoverrun_sync()
5337 DMABUFFERENTRY *buffer_list = info->rx_buffer_list; usc_process_rxoverrun_sync()
5340 usc_DmaCmd( info, DmaCmd_PauseRxChannel ); usc_process_rxoverrun_sync()
5341 usc_RCmd( info, RCmd_EnterHuntmode ); usc_process_rxoverrun_sync()
5342 usc_RTCmd( info, RTCmd_PurgeRxFifo ); usc_process_rxoverrun_sync()
5347 frame_start_index = start_index = end_index = info->current_rx_buffer; usc_process_rxoverrun_sync()
5380 if ( end_index == info->rx_buffer_count ) usc_process_rxoverrun_sync()
5388 mgsl_reset_rx_dma_buffers( info ); usc_process_rxoverrun_sync()
5409 *((unsigned long *)&(info->rx_buffer_list[start_index++].count)) = DMABUFFERSIZE; usc_process_rxoverrun_sync()
5412 if ( start_index == info->rx_buffer_count ) usc_process_rxoverrun_sync()
5422 usc_UnlatchRxstatusBits(info,RXSTATUS_ALL); usc_process_rxoverrun_sync()
5423 usc_ClearIrqPendingBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_process_rxoverrun_sync()
5424 usc_UnlatchRxstatusBits(info, RECEIVE_DATA|RECEIVE_STATUS); usc_process_rxoverrun_sync()
5426 usc_EnableReceiver(info,DISABLE_UNCONDITIONAL); usc_process_rxoverrun_sync()
5429 usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); usc_process_rxoverrun_sync()
5432 phys_addr = info->rx_buffer_list[frame_start_index].phys_entry; usc_process_rxoverrun_sync()
5433 usc_OutDmaReg( info, NRARL, (u16)phys_addr ); usc_process_rxoverrun_sync()
5434 usc_OutDmaReg( info, NRARU, (u16)(phys_addr >> 16) ); usc_process_rxoverrun_sync()
5436 usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_process_rxoverrun_sync()
5437 usc_ClearIrqPendingBits( info, RECEIVE_DATA | RECEIVE_STATUS ); usc_process_rxoverrun_sync()
5438 usc_EnableInterrupts( info, RECEIVE_STATUS ); usc_process_rxoverrun_sync()
5443 usc_OutDmaReg( info, RDIAR, BIT3 | BIT2 ); usc_process_rxoverrun_sync()
5444 usc_OutDmaReg( info, DICR, (u16)(usc_InDmaReg(info,DICR) | BIT1) ); usc_process_rxoverrun_sync()
5445 usc_DmaCmd( info, DmaCmd_InitRxChannel ); usc_process_rxoverrun_sync()
5446 if ( info->params.flags & HDLC_FLAG_AUTO_DCD ) usc_process_rxoverrun_sync()
5447 usc_EnableReceiver(info,ENABLE_AUTO_DCD); usc_process_rxoverrun_sync()
5449 usc_EnableReceiver(info,ENABLE_UNCONDITIONAL); usc_process_rxoverrun_sync()
5454 usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); usc_process_rxoverrun_sync()
5455 usc_RTCmd( info, RTCmd_PurgeRxFifo ); usc_process_rxoverrun_sync()
5464 * Arguments: info pointer to device instance data
5467 static void usc_stop_receiver( struct mgsl_struct *info ) usc_stop_receiver()
5471 __FILE__,__LINE__, info->device_name ); usc_stop_receiver()
5475 usc_DmaCmd( info, DmaCmd_ResetRxChannel ); usc_stop_receiver()
5477 usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_stop_receiver()
5478 usc_ClearIrqPendingBits( info, RECEIVE_DATA | RECEIVE_STATUS ); usc_stop_receiver()
5479 usc_DisableInterrupts( info, RECEIVE_DATA | RECEIVE_STATUS ); usc_stop_receiver()
5481 usc_EnableReceiver(info,DISABLE_UNCONDITIONAL); usc_stop_receiver()
5484 usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); usc_stop_receiver()
5485 usc_RTCmd( info, RTCmd_PurgeRxFifo ); usc_stop_receiver()
5487 info->rx_enabled = false; usc_stop_receiver()
5488 info->rx_overflow = false; usc_stop_receiver()
5489 info->rx_rcc_underrun = false; usc_stop_receiver()
5497 * Arguments: info pointer to device instance data
5500 static void usc_start_receiver( struct mgsl_struct *info ) usc_start_receiver()
5506 __FILE__,__LINE__, info->device_name ); usc_start_receiver()
5508 mgsl_reset_rx_dma_buffers( info ); usc_start_receiver()
5509 usc_stop_receiver( info ); usc_start_receiver()
5511 usc_OutReg( info, CCSR, (u16)(usc_InReg(info,CCSR) | BIT13) ); usc_start_receiver()
5512 usc_RTCmd( info, RTCmd_PurgeRxFifo ); usc_start_receiver()
5514 if ( info->params.mode == MGSL_MODE_HDLC || usc_start_receiver()
5515 info->params.mode == MGSL_MODE_RAW ) { usc_start_receiver()
5521 phys_addr = info->rx_buffer_list[0].phys_entry; usc_start_receiver()
5522 usc_OutDmaReg( info, NRARL, (u16)phys_addr ); usc_start_receiver()
5523 usc_OutDmaReg( info, NRARU, (u16)(phys_addr >> 16) ); usc_start_receiver()
5525 usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_start_receiver()
5526 usc_ClearIrqPendingBits( info, RECEIVE_DATA | RECEIVE_STATUS ); usc_start_receiver()
5527 usc_EnableInterrupts( info, RECEIVE_STATUS ); usc_start_receiver()
5532 usc_OutDmaReg( info, RDIAR, BIT3 | BIT2 ); usc_start_receiver()
5533 usc_OutDmaReg( info, DICR, (u16)(usc_InDmaReg(info,DICR) | BIT1) ); usc_start_receiver()
5534 usc_DmaCmd( info, DmaCmd_InitRxChannel ); usc_start_receiver()
5535 if ( info->params.flags & HDLC_FLAG_AUTO_DCD ) usc_start_receiver()
5536 usc_EnableReceiver(info,ENABLE_AUTO_DCD); usc_start_receiver()
5538 usc_EnableReceiver(info,ENABLE_UNCONDITIONAL); usc_start_receiver()
5540 usc_UnlatchRxstatusBits(info, RXSTATUS_ALL); usc_start_receiver()
5541 usc_ClearIrqPendingBits(info, RECEIVE_DATA | RECEIVE_STATUS); usc_start_receiver()
5542 usc_EnableInterrupts(info, RECEIVE_DATA); usc_start_receiver()
5544 usc_RTCmd( info, RTCmd_PurgeRxFifo ); usc_start_receiver()
5545 usc_RCmd( info, RCmd_EnterHuntmode ); usc_start_receiver()
5547 usc_EnableReceiver(info,ENABLE_UNCONDITIONAL); usc_start_receiver()
5550 usc_OutReg( info, CCSR, 0x1020 ); usc_start_receiver()
5552 info->rx_enabled = true; usc_start_receiver()
5561 * Arguments: info pointer to device instance data
5564 static void usc_start_transmitter( struct mgsl_struct *info ) usc_start_transmitter()
5571 __FILE__,__LINE__, info->device_name ); usc_start_transmitter()
5573 if ( info->xmit_cnt ) { usc_start_transmitter()
5579 info->drop_rts_on_tx_done = false; usc_start_transmitter()
5581 if ( info->params.flags & HDLC_FLAG_AUTO_RTS ) { usc_start_transmitter()
5582 usc_get_serial_signals( info ); usc_start_transmitter()
5583 if ( !(info->serial_signals & SerialSignal_RTS) ) { usc_start_transmitter()
5584 info->serial_signals |= SerialSignal_RTS; usc_start_transmitter()
5585 usc_set_serial_signals( info ); usc_start_transmitter()
5586 info->drop_rts_on_tx_done = true; usc_start_transmitter()
5591 if ( info->params.mode == MGSL_MODE_ASYNC ) { usc_start_transmitter()
5592 if ( !info->tx_active ) { usc_start_transmitter()
5593 usc_UnlatchTxstatusBits(info, TXSTATUS_ALL); usc_start_transmitter()
5594 usc_ClearIrqPendingBits(info, TRANSMIT_STATUS + TRANSMIT_DATA); usc_start_transmitter()
5595 usc_EnableInterrupts(info, TRANSMIT_DATA); usc_start_transmitter()
5596 usc_load_txfifo(info); usc_start_transmitter()
5600 usc_DmaCmd( info, DmaCmd_ResetTxChannel ); usc_start_transmitter()
5605 FrameSize = info->tx_buffer_list[info->start_tx_dma_buffer].rcc; usc_start_transmitter()
5611 if ( info->params.mode == MGSL_MODE_RAW ) usc_start_transmitter()
5612 info->tx_buffer_list[info->start_tx_dma_buffer].rcc = 0; usc_start_transmitter()
5616 usc_OutReg( info, TCLR, (u16)FrameSize ); usc_start_transmitter()
5618 usc_RTCmd( info, RTCmd_PurgeTxFifo ); usc_start_transmitter()
5621 phys_addr = info->tx_buffer_list[info->start_tx_dma_buffer].phys_entry; usc_start_transmitter()
5622 usc_OutDmaReg( info, NTARL, (u16)phys_addr ); usc_start_transmitter()
5623 usc_OutDmaReg( info, NTARU, (u16)(phys_addr >> 16) ); usc_start_transmitter()
5625 usc_UnlatchTxstatusBits( info, TXSTATUS_ALL ); usc_start_transmitter()
5626 usc_ClearIrqPendingBits( info, TRANSMIT_STATUS ); usc_start_transmitter()
5627 usc_EnableInterrupts( info, TRANSMIT_STATUS ); usc_start_transmitter()
5629 if ( info->params.mode == MGSL_MODE_RAW && usc_start_transmitter()
5630 info->num_tx_dma_buffers > 1 ) { usc_start_transmitter()
5638 usc_OutDmaReg( info, TDIAR, BIT2|BIT3 ); usc_start_transmitter()
5639 usc_OutDmaReg( info, DICR, (u16)(usc_InDmaReg(info,DICR) | BIT0) ); usc_start_transmitter()
5643 usc_DmaCmd( info, DmaCmd_InitTxChannel ); usc_start_transmitter()
5645 usc_TCmd( info, TCmd_SendFrame ); usc_start_transmitter()
5647 mod_timer(&info->tx_timer, jiffies + usc_start_transmitter()
5650 info->tx_active = true; usc_start_transmitter()
5653 if ( !info->tx_enabled ) { usc_start_transmitter()
5654 info->tx_enabled = true; usc_start_transmitter()
5655 if ( info->params.flags & HDLC_FLAG_AUTO_CTS ) usc_start_transmitter()
5656 usc_EnableTransmitter(info,ENABLE_AUTO_CTS); usc_start_transmitter()
5658 usc_EnableTransmitter(info,ENABLE_UNCONDITIONAL); usc_start_transmitter()
5667 * Arguments: info pointer to device isntance data
5670 static void usc_stop_transmitter( struct mgsl_struct *info ) usc_stop_transmitter()
5674 __FILE__,__LINE__, info->device_name ); usc_stop_transmitter()
5676 del_timer(&info->tx_timer); usc_stop_transmitter()
5678 usc_UnlatchTxstatusBits( info, TXSTATUS_ALL ); usc_stop_transmitter()
5679 usc_ClearIrqPendingBits( info, TRANSMIT_STATUS + TRANSMIT_DATA ); usc_stop_transmitter()
5680 usc_DisableInterrupts( info, TRANSMIT_STATUS + TRANSMIT_DATA ); usc_stop_transmitter()
5682 usc_EnableTransmitter(info,DISABLE_UNCONDITIONAL); usc_stop_transmitter()
5683 usc_DmaCmd( info, DmaCmd_ResetTxChannel ); usc_stop_transmitter()
5684 usc_RTCmd( info, RTCmd_PurgeTxFifo ); usc_stop_transmitter()
5686 info->tx_enabled = false; usc_stop_transmitter()
5687 info->tx_active = false; usc_stop_transmitter()
5696 * Arguments: info pointer to device extension (instance data)
5699 static void usc_load_txfifo( struct mgsl_struct *info ) usc_load_txfifo()
5704 if ( !info->xmit_cnt && !info->x_char ) usc_load_txfifo()
5708 usc_TCmd( info, TCmd_SelectTicrTxFifostatus ); usc_load_txfifo()
5712 while( (Fifocount = usc_InReg(info, TICR) >> 8) && info->xmit_cnt ) { usc_load_txfifo()
5716 if ( (info->xmit_cnt > 1) && (Fifocount > 1) && !info->x_char ) { usc_load_txfifo()
5719 TwoBytes[0] = info->xmit_buf[info->xmit_tail++]; usc_load_txfifo()
5720 info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); usc_load_txfifo()
5721 TwoBytes[1] = info->xmit_buf[info->xmit_tail++]; usc_load_txfifo()
5722 info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); usc_load_txfifo()
5724 outw( *((u16 *)TwoBytes), info->io_base + DATAREG); usc_load_txfifo()
5726 info->xmit_cnt -= 2; usc_load_txfifo()
5727 info->icount.tx += 2; usc_load_txfifo()
5731 outw( (inw( info->io_base + CCAR) & 0x0780) | (TDR+LSBONLY), usc_load_txfifo()
5732 info->io_base + CCAR ); usc_load_txfifo()
5734 if (info->x_char) { usc_load_txfifo()
5736 outw( info->x_char,info->io_base + CCAR ); usc_load_txfifo()
5737 info->x_char = 0; usc_load_txfifo()
5739 outw( info->xmit_buf[info->xmit_tail++],info->io_base + CCAR ); usc_load_txfifo()
5740 info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); usc_load_txfifo()
5741 info->xmit_cnt--; usc_load_txfifo()
5743 info->icount.tx++; usc_load_txfifo()
5753 * Arguments: info pointer to device instance data
5756 static void usc_reset( struct mgsl_struct *info ) usc_reset()
5758 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) { usc_reset()
5765 volatile u32 *MiscCtrl = (u32 *)(info->lcr_base + 0x50); usc_reset()
5766 u32 *LCR0BRDR = (u32 *)(info->lcr_base + 0x28); usc_reset()
5768 info->misc_ctrl_value |= BIT30; usc_reset()
5769 *MiscCtrl = info->misc_ctrl_value; usc_reset()
5779 info->misc_ctrl_value &= ~BIT30; usc_reset()
5780 *MiscCtrl = info->misc_ctrl_value; usc_reset()
5794 outb( 0,info->io_base + 8 ); usc_reset()
5797 info->mbre_bit = 0; usc_reset()
5798 info->loopback_bits = 0; usc_reset()
5799 info->usc_idle_mode = 0; usc_reset()
5818 outw( 0x000c,info->io_base + SDPIN ); usc_reset()
5821 outw( 0,info->io_base ); usc_reset()
5822 outw( 0,info->io_base + CCAR ); usc_reset()
5825 usc_RTCmd( info, RTCmd_SelectLittleEndian ); usc_reset()
5842 usc_OutReg( info, PCR, 0xf0f5 ); usc_reset()
5859 usc_OutReg( info, IOCR, 0x0004 ); usc_reset()
5867 * Arguments: info pointer to device instance data
5870 static void usc_set_async_mode( struct mgsl_struct *info ) usc_set_async_mode()
5875 usc_DisableMasterIrqBit( info ); usc_set_async_mode()
5877 outw( 0, info->io_base ); /* clear Master Bus Enable (DCAR) */ usc_set_async_mode()
5878 usc_DmaCmd( info, DmaCmd_ResetAllChannels ); /* disable both DMA channels */ usc_set_async_mode()
5880 usc_loopback_frame( info ); usc_set_async_mode()
5895 if ( info->params.stop_bits != 1 ) usc_set_async_mode()
5897 usc_OutReg( info, CMR, RegValue ); usc_set_async_mode()
5914 if ( info->params.data_bits != 8 ) usc_set_async_mode()
5917 if ( info->params.parity != ASYNC_PARITY_NONE ) { usc_set_async_mode()
5919 if ( info->params.parity != ASYNC_PARITY_ODD ) usc_set_async_mode()
5923 usc_OutReg( info, RMR, RegValue ); usc_set_async_mode()
5928 usc_RCmd( info, RCmd_SelectRicrIntLevel ); usc_set_async_mode()
5951 usc_OutReg( info, RICR, 0x0000 ); usc_set_async_mode()
5953 usc_UnlatchRxstatusBits( info, RXSTATUS_ALL ); usc_set_async_mode()
5954 usc_ClearIrqPendingBits( info, RECEIVE_STATUS ); usc_set_async_mode()
5971 if ( info->params.data_bits != 8 ) usc_set_async_mode()
5974 if ( info->params.parity != ASYNC_PARITY_NONE ) { usc_set_async_mode()
5976 if ( info->params.parity != ASYNC_PARITY_ODD ) usc_set_async_mode()
5980 usc_OutReg( info, TMR, RegValue ); usc_set_async_mode()
5982 usc_set_txidle( info ); usc_set_async_mode()
5987 usc_TCmd( info, TCmd_SelectTicrIntLevel ); usc_set_async_mode()
6005 usc_OutReg( info, TICR, 0x1f40 ); usc_set_async_mode()
6007 usc_UnlatchTxstatusBits( info, TXSTATUS_ALL ); usc_set_async_mode()
6008 usc_ClearIrqPendingBits( info, TRANSMIT_STATUS ); usc_set_async_mode()
6010 usc_enable_async_clock( info, info->params.data_rate ); usc_set_async_mode()
6031 usc_OutReg( info, CCSR, 0x0020 ); usc_set_async_mode()
6033 usc_DisableInterrupts( info, TRANSMIT_STATUS + TRANSMIT_DATA + usc_set_async_mode()
6036 usc_ClearIrqPendingBits( info, TRANSMIT_STATUS + TRANSMIT_DATA + usc_set_async_mode()
6039 usc_EnableMasterIrqBit( info ); usc_set_async_mode()
6041 if (info->bus_type == MGSL_BUS_TYPE_ISA) { usc_set_async_mode()
6044 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) & ~BIT12)); usc_set_async_mode()
6047 if (info->params.loopback) { usc_set_async_mode()
6048 info->loopback_bits = 0x300; usc_set_async_mode()
6049 outw(0x0300, info->io_base + CCAR); usc_set_async_mode()
6058 * clear any 'stale' status info left over from running in async mode.
6065 * Arguments: info pointer to device instance data
6068 static void usc_loopback_frame( struct mgsl_struct *info ) usc_loopback_frame()
6071 unsigned long oldmode = info->params.mode; usc_loopback_frame()
6073 info->params.mode = MGSL_MODE_HDLC; usc_loopback_frame()
6075 usc_DisableMasterIrqBit( info ); usc_loopback_frame()
6077 usc_set_sdlc_mode( info ); usc_loopback_frame()
6078 usc_enable_loopback( info, 1 ); usc_loopback_frame()
6081 usc_OutReg( info, TC0R, 0 ); usc_loopback_frame()
6097 usc_OutReg( info, CCR, 0x0100 ); usc_loopback_frame()
6100 usc_RTCmd( info, RTCmd_PurgeRxFifo ); usc_loopback_frame()
6101 usc_EnableReceiver(info,ENABLE_UNCONDITIONAL); usc_loopback_frame()
6106 usc_OutReg( info, TCLR, 2 ); usc_loopback_frame()
6107 usc_RTCmd( info, RTCmd_PurgeTxFifo ); usc_loopback_frame()
6110 usc_UnlatchTxstatusBits(info,TXSTATUS_ALL); usc_loopback_frame()
6111 outw(0,info->io_base + DATAREG); usc_loopback_frame()
6114 usc_TCmd( info, TCmd_SendFrame ); usc_loopback_frame()
6115 usc_EnableTransmitter(info,ENABLE_UNCONDITIONAL); usc_loopback_frame()
6119 if (usc_InReg( info, RCSR ) & (BIT8 | BIT4 | BIT3 | BIT1)) usc_loopback_frame()
6123 usc_enable_loopback(info, 0); usc_loopback_frame()
6125 usc_EnableMasterIrqBit(info); usc_loopback_frame()
6127 info->params.mode = oldmode; usc_loopback_frame()
6133 * Arguments: info pointer to adapter info structure
6136 static void usc_set_sync_mode( struct mgsl_struct *info ) usc_set_sync_mode()
6138 usc_loopback_frame( info ); usc_set_sync_mode()
6139 usc_set_sdlc_mode( info ); usc_set_sync_mode()
6141 if (info->bus_type == MGSL_BUS_TYPE_ISA) { usc_set_sync_mode()
6144 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) & ~BIT12)); usc_set_sync_mode()
6147 usc_enable_aux_clock(info, info->params.clock_speed); usc_set_sync_mode()
6149 if (info->params.loopback) usc_set_sync_mode()
6150 usc_enable_loopback(info,1); usc_set_sync_mode()
6156 * Arguments: info pointer to device instance data
6159 static void usc_set_txidle( struct mgsl_struct *info ) usc_set_txidle()
6165 switch( info->idle_mode ){ usc_set_txidle()
6175 info->usc_idle_mode = usc_idle_mode; usc_set_txidle()
6176 //usc_OutReg(info, TCSR, usc_idle_mode); usc_set_txidle()
6177 info->tcsr_value &= ~IDLEMODE_MASK; /* clear idle mode bits */ usc_set_txidle()
6178 info->tcsr_value += usc_idle_mode; usc_set_txidle()
6179 usc_OutReg(info, TCSR, info->tcsr_value); usc_set_txidle()
6188 if ( info->params.mode == MGSL_MODE_RAW ) { usc_set_txidle()
6190 switch( info->idle_mode ) { usc_set_txidle()
6210 usc_SetTransmitSyncChars(info,syncpat,syncpat); usc_set_txidle()
6219 * Arguments: info pointer to device instance data
6222 static void usc_get_serial_signals( struct mgsl_struct *info ) usc_get_serial_signals()
6227 info->serial_signals &= SerialSignal_RTS | SerialSignal_DTR; usc_get_serial_signals()
6232 status = usc_InReg( info, MISR ); usc_get_serial_signals()
6237 info->serial_signals |= SerialSignal_CTS; usc_get_serial_signals()
6240 info->serial_signals |= SerialSignal_DCD; usc_get_serial_signals()
6243 info->serial_signals |= SerialSignal_RI; usc_get_serial_signals()
6246 info->serial_signals |= SerialSignal_DSR; usc_get_serial_signals()
6255 * Arguments: info pointer to device instance data
6258 static void usc_set_serial_signals( struct mgsl_struct *info ) usc_set_serial_signals()
6261 unsigned char V24Out = info->serial_signals; usc_set_serial_signals()
6265 Control = usc_InReg( info, PCR ); usc_set_serial_signals()
6277 usc_OutReg( info, PCR, Control ); usc_set_serial_signals()
6285 * Arguments: info pointer to device instance data
6290 static void usc_enable_async_clock( struct mgsl_struct *info, u32 data_rate ) usc_enable_async_clock() argument
6307 usc_OutReg( info, CMCR, 0x0f64 ); usc_enable_async_clock()
6316 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) usc_enable_async_clock()
6317 usc_OutReg( info, TC0R, (u16)((691200/data_rate) - 1) ); usc_enable_async_clock()
6319 usc_OutReg( info, TC0R, (u16)((921600/data_rate) - 1) ); usc_enable_async_clock()
6328 usc_OutReg( info, HCR, usc_enable_async_clock()
6329 (u16)((usc_InReg( info, HCR ) & ~BIT1) | BIT0) ); usc_enable_async_clock()
6334 usc_OutReg( info, IOCR, usc_enable_async_clock()
6335 (u16)((usc_InReg(info, IOCR) & 0xfff8) | 0x0004) ); usc_enable_async_clock()
6338 usc_OutReg( info, HCR, (u16)(usc_InReg( info, HCR ) & ~BIT0) ); usc_enable_async_clock()
6397 * Arguments: info pointer to device instance data
6400 static void mgsl_reset_tx_dma_buffers( struct mgsl_struct *info ) mgsl_reset_tx_dma_buffers()
6404 for ( i = 0; i < info->tx_buffer_count; i++ ) { mgsl_reset_tx_dma_buffers()
6405 *((unsigned long *)&(info->tx_buffer_list[i].count)) = 0; mgsl_reset_tx_dma_buffers()
6408 info->current_tx_buffer = 0; mgsl_reset_tx_dma_buffers()
6409 info->start_tx_dma_buffer = 0; mgsl_reset_tx_dma_buffers()
6410 info->tx_dma_buffers_used = 0; mgsl_reset_tx_dma_buffers()
6412 info->get_tx_holding_index = 0; mgsl_reset_tx_dma_buffers()
6413 info->put_tx_holding_index = 0; mgsl_reset_tx_dma_buffers()
6414 info->tx_holding_count = 0; mgsl_reset_tx_dma_buffers()
6423 * Arguments: info pointer to device instance data
6426 static int num_free_tx_dma_buffers(struct mgsl_struct *info) num_free_tx_dma_buffers() argument
6428 return info->tx_buffer_count - info->tx_dma_buffers_used; num_free_tx_dma_buffers()
6438 * Arguments: info pointer to device instance data
6441 static void mgsl_reset_rx_dma_buffers( struct mgsl_struct *info ) mgsl_reset_rx_dma_buffers()
6445 for ( i = 0; i < info->rx_buffer_count; i++ ) { mgsl_reset_rx_dma_buffers()
6446 *((unsigned long *)&(info->rx_buffer_list[i].count)) = DMABUFFERSIZE; mgsl_reset_rx_dma_buffers()
6447 // info->rx_buffer_list[i].count = DMABUFFERSIZE; mgsl_reset_rx_dma_buffers()
6448 // info->rx_buffer_list[i].status = 0; mgsl_reset_rx_dma_buffers()
6451 info->current_rx_buffer = 0; mgsl_reset_rx_dma_buffers()
6463 * info pointer to device instance data
6469 static void mgsl_free_rx_frame_buffers( struct mgsl_struct *info, unsigned int StartIndex, unsigned int EndIndex ) mgsl_free_rx_frame_buffers() argument
6481 pBufEntry = &(info->rx_buffer_list[Index]); mgsl_free_rx_frame_buffers()
6495 if ( Index == info->rx_buffer_count ) mgsl_free_rx_frame_buffers()
6500 info->current_rx_buffer = Index; mgsl_free_rx_frame_buffers()
6509 * Arguments: info pointer to device extension
6512 static bool mgsl_get_rx_frame(struct mgsl_struct *info) mgsl_get_rx_frame() argument
6520 struct tty_struct *tty = info->port.tty; mgsl_get_rx_frame()
6530 StartIndex = EndIndex = info->current_rx_buffer; mgsl_get_rx_frame()
6532 while( !info->rx_buffer_list[EndIndex].status ) { mgsl_get_rx_frame()
6540 if ( info->rx_buffer_list[EndIndex].count ) mgsl_get_rx_frame()
6545 if ( EndIndex == info->rx_buffer_count ) mgsl_get_rx_frame()
6555 if ( info->rx_enabled ){ mgsl_get_rx_frame()
6556 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_get_rx_frame()
6557 usc_start_receiver(info); mgsl_get_rx_frame()
6558 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_get_rx_frame()
6567 status = info->rx_buffer_list[EndIndex].status; mgsl_get_rx_frame()
6572 info->icount.rxshort++; mgsl_get_rx_frame()
6574 info->icount.rxabort++; mgsl_get_rx_frame()
6576 info->icount.rxover++; mgsl_get_rx_frame()
6578 info->icount.rxcrc++; mgsl_get_rx_frame()
6579 if ( info->params.crc_type & HDLC_CRC_RETURN_EX ) mgsl_get_rx_frame()
6585 info->netdev->stats.rx_errors++; mgsl_get_rx_frame()
6586 info->netdev->stats.rx_frame_errors++; mgsl_get_rx_frame()
6599 framesize = RCLRVALUE - info->rx_buffer_list[EndIndex].rcc; mgsl_get_rx_frame()
6602 if ( info->params.crc_type == HDLC_CRC_16_CCITT ) mgsl_get_rx_frame()
6604 else if ( info->params.crc_type == HDLC_CRC_32_CCITT ) mgsl_get_rx_frame()
6610 __FILE__,__LINE__,info->device_name,status,framesize); mgsl_get_rx_frame()
6613 mgsl_trace_block(info,info->rx_buffer_list[StartIndex].virt_addr, mgsl_get_rx_frame()
6617 if ( ( (info->params.crc_type & HDLC_CRC_RETURN_EX) && mgsl_get_rx_frame()
6618 ((framesize+1) > info->max_frame_size) ) || mgsl_get_rx_frame()
6619 (framesize > info->max_frame_size) ) mgsl_get_rx_frame()
6620 info->icount.rxlong++; mgsl_get_rx_frame()
6625 unsigned char *ptmp = info->intermediate_rxbuffer; mgsl_get_rx_frame()
6628 info->icount.rxok++; mgsl_get_rx_frame()
6637 pBufEntry = &(info->rx_buffer_list[index]); mgsl_get_rx_frame()
6642 if ( ++index == info->rx_buffer_count ) mgsl_get_rx_frame()
6646 if ( info->params.crc_type & HDLC_CRC_RETURN_EX ) { mgsl_get_rx_frame()
6654 __FILE__,__LINE__,info->device_name, mgsl_get_rx_frame()
6659 if (info->netcount) mgsl_get_rx_frame()
6660 hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); mgsl_get_rx_frame()
6663 ldisc_receive_buf(tty, info->intermediate_rxbuffer, info->flag_buf, framesize); mgsl_get_rx_frame()
6667 mgsl_free_rx_frame_buffers( info, StartIndex, EndIndex ); mgsl_get_rx_frame()
6673 if ( info->rx_enabled && info->rx_overflow ) { mgsl_get_rx_frame()
6679 if ( !info->rx_buffer_list[EndIndex].status && mgsl_get_rx_frame()
6680 info->rx_buffer_list[EndIndex].count ) { mgsl_get_rx_frame()
6681 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_get_rx_frame()
6682 usc_start_receiver(info); mgsl_get_rx_frame()
6683 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_get_rx_frame()
6707 * Arguments: info pointer to device extension
6710 static bool mgsl_get_raw_rx_frame(struct mgsl_struct *info) mgsl_get_raw_rx_frame() argument
6718 struct tty_struct *tty = info->port.tty; mgsl_get_raw_rx_frame()
6735 CurrentIndex = NextIndex = info->current_rx_buffer; mgsl_get_raw_rx_frame()
6737 if ( NextIndex == info->rx_buffer_count ) mgsl_get_raw_rx_frame()
6740 if ( info->rx_buffer_list[CurrentIndex].status != 0 || mgsl_get_raw_rx_frame()
6741 (info->rx_buffer_list[CurrentIndex].count == 0 && mgsl_get_raw_rx_frame()
6742 info->rx_buffer_list[NextIndex].count == 0)) { mgsl_get_raw_rx_frame()
6750 status = info->rx_buffer_list[CurrentIndex].status; mgsl_get_raw_rx_frame()
6755 info->icount.rxshort++; mgsl_get_raw_rx_frame()
6757 info->icount.rxabort++; mgsl_get_raw_rx_frame()
6759 info->icount.rxover++; mgsl_get_raw_rx_frame()
6761 info->icount.rxcrc++; mgsl_get_raw_rx_frame()
6799 if ( info->rx_buffer_list[CurrentIndex].rcc ) mgsl_get_raw_rx_frame()
6800 framesize = RCLRVALUE - info->rx_buffer_list[CurrentIndex].rcc; mgsl_get_raw_rx_frame()
6821 __FILE__,__LINE__,info->device_name,status,framesize); mgsl_get_raw_rx_frame()
6824 mgsl_trace_block(info,info->rx_buffer_list[CurrentIndex].virt_addr, mgsl_get_raw_rx_frame()
6831 pBufEntry = &(info->rx_buffer_list[CurrentIndex]); mgsl_get_raw_rx_frame()
6832 memcpy( info->intermediate_rxbuffer, pBufEntry->virt_addr, framesize); mgsl_get_raw_rx_frame()
6833 info->icount.rxok++; mgsl_get_raw_rx_frame()
6835 ldisc_receive_buf(tty, info->intermediate_rxbuffer, info->flag_buf, framesize); mgsl_get_raw_rx_frame()
6839 mgsl_free_rx_frame_buffers( info, CurrentIndex, CurrentIndex ); mgsl_get_raw_rx_frame()
6845 if ( info->rx_enabled && info->rx_overflow ) { mgsl_get_raw_rx_frame()
6851 if ( !info->rx_buffer_list[CurrentIndex].status && mgsl_get_raw_rx_frame()
6852 info->rx_buffer_list[CurrentIndex].count ) { mgsl_get_raw_rx_frame()
6853 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_get_raw_rx_frame()
6854 usc_start_receiver(info); mgsl_get_raw_rx_frame()
6855 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_get_raw_rx_frame()
6869 * info pointer to device extension
6875 static void mgsl_load_tx_dma_buffer(struct mgsl_struct *info, mgsl_load_tx_dma_buffer() argument
6883 mgsl_trace_block(info,Buffer, min_t(int, BufferSize, DMABUFFERSIZE), 1); mgsl_load_tx_dma_buffer()
6885 if (info->params.flags & HDLC_FLAG_HDLC_LOOPMODE) { mgsl_load_tx_dma_buffer()
6889 info->cmr_value |= BIT13; mgsl_load_tx_dma_buffer()
6896 i = info->current_tx_buffer; mgsl_load_tx_dma_buffer()
6897 info->start_tx_dma_buffer = i; mgsl_load_tx_dma_buffer()
6902 info->tx_buffer_list[i].status = info->cmr_value & 0xf000; mgsl_load_tx_dma_buffer()
6903 info->tx_buffer_list[i].rcc = BufferSize; mgsl_load_tx_dma_buffer()
6904 info->tx_buffer_list[i].count = BufferSize; mgsl_load_tx_dma_buffer()
6911 pBufEntry = &info->tx_buffer_list[i++]; mgsl_load_tx_dma_buffer()
6913 if ( i == info->tx_buffer_count ) mgsl_load_tx_dma_buffer()
6925 if ( info->bus_type == MGSL_BUS_TYPE_PCI ) mgsl_load_tx_dma_buffer()
6936 ++info->tx_dma_buffers_used; mgsl_load_tx_dma_buffer()
6940 info->current_tx_buffer = i; mgsl_load_tx_dma_buffer()
6949 * Arguments: info pointer to device instance data
6952 static bool mgsl_register_test( struct mgsl_struct *info ) mgsl_register_test()
6961 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_register_test()
6962 usc_reset(info); mgsl_register_test()
6966 if ( (usc_InReg( info, SICR ) != 0) || mgsl_register_test()
6967 (usc_InReg( info, IVR ) != 0) || mgsl_register_test()
6968 (usc_InDmaReg( info, DIVR ) != 0) ){ mgsl_register_test()
6977 usc_OutReg( info, TC0R, BitPatterns[i] ); mgsl_register_test()
6978 usc_OutReg( info, TC1R, BitPatterns[(i+1)%Patterncount] ); mgsl_register_test()
6979 usc_OutReg( info, TCLR, BitPatterns[(i+2)%Patterncount] ); mgsl_register_test()
6980 usc_OutReg( info, RCLR, BitPatterns[(i+3)%Patterncount] ); mgsl_register_test()
6981 usc_OutReg( info, RSR, BitPatterns[(i+4)%Patterncount] ); mgsl_register_test()
6982 usc_OutDmaReg( info, TBCR, BitPatterns[(i+5)%Patterncount] ); mgsl_register_test()
6984 if ( (usc_InReg( info, TC0R ) != BitPatterns[i]) || mgsl_register_test()
6985 (usc_InReg( info, TC1R ) != BitPatterns[(i+1)%Patterncount]) || mgsl_register_test()
6986 (usc_InReg( info, TCLR ) != BitPatterns[(i+2)%Patterncount]) || mgsl_register_test()
6987 (usc_InReg( info, RCLR ) != BitPatterns[(i+3)%Patterncount]) || mgsl_register_test()
6988 (usc_InReg( info, RSR ) != BitPatterns[(i+4)%Patterncount]) || mgsl_register_test()
6989 (usc_InDmaReg( info, TBCR ) != BitPatterns[(i+5)%Patterncount]) ){ mgsl_register_test()
6996 usc_reset(info); mgsl_register_test()
6997 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_register_test()
7005 * Arguments: info pointer to device instance data
7008 static bool mgsl_irq_test( struct mgsl_struct *info ) mgsl_irq_test()
7013 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_irq_test()
7014 usc_reset(info); mgsl_irq_test()
7021 info->irq_occurred = false; mgsl_irq_test()
7027 usc_OutReg( info, PCR, (unsigned short)((usc_InReg(info, PCR) | BIT13) & ~BIT12) ); mgsl_irq_test()
7029 usc_EnableMasterIrqBit(info); mgsl_irq_test()
7030 usc_EnableInterrupts(info, IO_PIN); mgsl_irq_test()
7031 usc_ClearIrqPendingBits(info, IO_PIN); mgsl_irq_test()
7033 usc_UnlatchIostatusBits(info, MISCSTATUS_TXC_LATCHED); mgsl_irq_test()
7034 usc_EnableStatusIrqs(info, SICR_TXC_ACTIVE + SICR_TXC_INACTIVE); mgsl_irq_test()
7036 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_irq_test()
7039 while( EndTime-- && !info->irq_occurred ) { mgsl_irq_test()
7043 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_irq_test()
7044 usc_reset(info); mgsl_irq_test()
7045 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_irq_test()
7047 return info->irq_occurred; mgsl_irq_test()
7057 * Arguments: info pointer to device instance data
7060 static bool mgsl_dma_test( struct mgsl_struct *info ) mgsl_dma_test()
7074 memcpy(&tmp_params,&info->params,sizeof(MGSL_PARAMS)); mgsl_dma_test()
7076 memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS)); mgsl_dma_test()
7080 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7084 usc_reset(info); mgsl_dma_test()
7085 usc_set_sdlc_mode(info); mgsl_dma_test()
7086 usc_enable_loopback(info,1); mgsl_dma_test()
7108 usc_OutDmaReg( info, RDMR, 0xe200 ); mgsl_dma_test()
7110 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7120 info->tx_buffer_list[0].count = FrameSize; mgsl_dma_test()
7121 info->tx_buffer_list[0].rcc = FrameSize; mgsl_dma_test()
7122 info->tx_buffer_list[0].status = 0x4000; mgsl_dma_test()
7126 TmpPtr = info->tx_buffer_list[0].virt_addr; mgsl_dma_test()
7133 info->rx_buffer_list[0].status = 0; mgsl_dma_test()
7134 info->rx_buffer_list[0].count = FrameSize + 4; mgsl_dma_test()
7138 memset( info->rx_buffer_list[0].virt_addr, 0, FrameSize + 4 ); mgsl_dma_test()
7143 info->tx_buffer_list[1].count = 0; mgsl_dma_test()
7144 info->rx_buffer_list[1].count = 0; mgsl_dma_test()
7151 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7154 usc_RTCmd( info, RTCmd_PurgeRxFifo ); mgsl_dma_test()
7157 phys_addr = info->rx_buffer_list[0].phys_entry; mgsl_dma_test()
7158 usc_OutDmaReg( info, NRARL, (unsigned short)phys_addr ); mgsl_dma_test()
7159 usc_OutDmaReg( info, NRARU, (unsigned short)(phys_addr >> 16) ); mgsl_dma_test()
7162 usc_InDmaReg( info, RDMR ); mgsl_dma_test()
7163 usc_DmaCmd( info, DmaCmd_InitRxChannel ); mgsl_dma_test()
7166 usc_OutReg( info, RMR, (unsigned short)((usc_InReg(info, RMR) & 0xfffc) | 0x0002) ); mgsl_dma_test()
7168 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7184 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7185 status = usc_InDmaReg( info, RDMR ); mgsl_dma_test()
7186 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7201 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7206 usc_OutReg( info, TCLR, (unsigned short)info->tx_buffer_list[0].count ); mgsl_dma_test()
7207 usc_RTCmd( info, RTCmd_PurgeTxFifo ); mgsl_dma_test()
7211 phys_addr = info->tx_buffer_list[0].phys_entry; mgsl_dma_test()
7212 usc_OutDmaReg( info, NTARL, (unsigned short)phys_addr ); mgsl_dma_test()
7213 usc_OutDmaReg( info, NTARU, (unsigned short)(phys_addr >> 16) ); mgsl_dma_test()
7217 usc_OutReg( info, TCSR, (unsigned short)(( usc_InReg(info, TCSR) & 0x0f00) | 0xfa) ); mgsl_dma_test()
7218 usc_DmaCmd( info, DmaCmd_InitTxChannel ); mgsl_dma_test()
7222 usc_TCmd( info, TCmd_SelectTicrTxFifostatus ); mgsl_dma_test()
7224 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7240 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7241 FifoLevel = usc_InReg(info, TICR) >> 8; mgsl_dma_test()
7242 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7260 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7263 usc_TCmd( info, TCmd_SendFrame ); mgsl_dma_test()
7264 usc_OutReg( info, TMR, (unsigned short)((usc_InReg(info, TMR) & 0xfffc) | 0x0002) ); mgsl_dma_test()
7266 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7278 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7279 status = usc_InReg( info, TCSR ); mgsl_dma_test()
7280 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7288 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7289 status = usc_InReg( info, TCSR ); mgsl_dma_test()
7290 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7308 status=info->rx_buffer_list[0].status; mgsl_dma_test()
7314 status=info->rx_buffer_list[0].status; mgsl_dma_test()
7321 status = info->rx_buffer_list[0].status; mgsl_dma_test()
7327 if ( memcmp( info->tx_buffer_list[0].virt_addr , mgsl_dma_test()
7328 info->rx_buffer_list[0].virt_addr, FrameSize ) ){ mgsl_dma_test()
7334 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_dma_test()
7335 usc_reset( info ); mgsl_dma_test()
7336 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_dma_test()
7339 memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); mgsl_dma_test()
7349 * Arguments: info pointer to device instance data
7352 static int mgsl_adapter_test( struct mgsl_struct *info ) mgsl_adapter_test()
7356 __FILE__,__LINE__,info->device_name ); mgsl_adapter_test()
7358 if ( !mgsl_register_test( info ) ) { mgsl_adapter_test()
7359 info->init_error = DiagStatus_AddressFailure; mgsl_adapter_test()
7361 __FILE__,__LINE__,info->device_name, (unsigned short)(info->io_base) ); mgsl_adapter_test()
7365 if ( !mgsl_irq_test( info ) ) { mgsl_adapter_test()
7366 info->init_error = DiagStatus_IrqFailure; mgsl_adapter_test()
7368 __FILE__,__LINE__,info->device_name, (unsigned short)(info->irq_level) ); mgsl_adapter_test()
7372 if ( !mgsl_dma_test( info ) ) { mgsl_adapter_test()
7373 info->init_error = DiagStatus_DmaFailure; mgsl_adapter_test()
7375 __FILE__,__LINE__,info->device_name, (unsigned short)(info->dma_level) ); mgsl_adapter_test()
7381 __FILE__,__LINE__,info->device_name ); mgsl_adapter_test()
7391 * Arguments: info pointer to device instance data
7394 static bool mgsl_memory_test( struct mgsl_struct *info ) mgsl_memory_test()
7403 if ( info->bus_type != MGSL_BUS_TYPE_PCI ) mgsl_memory_test()
7406 TestAddr = (unsigned long *)info->memory_base; mgsl_memory_test()
7424 TestAddr = (unsigned long *)info->memory_base; mgsl_memory_test()
7432 memset( info->memory_base, 0, SHARED_MEM_ADDRESS_SIZE ); mgsl_memory_test()
7497 static void mgsl_trace_block(struct mgsl_struct *info,const char* data, int count, int xmit) mgsl_trace_block() argument
7502 printk("%s tx data:\n",info->device_name); mgsl_trace_block()
7504 printk("%s rx data:\n",info->device_name); mgsl_trace_block()
7539 struct mgsl_struct *info = (struct mgsl_struct*)context; mgsl_tx_timeout() local
7544 __FILE__,__LINE__,info->device_name); mgsl_tx_timeout()
7545 if(info->tx_active && mgsl_tx_timeout()
7546 (info->params.mode == MGSL_MODE_HDLC || mgsl_tx_timeout()
7547 info->params.mode == MGSL_MODE_RAW) ) { mgsl_tx_timeout()
7548 info->icount.txtimeout++; mgsl_tx_timeout()
7550 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_tx_timeout()
7551 info->tx_active = false; mgsl_tx_timeout()
7552 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; mgsl_tx_timeout()
7554 if ( info->params.flags & HDLC_FLAG_HDLC_LOOPMODE ) mgsl_tx_timeout()
7555 usc_loopmode_cancel_transmit( info ); mgsl_tx_timeout()
7557 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_tx_timeout()
7560 if (info->netcount) mgsl_tx_timeout()
7561 hdlcdev_tx_done(info); mgsl_tx_timeout()
7564 mgsl_bh_transmit(info); mgsl_tx_timeout()
7572 static int mgsl_loopmode_send_done( struct mgsl_struct * info ) mgsl_loopmode_send_done()
7576 spin_lock_irqsave(&info->irq_spinlock,flags); mgsl_loopmode_send_done()
7577 if (info->params.flags & HDLC_FLAG_HDLC_LOOPMODE) { mgsl_loopmode_send_done()
7578 if (info->tx_active) mgsl_loopmode_send_done()
7579 info->loopmode_send_done_requested = true; mgsl_loopmode_send_done()
7581 usc_loopmode_send_done(info); mgsl_loopmode_send_done()
7583 spin_unlock_irqrestore(&info->irq_spinlock,flags); mgsl_loopmode_send_done()
7591 static void usc_loopmode_send_done( struct mgsl_struct * info ) usc_loopmode_send_done()
7593 info->loopmode_send_done_requested = false; usc_loopmode_send_done()
7595 info->cmr_value &= ~BIT13; usc_loopmode_send_done()
7596 usc_OutReg(info, CMR, info->cmr_value); usc_loopmode_send_done()
7601 static void usc_loopmode_cancel_transmit( struct mgsl_struct * info ) usc_loopmode_cancel_transmit()
7604 usc_RTCmd( info, RTCmd_PurgeTxFifo ); usc_loopmode_cancel_transmit()
7605 usc_DmaCmd( info, DmaCmd_ResetTxChannel ); usc_loopmode_cancel_transmit()
7606 usc_loopmode_send_done( info ); usc_loopmode_cancel_transmit()
7613 static void usc_loopmode_insert_request( struct mgsl_struct * info ) usc_loopmode_insert_request()
7615 info->loopmode_insert_requested = true; usc_loopmode_insert_request()
7620 usc_OutReg( info, RICR, usc_loopmode_insert_request()
7621 (usc_InReg( info, RICR ) | RXSTATUS_ABORT_RECEIVED ) ); usc_loopmode_insert_request()
7624 info->cmr_value |= BIT13; usc_loopmode_insert_request()
7625 usc_OutReg(info, CMR, info->cmr_value); usc_loopmode_insert_request()
7630 static int usc_loopmode_active( struct mgsl_struct * info) usc_loopmode_active() argument
7632 return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; usc_loopmode_active()
7650 struct mgsl_struct *info = dev_to_port(dev); hdlcdev_attach() local
7655 if (info->port.count) hdlcdev_attach()
7676 info->params.encoding = new_encoding; hdlcdev_attach()
7677 info->params.crc_type = new_crctype; hdlcdev_attach()
7680 if (info->netcount) hdlcdev_attach()
7681 mgsl_program_hw(info); hdlcdev_attach()
7695 struct mgsl_struct *info = dev_to_port(dev); hdlcdev_xmit() local
7705 info->xmit_cnt = skb->len; hdlcdev_xmit()
7706 mgsl_load_tx_dma_buffer(info, skb->data, skb->len); hdlcdev_xmit()
7719 spin_lock_irqsave(&info->irq_spinlock,flags); hdlcdev_xmit()
7720 if (!info->tx_active) hdlcdev_xmit()
7721 usc_start_transmitter(info); hdlcdev_xmit()
7722 spin_unlock_irqrestore(&info->irq_spinlock,flags); hdlcdev_xmit()
7737 struct mgsl_struct *info = dev_to_port(dev); hdlcdev_open() local
7750 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
7751 if (info->port.count != 0 || info->netcount != 0) { hdlcdev_open()
7753 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
7756 info->netcount=1; hdlcdev_open()
7757 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
7760 if ((rc = startup(info)) != 0) { hdlcdev_open()
7761 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
7762 info->netcount=0; hdlcdev_open()
7763 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
7768 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; hdlcdev_open()
7769 mgsl_program_hw(info); hdlcdev_open()
7776 spin_lock_irqsave(&info->irq_spinlock, flags); hdlcdev_open()
7777 usc_get_serial_signals(info); hdlcdev_open()
7778 spin_unlock_irqrestore(&info->irq_spinlock, flags); hdlcdev_open()
7779 if (info->serial_signals & SerialSignal_DCD) hdlcdev_open()
7796 struct mgsl_struct *info = dev_to_port(dev); hdlcdev_close() local
7805 shutdown(info); hdlcdev_close()
7809 spin_lock_irqsave(&info->netlock, flags); hdlcdev_close()
7810 info->netcount=0; hdlcdev_close()
7811 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_close()
7830 struct mgsl_struct *info = dev_to_port(dev); hdlcdev_ioctl() local
7837 if (info->port.count) hdlcdev_ioctl()
7852 flags = info->params.flags & (HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
7866 new_line.clock_rate = info->params.clock_speed; hdlcdev_ioctl()
7867 new_line.loopback = info->params.loopback ? 1:0; hdlcdev_ioctl()
7886 case CLOCK_DEFAULT: flags = info->params.flags & hdlcdev_ioctl()
7897 info->params.flags &= ~(HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
7901 info->params.flags |= flags; hdlcdev_ioctl()
7903 info->params.loopback = new_line.loopback; hdlcdev_ioctl()
7906 info->params.clock_speed = new_line.clock_rate; hdlcdev_ioctl()
7908 info->params.clock_speed = 0; hdlcdev_ioctl()
7911 if (info->netcount) hdlcdev_ioctl()
7912 mgsl_program_hw(info); hdlcdev_ioctl()
7927 struct mgsl_struct *info = dev_to_port(dev); hdlcdev_tx_timeout() local
7936 spin_lock_irqsave(&info->irq_spinlock,flags); hdlcdev_tx_timeout()
7937 usc_stop_transmitter(info); hdlcdev_tx_timeout()
7938 spin_unlock_irqrestore(&info->irq_spinlock,flags); hdlcdev_tx_timeout()
7947 * info pointer to device instance information
7949 static void hdlcdev_tx_done(struct mgsl_struct *info) hdlcdev_tx_done() argument
7951 if (netif_queue_stopped(info->netdev)) hdlcdev_tx_done()
7952 netif_wake_queue(info->netdev); hdlcdev_tx_done()
7959 * info pointer to device instance information
7963 static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size) hdlcdev_rx() argument
7966 struct net_device *dev = info->netdev; hdlcdev_rx()
8001 * info pointer to device instance information
8005 static int hdlcdev_init(struct mgsl_struct *info) hdlcdev_init() argument
8013 dev = alloc_hdlcdev(info); hdlcdev_init()
8020 dev->base_addr = info->io_base; hdlcdev_init()
8021 dev->irq = info->irq_level; hdlcdev_init()
8022 dev->dma = info->dma_level; hdlcdev_init()
8042 info->netdev = dev; hdlcdev_init()
8050 * info pointer to device instance information
8052 static void hdlcdev_exit(struct mgsl_struct *info) hdlcdev_exit() argument
8054 unregister_hdlc_device(info->netdev); hdlcdev_exit()
8055 free_netdev(info->netdev); hdlcdev_exit()
8056 info->netdev = NULL; hdlcdev_exit()
8065 struct mgsl_struct *info; synclink_init_one() local
8072 info = mgsl_allocate_device(); synclink_init_one()
8073 if (!info) { synclink_init_one()
8078 /* Copy user configuration info to device instance data */ synclink_init_one()
8080 info->io_base = pci_resource_start(dev, 2); synclink_init_one()
8081 info->irq_level = dev->irq; synclink_init_one()
8082 info->phys_memory_base = pci_resource_start(dev, 3); synclink_init_one()
8088 info->phys_lcr_base = pci_resource_start(dev, 0); synclink_init_one()
8089 info->lcr_offset = info->phys_lcr_base & (PAGE_SIZE-1); synclink_init_one()
8090 info->phys_lcr_base &= ~(PAGE_SIZE-1); synclink_init_one()
8092 info->bus_type = MGSL_BUS_TYPE_PCI; synclink_init_one()
8093 info->io_addr_size = 8; synclink_init_one()
8094 info->irq_flags = IRQF_SHARED; synclink_init_one()
8098 info->misc_ctrl_value = 0x007c4080; synclink_init_one()
8099 info->hw_version = 1; synclink_init_one()
8106 info->misc_ctrl_value = 0x087e4546; synclink_init_one()
8107 info->hw_version = 0; synclink_init_one()
8110 mgsl_add_device(info); synclink_init_one()
3264 block_til_ready(struct tty_struct *tty, struct file * filp, struct mgsl_struct *info) block_til_ready() argument
H A Dmxser.c268 const struct mxser_cardinfo *info; member in struct:mxser_board
357 static void mxser_set_must_fifo_value(struct mxser_port *info) mxser_set_must_fifo_value() argument
362 oldlcr = inb(info->ioaddr + UART_LCR); mxser_set_must_fifo_value()
363 outb(MOXA_MUST_ENTER_ENCHANCE, info->ioaddr + UART_LCR); mxser_set_must_fifo_value()
365 efr = inb(info->ioaddr + MOXA_MUST_EFR_REGISTER); mxser_set_must_fifo_value()
369 outb(efr, info->ioaddr + MOXA_MUST_EFR_REGISTER); mxser_set_must_fifo_value()
370 outb((u8)info->rx_high_water, info->ioaddr + MOXA_MUST_RBRTH_REGISTER); mxser_set_must_fifo_value()
371 outb((u8)info->rx_trigger, info->ioaddr + MOXA_MUST_RBRTI_REGISTER); mxser_set_must_fifo_value()
372 outb((u8)info->rx_low_water, info->ioaddr + MOXA_MUST_RBRTL_REGISTER); mxser_set_must_fifo_value()
373 outb(oldlcr, info->ioaddr + UART_LCR); mxser_set_must_fifo_value()
514 static void process_txrx_fifo(struct mxser_port *info) process_txrx_fifo() argument
518 if ((info->type == PORT_16450) || (info->type == PORT_8250)) { process_txrx_fifo()
519 info->rx_trigger = 1; process_txrx_fifo()
520 info->rx_high_water = 1; process_txrx_fifo()
521 info->rx_low_water = 1; process_txrx_fifo()
522 info->xmit_fifo_size = 1; process_txrx_fifo()
525 if (info->board->chip_flag == Gpci_uart_info[i].type) { process_txrx_fifo()
526 info->rx_trigger = Gpci_uart_info[i].rx_trigger; process_txrx_fifo()
527 info->rx_low_water = Gpci_uart_info[i].rx_low_water; process_txrx_fifo()
528 info->rx_high_water = Gpci_uart_info[i].rx_high_water; process_txrx_fifo()
529 info->xmit_fifo_size = Gpci_uart_info[i].xmit_fifo_size; process_txrx_fifo()
573 struct mxser_port *info = tty->driver_data; mxser_set_baud() local
577 if (!info->ioaddr) mxser_set_baud()
580 if (newspd > info->max_baud) mxser_set_baud()
584 quot = 2 * info->baud_base / 269; mxser_set_baud()
587 quot = info->baud_base / newspd; mxser_set_baud()
590 baud = info->baud_base/quot; mxser_set_baud()
596 info->timeout = ((info->xmit_fifo_size * HZ * 10 * quot) / info->baud_base); mxser_set_baud()
597 info->timeout += HZ / 50; /* Add .02 seconds of slop */ mxser_set_baud()
600 info->MCR |= UART_MCR_DTR; mxser_set_baud()
601 outb(info->MCR, info->ioaddr + UART_MCR); mxser_set_baud()
603 info->MCR &= ~UART_MCR_DTR; mxser_set_baud()
604 outb(info->MCR, info->ioaddr + UART_MCR); mxser_set_baud()
608 cval = inb(info->ioaddr + UART_LCR); mxser_set_baud()
610 outb(cval | UART_LCR_DLAB, info->ioaddr + UART_LCR); /* set DLAB */ mxser_set_baud()
612 outb(quot & 0xff, info->ioaddr + UART_DLL); /* LS of divisor */ mxser_set_baud()
613 outb(quot >> 8, info->ioaddr + UART_DLM); /* MS of divisor */ mxser_set_baud()
614 outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */ mxser_set_baud()
618 quot = info->baud_base % newspd; mxser_set_baud()
626 mxser_set_must_enum_value(info->ioaddr, quot); mxser_set_baud()
629 mxser_set_must_enum_value(info->ioaddr, 0); mxser_set_baud()
641 struct mxser_port *info = tty->driver_data; mxser_change_speed() local
647 if (!info->ioaddr) mxser_change_speed()
680 if ((info->type == PORT_8250) || (info->type == PORT_16450)) { mxser_change_speed()
681 if (info->board->chip_flag) { mxser_change_speed()
684 mxser_set_must_fifo_value(info); mxser_change_speed()
689 if (info->board->chip_flag) { mxser_change_speed()
691 mxser_set_must_fifo_value(info); mxser_change_speed()
693 switch (info->rx_trigger) { mxser_change_speed()
711 info->IER &= ~UART_IER_MSI; mxser_change_speed()
712 info->MCR &= ~UART_MCR_AFE; mxser_change_speed()
714 info->port.flags |= ASYNC_CTS_FLOW; mxser_change_speed()
715 info->IER |= UART_IER_MSI; mxser_change_speed()
716 if ((info->type == PORT_16550A) || (info->board->chip_flag)) { mxser_change_speed()
717 info->MCR |= UART_MCR_AFE; mxser_change_speed()
719 status = inb(info->ioaddr + UART_MSR); mxser_change_speed()
723 if (info->type != PORT_16550A && mxser_change_speed()
724 !info->board->chip_flag) { mxser_change_speed()
725 outb(info->IER & ~UART_IER_THRI, mxser_change_speed()
726 info->ioaddr + mxser_change_speed()
728 info->IER |= UART_IER_THRI; mxser_change_speed()
729 outb(info->IER, info->ioaddr + mxser_change_speed()
737 if ((info->type != PORT_16550A) && mxser_change_speed()
738 (!info->board->chip_flag)) { mxser_change_speed()
739 info->IER &= ~UART_IER_THRI; mxser_change_speed()
740 outb(info->IER, info->ioaddr + mxser_change_speed()
747 info->port.flags &= ~ASYNC_CTS_FLOW; mxser_change_speed()
749 outb(info->MCR, info->ioaddr + UART_MCR); mxser_change_speed()
751 info->port.flags &= ~ASYNC_CHECK_CD; mxser_change_speed()
753 info->port.flags |= ASYNC_CHECK_CD; mxser_change_speed()
754 info->IER |= UART_IER_MSI; mxser_change_speed()
756 outb(info->IER, info->ioaddr + UART_IER); mxser_change_speed()
761 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; mxser_change_speed()
763 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; mxser_change_speed()
765 info->read_status_mask |= UART_LSR_BI; mxser_change_speed()
767 info->ignore_status_mask = 0; mxser_change_speed()
770 info->ignore_status_mask |= UART_LSR_BI; mxser_change_speed()
771 info->read_status_mask |= UART_LSR_BI; mxser_change_speed()
777 info->ignore_status_mask |= mxser_change_speed()
781 info->read_status_mask |= mxser_change_speed()
787 if (info->board->chip_flag) { mxser_change_speed()
788 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(tty)); mxser_change_speed()
789 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(tty)); mxser_change_speed()
792 info->ioaddr); mxser_change_speed()
795 info->ioaddr); mxser_change_speed()
799 info->ioaddr); mxser_change_speed()
802 info->ioaddr); mxser_change_speed()
807 outb(fcr, info->ioaddr + UART_FCR); /* set fcr */ mxser_change_speed()
808 outb(cval, info->ioaddr + UART_LCR); mxser_change_speed()
864 struct mxser_port *info = container_of(port, struct mxser_port, port); mxser_activate() local
872 spin_lock_irqsave(&info->slock, flags); mxser_activate()
874 if (!info->ioaddr || !info->type) { mxser_activate()
877 spin_unlock_irqrestore(&info->slock, flags); mxser_activate()
880 info->port.xmit_buf = (unsigned char *) page; mxser_activate()
886 if (info->board->chip_flag) mxser_activate()
889 MOXA_MUST_FCR_GDA_MODE_ENABLE), info->ioaddr + UART_FCR); mxser_activate()
892 info->ioaddr + UART_FCR); mxser_activate()
899 if (inb(info->ioaddr + UART_LSR) == 0xff) { mxser_activate()
900 spin_unlock_irqrestore(&info->slock, flags); mxser_activate()
911 (void) inb(info->ioaddr + UART_LSR); mxser_activate()
912 (void) inb(info->ioaddr + UART_RX); mxser_activate()
913 (void) inb(info->ioaddr + UART_IIR); mxser_activate()
914 (void) inb(info->ioaddr + UART_MSR); mxser_activate()
919 outb(UART_LCR_WLEN8, info->ioaddr + UART_LCR); /* reset DLAB */ mxser_activate()
920 info->MCR = UART_MCR_DTR | UART_MCR_RTS; mxser_activate()
921 outb(info->MCR, info->ioaddr + UART_MCR); mxser_activate()
926 info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; mxser_activate()
928 if (info->board->chip_flag) mxser_activate()
929 info->IER |= MOXA_MUST_IER_EGDAI; mxser_activate()
930 outb(info->IER, info->ioaddr + UART_IER); /* enable interrupts */ mxser_activate()
935 (void) inb(info->ioaddr + UART_LSR); mxser_activate()
936 (void) inb(info->ioaddr + UART_RX); mxser_activate()
937 (void) inb(info->ioaddr + UART_IIR); mxser_activate()
938 (void) inb(info->ioaddr + UART_MSR); mxser_activate()
941 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; mxser_activate()
947 spin_unlock_irqrestore(&info->slock, flags); mxser_activate()
957 struct mxser_port *info = container_of(port, struct mxser_port, port); mxser_shutdown_port() local
960 spin_lock_irqsave(&info->slock, flags); mxser_shutdown_port()
966 wake_up_interruptible(&info->port.delta_msr_wait); mxser_shutdown_port()
971 if (info->port.xmit_buf) { mxser_shutdown_port()
972 free_page((unsigned long) info->port.xmit_buf); mxser_shutdown_port()
973 info->port.xmit_buf = NULL; mxser_shutdown_port()
976 info->IER = 0; mxser_shutdown_port()
977 outb(0x00, info->ioaddr + UART_IER); mxser_shutdown_port()
980 if (info->board->chip_flag) mxser_shutdown_port()
983 info->ioaddr + UART_FCR); mxser_shutdown_port()
986 info->ioaddr + UART_FCR); mxser_shutdown_port()
989 (void) inb(info->ioaddr + UART_RX); mxser_shutdown_port()
992 if (info->board->chip_flag) mxser_shutdown_port()
993 SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr); mxser_shutdown_port()
995 spin_unlock_irqrestore(&info->slock, flags); mxser_shutdown_port()
1006 struct mxser_port *info; mxser_open() local
1012 info = &mxser_boards[line / MXSER_PORTS_PER_BOARD].ports[line % MXSER_PORTS_PER_BOARD]; mxser_open()
1013 if (!info->ioaddr) mxser_open()
1016 tty->driver_data = info; mxser_open()
1017 return tty_port_open(&info->port, tty, filp); mxser_open()
1022 struct mxser_port *info = tty->driver_data; mxser_flush_buffer() local
1027 spin_lock_irqsave(&info->slock, flags); mxser_flush_buffer()
1028 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; mxser_flush_buffer()
1030 fcr = inb(info->ioaddr + UART_FCR); mxser_flush_buffer()
1032 info->ioaddr + UART_FCR); mxser_flush_buffer()
1033 outb(fcr, info->ioaddr + UART_FCR); mxser_flush_buffer()
1035 spin_unlock_irqrestore(&info->slock, flags); mxser_flush_buffer()
1043 struct mxser_port *info = container_of(port, struct mxser_port, port); mxser_close_port() local
1051 info->IER &= ~UART_IER_RLSI; mxser_close_port()
1052 if (info->board->chip_flag) mxser_close_port()
1053 info->IER &= ~MOXA_MUST_RECV_ISR; mxser_close_port()
1055 outb(info->IER, info->ioaddr + UART_IER); mxser_close_port()
1062 while (!(inb(info->ioaddr + UART_LSR) & UART_LSR_TEMT)) { mxser_close_port()
1077 struct mxser_port *info = tty->driver_data; mxser_close() local
1078 struct tty_port *port = &info->port; mxser_close()
1080 if (tty->index == MXSER_PORTS || info == NULL) mxser_close()
1103 struct mxser_port *info = tty->driver_data; mxser_write() local
1106 if (!info->port.xmit_buf) mxser_write()
1110 c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, mxser_write()
1111 SERIAL_XMIT_SIZE - info->xmit_head)); mxser_write()
1115 memcpy(info->port.xmit_buf + info->xmit_head, buf, c); mxser_write()
1116 spin_lock_irqsave(&info->slock, flags); mxser_write()
1117 info->xmit_head = (info->xmit_head + c) & mxser_write()
1119 info->xmit_cnt += c; mxser_write()
1120 spin_unlock_irqrestore(&info->slock, flags); mxser_write()
1127 if (info->xmit_cnt && !tty->stopped) { mxser_write()
1129 (info->type == PORT_16550A) || mxser_write()
1130 (info->board->chip_flag)) { mxser_write()
1131 spin_lock_irqsave(&info->slock, flags); mxser_write()
1132 outb(info->IER & ~UART_IER_THRI, info->ioaddr + mxser_write()
1134 info->IER |= UART_IER_THRI; mxser_write()
1135 outb(info->IER, info->ioaddr + UART_IER); mxser_write()
1136 spin_unlock_irqrestore(&info->slock, flags); mxser_write()
1144 struct mxser_port *info = tty->driver_data; mxser_put_char() local
1147 if (!info->port.xmit_buf) mxser_put_char()
1150 if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1) mxser_put_char()
1153 spin_lock_irqsave(&info->slock, flags); mxser_put_char()
1154 info->port.xmit_buf[info->xmit_head++] = ch; mxser_put_char()
1155 info->xmit_head &= SERIAL_XMIT_SIZE - 1; mxser_put_char()
1156 info->xmit_cnt++; mxser_put_char()
1157 spin_unlock_irqrestore(&info->slock, flags); mxser_put_char()
1160 (info->type == PORT_16550A) || mxser_put_char()
1161 info->board->chip_flag) { mxser_put_char()
1162 spin_lock_irqsave(&info->slock, flags); mxser_put_char()
1163 outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); mxser_put_char()
1164 info->IER |= UART_IER_THRI; mxser_put_char()
1165 outb(info->IER, info->ioaddr + UART_IER); mxser_put_char()
1166 spin_unlock_irqrestore(&info->slock, flags); mxser_put_char()
1175 struct mxser_port *info = tty->driver_data; mxser_flush_chars() local
1178 if (info->xmit_cnt <= 0 || tty->stopped || !info->port.xmit_buf || mxser_flush_chars()
1179 (tty->hw_stopped && info->type != PORT_16550A && mxser_flush_chars()
1180 !info->board->chip_flag)) mxser_flush_chars()
1183 spin_lock_irqsave(&info->slock, flags); mxser_flush_chars()
1185 outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); mxser_flush_chars()
1186 info->IER |= UART_IER_THRI; mxser_flush_chars()
1187 outb(info->IER, info->ioaddr + UART_IER); mxser_flush_chars()
1189 spin_unlock_irqrestore(&info->slock, flags); mxser_flush_chars()
1194 struct mxser_port *info = tty->driver_data; mxser_write_room() local
1197 ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; mxser_write_room()
1203 struct mxser_port *info = tty->driver_data; mxser_chars_in_buffer() local
1204 return info->xmit_cnt; mxser_chars_in_buffer()
1215 struct mxser_port *info = tty->driver_data; mxser_get_serial_info() local
1217 .type = info->type, mxser_get_serial_info()
1219 .port = info->ioaddr, mxser_get_serial_info()
1220 .irq = info->board->irq, mxser_get_serial_info()
1221 .flags = info->port.flags, mxser_get_serial_info()
1222 .baud_base = info->baud_base, mxser_get_serial_info()
1223 .close_delay = info->port.close_delay, mxser_get_serial_info()
1224 .closing_wait = info->port.closing_wait, mxser_get_serial_info()
1225 .custom_divisor = info->custom_divisor, mxser_get_serial_info()
1236 struct mxser_port *info = tty->driver_data; mxser_set_serial_info() local
1237 struct tty_port *port = &info->port; mxser_set_serial_info()
1244 if (!new_info || !info->ioaddr) mxser_set_serial_info()
1249 if (new_serial.irq != info->board->irq || mxser_set_serial_info()
1250 new_serial.port != info->ioaddr) mxser_set_serial_info()
1256 if ((new_serial.baud_base != info->baud_base) || mxser_set_serial_info()
1257 (new_serial.close_delay != info->port.close_delay) || mxser_set_serial_info()
1258 ((new_serial.flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK))) mxser_set_serial_info()
1260 info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | mxser_set_serial_info()
1273 (new_serial.baud_base != info->baud_base || mxser_set_serial_info()
1275 info->custom_divisor)) { mxser_set_serial_info()
1283 info->type = new_serial.type; mxser_set_serial_info()
1285 process_txrx_fifo(info); mxser_set_serial_info()
1289 spin_lock_irqsave(&info->slock, sl_flags); mxser_set_serial_info()
1291 spin_unlock_irqrestore(&info->slock, sl_flags); mxser_set_serial_info()
1302 * mxser_get_lsr_info - get line status register info
1304 * Purpose: Let user call ioctl() to get info when the UART physically
1311 static int mxser_get_lsr_info(struct mxser_port *info, mxser_get_lsr_info() argument
1318 spin_lock_irqsave(&info->slock, flags); mxser_get_lsr_info()
1319 status = inb(info->ioaddr + UART_LSR); mxser_get_lsr_info()
1320 spin_unlock_irqrestore(&info->slock, flags); mxser_get_lsr_info()
1327 struct mxser_port *info = tty->driver_data; mxser_tiocmget() local
1337 control = info->MCR; mxser_tiocmget()
1339 spin_lock_irqsave(&info->slock, flags); mxser_tiocmget()
1340 status = inb(info->ioaddr + UART_MSR); mxser_tiocmget()
1342 mxser_check_modem_status(tty, info, status); mxser_tiocmget()
1343 spin_unlock_irqrestore(&info->slock, flags); mxser_tiocmget()
1355 struct mxser_port *info = tty->driver_data; mxser_tiocmset() local
1364 spin_lock_irqsave(&info->slock, flags); mxser_tiocmset()
1367 info->MCR |= UART_MCR_RTS; mxser_tiocmset()
1369 info->MCR |= UART_MCR_DTR; mxser_tiocmset()
1372 info->MCR &= ~UART_MCR_RTS; mxser_tiocmset()
1374 info->MCR &= ~UART_MCR_DTR; mxser_tiocmset()
1376 outb(info->MCR, info->ioaddr + UART_MCR); mxser_tiocmset()
1377 spin_unlock_irqrestore(&info->slock, flags); mxser_tiocmset()
1642 static int mxser_cflags_changed(struct mxser_port *info, unsigned long arg, mxser_cflags_changed() argument
1649 spin_lock_irqsave(&info->slock, flags); mxser_cflags_changed()
1650 cnow = info->icount; /* atomic copy */ mxser_cflags_changed()
1651 spin_unlock_irqrestore(&info->slock, flags); mxser_cflags_changed()
1666 struct mxser_port *info = tty->driver_data; mxser_ioctl() local
1667 struct tty_port *port = &info->port; mxser_ioctl()
1683 if (info->board->chip_flag != MOXA_MUST_MU860_HWID) mxser_ioctl()
1697 spin_lock_irq(&info->slock); mxser_ioctl()
1698 val = inb(info->opmode_ioaddr); mxser_ioctl()
1701 outb(val, info->opmode_ioaddr); mxser_ioctl()
1702 spin_unlock_irq(&info->slock); mxser_ioctl()
1705 spin_lock_irq(&info->slock); mxser_ioctl()
1706 opmode = inb(info->opmode_ioaddr) >> shiftbit; mxser_ioctl()
1707 spin_unlock_irq(&info->slock); mxser_ioctl()
1731 return mxser_get_lsr_info(info, argp); mxser_ioctl()
1739 spin_lock_irqsave(&info->slock, flags); mxser_ioctl()
1740 cnow = info->icount; /* note the counters on entry */ mxser_ioctl()
1741 spin_unlock_irqrestore(&info->slock, flags); mxser_ioctl()
1743 return wait_event_interruptible(info->port.delta_msr_wait, mxser_ioctl()
1744 mxser_cflags_changed(info, arg, &cnow)); mxser_ioctl()
1746 return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); mxser_ioctl()
1748 spin_lock_irq(&info->slock); mxser_ioctl()
1749 info->mon_data.rxcnt = 0; mxser_ioctl()
1750 info->mon_data.txcnt = 0; mxser_ioctl()
1751 spin_unlock_irq(&info->slock); mxser_ioctl()
1758 spin_lock_irq(&info->slock); mxser_ioctl()
1759 lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_THRE; mxser_ioctl()
1760 spin_unlock_irq(&info->slock); mxser_ioctl()
1768 spin_lock_irq(&info->slock); mxser_ioctl()
1769 status = mxser_get_msr(info->ioaddr, 1, tty->index); mxser_ioctl()
1770 mxser_check_modem_status(tty, info, status); mxser_ioctl()
1772 mcr = inb(info->ioaddr + UART_MCR); mxser_ioctl()
1773 spin_unlock_irq(&info->slock); mxser_ioctl()
1776 info->mon_data.hold_reason &= ~NPPI_NOTIFY_XOFFHOLD; mxser_ioctl()
1778 info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFHOLD; mxser_ioctl()
1781 info->mon_data.hold_reason &= ~NPPI_NOTIFY_XOFFXENT; mxser_ioctl()
1783 info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT; mxser_ioctl()
1786 info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD; mxser_ioctl()
1788 info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; mxser_ioctl()
1790 if (copy_to_user(argp, &info->mon_data, mxser_ioctl()
1797 if (put_user(info->err_shadow, (unsigned char __user *)argp)) mxser_ioctl()
1800 info->err_shadow = 0; mxser_ioctl()
1828 struct mxser_port *info = tty->driver_data; mxser_get_icount() local
1832 spin_lock_irqsave(&info->slock, flags); mxser_get_icount()
1833 cnow = info->icount; mxser_get_icount()
1834 spin_unlock_irqrestore(&info->slock, flags); mxser_get_icount()
1852 struct mxser_port *info = tty->driver_data; mxser_stoprx() local
1854 info->ldisc_stop_rx = 1; mxser_stoprx()
1856 if (info->board->chip_flag) { mxser_stoprx()
1857 info->IER &= ~MOXA_MUST_RECV_ISR; mxser_stoprx()
1858 outb(info->IER, info->ioaddr + UART_IER); mxser_stoprx()
1860 info->x_char = STOP_CHAR(tty); mxser_stoprx()
1861 outb(0, info->ioaddr + UART_IER); mxser_stoprx()
1862 info->IER |= UART_IER_THRI; mxser_stoprx()
1863 outb(info->IER, info->ioaddr + UART_IER); mxser_stoprx()
1868 info->MCR &= ~UART_MCR_RTS; mxser_stoprx()
1869 outb(info->MCR, info->ioaddr + UART_MCR); mxser_stoprx()
1884 struct mxser_port *info = tty->driver_data; mxser_unthrottle() local
1887 info->ldisc_stop_rx = 0; mxser_unthrottle()
1889 if (info->x_char) mxser_unthrottle()
1890 info->x_char = 0; mxser_unthrottle()
1892 if (info->board->chip_flag) { mxser_unthrottle()
1893 info->IER |= MOXA_MUST_RECV_ISR; mxser_unthrottle()
1894 outb(info->IER, info->ioaddr + UART_IER); mxser_unthrottle()
1896 info->x_char = START_CHAR(tty); mxser_unthrottle()
1897 outb(0, info->ioaddr + UART_IER); mxser_unthrottle()
1898 info->IER |= UART_IER_THRI; mxser_unthrottle()
1899 outb(info->IER, info->ioaddr + UART_IER); mxser_unthrottle()
1905 info->MCR |= UART_MCR_RTS; mxser_unthrottle()
1906 outb(info->MCR, info->ioaddr + UART_MCR); mxser_unthrottle()
1918 struct mxser_port *info = tty->driver_data; mxser_stop() local
1921 spin_lock_irqsave(&info->slock, flags); mxser_stop()
1922 if (info->IER & UART_IER_THRI) { mxser_stop()
1923 info->IER &= ~UART_IER_THRI; mxser_stop()
1924 outb(info->IER, info->ioaddr + UART_IER); mxser_stop()
1926 spin_unlock_irqrestore(&info->slock, flags); mxser_stop()
1931 struct mxser_port *info = tty->driver_data; mxser_start() local
1934 spin_lock_irqsave(&info->slock, flags); mxser_start()
1935 if (info->xmit_cnt && info->port.xmit_buf) { mxser_start()
1936 outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); mxser_start()
1937 info->IER |= UART_IER_THRI; mxser_start()
1938 outb(info->IER, info->ioaddr + UART_IER); mxser_start()
1940 spin_unlock_irqrestore(&info->slock, flags); mxser_start()
1945 struct mxser_port *info = tty->driver_data; mxser_set_termios() local
1948 spin_lock_irqsave(&info->slock, flags); mxser_set_termios()
1950 spin_unlock_irqrestore(&info->slock, flags); mxser_set_termios()
1963 if (info->board->chip_flag) { mxser_set_termios()
1964 spin_lock_irqsave(&info->slock, flags); mxser_set_termios()
1966 info->ioaddr); mxser_set_termios()
1967 spin_unlock_irqrestore(&info->slock, flags); mxser_set_termios()
1979 struct mxser_port *info = tty->driver_data; mxser_wait_until_sent() local
1984 if (info->type == PORT_UNKNOWN) mxser_wait_until_sent()
1987 if (info->xmit_fifo_size == 0) mxser_wait_until_sent()
1999 char_time = (info->timeout - HZ / 50) / info->xmit_fifo_size; mxser_wait_until_sent()
2010 * takes longer than info->timeout, this is probably due to a mxser_wait_until_sent()
2012 * 2*info->timeout. mxser_wait_until_sent()
2014 if (!timeout || timeout > 2 * info->timeout) mxser_wait_until_sent()
2015 timeout = 2 * info->timeout; mxser_wait_until_sent()
2017 spin_lock_irqsave(&info->slock, flags); mxser_wait_until_sent()
2018 while (!((lsr = inb(info->ioaddr + UART_LSR)) & UART_LSR_TEMT)) { mxser_wait_until_sent()
2019 spin_unlock_irqrestore(&info->slock, flags); mxser_wait_until_sent()
2021 spin_lock_irqsave(&info->slock, flags); mxser_wait_until_sent()
2027 spin_unlock_irqrestore(&info->slock, flags); mxser_wait_until_sent()
2036 struct mxser_port *info = tty->driver_data; mxser_hangup() local
2039 tty_port_hangup(&info->port); mxser_hangup()
2047 struct mxser_port *info = tty->driver_data; mxser_rs_break() local
2050 spin_lock_irqsave(&info->slock, flags); mxser_rs_break()
2052 outb(inb(info->ioaddr + UART_LCR) | UART_LCR_SBC, mxser_rs_break()
2053 info->ioaddr + UART_LCR); mxser_rs_break()
2055 outb(inb(info->ioaddr + UART_LCR) & ~UART_LCR_SBC, mxser_rs_break()
2056 info->ioaddr + UART_LCR); mxser_rs_break()
2057 spin_unlock_irqrestore(&info->slock, flags); mxser_rs_break()
2236 max = brd->info->nports; mxser_interrupt()
2359 brd->vector < brd->ports[0].ioaddr + 8 * brd->info->nports; mxser_overlapping_vector()
2378 release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); mxser_release_ISA_res()
2385 struct mxser_port *info; mxser_initbrd() local
2392 for (i = 0; i < brd->info->nports; i++) { mxser_initbrd()
2393 info = &brd->ports[i]; mxser_initbrd()
2394 tty_port_init(&info->port); mxser_initbrd()
2395 info->port.ops = &mxser_port_ops; mxser_initbrd()
2396 info->board = brd; mxser_initbrd()
2397 info->stop_rx = 0; mxser_initbrd()
2398 info->ldisc_stop_rx = 0; mxser_initbrd()
2402 mxser_enable_must_enchance_mode(info->ioaddr); mxser_initbrd()
2404 info->port.flags = ASYNC_SHARE_IRQ; mxser_initbrd()
2405 info->type = brd->uart_type; mxser_initbrd()
2407 process_txrx_fifo(info); mxser_initbrd()
2409 info->custom_divisor = info->baud_base * 16; mxser_initbrd()
2410 info->port.close_delay = 5 * HZ / 10; mxser_initbrd()
2411 info->port.closing_wait = 30 * HZ; mxser_initbrd()
2412 info->normal_termios = mxvar_sdriver->init_termios; mxser_initbrd()
2413 memset(&info->mon_data, 0, sizeof(struct mxser_mon)); mxser_initbrd()
2414 info->err_shadow = 0; mxser_initbrd()
2415 spin_lock_init(&info->slock); mxser_initbrd()
2418 outb(inb(info->ioaddr + UART_IER) & 0xf0, mxser_initbrd()
2419 info->ioaddr + UART_IER); mxser_initbrd()
2425 for (i = 0; i < brd->info->nports; i++) mxser_initbrd()
2429 brd->info->name, brd->irq); mxser_initbrd()
2439 for (i = 0; i < brd->info->nports; i++) { mxser_board_remove()
2457 brd->info = &mxser_cards[0]; mxser_get_ISA_conf()
2460 brd->info = &mxser_cards[1]; mxser_get_ISA_conf()
2463 brd->info = &mxser_cards[2]; mxser_get_ISA_conf()
2466 brd->info = &mxser_cards[5]; mxser_get_ISA_conf()
2469 brd->info = &mxser_cards[6]; mxser_get_ISA_conf()
2472 brd->info = &mxser_cards[7]; mxser_get_ISA_conf()
2481 if (brd->info->nports == 2 || (brd->info->flags & MXSER_HAS2)) { mxser_get_ISA_conf()
2486 } else if (brd->info->nports == 4) { mxser_get_ISA_conf()
2492 } else if (brd->info->nports == 8) { mxser_get_ISA_conf()
2536 if (!request_region(brd->ports[0].ioaddr, 8 * brd->info->nports, mxser_get_ISA_conf()
2541 8 * brd->info->nports - 1); mxser_get_ISA_conf()
2547 release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); mxser_get_ISA_conf()
2551 8 * brd->info->nports - 1); mxser_get_ISA_conf()
2554 return brd->info->nports; mxser_get_ISA_conf()
2572 if (mxser_boards[i].info == NULL) mxser_probe()
2599 brd->info = &mxser_cards[ent->driver_data]; mxser_probe()
2600 for (i = 0; i < brd->info->nports; i++) mxser_probe()
2617 for (i = 0; i < brd->info->nports; i++) { mxser_probe()
2624 if (brd->info->flags & MXSER_HIGHBAUD) mxser_probe()
2632 for (i = 0; i < brd->info->nports; i++) { mxser_probe()
2642 for (i = 0; i < brd->info->nports; i++) { mxser_probe()
2652 for (i = 0; i < brd->info->nports; i++) { mxser_probe()
2668 for (i = 0; i < brd->info->nports; i++) mxser_probe()
2674 brd->info = NULL; mxser_probe()
2695 brd->info = NULL; mxser_remove()
2746 brd->info = NULL; mxser_module_init()
2751 brd->info->name, ioaddr[b]); mxser_module_init()
2756 brd->info = NULL; mxser_module_init()
2761 for (i = 0; i < brd->info->nports; i++) { mxser_module_init()
2768 for (i = 0; i < brd->info->nports; i++) mxser_module_init()
2772 brd->info = NULL; mxser_module_init()
2776 if (brd->info == NULL) mxser_module_init()
2806 if (mxser_boards[i].info != NULL) mxser_module_exit()
2812 if (mxser_boards[i].info != NULL) mxser_module_exit()
H A Dcyclades.c176 * are accessed via settings in info->port.flags.
332 static inline int serial_paranoia_check(struct cyclades_port *info, serial_paranoia_check() argument
336 if (!info) { serial_paranoia_check()
342 if (info->magic != CYCLADES_MAGIC) { serial_paranoia_check()
443 struct cyclades_port *info; cyy_chip_rx() local
454 info = &cinfo->ports[channel + chip * 4]; cyy_chip_rx()
455 port = &info->port; cyy_chip_rx()
456 save_car = cyy_readb(info, CyCAR); cyy_chip_rx()
457 cyy_writeb(info, CyCAR, save_xir); cyy_chip_rx()
458 ivr = cyy_readb(info, CyRIVR) & CyIVRMask; cyy_chip_rx()
462 data = cyy_readb(info, CyRDSR); cyy_chip_rx()
466 info->icount.brk++; cyy_chip_rx()
468 info->icount.frame++; cyy_chip_rx()
470 info->icount.parity++; cyy_chip_rx()
472 info->icount.overrun++; cyy_chip_rx()
474 if (data & info->ignore_status_mask) { cyy_chip_rx()
475 info->icount.rx++; cyy_chip_rx()
479 if (data & info->read_status_mask) { cyy_chip_rx()
482 cyy_readb(info, CyRDSR), cyy_chip_rx()
484 info->icount.rx++; cyy_chip_rx()
495 cyy_readb(info, CyRDSR), cyy_chip_rx()
497 info->icount.rx++; cyy_chip_rx()
498 info->idle_stats.frame_errs++; cyy_chip_rx()
502 cyy_readb(info, CyRDSR), cyy_chip_rx()
504 info->icount.rx++; cyy_chip_rx()
505 info->idle_stats.parity_errs++; cyy_chip_rx()
509 info->icount.rx++; cyy_chip_rx()
515 cyy_readb(info, CyRDSR), cyy_chip_rx()
517 info->icount.rx++; cyy_chip_rx()
518 info->idle_stats.overruns++; cyy_chip_rx()
526 info->icount.rx++; cyy_chip_rx()
530 info->icount.rx++; cyy_chip_rx()
535 info->icount.buf_overrun++; cyy_chip_rx()
536 info->idle_stats.overruns++; cyy_chip_rx()
540 char_count = cyy_readb(info, CyRDCR); cyy_chip_rx()
543 ++info->mon.int_count; cyy_chip_rx()
544 info->mon.char_count += char_count; cyy_chip_rx()
545 if (char_count > info->mon.char_max) cyy_chip_rx()
546 info->mon.char_max = char_count; cyy_chip_rx()
547 info->mon.char_last = char_count; cyy_chip_rx()
551 data = cyy_readb(info, CyRDSR); cyy_chip_rx()
553 info->idle_stats.recv_bytes++; cyy_chip_rx()
554 info->icount.rx++; cyy_chip_rx()
559 info->idle_stats.recv_idle = jiffies; cyy_chip_rx()
564 cyy_writeb(info, CyRIR, save_xir & 0x3f); cyy_chip_rx()
565 cyy_writeb(info, CyCAR, save_car); cyy_chip_rx()
571 struct cyclades_port *info; cyy_chip_tx() local
589 info = &cinfo->ports[channel + chip * 4]; cyy_chip_tx()
590 tty = tty_port_tty_get(&info->port); cyy_chip_tx()
592 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) & ~CyTxRdy); cyy_chip_tx()
597 char_count = info->xmit_fifo_size; cyy_chip_tx()
599 if (info->x_char) { /* send special char */ cyy_chip_tx()
600 outch = info->x_char; cyy_chip_tx()
601 cyy_writeb(info, CyTDR, outch); cyy_chip_tx()
603 info->icount.tx++; cyy_chip_tx()
604 info->x_char = 0; cyy_chip_tx()
607 if (info->breakon || info->breakoff) { cyy_chip_tx()
608 if (info->breakon) { cyy_chip_tx()
609 cyy_writeb(info, CyTDR, 0); cyy_chip_tx()
610 cyy_writeb(info, CyTDR, 0x81); cyy_chip_tx()
611 info->breakon = 0; cyy_chip_tx()
614 if (info->breakoff) { cyy_chip_tx()
615 cyy_writeb(info, CyTDR, 0); cyy_chip_tx()
616 cyy_writeb(info, CyTDR, 0x83); cyy_chip_tx()
617 info->breakoff = 0; cyy_chip_tx()
623 if (!info->xmit_cnt) { cyy_chip_tx()
624 if (cyy_readb(info, CySRER) & CyTxMpty) { cyy_chip_tx()
625 cyy_writeb(info, CySRER, cyy_chip_tx()
626 cyy_readb(info, CySRER) & ~CyTxMpty); cyy_chip_tx()
628 cyy_writeb(info, CySRER, CyTxMpty | cyy_chip_tx()
629 (cyy_readb(info, CySRER) & ~CyTxRdy)); cyy_chip_tx()
633 if (info->port.xmit_buf == NULL) { cyy_chip_tx()
634 cyy_writeb(info, CySRER, cyy_chip_tx()
635 cyy_readb(info, CySRER) & ~CyTxRdy); cyy_chip_tx()
639 cyy_writeb(info, CySRER, cyy_chip_tx()
640 cyy_readb(info, CySRER) & ~CyTxRdy); cyy_chip_tx()
652 outch = info->port.xmit_buf[info->xmit_tail]; cyy_chip_tx()
654 info->xmit_cnt--; cyy_chip_tx()
655 info->xmit_tail = (info->xmit_tail + 1) & cyy_chip_tx()
657 cyy_writeb(info, CyTDR, outch); cyy_chip_tx()
658 info->icount.tx++; cyy_chip_tx()
661 info->xmit_cnt--; cyy_chip_tx()
662 info->xmit_tail = (info->xmit_tail + 1) & cyy_chip_tx()
664 cyy_writeb(info, CyTDR, outch); cyy_chip_tx()
665 cyy_writeb(info, CyTDR, 0); cyy_chip_tx()
666 info->icount.tx++; cyy_chip_tx()
677 cyy_writeb(info, CyTIR, save_xir & 0x3f); cyy_chip_tx()
678 cyy_writeb(info, CyCAR, save_car); cyy_chip_tx()
684 struct cyclades_port *info; cyy_chip_modem() local
692 info = &cinfo->ports[channel + chip * 4]; cyy_chip_modem()
693 save_car = cyy_readb(info, CyCAR); cyy_chip_modem()
694 cyy_writeb(info, CyCAR, save_xir); cyy_chip_modem()
696 mdm_change = cyy_readb(info, CyMISR); cyy_chip_modem()
697 mdm_status = cyy_readb(info, CyMSVR1); cyy_chip_modem()
699 tty = tty_port_tty_get(&info->port); cyy_chip_modem()
706 info->icount.dcd++; cyy_chip_modem()
708 info->icount.cts++; cyy_chip_modem()
710 info->icount.dsr++; cyy_chip_modem()
712 info->icount.rng++; cyy_chip_modem()
714 wake_up_interruptible(&info->port.delta_msr_wait); cyy_chip_modem()
717 if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) { cyy_chip_modem()
719 wake_up_interruptible(&info->port.open_wait); cyy_chip_modem()
723 if ((mdm_change & CyCTS) && tty_port_cts_enabled(&info->port)) { cyy_chip_modem()
729 cyy_writeb(info, CySRER, cyy_chip_modem()
730 cyy_readb(info, CySRER) | CyTxRdy); cyy_chip_modem()
738 cyy_writeb(info, CySRER, cyy_chip_modem()
739 cyy_readb(info, CySRER) & ~CyTxRdy); cyy_chip_modem()
750 cyy_writeb(info, CyMIR, save_xir & 0x3f); cyy_chip_modem()
751 cyy_writeb(info, CyCAR, save_car); cyy_chip_modem()
822 static void cyy_change_rts_dtr(struct cyclades_port *info, unsigned int set, cyy_change_rts_dtr() argument
825 struct cyclades_card *card = info->card; cyy_change_rts_dtr()
826 int channel = info->line - card->first_line; cyy_change_rts_dtr()
831 if (info->rtsdtr_inv) { cyy_change_rts_dtr()
843 cyy_writeb(info, CyCAR, channel); cyy_change_rts_dtr()
844 cyy_writeb(info, msvrr, rts); cyy_change_rts_dtr()
847 cyy_writeb(info, CyCAR, channel); cyy_change_rts_dtr()
848 cyy_writeb(info, msvrr, ~rts); cyy_change_rts_dtr()
851 cyy_writeb(info, CyCAR, channel); cyy_change_rts_dtr()
852 cyy_writeb(info, msvrd, dtr); cyy_change_rts_dtr()
856 cyy_readb(info, CyMSVR1), cyy_change_rts_dtr()
857 cyy_readb(info, CyMSVR2)); cyy_change_rts_dtr()
861 cyy_writeb(info, CyCAR, channel); cyy_change_rts_dtr()
862 cyy_writeb(info, msvrd, ~dtr); cyy_change_rts_dtr()
866 cyy_readb(info, CyMSVR1), cyy_change_rts_dtr()
867 cyy_readb(info, CyMSVR2)); cyy_change_rts_dtr()
920 static void cyz_handle_rx(struct cyclades_port *info) cyz_handle_rx() argument
922 struct BUF_CTRL __iomem *buf_ctrl = info->u.cyz.buf_ctrl; cyz_handle_rx()
923 struct cyclades_card *cinfo = info->card; cyz_handle_rx()
924 struct tty_port *port = &info->port; cyz_handle_rx()
947 info->mon.int_count++; cyz_handle_rx()
948 info->mon.char_count += char_count; cyz_handle_rx()
949 if (char_count > info->mon.char_max) cyz_handle_rx()
950 info->mon.char_max = char_count; cyz_handle_rx()
951 info->mon.char_last = char_count; cyz_handle_rx()
973 info->icount.rx += len; cyz_handle_rx()
974 info->idle_stats.recv_bytes += len; cyz_handle_rx()
984 info->idle_stats.recv_bytes++; cyz_handle_rx()
985 info->icount.rx++; cyz_handle_rx()
998 info->line])) cyz_handle_rx()
999 mod_timer(&cyz_rx_full_timer[info->line], cyz_handle_rx()
1002 info->idle_stats.recv_idle = jiffies; cyz_handle_rx()
1003 tty_schedule_flip(&info->port); cyz_handle_rx()
1009 static void cyz_handle_tx(struct cyclades_port *info) cyz_handle_tx() argument
1011 struct BUF_CTRL __iomem *buf_ctrl = info->u.cyz.buf_ctrl; cyz_handle_tx()
1012 struct cyclades_card *cinfo = info->card; cyz_handle_tx()
1021 if (info->xmit_cnt <= 0) /* Nothing to transmit */ cyz_handle_tx()
1036 tty = tty_port_tty_get(&info->port); cyz_handle_tx()
1040 if (info->x_char) { /* send special char */ cyz_handle_tx()
1041 data = info->x_char; cyz_handle_tx()
1045 info->x_char = 0; cyz_handle_tx()
1047 info->icount.tx++; cyz_handle_tx()
1052 (SERIAL_XMIT_SIZE - info->xmit_tail), cyz_handle_tx()
1053 min_t(unsigned int, info->xmit_cnt, cyz_handle_tx()
1057 &info->port.xmit_buf[info->xmit_tail], cyz_handle_tx()
1062 info->icount.tx += small_count; cyz_handle_tx()
1063 info->xmit_cnt -= small_count; cyz_handle_tx()
1064 info->xmit_tail = (info->xmit_tail + small_count) & cyz_handle_tx()
1068 while (info->xmit_cnt && char_count) { cyz_handle_tx()
1069 data = info->port.xmit_buf[info->xmit_tail]; cyz_handle_tx()
1070 info->xmit_cnt--; cyz_handle_tx()
1071 info->xmit_tail = (info->xmit_tail + 1) & cyz_handle_tx()
1077 info->icount.tx++; cyz_handle_tx()
1090 struct cyclades_port *info; cyz_handle_cmd() local
1101 info = &cinfo->ports[channel]; cyz_handle_cmd()
1105 tty_insert_flip_char(&info->port, 0, TTY_PARITY); cyz_handle_cmd()
1106 info->icount.rx++; cyz_handle_cmd()
1110 tty_insert_flip_char(&info->port, 0, TTY_FRAME); cyz_handle_cmd()
1111 info->icount.rx++; cyz_handle_cmd()
1115 tty_insert_flip_char(&info->port, 0, TTY_BREAK); cyz_handle_cmd()
1116 info->icount.rx++; cyz_handle_cmd()
1120 info->icount.dcd++; cyz_handle_cmd()
1122 if (info->port.flags & ASYNC_CHECK_CD) { cyz_handle_cmd()
1124 readl(&info->u.cyz.ch_ctrl->rs_status); cyz_handle_cmd()
1126 wake_up_interruptible(&info->port.open_wait); cyz_handle_cmd()
1128 tty_port_tty_hangup(&info->port, false); cyz_handle_cmd()
1132 info->icount.cts++; cyz_handle_cmd()
1136 info->icount.rng++; cyz_handle_cmd()
1140 info->icount.dsr++; cyz_handle_cmd()
1145 complete(&info->shutdown_wait); cyz_handle_cmd()
1155 "port %ld\n", info->card, channel); cyz_handle_cmd()
1157 cyz_handle_rx(info); cyz_handle_cmd()
1165 "port %ld\n", info->card, channel); cyz_handle_cmd()
1167 cyz_handle_tx(info); cyz_handle_cmd()
1177 wake_up_interruptible(&info->port.delta_msr_wait); cyz_handle_cmd()
1179 tty_schedule_flip(&info->port); cyz_handle_cmd()
1204 struct cyclades_port *info = (struct cyclades_port *)arg; cyz_rx_restart() local
1205 struct cyclades_card *card = info->card; cyz_rx_restart()
1207 __u32 channel = info->line - card->first_line; cyz_rx_restart()
1214 info->line, retval); cyz_rx_restart()
1224 struct cyclades_port *info; cyz_poll() local
1245 info = &cinfo->ports[port]; cyz_poll()
1247 if (!info->throttle) cyz_poll()
1248 cyz_handle_rx(info); cyz_poll()
1249 cyz_handle_tx(info); cyz_poll()
1265 static int cy_startup(struct cyclades_port *info, struct tty_struct *tty) cy_startup() argument
1273 card = info->card; cy_startup()
1274 channel = info->line - card->first_line; cy_startup()
1282 if (info->port.flags & ASYNC_INITIALIZED) cy_startup()
1285 if (!info->type) { cy_startup()
1290 if (info->port.xmit_buf) cy_startup()
1293 info->port.xmit_buf = (unsigned char *)page; cy_startup()
1297 cy_set_line_char(info, tty); cy_startup()
1304 cyy_writeb(info, CyCAR, channel); cy_startup()
1306 cyy_writeb(info, CyRTPR, cy_startup()
1307 (info->default_timeout ? info->default_timeout : 0x02)); cy_startup()
1310 cyy_issue_cmd(info, CyCHAN_CTL | CyENB_RCVR | CyENB_XMTR); cy_startup()
1312 cyy_change_rts_dtr(info, TIOCM_RTS | TIOCM_DTR, 0); cy_startup()
1314 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) | CyRxData); cy_startup()
1316 struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl; cy_startup()
1350 "%x\n", info->line, retval); cy_startup()
1357 "%x\n", info->line, retval); cy_startup()
1362 tty_port_raise_dtr_rts(&info->port); cy_startup()
1367 info->port.flags |= ASYNC_INITIALIZED; cy_startup()
1370 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; cy_startup()
1371 info->breakon = info->breakoff = 0; cy_startup()
1372 memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); cy_startup()
1373 info->idle_stats.in_use = cy_startup()
1374 info->idle_stats.recv_idle = cy_startup()
1375 info->idle_stats.xmit_idle = jiffies; cy_startup()
1390 static void start_xmit(struct cyclades_port *info) start_xmit() argument
1392 struct cyclades_card *card = info->card; start_xmit()
1394 int channel = info->line - card->first_line; start_xmit()
1398 cyy_writeb(info, CyCAR, channel & 0x03); start_xmit()
1399 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) | CyTxRdy); start_xmit()
1409 "%x\n", info->line, retval); start_xmit()
1422 static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty) cy_shutdown() argument
1427 if (!(info->port.flags & ASYNC_INITIALIZED)) cy_shutdown()
1430 card = info->card; cy_shutdown()
1435 wake_up_interruptible(&info->port.delta_msr_wait); cy_shutdown()
1437 if (info->port.xmit_buf) { cy_shutdown()
1439 temp = info->port.xmit_buf; cy_shutdown()
1440 info->port.xmit_buf = NULL; cy_shutdown()
1444 cyy_change_rts_dtr(info, 0, TIOCM_RTS | TIOCM_DTR); cy_shutdown()
1446 cyy_issue_cmd(info, CyCHAN_CTL | CyDIS_RCVR); cy_shutdown()
1451 info->port.flags &= ~ASYNC_INITIALIZED; cy_shutdown()
1455 int channel = info->line - card->first_line; cy_shutdown()
1465 if (info->port.xmit_buf) { cy_shutdown()
1467 temp = info->port.xmit_buf; cy_shutdown()
1468 info->port.xmit_buf = NULL; cy_shutdown()
1473 tty_port_lower_dtr_rts(&info->port); cy_shutdown()
1476 info->port.flags &= ~ASYNC_INITIALIZED; cy_shutdown()
1498 struct cyclades_port *info; cy_open() local
1508 info = &cy_card[i].ports[line - cy_card[i].first_line]; cy_open()
1509 if (info->line < 0) cy_open()
1516 if (cy_is_Z(info->card)) { cy_open()
1517 struct cyclades_card *cinfo = info->card; cy_open()
1559 if (info->line > (cinfo->first_line + cinfo->nports - 1)) cy_open()
1563 printk(KERN_DEBUG "cyc:cy_open ttyC%d\n", info->line); cy_open()
1565 tty->driver_data = info; cy_open()
1566 if (serial_paranoia_check(info, tty->name, "cy_open")) cy_open()
1570 printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line, cy_open()
1571 info->port.count); cy_open()
1573 info->port.count++; cy_open()
1576 current->pid, info->port.count); cy_open()
1582 retval = cy_startup(info, tty); cy_open()
1586 retval = tty_port_block_til_ready(&info->port, tty, filp); cy_open()
1595 info->throttle = 0; cy_open()
1596 tty_port_tty_set(&info->port, tty); cy_open()
1610 struct cyclades_port *info = tty->driver_data; cy_wait_until_sent() local
1614 if (serial_paranoia_check(info, tty->name, "cy_wait_until_sent")) cy_wait_until_sent()
1617 if (info->xmit_fifo_size == 0) cy_wait_until_sent()
1629 char_time = (info->timeout - HZ / 50) / info->xmit_fifo_size; cy_wait_until_sent()
1642 * takes longer than info->timeout, this is probably due to a cy_wait_until_sent()
1644 * 2*info->timeout. cy_wait_until_sent()
1646 if (!timeout || timeout > 2 * info->timeout) cy_wait_until_sent()
1647 timeout = 2 * info->timeout; cy_wait_until_sent()
1649 card = info->card; cy_wait_until_sent()
1651 while (cyy_readb(info, CySRER) & CyTxRdy) { cy_wait_until_sent()
1665 struct cyclades_port *info = tty->driver_data; cy_flush_buffer() local
1671 printk(KERN_DEBUG "cyc:cy_flush_buffer ttyC%d\n", info->line); cy_flush_buffer()
1674 if (serial_paranoia_check(info, tty->name, "cy_flush_buffer")) cy_flush_buffer()
1677 card = info->card; cy_flush_buffer()
1678 channel = info->line - card->first_line; cy_flush_buffer()
1681 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; cy_flush_buffer()
1690 "was %x\n", info->line, retval); cy_flush_buffer()
1700 struct cyclades_port *info = container_of(port, struct cyclades_port, cy_do_close() local
1706 card = info->card; cy_do_close()
1707 channel = info->line - card->first_line; cy_do_close()
1712 cyy_writeb(info, CyCAR, channel & 0x03); cy_do_close()
1713 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) & ~CyRxData); cy_do_close()
1714 if (info->port.flags & ASYNC_INITIALIZED) { cy_do_close()
1718 cy_wait_until_sent(port->tty, info->timeout); cy_do_close()
1725 struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl; cy_do_close()
1732 "ttyC%d was %x\n", info->line, retval); cy_do_close()
1735 wait_for_completion_interruptible(&info->shutdown_wait); cy_do_close()
1741 cy_shutdown(info, port->tty); cy_do_close()
1749 struct cyclades_port *info = tty->driver_data; cy_close() local
1750 if (!info || serial_paranoia_check(info, tty->name, "cy_close")) cy_close()
1752 tty_port_close(&info->port, tty, filp); cy_close()
1770 struct cyclades_port *info = tty->driver_data; cy_write() local
1775 printk(KERN_DEBUG "cyc:cy_write ttyC%d\n", info->line); cy_write()
1778 if (serial_paranoia_check(info, tty->name, "cy_write")) cy_write()
1781 if (!info->port.xmit_buf) cy_write()
1784 spin_lock_irqsave(&info->card->card_lock, flags); cy_write()
1786 c = min(count, (int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1)); cy_write()
1787 c = min(c, (int)(SERIAL_XMIT_SIZE - info->xmit_head)); cy_write()
1792 memcpy(info->port.xmit_buf + info->xmit_head, buf, c); cy_write()
1793 info->xmit_head = (info->xmit_head + c) & cy_write()
1795 info->xmit_cnt += c; cy_write()
1800 spin_unlock_irqrestore(&info->card->card_lock, flags); cy_write()
1802 info->idle_stats.xmit_bytes += ret; cy_write()
1803 info->idle_stats.xmit_idle = jiffies; cy_write()
1805 if (info->xmit_cnt && !tty->stopped && !tty->hw_stopped) cy_write()
1806 start_xmit(info); cy_write()
1820 struct cyclades_port *info = tty->driver_data; cy_put_char() local
1824 printk(KERN_DEBUG "cyc:cy_put_char ttyC%d\n", info->line); cy_put_char()
1827 if (serial_paranoia_check(info, tty->name, "cy_put_char")) cy_put_char()
1830 if (!info->port.xmit_buf) cy_put_char()
1833 spin_lock_irqsave(&info->card->card_lock, flags); cy_put_char()
1834 if (info->xmit_cnt >= (int)(SERIAL_XMIT_SIZE - 1)) { cy_put_char()
1835 spin_unlock_irqrestore(&info->card->card_lock, flags); cy_put_char()
1839 info->port.xmit_buf[info->xmit_head++] = ch; cy_put_char()
1840 info->xmit_head &= SERIAL_XMIT_SIZE - 1; cy_put_char()
1841 info->xmit_cnt++; cy_put_char()
1842 info->idle_stats.xmit_bytes++; cy_put_char()
1843 info->idle_stats.xmit_idle = jiffies; cy_put_char()
1844 spin_unlock_irqrestore(&info->card->card_lock, flags); cy_put_char()
1854 struct cyclades_port *info = tty->driver_data; cy_flush_chars() local
1857 printk(KERN_DEBUG "cyc:cy_flush_chars ttyC%d\n", info->line); cy_flush_chars()
1860 if (serial_paranoia_check(info, tty->name, "cy_flush_chars")) cy_flush_chars()
1863 if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || cy_flush_chars()
1864 !info->port.xmit_buf) cy_flush_chars()
1867 start_xmit(info); cy_flush_chars()
1878 struct cyclades_port *info = tty->driver_data; cy_write_room() local
1882 printk(KERN_DEBUG "cyc:cy_write_room ttyC%d\n", info->line); cy_write_room()
1885 if (serial_paranoia_check(info, tty->name, "cy_write_room")) cy_write_room()
1887 ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; cy_write_room()
1895 struct cyclades_port *info = tty->driver_data; cy_chars_in_buffer() local
1897 if (serial_paranoia_check(info, tty->name, "cy_chars_in_buffer")) cy_chars_in_buffer()
1901 if (!cy_is_Z(info->card)) { cy_chars_in_buffer()
1905 info->line, info->xmit_cnt); cy_chars_in_buffer()
1907 return info->xmit_cnt; cy_chars_in_buffer()
1910 struct BUF_CTRL __iomem *buf_ctrl = info->u.cyz.buf_ctrl; cy_chars_in_buffer()
1923 info->line, info->xmit_cnt + char_count); cy_chars_in_buffer()
1925 return info->xmit_cnt + char_count; cy_chars_in_buffer()
1936 static void cyy_baud_calc(struct cyclades_port *info, __u32 baud) cyy_baud_calc() argument
1939 __u32 cy_clock = ((info->chip_rev >= CD1400_REV_J) ? 60000000 : cyy_baud_calc()
1943 info->tbpr = info->tco = info->rbpr = info->rco = 0; cyy_baud_calc()
1957 info->tbpr = info->rbpr = bpr; cyy_baud_calc()
1958 info->tco = info->rco = co; cyy_baud_calc()
1965 static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty) cy_set_line_char() argument
1974 if (info->line == -1) cy_set_line_char()
1983 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) cy_set_line_char()
1985 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) cy_set_line_char()
1987 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) cy_set_line_char()
1989 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) cy_set_line_char()
1992 card = info->card; cy_set_line_char()
1993 channel = info->line - card->first_line; cy_set_line_char()
2000 if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == cy_set_line_char()
2002 if (info->custom_divisor) cy_set_line_char()
2003 baud_rate = info->baud / info->custom_divisor; cy_set_line_char()
2005 baud_rate = info->baud; cy_set_line_char()
2017 if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == cy_set_line_char()
2019 cyy_baud_calc(info, baud_rate); cy_set_line_char()
2021 if (info->chip_rev >= CD1400_REV_J) { cy_set_line_char()
2023 info->tbpr = baud_bpr_60[i]; /* Tx BPR */ cy_set_line_char()
2024 info->tco = baud_co_60[i]; /* Tx CO */ cy_set_line_char()
2025 info->rbpr = baud_bpr_60[i]; /* Rx BPR */ cy_set_line_char()
2026 info->rco = baud_co_60[i]; /* Rx CO */ cy_set_line_char()
2028 info->tbpr = baud_bpr_25[i]; /* Tx BPR */ cy_set_line_char()
2029 info->tco = baud_co_25[i]; /* Tx CO */ cy_set_line_char()
2030 info->rbpr = baud_bpr_25[i]; /* Rx BPR */ cy_set_line_char()
2031 info->rco = baud_co_25[i]; /* Rx CO */ cy_set_line_char()
2036 info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + cy_set_line_char()
2038 } else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == cy_set_line_char()
2040 info->timeout = (info->xmit_fifo_size * HZ * 15 / cy_set_line_char()
2043 info->timeout = (info->xmit_fifo_size * HZ * 15 / cy_set_line_char()
2045 /* this needs to be propagated into the card info */ cy_set_line_char()
2047 info->timeout = 0; cy_set_line_char()
2054 info->cor5 = 0; cy_set_line_char()
2055 info->cor4 = 0; cy_set_line_char()
2057 info->cor3 = (info->default_threshold ? cy_set_line_char()
2058 info->default_threshold : baud_cor3[i]); cy_set_line_char()
2059 info->cor2 = CyETC; cy_set_line_char()
2062 info->cor1 = Cy_5_BITS; cy_set_line_char()
2065 info->cor1 = Cy_6_BITS; cy_set_line_char()
2068 info->cor1 = Cy_7_BITS; cy_set_line_char()
2071 info->cor1 = Cy_8_BITS; cy_set_line_char()
2075 info->cor1 |= Cy_2_STOP; cy_set_line_char()
2079 info->cor1 |= CyPARITY_O; cy_set_line_char()
2081 info->cor1 |= CyPARITY_E; cy_set_line_char()
2083 info->cor1 |= CyPARITY_NONE; cy_set_line_char()
2087 info->port.flags |= ASYNC_CTS_FLOW; cy_set_line_char()
2088 info->cor2 |= CyCtsAE; cy_set_line_char()
2090 info->port.flags &= ~ASYNC_CTS_FLOW; cy_set_line_char()
2091 info->cor2 &= ~CyCtsAE; cy_set_line_char()
2094 info->port.flags &= ~ASYNC_CHECK_CD; cy_set_line_char()
2096 info->port.flags |= ASYNC_CHECK_CD; cy_set_line_char()
2111 cyy_writeb(info, CyCAR, channel); cy_set_line_char()
2115 cyy_writeb(info, CyTCOR, info->tco); cy_set_line_char()
2116 cyy_writeb(info, CyTBPR, info->tbpr); cy_set_line_char()
2117 cyy_writeb(info, CyRCOR, info->rco); cy_set_line_char()
2118 cyy_writeb(info, CyRBPR, info->rbpr); cy_set_line_char()
2122 cyy_writeb(info, CySCHR1, START_CHAR(tty)); cy_set_line_char()
2123 cyy_writeb(info, CySCHR2, STOP_CHAR(tty)); cy_set_line_char()
2124 cyy_writeb(info, CyCOR1, info->cor1); cy_set_line_char()
2125 cyy_writeb(info, CyCOR2, info->cor2); cy_set_line_char()
2126 cyy_writeb(info, CyCOR3, info->cor3); cy_set_line_char()
2127 cyy_writeb(info, CyCOR4, info->cor4); cy_set_line_char()
2128 cyy_writeb(info, CyCOR5, info->cor5); cy_set_line_char()
2130 cyy_issue_cmd(info, CyCOR_CHANGE | CyCOR1ch | CyCOR2ch | cy_set_line_char()
2134 cyy_writeb(info, CyCAR, channel); cy_set_line_char()
2135 cyy_writeb(info, CyRTPR, cy_set_line_char()
2136 (info->default_timeout ? info->default_timeout : 0x02)); cy_set_line_char()
2143 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) | CyMdmCh); cy_set_line_char()
2145 if ((cflag & CRTSCTS) && info->rflow) cy_set_line_char()
2146 cyy_writeb(info, CyMCOR1, cflags | rflow_thr[i]); cy_set_line_char()
2148 cyy_writeb(info, CyMCOR1, cflags); cy_set_line_char()
2150 cyy_writeb(info, CyMCOR2, cflags); cy_set_line_char()
2153 cyy_change_rts_dtr(info, 0, TIOCM_DTR); cy_set_line_char()
2155 cyy_change_rts_dtr(info, TIOCM_DTR, 0); cy_set_line_char()
2161 struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl; cy_set_line_char()
2170 if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == cy_set_line_char()
2172 if (info->custom_divisor) cy_set_line_char()
2173 baud_rate = info->baud / info->custom_divisor; cy_set_line_char()
2175 baud_rate = info->baud; cy_set_line_char()
2183 info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + cy_set_line_char()
2185 } else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) == cy_set_line_char()
2187 info->timeout = (info->xmit_fifo_size * HZ * 15 / cy_set_line_char()
2190 info->timeout = (info->xmit_fifo_size * HZ * 15 / cy_set_line_char()
2192 /* this needs to be propagated into the card info */ cy_set_line_char()
2194 info->timeout = 0; cy_set_line_char()
2237 info->port.flags &= ~ASYNC_CTS_FLOW; cy_set_line_char()
2251 "was %x\n", info->line, retval); cy_set_line_char()
2256 info->port.flags &= ~ASYNC_CHECK_CD; cy_set_line_char()
2258 info->port.flags |= ASYNC_CHECK_CD; cy_set_line_char()
2277 "was %x\n", info->line, retval); cy_set_line_char()
2284 static int cy_get_serial_info(struct cyclades_port *info, cy_get_serial_info() argument
2287 struct cyclades_card *cinfo = info->card; cy_get_serial_info()
2289 .type = info->type, cy_get_serial_info()
2290 .line = info->line, cy_get_serial_info()
2291 .port = (info->card - cy_card) * 0x100 + info->line - cy_get_serial_info()
2294 .flags = info->port.flags, cy_get_serial_info()
2295 .close_delay = info->port.close_delay, cy_get_serial_info()
2296 .closing_wait = info->port.closing_wait, cy_get_serial_info()
2297 .baud_base = info->baud, cy_get_serial_info()
2298 .custom_divisor = info->custom_divisor, cy_get_serial_info()
2305 cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty, cy_set_serial_info() argument
2314 mutex_lock(&info->port.mutex); cy_set_serial_info()
2316 if (new_serial.close_delay != info->port.close_delay || cy_set_serial_info()
2317 new_serial.baud_base != info->baud || cy_set_serial_info()
2320 (info->port.flags & ASYNC_FLAGS & ~ASYNC_USR_MASK)) cy_set_serial_info()
2322 mutex_unlock(&info->port.mutex); cy_set_serial_info()
2325 info->port.flags = (info->port.flags & ~ASYNC_USR_MASK) | cy_set_serial_info()
2327 info->baud = new_serial.baud_base; cy_set_serial_info()
2328 info->custom_divisor = new_serial.custom_divisor; cy_set_serial_info()
2337 info->baud = new_serial.baud_base; cy_set_serial_info()
2338 info->custom_divisor = new_serial.custom_divisor; cy_set_serial_info()
2339 info->port.flags = (info->port.flags & ~ASYNC_FLAGS) | cy_set_serial_info()
2341 info->port.close_delay = new_serial.close_delay * HZ / 100; cy_set_serial_info()
2342 info->port.closing_wait = new_serial.closing_wait * HZ / 100; cy_set_serial_info()
2345 if (info->port.flags & ASYNC_INITIALIZED) { cy_set_serial_info()
2346 cy_set_line_char(info, tty); cy_set_serial_info()
2349 ret = cy_startup(info, tty); cy_set_serial_info()
2351 mutex_unlock(&info->port.mutex); cy_set_serial_info()
2356 * get_lsr_info - get line status register info
2358 * Purpose: Let user call ioctl() to get info when the UART physically
2365 static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value) get_lsr_info() argument
2367 struct cyclades_card *card = info->card; get_lsr_info()
2374 status = cyy_readb(info, CySRER) & (CyTxRdy | CyTxMpty); get_lsr_info()
2386 struct cyclades_port *info = tty->driver_data; cy_tiocmget() local
2390 if (serial_paranoia_check(info, tty->name, __func__)) cy_tiocmget()
2393 card = info->card; cy_tiocmget()
2397 int channel = info->line - card->first_line; cy_tiocmget()
2401 cyy_writeb(info, CyCAR, channel & 0x03); cy_tiocmget()
2402 status = cyy_readb(info, CyMSVR1); cy_tiocmget()
2403 status |= cyy_readb(info, CyMSVR2); cy_tiocmget()
2406 if (info->rtsdtr_inv) { cy_tiocmget()
2425 lstatus = readl(&info->u.cyz.ch_ctrl->rs_status); cy_tiocmget()
2441 struct cyclades_port *info = tty->driver_data; cy_tiocmset() local
2445 if (serial_paranoia_check(info, tty->name, __func__)) cy_tiocmset()
2448 card = info->card; cy_tiocmset()
2451 cyy_change_rts_dtr(info, set, clear); cy_tiocmset()
2454 struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl; cy_tiocmset()
2455 int retval, channel = info->line - card->first_line; cy_tiocmset()
2485 "was %x\n", info->line, retval); cy_tiocmset()
2496 struct cyclades_port *info = tty->driver_data; cy_break() local
2501 if (serial_paranoia_check(info, tty->name, "cy_break")) cy_break()
2504 card = info->card; cy_break()
2512 if (!info->breakon) { cy_break()
2513 info->breakon = 1; cy_break()
2514 if (!info->xmit_cnt) { cy_break()
2516 start_xmit(info); cy_break()
2521 if (!info->breakoff) { cy_break()
2522 info->breakoff = 1; cy_break()
2523 if (!info->xmit_cnt) { cy_break()
2525 start_xmit(info); cy_break()
2533 info->line - card->first_line, cy_break()
2537 "ttyC%d was %x\n", info->line, retval); cy_break()
2541 info->line - card->first_line, cy_break()
2545 "on ttyC%d was %x\n", info->line, cy_break()
2554 static int set_threshold(struct cyclades_port *info, unsigned long value) set_threshold() argument
2556 struct cyclades_card *card = info->card; set_threshold()
2560 info->cor3 &= ~CyREC_FIFO; set_threshold()
2561 info->cor3 |= value & CyREC_FIFO; set_threshold()
2564 cyy_writeb(info, CyCOR3, info->cor3); set_threshold()
2565 cyy_issue_cmd(info, CyCOR_CHANGE | CyCOR3ch); set_threshold()
2571 static int get_threshold(struct cyclades_port *info, get_threshold() argument
2574 struct cyclades_card *card = info->card; get_threshold()
2577 u8 tmp = cyy_readb(info, CyCOR3) & CyREC_FIFO; get_threshold()
2583 static int set_timeout(struct cyclades_port *info, unsigned long value) set_timeout() argument
2585 struct cyclades_card *card = info->card; set_timeout()
2590 cyy_writeb(info, CyRTPR, value & 0xff); set_timeout()
2596 static int get_timeout(struct cyclades_port *info, get_timeout() argument
2599 struct cyclades_card *card = info->card; get_timeout()
2602 u8 tmp = cyy_readb(info, CyRTPR); get_timeout()
2608 static int cy_cflags_changed(struct cyclades_port *info, unsigned long arg, cy_cflags_changed() argument
2615 spin_lock_irqsave(&info->card->card_lock, flags); cy_cflags_changed()
2616 cnow = info->icount; /* atomic copy */ cy_cflags_changed()
2617 spin_unlock_irqrestore(&info->card->card_lock, flags); cy_cflags_changed()
2638 struct cyclades_port *info = tty->driver_data; cy_ioctl() local
2644 if (serial_paranoia_check(info, tty->name, "cy_ioctl")) cy_ioctl()
2649 info->line, cmd, arg); cy_ioctl()
2654 if (copy_to_user(argp, &info->mon, sizeof(info->mon))) { cy_ioctl()
2658 memset(&info->mon, 0, sizeof(info->mon)); cy_ioctl()
2661 ret_val = get_threshold(info, argp); cy_ioctl()
2664 ret_val = set_threshold(info, arg); cy_ioctl()
2667 ret_val = put_user(info->default_threshold, cy_ioctl()
2671 info->default_threshold = arg & 0x0f; cy_ioctl()
2674 ret_val = get_timeout(info, argp); cy_ioctl()
2677 ret_val = set_timeout(info, arg); cy_ioctl()
2680 ret_val = put_user(info->default_timeout, cy_ioctl()
2684 info->default_timeout = arg & 0xff; cy_ioctl()
2687 info->rflow = (int)arg; cy_ioctl()
2690 ret_val = info->rflow; cy_ioctl()
2693 info->rtsdtr_inv = (int)arg; cy_ioctl()
2696 ret_val = info->rtsdtr_inv; cy_ioctl()
2699 ret_val = info->chip_rev; cy_ioctl()
2712 info->port.closing_wait = (unsigned short)arg * HZ / 100; cy_ioctl()
2715 ret_val = info->port.closing_wait / (HZ / 100); cy_ioctl()
2718 ret_val = cy_get_serial_info(info, argp); cy_ioctl()
2721 ret_val = cy_set_serial_info(info, tty, argp); cy_ioctl()
2724 ret_val = get_lsr_info(info, argp); cy_ioctl()
2733 spin_lock_irqsave(&info->card->card_lock, flags); cy_ioctl()
2735 cnow = info->icount; cy_ioctl()
2736 spin_unlock_irqrestore(&info->card->card_lock, flags); cy_ioctl()
2737 ret_val = wait_event_interruptible(info->port.delta_msr_wait, cy_ioctl()
2738 cy_cflags_changed(info, arg, &cnow)); cy_ioctl()
2760 struct cyclades_port *info = tty->driver_data; cy_get_icount() local
2764 spin_lock_irqsave(&info->card->card_lock, flags); cy_get_icount()
2765 cnow = info->icount; cy_get_icount()
2766 spin_unlock_irqrestore(&info->card->card_lock, flags); cy_get_icount()
2790 struct cyclades_port *info = tty->driver_data; cy_set_termios() local
2793 printk(KERN_DEBUG "cyc:cy_set_termios ttyC%d\n", info->line); cy_set_termios()
2796 cy_set_line_char(info, tty); cy_set_termios()
2812 wake_up_interruptible(&info->port.open_wait); cy_set_termios()
2821 struct cyclades_port *info = tty->driver_data; cy_send_xchar() local
2825 if (serial_paranoia_check(info, tty->name, "cy_send_xchar")) cy_send_xchar()
2828 info->x_char = ch; cy_send_xchar()
2833 card = info->card; cy_send_xchar()
2834 channel = info->line - card->first_line; cy_send_xchar()
2850 struct cyclades_port *info = tty->driver_data; cy_throttle() local
2856 tty->ldisc.chars_in_buffer(tty), info->line); cy_throttle()
2859 if (serial_paranoia_check(info, tty->name, "cy_throttle")) cy_throttle()
2862 card = info->card; cy_throttle()
2868 info->throttle = 1; cy_throttle()
2874 cyy_change_rts_dtr(info, 0, TIOCM_RTS); cy_throttle()
2877 info->throttle = 1; cy_throttle()
2889 struct cyclades_port *info = tty->driver_data; cy_unthrottle() local
2895 tty_name(tty), tty_chars_in_buffer(tty), info->line); cy_unthrottle()
2898 if (serial_paranoia_check(info, tty->name, "cy_unthrottle")) cy_unthrottle()
2902 if (info->x_char) cy_unthrottle()
2903 info->x_char = 0; cy_unthrottle()
2909 card = info->card; cy_unthrottle()
2912 cyy_change_rts_dtr(info, TIOCM_RTS, 0); cy_unthrottle()
2915 info->throttle = 0; cy_unthrottle()
2926 struct cyclades_port *info = tty->driver_data; cy_stop() local
2931 printk(KERN_DEBUG "cyc:cy_stop ttyC%d\n", info->line); cy_stop()
2934 if (serial_paranoia_check(info, tty->name, "cy_stop")) cy_stop()
2937 cinfo = info->card; cy_stop()
2938 channel = info->line - cinfo->first_line; cy_stop()
2941 cyy_writeb(info, CyCAR, channel & 0x03); cy_stop()
2942 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) & ~CyTxRdy); cy_stop()
2950 struct cyclades_port *info = tty->driver_data; cy_start() local
2955 printk(KERN_DEBUG "cyc:cy_start ttyC%d\n", info->line); cy_start()
2958 if (serial_paranoia_check(info, tty->name, "cy_start")) cy_start()
2961 cinfo = info->card; cy_start()
2962 channel = info->line - cinfo->first_line; cy_start()
2965 cyy_writeb(info, CyCAR, channel & 0x03); cy_start()
2966 cyy_writeb(info, CySRER, cyy_readb(info, CySRER) | CyTxRdy); cy_start()
2976 struct cyclades_port *info = tty->driver_data; cy_hangup() local
2979 printk(KERN_DEBUG "cyc:cy_hangup ttyC%d\n", info->line); cy_hangup()
2982 if (serial_paranoia_check(info, tty->name, "cy_hangup")) cy_hangup()
2986 cy_shutdown(info, tty); cy_hangup()
2987 tty_port_hangup(&info->port); cy_hangup()
2992 struct cyclades_port *info = container_of(port, struct cyclades_port, cyy_carrier_raised() local
2994 struct cyclades_card *cinfo = info->card; cyy_carrier_raised()
2996 int channel = info->line - cinfo->first_line; cyy_carrier_raised()
3000 cyy_writeb(info, CyCAR, channel & 0x03); cyy_carrier_raised()
3001 cd = cyy_readb(info, CyMSVR1) & CyDCD; cyy_carrier_raised()
3009 struct cyclades_port *info = container_of(port, struct cyclades_port, cyy_dtr_rts() local
3011 struct cyclades_card *cinfo = info->card; cyy_dtr_rts()
3015 cyy_change_rts_dtr(info, raise ? TIOCM_RTS | TIOCM_DTR : 0, cyy_dtr_rts()
3022 struct cyclades_port *info = container_of(port, struct cyclades_port, cyz_carrier_raised() local
3025 return readl(&info->u.cyz.ch_ctrl->rs_status) & C_RS_DCD; cyz_carrier_raised()
3030 struct cyclades_port *info = container_of(port, struct cyclades_port, cyz_dtr_rts() local
3032 struct cyclades_card *cinfo = info->card; cyz_dtr_rts()
3033 struct CH_CTRL __iomem *ch_ctrl = info->u.cyz.ch_ctrl; cyz_dtr_rts()
3034 int ret, channel = info->line - cinfo->first_line; cyz_dtr_rts()
3046 __func__, info->line, ret); cyz_dtr_rts()
3074 struct cyclades_port *info; cy_init_card() local
3089 info = &cinfo->ports[channel]; cy_init_card()
3090 tty_port_init(&info->port); cy_init_card()
3091 info->magic = CYCLADES_MAGIC; cy_init_card()
3092 info->card = cinfo; cy_init_card()
3093 info->line = port; cy_init_card()
3095 info->port.closing_wait = CLOSING_WAIT_DELAY; cy_init_card()
3096 info->port.close_delay = 5 * HZ / 10; cy_init_card()
3097 info->port.flags = STD_COM_FLAGS; cy_init_card()
3098 init_completion(&info->shutdown_wait); cy_init_card()
3104 info->port.ops = &cyz_port_ops; cy_init_card()
3105 info->type = PORT_STARTECH; cy_init_card()
3109 info->u.cyz.ch_ctrl = &zfw_ctrl->ch_ctrl[channel]; cy_init_card()
3110 info->u.cyz.buf_ctrl = &zfw_ctrl->buf_ctrl[channel]; cy_init_card()
3113 info->xmit_fifo_size = CYZ_FIFO_SIZE; cy_init_card()
3115 info->xmit_fifo_size = 4 * CYZ_FIFO_SIZE; cy_init_card()
3118 cyz_rx_restart, (unsigned long)info); cy_init_card()
3124 info->port.ops = &cyy_port_ops; cy_init_card()
3125 info->type = PORT_CIRRUS; cy_init_card()
3126 info->xmit_fifo_size = CyMAX_CHAR_FIFO; cy_init_card()
3127 info->cor1 = CyPARITY_NONE | Cy_1_STOP | Cy_8_BITS; cy_init_card()
3128 info->cor2 = CyETC; cy_init_card()
3129 info->cor3 = 0x08; /* _very_ small rcv threshold */ cy_init_card()
3132 info->u.cyy.base_addr = cinfo->base_addr + cy_init_card()
3134 info->chip_rev = cyy_readb(info, CyGFRCR); cy_init_card()
3136 if (info->chip_rev >= CD1400_REV_J) { cy_init_card()
3138 info->tbpr = baud_bpr_60[13]; /* Tx BPR */ cy_init_card()
3139 info->tco = baud_co_60[13]; /* Tx CO */ cy_init_card()
3140 info->rbpr = baud_bpr_60[13]; /* Rx BPR */ cy_init_card()
3141 info->rco = baud_co_60[13]; /* Rx CO */ cy_init_card()
3142 info->rtsdtr_inv = 1; cy_init_card()
3144 info->tbpr = baud_bpr_25[13]; /* Tx BPR */ cy_init_card()
3145 info->tco = baud_co_25[13]; /* Tx CO */ cy_init_card()
3146 info->rbpr = baud_bpr_25[13]; /* Rx BPR */ cy_init_card()
3147 info->rco = baud_co_25[13]; /* Rx CO */ cy_init_card()
3148 info->rtsdtr_inv = 0; cy_init_card()
3150 info->read_status_mask = CyTIMEOUT | CySPECHAR | cy_init_card()
3952 struct cyclades_port *info; cyclades_proc_show() local
3962 info = &cy_card[i].ports[j]; cyclades_proc_show()
3964 if (info->port.count) { cyclades_proc_show()
3969 tty = tty_port_tty_get(&info->port); cyclades_proc_show()
3979 "%10lu %8lu %9lu %6d\n", info->line, cyclades_proc_show()
3980 (cur_jifs - info->idle_stats.in_use) / cyclades_proc_show()
3981 HZ, info->idle_stats.xmit_bytes, cyclades_proc_show()
3982 (cur_jifs - info->idle_stats.xmit_idle)/ cyclades_proc_show()
3983 HZ, info->idle_stats.recv_bytes, cyclades_proc_show()
3984 (cur_jifs - info->idle_stats.recv_idle)/ cyclades_proc_show()
3985 HZ, info->idle_stats.overruns, cyclades_proc_show()
3990 info->line, 0L, 0L, 0L, 0L, 0L, 0L, 0L); cyclades_proc_show()
H A Damiserial.c48 tty->name, (info->tport.flags), serial_driver->refcount,info->count,tty->count,s)
122 static void change_speed(struct tty_struct *tty, struct serial_state *info,
136 static inline int serial_paranoia_check(struct serial_state *info, serial_paranoia_check() argument
145 if (!info) { serial_paranoia_check()
149 if (info->magic != SERIAL_MAGIC) { serial_paranoia_check()
189 struct serial_state *info = tty->driver_data; rs_stop() local
192 if (serial_paranoia_check(info, tty->name, "rs_stop")) rs_stop()
196 if (info->IER & UART_IER_THRI) { rs_stop()
197 info->IER &= ~UART_IER_THRI; rs_stop()
209 struct serial_state *info = tty->driver_data; rs_start() local
212 if (serial_paranoia_check(info, tty->name, "rs_start")) rs_start()
216 if (info->xmit.head != info->xmit.tail rs_start()
217 && info->xmit.buf rs_start()
218 && !(info->IER & UART_IER_THRI)) { rs_start()
219 info->IER |= UART_IER_THRI; rs_start()
250 static void receive_chars(struct serial_state *info) receive_chars() argument
258 icount = &info->icount; receive_chars()
305 if (status & info->ignore_status_mask) receive_chars()
308 status &= info->read_status_mask; receive_chars()
315 if (info->tport.flags & ASYNC_SAK) receive_chars()
316 do_SAK(info->tport.tty); receive_chars()
330 tty_insert_flip_char(&info->tport, ch, flag); receive_chars()
332 tty_insert_flip_char(&info->tport, 0, TTY_OVERRUN); receive_chars()
333 tty_flip_buffer_push(&info->tport); receive_chars()
338 static void transmit_chars(struct serial_state *info) transmit_chars() argument
342 if (info->x_char) { transmit_chars()
343 custom.serdat = info->x_char | 0x100; transmit_chars()
345 info->icount.tx++; transmit_chars()
346 info->x_char = 0; transmit_chars()
349 if (info->xmit.head == info->xmit.tail transmit_chars()
350 || info->tport.tty->stopped transmit_chars()
351 || info->tport.tty->hw_stopped) { transmit_chars()
352 info->IER &= ~UART_IER_THRI; transmit_chars()
358 custom.serdat = info->xmit.buf[info->xmit.tail++] | 0x100; transmit_chars()
360 info->xmit.tail = info->xmit.tail & (SERIAL_XMIT_SIZE-1); transmit_chars()
361 info->icount.tx++; transmit_chars()
363 if (CIRC_CNT(info->xmit.head, transmit_chars()
364 info->xmit.tail, transmit_chars()
366 tty_wakeup(info->tport.tty); transmit_chars()
371 if (info->xmit.head == info->xmit.tail) { transmit_chars()
374 info->IER &= ~UART_IER_THRI; transmit_chars()
378 static void check_modem_status(struct serial_state *info) check_modem_status() argument
380 struct tty_port *port = &info->tport; check_modem_status()
390 icount = &info->icount; check_modem_status()
404 printk("ttyS%d CD now %s...", info->line, check_modem_status()
424 info->IER |= UART_IER_THRI; check_modem_status()
439 info->IER &= ~UART_IER_THRI; check_modem_status()
453 struct serial_state *info = data; ser_vbl_int() local
458 if(info->IER & UART_IER_MSI) ser_vbl_int()
459 check_modem_status(info); ser_vbl_int()
465 struct serial_state *info = dev_id; ser_rx_int() local
471 if (!info->tport.tty) ser_rx_int()
474 receive_chars(info); ser_rx_int()
483 struct serial_state *info = dev_id; ser_tx_int() local
490 if (!info->tport.tty) ser_tx_int()
493 transmit_chars(info); ser_tx_int()
516 static int startup(struct tty_struct *tty, struct serial_state *info) startup() argument
518 struct tty_port *port = &info->tport; startup()
534 if (info->xmit.buf) startup()
537 info->xmit.buf = (unsigned char *) page; startup()
540 printk("starting up ttys%d ...", info->line); startup()
548 retval = request_irq(IRQ_AMIGA_VERTB, ser_vbl_int, 0, "serial status", info); startup()
560 info->IER = UART_IER_MSI; startup()
565 info->MCR = 0; startup()
567 info->MCR = SER_DTR | SER_RTS; startup()
568 rtsdtr_ctrl(info->MCR); startup()
571 info->xmit.head = info->xmit.tail = 0; startup()
588 change_speed(tty, info, NULL); startup()
603 static void shutdown(struct tty_struct *tty, struct serial_state *info) shutdown() argument
608 if (!(info->tport.flags & ASYNC_INITIALIZED)) shutdown()
611 state = info; shutdown()
614 printk("Shutting down serial port %d ....\n", info->line); shutdown()
623 wake_up_interruptible(&info->tport.delta_msr_wait); shutdown()
628 free_irq(IRQ_AMIGA_VERTB, info); shutdown()
630 if (info->xmit.buf) { shutdown()
631 free_page((unsigned long) info->xmit.buf); shutdown()
632 info->xmit.buf = NULL; shutdown()
635 info->IER = 0; shutdown()
644 info->MCR &= ~(SER_DTR|SER_RTS); shutdown()
645 rtsdtr_ctrl(info->MCR); shutdown()
649 info->tport.flags &= ~ASYNC_INITIALIZED; shutdown()
658 static void change_speed(struct tty_struct *tty, struct serial_state *info, change_speed() argument
661 struct tty_port *port = &info->tport; change_speed()
691 baud_base = info->baud_base; change_speed()
693 quot = info->custom_divisor; change_speed()
711 quot = info->custom_divisor; change_speed()
723 info->quot = quot; change_speed()
724 info->timeout = ((info->xmit_fifo_size*HZ*bits*quot) / baud_base); change_speed()
725 info->timeout += HZ/50; /* Add .02 seconds of slop */ change_speed()
728 info->IER &= ~UART_IER_MSI; change_speed()
730 info->IER |= UART_IER_MSI; change_speed()
733 info->IER |= UART_IER_MSI; change_speed()
740 info->IER |= UART_IER_MSI; change_speed()
750 info->read_status_mask = UART_LSR_OE | UART_LSR_DR; change_speed()
752 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; change_speed()
754 info->read_status_mask |= UART_LSR_BI; change_speed()
759 info->ignore_status_mask = 0; change_speed()
761 info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; change_speed()
763 info->ignore_status_mask |= UART_LSR_BI; change_speed()
769 info->ignore_status_mask |= UART_LSR_OE; change_speed()
775 info->ignore_status_mask |= UART_LSR_DR; change_speed()
798 struct serial_state *info; rs_put_char() local
801 info = tty->driver_data; rs_put_char()
803 if (serial_paranoia_check(info, tty->name, "rs_put_char")) rs_put_char()
806 if (!info->xmit.buf) rs_put_char()
810 if (CIRC_SPACE(info->xmit.head, rs_put_char()
811 info->xmit.tail, rs_put_char()
817 info->xmit.buf[info->xmit.head++] = ch; rs_put_char()
818 info->xmit.head &= SERIAL_XMIT_SIZE-1; rs_put_char()
825 struct serial_state *info = tty->driver_data; rs_flush_chars() local
828 if (serial_paranoia_check(info, tty->name, "rs_flush_chars")) rs_flush_chars()
831 if (info->xmit.head == info->xmit.tail rs_flush_chars()
834 || !info->xmit.buf) rs_flush_chars()
838 info->IER |= UART_IER_THRI; rs_flush_chars()
850 struct serial_state *info = tty->driver_data; rs_write() local
853 if (serial_paranoia_check(info, tty->name, "rs_write")) rs_write()
856 if (!info->xmit.buf) rs_write()
861 c = CIRC_SPACE_TO_END(info->xmit.head, rs_write()
862 info->xmit.tail, rs_write()
869 memcpy(info->xmit.buf + info->xmit.head, buf, c); rs_write()
870 info->xmit.head = ((info->xmit.head + c) & rs_write()
878 if (info->xmit.head != info->xmit.tail rs_write()
881 && !(info->IER & UART_IER_THRI)) { rs_write()
882 info->IER |= UART_IER_THRI; rs_write()
896 struct serial_state *info = tty->driver_data; rs_write_room() local
898 if (serial_paranoia_check(info, tty->name, "rs_write_room")) rs_write_room()
900 return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); rs_write_room()
905 struct serial_state *info = tty->driver_data; rs_chars_in_buffer() local
907 if (serial_paranoia_check(info, tty->name, "rs_chars_in_buffer")) rs_chars_in_buffer()
909 return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); rs_chars_in_buffer()
914 struct serial_state *info = tty->driver_data; rs_flush_buffer() local
917 if (serial_paranoia_check(info, tty->name, "rs_flush_buffer")) rs_flush_buffer()
920 info->xmit.head = info->xmit.tail = 0; rs_flush_buffer()
931 struct serial_state *info = tty->driver_data; rs_send_xchar() local
934 if (serial_paranoia_check(info, tty->name, "rs_send_xchar")) rs_send_xchar()
937 info->x_char = ch; rs_send_xchar()
952 info->IER |= UART_IER_THRI; rs_send_xchar()
966 struct serial_state *info = tty->driver_data; rs_throttle() local
973 if (serial_paranoia_check(info, tty->name, "rs_throttle")) rs_throttle()
980 info->MCR &= ~SER_RTS; rs_throttle()
983 rtsdtr_ctrl(info->MCR); rs_throttle()
989 struct serial_state *info = tty->driver_data; rs_unthrottle() local
996 if (serial_paranoia_check(info, tty->name, "rs_unthrottle")) rs_unthrottle()
1000 if (info->x_char) rs_unthrottle()
1001 info->x_char = 0; rs_unthrottle()
1006 info->MCR |= SER_RTS; rs_unthrottle()
1008 rtsdtr_ctrl(info->MCR); rs_unthrottle()
1115 * get_lsr_info - get line status register info
1117 * Purpose: Let user call ioctl() to get info when the UART physically
1124 static int get_lsr_info(struct serial_state *info, unsigned int __user *value) get_lsr_info() argument
1143 struct serial_state *info = tty->driver_data; rs_tiocmget() local
1147 if (serial_paranoia_check(info, tty->name, "rs_ioctl")) rs_tiocmget()
1152 control = info->MCR; rs_tiocmget()
1166 struct serial_state *info = tty->driver_data; rs_tiocmset() local
1169 if (serial_paranoia_check(info, tty->name, "rs_ioctl")) rs_tiocmset()
1176 info->MCR |= SER_RTS; rs_tiocmset()
1178 info->MCR |= SER_DTR; rs_tiocmset()
1180 info->MCR &= ~SER_RTS; rs_tiocmset()
1182 info->MCR &= ~SER_DTR; rs_tiocmset()
1183 rtsdtr_ctrl(info->MCR); rs_tiocmset()
1193 struct serial_state *info = tty->driver_data; rs_break() local
1196 if (serial_paranoia_check(info, tty->name, "rs_break")) rs_break()
1218 struct serial_state *info = tty->driver_data; rs_get_icount() local
1223 cnow = info->icount; rs_get_icount()
1243 struct serial_state *info = tty->driver_data; rs_ioctl() local
1250 if (serial_paranoia_check(info, tty->name, "rs_ioctl")) rs_ioctl()
1262 return get_serial_info(tty, info, argp); rs_ioctl()
1264 return set_serial_info(tty, info, argp); rs_ioctl()
1269 return get_lsr_info(info, argp); rs_ioctl()
1273 info, sizeof(struct serial_state))) rs_ioctl()
1286 cprev = info->icount; rs_ioctl()
1289 prepare_to_wait(&info->tport.delta_msr_wait, rs_ioctl()
1292 cnow = info->icount; /* atomic copy */ rs_ioctl()
1314 finish_wait(&info->tport.delta_msr_wait, &wait); rs_ioctl()
1331 struct serial_state *info = tty->driver_data; rs_set_termios() local
1335 change_speed(tty, info, old_termios); rs_set_termios()
1340 info->MCR &= ~(SER_DTR|SER_RTS); rs_set_termios()
1342 rtsdtr_ctrl(info->MCR); rs_set_termios()
1349 info->MCR |= SER_DTR; rs_set_termios()
1352 info->MCR |= SER_RTS; rs_set_termios()
1355 rtsdtr_ctrl(info->MCR); rs_set_termios()
1375 wake_up_interruptible(&info->open_wait); rs_set_termios()
1436 struct serial_state *info = tty->driver_data; rs_wait_until_sent() local
1440 if (serial_paranoia_check(info, tty->name, "rs_wait_until_sent")) rs_wait_until_sent()
1443 if (info->xmit_fifo_size == 0) rs_wait_until_sent()
1456 char_time = (info->timeout - HZ/50) / info->xmit_fifo_size; rs_wait_until_sent()
1467 * takes longer than info->timeout, this is probably due to a rs_wait_until_sent()
1469 * 2*info->timeout. rs_wait_until_sent()
1471 if (!timeout || timeout > 2*info->timeout) rs_wait_until_sent()
1472 timeout = 2*info->timeout; rs_wait_until_sent()
1499 struct serial_state *info = tty->driver_data; rs_hangup() local
1501 if (serial_paranoia_check(info, tty->name, "rs_hangup")) rs_hangup()
1505 shutdown(tty, info); rs_hangup()
1506 info->tport.count = 0; rs_hangup()
1507 info->tport.flags &= ~ASYNC_NORMAL_ACTIVE; rs_hangup()
1508 info->tport.tty = NULL; rs_hangup()
1509 wake_up_interruptible(&info->tport.open_wait); rs_hangup()
1520 struct serial_state *info = rs_table + tty->index; rs_open() local
1521 struct tty_port *port = &info->tport; rs_open()
1526 tty->driver_data = info; rs_open()
1528 if (serial_paranoia_check(info, tty->name, "rs_open")) rs_open()
1533 retval = startup(tty, info); rs_open()
1665 struct serial_state *info = container_of(port, struct serial_state, amiga_dtr_rts() local
1670 info->MCR |= SER_DTR|SER_RTS; amiga_dtr_rts()
1672 info->MCR &= ~(SER_DTR|SER_RTS); amiga_dtr_rts()
1675 rtsdtr_ctrl(info->MCR); amiga_dtr_rts()
/linux-4.4.14/drivers/mtd/maps/
H A Dlatch-addr-flash.c40 struct latch_addr_flash_info *info; lf_read() local
43 info = (struct latch_addr_flash_info *)map->map_priv_1; lf_read()
45 spin_lock(&info->lock); lf_read()
47 info->set_window(ofs, info->data); lf_read()
48 datum = inline_map_read(map, info->win_mask & ofs); lf_read()
50 spin_unlock(&info->lock); lf_read()
57 struct latch_addr_flash_info *info; lf_write() local
59 info = (struct latch_addr_flash_info *)map->map_priv_1; lf_write()
61 spin_lock(&info->lock); lf_write()
63 info->set_window(ofs, info->data); lf_write()
64 inline_map_write(map, datum, info->win_mask & ofs); lf_write()
66 spin_unlock(&info->lock); lf_write()
72 struct latch_addr_flash_info *info = lf_copy_from() local
77 n = info->win_mask + 1 - (from & info->win_mask); lf_copy_from()
81 spin_lock(&info->lock); lf_copy_from()
83 info->set_window(from, info->data); lf_copy_from()
84 memcpy_fromio(to, map->virt + (from & info->win_mask), n); lf_copy_from()
86 spin_unlock(&info->lock); lf_copy_from()
98 struct latch_addr_flash_info *info; latch_addr_flash_remove() local
101 info = platform_get_drvdata(dev); latch_addr_flash_remove()
102 if (info == NULL) latch_addr_flash_remove()
107 if (info->mtd != NULL) { latch_addr_flash_remove()
108 mtd_device_unregister(info->mtd); latch_addr_flash_remove()
109 map_destroy(info->mtd); latch_addr_flash_remove()
112 if (info->map.virt != NULL) latch_addr_flash_remove()
113 iounmap(info->map.virt); latch_addr_flash_remove()
115 if (info->res != NULL) latch_addr_flash_remove()
116 release_mem_region(info->res->start, resource_size(info->res)); latch_addr_flash_remove()
118 kfree(info); latch_addr_flash_remove()
129 struct latch_addr_flash_info *info; latch_addr_flash_probe() local
152 info = kzalloc(sizeof(struct latch_addr_flash_info), GFP_KERNEL); latch_addr_flash_probe()
153 if (info == NULL) { latch_addr_flash_probe()
158 platform_set_drvdata(dev, info); latch_addr_flash_probe()
160 info->res = request_mem_region(win_base, win_size, DRIVER_NAME); latch_addr_flash_probe()
161 if (info->res == NULL) { latch_addr_flash_probe()
167 info->map.name = DRIVER_NAME; latch_addr_flash_probe()
168 info->map.size = latch_addr_data->size; latch_addr_flash_probe()
169 info->map.bankwidth = latch_addr_data->width; latch_addr_flash_probe()
171 info->map.phys = NO_XIP; latch_addr_flash_probe()
172 info->map.virt = ioremap(win_base, win_size); latch_addr_flash_probe()
173 if (!info->map.virt) { latch_addr_flash_probe()
178 info->map.map_priv_1 = (unsigned long)info; latch_addr_flash_probe()
180 info->map.read = lf_read; latch_addr_flash_probe()
181 info->map.copy_from = lf_copy_from; latch_addr_flash_probe()
182 info->map.write = lf_write; latch_addr_flash_probe()
183 info->set_window = latch_addr_data->set_window; latch_addr_flash_probe()
184 info->data = latch_addr_data->data; latch_addr_flash_probe()
185 info->win_mask = win_size - 1; latch_addr_flash_probe()
187 spin_lock_init(&info->lock); latch_addr_flash_probe()
189 for (probe_type = rom_probe_types; !info->mtd && *probe_type; latch_addr_flash_probe()
191 info->mtd = do_map_probe(*probe_type, &info->map); latch_addr_flash_probe()
193 if (info->mtd == NULL) { latch_addr_flash_probe()
198 info->mtd->dev.parent = &dev->dev; latch_addr_flash_probe()
200 mtd_device_parse_register(info->mtd, NULL, NULL, latch_addr_flash_probe()
206 iounmap(info->map.virt); latch_addr_flash_probe()
208 release_mem_region(info->res->start, resource_size(info->res)); latch_addr_flash_probe()
210 kfree(info); latch_addr_flash_probe()
H A Dpxa2xx-flash.c52 struct pxa2xx_flash_info *info; pxa2xx_flash_probe() local
59 info = kzalloc(sizeof(struct pxa2xx_flash_info), GFP_KERNEL); pxa2xx_flash_probe()
60 if (!info) pxa2xx_flash_probe()
63 info->map.name = flash->name; pxa2xx_flash_probe()
64 info->map.bankwidth = flash->width; pxa2xx_flash_probe()
65 info->map.phys = res->start; pxa2xx_flash_probe()
66 info->map.size = resource_size(res); pxa2xx_flash_probe()
68 info->map.virt = ioremap(info->map.phys, info->map.size); pxa2xx_flash_probe()
69 if (!info->map.virt) { pxa2xx_flash_probe()
71 info->map.name); pxa2xx_flash_probe()
74 info->map.cached = memremap(info->map.phys, info->map.size, pxa2xx_flash_probe()
76 if (!info->map.cached) pxa2xx_flash_probe()
78 info->map.name); pxa2xx_flash_probe()
79 info->map.inval_cache = pxa2xx_map_inval_cache; pxa2xx_flash_probe()
80 simple_map_init(&info->map); pxa2xx_flash_probe()
85 info->map.name, (unsigned long)info->map.phys, pxa2xx_flash_probe()
86 info->map.bankwidth * 8); pxa2xx_flash_probe()
88 info->mtd = do_map_probe(flash->map_name, &info->map); pxa2xx_flash_probe()
90 if (!info->mtd) { pxa2xx_flash_probe()
91 iounmap((void *)info->map.virt); pxa2xx_flash_probe()
92 if (info->map.cached) pxa2xx_flash_probe()
93 iounmap(info->map.cached); pxa2xx_flash_probe()
96 info->mtd->dev.parent = &pdev->dev; pxa2xx_flash_probe()
98 mtd_device_parse_register(info->mtd, probes, NULL, flash->parts, pxa2xx_flash_probe()
101 platform_set_drvdata(pdev, info); pxa2xx_flash_probe()
107 struct pxa2xx_flash_info *info = platform_get_drvdata(dev); pxa2xx_flash_remove() local
109 mtd_device_unregister(info->mtd); pxa2xx_flash_remove()
111 map_destroy(info->mtd); pxa2xx_flash_remove()
112 iounmap(info->map.virt); pxa2xx_flash_remove()
113 if (info->map.cached) pxa2xx_flash_remove()
114 memunmap(info->map.cached); pxa2xx_flash_remove()
115 kfree(info); pxa2xx_flash_remove()
122 struct pxa2xx_flash_info *info = platform_get_drvdata(dev); pxa2xx_flash_shutdown() local
124 if (info && mtd_suspend(info->mtd) == 0) pxa2xx_flash_shutdown()
125 mtd_resume(info->mtd); pxa2xx_flash_shutdown()
H A Drbtx4939-flash.c31 struct rbtx4939_flash_info *info; rbtx4939_flash_remove() local
33 info = platform_get_drvdata(dev); rbtx4939_flash_remove()
34 if (!info) rbtx4939_flash_remove()
37 if (info->mtd) { rbtx4939_flash_remove()
38 mtd_device_unregister(info->mtd); rbtx4939_flash_remove()
39 map_destroy(info->mtd); rbtx4939_flash_remove()
50 struct rbtx4939_flash_info *info; rbtx4939_flash_probe() local
63 info = devm_kzalloc(&dev->dev, sizeof(struct rbtx4939_flash_info), rbtx4939_flash_probe()
65 if (!info) rbtx4939_flash_probe()
68 platform_set_drvdata(dev, info); rbtx4939_flash_probe()
77 info->map.name = dev_name(&dev->dev); rbtx4939_flash_probe()
78 info->map.phys = res->start; rbtx4939_flash_probe()
79 info->map.size = size; rbtx4939_flash_probe()
80 info->map.bankwidth = pdata->width; rbtx4939_flash_probe()
82 info->map.virt = devm_ioremap(&dev->dev, info->map.phys, size); rbtx4939_flash_probe()
83 if (!info->map.virt) rbtx4939_flash_probe()
87 (*pdata->map_init)(&info->map); rbtx4939_flash_probe()
89 simple_map_init(&info->map); rbtx4939_flash_probe()
92 for (; !info->mtd && *probe_type; probe_type++) rbtx4939_flash_probe()
93 info->mtd = do_map_probe(*probe_type, &info->map); rbtx4939_flash_probe()
94 if (!info->mtd) { rbtx4939_flash_probe()
99 info->mtd->dev.parent = &dev->dev; rbtx4939_flash_probe()
100 err = mtd_device_parse_register(info->mtd, NULL, NULL, pdata->parts, rbtx4939_flash_probe()
115 struct rbtx4939_flash_info *info = platform_get_drvdata(dev); rbtx4939_flash_shutdown() local
117 if (mtd_suspend(info->mtd) == 0) rbtx4939_flash_shutdown()
118 mtd_resume(info->mtd); rbtx4939_flash_shutdown()
H A Dphysmap.c36 struct physmap_flash_info *info; physmap_flash_remove() local
40 info = platform_get_drvdata(dev); physmap_flash_remove()
41 if (info == NULL) physmap_flash_remove()
46 if (info->cmtd) { physmap_flash_remove()
47 mtd_device_unregister(info->cmtd); physmap_flash_remove()
48 if (info->cmtd != info->mtd[0]) physmap_flash_remove()
49 mtd_concat_destroy(info->cmtd); physmap_flash_remove()
53 if (info->mtd[i] != NULL) physmap_flash_remove()
54 map_destroy(info->mtd[i]); physmap_flash_remove()
67 struct physmap_flash_info *info; physmap_set_vpp() local
76 info = platform_get_drvdata(pdev); physmap_set_vpp()
78 spin_lock_irqsave(&info->vpp_lock, flags); physmap_set_vpp()
80 if (++info->vpp_refcnt == 1) /* first nested 'on' */ physmap_set_vpp()
83 if (--info->vpp_refcnt == 0) /* last nested 'off' */ physmap_set_vpp()
86 spin_unlock_irqrestore(&info->vpp_lock, flags); physmap_set_vpp()
98 struct physmap_flash_info *info; physmap_flash_probe() local
109 info = devm_kzalloc(&dev->dev, sizeof(struct physmap_flash_info), physmap_flash_probe()
111 if (info == NULL) { physmap_flash_probe()
122 platform_set_drvdata(dev, info); physmap_flash_probe()
138 info->map[i].name = dev_name(&dev->dev); physmap_flash_probe()
139 info->map[i].phys = dev->resource[i].start; physmap_flash_probe()
140 info->map[i].size = resource_size(&dev->resource[i]); physmap_flash_probe()
141 info->map[i].bankwidth = physmap_data->width; physmap_flash_probe()
142 info->map[i].set_vpp = physmap_set_vpp; physmap_flash_probe()
143 info->map[i].pfow_base = physmap_data->pfow_base; physmap_flash_probe()
144 info->map[i].map_priv_1 = (unsigned long)dev; physmap_flash_probe()
146 info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, physmap_flash_probe()
147 info->map[i].size); physmap_flash_probe()
148 if (info->map[i].virt == NULL) { physmap_flash_probe()
154 simple_map_init(&info->map[i]); physmap_flash_probe()
158 for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) physmap_flash_probe()
159 info->mtd[i] = do_map_probe(*probe_type, &info->map[i]); physmap_flash_probe()
161 info->mtd[i] = do_map_probe(physmap_data->probe_type, &info->map[i]); physmap_flash_probe()
163 if (info->mtd[i] == NULL) { physmap_flash_probe()
170 info->mtd[i]->dev.parent = &dev->dev; physmap_flash_probe()
174 info->cmtd = info->mtd[0]; physmap_flash_probe()
179 info->cmtd = mtd_concat_create(info->mtd, devices_found, dev_name(&dev->dev)); physmap_flash_probe()
180 if (info->cmtd == NULL) physmap_flash_probe()
186 spin_lock_init(&info->vpp_lock); physmap_flash_probe()
190 mtd_device_parse_register(info->cmtd, part_types, NULL, physmap_flash_probe()
202 struct physmap_flash_info *info = platform_get_drvdata(dev); physmap_flash_shutdown() local
205 for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) physmap_flash_shutdown()
206 if (mtd_suspend(info->mtd[i]) == 0) physmap_flash_shutdown()
207 mtd_resume(info->mtd[i]); physmap_flash_shutdown()
H A Dplat-ram.c68 static inline void platram_setrw(struct platram_info *info, int to) platram_setrw() argument
70 if (info->pdata == NULL) platram_setrw()
73 if (info->pdata->set_rw != NULL) platram_setrw()
74 (info->pdata->set_rw)(info->dev, to); platram_setrw()
84 struct platram_info *info = to_platram_info(pdev); platram_remove() local
88 if (info == NULL) platram_remove()
91 if (info->mtd) { platram_remove()
92 mtd_device_unregister(info->mtd); platram_remove()
93 map_destroy(info->mtd); platram_remove()
98 platram_setrw(info, PLATRAM_RO); platram_remove()
102 if (info->area) { platram_remove()
103 release_resource(info->area); platram_remove()
104 kfree(info->area); platram_remove()
107 if (info->map.virt != NULL) platram_remove()
108 iounmap(info->map.virt); platram_remove()
110 kfree(info); platram_remove()
124 struct platram_info *info; platram_probe() local
138 info = kzalloc(sizeof(*info), GFP_KERNEL); platram_probe()
139 if (info == NULL) { platram_probe()
144 platform_set_drvdata(pdev, info); platram_probe()
146 info->dev = &pdev->dev; platram_probe()
147 info->pdata = pdata; platram_probe()
164 info->map.phys = res->start; platram_probe()
165 info->map.size = resource_size(res); platram_probe()
166 info->map.name = pdata->mapname != NULL ? platram_probe()
168 info->map.bankwidth = pdata->bankwidth; platram_probe()
172 info->area = request_mem_region(res->start, info->map.size, pdev->name); platram_probe()
173 if (info->area == NULL) { platram_probe()
181 info->map.virt = ioremap(res->start, info->map.size); platram_probe()
182 dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); platram_probe()
184 if (info->map.virt == NULL) { platram_probe()
190 simple_map_init(&info->map); platram_probe()
200 for ( ; !info->mtd && *map_probes; map_probes++) platram_probe()
201 info->mtd = do_map_probe(*map_probes , &info->map); platram_probe()
205 info->mtd = do_map_probe("map_ram", &info->map); platram_probe()
207 if (info->mtd == NULL) { platram_probe()
213 info->mtd->dev.parent = &pdev->dev; platram_probe()
215 platram_setrw(info, PLATRAM_RW); platram_probe()
220 err = mtd_device_parse_register(info->mtd, pdata->probes, NULL, platram_probe()
228 err = mtd_device_register(info->mtd, NULL, 0); platram_probe()
243 /* device driver info */
/linux-4.4.14/arch/s390/kernel/
H A Dsysinfo.c54 static void stsi_1_1_1(struct seq_file *m, struct sysinfo_1_1_1 *info) stsi_1_1_1() argument
58 if (stsi(info, 1, 1, 1)) stsi_1_1_1()
60 EBCASC(info->manufacturer, sizeof(info->manufacturer)); stsi_1_1_1()
61 EBCASC(info->type, sizeof(info->type)); stsi_1_1_1()
62 EBCASC(info->model, sizeof(info->model)); stsi_1_1_1()
63 EBCASC(info->sequence, sizeof(info->sequence)); stsi_1_1_1()
64 EBCASC(info->plant, sizeof(info->plant)); stsi_1_1_1()
65 EBCASC(info->model_capacity, sizeof(info->model_capacity)); stsi_1_1_1()
66 EBCASC(info->model_perm_cap, sizeof(info->model_perm_cap)); stsi_1_1_1()
67 EBCASC(info->model_temp_cap, sizeof(info->model_temp_cap)); stsi_1_1_1()
68 seq_printf(m, "Manufacturer: %-16.16s\n", info->manufacturer); stsi_1_1_1()
69 seq_printf(m, "Type: %-4.4s\n", info->type); stsi_1_1_1()
77 seq_printf(m, "Model: %-16.16s", info->model_capacity); stsi_1_1_1()
78 if (info->model[0] != '\0') stsi_1_1_1()
79 seq_printf(m, " %-16.16s", info->model); stsi_1_1_1()
81 seq_printf(m, "Sequence Code: %-16.16s\n", info->sequence); stsi_1_1_1()
82 seq_printf(m, "Plant: %-4.4s\n", info->plant); stsi_1_1_1()
84 info->model_capacity, info->model_cap_rating); stsi_1_1_1()
85 if (info->model_perm_cap_rating) stsi_1_1_1()
87 info->model_perm_cap, stsi_1_1_1()
88 info->model_perm_cap_rating); stsi_1_1_1()
89 if (info->model_temp_cap_rating) stsi_1_1_1()
91 info->model_temp_cap, stsi_1_1_1()
92 info->model_temp_cap_rating); stsi_1_1_1()
93 if (info->ncr) stsi_1_1_1()
94 seq_printf(m, "Nominal Cap. Rating: %08u\n", info->ncr); stsi_1_1_1()
95 if (info->npr) stsi_1_1_1()
96 seq_printf(m, "Nominal Perm. Rating: %08u\n", info->npr); stsi_1_1_1()
97 if (info->ntr) stsi_1_1_1()
98 seq_printf(m, "Nominal Temp. Rating: %08u\n", info->ntr); stsi_1_1_1()
99 if (info->cai) { stsi_1_1_1()
100 seq_printf(m, "Capacity Adj. Ind.: %d\n", info->cai); stsi_1_1_1()
101 seq_printf(m, "Capacity Ch. Reason: %d\n", info->ccr); stsi_1_1_1()
102 seq_printf(m, "Capacity Transient: %d\n", info->t); stsi_1_1_1()
104 if (info->p) { stsi_1_1_1()
105 for (i = 1; i <= ARRAY_SIZE(info->typepct); i++) { stsi_1_1_1()
107 i, info->typepct[i - 1]); stsi_1_1_1()
112 static void stsi_15_1_x(struct seq_file *m, struct sysinfo_15_1_x *info) stsi_15_1_x() argument
120 if (stsi(info, 15, 1, topology_max_mnest)) stsi_15_1_x()
124 seq_printf(m, " %d", info->mag[i]); stsi_15_1_x()
127 store_topology(info); stsi_15_1_x()
130 seq_printf(m, " %d", info->mag[i]); stsi_15_1_x()
135 static void stsi_1_2_2(struct seq_file *m, struct sysinfo_1_2_2 *info) stsi_1_2_2() argument
140 if (stsi(info, 1, 2, 2)) stsi_1_2_2()
143 ((unsigned long) info + info->acc_offset); stsi_1_2_2()
144 seq_printf(m, "CPUs Total: %d\n", info->cpus_total); stsi_1_2_2()
145 seq_printf(m, "CPUs Configured: %d\n", info->cpus_configured); stsi_1_2_2()
146 seq_printf(m, "CPUs Standby: %d\n", info->cpus_standby); stsi_1_2_2()
147 seq_printf(m, "CPUs Reserved: %d\n", info->cpus_reserved); stsi_1_2_2()
157 seq_printf(m, "Capability: %u", info->capability); stsi_1_2_2()
158 if (info->format == 1) stsi_1_2_2()
161 if (info->nominal_cap) stsi_1_2_2()
162 seq_printf(m, "Nominal Capability: %d\n", info->nominal_cap); stsi_1_2_2()
163 if (info->secondary_cap) stsi_1_2_2()
164 seq_printf(m, "Secondary Capability: %d\n", info->secondary_cap); stsi_1_2_2()
165 for (i = 2; i <= info->cpus_total; i++) { stsi_1_2_2()
167 i, info->adjustment[i-2]); stsi_1_2_2()
168 if (info->format == 1) stsi_1_2_2()
174 static void stsi_2_2_2(struct seq_file *m, struct sysinfo_2_2_2 *info) stsi_2_2_2() argument
176 if (stsi(info, 2, 2, 2)) stsi_2_2_2()
178 EBCASC(info->name, sizeof(info->name)); stsi_2_2_2()
180 seq_printf(m, "LPAR Number: %d\n", info->lpar_number); stsi_2_2_2()
182 if (info->characteristics & LPAR_CHAR_DEDICATED) stsi_2_2_2()
184 if (info->characteristics & LPAR_CHAR_SHARED) stsi_2_2_2()
186 if (info->characteristics & LPAR_CHAR_LIMITED) stsi_2_2_2()
189 seq_printf(m, "LPAR Name: %-8.8s\n", info->name); stsi_2_2_2()
190 seq_printf(m, "LPAR Adjustment: %d\n", info->caf); stsi_2_2_2()
191 seq_printf(m, "LPAR CPUs Total: %d\n", info->cpus_total); stsi_2_2_2()
192 seq_printf(m, "LPAR CPUs Configured: %d\n", info->cpus_configured); stsi_2_2_2()
193 seq_printf(m, "LPAR CPUs Standby: %d\n", info->cpus_standby); stsi_2_2_2()
194 seq_printf(m, "LPAR CPUs Reserved: %d\n", info->cpus_reserved); stsi_2_2_2()
195 seq_printf(m, "LPAR CPUs Dedicated: %d\n", info->cpus_dedicated); stsi_2_2_2()
196 seq_printf(m, "LPAR CPUs Shared: %d\n", info->cpus_shared); stsi_2_2_2()
197 if (info->mt_installed & 0x80) { stsi_2_2_2()
199 info->mt_general & 0x1f); stsi_2_2_2()
201 info->mt_installed & 0x1f); stsi_2_2_2()
203 info->mt_psmtid & 0x1f); stsi_2_2_2()
208 struct sysinfo_3_2_2 *info) print_ext_name()
210 if (info->vm[lvl].ext_name_encoding == 0) print_ext_name()
212 if (info->ext_names[lvl][0] == 0) print_ext_name()
214 switch (info->vm[lvl].ext_name_encoding) { print_ext_name()
216 EBCASC(info->ext_names[lvl], sizeof(info->ext_names[lvl])); print_ext_name()
224 info->ext_names[lvl]); print_ext_name()
227 static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info) print_uuid() argument
229 if (!memcmp(&info->vm[i].uuid, &NULL_UUID_BE, sizeof(uuid_be))) print_uuid()
231 seq_printf(m, "VM%02d UUID: %pUb\n", i, &info->vm[i].uuid); print_uuid()
234 static void stsi_3_2_2(struct seq_file *m, struct sysinfo_3_2_2 *info) stsi_3_2_2() argument
238 if (stsi(info, 3, 2, 2)) stsi_3_2_2()
240 for (i = 0; i < info->count; i++) { stsi_3_2_2()
241 EBCASC(info->vm[i].name, sizeof(info->vm[i].name)); stsi_3_2_2()
242 EBCASC(info->vm[i].cpi, sizeof(info->vm[i].cpi)); stsi_3_2_2()
244 seq_printf(m, "VM%02d Name: %-8.8s\n", i, info->vm[i].name); stsi_3_2_2()
245 seq_printf(m, "VM%02d Control Program: %-16.16s\n", i, info->vm[i].cpi); stsi_3_2_2()
246 seq_printf(m, "VM%02d Adjustment: %d\n", i, info->vm[i].caf); stsi_3_2_2()
247 seq_printf(m, "VM%02d CPUs Total: %d\n", i, info->vm[i].cpus_total); stsi_3_2_2()
248 seq_printf(m, "VM%02d CPUs Configured: %d\n", i, info->vm[i].cpus_configured); stsi_3_2_2()
249 seq_printf(m, "VM%02d CPUs Standby: %d\n", i, info->vm[i].cpus_standby); stsi_3_2_2()
250 seq_printf(m, "VM%02d CPUs Reserved: %d\n", i, info->vm[i].cpus_reserved); stsi_3_2_2()
251 print_ext_name(m, i, info); stsi_3_2_2()
252 print_uuid(m, i, info); stsi_3_2_2()
258 void *info = (void *)get_zeroed_page(GFP_KERNEL); sysinfo_show() local
261 if (!info) sysinfo_show()
265 stsi_1_1_1(m, info); sysinfo_show()
267 stsi_15_1_x(m, info); sysinfo_show()
269 stsi_1_2_2(m, info); sysinfo_show()
271 stsi_2_2_2(m, info); sysinfo_show()
273 stsi_3_2_2(m, info); sysinfo_show()
274 free_page((unsigned long)info); sysinfo_show()
416 struct sysinfo_1_2_2 *info; s390_adjust_jiffies() local
422 info = (void *) get_zeroed_page(GFP_KERNEL); s390_adjust_jiffies()
423 if (!info) s390_adjust_jiffies()
426 if (stsi(info, 1, 2, 2) == 0) { s390_adjust_jiffies()
429 * If the first 9 bits of info->capability are 0 then it s390_adjust_jiffies()
439 if ((info->capability >> 23) == 0) s390_adjust_jiffies()
440 FP_FROM_INT_S(SB, (long) info->capability, 64, long); s390_adjust_jiffies()
442 FP_UNPACK_SP(SB, &info->capability); s390_adjust_jiffies()
452 free_page((unsigned long) info); s390_adjust_jiffies()
207 print_ext_name(struct seq_file *m, int lvl, struct sysinfo_3_2_2 *info) print_ext_name() argument
/linux-4.4.14/drivers/rtc/
H A Drtc-s3c.c60 void (*irq_handler) (struct s3c_rtc *info, int mask);
61 void (*set_freq) (struct s3c_rtc *info, int freq);
62 void (*enable_tick) (struct s3c_rtc *info, struct seq_file *seq);
63 void (*select_tick_clk) (struct s3c_rtc *info);
64 void (*save_tick_cnt) (struct s3c_rtc *info);
65 void (*restore_tick_cnt) (struct s3c_rtc *info);
66 void (*enable) (struct s3c_rtc *info);
67 void (*disable) (struct s3c_rtc *info);
70 static void s3c_rtc_enable_clk(struct s3c_rtc *info) s3c_rtc_enable_clk() argument
74 spin_lock_irqsave(&info->alarm_clk_lock, irq_flags); s3c_rtc_enable_clk()
75 if (info->clk_disabled) { s3c_rtc_enable_clk()
76 clk_enable(info->rtc_clk); s3c_rtc_enable_clk()
77 if (info->data->needs_src_clk) s3c_rtc_enable_clk()
78 clk_enable(info->rtc_src_clk); s3c_rtc_enable_clk()
79 info->clk_disabled = false; s3c_rtc_enable_clk()
81 spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags); s3c_rtc_enable_clk()
84 static void s3c_rtc_disable_clk(struct s3c_rtc *info) s3c_rtc_disable_clk() argument
88 spin_lock_irqsave(&info->alarm_clk_lock, irq_flags); s3c_rtc_disable_clk()
89 if (!info->clk_disabled) { s3c_rtc_disable_clk()
90 if (info->data->needs_src_clk) s3c_rtc_disable_clk()
91 clk_disable(info->rtc_src_clk); s3c_rtc_disable_clk()
92 clk_disable(info->rtc_clk); s3c_rtc_disable_clk()
93 info->clk_disabled = true; s3c_rtc_disable_clk()
95 spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags); s3c_rtc_disable_clk()
101 struct s3c_rtc *info = (struct s3c_rtc *)id; s3c_rtc_tickirq() local
103 if (info->data->irq_handler) s3c_rtc_tickirq()
104 info->data->irq_handler(info, S3C2410_INTP_TIC); s3c_rtc_tickirq()
111 struct s3c_rtc *info = (struct s3c_rtc *)id; s3c_rtc_alarmirq() local
113 if (info->data->irq_handler) s3c_rtc_alarmirq()
114 info->data->irq_handler(info, S3C2410_INTP_ALM); s3c_rtc_alarmirq()
122 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_setaie() local
125 dev_dbg(info->dev, "%s: aie=%d\n", __func__, enabled); s3c_rtc_setaie()
127 s3c_rtc_enable_clk(info); s3c_rtc_setaie()
129 tmp = readb(info->base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; s3c_rtc_setaie()
134 writeb(tmp, info->base + S3C2410_RTCALM); s3c_rtc_setaie()
136 s3c_rtc_disable_clk(info); s3c_rtc_setaie()
139 s3c_rtc_enable_clk(info); s3c_rtc_setaie()
141 s3c_rtc_disable_clk(info); s3c_rtc_setaie()
147 static int s3c_rtc_setfreq(struct s3c_rtc *info, int freq) s3c_rtc_setfreq() argument
152 spin_lock_irq(&info->pie_lock); s3c_rtc_setfreq()
154 if (info->data->set_freq) s3c_rtc_setfreq()
155 info->data->set_freq(info, freq); s3c_rtc_setfreq()
157 spin_unlock_irq(&info->pie_lock); s3c_rtc_setfreq()
165 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_gettime() local
168 s3c_rtc_enable_clk(info); s3c_rtc_gettime()
171 rtc_tm->tm_min = readb(info->base + S3C2410_RTCMIN); s3c_rtc_gettime()
172 rtc_tm->tm_hour = readb(info->base + S3C2410_RTCHOUR); s3c_rtc_gettime()
173 rtc_tm->tm_mday = readb(info->base + S3C2410_RTCDATE); s3c_rtc_gettime()
174 rtc_tm->tm_mon = readb(info->base + S3C2410_RTCMON); s3c_rtc_gettime()
175 rtc_tm->tm_year = readb(info->base + S3C2410_RTCYEAR); s3c_rtc_gettime()
176 rtc_tm->tm_sec = readb(info->base + S3C2410_RTCSEC); s3c_rtc_gettime()
195 s3c_rtc_disable_clk(info); s3c_rtc_gettime()
210 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_settime() local
224 s3c_rtc_enable_clk(info); s3c_rtc_settime()
226 writeb(bin2bcd(tm->tm_sec), info->base + S3C2410_RTCSEC); s3c_rtc_settime()
227 writeb(bin2bcd(tm->tm_min), info->base + S3C2410_RTCMIN); s3c_rtc_settime()
228 writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_RTCHOUR); s3c_rtc_settime()
229 writeb(bin2bcd(tm->tm_mday), info->base + S3C2410_RTCDATE); s3c_rtc_settime()
230 writeb(bin2bcd(tm->tm_mon + 1), info->base + S3C2410_RTCMON); s3c_rtc_settime()
231 writeb(bin2bcd(year), info->base + S3C2410_RTCYEAR); s3c_rtc_settime()
233 s3c_rtc_disable_clk(info); s3c_rtc_settime()
240 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_getalarm() local
244 s3c_rtc_enable_clk(info); s3c_rtc_getalarm()
246 alm_tm->tm_sec = readb(info->base + S3C2410_ALMSEC); s3c_rtc_getalarm()
247 alm_tm->tm_min = readb(info->base + S3C2410_ALMMIN); s3c_rtc_getalarm()
248 alm_tm->tm_hour = readb(info->base + S3C2410_ALMHOUR); s3c_rtc_getalarm()
249 alm_tm->tm_mon = readb(info->base + S3C2410_ALMMON); s3c_rtc_getalarm()
250 alm_tm->tm_mday = readb(info->base + S3C2410_ALMDATE); s3c_rtc_getalarm()
251 alm_tm->tm_year = readb(info->base + S3C2410_ALMYEAR); s3c_rtc_getalarm()
253 alm_en = readb(info->base + S3C2410_RTCALM); s3c_rtc_getalarm()
255 s3c_rtc_disable_clk(info); s3c_rtc_getalarm()
302 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_setalarm() local
312 s3c_rtc_enable_clk(info); s3c_rtc_setalarm()
314 alrm_en = readb(info->base + S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN; s3c_rtc_setalarm()
315 writeb(0x00, info->base + S3C2410_RTCALM); s3c_rtc_setalarm()
319 writeb(bin2bcd(tm->tm_sec), info->base + S3C2410_ALMSEC); s3c_rtc_setalarm()
324 writeb(bin2bcd(tm->tm_min), info->base + S3C2410_ALMMIN); s3c_rtc_setalarm()
329 writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_ALMHOUR); s3c_rtc_setalarm()
334 writeb(bin2bcd(year), info->base + S3C2410_ALMYEAR); s3c_rtc_setalarm()
339 writeb(bin2bcd(tm->tm_mon + 1), info->base + S3C2410_ALMMON); s3c_rtc_setalarm()
344 writeb(bin2bcd(tm->tm_mday), info->base + S3C2410_ALMDATE); s3c_rtc_setalarm()
349 writeb(alrm_en, info->base + S3C2410_RTCALM); s3c_rtc_setalarm()
351 s3c_rtc_disable_clk(info); s3c_rtc_setalarm()
360 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_proc() local
362 s3c_rtc_enable_clk(info); s3c_rtc_proc()
364 if (info->data->enable_tick) s3c_rtc_proc()
365 info->data->enable_tick(info, seq); s3c_rtc_proc()
367 s3c_rtc_disable_clk(info); s3c_rtc_proc()
381 static void s3c24xx_rtc_enable(struct s3c_rtc *info) s3c24xx_rtc_enable() argument
385 con = readw(info->base + S3C2410_RTCCON); s3c24xx_rtc_enable()
388 dev_info(info->dev, "rtc disabled, re-enabling\n"); s3c24xx_rtc_enable()
390 tmp = readw(info->base + S3C2410_RTCCON); s3c24xx_rtc_enable()
392 info->base + S3C2410_RTCCON); s3c24xx_rtc_enable()
396 dev_info(info->dev, "removing RTCCON_CNTSEL\n"); s3c24xx_rtc_enable()
398 tmp = readw(info->base + S3C2410_RTCCON); s3c24xx_rtc_enable()
400 info->base + S3C2410_RTCCON); s3c24xx_rtc_enable()
404 dev_info(info->dev, "removing RTCCON_CLKRST\n"); s3c24xx_rtc_enable()
406 tmp = readw(info->base + S3C2410_RTCCON); s3c24xx_rtc_enable()
408 info->base + S3C2410_RTCCON); s3c24xx_rtc_enable()
412 static void s3c24xx_rtc_disable(struct s3c_rtc *info) s3c24xx_rtc_disable() argument
416 con = readw(info->base + S3C2410_RTCCON); s3c24xx_rtc_disable()
418 writew(con, info->base + S3C2410_RTCCON); s3c24xx_rtc_disable()
420 con = readb(info->base + S3C2410_TICNT); s3c24xx_rtc_disable()
422 writeb(con, info->base + S3C2410_TICNT); s3c24xx_rtc_disable()
425 static void s3c6410_rtc_disable(struct s3c_rtc *info) s3c6410_rtc_disable() argument
429 con = readw(info->base + S3C2410_RTCCON); s3c6410_rtc_disable()
432 writew(con, info->base + S3C2410_RTCCON); s3c6410_rtc_disable()
437 struct s3c_rtc *info = platform_get_drvdata(pdev); s3c_rtc_remove() local
439 s3c_rtc_setaie(info->dev, 0); s3c_rtc_remove()
441 if (info->data->needs_src_clk) s3c_rtc_remove()
442 clk_unprepare(info->rtc_src_clk); s3c_rtc_remove()
443 clk_unprepare(info->rtc_clk); s3c_rtc_remove()
460 struct s3c_rtc *info = NULL; s3c_rtc_probe() local
465 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); s3c_rtc_probe()
466 if (!info) s3c_rtc_probe()
470 info->irq_tick = platform_get_irq(pdev, 1); s3c_rtc_probe()
471 if (info->irq_tick < 0) { s3c_rtc_probe()
473 return info->irq_tick; s3c_rtc_probe()
476 info->dev = &pdev->dev; s3c_rtc_probe()
477 info->data = s3c_rtc_get_data(pdev); s3c_rtc_probe()
478 if (!info->data) { s3c_rtc_probe()
482 spin_lock_init(&info->pie_lock); s3c_rtc_probe()
483 spin_lock_init(&info->alarm_clk_lock); s3c_rtc_probe()
485 platform_set_drvdata(pdev, info); s3c_rtc_probe()
487 info->irq_alarm = platform_get_irq(pdev, 0); s3c_rtc_probe()
488 if (info->irq_alarm < 0) { s3c_rtc_probe()
490 return info->irq_alarm; s3c_rtc_probe()
494 info->irq_tick, info->irq_alarm); s3c_rtc_probe()
498 info->base = devm_ioremap_resource(&pdev->dev, res); s3c_rtc_probe()
499 if (IS_ERR(info->base)) s3c_rtc_probe()
500 return PTR_ERR(info->base); s3c_rtc_probe()
502 info->rtc_clk = devm_clk_get(&pdev->dev, "rtc"); s3c_rtc_probe()
503 if (IS_ERR(info->rtc_clk)) { s3c_rtc_probe()
505 return PTR_ERR(info->rtc_clk); s3c_rtc_probe()
507 clk_prepare_enable(info->rtc_clk); s3c_rtc_probe()
509 if (info->data->needs_src_clk) { s3c_rtc_probe()
510 info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src"); s3c_rtc_probe()
511 if (IS_ERR(info->rtc_src_clk)) { s3c_rtc_probe()
514 clk_disable_unprepare(info->rtc_clk); s3c_rtc_probe()
515 return PTR_ERR(info->rtc_src_clk); s3c_rtc_probe()
517 clk_prepare_enable(info->rtc_src_clk); s3c_rtc_probe()
521 if (info->data->enable) s3c_rtc_probe()
522 info->data->enable(info); s3c_rtc_probe()
525 readw(info->base + S3C2410_RTCCON)); s3c_rtc_probe()
544 info->rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops, s3c_rtc_probe()
546 if (IS_ERR(info->rtc)) { s3c_rtc_probe()
548 ret = PTR_ERR(info->rtc); s3c_rtc_probe()
552 ret = devm_request_irq(&pdev->dev, info->irq_alarm, s3c_rtc_alarmirq, s3c_rtc_probe()
553 0, "s3c2410-rtc alarm", info); s3c_rtc_probe()
555 dev_err(&pdev->dev, "IRQ%d error %d\n", info->irq_alarm, ret); s3c_rtc_probe()
559 ret = devm_request_irq(&pdev->dev, info->irq_tick, s3c_rtc_tickirq, s3c_rtc_probe()
560 0, "s3c2410-rtc tick", info); s3c_rtc_probe()
562 dev_err(&pdev->dev, "IRQ%d error %d\n", info->irq_tick, ret); s3c_rtc_probe()
566 if (info->data->select_tick_clk) s3c_rtc_probe()
567 info->data->select_tick_clk(info); s3c_rtc_probe()
569 s3c_rtc_setfreq(info, 1); s3c_rtc_probe()
571 s3c_rtc_disable_clk(info); s3c_rtc_probe()
576 if (info->data->disable) s3c_rtc_probe()
577 info->data->disable(info); s3c_rtc_probe()
579 if (info->data->needs_src_clk) s3c_rtc_probe()
580 clk_disable_unprepare(info->rtc_src_clk); s3c_rtc_probe()
581 clk_disable_unprepare(info->rtc_clk); s3c_rtc_probe()
590 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_suspend() local
592 s3c_rtc_enable_clk(info); s3c_rtc_suspend()
595 if (info->data->save_tick_cnt) s3c_rtc_suspend()
596 info->data->save_tick_cnt(info); s3c_rtc_suspend()
598 if (info->data->disable) s3c_rtc_suspend()
599 info->data->disable(info); s3c_rtc_suspend()
601 if (device_may_wakeup(dev) && !info->wake_en) { s3c_rtc_suspend()
602 if (enable_irq_wake(info->irq_alarm) == 0) s3c_rtc_suspend()
603 info->wake_en = true; s3c_rtc_suspend()
613 struct s3c_rtc *info = dev_get_drvdata(dev); s3c_rtc_resume() local
615 if (info->data->enable) s3c_rtc_resume()
616 info->data->enable(info); s3c_rtc_resume()
618 if (info->data->restore_tick_cnt) s3c_rtc_resume()
619 info->data->restore_tick_cnt(info); s3c_rtc_resume()
621 s3c_rtc_disable_clk(info); s3c_rtc_resume()
623 if (device_may_wakeup(dev) && info->wake_en) { s3c_rtc_resume()
624 disable_irq_wake(info->irq_alarm); s3c_rtc_resume()
625 info->wake_en = false; s3c_rtc_resume()
633 static void s3c24xx_rtc_irq(struct s3c_rtc *info, int mask) s3c24xx_rtc_irq() argument
635 rtc_update_irq(info->rtc, 1, RTC_AF | RTC_IRQF); s3c24xx_rtc_irq()
638 static void s3c6410_rtc_irq(struct s3c_rtc *info, int mask) s3c6410_rtc_irq() argument
640 rtc_update_irq(info->rtc, 1, RTC_AF | RTC_IRQF); s3c6410_rtc_irq()
641 writeb(mask, info->base + S3C2410_INTP); s3c6410_rtc_irq()
644 static void s3c2410_rtc_setfreq(struct s3c_rtc *info, int freq) s3c2410_rtc_setfreq() argument
649 tmp = readb(info->base + S3C2410_TICNT); s3c2410_rtc_setfreq()
652 val = (info->rtc->max_user_freq / freq) - 1; s3c2410_rtc_setfreq()
655 writel(tmp, info->base + S3C2410_TICNT); s3c2410_rtc_setfreq()
658 static void s3c2416_rtc_setfreq(struct s3c_rtc *info, int freq) s3c2416_rtc_setfreq() argument
663 tmp = readb(info->base + S3C2410_TICNT); s3c2416_rtc_setfreq()
666 val = (info->rtc->max_user_freq / freq) - 1; s3c2416_rtc_setfreq()
669 writel(S3C2443_TICNT1_PART(val), info->base + S3C2443_TICNT1); s3c2416_rtc_setfreq()
671 writel(S3C2416_TICNT2_PART(val), info->base + S3C2416_TICNT2); s3c2416_rtc_setfreq()
673 writel(tmp, info->base + S3C2410_TICNT); s3c2416_rtc_setfreq()
676 static void s3c2443_rtc_setfreq(struct s3c_rtc *info, int freq) s3c2443_rtc_setfreq() argument
681 tmp = readb(info->base + S3C2410_TICNT); s3c2443_rtc_setfreq()
684 val = (info->rtc->max_user_freq / freq) - 1; s3c2443_rtc_setfreq()
687 writel(S3C2443_TICNT1_PART(val), info->base + S3C2443_TICNT1); s3c2443_rtc_setfreq()
689 writel(tmp, info->base + S3C2410_TICNT); s3c2443_rtc_setfreq()
692 static void s3c6410_rtc_setfreq(struct s3c_rtc *info, int freq) s3c6410_rtc_setfreq() argument
696 val = (info->rtc->max_user_freq / freq) - 1; s3c6410_rtc_setfreq()
697 writel(val, info->base + S3C2410_TICNT); s3c6410_rtc_setfreq()
700 static void s3c24xx_rtc_enable_tick(struct s3c_rtc *info, struct seq_file *seq) s3c24xx_rtc_enable_tick() argument
704 ticnt = readb(info->base + S3C2410_TICNT); s3c24xx_rtc_enable_tick()
710 static void s3c2416_rtc_select_tick_clk(struct s3c_rtc *info) s3c2416_rtc_select_tick_clk() argument
714 con = readw(info->base + S3C2410_RTCCON); s3c2416_rtc_select_tick_clk()
716 writew(con, info->base + S3C2410_RTCCON); s3c2416_rtc_select_tick_clk()
719 static void s3c6410_rtc_enable_tick(struct s3c_rtc *info, struct seq_file *seq) s3c6410_rtc_enable_tick() argument
723 ticnt = readw(info->base + S3C2410_RTCCON); s3c6410_rtc_enable_tick()
729 static void s3c24xx_rtc_save_tick_cnt(struct s3c_rtc *info) s3c24xx_rtc_save_tick_cnt() argument
731 info->ticnt_save = readb(info->base + S3C2410_TICNT); s3c24xx_rtc_save_tick_cnt()
734 static void s3c24xx_rtc_restore_tick_cnt(struct s3c_rtc *info) s3c24xx_rtc_restore_tick_cnt() argument
736 writeb(info->ticnt_save, info->base + S3C2410_TICNT); s3c24xx_rtc_restore_tick_cnt()
739 static void s3c6410_rtc_save_tick_cnt(struct s3c_rtc *info) s3c6410_rtc_save_tick_cnt() argument
741 info->ticnt_en_save = readw(info->base + S3C2410_RTCCON); s3c6410_rtc_save_tick_cnt()
742 info->ticnt_en_save &= S3C64XX_RTCCON_TICEN; s3c6410_rtc_save_tick_cnt()
743 info->ticnt_save = readl(info->base + S3C2410_TICNT); s3c6410_rtc_save_tick_cnt()
746 static void s3c6410_rtc_restore_tick_cnt(struct s3c_rtc *info) s3c6410_rtc_restore_tick_cnt() argument
750 writel(info->ticnt_save, info->base + S3C2410_TICNT); s3c6410_rtc_restore_tick_cnt()
751 if (info->ticnt_en_save) { s3c6410_rtc_restore_tick_cnt()
752 con = readw(info->base + S3C2410_RTCCON); s3c6410_rtc_restore_tick_cnt()
753 writew(con | info->ticnt_en_save, s3c6410_rtc_restore_tick_cnt()
754 info->base + S3C2410_RTCCON); s3c6410_rtc_restore_tick_cnt()
H A Drtc-max8997.c119 static inline int max8997_rtc_set_update_reg(struct max8997_rtc_info *info) max8997_rtc_set_update_reg() argument
123 ret = max8997_write_reg(info->rtc, MAX8997_RTC_UPDATE1, max8997_rtc_set_update_reg()
126 dev_err(info->dev, "%s: fail to write update reg(%d)\n", max8997_rtc_set_update_reg()
140 struct max8997_rtc_info *info = dev_get_drvdata(dev); max8997_rtc_read_time() local
144 mutex_lock(&info->lock); max8997_rtc_read_time()
145 ret = max8997_bulk_read(info->rtc, MAX8997_RTC_SEC, RTC_NR_TIME, data); max8997_rtc_read_time()
146 mutex_unlock(&info->lock); max8997_rtc_read_time()
149 dev_err(info->dev, "%s: fail to read time reg(%d)\n", __func__, max8997_rtc_read_time()
154 max8997_rtc_data_to_tm(data, tm, info->rtc_24hr_mode); max8997_rtc_read_time()
161 struct max8997_rtc_info *info = dev_get_drvdata(dev); max8997_rtc_set_time() local
169 mutex_lock(&info->lock); max8997_rtc_set_time()
171 ret = max8997_bulk_write(info->rtc, MAX8997_RTC_SEC, RTC_NR_TIME, data); max8997_rtc_set_time()
173 dev_err(info->dev, "%s: fail to write time reg(%d)\n", __func__, max8997_rtc_set_time()
178 ret = max8997_rtc_set_update_reg(info); max8997_rtc_set_time()
180 mutex_unlock(&info->lock); max8997_rtc_set_time()
186 struct max8997_rtc_info *info = dev_get_drvdata(dev); max8997_rtc_read_alarm() local
191 mutex_lock(&info->lock); max8997_rtc_read_alarm()
193 ret = max8997_bulk_read(info->rtc, MAX8997_RTC_ALARM1_SEC, RTC_NR_TIME, max8997_rtc_read_alarm()
196 dev_err(info->dev, "%s:%d fail to read alarm reg(%d)\n", max8997_rtc_read_alarm()
201 max8997_rtc_data_to_tm(data, &alrm->time, info->rtc_24hr_mode); max8997_rtc_read_alarm()
212 ret = max8997_read_reg(info->max8997->i2c, MAX8997_REG_STATUS1, &val); max8997_rtc_read_alarm()
214 dev_err(info->dev, "%s:%d fail to read status1 reg(%d)\n", max8997_rtc_read_alarm()
223 mutex_unlock(&info->lock); max8997_rtc_read_alarm()
227 static int max8997_rtc_stop_alarm(struct max8997_rtc_info *info) max8997_rtc_stop_alarm() argument
232 if (!mutex_is_locked(&info->lock)) max8997_rtc_stop_alarm()
233 dev_warn(info->dev, "%s: should have mutex locked\n", __func__); max8997_rtc_stop_alarm()
235 ret = max8997_bulk_read(info->rtc, MAX8997_RTC_ALARM1_SEC, RTC_NR_TIME, max8997_rtc_stop_alarm()
238 dev_err(info->dev, "%s: fail to read alarm reg(%d)\n", max8997_rtc_stop_alarm()
246 ret = max8997_bulk_write(info->rtc, MAX8997_RTC_ALARM1_SEC, RTC_NR_TIME, max8997_rtc_stop_alarm()
249 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max8997_rtc_stop_alarm()
254 ret = max8997_rtc_set_update_reg(info); max8997_rtc_stop_alarm()
259 static int max8997_rtc_start_alarm(struct max8997_rtc_info *info) max8997_rtc_start_alarm() argument
264 if (!mutex_is_locked(&info->lock)) max8997_rtc_start_alarm()
265 dev_warn(info->dev, "%s: should have mutex locked\n", __func__); max8997_rtc_start_alarm()
267 ret = max8997_bulk_read(info->rtc, MAX8997_RTC_ALARM1_SEC, RTC_NR_TIME, max8997_rtc_start_alarm()
270 dev_err(info->dev, "%s: fail to read alarm reg(%d)\n", max8997_rtc_start_alarm()
286 ret = max8997_bulk_write(info->rtc, MAX8997_RTC_ALARM1_SEC, RTC_NR_TIME, max8997_rtc_start_alarm()
289 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max8997_rtc_start_alarm()
294 ret = max8997_rtc_set_update_reg(info); max8997_rtc_start_alarm()
300 struct max8997_rtc_info *info = dev_get_drvdata(dev); max8997_rtc_set_alarm() local
308 dev_info(info->dev, "%s: %d-%02d-%02d %02d:%02d:%02d\n", __func__, max8997_rtc_set_alarm()
312 mutex_lock(&info->lock); max8997_rtc_set_alarm()
314 ret = max8997_rtc_stop_alarm(info); max8997_rtc_set_alarm()
318 ret = max8997_bulk_write(info->rtc, MAX8997_RTC_ALARM1_SEC, RTC_NR_TIME, max8997_rtc_set_alarm()
321 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max8997_rtc_set_alarm()
326 ret = max8997_rtc_set_update_reg(info); max8997_rtc_set_alarm()
331 ret = max8997_rtc_start_alarm(info); max8997_rtc_set_alarm()
333 mutex_unlock(&info->lock); max8997_rtc_set_alarm()
340 struct max8997_rtc_info *info = dev_get_drvdata(dev); max8997_rtc_alarm_irq_enable() local
343 mutex_lock(&info->lock); max8997_rtc_alarm_irq_enable()
345 ret = max8997_rtc_start_alarm(info); max8997_rtc_alarm_irq_enable()
347 ret = max8997_rtc_stop_alarm(info); max8997_rtc_alarm_irq_enable()
348 mutex_unlock(&info->lock); max8997_rtc_alarm_irq_enable()
355 struct max8997_rtc_info *info = data; max8997_rtc_alarm_irq() local
357 dev_info(info->dev, "%s:irq(%d)\n", __func__, irq); max8997_rtc_alarm_irq()
359 rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF); max8997_rtc_alarm_irq()
372 static void max8997_rtc_enable_wtsr(struct max8997_rtc_info *info, bool enable) max8997_rtc_enable_wtsr() argument
387 dev_info(info->dev, "%s: %s WTSR\n", __func__, max8997_rtc_enable_wtsr()
390 ret = max8997_update_reg(info->rtc, MAX8997_RTC_WTSR_SMPL, val, mask); max8997_rtc_enable_wtsr()
392 dev_err(info->dev, "%s: fail to update WTSR reg(%d)\n", max8997_rtc_enable_wtsr()
397 max8997_rtc_set_update_reg(info); max8997_rtc_enable_wtsr()
400 static void max8997_rtc_enable_smpl(struct max8997_rtc_info *info, bool enable) max8997_rtc_enable_smpl() argument
415 dev_info(info->dev, "%s: %s SMPL\n", __func__, max8997_rtc_enable_smpl()
418 ret = max8997_update_reg(info->rtc, MAX8997_RTC_WTSR_SMPL, val, mask); max8997_rtc_enable_smpl()
420 dev_err(info->dev, "%s: fail to update SMPL reg(%d)\n", max8997_rtc_enable_smpl()
425 max8997_rtc_set_update_reg(info); max8997_rtc_enable_smpl()
428 max8997_read_reg(info->rtc, MAX8997_RTC_WTSR_SMPL, &val); max8997_rtc_enable_smpl()
432 static int max8997_rtc_init_reg(struct max8997_rtc_info *info) max8997_rtc_init_reg() argument
441 info->rtc_24hr_mode = 1; max8997_rtc_init_reg()
443 ret = max8997_bulk_write(info->rtc, MAX8997_RTC_CTRLMASK, 2, data); max8997_rtc_init_reg()
445 dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", max8997_rtc_init_reg()
450 ret = max8997_rtc_set_update_reg(info); max8997_rtc_init_reg()
457 struct max8997_rtc_info *info; max8997_rtc_probe() local
460 info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_rtc_info), max8997_rtc_probe()
462 if (!info) max8997_rtc_probe()
465 mutex_init(&info->lock); max8997_rtc_probe()
466 info->dev = &pdev->dev; max8997_rtc_probe()
467 info->max8997 = max8997; max8997_rtc_probe()
468 info->rtc = max8997->rtc; max8997_rtc_probe()
470 platform_set_drvdata(pdev, info); max8997_rtc_probe()
472 ret = max8997_rtc_init_reg(info); max8997_rtc_probe()
479 max8997_rtc_enable_wtsr(info, true); max8997_rtc_probe()
480 max8997_rtc_enable_smpl(info, true); max8997_rtc_probe()
484 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8997-rtc", max8997_rtc_probe()
487 if (IS_ERR(info->rtc_dev)) { max8997_rtc_probe()
488 ret = PTR_ERR(info->rtc_dev); max8997_rtc_probe()
499 info->virq = virq; max8997_rtc_probe()
503 "rtc-alarm0", info); max8997_rtc_probe()
506 info->virq, ret); max8997_rtc_probe()
514 struct max8997_rtc_info *info = platform_get_drvdata(pdev); max8997_rtc_shutdown() local
516 max8997_rtc_enable_wtsr(info, false); max8997_rtc_shutdown()
517 max8997_rtc_enable_smpl(info, false); max8997_rtc_shutdown()
H A Drtc-max77686.c115 static int max77686_rtc_update(struct max77686_rtc_info *info, max77686_rtc_update() argument
126 ret = regmap_update_bits(info->max77686->rtc_regmap, max77686_rtc_update()
129 dev_err(info->dev, "%s: fail to write update reg(ret=%d, data=0x%x)\n", max77686_rtc_update()
141 struct max77686_rtc_info *info = dev_get_drvdata(dev); max77686_rtc_read_time() local
145 mutex_lock(&info->lock); max77686_rtc_read_time()
147 ret = max77686_rtc_update(info, MAX77686_RTC_READ); max77686_rtc_read_time()
151 ret = regmap_bulk_read(info->max77686->rtc_regmap, max77686_rtc_read_time()
154 dev_err(info->dev, "%s: fail to read time reg(%d)\n", __func__, ret); max77686_rtc_read_time()
158 max77686_rtc_data_to_tm(data, tm, info->rtc_24hr_mode); max77686_rtc_read_time()
163 mutex_unlock(&info->lock); max77686_rtc_read_time()
169 struct max77686_rtc_info *info = dev_get_drvdata(dev); max77686_rtc_set_time() local
177 mutex_lock(&info->lock); max77686_rtc_set_time()
179 ret = regmap_bulk_write(info->max77686->rtc_regmap, max77686_rtc_set_time()
182 dev_err(info->dev, "%s: fail to write time reg(%d)\n", __func__, max77686_rtc_set_time()
187 ret = max77686_rtc_update(info, MAX77686_RTC_WRITE); max77686_rtc_set_time()
190 mutex_unlock(&info->lock); max77686_rtc_set_time()
196 struct max77686_rtc_info *info = dev_get_drvdata(dev); max77686_rtc_read_alarm() local
201 mutex_lock(&info->lock); max77686_rtc_read_alarm()
203 ret = max77686_rtc_update(info, MAX77686_RTC_READ); max77686_rtc_read_alarm()
207 ret = regmap_bulk_read(info->max77686->rtc_regmap, max77686_rtc_read_alarm()
210 dev_err(info->dev, "%s:%d fail to read alarm reg(%d)\n", max77686_rtc_read_alarm()
215 max77686_rtc_data_to_tm(data, &alrm->time, info->rtc_24hr_mode); max77686_rtc_read_alarm()
226 ret = regmap_read(info->max77686->regmap, MAX77686_REG_STATUS2, &val); max77686_rtc_read_alarm()
228 dev_err(info->dev, "%s:%d fail to read status2 reg(%d)\n", max77686_rtc_read_alarm()
237 mutex_unlock(&info->lock); max77686_rtc_read_alarm()
241 static int max77686_rtc_stop_alarm(struct max77686_rtc_info *info) max77686_rtc_stop_alarm() argument
247 if (!mutex_is_locked(&info->lock)) max77686_rtc_stop_alarm()
248 dev_warn(info->dev, "%s: should have mutex locked\n", __func__); max77686_rtc_stop_alarm()
250 ret = max77686_rtc_update(info, MAX77686_RTC_READ); max77686_rtc_stop_alarm()
254 ret = regmap_bulk_read(info->max77686->rtc_regmap, max77686_rtc_stop_alarm()
257 dev_err(info->dev, "%s: fail to read alarm reg(%d)\n", max77686_rtc_stop_alarm()
262 max77686_rtc_data_to_tm(data, &tm, info->rtc_24hr_mode); max77686_rtc_stop_alarm()
267 ret = regmap_bulk_write(info->max77686->rtc_regmap, max77686_rtc_stop_alarm()
270 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max77686_rtc_stop_alarm()
275 ret = max77686_rtc_update(info, MAX77686_RTC_WRITE); max77686_rtc_stop_alarm()
280 static int max77686_rtc_start_alarm(struct max77686_rtc_info *info) max77686_rtc_start_alarm() argument
286 if (!mutex_is_locked(&info->lock)) max77686_rtc_start_alarm()
287 dev_warn(info->dev, "%s: should have mutex locked\n", __func__); max77686_rtc_start_alarm()
289 ret = max77686_rtc_update(info, MAX77686_RTC_READ); max77686_rtc_start_alarm()
293 ret = regmap_bulk_read(info->max77686->rtc_regmap, max77686_rtc_start_alarm()
296 dev_err(info->dev, "%s: fail to read alarm reg(%d)\n", max77686_rtc_start_alarm()
301 max77686_rtc_data_to_tm(data, &tm, info->rtc_24hr_mode); max77686_rtc_start_alarm()
314 ret = regmap_bulk_write(info->max77686->rtc_regmap, max77686_rtc_start_alarm()
317 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max77686_rtc_start_alarm()
322 ret = max77686_rtc_update(info, MAX77686_RTC_WRITE); max77686_rtc_start_alarm()
329 struct max77686_rtc_info *info = dev_get_drvdata(dev); max77686_rtc_set_alarm() local
337 mutex_lock(&info->lock); max77686_rtc_set_alarm()
339 ret = max77686_rtc_stop_alarm(info); max77686_rtc_set_alarm()
343 ret = regmap_bulk_write(info->max77686->rtc_regmap, max77686_rtc_set_alarm()
347 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max77686_rtc_set_alarm()
352 ret = max77686_rtc_update(info, MAX77686_RTC_WRITE); max77686_rtc_set_alarm()
357 ret = max77686_rtc_start_alarm(info); max77686_rtc_set_alarm()
359 mutex_unlock(&info->lock); max77686_rtc_set_alarm()
366 struct max77686_rtc_info *info = dev_get_drvdata(dev); max77686_rtc_alarm_irq_enable() local
369 mutex_lock(&info->lock); max77686_rtc_alarm_irq_enable()
371 ret = max77686_rtc_start_alarm(info); max77686_rtc_alarm_irq_enable()
373 ret = max77686_rtc_stop_alarm(info); max77686_rtc_alarm_irq_enable()
374 mutex_unlock(&info->lock); max77686_rtc_alarm_irq_enable()
381 struct max77686_rtc_info *info = data; max77686_rtc_alarm_irq() local
383 dev_info(info->dev, "%s:irq(%d)\n", __func__, irq); max77686_rtc_alarm_irq()
385 rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF); max77686_rtc_alarm_irq()
398 static int max77686_rtc_init_reg(struct max77686_rtc_info *info) max77686_rtc_init_reg() argument
407 info->rtc_24hr_mode = 1; max77686_rtc_init_reg()
409 ret = regmap_bulk_write(info->max77686->rtc_regmap, MAX77686_RTC_CONTROLM, data, 2); max77686_rtc_init_reg()
411 dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", max77686_rtc_init_reg()
416 ret = max77686_rtc_update(info, MAX77686_RTC_WRITE); max77686_rtc_init_reg()
423 struct max77686_rtc_info *info; max77686_rtc_probe() local
428 info = devm_kzalloc(&pdev->dev, sizeof(struct max77686_rtc_info), max77686_rtc_probe()
430 if (!info) max77686_rtc_probe()
433 mutex_init(&info->lock); max77686_rtc_probe()
434 info->dev = &pdev->dev; max77686_rtc_probe()
435 info->max77686 = max77686; max77686_rtc_probe()
436 info->rtc = max77686->rtc; max77686_rtc_probe()
438 platform_set_drvdata(pdev, info); max77686_rtc_probe()
440 ret = max77686_rtc_init_reg(info); max77686_rtc_probe()
449 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max77686-rtc", max77686_rtc_probe()
452 if (IS_ERR(info->rtc_dev)) { max77686_rtc_probe()
453 ret = PTR_ERR(info->rtc_dev); max77686_rtc_probe()
466 info->virq = regmap_irq_get_virq(max77686->rtc_irq_data, max77686_rtc_probe()
468 if (info->virq <= 0) { max77686_rtc_probe()
473 ret = devm_request_threaded_irq(&pdev->dev, info->virq, NULL, max77686_rtc_probe()
474 max77686_rtc_alarm_irq, 0, "rtc-alarm1", info); max77686_rtc_probe()
477 info->virq, ret); max77686_rtc_probe()
487 struct max77686_rtc_info *info = dev_get_drvdata(dev); max77686_rtc_suspend() local
489 return enable_irq_wake(info->virq); max77686_rtc_suspend()
498 struct max77686_rtc_info *info = dev_get_drvdata(dev); max77686_rtc_resume() local
500 return disable_irq_wake(info->virq); max77686_rtc_resume()
H A Drtc-max77802.c114 static int max77802_rtc_update(struct max77802_rtc_info *info, max77802_rtc_update() argument
125 ret = regmap_update_bits(info->max77802->regmap, max77802_rtc_update()
128 dev_err(info->dev, "%s: fail to write update reg(ret=%d, data=0x%x)\n", max77802_rtc_update()
141 struct max77802_rtc_info *info = dev_get_drvdata(dev); max77802_rtc_read_time() local
145 mutex_lock(&info->lock); max77802_rtc_read_time()
147 ret = max77802_rtc_update(info, MAX77802_RTC_READ); max77802_rtc_read_time()
151 ret = regmap_bulk_read(info->max77802->regmap, max77802_rtc_read_time()
154 dev_err(info->dev, "%s: fail to read time reg(%d)\n", __func__, max77802_rtc_read_time()
159 max77802_rtc_data_to_tm(data, tm, info->rtc_24hr_mode); max77802_rtc_read_time()
164 mutex_unlock(&info->lock); max77802_rtc_read_time()
170 struct max77802_rtc_info *info = dev_get_drvdata(dev); max77802_rtc_set_time() local
178 mutex_lock(&info->lock); max77802_rtc_set_time()
180 ret = regmap_bulk_write(info->max77802->regmap, max77802_rtc_set_time()
183 dev_err(info->dev, "%s: fail to write time reg(%d)\n", __func__, max77802_rtc_set_time()
188 ret = max77802_rtc_update(info, MAX77802_RTC_WRITE); max77802_rtc_set_time()
191 mutex_unlock(&info->lock); max77802_rtc_set_time()
197 struct max77802_rtc_info *info = dev_get_drvdata(dev); max77802_rtc_read_alarm() local
202 mutex_lock(&info->lock); max77802_rtc_read_alarm()
204 ret = max77802_rtc_update(info, MAX77802_RTC_READ); max77802_rtc_read_alarm()
208 ret = regmap_bulk_read(info->max77802->regmap, max77802_rtc_read_alarm()
211 dev_err(info->dev, "%s:%d fail to read alarm reg(%d)\n", max77802_rtc_read_alarm()
216 max77802_rtc_data_to_tm(data, &alrm->time, info->rtc_24hr_mode); max77802_rtc_read_alarm()
219 ret = regmap_read(info->max77802->regmap, max77802_rtc_read_alarm()
222 dev_err(info->dev, "%s:%d fail to read alarm enable(%d)\n", max77802_rtc_read_alarm()
230 ret = regmap_read(info->max77802->regmap, MAX77802_REG_STATUS2, &val); max77802_rtc_read_alarm()
232 dev_err(info->dev, "%s:%d fail to read status2 reg(%d)\n", max77802_rtc_read_alarm()
241 mutex_unlock(&info->lock); max77802_rtc_read_alarm()
245 static int max77802_rtc_stop_alarm(struct max77802_rtc_info *info) max77802_rtc_stop_alarm() argument
249 if (!mutex_is_locked(&info->lock)) max77802_rtc_stop_alarm()
250 dev_warn(info->dev, "%s: should have mutex locked\n", __func__); max77802_rtc_stop_alarm()
252 ret = max77802_rtc_update(info, MAX77802_RTC_READ); max77802_rtc_stop_alarm()
256 ret = regmap_write(info->max77802->regmap, max77802_rtc_stop_alarm()
259 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max77802_rtc_stop_alarm()
264 ret = max77802_rtc_update(info, MAX77802_RTC_WRITE); max77802_rtc_stop_alarm()
269 static int max77802_rtc_start_alarm(struct max77802_rtc_info *info) max77802_rtc_start_alarm() argument
273 if (!mutex_is_locked(&info->lock)) max77802_rtc_start_alarm()
274 dev_warn(info->dev, "%s: should have mutex locked\n", max77802_rtc_start_alarm()
277 ret = max77802_rtc_update(info, MAX77802_RTC_READ); max77802_rtc_start_alarm()
281 ret = regmap_write(info->max77802->regmap, max77802_rtc_start_alarm()
286 dev_err(info->dev, "%s: fail to read alarm reg(%d)\n", max77802_rtc_start_alarm()
291 ret = max77802_rtc_update(info, MAX77802_RTC_WRITE); max77802_rtc_start_alarm()
298 struct max77802_rtc_info *info = dev_get_drvdata(dev); max77802_rtc_set_alarm() local
306 mutex_lock(&info->lock); max77802_rtc_set_alarm()
308 ret = max77802_rtc_stop_alarm(info); max77802_rtc_set_alarm()
312 ret = regmap_bulk_write(info->max77802->regmap, max77802_rtc_set_alarm()
316 dev_err(info->dev, "%s: fail to write alarm reg(%d)\n", max77802_rtc_set_alarm()
321 ret = max77802_rtc_update(info, MAX77802_RTC_WRITE); max77802_rtc_set_alarm()
326 ret = max77802_rtc_start_alarm(info); max77802_rtc_set_alarm()
328 mutex_unlock(&info->lock); max77802_rtc_set_alarm()
335 struct max77802_rtc_info *info = dev_get_drvdata(dev); max77802_rtc_alarm_irq_enable() local
338 mutex_lock(&info->lock); max77802_rtc_alarm_irq_enable()
340 ret = max77802_rtc_start_alarm(info); max77802_rtc_alarm_irq_enable()
342 ret = max77802_rtc_stop_alarm(info); max77802_rtc_alarm_irq_enable()
343 mutex_unlock(&info->lock); max77802_rtc_alarm_irq_enable()
350 struct max77802_rtc_info *info = data; max77802_rtc_alarm_irq() local
352 dev_dbg(info->dev, "%s:irq(%d)\n", __func__, irq); max77802_rtc_alarm_irq()
354 rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF); max77802_rtc_alarm_irq()
367 static int max77802_rtc_init_reg(struct max77802_rtc_info *info) max77802_rtc_init_reg() argument
372 max77802_rtc_update(info, MAX77802_RTC_READ); max77802_rtc_init_reg()
378 info->rtc_24hr_mode = 1; max77802_rtc_init_reg()
380 ret = regmap_bulk_write(info->max77802->regmap, max77802_rtc_init_reg()
383 dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", max77802_rtc_init_reg()
388 ret = max77802_rtc_update(info, MAX77802_RTC_WRITE); max77802_rtc_init_reg()
395 struct max77802_rtc_info *info; max77802_rtc_probe() local
400 info = devm_kzalloc(&pdev->dev, sizeof(struct max77802_rtc_info), max77802_rtc_probe()
402 if (!info) max77802_rtc_probe()
405 mutex_init(&info->lock); max77802_rtc_probe()
406 info->dev = &pdev->dev; max77802_rtc_probe()
407 info->max77802 = max77802; max77802_rtc_probe()
408 info->rtc = max77802->i2c; max77802_rtc_probe()
410 platform_set_drvdata(pdev, info); max77802_rtc_probe()
412 ret = max77802_rtc_init_reg(info); max77802_rtc_probe()
421 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max77802-rtc", max77802_rtc_probe()
424 if (IS_ERR(info->rtc_dev)) { max77802_rtc_probe()
425 ret = PTR_ERR(info->rtc_dev); max77802_rtc_probe()
437 info->virq = regmap_irq_get_virq(max77802->rtc_irq_data, max77802_rtc_probe()
440 if (info->virq <= 0) { max77802_rtc_probe()
446 ret = devm_request_threaded_irq(&pdev->dev, info->virq, NULL, max77802_rtc_probe()
448 info); max77802_rtc_probe()
451 info->virq, ret); max77802_rtc_probe()
460 struct max77802_rtc_info *info = dev_get_drvdata(dev); max77802_rtc_suspend() local
462 return enable_irq_wake(info->virq); max77802_rtc_suspend()
471 struct max77802_rtc_info *info = dev_get_drvdata(dev); max77802_rtc_resume() local
473 return disable_irq_wake(info->virq); max77802_rtc_resume()
H A Drtc-sa1100.c52 struct sa1100_rtc *info = dev_get_drvdata(dev_id); sa1100_rtc_interrupt() local
53 struct rtc_device *rtc = info->rtc; sa1100_rtc_interrupt()
57 spin_lock(&info->lock); sa1100_rtc_interrupt()
59 rtsr = readl_relaxed(info->rtsr); sa1100_rtc_interrupt()
61 writel_relaxed(0, info->rtsr); sa1100_rtc_interrupt()
68 writel_relaxed((RTSR_AL | RTSR_HZ) & (rtsr >> 2), info->rtsr); sa1100_rtc_interrupt()
77 writel_relaxed(RTSR_AL | RTSR_HZ, info->rtsr); sa1100_rtc_interrupt()
83 writel_relaxed(rtsr & (RTSR_ALE | RTSR_HZE), info->rtsr); sa1100_rtc_interrupt()
93 spin_unlock(&info->lock); sa1100_rtc_interrupt()
100 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_open() local
101 struct rtc_device *rtc = info->rtc; sa1100_rtc_open()
104 ret = request_irq(info->irq_1hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev); sa1100_rtc_open()
106 dev_err(dev, "IRQ %d already in use.\n", info->irq_1hz); sa1100_rtc_open()
109 ret = request_irq(info->irq_alarm, sa1100_rtc_interrupt, 0, "rtc Alrm", dev); sa1100_rtc_open()
111 dev_err(dev, "IRQ %d already in use.\n", info->irq_alarm); sa1100_rtc_open()
120 free_irq(info->irq_1hz, dev); sa1100_rtc_open()
122 clk_disable_unprepare(info->clk); sa1100_rtc_open()
128 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_release() local
130 spin_lock_irq(&info->lock); sa1100_rtc_release()
131 writel_relaxed(0, info->rtsr); sa1100_rtc_release()
132 spin_unlock_irq(&info->lock); sa1100_rtc_release()
134 free_irq(info->irq_alarm, dev); sa1100_rtc_release()
135 free_irq(info->irq_1hz, dev); sa1100_rtc_release()
141 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_alarm_irq_enable() local
143 spin_lock_irq(&info->lock); sa1100_rtc_alarm_irq_enable()
144 rtsr = readl_relaxed(info->rtsr); sa1100_rtc_alarm_irq_enable()
149 writel_relaxed(rtsr, info->rtsr); sa1100_rtc_alarm_irq_enable()
150 spin_unlock_irq(&info->lock); sa1100_rtc_alarm_irq_enable()
156 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_read_time() local
158 rtc_time_to_tm(readl_relaxed(info->rcnr), tm); sa1100_rtc_read_time()
164 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_set_time() local
170 writel_relaxed(time, info->rcnr); sa1100_rtc_set_time()
177 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_read_alarm() local
179 rtsr = readl_relaxed(info->rtsr); sa1100_rtc_read_alarm()
187 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_set_alarm() local
191 spin_lock_irq(&info->lock); sa1100_rtc_set_alarm()
195 writel_relaxed(readl_relaxed(info->rtsr) & sa1100_rtc_set_alarm()
196 (RTSR_HZE | RTSR_ALE | RTSR_AL), info->rtsr); sa1100_rtc_set_alarm()
197 writel_relaxed(time, info->rtar); sa1100_rtc_set_alarm()
199 writel_relaxed(readl_relaxed(info->rtsr) | RTSR_ALE, info->rtsr); sa1100_rtc_set_alarm()
201 writel_relaxed(readl_relaxed(info->rtsr) & ~RTSR_ALE, info->rtsr); sa1100_rtc_set_alarm()
203 spin_unlock_irq(&info->lock); sa1100_rtc_set_alarm()
210 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_proc() local
212 seq_printf(seq, "trim/divider\t\t: 0x%08x\n", readl_relaxed(info->rttr)); sa1100_rtc_proc()
213 seq_printf(seq, "RTSR\t\t\t: 0x%08x\n", readl_relaxed(info->rtsr)); sa1100_rtc_proc()
229 int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info) sa1100_rtc_init() argument
234 spin_lock_init(&info->lock); sa1100_rtc_init()
236 info->clk = devm_clk_get(&pdev->dev, NULL); sa1100_rtc_init()
237 if (IS_ERR(info->clk)) { sa1100_rtc_init()
239 return PTR_ERR(info->clk); sa1100_rtc_init()
242 ret = clk_prepare_enable(info->clk); sa1100_rtc_init()
252 if (readl_relaxed(info->rttr) == 0) { sa1100_rtc_init()
253 writel_relaxed(RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16), info->rttr); sa1100_rtc_init()
257 writel_relaxed(0, info->rcnr); sa1100_rtc_init()
263 clk_disable_unprepare(info->clk); sa1100_rtc_init()
266 info->rtc = rtc; sa1100_rtc_init()
290 writel_relaxed(RTSR_AL | RTSR_HZ, info->rtsr); sa1100_rtc_init()
298 struct sa1100_rtc *info; sa1100_rtc_probe() local
308 info = devm_kzalloc(&pdev->dev, sizeof(struct sa1100_rtc), GFP_KERNEL); sa1100_rtc_probe()
309 if (!info) sa1100_rtc_probe()
311 info->irq_1hz = irq_1hz; sa1100_rtc_probe()
312 info->irq_alarm = irq_alarm; sa1100_rtc_probe()
321 info->rcnr = base + 0x04; sa1100_rtc_probe()
322 info->rtsr = base + 0x10; sa1100_rtc_probe()
323 info->rtar = base + 0x00; sa1100_rtc_probe()
324 info->rttr = base + 0x08; sa1100_rtc_probe()
326 info->rcnr = base + 0x0; sa1100_rtc_probe()
327 info->rtsr = base + 0x8; sa1100_rtc_probe()
328 info->rtar = base + 0x4; sa1100_rtc_probe()
329 info->rttr = base + 0xc; sa1100_rtc_probe()
332 platform_set_drvdata(pdev, info); sa1100_rtc_probe()
335 return sa1100_rtc_init(pdev, info); sa1100_rtc_probe()
340 struct sa1100_rtc *info = platform_get_drvdata(pdev); sa1100_rtc_remove() local
342 if (info) sa1100_rtc_remove()
343 clk_disable_unprepare(info->clk); sa1100_rtc_remove()
351 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_suspend() local
353 enable_irq_wake(info->irq_alarm); sa1100_rtc_suspend()
359 struct sa1100_rtc *info = dev_get_drvdata(dev); sa1100_rtc_resume() local
361 disable_irq_wake(info->irq_alarm); sa1100_rtc_resume()
H A Drtc-s5m.c163 static inline int s5m8767_wait_for_udr_update(struct s5m_rtc_info *info) s5m8767_wait_for_udr_update() argument
169 ret = regmap_read(info->regmap, info->regs->rtc_udr_update, s5m8767_wait_for_udr_update()
171 } while (--retry && (data & info->regs->rtc_udr_mask) && !ret); s5m8767_wait_for_udr_update()
174 dev_err(info->dev, "waiting for UDR update, reached max number of retries\n"); s5m8767_wait_for_udr_update()
179 static inline int s5m_check_peding_alarm_interrupt(struct s5m_rtc_info *info, s5m_check_peding_alarm_interrupt() argument
185 switch (info->device_type) { s5m_check_peding_alarm_interrupt()
188 ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val); s5m_check_peding_alarm_interrupt()
193 ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2, s5m_check_peding_alarm_interrupt()
211 static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) s5m8767_rtc_set_time_reg() argument
216 ret = regmap_read(info->regmap, info->regs->rtc_udr_update, &data); s5m8767_rtc_set_time_reg()
218 dev_err(info->dev, "failed to read update reg(%d)\n", ret); s5m8767_rtc_set_time_reg()
222 data |= info->regs->rtc_udr_mask; s5m8767_rtc_set_time_reg()
223 if (info->device_type == S5M8763X || info->device_type == S5M8767X) s5m8767_rtc_set_time_reg()
226 ret = regmap_write(info->regmap, info->regs->rtc_udr_update, data); s5m8767_rtc_set_time_reg()
228 dev_err(info->dev, "failed to write update reg(%d)\n", ret); s5m8767_rtc_set_time_reg()
232 ret = s5m8767_wait_for_udr_update(info); s5m8767_rtc_set_time_reg()
237 static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) s5m8767_rtc_set_alarm_reg() argument
242 ret = regmap_read(info->regmap, info->regs->rtc_udr_update, &data); s5m8767_rtc_set_alarm_reg()
244 dev_err(info->dev, "%s: fail to read update reg(%d)\n", s5m8767_rtc_set_alarm_reg()
249 data |= info->regs->rtc_udr_mask; s5m8767_rtc_set_alarm_reg()
250 switch (info->device_type) { s5m8767_rtc_set_alarm_reg()
265 ret = regmap_write(info->regmap, info->regs->rtc_udr_update, data); s5m8767_rtc_set_alarm_reg()
267 dev_err(info->dev, "%s: fail to write update reg(%d)\n", s5m8767_rtc_set_alarm_reg()
272 ret = s5m8767_wait_for_udr_update(info); s5m8767_rtc_set_alarm_reg()
275 if (info->device_type == S2MPS13X) s5m8767_rtc_set_alarm_reg()
276 regmap_update_bits(info->regmap, info->regs->rtc_udr_update, s5m8767_rtc_set_alarm_reg()
316 struct s5m_rtc_info *info = dev_get_drvdata(dev); s5m_rtc_read_time() local
317 u8 data[info->regs->regs_count]; s5m_rtc_read_time()
320 if (info->device_type == S2MPS14X || info->device_type == S2MPS13X) { s5m_rtc_read_time()
321 ret = regmap_update_bits(info->regmap, s5m_rtc_read_time()
322 info->regs->rtc_udr_update, s5m_rtc_read_time()
331 ret = regmap_bulk_read(info->regmap, info->regs->time, data, s5m_rtc_read_time()
332 info->regs->regs_count); s5m_rtc_read_time()
336 switch (info->device_type) { s5m_rtc_read_time()
344 s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode); s5m_rtc_read_time()
360 struct s5m_rtc_info *info = dev_get_drvdata(dev); s5m_rtc_set_time() local
361 u8 data[info->regs->regs_count]; s5m_rtc_set_time()
364 switch (info->device_type) { s5m_rtc_set_time()
384 ret = regmap_raw_write(info->regmap, info->regs->time, data, s5m_rtc_set_time()
385 info->regs->regs_count); s5m_rtc_set_time()
389 ret = s5m8767_rtc_set_time_reg(info); s5m_rtc_set_time()
396 struct s5m_rtc_info *info = dev_get_drvdata(dev); s5m_rtc_read_alarm() local
397 u8 data[info->regs->regs_count]; s5m_rtc_read_alarm()
401 ret = regmap_bulk_read(info->regmap, info->regs->alarm0, data, s5m_rtc_read_alarm()
402 info->regs->regs_count); s5m_rtc_read_alarm()
406 switch (info->device_type) { s5m_rtc_read_alarm()
409 ret = regmap_read(info->regmap, S5M_ALARM0_CONF, &val); s5m_rtc_read_alarm()
419 s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode); s5m_rtc_read_alarm()
421 for (i = 0; i < info->regs->regs_count; i++) { s5m_rtc_read_alarm()
439 ret = s5m_check_peding_alarm_interrupt(info, alrm); s5m_rtc_read_alarm()
444 static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) s5m_rtc_stop_alarm() argument
446 u8 data[info->regs->regs_count]; s5m_rtc_stop_alarm()
450 ret = regmap_bulk_read(info->regmap, info->regs->alarm0, data, s5m_rtc_stop_alarm()
451 info->regs->regs_count); s5m_rtc_stop_alarm()
455 s5m8767_data_to_tm(data, &tm, info->rtc_24hr_mode); s5m_rtc_stop_alarm()
456 dev_dbg(info->dev, "%s: %d/%d/%d %d:%d:%d(%d)\n", __func__, s5m_rtc_stop_alarm()
460 switch (info->device_type) { s5m_rtc_stop_alarm()
462 ret = regmap_write(info->regmap, S5M_ALARM0_CONF, 0); s5m_rtc_stop_alarm()
468 for (i = 0; i < info->regs->regs_count; i++) s5m_rtc_stop_alarm()
471 ret = regmap_raw_write(info->regmap, info->regs->alarm0, data, s5m_rtc_stop_alarm()
472 info->regs->regs_count); s5m_rtc_stop_alarm()
476 ret = s5m8767_rtc_set_alarm_reg(info); s5m_rtc_stop_alarm()
487 static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) s5m_rtc_start_alarm() argument
490 u8 data[info->regs->regs_count]; s5m_rtc_start_alarm()
494 ret = regmap_bulk_read(info->regmap, info->regs->alarm0, data, s5m_rtc_start_alarm()
495 info->regs->regs_count); s5m_rtc_start_alarm()
499 s5m8767_data_to_tm(data, &tm, info->rtc_24hr_mode); s5m_rtc_start_alarm()
500 dev_dbg(info->dev, "%s: %d/%d/%d %d:%d:%d(%d)\n", __func__, s5m_rtc_start_alarm()
504 switch (info->device_type) { s5m_rtc_start_alarm()
507 ret = regmap_write(info->regmap, S5M_ALARM0_CONF, alarm0_conf); s5m_rtc_start_alarm()
524 ret = regmap_raw_write(info->regmap, info->regs->alarm0, data, s5m_rtc_start_alarm()
525 info->regs->regs_count); s5m_rtc_start_alarm()
528 ret = s5m8767_rtc_set_alarm_reg(info); s5m_rtc_start_alarm()
541 struct s5m_rtc_info *info = dev_get_drvdata(dev); s5m_rtc_set_alarm() local
542 u8 data[info->regs->regs_count]; s5m_rtc_set_alarm()
545 switch (info->device_type) { s5m_rtc_set_alarm()
565 ret = s5m_rtc_stop_alarm(info); s5m_rtc_set_alarm()
569 ret = regmap_raw_write(info->regmap, info->regs->alarm0, data, s5m_rtc_set_alarm()
570 info->regs->regs_count); s5m_rtc_set_alarm()
574 ret = s5m8767_rtc_set_alarm_reg(info); s5m_rtc_set_alarm()
579 ret = s5m_rtc_start_alarm(info); s5m_rtc_set_alarm()
587 struct s5m_rtc_info *info = dev_get_drvdata(dev); s5m_rtc_alarm_irq_enable() local
590 return s5m_rtc_start_alarm(info); s5m_rtc_alarm_irq_enable()
592 return s5m_rtc_stop_alarm(info); s5m_rtc_alarm_irq_enable()
597 struct s5m_rtc_info *info = data; s5m_rtc_alarm_irq() local
599 rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF); s5m_rtc_alarm_irq()
612 static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) s5m8767_rtc_init_reg() argument
617 switch (info->device_type) { s5m8767_rtc_init_reg()
621 ret = regmap_update_bits(info->regmap, S5M_RTC_UDR_CON, s5m8767_rtc_init_reg()
624 dev_err(info->dev, "%s: fail to change UDR time: %d\n", s5m8767_rtc_init_reg()
631 ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2); s5m8767_rtc_init_reg()
637 ret = regmap_write(info->regmap, info->regs->ctrl, data[0]); s5m8767_rtc_init_reg()
647 ret = s5m8767_rtc_set_alarm_reg(info); s5m8767_rtc_init_reg()
654 info->rtc_24hr_mode = 1; s5m8767_rtc_init_reg()
656 dev_err(info->dev, "%s: fail to write controlm reg(%d)\n", s5m8767_rtc_init_reg()
668 struct s5m_rtc_info *info; s5m_rtc_probe() local
677 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); s5m_rtc_probe()
678 if (!info) s5m_rtc_probe()
685 info->regs = &s2mps_rtc_regs; s5m_rtc_probe()
690 info->regs = &s5m_rtc_regs; s5m_rtc_probe()
695 info->regs = &s5m_rtc_regs; s5m_rtc_probe()
705 info->i2c = i2c_new_dummy(s5m87xx->i2c->adapter, RTC_I2C_ADDR); s5m_rtc_probe()
706 if (!info->i2c) { s5m_rtc_probe()
711 info->regmap = devm_regmap_init_i2c(info->i2c, regmap_cfg); s5m_rtc_probe()
712 if (IS_ERR(info->regmap)) { s5m_rtc_probe()
713 ret = PTR_ERR(info->regmap); s5m_rtc_probe()
719 info->dev = &pdev->dev; s5m_rtc_probe()
720 info->s5m87xx = s5m87xx; s5m_rtc_probe()
721 info->device_type = platform_get_device_id(pdev)->driver_data; s5m_rtc_probe()
724 info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq); s5m_rtc_probe()
725 if (info->irq <= 0) { s5m_rtc_probe()
733 platform_set_drvdata(pdev, info); s5m_rtc_probe()
735 ret = s5m8767_rtc_init_reg(info); s5m_rtc_probe()
739 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc", s5m_rtc_probe()
742 if (IS_ERR(info->rtc_dev)) { s5m_rtc_probe()
743 ret = PTR_ERR(info->rtc_dev); s5m_rtc_probe()
747 if (!info->irq) { s5m_rtc_probe()
752 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, s5m_rtc_probe()
754 info); s5m_rtc_probe()
757 info->irq, ret); s5m_rtc_probe()
764 i2c_unregister_device(info->i2c); s5m_rtc_probe()
771 struct s5m_rtc_info *info = platform_get_drvdata(pdev); s5m_rtc_remove() local
773 i2c_unregister_device(info->i2c); s5m_rtc_remove()
781 struct s5m_rtc_info *info = dev_get_drvdata(dev); s5m_rtc_resume() local
784 if (info->irq && device_may_wakeup(dev)) s5m_rtc_resume()
785 ret = disable_irq_wake(info->irq); s5m_rtc_resume()
792 struct s5m_rtc_info *info = dev_get_drvdata(dev); s5m_rtc_suspend() local
795 if (info->irq && device_may_wakeup(dev)) s5m_rtc_suspend()
796 ret = enable_irq_wake(info->irq); s5m_rtc_suspend()
H A Drtc-88pm860x.c62 struct pm860x_rtc_info *info = (struct pm860x_rtc_info *)data; rtc_update_handler() local
66 pm860x_set_bits(info->i2c, PM8607_RTC1, mask | ALARM_EN, mask); rtc_update_handler()
67 rtc_update_irq(info->rtc_dev, 1, RTC_AF); rtc_update_handler()
73 struct pm860x_rtc_info *info = dev_get_drvdata(dev); pm860x_rtc_alarm_irq_enable() local
76 pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, ALARM_EN); pm860x_rtc_alarm_irq_enable()
78 pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, 0); pm860x_rtc_alarm_irq_enable()
111 struct pm860x_rtc_info *info = dev_get_drvdata(dev); pm860x_rtc_read_time() local
115 pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf); pm860x_rtc_read_time()
116 dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1], pm860x_rtc_read_time()
121 pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf); pm860x_rtc_read_time()
124 dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm860x_rtc_read_time()
134 struct pm860x_rtc_info *info = dev_get_drvdata(dev); pm860x_rtc_set_time() local
139 dev_dbg(info->dev, "Set time %d out of range. " pm860x_rtc_set_time()
147 pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf); pm860x_rtc_set_time()
150 dev_dbg(info->dev, "set base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm860x_rtc_set_time()
153 pm860x_page_reg_write(info->i2c, REG0_DATA, (base >> 24) & 0xFF); pm860x_rtc_set_time()
154 pm860x_page_reg_write(info->i2c, REG1_DATA, (base >> 16) & 0xFF); pm860x_rtc_set_time()
155 pm860x_page_reg_write(info->i2c, REG2_DATA, (base >> 8) & 0xFF); pm860x_rtc_set_time()
156 pm860x_page_reg_write(info->i2c, REG3_DATA, base & 0xFF); pm860x_rtc_set_time()
158 if (info->sync) pm860x_rtc_set_time()
159 info->sync(ticks); pm860x_rtc_set_time()
165 struct pm860x_rtc_info *info = dev_get_drvdata(dev); pm860x_rtc_read_alarm() local
170 pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf); pm860x_rtc_read_alarm()
171 dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1], pm860x_rtc_read_alarm()
175 pm860x_bulk_read(info->i2c, PM8607_RTC_EXPIRE1, 4, buf); pm860x_rtc_read_alarm()
178 dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm860x_rtc_read_alarm()
182 ret = pm860x_reg_read(info->i2c, PM8607_RTC1); pm860x_rtc_read_alarm()
190 struct pm860x_rtc_info *info = dev_get_drvdata(dev); pm860x_rtc_set_alarm() local
196 pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, 0); pm860x_rtc_set_alarm()
198 pm860x_page_bulk_read(info->i2c, REG0_ADDR, 8, buf); pm860x_rtc_set_alarm()
199 dev_dbg(info->dev, "%x-%x-%x-%x-%x-%x-%x-%x\n", buf[0], buf[1], pm860x_rtc_set_alarm()
204 pm860x_bulk_read(info->i2c, PM8607_RTC_COUNTER1, 4, buf); pm860x_rtc_set_alarm()
207 dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm860x_rtc_set_alarm()
220 pm860x_bulk_write(info->i2c, PM8607_RTC_EXPIRE1, 4, buf); pm860x_rtc_set_alarm()
223 pm860x_set_bits(info->i2c, PM8607_RTC1, mask, mask); pm860x_rtc_set_alarm()
226 pm860x_set_bits(info->i2c, PM8607_RTC1, mask, pm860x_rtc_set_alarm()
243 struct pm860x_rtc_info *info = container_of(work, calibrate_vrtc_work() local
251 pm860x_bulk_read(info->i2c, REG_VRTC_MEAS1, 2, buf); calibrate_vrtc_work()
257 vrtc_set = 2700 + (info->vrtc & 0x3) * 200; calibrate_vrtc_work()
258 dev_dbg(info->dev, "mean:%d, vrtc_set:%d\n", mean, vrtc_set); calibrate_vrtc_work()
260 sum = pm860x_reg_read(info->i2c, PM8607_RTC_MISC1); calibrate_vrtc_work()
267 pm860x_reg_write(info->i2c, PM8607_RTC_MISC1, data); calibrate_vrtc_work()
273 pm860x_reg_write(info->i2c, PM8607_RTC_MISC1, data); calibrate_vrtc_work()
276 dev_dbg(info->dev, "set 0x%x to RTC_MISC1\n", data); calibrate_vrtc_work()
278 schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); calibrate_vrtc_work()
282 pm860x_set_bits(info->i2c, PM8607_MEAS_EN2, MEAS2_VRTC, 0); calibrate_vrtc_work()
283 dev_dbg(info->dev, "finish VRTC calibration\n"); calibrate_vrtc_work()
290 struct pm860x_rtc_info *info) pm860x_rtc_dt_init()
301 ret = of_property_read_u32(np, "marvell,88pm860x-vrtc", &info->vrtc); pm860x_rtc_dt_init()
303 info->vrtc = 0; pm860x_rtc_dt_init()
315 struct pm860x_rtc_info *info; pm860x_rtc_probe() local
322 info = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_rtc_info), pm860x_rtc_probe()
324 if (!info) pm860x_rtc_probe()
326 info->irq = platform_get_irq(pdev, 0); pm860x_rtc_probe()
327 if (info->irq < 0) { pm860x_rtc_probe()
329 return info->irq; pm860x_rtc_probe()
332 info->chip = chip; pm860x_rtc_probe()
333 info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion; pm860x_rtc_probe()
334 info->dev = &pdev->dev; pm860x_rtc_probe()
335 dev_set_drvdata(&pdev->dev, info); pm860x_rtc_probe()
337 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, pm860x_rtc_probe()
339 info); pm860x_rtc_probe()
342 info->irq, ret); pm860x_rtc_probe()
347 pm860x_page_reg_write(info->i2c, REG0_ADDR, REG0_DATA); pm860x_rtc_probe()
348 pm860x_page_reg_write(info->i2c, REG1_ADDR, REG1_DATA); pm860x_rtc_probe()
349 pm860x_page_reg_write(info->i2c, REG2_ADDR, REG2_DATA); pm860x_rtc_probe()
350 pm860x_page_reg_write(info->i2c, REG3_ADDR, REG3_DATA); pm860x_rtc_probe()
371 if (pm860x_rtc_dt_init(pdev, info)) { pm860x_rtc_probe()
374 info->sync = pdata->sync; pm860x_rtc_probe()
378 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "88pm860x-rtc", pm860x_rtc_probe()
380 ret = PTR_ERR(info->rtc_dev); pm860x_rtc_probe()
381 if (IS_ERR(info->rtc_dev)) { pm860x_rtc_probe()
390 pm860x_set_bits(info->i2c, PM8607_RTC1, RTC1_USE_XO, RTC1_USE_XO); pm860x_rtc_probe()
394 if (pm860x_rtc_dt_init(pdev, info)) { pm860x_rtc_probe()
396 info->vrtc = pdata->vrtc & 0x3; pm860x_rtc_probe()
398 info->vrtc = 1; pm860x_rtc_probe()
400 pm860x_set_bits(info->i2c, PM8607_MEAS_EN2, MEAS2_VRTC, MEAS2_VRTC); pm860x_rtc_probe()
403 INIT_DELAYED_WORK(&info->calib_work, calibrate_vrtc_work); pm860x_rtc_probe()
404 schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); pm860x_rtc_probe()
414 struct pm860x_rtc_info *info = platform_get_drvdata(pdev); pm860x_rtc_remove() local
419 pm860x_set_bits(info->i2c, PM8607_MEAS_EN2, MEAS2_VRTC, 0); pm860x_rtc_remove()
289 pm860x_rtc_dt_init(struct platform_device *pdev, struct pm860x_rtc_info *info) pm860x_rtc_dt_init() argument
H A Drtc-88pm80x.c63 struct pm80x_rtc_info *info = (struct pm80x_rtc_info *)data; rtc_update_handler() local
67 regmap_update_bits(info->map, PM800_RTC_CONTROL, mask | PM800_ALARM1_EN, rtc_update_handler()
69 rtc_update_irq(info->rtc_dev, 1, RTC_AF); rtc_update_handler()
75 struct pm80x_rtc_info *info = dev_get_drvdata(dev); pm80x_rtc_alarm_irq_enable() local
78 regmap_update_bits(info->map, PM800_RTC_CONTROL, pm80x_rtc_alarm_irq_enable()
81 regmap_update_bits(info->map, PM800_RTC_CONTROL, pm80x_rtc_alarm_irq_enable()
115 struct pm80x_rtc_info *info = dev_get_drvdata(dev); pm80x_rtc_read_time() local
118 regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4); pm80x_rtc_read_time()
120 dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]); pm80x_rtc_read_time()
123 regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4); pm80x_rtc_read_time()
126 dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm80x_rtc_read_time()
134 struct pm80x_rtc_info *info = dev_get_drvdata(dev); pm80x_rtc_set_time() local
138 dev_dbg(info->dev, pm80x_rtc_set_time()
146 regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4); pm80x_rtc_set_time()
149 dev_dbg(info->dev, "set base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm80x_rtc_set_time()
155 regmap_raw_write(info->map, PM800_RTC_EXPIRE2_1, buf, 4); pm80x_rtc_set_time()
162 struct pm80x_rtc_info *info = dev_get_drvdata(dev); pm80x_rtc_read_alarm() local
167 regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4); pm80x_rtc_read_alarm()
169 dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]); pm80x_rtc_read_alarm()
171 regmap_raw_read(info->map, PM800_RTC_EXPIRE1_1, buf, 4); pm80x_rtc_read_alarm()
174 dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm80x_rtc_read_alarm()
178 regmap_read(info->map, PM800_RTC_CONTROL, &ret); pm80x_rtc_read_alarm()
186 struct pm80x_rtc_info *info = dev_get_drvdata(dev); pm80x_rtc_set_alarm() local
192 regmap_update_bits(info->map, PM800_RTC_CONTROL, PM800_ALARM1_EN, 0); pm80x_rtc_set_alarm()
194 regmap_raw_read(info->map, PM800_RTC_EXPIRE2_1, buf, 4); pm80x_rtc_set_alarm()
196 dev_dbg(info->dev, "%x-%x-%x-%x\n", buf[0], buf[1], buf[2], buf[3]); pm80x_rtc_set_alarm()
199 regmap_raw_read(info->map, PM800_RTC_COUNTER1, buf, 4); pm80x_rtc_set_alarm()
202 dev_dbg(info->dev, "get base:0x%lx, RO count:0x%lx, ticks:0x%lx\n", pm80x_rtc_set_alarm()
206 dev_dbg(info->dev, "%s, now time : %lu\n", __func__, ticks); pm80x_rtc_set_alarm()
210 dev_dbg(info->dev, "%s, alarm time: %lu\n", __func__, ticks); pm80x_rtc_set_alarm()
217 regmap_raw_write(info->map, PM800_RTC_EXPIRE1_1, buf, 4); pm80x_rtc_set_alarm()
220 regmap_update_bits(info->map, PM800_RTC_CONTROL, mask, mask); pm80x_rtc_set_alarm()
223 regmap_update_bits(info->map, PM800_RTC_CONTROL, mask, pm80x_rtc_set_alarm()
255 struct pm80x_rtc_info *info; pm80x_rtc_probe() local
275 info = pm80x_rtc_probe()
277 if (!info) pm80x_rtc_probe()
279 info->irq = platform_get_irq(pdev, 0); pm80x_rtc_probe()
280 if (info->irq < 0) { pm80x_rtc_probe()
286 info->chip = chip; pm80x_rtc_probe()
287 info->map = chip->regmap; pm80x_rtc_probe()
288 if (!info->map) { pm80x_rtc_probe()
294 info->dev = &pdev->dev; pm80x_rtc_probe()
295 dev_set_drvdata(&pdev->dev, info); pm80x_rtc_probe()
297 ret = pm80x_request_irq(chip, info->irq, rtc_update_handler, pm80x_rtc_probe()
298 IRQF_ONESHOT, "rtc", info); pm80x_rtc_probe()
301 info->irq, ret); pm80x_rtc_probe()
325 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "88pm80x-rtc", pm80x_rtc_probe()
327 if (IS_ERR(info->rtc_dev)) { pm80x_rtc_probe()
328 ret = PTR_ERR(info->rtc_dev); pm80x_rtc_probe()
336 regmap_update_bits(info->map, PM800_RTC_CONTROL, PM800_RTC1_USE_XO, pm80x_rtc_probe()
340 info->rtc_dev->dev.platform_data = &pdata->rtc_wakeup; pm80x_rtc_probe()
346 pm80x_free_irq(chip, info->irq, info); pm80x_rtc_probe()
353 struct pm80x_rtc_info *info = platform_get_drvdata(pdev); pm80x_rtc_remove() local
354 pm80x_free_irq(info->chip, info->irq, info); pm80x_rtc_remove()
H A Drtc-tegra.c71 static inline u32 tegra_rtc_check_busy(struct tegra_rtc_info *info) tegra_rtc_check_busy() argument
73 return readl(info->rtc_base + TEGRA_RTC_REG_BUSY) & 1; tegra_rtc_check_busy()
87 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_wait_while_busy() local
93 while (tegra_rtc_check_busy(info)) { tegra_rtc_wait_while_busy()
109 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_read_time() local
115 spin_lock_irqsave(&info->tegra_rtc_lock, sl_irq_flags); tegra_rtc_read_time()
117 msec = readl(info->rtc_base + TEGRA_RTC_REG_MILLI_SECONDS); tegra_rtc_read_time()
118 sec = readl(info->rtc_base + TEGRA_RTC_REG_SHADOW_SECONDS); tegra_rtc_read_time()
120 spin_unlock_irqrestore(&info->tegra_rtc_lock, sl_irq_flags); tegra_rtc_read_time()
139 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_set_time() local
163 writel(sec, info->rtc_base + TEGRA_RTC_REG_SECONDS); tegra_rtc_set_time()
166 readl(info->rtc_base + TEGRA_RTC_REG_SECONDS)); tegra_rtc_set_time()
173 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_read_alarm() local
177 sec = readl(info->rtc_base + TEGRA_RTC_REG_SECONDS_ALARM0); tegra_rtc_read_alarm()
194 tmp = readl(info->rtc_base + TEGRA_RTC_REG_INTR_STATUS); tegra_rtc_read_alarm()
202 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_alarm_irq_enable() local
207 spin_lock_irqsave(&info->tegra_rtc_lock, sl_irq_flags); tegra_rtc_alarm_irq_enable()
210 status = readl(info->rtc_base + TEGRA_RTC_REG_INTR_MASK); tegra_rtc_alarm_irq_enable()
216 writel(status, info->rtc_base + TEGRA_RTC_REG_INTR_MASK); tegra_rtc_alarm_irq_enable()
218 spin_unlock_irqrestore(&info->tegra_rtc_lock, sl_irq_flags); tegra_rtc_alarm_irq_enable()
225 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_set_alarm() local
234 writel(sec, info->rtc_base + TEGRA_RTC_REG_SECONDS_ALARM0); tegra_rtc_set_alarm()
236 readl(info->rtc_base + TEGRA_RTC_REG_SECONDS_ALARM0)); tegra_rtc_set_alarm()
272 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_irq_handler() local
277 status = readl(info->rtc_base + TEGRA_RTC_REG_INTR_STATUS); tegra_rtc_irq_handler()
281 spin_lock_irqsave(&info->tegra_rtc_lock, sl_irq_flags); tegra_rtc_irq_handler()
282 writel(0, info->rtc_base + TEGRA_RTC_REG_INTR_MASK); tegra_rtc_irq_handler()
283 writel(status, info->rtc_base + TEGRA_RTC_REG_INTR_STATUS); tegra_rtc_irq_handler()
284 spin_unlock_irqrestore(&info->tegra_rtc_lock, sl_irq_flags); tegra_rtc_irq_handler()
295 rtc_update_irq(info->rtc_dev, 1, events); tegra_rtc_irq_handler()
317 struct tegra_rtc_info *info; tegra_rtc_probe() local
321 info = devm_kzalloc(&pdev->dev, sizeof(struct tegra_rtc_info), tegra_rtc_probe()
323 if (!info) tegra_rtc_probe()
327 info->rtc_base = devm_ioremap_resource(&pdev->dev, res); tegra_rtc_probe()
328 if (IS_ERR(info->rtc_base)) tegra_rtc_probe()
329 return PTR_ERR(info->rtc_base); tegra_rtc_probe()
331 info->tegra_rtc_irq = platform_get_irq(pdev, 0); tegra_rtc_probe()
332 if (info->tegra_rtc_irq <= 0) tegra_rtc_probe()
335 /* set context info. */ tegra_rtc_probe()
336 info->pdev = pdev; tegra_rtc_probe()
337 spin_lock_init(&info->tegra_rtc_lock); tegra_rtc_probe()
339 platform_set_drvdata(pdev, info); tegra_rtc_probe()
342 writel(0, info->rtc_base + TEGRA_RTC_REG_SECONDS_ALARM0); tegra_rtc_probe()
343 writel(0xffffffff, info->rtc_base + TEGRA_RTC_REG_INTR_STATUS); tegra_rtc_probe()
344 writel(0, info->rtc_base + TEGRA_RTC_REG_INTR_MASK); tegra_rtc_probe()
348 info->rtc_dev = devm_rtc_device_register(&pdev->dev, tegra_rtc_probe()
351 if (IS_ERR(info->rtc_dev)) { tegra_rtc_probe()
352 ret = PTR_ERR(info->rtc_dev); tegra_rtc_probe()
358 ret = devm_request_irq(&pdev->dev, info->tegra_rtc_irq, tegra_rtc_probe()
376 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_suspend() local
381 writel(0xffffffff, info->rtc_base + TEGRA_RTC_REG_INTR_STATUS); tegra_rtc_suspend()
383 info->rtc_base + TEGRA_RTC_REG_INTR_MASK); tegra_rtc_suspend()
386 readl(info->rtc_base + TEGRA_RTC_REG_SECONDS_ALARM0)); tegra_rtc_suspend()
389 device_may_wakeup(dev), info->tegra_rtc_irq); tegra_rtc_suspend()
393 enable_irq_wake(info->tegra_rtc_irq); tegra_rtc_suspend()
400 struct tegra_rtc_info *info = dev_get_drvdata(dev); tegra_rtc_resume() local
406 disable_irq_wake(info->tegra_rtc_irq); tegra_rtc_resume()
H A Drtc-max8998.c113 struct max8998_rtc_info *info = dev_get_drvdata(dev); max8998_rtc_read_time() local
117 ret = max8998_bulk_read(info->rtc, MAX8998_RTC_SEC, 8, data); max8998_rtc_read_time()
128 struct max8998_rtc_info *info = dev_get_drvdata(dev); max8998_rtc_set_time() local
134 ret = max8998_bulk_write(info->rtc, MAX8998_RTC_SEC, 8, data); max8998_rtc_set_time()
136 if (info->lp3974_bug_workaround) max8998_rtc_set_time()
144 struct max8998_rtc_info *info = dev_get_drvdata(dev); max8998_rtc_read_alarm() local
149 ret = max8998_bulk_read(info->rtc, MAX8998_ALARM0_SEC, 8, data); max8998_rtc_read_alarm()
155 ret = max8998_read_reg(info->rtc, MAX8998_ALARM0_CONF, &val); max8998_rtc_read_alarm()
161 ret = max8998_read_reg(info->rtc, MAX8998_RTC_STATUS, &val); max8998_rtc_read_alarm()
173 static int max8998_rtc_stop_alarm(struct max8998_rtc_info *info) max8998_rtc_stop_alarm() argument
175 int ret = max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, 0); max8998_rtc_stop_alarm()
177 if (info->lp3974_bug_workaround) max8998_rtc_stop_alarm()
183 static int max8998_rtc_start_alarm(struct max8998_rtc_info *info) max8998_rtc_start_alarm() argument
189 if (info->lp3974_bug_workaround) max8998_rtc_start_alarm()
192 ret = max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, alarm0_conf); max8998_rtc_start_alarm()
194 if (info->lp3974_bug_workaround) max8998_rtc_start_alarm()
202 struct max8998_rtc_info *info = dev_get_drvdata(dev); max8998_rtc_set_alarm() local
208 ret = max8998_rtc_stop_alarm(info); max8998_rtc_set_alarm()
212 ret = max8998_bulk_write(info->rtc, MAX8998_ALARM0_SEC, 8, data); max8998_rtc_set_alarm()
216 if (info->lp3974_bug_workaround) max8998_rtc_set_alarm()
220 ret = max8998_rtc_start_alarm(info); max8998_rtc_set_alarm()
228 struct max8998_rtc_info *info = dev_get_drvdata(dev); max8998_rtc_alarm_irq_enable() local
231 return max8998_rtc_start_alarm(info); max8998_rtc_alarm_irq_enable()
233 return max8998_rtc_stop_alarm(info); max8998_rtc_alarm_irq_enable()
238 struct max8998_rtc_info *info = data; max8998_rtc_alarm_irq() local
240 rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF); max8998_rtc_alarm_irq()
257 struct max8998_rtc_info *info; max8998_rtc_probe() local
260 info = devm_kzalloc(&pdev->dev, sizeof(struct max8998_rtc_info), max8998_rtc_probe()
262 if (!info) max8998_rtc_probe()
265 info->dev = &pdev->dev; max8998_rtc_probe()
266 info->max8998 = max8998; max8998_rtc_probe()
267 info->rtc = max8998->rtc; max8998_rtc_probe()
269 platform_set_drvdata(pdev, info); max8998_rtc_probe()
271 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8998-rtc", max8998_rtc_probe()
274 if (IS_ERR(info->rtc_dev)) { max8998_rtc_probe()
275 ret = PTR_ERR(info->rtc_dev); max8998_rtc_probe()
283 info->irq = irq_create_mapping(max8998->irq_domain, MAX8998_IRQ_ALARM0); max8998_rtc_probe()
284 if (!info->irq) { max8998_rtc_probe()
289 ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, max8998_rtc_probe()
290 max8998_rtc_alarm_irq, 0, "rtc-alarm0", info); max8998_rtc_probe()
294 info->irq, ret); max8998_rtc_probe()
299 info->lp3974_bug_workaround = true; max8998_rtc_probe()
/linux-4.4.14/net/netfilter/
H A Dxt_rateest.c20 const struct xt_rateest_match_info *info = par->matchinfo; xt_rateest_mt() local
25 spin_lock_bh(&info->est1->lock); xt_rateest_mt()
26 r = &info->est1->rstats; xt_rateest_mt()
27 if (info->flags & XT_RATEEST_MATCH_DELTA) { xt_rateest_mt()
28 bps1 = info->bps1 >= r->bps ? info->bps1 - r->bps : 0; xt_rateest_mt()
29 pps1 = info->pps1 >= r->pps ? info->pps1 - r->pps : 0; xt_rateest_mt()
34 spin_unlock_bh(&info->est1->lock); xt_rateest_mt()
36 if (info->flags & XT_RATEEST_MATCH_ABS) { xt_rateest_mt()
37 bps2 = info->bps2; xt_rateest_mt()
38 pps2 = info->pps2; xt_rateest_mt()
40 spin_lock_bh(&info->est2->lock); xt_rateest_mt()
41 r = &info->est2->rstats; xt_rateest_mt()
42 if (info->flags & XT_RATEEST_MATCH_DELTA) { xt_rateest_mt()
43 bps2 = info->bps2 >= r->bps ? info->bps2 - r->bps : 0; xt_rateest_mt()
44 pps2 = info->pps2 >= r->pps ? info->pps2 - r->pps : 0; xt_rateest_mt()
49 spin_unlock_bh(&info->est2->lock); xt_rateest_mt()
52 switch (info->mode) { xt_rateest_mt()
54 if (info->flags & XT_RATEEST_MATCH_BPS) xt_rateest_mt()
56 if (info->flags & XT_RATEEST_MATCH_PPS) xt_rateest_mt()
60 if (info->flags & XT_RATEEST_MATCH_BPS) xt_rateest_mt()
62 if (info->flags & XT_RATEEST_MATCH_PPS) xt_rateest_mt()
66 if (info->flags & XT_RATEEST_MATCH_BPS) xt_rateest_mt()
68 if (info->flags & XT_RATEEST_MATCH_PPS) xt_rateest_mt()
73 ret ^= info->flags & XT_RATEEST_MATCH_INVERT ? true : false; xt_rateest_mt()
79 struct xt_rateest_match_info *info = par->matchinfo; xt_rateest_mt_checkentry() local
83 if (hweight32(info->flags & (XT_RATEEST_MATCH_ABS | xt_rateest_mt_checkentry()
87 if (!(info->flags & (XT_RATEEST_MATCH_BPS | XT_RATEEST_MATCH_PPS))) xt_rateest_mt_checkentry()
90 switch (info->mode) { xt_rateest_mt_checkentry()
100 est1 = xt_rateest_lookup(info->name1); xt_rateest_mt_checkentry()
105 if (info->flags & XT_RATEEST_MATCH_REL) { xt_rateest_mt_checkentry()
106 est2 = xt_rateest_lookup(info->name2); xt_rateest_mt_checkentry()
111 info->est1 = est1; xt_rateest_mt_checkentry()
112 info->est2 = est2; xt_rateest_mt_checkentry()
123 struct xt_rateest_match_info *info = par->matchinfo; xt_rateest_mt_destroy() local
125 xt_rateest_put(info->est1); xt_rateest_mt_destroy()
126 if (info->est2) xt_rateest_mt_destroy()
127 xt_rateest_put(info->est2); xt_rateest_mt_destroy()
H A Dxt_conntrack.c44 const struct xt_conntrack_mtinfo2 *info, conntrack_mt_origsrc()
48 &info->origsrc_addr, &info->origsrc_mask, family); conntrack_mt_origsrc()
53 const struct xt_conntrack_mtinfo2 *info, conntrack_mt_origdst()
57 &info->origdst_addr, &info->origdst_mask, family); conntrack_mt_origdst()
62 const struct xt_conntrack_mtinfo2 *info, conntrack_mt_replsrc()
66 &info->replsrc_addr, &info->replsrc_mask, family); conntrack_mt_replsrc()
71 const struct xt_conntrack_mtinfo2 *info, conntrack_mt_repldst()
75 &info->repldst_addr, &info->repldst_mask, family); conntrack_mt_repldst()
79 ct_proto_port_check(const struct xt_conntrack_mtinfo2 *info, ct_proto_port_check() argument
85 if ((info->match_flags & XT_CONNTRACK_PROTO) && ct_proto_port_check()
86 (nf_ct_protonum(ct) == info->l4proto) ^ ct_proto_port_check()
87 !(info->invert_flags & XT_CONNTRACK_PROTO)) ct_proto_port_check()
91 if ((info->match_flags & XT_CONNTRACK_ORIGSRC_PORT) && ct_proto_port_check()
92 (tuple->src.u.all == info->origsrc_port) ^ ct_proto_port_check()
93 !(info->invert_flags & XT_CONNTRACK_ORIGSRC_PORT)) ct_proto_port_check()
96 if ((info->match_flags & XT_CONNTRACK_ORIGDST_PORT) && ct_proto_port_check()
97 (tuple->dst.u.all == info->origdst_port) ^ ct_proto_port_check()
98 !(info->invert_flags & XT_CONNTRACK_ORIGDST_PORT)) ct_proto_port_check()
103 if ((info->match_flags & XT_CONNTRACK_REPLSRC_PORT) && ct_proto_port_check()
104 (tuple->src.u.all == info->replsrc_port) ^ ct_proto_port_check()
105 !(info->invert_flags & XT_CONNTRACK_REPLSRC_PORT)) ct_proto_port_check()
108 if ((info->match_flags & XT_CONNTRACK_REPLDST_PORT) && ct_proto_port_check()
109 (tuple->dst.u.all == info->repldst_port) ^ ct_proto_port_check()
110 !(info->invert_flags & XT_CONNTRACK_REPLDST_PORT)) ct_proto_port_check()
123 ct_proto_port_check_v3(const struct xt_conntrack_mtinfo3 *info, ct_proto_port_check_v3() argument
129 if ((info->match_flags & XT_CONNTRACK_PROTO) && ct_proto_port_check_v3()
130 (nf_ct_protonum(ct) == info->l4proto) ^ ct_proto_port_check_v3()
131 !(info->invert_flags & XT_CONNTRACK_PROTO)) ct_proto_port_check_v3()
135 if ((info->match_flags & XT_CONNTRACK_ORIGSRC_PORT) && ct_proto_port_check_v3()
136 !port_match(info->origsrc_port, info->origsrc_port_high, ct_proto_port_check_v3()
138 info->invert_flags & XT_CONNTRACK_ORIGSRC_PORT)) ct_proto_port_check_v3()
141 if ((info->match_flags & XT_CONNTRACK_ORIGDST_PORT) && ct_proto_port_check_v3()
142 !port_match(info->origdst_port, info->origdst_port_high, ct_proto_port_check_v3()
144 info->invert_flags & XT_CONNTRACK_ORIGDST_PORT)) ct_proto_port_check_v3()
149 if ((info->match_flags & XT_CONNTRACK_REPLSRC_PORT) && ct_proto_port_check_v3()
150 !port_match(info->replsrc_port, info->replsrc_port_high, ct_proto_port_check_v3()
152 info->invert_flags & XT_CONNTRACK_REPLSRC_PORT)) ct_proto_port_check_v3()
155 if ((info->match_flags & XT_CONNTRACK_REPLDST_PORT) && ct_proto_port_check_v3()
156 !port_match(info->repldst_port, info->repldst_port_high, ct_proto_port_check_v3()
158 info->invert_flags & XT_CONNTRACK_REPLDST_PORT)) ct_proto_port_check_v3()
168 const struct xt_conntrack_mtinfo2 *info = par->matchinfo; conntrack_mt() local
183 if (info->match_flags & XT_CONNTRACK_STATE) { conntrack_mt()
191 !(info->invert_flags & XT_CONNTRACK_STATE)) conntrack_mt()
196 return info->match_flags & XT_CONNTRACK_STATE; conntrack_mt()
197 if ((info->match_flags & XT_CONNTRACK_DIRECTION) && conntrack_mt()
199 !(info->invert_flags & XT_CONNTRACK_DIRECTION)) conntrack_mt()
202 if (info->match_flags & XT_CONNTRACK_ORIGSRC) conntrack_mt()
203 if (conntrack_mt_origsrc(ct, info, par->family) ^ conntrack_mt()
204 !(info->invert_flags & XT_CONNTRACK_ORIGSRC)) conntrack_mt()
207 if (info->match_flags & XT_CONNTRACK_ORIGDST) conntrack_mt()
208 if (conntrack_mt_origdst(ct, info, par->family) ^ conntrack_mt()
209 !(info->invert_flags & XT_CONNTRACK_ORIGDST)) conntrack_mt()
212 if (info->match_flags & XT_CONNTRACK_REPLSRC) conntrack_mt()
213 if (conntrack_mt_replsrc(ct, info, par->family) ^ conntrack_mt()
214 !(info->invert_flags & XT_CONNTRACK_REPLSRC)) conntrack_mt()
217 if (info->match_flags & XT_CONNTRACK_REPLDST) conntrack_mt()
218 if (conntrack_mt_repldst(ct, info, par->family) ^ conntrack_mt()
219 !(info->invert_flags & XT_CONNTRACK_REPLDST)) conntrack_mt()
223 if (!ct_proto_port_check(info, ct)) conntrack_mt()
230 if ((info->match_flags & XT_CONNTRACK_STATUS) && conntrack_mt()
232 !(info->invert_flags & XT_CONNTRACK_STATUS))) conntrack_mt()
235 if (info->match_flags & XT_CONNTRACK_EXPIRES) { conntrack_mt()
240 if ((expires >= info->expires_min && conntrack_mt()
241 expires <= info->expires_max) ^ conntrack_mt()
242 !(info->invert_flags & XT_CONNTRACK_EXPIRES)) conntrack_mt()
251 const struct xt_conntrack_mtinfo1 *info = par->matchinfo; conntrack_mt_v1() local
253 return conntrack_mt(skb, par, info->state_mask, info->status_mask); conntrack_mt_v1()
259 const struct xt_conntrack_mtinfo2 *info = par->matchinfo; conntrack_mt_v2() local
261 return conntrack_mt(skb, par, info->state_mask, info->status_mask); conntrack_mt_v2()
267 const struct xt_conntrack_mtinfo3 *info = par->matchinfo; conntrack_mt_v3() local
269 return conntrack_mt(skb, par, info->state_mask, info->status_mask); conntrack_mt_v3()
43 conntrack_mt_origsrc(const struct nf_conn *ct, const struct xt_conntrack_mtinfo2 *info, u_int8_t family) conntrack_mt_origsrc() argument
52 conntrack_mt_origdst(const struct nf_conn *ct, const struct xt_conntrack_mtinfo2 *info, u_int8_t family) conntrack_mt_origdst() argument
61 conntrack_mt_replsrc(const struct nf_conn *ct, const struct xt_conntrack_mtinfo2 *info, u_int8_t family) conntrack_mt_replsrc() argument
70 conntrack_mt_repldst(const struct nf_conn *ct, const struct xt_conntrack_mtinfo2 *info, u_int8_t family) conntrack_mt_repldst() argument
H A Dxt_set.c56 const struct xt_set_info_match_v0 *info = par->matchinfo; set_match_v0() local
58 ADT_OPT(opt, par->family, info->match_set.u.compat.dim, set_match_v0()
59 info->match_set.u.compat.flags, 0, UINT_MAX); set_match_v0()
61 return match_set(info->match_set.index, skb, par, &opt, set_match_v0()
62 info->match_set.u.compat.flags & IPSET_INV_MATCH); set_match_v0()
66 compat_flags(struct xt_set_info_v0 *info) compat_flags() argument
71 info->u.compat.dim = IPSET_DIM_ZERO; compat_flags()
72 if (info->u.flags[0] & IPSET_MATCH_INV) compat_flags()
73 info->u.compat.flags |= IPSET_INV_MATCH; compat_flags()
74 for (i = 0; i < IPSET_DIM_MAX - 1 && info->u.flags[i]; i++) { compat_flags()
75 info->u.compat.dim++; compat_flags()
76 if (info->u.flags[i] & IPSET_SRC) compat_flags()
77 info->u.compat.flags |= (1 << info->u.compat.dim); compat_flags()
84 struct xt_set_info_match_v0 *info = par->matchinfo; set_match_v0_checkentry() local
87 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index); set_match_v0_checkentry()
91 info->match_set.index); set_match_v0_checkentry()
94 if (info->match_set.u.flags[IPSET_DIM_MAX - 1] != 0) { set_match_v0_checkentry()
96 ip_set_nfnl_put(par->net, info->match_set.index); set_match_v0_checkentry()
101 compat_flags(&info->match_set); set_match_v0_checkentry()
109 struct xt_set_info_match_v0 *info = par->matchinfo; set_match_v0_destroy() local
111 ip_set_nfnl_put(par->net, info->match_set.index); set_match_v0_destroy()
119 const struct xt_set_info_match_v1 *info = par->matchinfo; set_match_v1() local
121 ADT_OPT(opt, par->family, info->match_set.dim, set_match_v1()
122 info->match_set.flags, 0, UINT_MAX); set_match_v1()
127 return match_set(info->match_set.index, skb, par, &opt, set_match_v1()
128 info->match_set.flags & IPSET_INV_MATCH); set_match_v1()
134 struct xt_set_info_match_v1 *info = par->matchinfo; set_match_v1_checkentry() local
137 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index); set_match_v1_checkentry()
141 info->match_set.index); set_match_v1_checkentry()
144 if (info->match_set.dim > IPSET_DIM_MAX) { set_match_v1_checkentry()
146 ip_set_nfnl_put(par->net, info->match_set.index); set_match_v1_checkentry()
156 struct xt_set_info_match_v1 *info = par->matchinfo; set_match_v1_destroy() local
158 ip_set_nfnl_put(par->net, info->match_set.index); set_match_v1_destroy()
164 match_counter0(u64 counter, const struct ip_set_counter_match0 *info) match_counter0() argument
166 switch (info->op) { match_counter0()
170 return counter == info->value; match_counter0()
172 return counter != info->value; match_counter0()
174 return counter < info->value; match_counter0()
176 return counter > info->value; match_counter0()
184 const struct xt_set_info_match_v3 *info = par->matchinfo; set_match_v3() local
187 ADT_OPT(opt, par->family, info->match_set.dim, set_match_v3()
188 info->match_set.flags, info->flags, UINT_MAX); set_match_v3()
190 if (info->packets.op != IPSET_COUNTER_NONE || set_match_v3()
191 info->bytes.op != IPSET_COUNTER_NONE) set_match_v3()
194 ret = match_set(info->match_set.index, skb, par, &opt, set_match_v3()
195 info->match_set.flags & IPSET_INV_MATCH); set_match_v3()
200 if (!match_counter0(opt.ext.packets, &info->packets)) set_match_v3()
202 return match_counter0(opt.ext.bytes, &info->bytes); set_match_v3()
211 match_counter(u64 counter, const struct ip_set_counter_match *info) match_counter() argument
213 switch (info->op) { match_counter()
217 return counter == info->value; match_counter()
219 return counter != info->value; match_counter()
221 return counter < info->value; match_counter()
223 return counter > info->value; match_counter()
231 const struct xt_set_info_match_v4 *info = par->matchinfo; set_match_v4() local
234 ADT_OPT(opt, par->family, info->match_set.dim, set_match_v4()
235 info->match_set.flags, info->flags, UINT_MAX); set_match_v4()
237 if (info->packets.op != IPSET_COUNTER_NONE || set_match_v4()
238 info->bytes.op != IPSET_COUNTER_NONE) set_match_v4()
241 ret = match_set(info->match_set.index, skb, par, &opt, set_match_v4()
242 info->match_set.flags & IPSET_INV_MATCH); set_match_v4()
247 if (!match_counter(opt.ext.packets, &info->packets)) set_match_v4()
249 return match_counter(opt.ext.bytes, &info->bytes); set_match_v4()
260 const struct xt_set_info_target_v0 *info = par->targinfo; set_target_v0() local
262 ADT_OPT(add_opt, par->family, info->add_set.u.compat.dim, set_target_v0()
263 info->add_set.u.compat.flags, 0, UINT_MAX); set_target_v0()
264 ADT_OPT(del_opt, par->family, info->del_set.u.compat.dim, set_target_v0()
265 info->del_set.u.compat.flags, 0, UINT_MAX); set_target_v0()
267 if (info->add_set.index != IPSET_INVALID_ID) set_target_v0()
268 ip_set_add(info->add_set.index, skb, par, &add_opt); set_target_v0()
269 if (info->del_set.index != IPSET_INVALID_ID) set_target_v0()
270 ip_set_del(info->del_set.index, skb, par, &del_opt); set_target_v0()
278 struct xt_set_info_target_v0 *info = par->targinfo; set_target_v0_checkentry() local
281 if (info->add_set.index != IPSET_INVALID_ID) { set_target_v0_checkentry()
282 index = ip_set_nfnl_get_byindex(par->net, info->add_set.index); set_target_v0_checkentry()
285 info->add_set.index); set_target_v0_checkentry()
290 if (info->del_set.index != IPSET_INVALID_ID) { set_target_v0_checkentry()
291 index = ip_set_nfnl_get_byindex(par->net, info->del_set.index); set_target_v0_checkentry()
294 info->del_set.index); set_target_v0_checkentry()
295 if (info->add_set.index != IPSET_INVALID_ID) set_target_v0_checkentry()
296 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v0_checkentry()
300 if (info->add_set.u.flags[IPSET_DIM_MAX - 1] != 0 || set_target_v0_checkentry()
301 info->del_set.u.flags[IPSET_DIM_MAX - 1] != 0) { set_target_v0_checkentry()
303 if (info->add_set.index != IPSET_INVALID_ID) set_target_v0_checkentry()
304 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v0_checkentry()
305 if (info->del_set.index != IPSET_INVALID_ID) set_target_v0_checkentry()
306 ip_set_nfnl_put(par->net, info->del_set.index); set_target_v0_checkentry()
311 compat_flags(&info->add_set); set_target_v0_checkentry()
312 compat_flags(&info->del_set); set_target_v0_checkentry()
320 const struct xt_set_info_target_v0 *info = par->targinfo; set_target_v0_destroy() local
322 if (info->add_set.index != IPSET_INVALID_ID) set_target_v0_destroy()
323 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v0_destroy()
324 if (info->del_set.index != IPSET_INVALID_ID) set_target_v0_destroy()
325 ip_set_nfnl_put(par->net, info->del_set.index); set_target_v0_destroy()
333 const struct xt_set_info_target_v1 *info = par->targinfo; set_target_v1() local
335 ADT_OPT(add_opt, par->family, info->add_set.dim, set_target_v1()
336 info->add_set.flags, 0, UINT_MAX); set_target_v1()
337 ADT_OPT(del_opt, par->family, info->del_set.dim, set_target_v1()
338 info->del_set.flags, 0, UINT_MAX); set_target_v1()
340 if (info->add_set.index != IPSET_INVALID_ID) set_target_v1()
341 ip_set_add(info->add_set.index, skb, par, &add_opt); set_target_v1()
342 if (info->del_set.index != IPSET_INVALID_ID) set_target_v1()
343 ip_set_del(info->del_set.index, skb, par, &del_opt); set_target_v1()
351 const struct xt_set_info_target_v1 *info = par->targinfo; set_target_v1_checkentry() local
354 if (info->add_set.index != IPSET_INVALID_ID) { set_target_v1_checkentry()
355 index = ip_set_nfnl_get_byindex(par->net, info->add_set.index); set_target_v1_checkentry()
358 info->add_set.index); set_target_v1_checkentry()
363 if (info->del_set.index != IPSET_INVALID_ID) { set_target_v1_checkentry()
364 index = ip_set_nfnl_get_byindex(par->net, info->del_set.index); set_target_v1_checkentry()
367 info->del_set.index); set_target_v1_checkentry()
368 if (info->add_set.index != IPSET_INVALID_ID) set_target_v1_checkentry()
369 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v1_checkentry()
373 if (info->add_set.dim > IPSET_DIM_MAX || set_target_v1_checkentry()
374 info->del_set.dim > IPSET_DIM_MAX) { set_target_v1_checkentry()
376 if (info->add_set.index != IPSET_INVALID_ID) set_target_v1_checkentry()
377 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v1_checkentry()
378 if (info->del_set.index != IPSET_INVALID_ID) set_target_v1_checkentry()
379 ip_set_nfnl_put(par->net, info->del_set.index); set_target_v1_checkentry()
389 const struct xt_set_info_target_v1 *info = par->targinfo; set_target_v1_destroy() local
391 if (info->add_set.index != IPSET_INVALID_ID) set_target_v1_destroy()
392 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v1_destroy()
393 if (info->del_set.index != IPSET_INVALID_ID) set_target_v1_destroy()
394 ip_set_nfnl_put(par->net, info->del_set.index); set_target_v1_destroy()
402 const struct xt_set_info_target_v2 *info = par->targinfo; set_target_v2() local
404 ADT_OPT(add_opt, par->family, info->add_set.dim, set_target_v2()
405 info->add_set.flags, info->flags, info->timeout); set_target_v2()
406 ADT_OPT(del_opt, par->family, info->del_set.dim, set_target_v2()
407 info->del_set.flags, 0, UINT_MAX); set_target_v2()
413 if (info->add_set.index != IPSET_INVALID_ID) set_target_v2()
414 ip_set_add(info->add_set.index, skb, par, &add_opt); set_target_v2()
415 if (info->del_set.index != IPSET_INVALID_ID) set_target_v2()
416 ip_set_del(info->del_set.index, skb, par, &del_opt); set_target_v2()
429 const struct xt_set_info_target_v3 *info = par->targinfo; set_target_v3() local
432 ADT_OPT(add_opt, par->family, info->add_set.dim, set_target_v3()
433 info->add_set.flags, info->flags, info->timeout); set_target_v3()
434 ADT_OPT(del_opt, par->family, info->del_set.dim, set_target_v3()
435 info->del_set.flags, 0, UINT_MAX); set_target_v3()
436 ADT_OPT(map_opt, par->family, info->map_set.dim, set_target_v3()
437 info->map_set.flags, 0, UINT_MAX); set_target_v3()
443 if (info->add_set.index != IPSET_INVALID_ID) set_target_v3()
444 ip_set_add(info->add_set.index, skb, par, &add_opt); set_target_v3()
445 if (info->del_set.index != IPSET_INVALID_ID) set_target_v3()
446 ip_set_del(info->del_set.index, skb, par, &del_opt); set_target_v3()
447 if (info->map_set.index != IPSET_INVALID_ID) { set_target_v3()
448 map_opt.cmdflags |= info->flags & (IPSET_FLAG_MAP_SKBMARK | set_target_v3()
451 ret = match_set(info->map_set.index, skb, par, &map_opt, set_target_v3()
452 info->map_set.flags & IPSET_INV_MATCH); set_target_v3()
471 const struct xt_set_info_target_v3 *info = par->targinfo; set_target_v3_checkentry() local
474 if (info->add_set.index != IPSET_INVALID_ID) { set_target_v3_checkentry()
476 info->add_set.index); set_target_v3_checkentry()
479 info->add_set.index); set_target_v3_checkentry()
484 if (info->del_set.index != IPSET_INVALID_ID) { set_target_v3_checkentry()
486 info->del_set.index); set_target_v3_checkentry()
489 info->del_set.index); set_target_v3_checkentry()
490 if (info->add_set.index != IPSET_INVALID_ID) set_target_v3_checkentry()
492 info->add_set.index); set_target_v3_checkentry()
497 if (info->map_set.index != IPSET_INVALID_ID) { set_target_v3_checkentry()
502 if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) | set_target_v3_checkentry()
503 (info->flags & IPSET_FLAG_MAP_SKBQUEUE)) && set_target_v3_checkentry()
511 info->map_set.index); set_target_v3_checkentry()
514 info->map_set.index); set_target_v3_checkentry()
515 if (info->add_set.index != IPSET_INVALID_ID) set_target_v3_checkentry()
517 info->add_set.index); set_target_v3_checkentry()
518 if (info->del_set.index != IPSET_INVALID_ID) set_target_v3_checkentry()
520 info->del_set.index); set_target_v3_checkentry()
525 if (info->add_set.dim > IPSET_DIM_MAX || set_target_v3_checkentry()
526 info->del_set.dim > IPSET_DIM_MAX || set_target_v3_checkentry()
527 info->map_set.dim > IPSET_DIM_MAX) { set_target_v3_checkentry()
529 if (info->add_set.index != IPSET_INVALID_ID) set_target_v3_checkentry()
530 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v3_checkentry()
531 if (info->del_set.index != IPSET_INVALID_ID) set_target_v3_checkentry()
532 ip_set_nfnl_put(par->net, info->del_set.index); set_target_v3_checkentry()
533 if (info->map_set.index != IPSET_INVALID_ID) set_target_v3_checkentry()
534 ip_set_nfnl_put(par->net, info->map_set.index); set_target_v3_checkentry()
544 const struct xt_set_info_target_v3 *info = par->targinfo; set_target_v3_destroy() local
546 if (info->add_set.index != IPSET_INVALID_ID) set_target_v3_destroy()
547 ip_set_nfnl_put(par->net, info->add_set.index); set_target_v3_destroy()
548 if (info->del_set.index != IPSET_INVALID_ID) set_target_v3_destroy()
549 ip_set_nfnl_put(par->net, info->del_set.index); set_target_v3_destroy()
550 if (info->map_set.index != IPSET_INVALID_ID) set_target_v3_destroy()
551 ip_set_nfnl_put(par->net, info->map_set.index); set_target_v3_destroy()
H A Dxt_physdev.c28 const struct xt_physdev_info *info = par->matchinfo; physdev_mt() local
33 /* Not a bridged IP packet or no info available yet: physdev_mt()
38 if ((info->bitmask & XT_PHYSDEV_OP_BRIDGED) && physdev_mt()
39 !(info->invert & XT_PHYSDEV_OP_BRIDGED)) physdev_mt()
41 if ((info->bitmask & XT_PHYSDEV_OP_ISIN) && physdev_mt()
42 !(info->invert & XT_PHYSDEV_OP_ISIN)) physdev_mt()
44 if ((info->bitmask & XT_PHYSDEV_OP_ISOUT) && physdev_mt()
45 !(info->invert & XT_PHYSDEV_OP_ISOUT)) physdev_mt()
47 if ((info->bitmask & XT_PHYSDEV_OP_IN) && physdev_mt()
48 !(info->invert & XT_PHYSDEV_OP_IN)) physdev_mt()
50 if ((info->bitmask & XT_PHYSDEV_OP_OUT) && physdev_mt()
51 !(info->invert & XT_PHYSDEV_OP_OUT)) physdev_mt()
60 if ((info->bitmask & XT_PHYSDEV_OP_BRIDGED) && physdev_mt()
61 (!!outdev ^ !(info->invert & XT_PHYSDEV_OP_BRIDGED))) physdev_mt()
67 if ((info->bitmask & XT_PHYSDEV_OP_ISIN && physdev_mt()
68 (!indev ^ !!(info->invert & XT_PHYSDEV_OP_ISIN))) || physdev_mt()
69 (info->bitmask & XT_PHYSDEV_OP_ISOUT && physdev_mt()
70 (!outdev ^ !!(info->invert & XT_PHYSDEV_OP_ISOUT)))) physdev_mt()
73 if (!(info->bitmask & XT_PHYSDEV_OP_IN)) physdev_mt()
77 ret = ifname_compare_aligned(indev, info->physindev, physdev_mt()
78 info->in_mask); physdev_mt()
80 if (!ret ^ !(info->invert & XT_PHYSDEV_OP_IN)) physdev_mt()
85 if (!(info->bitmask & XT_PHYSDEV_OP_OUT)) physdev_mt()
91 ret = ifname_compare_aligned(outdev, info->physoutdev, info->out_mask); physdev_mt()
93 return (!!ret ^ !(info->invert & XT_PHYSDEV_OP_OUT)); physdev_mt()
98 const struct xt_physdev_info *info = par->matchinfo; physdev_mt_check() local
102 if (!(info->bitmask & XT_PHYSDEV_OP_MASK) || physdev_mt_check()
103 info->bitmask & ~XT_PHYSDEV_OP_MASK) physdev_mt_check()
105 if (info->bitmask & XT_PHYSDEV_OP_OUT && physdev_mt_check()
106 (!(info->bitmask & XT_PHYSDEV_OP_BRIDGED) || physdev_mt_check()
107 info->invert & XT_PHYSDEV_OP_BRIDGED) && physdev_mt_check()
H A Dxt_iprange.c22 const struct xt_iprange_mtinfo *info = par->matchinfo; iprange_mt4() local
26 if (info->flags & IPRANGE_SRC) { iprange_mt4()
27 m = ntohl(iph->saddr) < ntohl(info->src_min.ip); iprange_mt4()
28 m |= ntohl(iph->saddr) > ntohl(info->src_max.ip); iprange_mt4()
29 m ^= !!(info->flags & IPRANGE_SRC_INV); iprange_mt4()
33 (info->flags & IPRANGE_SRC_INV) ? "(INV) " : "", iprange_mt4()
34 &info->src_min.ip, iprange_mt4()
35 &info->src_max.ip); iprange_mt4()
39 if (info->flags & IPRANGE_DST) { iprange_mt4()
40 m = ntohl(iph->daddr) < ntohl(info->dst_min.ip); iprange_mt4()
41 m |= ntohl(iph->daddr) > ntohl(info->dst_max.ip); iprange_mt4()
42 m ^= !!(info->flags & IPRANGE_DST_INV); iprange_mt4()
46 (info->flags & IPRANGE_DST_INV) ? "(INV) " : "", iprange_mt4()
47 &info->dst_min.ip, iprange_mt4()
48 &info->dst_max.ip); iprange_mt4()
71 const struct xt_iprange_mtinfo *info = par->matchinfo; iprange_mt6() local
75 if (info->flags & IPRANGE_SRC) { iprange_mt6()
76 m = iprange_ipv6_lt(&iph->saddr, &info->src_min.in6); iprange_mt6()
77 m |= iprange_ipv6_lt(&info->src_max.in6, &iph->saddr); iprange_mt6()
78 m ^= !!(info->flags & IPRANGE_SRC_INV); iprange_mt6()
82 (info->flags & IPRANGE_SRC_INV) ? "(INV) " : "", iprange_mt6()
83 &info->src_min.in6, iprange_mt6()
84 &info->src_max.in6); iprange_mt6()
88 if (info->flags & IPRANGE_DST) { iprange_mt6()
89 m = iprange_ipv6_lt(&iph->daddr, &info->dst_min.in6); iprange_mt6()
90 m |= iprange_ipv6_lt(&info->dst_max.in6, &iph->daddr); iprange_mt6()
91 m ^= !!(info->flags & IPRANGE_DST_INV); iprange_mt6()
95 (info->flags & IPRANGE_DST_INV) ? "(INV) " : "", iprange_mt6()
96 &info->dst_min.in6, iprange_mt6()
97 &info->dst_max.in6); iprange_mt6()
H A Dxt_owner.c23 struct xt_owner_match_info *info = par->matchinfo; owner_check() local
26 if ((info->match & (XT_OWNER_UID|XT_OWNER_GID)) && owner_check()
35 const struct xt_owner_match_info *info = par->matchinfo; owner_mt() local
40 return (info->match ^ info->invert) == 0; owner_mt()
41 else if (info->match & info->invert & XT_OWNER_SOCKET) owner_mt()
50 return ((info->match ^ info->invert) & owner_mt()
53 if (info->match & XT_OWNER_UID) { owner_mt()
54 kuid_t uid_min = make_kuid(&init_user_ns, info->uid_min); owner_mt()
55 kuid_t uid_max = make_kuid(&init_user_ns, info->uid_max); owner_mt()
58 !(info->invert & XT_OWNER_UID)) owner_mt()
62 if (info->match & XT_OWNER_GID) { owner_mt()
63 kgid_t gid_min = make_kgid(&init_user_ns, info->gid_min); owner_mt()
64 kgid_t gid_max = make_kgid(&init_user_ns, info->gid_max); owner_mt()
67 !(info->invert & XT_OWNER_GID)) owner_mt()
H A Dxt_statistic.c34 const struct xt_statistic_info *info = par->matchinfo; statistic_mt() local
35 bool ret = info->flags & XT_STATISTIC_INVERT; statistic_mt()
38 switch (info->mode) { statistic_mt()
40 if ((prandom_u32() & 0x7FFFFFFF) < info->u.random.probability) statistic_mt()
45 oval = atomic_read(&info->master->count); statistic_mt()
46 nval = (oval == info->u.nth.every) ? 0 : oval + 1; statistic_mt()
47 } while (atomic_cmpxchg(&info->master->count, oval, nval) != oval); statistic_mt()
58 struct xt_statistic_info *info = par->matchinfo; statistic_mt_check() local
60 if (info->mode > XT_STATISTIC_MODE_MAX || statistic_mt_check()
61 info->flags & ~XT_STATISTIC_MASK) statistic_mt_check()
64 info->master = kzalloc(sizeof(*info->master), GFP_KERNEL); statistic_mt_check()
65 if (info->master == NULL) statistic_mt_check()
67 atomic_set(&info->master->count, info->u.nth.count); statistic_mt_check()
74 const struct xt_statistic_info *info = par->matchinfo; statistic_mt_destroy() local
76 kfree(info->master); statistic_mt_destroy()
H A Dxt_devgroup.c24 const struct xt_devgroup_info *info = par->matchinfo; devgroup_mt() local
26 if (info->flags & XT_DEVGROUP_MATCH_SRC && devgroup_mt()
27 (((info->src_group ^ par->in->group) & info->src_mask ? 1 : 0) ^ devgroup_mt()
28 ((info->flags & XT_DEVGROUP_INVERT_SRC) ? 1 : 0))) devgroup_mt()
31 if (info->flags & XT_DEVGROUP_MATCH_DST && devgroup_mt()
32 (((info->dst_group ^ par->out->group) & info->dst_mask ? 1 : 0) ^ devgroup_mt()
33 ((info->flags & XT_DEVGROUP_INVERT_DST) ? 1 : 0))) devgroup_mt()
41 const struct xt_devgroup_info *info = par->matchinfo; devgroup_mt_checkentry() local
43 if (info->flags & ~(XT_DEVGROUP_MATCH_SRC | XT_DEVGROUP_INVERT_SRC | devgroup_mt_checkentry()
47 if (info->flags & XT_DEVGROUP_MATCH_SRC && devgroup_mt_checkentry()
53 if (info->flags & XT_DEVGROUP_MATCH_DST && devgroup_mt_checkentry()
H A Dxt_IDLETIMER.c119 static int idletimer_tg_create(struct idletimer_tg_info *info) idletimer_tg_create() argument
123 info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL); idletimer_tg_create()
124 if (!info->timer) { idletimer_tg_create()
129 sysfs_attr_init(&info->timer->attr.attr); idletimer_tg_create()
130 info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL); idletimer_tg_create()
131 if (!info->timer->attr.attr.name) { idletimer_tg_create()
135 info->timer->attr.attr.mode = S_IRUGO; idletimer_tg_create()
136 info->timer->attr.show = idletimer_tg_show; idletimer_tg_create()
138 ret = sysfs_create_file(idletimer_tg_kobj, &info->timer->attr.attr); idletimer_tg_create()
144 list_add(&info->timer->entry, &idletimer_tg_list); idletimer_tg_create()
146 setup_timer(&info->timer->timer, idletimer_tg_expired, idletimer_tg_create()
147 (unsigned long) info->timer); idletimer_tg_create()
148 info->timer->refcnt = 1; idletimer_tg_create()
150 mod_timer(&info->timer->timer, idletimer_tg_create()
151 msecs_to_jiffies(info->timeout * 1000) + jiffies); idletimer_tg_create()
153 INIT_WORK(&info->timer->work, idletimer_tg_work); idletimer_tg_create()
158 kfree(info->timer->attr.attr.name); idletimer_tg_create()
160 kfree(info->timer); idletimer_tg_create()
171 const struct idletimer_tg_info *info = par->targinfo; idletimer_tg_target() local
174 info->label, info->timeout); idletimer_tg_target()
176 BUG_ON(!info->timer); idletimer_tg_target()
178 mod_timer(&info->timer->timer, idletimer_tg_target()
179 msecs_to_jiffies(info->timeout * 1000) + jiffies); idletimer_tg_target()
186 struct idletimer_tg_info *info = par->targinfo; idletimer_tg_checkentry() local
189 pr_debug("checkentry targinfo%s\n", info->label); idletimer_tg_checkentry()
191 if (info->timeout == 0) { idletimer_tg_checkentry()
196 if (info->label[0] == '\0' || idletimer_tg_checkentry()
197 strnlen(info->label, idletimer_tg_checkentry()
205 info->timer = __idletimer_tg_find_by_label(info->label); idletimer_tg_checkentry()
206 if (info->timer) { idletimer_tg_checkentry()
207 info->timer->refcnt++; idletimer_tg_checkentry()
208 mod_timer(&info->timer->timer, idletimer_tg_checkentry()
209 msecs_to_jiffies(info->timeout * 1000) + jiffies); idletimer_tg_checkentry()
212 info->label, info->timer->refcnt); idletimer_tg_checkentry()
214 ret = idletimer_tg_create(info); idletimer_tg_checkentry()
228 const struct idletimer_tg_info *info = par->targinfo; idletimer_tg_destroy() local
230 pr_debug("destroy targinfo %s\n", info->label); idletimer_tg_destroy()
234 if (--info->timer->refcnt == 0) { idletimer_tg_destroy()
235 pr_debug("deleting timer %s\n", info->label); idletimer_tg_destroy()
237 list_del(&info->timer->entry); idletimer_tg_destroy()
238 del_timer_sync(&info->timer->timer); idletimer_tg_destroy()
239 sysfs_remove_file(idletimer_tg_kobj, &info->timer->attr.attr); idletimer_tg_destroy()
240 kfree(info->timer->attr.attr.name); idletimer_tg_destroy()
241 kfree(info->timer); idletimer_tg_destroy()
244 info->label, info->timer->refcnt); idletimer_tg_destroy()
H A Dxt_dscp.c30 const struct xt_dscp_info *info = par->matchinfo; dscp_mt() local
33 return (dscp == info->dscp) ^ !!info->invert; dscp_mt()
39 const struct xt_dscp_info *info = par->matchinfo; dscp_mt6() local
42 return (dscp == info->dscp) ^ !!info->invert; dscp_mt6()
47 const struct xt_dscp_info *info = par->matchinfo; dscp_mt_check() local
49 if (info->dscp > XT_DSCP_MAX) { dscp_mt_check()
50 pr_info("dscp %x out of range\n", info->dscp); dscp_mt_check()
59 const struct xt_tos_match_info *info = par->matchinfo; tos_mt() local
62 return ((ip_hdr(skb)->tos & info->tos_mask) == tos_mt()
63 info->tos_value) ^ !!info->invert; tos_mt()
65 return ((ipv6_get_dsfield(ipv6_hdr(skb)) & info->tos_mask) == tos_mt()
66 info->tos_value) ^ !!info->invert; tos_mt()
H A Dxt_NFQUEUE.c41 const struct xt_NFQ_info_v1 *info = par->targinfo; nfqueue_tg_v1() local
42 u32 queue = info->queuenum; nfqueue_tg_v1()
44 if (info->queues_total > 1) { nfqueue_tg_v1()
45 queue = nfqueue_hash(skb, queue, info->queues_total, nfqueue_tg_v1()
54 const struct xt_NFQ_info_v2 *info = par->targinfo; nfqueue_tg_v2() local
57 if (info->bypass) nfqueue_tg_v2()
64 const struct xt_NFQ_info_v3 *info = par->targinfo; nfqueue_tg_check() local
69 if (info->queues_total == 0) { nfqueue_tg_check()
73 maxid = info->queues_total - 1 + info->queuenum; nfqueue_tg_check()
76 info->queues_total, maxid); nfqueue_tg_check()
79 if (par->target->revision == 2 && info->flags > 1) nfqueue_tg_check()
81 if (par->target->revision == 3 && info->flags & ~NFQ_FLAG_MASK) nfqueue_tg_check()
90 const struct xt_NFQ_info_v3 *info = par->targinfo; nfqueue_tg_v3() local
91 u32 queue = info->queuenum; nfqueue_tg_v3()
94 if (info->queues_total > 1) { nfqueue_tg_v3()
95 if (info->flags & NFQ_FLAG_CPU_FANOUT) { nfqueue_tg_v3()
98 queue = info->queuenum + cpu % info->queues_total; nfqueue_tg_v3()
100 queue = nfqueue_hash(skb, queue, info->queues_total, nfqueue_tg_v3()
106 if (info->flags & NFQ_FLAG_BYPASS) nfqueue_tg_v3()
H A Dxt_TEE.c7 * <delaunois@info.ucl.be>
33 const struct xt_tee_tginfo *info = par->targinfo; tee_tg4() local
34 int oif = info->priv ? info->priv->oif : 0; tee_tg4()
36 nf_dup_ipv4(par->net, skb, par->hooknum, &info->gw.in, oif); tee_tg4()
45 const struct xt_tee_tginfo *info = par->targinfo; tee_tg6() local
46 int oif = info->priv ? info->priv->oif : 0; tee_tg6()
48 nf_dup_ipv6(par->net, skb, par->hooknum, &info->gw.in6, oif); tee_tg6()
83 struct xt_tee_tginfo *info = par->targinfo; tee_tg_check() local
87 if (memcmp(&info->gw, &tee_zero_address, tee_tg_check()
91 if (info->oif[0]) { tee_tg_check()
92 if (info->oif[sizeof(info->oif)-1] != '\0') tee_tg_check()
99 priv->tginfo = info; tee_tg_check()
102 info->priv = priv; tee_tg_check()
106 info->priv = NULL; tee_tg_check()
114 struct xt_tee_tginfo *info = par->targinfo; tee_tg_destroy() local
116 if (info->priv) { tee_tg_destroy()
117 unregister_netdevice_notifier(&info->priv->notifier); tee_tg_destroy()
118 kfree(info->priv); tee_tg_destroy()
H A Dxt_HL.c32 const struct ipt_TTL_info *info = par->targinfo; ttl_tg() local
40 switch (info->mode) { ttl_tg()
42 new_ttl = info->ttl; ttl_tg()
45 new_ttl = iph->ttl + info->ttl; ttl_tg()
50 new_ttl = iph->ttl - info->ttl; ttl_tg()
72 const struct ip6t_HL_info *info = par->targinfo; hl_tg6() local
80 switch (info->mode) { hl_tg6()
82 new_hl = info->hop_limit; hl_tg6()
85 new_hl = ip6h->hop_limit + info->hop_limit; hl_tg6()
90 new_hl = ip6h->hop_limit - info->hop_limit; hl_tg6()
106 const struct ipt_TTL_info *info = par->targinfo; ttl_tg_check() local
108 if (info->mode > IPT_TTL_MAXMODE) { ttl_tg_check()
109 pr_info("TTL: invalid or unknown mode %u\n", info->mode); ttl_tg_check()
112 if (info->mode != IPT_TTL_SET && info->ttl == 0) ttl_tg_check()
119 const struct ip6t_HL_info *info = par->targinfo; hl_tg6_check() local
121 if (info->mode > IP6T_HL_MAXMODE) { hl_tg6_check()
122 pr_info("invalid or unknown mode %u\n", info->mode); hl_tg6_check()
125 if (info->mode != IP6T_HL_SET && info->hop_limit == 0) { hl_tg6_check()
H A Dxt_SECMARK.c36 const struct xt_secmark_target_info *info = par->targinfo; secmark_tg() local
38 BUG_ON(info->mode != mode); secmark_tg()
42 secmark = info->secid; secmark_tg()
52 static int checkentry_lsm(struct xt_secmark_target_info *info) checkentry_lsm() argument
56 info->secctx[SECMARK_SECCTX_MAX - 1] = '\0'; checkentry_lsm()
57 info->secid = 0; checkentry_lsm()
59 err = security_secctx_to_secid(info->secctx, strlen(info->secctx), checkentry_lsm()
60 &info->secid); checkentry_lsm()
63 pr_info("invalid security context \'%s\'\n", info->secctx); checkentry_lsm()
67 if (!info->secid) { checkentry_lsm()
68 pr_info("unable to map security context \'%s\'\n", info->secctx); checkentry_lsm()
72 err = security_secmark_relabel_packet(info->secid); checkentry_lsm()
84 struct xt_secmark_target_info *info = par->targinfo; secmark_tg_check() local
94 if (mode && mode != info->mode) { secmark_tg_check()
96 "rules for mode %hu\n", mode, info->mode); secmark_tg_check()
100 switch (info->mode) { secmark_tg_check()
104 pr_info("invalid mode: %hu\n", info->mode); secmark_tg_check()
108 err = checkentry_lsm(info); secmark_tg_check()
113 mode = info->mode; secmark_tg_check()
H A Dxt_HMARK.c62 const struct xt_hmark_info *info) hmark_swap_ports()
67 hp.b32 = (uports->b32 & info->port_mask.b32) | info->port_set.b32; hmark_swap_ports()
79 const struct xt_hmark_info *info) hmark_ct_set_htuple()
94 info->src_mask.ip6); hmark_ct_set_htuple()
96 info->dst_mask.ip6); hmark_ct_set_htuple()
98 if (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3)) hmark_ct_set_htuple()
105 hmark_swap_ports(&t->uports, info); hmark_ct_set_htuple()
117 hmark_hash(struct hmark_tuple *t, const struct xt_hmark_info *info) hmark_hash() argument
126 hash = jhash_3words(src, dst, t->uports.v32, info->hashrnd); hmark_hash()
127 hash = hash ^ (t->proto & info->proto_mask); hmark_hash()
129 return reciprocal_scale(hash, info->hmodulus) + info->hoffset; hmark_hash()
134 struct hmark_tuple *t, const struct xt_hmark_info *info) hmark_set_tuple_ports()
146 hmark_swap_ports(&t->uports, info); hmark_set_tuple_ports()
167 const struct xt_hmark_info *info) hmark_pkt_set_htuple_ipv6()
194 t->src = hmark_addr6_mask(ip6->saddr.s6_addr32, info->src_mask.ip6); hmark_pkt_set_htuple_ipv6()
195 t->dst = hmark_addr6_mask(ip6->daddr.s6_addr32, info->dst_mask.ip6); hmark_pkt_set_htuple_ipv6()
197 if (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3)) hmark_pkt_set_htuple_ipv6()
207 hmark_set_tuple_ports(skb, nhoff, t, info); hmark_pkt_set_htuple_ipv6()
214 const struct xt_hmark_info *info = par->targinfo; hmark_tg_v6() local
219 if (info->flags & XT_HMARK_FLAG(XT_HMARK_CT)) { hmark_tg_v6()
220 if (hmark_ct_set_htuple(skb, &t, info) < 0) hmark_tg_v6()
223 if (hmark_pkt_set_htuple_ipv6(skb, &t, info) < 0) hmark_tg_v6()
227 skb->mark = hmark_hash(&t, info); hmark_tg_v6()
256 const struct xt_hmark_info *info) hmark_pkt_set_htuple_ipv4()
271 t->src = ip->saddr & info->src_mask.ip; hmark_pkt_set_htuple_ipv4()
272 t->dst = ip->daddr & info->dst_mask.ip; hmark_pkt_set_htuple_ipv4()
274 if (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3)) hmark_pkt_set_htuple_ipv4()
287 hmark_set_tuple_ports(skb, (ip->ihl * 4) + nhoff, t, info); hmark_pkt_set_htuple_ipv4()
295 const struct xt_hmark_info *info = par->targinfo; hmark_tg_v4() local
300 if (info->flags & XT_HMARK_FLAG(XT_HMARK_CT)) { hmark_tg_v4()
301 if (hmark_ct_set_htuple(skb, &t, info) < 0) hmark_tg_v4()
304 if (hmark_pkt_set_htuple_ipv4(skb, &t, info) < 0) hmark_tg_v4()
308 skb->mark = hmark_hash(&t, info); hmark_tg_v4()
314 const struct xt_hmark_info *info = par->targinfo; hmark_tg_check() local
316 if (!info->hmodulus) { hmark_tg_check()
320 if (info->proto_mask && hmark_tg_check()
321 (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3))) { hmark_tg_check()
325 if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI_MASK) && hmark_tg_check()
326 (info->flags & (XT_HMARK_FLAG(XT_HMARK_SPORT_MASK) | hmark_tg_check()
331 if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI) && hmark_tg_check()
332 (info->flags & (XT_HMARK_FLAG(XT_HMARK_SPORT) | hmark_tg_check()
61 hmark_swap_ports(union hmark_ports *uports, const struct xt_hmark_info *info) hmark_swap_ports() argument
78 hmark_ct_set_htuple(const struct sk_buff *skb, struct hmark_tuple *t, const struct xt_hmark_info *info) hmark_ct_set_htuple() argument
133 hmark_set_tuple_ports(const struct sk_buff *skb, unsigned int nhoff, struct hmark_tuple *t, const struct xt_hmark_info *info) hmark_set_tuple_ports() argument
166 hmark_pkt_set_htuple_ipv6(const struct sk_buff *skb, struct hmark_tuple *t, const struct xt_hmark_info *info) hmark_pkt_set_htuple_ipv6() argument
255 hmark_pkt_set_htuple_ipv4(const struct sk_buff *skb, struct hmark_tuple *t, const struct xt_hmark_info *info) hmark_pkt_set_htuple_ipv4() argument
/linux-4.4.14/arch/sh/drivers/dma/
H A Ddma-api.c29 struct dma_info *info; get_dma_info() local
35 list_for_each_entry(info, &registered_dmac_list, list) { get_dma_info()
36 if ((chan < info->first_vchannel_nr) || get_dma_info()
37 (chan >= info->first_vchannel_nr + info->nr_channels)) get_dma_info()
40 return info; get_dma_info()
49 struct dma_info *info; get_dma_info_by_name() local
51 list_for_each_entry(info, &registered_dmac_list, list) { get_dma_info_by_name()
52 if (dmac_name && (strcmp(dmac_name, info->name) != 0)) get_dma_info_by_name()
55 return info; get_dma_info_by_name()
64 struct dma_info *info; get_nr_channels() local
70 list_for_each_entry(info, &registered_dmac_list, list) get_nr_channels()
71 nr += info->nr_channels; get_nr_channels()
78 struct dma_info *info = get_dma_info(chan); get_dma_channel() local
82 if (unlikely(!info)) get_dma_channel()
85 for (i = 0; i < info->nr_channels; i++) { get_dma_channel()
86 channel = &info->channels[i]; get_dma_channel()
97 struct dma_info *info = get_dma_info(chan); get_dma_residue() local
100 if (info->ops->get_residue) get_dma_residue()
101 return info->ops->get_residue(channel); get_dma_residue()
134 struct dma_info *info; request_dma_bycap() local
140 list_for_each_entry(info, &registered_dmac_list, list) request_dma_bycap()
141 if (strcmp(*dmac, info->name) == 0) { request_dma_bycap()
149 for (i = 0; i < info->nr_channels; i++) { request_dma_bycap()
150 struct dma_channel *channel = &info->channels[i]; request_dma_bycap()
170 struct dma_info *info = get_dma_info(0); dmac_search_free_channel() local
173 for (i = 0; i < info->nr_channels; i++) { dmac_search_free_channel()
174 channel = &info->channels[i]; dmac_search_free_channel()
182 if (info->ops->request) { dmac_search_free_channel()
183 int result = info->ops->request(channel); dmac_search_free_channel()
197 struct dma_info *info = get_dma_info(chan); request_dma() local
206 if (info->ops->request) { request_dma()
207 result = info->ops->request(channel); request_dma()
220 struct dma_info *info = get_dma_info(chan); free_dma() local
223 if (info->ops->free) free_dma()
224 info->ops->free(channel); free_dma()
232 struct dma_info *info = get_dma_info(chan); dma_wait_for_completion() local
237 (info->ops->get_residue(channel) == 0)); dma_wait_for_completion()
241 while (info->ops->get_residue(channel)) dma_wait_for_completion()
248 struct dma_info *info; register_chan_caps() local
252 list_for_each_entry(info, &registered_dmac_list, list) register_chan_caps()
253 if (strcmp(dmac, info->name) == 0) { register_chan_caps()
261 for (i = 0; i < info->nr_channels; i++, caps++) { register_chan_caps()
264 if ((info->first_channel_nr + i) != caps->ch_num) register_chan_caps()
267 channel = &info->channels[i]; register_chan_caps()
277 struct dma_info *info = get_dma_info(chan); dma_configure_channel() local
280 if (info->ops->configure) dma_configure_channel()
281 info->ops->configure(channel, flags); dma_configure_channel()
288 struct dma_info *info = get_dma_info(chan); dma_xfer() local
296 return info->ops->xfer(channel); dma_xfer()
302 struct dma_info *info = get_dma_info(chan); dma_extend() local
305 if (info->ops->extend) dma_extend()
306 return info->ops->extend(channel, op, param); dma_extend()
314 struct dma_info *info = v; dma_proc_show() local
322 list_for_each_entry(info, &registered_dmac_list, list) { dma_proc_show()
328 for (i = 0; i < info->nr_channels; i++) { dma_proc_show()
329 struct dma_channel *channel = info->channels + i; dma_proc_show()
335 info->name, channel->dev_id); dma_proc_show()
354 int register_dmac(struct dma_info *info) register_dmac() argument
358 INIT_LIST_HEAD(&info->list); register_dmac()
361 info->name, info->nr_channels, info->nr_channels > 1 ? "s" : ""); register_dmac()
363 BUG_ON((info->flags & DMAC_CHANNELS_CONFIGURED) && !info->channels); register_dmac()
365 info->pdev = platform_device_register_simple(info->name, -1, register_dmac()
367 if (IS_ERR(info->pdev)) register_dmac()
368 return PTR_ERR(info->pdev); register_dmac()
373 if (!(info->flags & DMAC_CHANNELS_CONFIGURED)) { register_dmac()
376 size = sizeof(struct dma_channel) * info->nr_channels; register_dmac()
378 info->channels = kzalloc(size, GFP_KERNEL); register_dmac()
379 if (!info->channels) register_dmac()
384 info->first_vchannel_nr = total_channels; register_dmac()
385 for (i = 0; i < info->nr_channels; i++) { register_dmac()
386 struct dma_channel *chan = &info->channels[i]; register_dmac()
390 chan->chan = info->first_channel_nr + i; register_dmac()
391 chan->vchan = info->first_channel_nr + i + total_channels; register_dmac()
395 if (info->flags & DMAC_CHANNELS_TEI_CAPABLE) register_dmac()
399 dma_create_sysfs_files(chan, info); register_dmac()
402 list_add(&info->list, &registered_dmac_list); register_dmac()
408 void unregister_dmac(struct dma_info *info) unregister_dmac() argument
412 for (i = 0; i < info->nr_channels; i++) unregister_dmac()
413 dma_remove_sysfs_files(info->channels + i, info); unregister_dmac()
415 if (!(info->flags & DMAC_CHANNELS_CONFIGURED)) unregister_dmac()
416 kfree(info->channels); unregister_dmac()
418 list_del(&info->list); unregister_dmac()
419 platform_device_unregister(info->pdev); unregister_dmac()
/linux-4.4.14/drivers/md/persistent-data/
H A Ddm-bitset.c29 struct dm_disk_bitset *info) dm_disk_bitset_init()
31 dm_array_info_init(&info->array_info, tm, &bitset_bvt); dm_disk_bitset_init()
32 info->current_index_set = false; dm_disk_bitset_init()
36 int dm_bitset_empty(struct dm_disk_bitset *info, dm_block_t *root) dm_bitset_empty() argument
38 return dm_array_empty(&info->array_info, root); dm_bitset_empty()
42 int dm_bitset_resize(struct dm_disk_bitset *info, dm_block_t root, dm_bitset_resize() argument
51 return dm_array_resize(&info->array_info, root, old_blocks, new_blocks, dm_bitset_resize()
56 int dm_bitset_del(struct dm_disk_bitset *info, dm_block_t root) dm_bitset_del() argument
58 return dm_array_del(&info->array_info, root); dm_bitset_del()
62 int dm_bitset_flush(struct dm_disk_bitset *info, dm_block_t root, dm_bitset_flush() argument
68 if (!info->current_index_set || !info->dirty) dm_bitset_flush()
71 value = cpu_to_le64(info->current_bits); dm_bitset_flush()
74 r = dm_array_set_value(&info->array_info, root, info->current_index, dm_bitset_flush()
79 info->current_index_set = false; dm_bitset_flush()
80 info->dirty = false; dm_bitset_flush()
86 static int read_bits(struct dm_disk_bitset *info, dm_block_t root, read_bits() argument
92 r = dm_array_get_value(&info->array_info, root, array_index, &value); read_bits()
96 info->current_bits = le64_to_cpu(value); read_bits()
97 info->current_index_set = true; read_bits()
98 info->current_index = array_index; read_bits()
99 info->dirty = false; read_bits()
104 static int get_array_entry(struct dm_disk_bitset *info, dm_block_t root, get_array_entry() argument
110 if (info->current_index_set) { get_array_entry()
111 if (info->current_index == array_index) get_array_entry()
114 r = dm_bitset_flush(info, root, new_root); get_array_entry()
119 return read_bits(info, root, array_index); get_array_entry()
122 int dm_bitset_set_bit(struct dm_disk_bitset *info, dm_block_t root, dm_bitset_set_bit() argument
128 r = get_array_entry(info, root, index, new_root); dm_bitset_set_bit()
132 set_bit(b, (unsigned long *) &info->current_bits); dm_bitset_set_bit()
133 info->dirty = true; dm_bitset_set_bit()
139 int dm_bitset_clear_bit(struct dm_disk_bitset *info, dm_block_t root, dm_bitset_clear_bit() argument
145 r = get_array_entry(info, root, index, new_root); dm_bitset_clear_bit()
149 clear_bit(b, (unsigned long *) &info->current_bits); dm_bitset_clear_bit()
150 info->dirty = true; dm_bitset_clear_bit()
156 int dm_bitset_test_bit(struct dm_disk_bitset *info, dm_block_t root, dm_bitset_test_bit() argument
162 r = get_array_entry(info, root, index, new_root); dm_bitset_test_bit()
166 *result = test_bit(b, (unsigned long *) &info->current_bits); dm_bitset_test_bit()
28 dm_disk_bitset_init(struct dm_transaction_manager *tm, struct dm_disk_bitset *info) dm_disk_bitset_init() argument
/linux-4.4.14/drivers/nfc/s3fwrn5/
H A Dcore.c34 static int s3fwrn5_firmware_update(struct s3fwrn5_info *info) s3fwrn5_firmware_update() argument
39 s3fwrn5_fw_init(&info->fw_info, "sec_s3fwrn5_firmware.bin"); s3fwrn5_firmware_update()
43 s3fwrn5_set_wake(info, false); s3fwrn5_firmware_update()
44 s3fwrn5_set_mode(info, S3FWRN5_MODE_FW); s3fwrn5_firmware_update()
46 ret = s3fwrn5_fw_setup(&info->fw_info); s3fwrn5_firmware_update()
50 need_update = s3fwrn5_fw_check_version(&info->fw_info, s3fwrn5_firmware_update()
51 info->ndev->manufact_specific_info); s3fwrn5_firmware_update()
55 dev_info(&info->ndev->nfc_dev->dev, "Detected new firmware version\n"); s3fwrn5_firmware_update()
57 ret = s3fwrn5_fw_download(&info->fw_info); s3fwrn5_firmware_update()
63 s3fwrn5_set_mode(info, S3FWRN5_MODE_NCI); s3fwrn5_firmware_update()
65 s3fwrn5_set_wake(info, true); s3fwrn5_firmware_update()
66 ret = s3fwrn5_nci_rf_configure(info, "sec_s3fwrn5_rfreg.bin"); s3fwrn5_firmware_update()
67 s3fwrn5_set_wake(info, false); s3fwrn5_firmware_update()
70 s3fwrn5_set_mode(info, S3FWRN5_MODE_COLD); s3fwrn5_firmware_update()
71 s3fwrn5_fw_cleanup(&info->fw_info); s3fwrn5_firmware_update()
77 struct s3fwrn5_info *info = nci_get_drvdata(ndev); s3fwrn5_nci_open() local
79 if (s3fwrn5_get_mode(info) != S3FWRN5_MODE_COLD) s3fwrn5_nci_open()
82 s3fwrn5_set_mode(info, S3FWRN5_MODE_NCI); s3fwrn5_nci_open()
83 s3fwrn5_set_wake(info, true); s3fwrn5_nci_open()
90 struct s3fwrn5_info *info = nci_get_drvdata(ndev); s3fwrn5_nci_close() local
92 s3fwrn5_set_wake(info, false); s3fwrn5_nci_close()
93 s3fwrn5_set_mode(info, S3FWRN5_MODE_COLD); s3fwrn5_nci_close()
100 struct s3fwrn5_info *info = nci_get_drvdata(ndev); s3fwrn5_nci_send() local
103 mutex_lock(&info->mutex); s3fwrn5_nci_send()
105 if (s3fwrn5_get_mode(info) != S3FWRN5_MODE_NCI) { s3fwrn5_nci_send()
106 mutex_unlock(&info->mutex); s3fwrn5_nci_send()
110 ret = s3fwrn5_write(info, skb); s3fwrn5_nci_send()
114 mutex_unlock(&info->mutex); s3fwrn5_nci_send()
120 struct s3fwrn5_info *info = nci_get_drvdata(ndev); s3fwrn5_nci_post_setup() local
123 ret = s3fwrn5_firmware_update(info); s3fwrn5_nci_post_setup()
129 s3fwrn5_set_mode(info, S3FWRN5_MODE_NCI); s3fwrn5_nci_post_setup()
130 s3fwrn5_set_wake(info, true); s3fwrn5_nci_post_setup()
132 ret = nci_core_reset(info->ndev); s3fwrn5_nci_post_setup()
136 ret = nci_core_init(info->ndev); s3fwrn5_nci_post_setup()
152 struct s3fwrn5_info *info; s3fwrn5_probe() local
155 info = devm_kzalloc(pdev, sizeof(*info), GFP_KERNEL); s3fwrn5_probe()
156 if (!info) s3fwrn5_probe()
159 info->phy_id = phy_id; s3fwrn5_probe()
160 info->pdev = pdev; s3fwrn5_probe()
161 info->phy_ops = phy_ops; s3fwrn5_probe()
162 info->max_payload = max_payload; s3fwrn5_probe()
163 mutex_init(&info->mutex); s3fwrn5_probe()
165 s3fwrn5_set_mode(info, S3FWRN5_MODE_COLD); s3fwrn5_probe()
170 info->ndev = nci_allocate_device(&s3fwrn5_nci_ops, s3fwrn5_probe()
172 if (!info->ndev) s3fwrn5_probe()
175 nci_set_parent_dev(info->ndev, pdev); s3fwrn5_probe()
176 nci_set_drvdata(info->ndev, info); s3fwrn5_probe()
178 ret = nci_register_device(info->ndev); s3fwrn5_probe()
180 nci_free_device(info->ndev); s3fwrn5_probe()
184 info->fw_info.ndev = info->ndev; s3fwrn5_probe()
186 *ndev = info->ndev; s3fwrn5_probe()
194 struct s3fwrn5_info *info = nci_get_drvdata(ndev); s3fwrn5_remove() local
196 s3fwrn5_set_mode(info, S3FWRN5_MODE_COLD); s3fwrn5_remove()
H A Ds3fwrn5.h55 static inline int s3fwrn5_set_mode(struct s3fwrn5_info *info, s3fwrn5_set_mode() argument
58 if (!info->phy_ops->set_mode) s3fwrn5_set_mode()
61 info->phy_ops->set_mode(info->phy_id, mode); s3fwrn5_set_mode()
66 static inline enum s3fwrn5_mode s3fwrn5_get_mode(struct s3fwrn5_info *info) s3fwrn5_get_mode() argument
68 if (!info->phy_ops->get_mode) s3fwrn5_get_mode()
71 return info->phy_ops->get_mode(info->phy_id); s3fwrn5_get_mode()
74 static inline int s3fwrn5_set_wake(struct s3fwrn5_info *info, bool wake) s3fwrn5_set_wake() argument
76 if (!info->phy_ops->set_wake) s3fwrn5_set_wake()
79 info->phy_ops->set_wake(info->phy_id, wake); s3fwrn5_set_wake()
84 static inline int s3fwrn5_write(struct s3fwrn5_info *info, struct sk_buff *skb) s3fwrn5_write() argument
86 if (!info->phy_ops->write) s3fwrn5_write()
89 return info->phy_ops->write(info->phy_id, skb); s3fwrn5_write()
/linux-4.4.14/drivers/scsi/arm/
H A Dfas216.c18 * FAS216_Info info;
142 static inline unsigned char fas216_readb(FAS216_Info *info, unsigned int reg) fas216_readb() argument
144 unsigned int off = reg << info->scsi.io_shift; fas216_readb()
145 return readb(info->scsi.io_base + off); fas216_readb()
148 static inline void fas216_writeb(FAS216_Info *info, unsigned int reg, unsigned int val) fas216_writeb() argument
150 unsigned int off = reg << info->scsi.io_shift; fas216_writeb()
151 writeb(val, info->scsi.io_base + off); fas216_writeb()
154 static void fas216_dumpstate(FAS216_Info *info) fas216_dumpstate() argument
158 is = fas216_readb(info, REG_IS); fas216_dumpstate()
159 stat = fas216_readb(info, REG_STAT); fas216_dumpstate()
160 inst = fas216_readb(info, REG_INST); fas216_dumpstate()
164 fas216_readb(info, REG_CTCL), fas216_dumpstate()
165 fas216_readb(info, REG_CTCM), fas216_dumpstate()
166 fas216_readb(info, REG_CMD), stat, inst, is, fas216_dumpstate()
167 fas216_readb(info, REG_CFIS)); fas216_dumpstate()
169 fas216_readb(info, REG_CNTL1), fas216_dumpstate()
170 fas216_readb(info, REG_CNTL2), fas216_dumpstate()
171 fas216_readb(info, REG_CNTL3), fas216_dumpstate()
172 fas216_readb(info, REG_CTCH)); fas216_dumpstate()
183 static void fas216_dumpinfo(FAS216_Info *info) fas216_dumpinfo() argument
193 info->magic_start, info->host, info->SCpnt, fas216_dumpinfo()
194 info->origSCpnt); fas216_dumpinfo()
196 info->scsi.io_shift, info->scsi.irq, fas216_dumpinfo()
197 info->scsi.cfg[0], info->scsi.cfg[1], info->scsi.cfg[2], fas216_dumpinfo()
198 info->scsi.cfg[3]); fas216_dumpinfo()
200 info->scsi.type, info->scsi.phase); fas216_dumpinfo()
201 print_SCp(&info->scsi.SCp, " SCp={ ", " }\n"); fas216_dumpinfo()
203 info->scsi.async_stp, fas216_dumpinfo()
204 info->scsi.disconnectable, info->scsi.aborting); fas216_dumpinfo()
207 info->stats.queues, info->stats.removes, info->stats.fins, fas216_dumpinfo()
208 info->stats.reads, info->stats.writes, info->stats.miscs, fas216_dumpinfo()
209 info->stats.disconnects, info->stats.aborts, info->stats.bus_resets, fas216_dumpinfo()
210 info->stats.host_resets); fas216_dumpinfo()
212 info->ifcfg.clockrate, info->ifcfg.select_timeout, fas216_dumpinfo()
213 info->ifcfg.asyncperiod, info->ifcfg.sync_max_depth); fas216_dumpinfo()
216 i, info->busyluns[i], i, fas216_dumpinfo()
217 info->device[i].disconnect_ok, info->device[i].stp, fas216_dumpinfo()
218 info->device[i].sof, info->device[i].sync_state); fas216_dumpinfo()
221 info->dma.transfer_type, info->dma.setup, fas216_dumpinfo()
222 info->dma.pseudo, info->dma.stop); fas216_dumpinfo()
224 info->internal_done, info->magic_end); fas216_dumpinfo()
227 static void __fas216_checkmagic(FAS216_Info *info, const char *func) __fas216_checkmagic() argument
230 if (info->magic_start != MAGIC) { __fas216_checkmagic()
234 if (info->magic_end != MAGIC) { __fas216_checkmagic()
239 fas216_dumpinfo(info); __fas216_checkmagic()
243 #define fas216_checkmagic(info) __fas216_checkmagic((info), __func__)
245 #define fas216_checkmagic(info)
260 static const char *fas216_drv_phase(FAS216_Info *info) fas216_drv_phase() argument
276 if (info->scsi.phase < ARRAY_SIZE(phases) && fas216_drv_phase()
277 phases[info->scsi.phase]) fas216_drv_phase()
278 return phases[info->scsi.phase]; fas216_drv_phase()
282 static char fas216_target(FAS216_Info *info) fas216_target() argument
284 if (info->SCpnt) fas216_target()
285 return '0' + info->SCpnt->device->id; fas216_target()
291 fas216_do_log(FAS216_Info *info, char target, char *fmt, va_list ap) fas216_do_log() argument
296 printk("scsi%d.%c: %s", info->host->host_no, target, buf); fas216_do_log()
299 static void fas216_log_command(FAS216_Info *info, int level, fas216_log_command() argument
308 fas216_do_log(info, '0' + SCpnt->device->id, fmt, args); fas216_log_command()
315 fas216_log_target(FAS216_Info *info, int level, int target, char *fmt, ...) fas216_log_target() argument
328 fas216_do_log(info, target, fmt, args); fas216_log_target()
334 static void fas216_log(FAS216_Info *info, int level, char *fmt, ...) fas216_log() argument
342 fas216_do_log(info, fas216_target(info), fmt, args); fas216_log()
366 static void fas216_cmd(FAS216_Info *info, unsigned int command) fas216_cmd() argument
373 fas216_writeb(info, REG_CMD, command); fas216_cmd()
403 static void fas216_done(FAS216_Info *info, unsigned int result);
407 * @info: interface to search
413 fas216_get_last_msg(FAS216_Info *info, int pos) fas216_get_last_msg() argument
419 while ((msg = msgqueue_getmsg(&info->scsi.msgs, msgnr++)) != NULL) { fas216_get_last_msg()
431 fas216_log(info, LOG_MESSAGES, fas216_get_last_msg()
439 * @info: state structure for interface connected to device
445 static int fas216_syncperiod(FAS216_Info *info, int ns) fas216_syncperiod() argument
447 int value = (info->ifcfg.clockrate * ns) / 1000; fas216_syncperiod()
449 fas216_checkmagic(info); fas216_syncperiod()
461 * @info: state structure for interface connected to device
469 static void fas216_set_sync(FAS216_Info *info, int target) fas216_set_sync() argument
473 fas216_writeb(info, REG_SOF, info->device[target].sof); fas216_set_sync()
474 fas216_writeb(info, REG_STP, info->device[target].stp); fas216_set_sync()
476 cntl3 = info->scsi.cfg[2]; fas216_set_sync()
477 if (info->device[target].period >= (200 / 4)) fas216_set_sync()
480 fas216_writeb(info, REG_CNTL3, cntl3); fas216_set_sync()
509 * @info: state structure for interface
514 static void fas216_handlesync(FAS216_Info *info, char *msg) fas216_handlesync() argument
516 struct fas216_device *dev = &info->device[info->SCpnt->device->id]; fas216_handlesync()
555 fas216_cmd(info, CMD_SETATN); fas216_handlesync()
556 if (msg[4] > info->ifcfg.sync_max_depth) fas216_handlesync()
557 msg[4] = info->ifcfg.sync_max_depth; fas216_handlesync()
558 if (msg[3] < 1000 / info->ifcfg.clockrate) fas216_handlesync()
559 msg[3] = 1000 / info->ifcfg.clockrate; fas216_handlesync()
561 msgqueue_flush(&info->scsi.msgs); fas216_handlesync()
562 msgqueue_addmsg(&info->scsi.msgs, 5, fas216_handlesync()
565 info->scsi.phase = PHASE_MSGOUT_EXPECT; fas216_handlesync()
582 if (msg[4] <= info->ifcfg.sync_max_depth && fas216_handlesync()
583 msg[3] >= 1000 / info->ifcfg.clockrate) { fas216_handlesync()
598 dev->stp = fas216_syncperiod(info, msg[3] * 4); fas216_handlesync()
599 fas216_set_sync(info, info->SCpnt->device->id); fas216_handlesync()
603 fas216_cmd(info, CMD_SETATN); fas216_handlesync()
604 msgqueue_flush(&info->scsi.msgs); fas216_handlesync()
605 msgqueue_addmsg(&info->scsi.msgs, 1, MESSAGE_REJECT); fas216_handlesync()
606 info->scsi.phase = PHASE_MSGOUT_EXPECT; fas216_handlesync()
609 dev->period = info->ifcfg.asyncperiod / 4; fas216_handlesync()
611 dev->stp = info->scsi.async_stp; fas216_handlesync()
612 fas216_set_sync(info, info->SCpnt->device->id); fas216_handlesync()
622 * @info: interface's local pointer to update
627 static void fas216_updateptrs(FAS216_Info *info, int bytes_transferred) fas216_updateptrs() argument
629 struct scsi_pointer *SCp = &info->scsi.SCp; fas216_updateptrs()
631 fas216_checkmagic(info); fas216_updateptrs()
647 info->host->host_no, '0' + info->SCpnt->device->id); fas216_updateptrs()
661 * @info: interface to transfer data to/from
667 static void fas216_pio(FAS216_Info *info, fasdmadir_t direction) fas216_pio() argument
669 struct scsi_pointer *SCp = &info->scsi.SCp; fas216_pio()
671 fas216_checkmagic(info); fas216_pio()
674 fas216_writeb(info, REG_FF, get_next_SCp_byte(SCp)); fas216_pio()
676 put_next_SCp_byte(SCp, fas216_readb(info, REG_FF)); fas216_pio()
682 static void fas216_set_stc(FAS216_Info *info, unsigned int length) fas216_set_stc() argument
684 fas216_writeb(info, REG_STCL, length); fas216_set_stc()
685 fas216_writeb(info, REG_STCM, length >> 8); fas216_set_stc()
686 fas216_writeb(info, REG_STCH, length >> 16); fas216_set_stc()
689 static unsigned int fas216_get_ctc(FAS216_Info *info) fas216_get_ctc() argument
691 return fas216_readb(info, REG_CTCL) + fas216_get_ctc()
692 (fas216_readb(info, REG_CTCM) << 8) + fas216_get_ctc()
693 (fas216_readb(info, REG_CTCH) << 16); fas216_get_ctc()
698 * @info: interface to clean up
703 static void fas216_cleanuptransfer(FAS216_Info *info) fas216_cleanuptransfer() argument
706 fasdmatype_t dmatype = info->dma.transfer_type; fas216_cleanuptransfer()
708 info->dma.transfer_type = fasdma_none; fas216_cleanuptransfer()
717 total = info->scsi.SCp.phase; fas216_cleanuptransfer()
719 total = info->scsi.SCp.this_residual; fas216_cleanuptransfer()
721 residual = fas216_get_ctc(info); fas216_cleanuptransfer()
723 fifo = fas216_readb(info, REG_CFIS) & CFIS_CF; fas216_cleanuptransfer()
725 fas216_log(info, LOG_BUFFER, "cleaning up from previous " fas216_cleanuptransfer()
735 if (info->scsi.phase == PHASE_DATAOUT) fas216_cleanuptransfer()
738 fas216_updateptrs(info, total - residual); fas216_cleanuptransfer()
743 * @info: interface from which device disconnected from
747 static void fas216_transfer(FAS216_Info *info) fas216_transfer() argument
752 fas216_log(info, LOG_BUFFER, fas216_transfer()
754 info->scsi.SCp.ptr, info->scsi.SCp.this_residual, fas216_transfer()
755 info->scsi.SCp.phase); fas216_transfer()
757 if (!info->scsi.SCp.ptr) { fas216_transfer()
758 fas216_log(info, LOG_ERROR, "null buffer passed to " fas216_transfer()
760 print_SCp(&info->scsi.SCp, "SCp: ", "\n"); fas216_transfer()
761 print_SCp(&info->SCpnt->SCp, "Cmnd SCp: ", "\n"); fas216_transfer()
770 if (info->device[info->SCpnt->device->id].sof) fas216_transfer()
775 if (info->scsi.phase == PHASE_DATAOUT) fas216_transfer()
780 if (info->dma.setup) fas216_transfer()
781 dmatype = info->dma.setup(info->host, &info->scsi.SCp, fas216_transfer()
783 info->dma.transfer_type = dmatype; fas216_transfer()
786 fas216_set_stc(info, info->scsi.SCp.phase); fas216_transfer()
788 fas216_set_stc(info, info->scsi.SCp.this_residual); fas216_transfer()
792 fas216_log(info, LOG_BUFFER, "PIO transfer"); fas216_transfer()
793 fas216_writeb(info, REG_SOF, 0); fas216_transfer()
794 fas216_writeb(info, REG_STP, info->scsi.async_stp); fas216_transfer()
795 fas216_cmd(info, CMD_TRANSFERINFO); fas216_transfer()
796 fas216_pio(info, direction); fas216_transfer()
800 fas216_log(info, LOG_BUFFER, "pseudo transfer"); fas216_transfer()
801 fas216_cmd(info, CMD_TRANSFERINFO | CMD_WITHDMA); fas216_transfer()
802 info->dma.pseudo(info->host, &info->scsi.SCp, fas216_transfer()
803 direction, info->SCpnt->transfersize); fas216_transfer()
807 fas216_log(info, LOG_BUFFER, "block dma transfer"); fas216_transfer()
808 fas216_cmd(info, CMD_TRANSFERINFO | CMD_WITHDMA); fas216_transfer()
812 fas216_log(info, LOG_BUFFER, "total dma transfer"); fas216_transfer()
813 fas216_cmd(info, CMD_TRANSFERINFO | CMD_WITHDMA); fas216_transfer()
817 fas216_log(info, LOG_BUFFER | LOG_ERROR, fas216_transfer()
825 * @info: interface from which device disconnected from
829 static void fas216_stoptransfer(FAS216_Info *info) fas216_stoptransfer() argument
831 fas216_checkmagic(info); fas216_stoptransfer()
833 if (info->dma.transfer_type == fasdma_real_all || fas216_stoptransfer()
834 info->dma.transfer_type == fasdma_real_block) fas216_stoptransfer()
835 info->dma.stop(info->host, &info->scsi.SCp); fas216_stoptransfer()
837 fas216_cleanuptransfer(info); fas216_stoptransfer()
839 if (info->scsi.phase == PHASE_DATAIN) { fas216_stoptransfer()
847 fifo = fas216_readb(info, REG_CFIS) & CFIS_CF; fas216_stoptransfer()
848 while (fifo && info->scsi.SCp.ptr) { fas216_stoptransfer()
849 *info->scsi.SCp.ptr = fas216_readb(info, REG_FF); fas216_stoptransfer()
850 fas216_updateptrs(info, 1); fas216_stoptransfer()
858 fas216_cmd(info, CMD_FLUSHFIFO); fas216_stoptransfer()
862 static void fas216_aborttransfer(FAS216_Info *info) fas216_aborttransfer() argument
864 fas216_checkmagic(info); fas216_aborttransfer()
866 if (info->dma.transfer_type == fasdma_real_all || fas216_aborttransfer()
867 info->dma.transfer_type == fasdma_real_block) fas216_aborttransfer()
868 info->dma.stop(info->host, &info->scsi.SCp); fas216_aborttransfer()
870 info->dma.transfer_type = fasdma_none; fas216_aborttransfer()
871 fas216_cmd(info, CMD_FLUSHFIFO); fas216_aborttransfer()
874 static void fas216_kick(FAS216_Info *info);
878 * @info: interface from which device disconnected from
882 static void fas216_disconnect_intr(FAS216_Info *info) fas216_disconnect_intr() argument
886 fas216_checkmagic(info); fas216_disconnect_intr()
888 fas216_log(info, LOG_CONNECT, "disconnect phase=%02x", fas216_disconnect_intr()
889 info->scsi.phase); fas216_disconnect_intr()
891 msgqueue_flush(&info->scsi.msgs); fas216_disconnect_intr()
893 switch (info->scsi.phase) { fas216_disconnect_intr()
896 fas216_done(info, DID_NO_CONNECT); fas216_disconnect_intr()
900 info->scsi.disconnectable = 1; fas216_disconnect_intr()
901 info->scsi.phase = PHASE_IDLE; fas216_disconnect_intr()
902 info->stats.disconnects += 1; fas216_disconnect_intr()
903 spin_lock_irqsave(&info->host_lock, flags); fas216_disconnect_intr()
904 if (info->scsi.phase == PHASE_IDLE) fas216_disconnect_intr()
905 fas216_kick(info); fas216_disconnect_intr()
906 spin_unlock_irqrestore(&info->host_lock, flags); fas216_disconnect_intr()
910 fas216_done(info, DID_OK); fas216_disconnect_intr()
914 if (fas216_get_last_msg(info, info->scsi.msgin_fifo) == ABORT) { fas216_disconnect_intr()
915 info->scsi.aborting = 0; fas216_disconnect_intr()
916 fas216_done(info, DID_ABORT); fas216_disconnect_intr()
922 info->host->host_no, fas216_target(info), fas216_drv_phase(info)); fas216_disconnect_intr()
924 fas216_stoptransfer(info); fas216_disconnect_intr()
925 fas216_done(info, DID_ERROR); fas216_disconnect_intr()
932 * @info: interface which was reselected
937 fas216_reselected_intr(FAS216_Info *info) fas216_reselected_intr() argument
943 fas216_checkmagic(info); fas216_reselected_intr()
945 WARN_ON(info->scsi.phase == PHASE_SELECTION || fas216_reselected_intr()
946 info->scsi.phase == PHASE_SELSTEPS); fas216_reselected_intr()
948 cfis = fas216_readb(info, REG_CFIS); fas216_reselected_intr()
950 fas216_log(info, LOG_CONNECT, "reconnect phase=%02x cfis=%02x", fas216_reselected_intr()
951 info->scsi.phase, cfis); fas216_reselected_intr()
957 info->host->host_no); fas216_reselected_intr()
962 msg[i] = fas216_readb(info, REG_FF); fas216_reselected_intr()
964 if (!(msg[0] & (1 << info->host->this_id)) || fas216_reselected_intr()
968 target = msg[0] & ~(1 << info->host->this_id); fas216_reselected_intr()
981 fas216_writeb(info, REG_SDID, target); fas216_reselected_intr()
982 fas216_set_sync(info, target); fas216_reselected_intr()
983 msgqueue_flush(&info->scsi.msgs); fas216_reselected_intr()
985 fas216_log(info, LOG_CONNECT, "Reconnected: target %1x lun %1x tag %02x", fas216_reselected_intr()
988 if (info->scsi.disconnectable && info->SCpnt) { fas216_reselected_intr()
989 info->scsi.disconnectable = 0; fas216_reselected_intr()
990 if (info->SCpnt->device->id == target && fas216_reselected_intr()
991 info->SCpnt->device->lun == lun && fas216_reselected_intr()
992 info->SCpnt->tag == tag) { fas216_reselected_intr()
993 fas216_log(info, LOG_CONNECT, "reconnected previously executing command"); fas216_reselected_intr()
995 queue_add_cmd_tail(&info->queues.disconnected, info->SCpnt); fas216_reselected_intr()
996 fas216_log(info, LOG_CONNECT, "had to move command to disconnected queue"); fas216_reselected_intr()
997 info->SCpnt = NULL; fas216_reselected_intr()
1000 if (!info->SCpnt) { fas216_reselected_intr()
1001 info->SCpnt = queue_remove_tgtluntag(&info->queues.disconnected, fas216_reselected_intr()
1003 fas216_log(info, LOG_CONNECT, "had to get command"); fas216_reselected_intr()
1006 if (info->SCpnt) { fas216_reselected_intr()
1010 info->scsi.SCp = info->SCpnt->SCp; fas216_reselected_intr()
1012 fas216_log(info, LOG_CONNECT, "data pointers: [%p, %X]", fas216_reselected_intr()
1013 info->scsi.SCp.ptr, info->scsi.SCp.this_residual); fas216_reselected_intr()
1014 info->scsi.phase = PHASE_MSGIN; fas216_reselected_intr()
1022 fas216_cmd(info, CMD_SETATN); fas216_reselected_intr()
1026 msgqueue_addmsg(&info->scsi.msgs, 2, ABORT_TAG, tag); fas216_reselected_intr()
1029 msgqueue_addmsg(&info->scsi.msgs, 1, ABORT); fas216_reselected_intr()
1030 info->scsi.phase = PHASE_MSGOUT_EXPECT; fas216_reselected_intr()
1031 info->scsi.aborting = 1; fas216_reselected_intr()
1034 fas216_cmd(info, CMD_MSGACCEPTED); fas216_reselected_intr()
1039 info->host->host_no); fas216_reselected_intr()
1044 fas216_cmd(info, CMD_SETATN); fas216_reselected_intr()
1045 msgqueue_flush(&info->scsi.msgs); fas216_reselected_intr()
1046 msgqueue_addmsg(&info->scsi.msgs, 1, INITIATOR_ERROR); fas216_reselected_intr()
1047 info->scsi.phase = PHASE_MSGOUT_EXPECT; fas216_reselected_intr()
1048 fas216_cmd(info, CMD_MSGACCEPTED); fas216_reselected_intr()
1051 static void fas216_parse_message(FAS216_Info *info, unsigned char *message, int msglen) fas216_parse_message() argument
1062 info->host->host_no, fas216_target(info)); fas216_parse_message()
1077 info->SCpnt->SCp = info->scsi.SCp; fas216_parse_message()
1078 info->SCpnt->SCp.sent_command = 0; fas216_parse_message()
1079 fas216_log(info, LOG_CONNECT | LOG_MESSAGES | LOG_BUFFER, fas216_parse_message()
1081 info->scsi.SCp.ptr, info->scsi.SCp.this_residual); fas216_parse_message()
1091 info->scsi.SCp = info->SCpnt->SCp; fas216_parse_message()
1092 fas216_log(info, LOG_CONNECT | LOG_MESSAGES | LOG_BUFFER, fas216_parse_message()
1094 info->scsi.SCp.ptr, info->scsi.SCp.this_residual); fas216_parse_message()
1101 info->scsi.phase = PHASE_MSGIN_DISCONNECT; fas216_parse_message()
1108 switch (fas216_get_last_msg(info, info->scsi.msgin_fifo)) { fas216_parse_message()
1110 fas216_handlesync(info, message); fas216_parse_message()
1114 fas216_log(info, 0, "reject, last message 0x%04x", fas216_parse_message()
1115 fas216_get_last_msg(info, info->scsi.msgin_fifo)); fas216_parse_message()
1128 fas216_handlesync(info, message); fas216_parse_message()
1142 fas216_log(info, 0, "unrecognised message, rejecting"); fas216_parse_message()
1143 printk("scsi%d.%c: message was", info->host->host_no, fas216_target(info)); fas216_parse_message()
1153 fas216_cmd(info, CMD_NOP); fas216_parse_message()
1154 fas216_dumpstate(info); fas216_parse_message()
1155 fas216_cmd(info, CMD_SETATN); fas216_parse_message()
1156 msgqueue_flush(&info->scsi.msgs); fas216_parse_message()
1157 msgqueue_addmsg(&info->scsi.msgs, 1, MESSAGE_REJECT); fas216_parse_message()
1158 info->scsi.phase = PHASE_MSGOUT_EXPECT; fas216_parse_message()
1159 fas216_dumpstate(info); fas216_parse_message()
1162 static int fas216_wait_cmd(FAS216_Info *info, int cmd) fas216_wait_cmd() argument
1167 fas216_cmd(info, cmd); fas216_wait_cmd()
1170 stat = fas216_readb(info, REG_STAT); fas216_wait_cmd()
1179 static int fas216_get_msg_byte(FAS216_Info *info) fas216_get_msg_byte() argument
1181 unsigned int stat = fas216_wait_cmd(info, CMD_MSGACCEPTED); fas216_get_msg_byte()
1189 fas216_readb(info, REG_INST); fas216_get_msg_byte()
1191 stat = fas216_wait_cmd(info, CMD_TRANSFERINFO); fas216_get_msg_byte()
1202 fas216_readb(info, REG_INST); fas216_get_msg_byte()
1204 return fas216_readb(info, REG_FF); fas216_get_msg_byte()
1207 fas216_log(info, LOG_ERROR, "timed out waiting for message byte"); fas216_get_msg_byte()
1211 fas216_log(info, LOG_ERROR, "unexpected phase change: status = %02x", stat); fas216_get_msg_byte()
1215 fas216_log(info, LOG_ERROR, "parity error during message in phase"); fas216_get_msg_byte()
1221 * @info: interface which caused function done interrupt
1225 static void fas216_message(FAS216_Info *info) fas216_message() argument
1227 unsigned char *message = info->scsi.message; fas216_message()
1231 fas216_checkmagic(info); fas216_message()
1233 message[0] = fas216_readb(info, REG_FF); fas216_message()
1236 msgbyte = fas216_get_msg_byte(info); fas216_message()
1242 msgbyte = fas216_get_msg_byte(info); fas216_message()
1260 info->host->host_no, fas216_target(info)); fas216_message()
1267 fas216_parse_message(info, message, msglen); fas216_message()
1268 fas216_cmd(info, CMD_MSGACCEPTED); fas216_message()
1272 fas216_cmd(info, CMD_SETATN); fas216_message()
1273 msgqueue_flush(&info->scsi.msgs); fas216_message()
1274 msgqueue_addmsg(&info->scsi.msgs, 1, MSG_PARITY_ERROR); fas216_message()
1275 info->scsi.phase = PHASE_MSGOUT_EXPECT; fas216_message()
1276 fas216_cmd(info, CMD_MSGACCEPTED); fas216_message()
1282 * @info: interface which caused bus service
1286 static void fas216_send_command(FAS216_Info *info) fas216_send_command() argument
1290 fas216_checkmagic(info); fas216_send_command()
1292 fas216_cmd(info, CMD_NOP|CMD_WITHDMA); fas216_send_command()
1293 fas216_cmd(info, CMD_FLUSHFIFO); fas216_send_command()
1296 for (i = info->scsi.SCp.sent_command; i < info->SCpnt->cmd_len; i++) fas216_send_command()
1297 fas216_writeb(info, REG_FF, info->SCpnt->cmnd[i]); fas216_send_command()
1299 fas216_cmd(info, CMD_TRANSFERINFO); fas216_send_command()
1301 info->scsi.phase = PHASE_COMMAND; fas216_send_command()
1306 * @info: interface which caused bus service
1311 static void fas216_send_messageout(FAS216_Info *info, int start) fas216_send_messageout() argument
1313 unsigned int tot_msglen = msgqueue_msglength(&info->scsi.msgs); fas216_send_messageout()
1315 fas216_checkmagic(info); fas216_send_messageout()
1317 fas216_cmd(info, CMD_FLUSHFIFO); fas216_send_messageout()
1323 while ((msg = msgqueue_getmsg(&info->scsi.msgs, msgnr++)) != NULL) { fas216_send_messageout()
1327 fas216_writeb(info, REG_FF, msg->msg[i]); fas216_send_messageout()
1329 msg->fifo = tot_msglen - (fas216_readb(info, REG_CFIS) & CFIS_CF); fas216_send_messageout()
1333 fas216_writeb(info, REG_FF, NOP); fas216_send_messageout()
1335 fas216_cmd(info, CMD_TRANSFERINFO); fas216_send_messageout()
1337 info->scsi.phase = PHASE_MSGOUT; fas216_send_messageout()
1342 * @info: interface which caused bus service interrupt
1348 static void fas216_busservice_intr(FAS216_Info *info, unsigned int stat, unsigned int is) fas216_busservice_intr() argument
1350 fas216_checkmagic(info); fas216_busservice_intr()
1352 fas216_log(info, LOG_BUSSERVICE, fas216_busservice_intr()
1354 stat, is, info->scsi.phase); fas216_busservice_intr()
1356 switch (info->scsi.phase) { fas216_busservice_intr()
1382 fas216_cmd(info, CMD_NOP); fas216_busservice_intr()
1388 switch (STATE(stat & STAT_BUSMASK, info->scsi.phase)) { fas216_busservice_intr()
1393 info->scsi.phase = PHASE_DATAIN; fas216_busservice_intr()
1394 fas216_transfer(info); fas216_busservice_intr()
1399 fas216_cleanuptransfer(info); fas216_busservice_intr()
1400 fas216_transfer(info); fas216_busservice_intr()
1407 fas216_cmd(info, CMD_FLUSHFIFO); fas216_busservice_intr()
1408 info->scsi.phase = PHASE_DATAOUT; fas216_busservice_intr()
1409 fas216_transfer(info); fas216_busservice_intr()
1414 fas216_stoptransfer(info); fas216_busservice_intr()
1419 fas216_cmd(info, CMD_INITCMDCOMPLETE); fas216_busservice_intr()
1420 info->scsi.phase = PHASE_STATUS; fas216_busservice_intr()
1425 fas216_stoptransfer(info); fas216_busservice_intr()
1429 info->scsi.msgin_fifo = fas216_readb(info, REG_CFIS) & CFIS_CF; fas216_busservice_intr()
1430 fas216_cmd(info, CMD_FLUSHFIFO); fas216_busservice_intr()
1431 fas216_cmd(info, CMD_TRANSFERINFO); fas216_busservice_intr()
1432 info->scsi.phase = PHASE_MSGIN; fas216_busservice_intr()
1436 info->scsi.msgin_fifo = fas216_readb(info, REG_CFIS) & CFIS_CF; fas216_busservice_intr()
1437 fas216_cmd(info, CMD_TRANSFERINFO); fas216_busservice_intr()
1442 fas216_send_command(info); fas216_busservice_intr()
1443 info->scsi.phase = PHASE_COMMAND; fas216_busservice_intr()
1451 fas216_send_messageout(info, 1); fas216_busservice_intr()
1465 if (info->device[info->SCpnt->device->id].parity_check) { STATE()
1470 info->device[info->SCpnt->device->id].parity_check = 0; STATE()
1471 info->device[info->SCpnt->device->id].parity_enabled = 1; STATE()
1472 fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0]); STATE()
1475 if (msgqueue_msglength(&info->scsi.msgs) > 1)
1476 fas216_cmd(info, CMD_SETATN);
1483 fas216_send_messageout(info, 0);
1499 info->host->host_no, fas216_target(info));
1500 fas216_cmd(info, CMD_SETATN);
1501 fas216_set_stc(info, 15);
1502 fas216_cmd(info, CMD_PADBYTES | CMD_WITHDMA);
1503 msgqueue_flush(&info->scsi.msgs);
1504 msgqueue_addmsg(&info->scsi.msgs, 1, INITIATOR_ERROR);
1505 info->scsi.phase = PHASE_MSGOUT_EXPECT;
1509 if (info->scsi.phase == PHASE_MSGIN_DISCONNECT) {
1511 info->host->host_no, fas216_target(info),
1513 msgqueue_flush(&info->scsi.msgs);
1514 fas216_cmd(info, CMD_SETATN);
1515 msgqueue_addmsg(&info->scsi.msgs, 1, INITIATOR_ERROR);
1516 info->scsi.phase = PHASE_MSGOUT_EXPECT;
1517 info->scsi.aborting = 1;
1518 fas216_cmd(info, CMD_TRANSFERINFO);
1522 info->host->host_no, fas216_target(info),
1524 fas216_drv_phase(info));
1529 fas216_log(info, 0, "bus service at step %d?", is & IS_BITS);
1530 fas216_dumpstate(info);
1533 fas216_done(info, DID_ERROR);
1538 * @info: interface which caused function done interrupt
1544 static void fas216_funcdone_intr(FAS216_Info *info, unsigned int stat, unsigned int is) fas216_funcdone_intr() argument
1546 unsigned int fifo_len = fas216_readb(info, REG_CFIS) & CFIS_CF; fas216_funcdone_intr()
1548 fas216_checkmagic(info); fas216_funcdone_intr()
1550 fas216_log(info, LOG_FUNCTIONDONE, fas216_funcdone_intr()
1552 stat, is, info->scsi.phase); fas216_funcdone_intr()
1554 switch (info->scsi.phase) { fas216_funcdone_intr()
1557 fas216_log(info, 0, "odd number of bytes in FIFO: %d", fifo_len); fas216_funcdone_intr()
1562 info->scsi.SCp.Status = fas216_readb(info, REG_FF); fas216_funcdone_intr()
1563 info->scsi.SCp.Message = fas216_readb(info, REG_FF); fas216_funcdone_intr()
1564 info->scsi.phase = PHASE_DONE; fas216_funcdone_intr()
1565 fas216_cmd(info, CMD_MSGACCEPTED); fas216_funcdone_intr()
1575 info->scsi.msgin_fifo = fifo_len; fas216_funcdone_intr()
1576 fas216_message(info); fas216_funcdone_intr()
1581 fas216_log(info, 0, "internal phase %s for function done?" fas216_funcdone_intr()
1583 fas216_target(info), fas216_drv_phase(info)); fas216_funcdone_intr()
1587 static void fas216_bus_reset(FAS216_Info *info) fas216_bus_reset() argument
1592 msgqueue_flush(&info->scsi.msgs); fas216_bus_reset()
1597 if (info->ifcfg.capabilities & (FASCAP_DMA|FASCAP_PSEUDODMA)) fas216_bus_reset()
1601 info->scsi.phase = PHASE_IDLE; fas216_bus_reset()
1602 info->SCpnt = NULL; /* bug! */ fas216_bus_reset()
1603 memset(&info->scsi.SCp, 0, sizeof(info->scsi.SCp)); fas216_bus_reset()
1606 info->device[i].disconnect_ok = info->ifcfg.disconnect_ok; fas216_bus_reset()
1607 info->device[i].sync_state = sync_state; fas216_bus_reset()
1608 info->device[i].period = info->ifcfg.asyncperiod / 4; fas216_bus_reset()
1609 info->device[i].stp = info->scsi.async_stp; fas216_bus_reset()
1610 info->device[i].sof = 0; fas216_bus_reset()
1611 info->device[i].wide_xfer = 0; fas216_bus_reset()
1614 info->rst_bus_status = 1; fas216_bus_reset()
1615 wake_up(&info->eh_wait); fas216_bus_reset()
1620 * @info: interface to service
1624 irqreturn_t fas216_intr(FAS216_Info *info) fas216_intr() argument
1629 fas216_checkmagic(info); fas216_intr()
1631 stat = fas216_readb(info, REG_STAT); fas216_intr()
1632 is = fas216_readb(info, REG_IS); fas216_intr()
1633 inst = fas216_readb(info, REG_INST); fas216_intr()
1635 add_debug_list(stat, is, inst, info->scsi.phase); fas216_intr()
1639 fas216_log(info, 0, "bus reset detected"); fas216_intr()
1640 fas216_bus_reset(info); fas216_intr()
1641 scsi_report_bus_reset(info->host, 0); fas216_intr()
1643 fas216_log(info, LOG_ERROR, "illegal command given\n"); fas216_intr()
1644 fas216_dumpstate(info); fas216_intr()
1647 fas216_disconnect_intr(info); fas216_intr()
1649 fas216_reselected_intr(info); fas216_intr()
1651 fas216_busservice_intr(info, stat, is); fas216_intr()
1653 fas216_funcdone_intr(info, stat, is); fas216_intr()
1655 fas216_log(info, 0, "unknown interrupt received:" fas216_intr()
1657 fas216_drv_phase(info), inst, is, stat); fas216_intr()
1663 static void __fas216_start_command(FAS216_Info *info, struct scsi_cmnd *SCpnt) __fas216_start_command() argument
1668 fas216_set_stc(info, 0); __fas216_start_command()
1669 fas216_cmd(info, CMD_NOP | CMD_WITHDMA); __fas216_start_command()
1672 fas216_cmd(info, CMD_FLUSHFIFO); __fas216_start_command()
1675 fas216_writeb(info, REG_SDID, BUSID(SCpnt->device->id)); __fas216_start_command()
1676 fas216_writeb(info, REG_STIM, info->ifcfg.select_timeout); __fas216_start_command()
1679 fas216_set_sync(info, SCpnt->device->id); __fas216_start_command()
1681 tot_msglen = msgqueue_msglength(&info->scsi.msgs); __fas216_start_command()
1689 info->host->host_no, '0' + SCpnt->device->id); __fas216_start_command()
1690 while ((msg = msgqueue_getmsg(&info->scsi.msgs, msgnr++)) != NULL) { __fas216_start_command()
1707 info->scsi.phase = PHASE_SELSTEPS; __fas216_start_command()
1710 while ((msg = msgqueue_getmsg(&info->scsi.msgs, msgnr++)) != NULL) { __fas216_start_command()
1712 fas216_writeb(info, REG_FF, msg->msg[i]); __fas216_start_command()
1713 msg->fifo = tot_msglen - (fas216_readb(info, REG_CFIS) & CFIS_CF); __fas216_start_command()
1718 fas216_writeb(info, REG_FF, SCpnt->cmnd[i]); __fas216_start_command()
1721 fas216_cmd(info, CMD_SELECTATN); __fas216_start_command()
1723 fas216_cmd(info, CMD_SELECTATN3); __fas216_start_command()
1730 struct message *msg = msgqueue_getmsg(&info->scsi.msgs, 0); __fas216_start_command()
1732 fas216_writeb(info, REG_FF, msg->msg[0]); __fas216_start_command()
1735 fas216_cmd(info, CMD_SELECTATNSTOP); __fas216_start_command()
1744 static int parity_test(FAS216_Info *info, int target) parity_test() argument
1748 info->device[target].parity_check = 0; parity_test()
1752 return info->device[target].parity_check; parity_test()
1755 static void fas216_start_command(FAS216_Info *info, struct scsi_cmnd *SCpnt) fas216_start_command() argument
1762 info->scsi.phase = PHASE_SELECTION; fas216_start_command()
1763 info->scsi.SCp = SCpnt->SCp; fas216_start_command()
1764 info->SCpnt = SCpnt; fas216_start_command()
1765 info->dma.transfer_type = fasdma_none; fas216_start_command()
1767 if (parity_test(info, SCpnt->device->id)) fas216_start_command()
1768 fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0] | CNTL1_PTE); fas216_start_command()
1770 fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0]); fas216_start_command()
1776 info->device[SCpnt->device->id].disconnect_ok; fas216_start_command()
1781 msgqueue_flush(&info->scsi.msgs); fas216_start_command()
1782 msgqueue_addmsg(&info->scsi.msgs, 1, IDENTIFY(disconnect_ok, SCpnt->device->lun)); fas216_start_command()
1788 msgqueue_addmsg(&info->scsi.msgs, 2, SIMPLE_QUEUE_TAG, SCpnt->tag); fas216_start_command()
1792 if ((info->device[SCpnt->device->id].sync_state == neg_wait || fas216_start_command()
1793 info->device[SCpnt->device->id].sync_state == neg_complete) && fas216_start_command()
1796 info->device[SCpnt->device->id].sync_state = neg_inprogress; fas216_start_command()
1797 msgqueue_addmsg(&info->scsi.msgs, 5, fas216_start_command()
1799 1000 / info->ifcfg.clockrate, fas216_start_command()
1800 info->ifcfg.sync_max_depth); fas216_start_command()
1806 __fas216_start_command(info, SCpnt); fas216_start_command()
1809 static void fas216_allocate_tag(FAS216_Info *info, struct scsi_cmnd *SCpnt) fas216_allocate_tag() argument
1824 (u8)(SCpnt->device->lun & 0x7), info->busyluns); fas216_allocate_tag()
1826 info->stats.removes += 1; fas216_allocate_tag()
1831 info->stats.writes += 1; fas216_allocate_tag()
1836 info->stats.reads += 1; fas216_allocate_tag()
1839 info->stats.miscs += 1; fas216_allocate_tag()
1844 static void fas216_do_bus_device_reset(FAS216_Info *info, fas216_do_bus_device_reset() argument
1852 info->scsi.phase = PHASE_SELECTION; fas216_do_bus_device_reset()
1853 info->scsi.SCp = SCpnt->SCp; fas216_do_bus_device_reset()
1854 info->SCpnt = SCpnt; fas216_do_bus_device_reset()
1855 info->dma.transfer_type = fasdma_none; fas216_do_bus_device_reset()
1857 fas216_log(info, LOG_ERROR, "sending bus device reset"); fas216_do_bus_device_reset()
1859 msgqueue_flush(&info->scsi.msgs); fas216_do_bus_device_reset()
1860 msgqueue_addmsg(&info->scsi.msgs, 1, BUS_DEVICE_RESET); fas216_do_bus_device_reset()
1863 fas216_set_stc(info, 0); fas216_do_bus_device_reset()
1864 fas216_cmd(info, CMD_NOP | CMD_WITHDMA); fas216_do_bus_device_reset()
1867 fas216_cmd(info, CMD_FLUSHFIFO); fas216_do_bus_device_reset()
1870 fas216_writeb(info, REG_SDID, BUSID(SCpnt->device->id)); fas216_do_bus_device_reset()
1871 fas216_writeb(info, REG_STIM, info->ifcfg.select_timeout); fas216_do_bus_device_reset()
1874 fas216_set_sync(info, SCpnt->device->id); fas216_do_bus_device_reset()
1876 msg = msgqueue_getmsg(&info->scsi.msgs, 0); fas216_do_bus_device_reset()
1878 fas216_writeb(info, REG_FF, BUS_DEVICE_RESET); fas216_do_bus_device_reset()
1881 fas216_cmd(info, CMD_SELECTATNSTOP); fas216_do_bus_device_reset()
1886 * @info: our host interface to kick
1891 static void fas216_kick(FAS216_Info *info) fas216_kick() argument
1899 fas216_checkmagic(info); fas216_kick()
1905 if (info->rstSCpnt) { fas216_kick()
1906 SCpnt = info->rstSCpnt; fas216_kick()
1912 if (info->reqSCpnt) { fas216_kick()
1913 SCpnt = info->reqSCpnt; fas216_kick()
1914 info->reqSCpnt = NULL; fas216_kick()
1918 if (info->origSCpnt) { fas216_kick()
1919 SCpnt = info->origSCpnt; fas216_kick()
1920 info->origSCpnt = NULL; fas216_kick()
1926 SCpnt = queue_remove_exclude(&info->queues.issue, fas216_kick()
1927 info->busyluns); fas216_kick()
1937 fas216_cmd(info, CMD_ENABLESEL); fas216_kick()
1944 fas216_cmd(info, CMD_DISABLESEL); fas216_kick()
1946 if (info->scsi.disconnectable && info->SCpnt) { fas216_kick()
1947 fas216_log(info, LOG_CONNECT, fas216_kick()
1949 info->SCpnt->device->id); fas216_kick()
1950 queue_add_cmd_tail(&info->queues.disconnected, info->SCpnt); fas216_kick()
1951 info->scsi.disconnectable = 0; fas216_kick()
1952 info->SCpnt = NULL; fas216_kick()
1955 fas216_log_command(info, LOG_CONNECT | LOG_MESSAGES, SCpnt, fas216_kick()
1960 fas216_allocate_tag(info, SCpnt); fas216_kick()
1962 fas216_start_command(info, SCpnt); fas216_kick()
1965 fas216_do_bus_device_reset(info, SCpnt); fas216_kick()
1969 fas216_log(info, LOG_CONNECT, "select: data pointers [%p, %X]", fas216_kick()
1970 info->scsi.SCp.ptr, info->scsi.SCp.this_residual); fas216_kick()
1981 static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, fas216_devicereset_done() argument
1984 fas216_log(info, LOG_ERROR, "fas216 device reset complete"); fas216_devicereset_done()
1986 info->rstSCpnt = NULL; fas216_devicereset_done()
1987 info->rst_dev_status = 1; fas216_devicereset_done()
1988 wake_up(&info->eh_wait); fas216_devicereset_done()
1993 * @info: interface that completed
1999 static void fas216_rq_sns_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, fas216_rq_sns_done() argument
2002 fas216_log_target(info, LOG_CONNECT, SCpnt->device->id, fas216_rq_sns_done()
2013 //printk("scsi%d.%c: sense buffer: ", info->host->host_no, '0' + SCpnt->device->id); fas216_rq_sns_done()
2021 scsi_eh_restore_cmnd(SCpnt, &info->ses); fas216_rq_sns_done()
2027 * @info: interface that completed
2034 fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) fas216_std_done() argument
2036 info->stats.fins += 1; fas216_std_done()
2038 SCpnt->result = result << 16 | info->scsi.SCp.Message << 8 | fas216_std_done()
2039 info->scsi.SCp.Status; fas216_std_done()
2041 fas216_log_command(info, LOG_CONNECT, SCpnt, fas216_std_done()
2073 if (info->scsi.SCp.ptr) { fas216_std_done()
2083 SCpnt->result, info->scsi.SCp.ptr, fas216_std_done()
2084 info->scsi.SCp.this_residual); fas216_std_done()
2098 info->host->host_no); fas216_std_done()
2105 scsi_eh_prep_cmnd(SCpnt, &info->ses, NULL, 0, ~0); fas216_std_done()
2106 fas216_log_target(info, LOG_CONNECT, SCpnt->device->id, fas216_std_done()
2119 if (info->reqSCpnt) fas216_std_done()
2121 info->host->host_no, '0' + SCpnt->device->id); fas216_std_done()
2122 info->reqSCpnt = SCpnt; fas216_std_done()
2127 * @info: interface that completed
2132 static void fas216_done(FAS216_Info *info, unsigned int result) fas216_done() argument
2138 fas216_checkmagic(info); fas216_done()
2140 if (!info->SCpnt) fas216_done()
2143 SCpnt = info->SCpnt; fas216_done()
2144 info->SCpnt = NULL; fas216_done()
2145 info->scsi.phase = PHASE_IDLE; fas216_done()
2147 if (info->scsi.aborting) { fas216_done()
2148 fas216_log(info, 0, "uncaught abort - returning DID_ABORT"); fas216_done()
2150 info->scsi.aborting = 0; fas216_done()
2157 if (info->scsi.SCp.ptr && info->scsi.SCp.this_residual == 0) { fas216_done()
2160 info->scsi.SCp.ptr, info->scsi.SCp.this_residual); fas216_done()
2161 info->scsi.SCp.ptr = NULL; fas216_done()
2170 info->device[SCpnt->device->id].parity_check = 0; fas216_done()
2172 (u8)(SCpnt->device->lun & 0x7), info->busyluns); fas216_done()
2175 fn(info, SCpnt, result); fas216_done()
2177 if (info->scsi.irq) { fas216_done()
2178 spin_lock_irqsave(&info->host_lock, flags); fas216_done()
2179 if (info->scsi.phase == PHASE_IDLE) fas216_done()
2180 fas216_kick(info); fas216_done()
2181 spin_unlock_irqrestore(&info->host_lock, flags); fas216_done()
2187 info->host->host_no); fas216_done()
2202 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; fas216_queue_command_lck() local
2205 fas216_checkmagic(info); fas216_queue_command_lck()
2207 fas216_log_command(info, LOG_CONNECT, SCpnt, fas216_queue_command_lck()
2216 info->stats.queues += 1; fas216_queue_command_lck()
2219 spin_lock(&info->host_lock); fas216_queue_command_lck()
2225 result = !queue_add_cmd_ordered(&info->queues.issue, SCpnt); fas216_queue_command_lck()
2231 if (result == 0 && info->scsi.phase == PHASE_IDLE) fas216_queue_command_lck()
2232 fas216_kick(info); fas216_queue_command_lck()
2233 spin_unlock(&info->host_lock); fas216_queue_command_lck()
2235 fas216_log_target(info, LOG_CONNECT, -1, "queue %s", fas216_queue_command_lck()
2251 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; fas216_internal_done() local
2253 fas216_checkmagic(info); fas216_internal_done()
2255 info->internal_done = 1; fas216_internal_done()
2269 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; fas216_noqueue_command_lck() local
2271 fas216_checkmagic(info); fas216_noqueue_command_lck()
2277 BUG_ON(info->scsi.irq); fas216_noqueue_command_lck()
2279 info->internal_done = 0; fas216_noqueue_command_lck()
2288 spin_unlock_irq(info->host->host_lock); fas216_noqueue_command_lck()
2290 while (!info->internal_done) { fas216_noqueue_command_lck()
2299 if (fas216_readb(info, REG_STAT) & STAT_INT) { fas216_noqueue_command_lck()
2300 spin_lock_irq(info->host->host_lock); fas216_noqueue_command_lck()
2301 fas216_intr(info); fas216_noqueue_command_lck()
2302 spin_unlock_irq(info->host->host_lock); fas216_noqueue_command_lck()
2306 spin_lock_irq(info->host->host_lock); fas216_noqueue_command_lck()
2321 FAS216_Info *info = (FAS216_Info *)data; fas216_eh_timer() local
2323 fas216_log(info, LOG_ERROR, "error handling timed out\n"); fas216_eh_timer()
2325 del_timer(&info->eh_timer); fas216_eh_timer()
2327 if (info->rst_bus_status == 0) fas216_eh_timer()
2328 info->rst_bus_status = -1; fas216_eh_timer()
2329 if (info->rst_dev_status == 0) fas216_eh_timer()
2330 info->rst_dev_status = -1; fas216_eh_timer()
2332 wake_up(&info->eh_wait); fas216_eh_timer()
2348 static enum res_find fas216_find_command(FAS216_Info *info, fas216_find_command() argument
2353 if (queue_remove_cmd(&info->queues.issue, SCpnt)) { fas216_find_command()
2363 } else if (queue_remove_cmd(&info->queues.disconnected, SCpnt)) { fas216_find_command()
2372 } else if (info->SCpnt == SCpnt) { fas216_find_command()
2375 switch (info->scsi.phase) { fas216_find_command()
2381 if (info->scsi.disconnectable) { fas216_find_command()
2382 info->scsi.disconnectable = 0; fas216_find_command()
2383 info->SCpnt = NULL; fas216_find_command()
2391 } else if (info->origSCpnt == SCpnt) { fas216_find_command()
2398 info->origSCpnt = NULL; fas216_find_command()
2400 (u8)(SCpnt->device->lun & 0x7), info->busyluns); fas216_find_command()
2419 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; fas216_eh_abort() local
2422 fas216_checkmagic(info); fas216_eh_abort()
2424 info->stats.aborts += 1; fas216_eh_abort()
2429 fas216_dumpstate(info); fas216_eh_abort()
2431 switch (fas216_find_command(info, SCpnt)) { fas216_eh_abort()
2472 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; fas216_eh_device_reset() local
2476 fas216_log(info, LOG_ERROR, "device reset for target %d", target); fas216_eh_device_reset()
2478 spin_lock_irqsave(&info->host_lock, flags); fas216_eh_device_reset()
2487 if (info->SCpnt && !info->scsi.disconnectable && fas216_eh_device_reset()
2488 info->SCpnt->device->id == SCpnt->device->id) fas216_eh_device_reset()
2497 queue_remove_all_target(&info->queues.issue, target); fas216_eh_device_reset()
2498 queue_remove_all_target(&info->queues.disconnected, target); fas216_eh_device_reset()
2499 if (info->origSCpnt && info->origSCpnt->device->id == target) fas216_eh_device_reset()
2500 info->origSCpnt = NULL; fas216_eh_device_reset()
2501 if (info->reqSCpnt && info->reqSCpnt->device->id == target) fas216_eh_device_reset()
2502 info->reqSCpnt = NULL; fas216_eh_device_reset()
2504 clear_bit(target * 8 + i, info->busyluns); fas216_eh_device_reset()
2512 info->rst_dev_status = 0; fas216_eh_device_reset()
2513 info->rstSCpnt = SCpnt; fas216_eh_device_reset()
2515 if (info->scsi.phase == PHASE_IDLE) fas216_eh_device_reset()
2516 fas216_kick(info); fas216_eh_device_reset()
2518 mod_timer(&info->eh_timer, jiffies + 30 * HZ); fas216_eh_device_reset()
2519 spin_unlock_irqrestore(&info->host_lock, flags); fas216_eh_device_reset()
2524 wait_event(info->eh_wait, info->rst_dev_status); fas216_eh_device_reset()
2526 del_timer_sync(&info->eh_timer); fas216_eh_device_reset()
2527 spin_lock_irqsave(&info->host_lock, flags); fas216_eh_device_reset()
2528 info->rstSCpnt = NULL; fas216_eh_device_reset()
2530 if (info->rst_dev_status == 1) fas216_eh_device_reset()
2535 spin_unlock_irqrestore(&info->host_lock, flags); fas216_eh_device_reset()
2537 fas216_log(info, LOG_ERROR, "device reset complete: %s\n", fas216_eh_device_reset()
2553 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; fas216_eh_bus_reset() local
2557 fas216_checkmagic(info); fas216_eh_bus_reset()
2558 fas216_log(info, LOG_ERROR, "resetting bus"); fas216_eh_bus_reset()
2560 info->stats.bus_resets += 1; fas216_eh_bus_reset()
2562 spin_lock_irqsave(&info->host_lock, flags); fas216_eh_bus_reset()
2567 fas216_aborttransfer(info); fas216_eh_bus_reset()
2568 fas216_writeb(info, REG_CNTL3, info->scsi.cfg[2]); fas216_eh_bus_reset()
2573 while (fas216_readb(info, REG_STAT) & STAT_INT) fas216_eh_bus_reset()
2574 fas216_readb(info, REG_INST); fas216_eh_bus_reset()
2576 info->rst_bus_status = 0; fas216_eh_bus_reset()
2583 shost_for_each_device(SDpnt, info->host) { fas216_eh_bus_reset()
2589 queue_remove_all_target(&info->queues.issue, SDpnt->id); fas216_eh_bus_reset()
2590 queue_remove_all_target(&info->queues.disconnected, SDpnt->id); fas216_eh_bus_reset()
2591 if (info->origSCpnt && info->origSCpnt->device->id == SDpnt->id) fas216_eh_bus_reset()
2592 info->origSCpnt = NULL; fas216_eh_bus_reset()
2593 if (info->reqSCpnt && info->reqSCpnt->device->id == SDpnt->id) fas216_eh_bus_reset()
2594 info->reqSCpnt = NULL; fas216_eh_bus_reset()
2595 info->SCpnt = NULL; fas216_eh_bus_reset()
2598 clear_bit(SDpnt->id * 8 + i, info->busyluns); fas216_eh_bus_reset()
2601 info->scsi.phase = PHASE_IDLE; fas216_eh_bus_reset()
2607 fas216_cmd(info, CMD_RESETSCSI); fas216_eh_bus_reset()
2609 mod_timer(&info->eh_timer, jiffies + HZ); fas216_eh_bus_reset()
2610 spin_unlock_irqrestore(&info->host_lock, flags); fas216_eh_bus_reset()
2615 wait_event(info->eh_wait, info->rst_bus_status); fas216_eh_bus_reset()
2616 del_timer_sync(&info->eh_timer); fas216_eh_bus_reset()
2618 fas216_log(info, LOG_ERROR, "bus reset complete: %s\n", fas216_eh_bus_reset()
2619 info->rst_bus_status == 1 ? "success" : "failed"); fas216_eh_bus_reset()
2621 return info->rst_bus_status == 1 ? SUCCESS : FAILED; fas216_eh_bus_reset()
2626 * @info: state structure for interface
2630 static void fas216_init_chip(FAS216_Info *info) fas216_init_chip() argument
2632 unsigned int clock = ((info->ifcfg.clockrate - 1) / 5 + 1) & 7; fas216_init_chip()
2633 fas216_writeb(info, REG_CLKF, clock); fas216_init_chip()
2634 fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0]); fas216_init_chip()
2635 fas216_writeb(info, REG_CNTL2, info->scsi.cfg[1]); fas216_init_chip()
2636 fas216_writeb(info, REG_CNTL3, info->scsi.cfg[2]); fas216_init_chip()
2637 fas216_writeb(info, REG_STIM, info->ifcfg.select_timeout); fas216_init_chip()
2638 fas216_writeb(info, REG_SOF, 0); fas216_init_chip()
2639 fas216_writeb(info, REG_STP, info->scsi.async_stp); fas216_init_chip()
2640 fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0]); fas216_init_chip()
2653 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; fas216_eh_host_reset() local
2655 spin_lock_irq(info->host->host_lock); fas216_eh_host_reset()
2657 fas216_checkmagic(info); fas216_eh_host_reset()
2659 fas216_log(info, LOG_ERROR, "resetting host"); fas216_eh_host_reset()
2664 fas216_cmd(info, CMD_RESETCHIP); fas216_eh_host_reset()
2672 spin_unlock_irq(info->host->host_lock); fas216_eh_host_reset()
2674 spin_lock_irq(info->host->host_lock); fas216_eh_host_reset()
2679 fas216_cmd(info, CMD_NOP); fas216_eh_host_reset()
2681 fas216_init_chip(info); fas216_eh_host_reset()
2683 spin_unlock_irq(info->host->host_lock); fas216_eh_host_reset()
2705 static int fas216_detect_type(FAS216_Info *info) fas216_detect_type() argument
2712 fas216_writeb(info, REG_CMD, CMD_RESETCHIP); fas216_detect_type()
2714 fas216_writeb(info, REG_CMD, CMD_NOP); fas216_detect_type()
2719 fas216_writeb(info, REG_CNTL3, 0); fas216_detect_type()
2720 fas216_writeb(info, REG_CNTL2, CNTL2_S2FE); fas216_detect_type()
2727 if ((fas216_readb(info, REG_CNTL2) & (~0xe0)) != CNTL2_S2FE) fas216_detect_type()
2733 fas216_writeb(info, REG_CNTL2, 0); fas216_detect_type()
2734 fas216_writeb(info, REG_CNTL3, 0); fas216_detect_type()
2735 fas216_writeb(info, REG_CNTL3, 5); fas216_detect_type()
2741 if (fas216_readb(info, REG_CNTL3) != 5) fas216_detect_type()
2747 fas216_writeb(info, REG_CNTL3, 0); fas216_detect_type()
2749 fas216_writeb(info, REG_CNTL3, CNTL3_ADIDCHK); fas216_detect_type()
2750 fas216_writeb(info, REG_CNTL3, 0); fas216_detect_type()
2752 fas216_writeb(info, REG_CMD, CMD_RESETCHIP); fas216_detect_type()
2754 fas216_writeb(info, REG_CMD, CMD_WITHDMA | CMD_NOP); fas216_detect_type()
2756 fas216_writeb(info, REG_CNTL2, CNTL2_ENF); fas216_detect_type()
2757 fas216_writeb(info, REG_CMD, CMD_RESETCHIP); fas216_detect_type()
2759 fas216_writeb(info, REG_CMD, CMD_NOP); fas216_detect_type()
2761 rev = fas216_readb(info, REG_ID); fas216_detect_type()
2789 * @info: state to initialise
2793 static void fas216_reset_state(FAS216_Info *info) fas216_reset_state() argument
2797 fas216_checkmagic(info); fas216_reset_state()
2799 fas216_bus_reset(info); fas216_reset_state()
2802 * Clear out all stale info in our state structure fas216_reset_state()
2804 memset(info->busyluns, 0, sizeof(info->busyluns)); fas216_reset_state()
2805 info->scsi.disconnectable = 0; fas216_reset_state()
2806 info->scsi.aborting = 0; fas216_reset_state()
2809 info->device[i].parity_enabled = 0; fas216_reset_state()
2810 info->device[i].parity_check = 1; fas216_reset_state()
2816 while (queue_remove(&info->queues.disconnected) != NULL); fas216_reset_state()
2821 info->SCpnt = NULL; fas216_reset_state()
2822 info->reqSCpnt = NULL; fas216_reset_state()
2823 info->rstSCpnt = NULL; fas216_reset_state()
2824 info->origSCpnt = NULL; fas216_reset_state()
2836 FAS216_Info *info = (FAS216_Info *)host->hostdata; fas216_init() local
2838 info->magic_start = MAGIC; fas216_init()
2839 info->magic_end = MAGIC; fas216_init()
2840 info->host = host; fas216_init()
2841 info->scsi.cfg[0] = host->this_id | CNTL1_PERE; fas216_init()
2842 info->scsi.cfg[1] = CNTL2_ENF | CNTL2_S2FE; fas216_init()
2843 info->scsi.cfg[2] = info->ifcfg.cntl3 | fas216_init()
2845 info->scsi.async_stp = fas216_syncperiod(info, info->ifcfg.asyncperiod); fas216_init()
2847 info->rst_dev_status = -1; fas216_init()
2848 info->rst_bus_status = -1; fas216_init()
2849 init_waitqueue_head(&info->eh_wait); fas216_init()
2850 init_timer(&info->eh_timer); fas216_init()
2851 info->eh_timer.data = (unsigned long)info; fas216_init()
2852 info->eh_timer.function = fas216_eh_timer; fas216_init()
2854 spin_lock_init(&info->host_lock); fas216_init()
2856 memset(&info->stats, 0, sizeof(info->stats)); fas216_init()
2858 msgqueue_initialise(&info->scsi.msgs); fas216_init()
2860 if (!queue_initialise(&info->queues.issue)) fas216_init()
2863 if (!queue_initialise(&info->queues.disconnected)) { fas216_init()
2864 queue_free(&info->queues.issue); fas216_init()
2881 FAS216_Info *info = (FAS216_Info *)host->hostdata; fas216_add() local
2884 if (info->ifcfg.clockrate <= 10 || info->ifcfg.clockrate > 40) { fas216_add()
2886 info->ifcfg.clockrate); fas216_add()
2890 fas216_reset_state(info); fas216_add()
2891 type = fas216_detect_type(info); fas216_add()
2892 info->scsi.type = chip_types[type]; fas216_add()
2899 fas216_init_chip(info); fas216_add()
2906 fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0] | CNTL1_DISR); fas216_add()
2907 fas216_writeb(info, REG_CMD, CMD_RESETSCSI); fas216_add()
2912 spin_unlock_irq(info->host->host_lock); fas216_add()
2914 spin_lock_irq(info->host->host_lock); fas216_add()
2916 fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0]); fas216_add()
2917 fas216_readb(info, REG_INST); fas216_add()
2919 fas216_checkmagic(info); fas216_add()
2923 fas216_writeb(info, REG_CMD, CMD_RESETCHIP); fas216_add()
2932 FAS216_Info *info = (FAS216_Info *)host->hostdata; fas216_remove() local
2934 fas216_checkmagic(info); fas216_remove()
2937 fas216_writeb(info, REG_CMD, CMD_RESETCHIP); fas216_remove()
2949 FAS216_Info *info = (FAS216_Info *)host->hostdata; fas216_release() local
2951 queue_free(&info->queues.disconnected); fas216_release()
2952 queue_free(&info->queues.issue); fas216_release()
2955 void fas216_print_host(FAS216_Info *info, struct seq_file *m) fas216_print_host() argument
2963 info->scsi.type, info->scsi.io_base, fas216_print_host()
2964 info->scsi.irq, info->scsi.dma); fas216_print_host()
2967 void fas216_print_stats(FAS216_Info *info, struct seq_file *m) fas216_print_stats() argument
2981 info->stats.queues, info->stats.removes, fas216_print_stats()
2982 info->stats.fins, info->stats.reads, fas216_print_stats()
2983 info->stats.writes, info->stats.miscs, fas216_print_stats()
2984 info->stats.disconnects, info->stats.aborts, fas216_print_stats()
2985 info->stats.bus_resets, info->stats.host_resets); fas216_print_stats()
2988 void fas216_print_devices(FAS216_Info *info, struct seq_file *m) fas216_print_devices() argument
2995 shost_for_each_device(scd, info->host) { fas216_print_devices()
2996 dev = &info->device[scd->id]; fas216_print_devices()
H A Dpowertec.c60 FAS216_Info info; member in struct:powertec_info
75 struct powertec_info *info = ec->irq_data; powertecscsi_irqenable() local
76 writeb(POWERTEC_INTR_ENABLE, info->base + POWERTEC_INTR_CONTROL); powertecscsi_irqenable()
87 struct powertec_info *info = ec->irq_data; powertecscsi_irqdisable() local
88 writeb(POWERTEC_INTR_DISABLE, info->base + POWERTEC_INTR_CONTROL); powertecscsi_irqdisable()
104 struct powertec_info *info = (struct powertec_info *)host->hostdata; powertecscsi_terminator_ctl() local
106 info->term_ctl = on_off ? POWERTEC_TERM_ENABLE : 0; powertecscsi_terminator_ctl()
107 writeb(info->term_ctl, info->base + POWERTEC_TERM_CONTROL); powertecscsi_terminator_ctl()
117 struct powertec_info *info = dev_id; powertecscsi_intr() local
119 return fas216_intr(&info->info); powertecscsi_intr()
134 struct powertec_info *info = (struct powertec_info *)host->hostdata; powertecscsi_dma_setup() local
136 int dmach = info->info.scsi.dma; powertecscsi_dma_setup()
138 if (info->info.ifcfg.capabilities & FASCAP_DMA && powertecscsi_dma_setup()
142 bufs = copy_SCp_to_sg(&info->sg[0], SCp, NR_SG); powertecscsi_dma_setup()
151 dma_map_sg(dev, info->sg, bufs, map_dir); powertecscsi_dma_setup()
154 set_dma_sg(dmach, info->sg, bufs); powertecscsi_dma_setup()
175 struct powertec_info *info = (struct powertec_info *)host->hostdata; powertecscsi_dma_stop() local
176 if (info->info.scsi.dma != NO_DMA) powertecscsi_dma_stop()
177 disable_dma(info->info.scsi.dma); powertecscsi_dma_stop()
182 * Params : host - driver host structure to return info for.
187 struct powertec_info *info = (struct powertec_info *)host->hostdata; powertecscsi_info() local
191 host->hostt->name, info->info.scsi.type, info->ec->slot_no, powertecscsi_info()
192 VERSION, info->term_ctl ? "n" : "ff"); powertecscsi_info()
242 struct powertec_info *info; powertecscsi_show_info() local
244 info = (struct powertec_info *)host->hostdata; powertecscsi_show_info()
247 fas216_print_host(&info->info, m); powertecscsi_show_info()
249 info->term_ctl ? "n" : "ff"); powertecscsi_show_info()
251 fas216_print_stats(&info->info, m); powertecscsi_show_info()
252 fas216_print_devices(&info->info, m); powertecscsi_show_info()
260 struct powertec_info *info = (struct powertec_info *)host->hostdata; powertecscsi_show_term() local
262 return sprintf(buf, "%d\n", info->term_ctl ? 1 : 0); powertecscsi_show_term()
285 .info = powertecscsi_info,
305 struct powertec_info *info; powertecscsi_probe() local
328 info = (struct powertec_info *)host->hostdata; powertecscsi_probe()
329 info->base = base; powertecscsi_probe()
332 info->ec = ec; powertecscsi_probe()
333 info->info.scsi.io_base = base + POWERTEC_FAS216_OFFSET; powertecscsi_probe()
334 info->info.scsi.io_shift = POWERTEC_FAS216_SHIFT; powertecscsi_probe()
335 info->info.scsi.irq = ec->irq; powertecscsi_probe()
336 info->info.scsi.dma = ec->dma; powertecscsi_probe()
337 info->info.ifcfg.clockrate = 40; /* MHz */ powertecscsi_probe()
338 info->info.ifcfg.select_timeout = 255; powertecscsi_probe()
339 info->info.ifcfg.asyncperiod = 200; /* ns */ powertecscsi_probe()
340 info->info.ifcfg.sync_max_depth = 7; powertecscsi_probe()
341 info->info.ifcfg.cntl3 = CNTL3_BS8 | CNTL3_FASTSCSI | CNTL3_FASTCLK; powertecscsi_probe()
342 info->info.ifcfg.disconnect_ok = 1; powertecscsi_probe()
343 info->info.ifcfg.wide_max_size = 0; powertecscsi_probe()
344 info->info.ifcfg.capabilities = 0; powertecscsi_probe()
345 info->info.dma.setup = powertecscsi_dma_setup; powertecscsi_probe()
346 info->info.dma.pseudo = NULL; powertecscsi_probe()
347 info->info.dma.stop = powertecscsi_dma_stop; powertecscsi_probe()
352 ecard_setirq(ec, &powertecscsi_ops, info); powertecscsi_probe()
361 0, "powertec", info); powertecscsi_probe()
368 if (info->info.scsi.dma != NO_DMA) { powertecscsi_probe()
369 if (request_dma(info->info.scsi.dma, "powertec")) { powertecscsi_probe()
371 host->host_no, info->info.scsi.dma); powertecscsi_probe()
372 info->info.scsi.dma = NO_DMA; powertecscsi_probe()
374 set_dma_speed(info->info.scsi.dma, 180); powertecscsi_probe()
375 info->info.ifcfg.capabilities |= FASCAP_DMA; powertecscsi_probe()
383 if (info->info.scsi.dma != NO_DMA) powertecscsi_probe()
384 free_dma(info->info.scsi.dma); powertecscsi_probe()
404 struct powertec_info *info = (struct powertec_info *)host->hostdata; powertecscsi_remove() local
411 if (info->info.scsi.dma != NO_DMA) powertecscsi_remove()
412 free_dma(info->info.scsi.dma); powertecscsi_remove()
413 free_irq(ec->irq, info); powertecscsi_remove()
H A Deesox.c72 FAS216_Info info; member in struct:eesoxscsi_info
88 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; eesoxscsi_irqenable() local
90 info->control |= EESOX_INTR_ENABLE; eesoxscsi_irqenable()
92 writeb(info->control, info->ctl_port); eesoxscsi_irqenable()
103 struct eesoxscsi_info *info = (struct eesoxscsi_info *)ec->irq_data; eesoxscsi_irqdisable() local
105 info->control &= ~EESOX_INTR_ENABLE; eesoxscsi_irqdisable()
107 writeb(info->control, info->ctl_port); eesoxscsi_irqdisable()
123 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_terminator_ctl() local
128 info->control |= EESOX_TERM_ENABLE; eesoxscsi_terminator_ctl()
130 info->control &= ~EESOX_TERM_ENABLE; eesoxscsi_terminator_ctl()
132 writeb(info->control, info->ctl_port); eesoxscsi_terminator_ctl()
144 struct eesoxscsi_info *info = dev_id; eesoxscsi_intr() local
146 return fas216_intr(&info->info); eesoxscsi_intr()
161 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_dma_setup() local
163 int dmach = info->info.scsi.dma; eesoxscsi_dma_setup()
169 bufs = copy_SCp_to_sg(&info->sg[0], SCp, NR_SG); eesoxscsi_dma_setup()
178 dma_map_sg(dev, info->sg, bufs, map_dir); eesoxscsi_dma_setup()
181 set_dma_sg(dmach, info->sg, bufs); eesoxscsi_dma_setup()
356 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_dma_pseudo() local
358 eesoxscsi_buffer_in(SCp->ptr, SCp->this_residual, info->base); eesoxscsi_dma_pseudo()
360 eesoxscsi_buffer_out(SCp->ptr, SCp->this_residual, info->base); eesoxscsi_dma_pseudo()
372 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_dma_stop() local
373 if (info->info.scsi.dma != NO_DMA) eesoxscsi_dma_stop()
374 disable_dma(info->info.scsi.dma); eesoxscsi_dma_stop()
379 * Params : host - driver host structure to return info for.
384 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_info() local
388 host->hostt->name, info->info.scsi.type, info->ec->slot_no, eesoxscsi_info()
389 VERSION, info->control & EESOX_TERM_ENABLE ? "n" : "ff"); eesoxscsi_info()
427 struct eesoxscsi_info *info; eesoxscsi_show_info() local
429 info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_show_info()
432 fas216_print_host(&info->info, m); eesoxscsi_show_info()
434 info->control & EESOX_TERM_ENABLE ? "n" : "ff"); eesoxscsi_show_info()
436 fas216_print_stats(&info->info, m); eesoxscsi_show_info()
437 fas216_print_devices(&info->info, m); eesoxscsi_show_info()
445 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_show_term() local
447 return sprintf(buf, "%d\n", info->control & EESOX_TERM_ENABLE ? 1 : 0); eesoxscsi_show_term()
454 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_store_term() local
460 info->control |= EESOX_TERM_ENABLE; eesoxscsi_store_term()
462 info->control &= ~EESOX_TERM_ENABLE; eesoxscsi_store_term()
464 writeb(info->control, info->ctl_port); eesoxscsi_store_term()
479 .info = eesoxscsi_info,
496 struct eesoxscsi_info *info; eesoxscsi_probe() local
519 info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_probe()
520 info->ec = ec; eesoxscsi_probe()
521 info->base = base; eesoxscsi_probe()
522 info->ctl_port = base + EESOX_CONTROL; eesoxscsi_probe()
523 info->control = term[ec->slot_no] ? EESOX_TERM_ENABLE : 0; eesoxscsi_probe()
524 writeb(info->control, info->ctl_port); eesoxscsi_probe()
526 info->info.scsi.io_base = base + EESOX_FAS216_OFFSET; eesoxscsi_probe()
527 info->info.scsi.io_shift = EESOX_FAS216_SHIFT; eesoxscsi_probe()
528 info->info.scsi.irq = ec->irq; eesoxscsi_probe()
529 info->info.scsi.dma = ec->dma; eesoxscsi_probe()
530 info->info.ifcfg.clockrate = 40; /* MHz */ eesoxscsi_probe()
531 info->info.ifcfg.select_timeout = 255; eesoxscsi_probe()
532 info->info.ifcfg.asyncperiod = 200; /* ns */ eesoxscsi_probe()
533 info->info.ifcfg.sync_max_depth = 7; eesoxscsi_probe()
534 info->info.ifcfg.cntl3 = CNTL3_FASTSCSI | CNTL3_FASTCLK; eesoxscsi_probe()
535 info->info.ifcfg.disconnect_ok = 1; eesoxscsi_probe()
536 info->info.ifcfg.wide_max_size = 0; eesoxscsi_probe()
537 info->info.ifcfg.capabilities = FASCAP_PSEUDODMA; eesoxscsi_probe()
538 info->info.dma.setup = eesoxscsi_dma_setup; eesoxscsi_probe()
539 info->info.dma.pseudo = eesoxscsi_dma_pseudo; eesoxscsi_probe()
540 info->info.dma.stop = eesoxscsi_dma_stop; eesoxscsi_probe()
545 ecard_setirq(ec, &eesoxscsi_ops, info); eesoxscsi_probe()
553 ret = request_irq(ec->irq, eesoxscsi_intr, 0, "eesoxscsi", info); eesoxscsi_probe()
560 if (info->info.scsi.dma != NO_DMA) { eesoxscsi_probe()
561 if (request_dma(info->info.scsi.dma, "eesox")) { eesoxscsi_probe()
563 host->host_no, info->info.scsi.dma); eesoxscsi_probe()
564 info->info.scsi.dma = NO_DMA; eesoxscsi_probe()
566 set_dma_speed(info->info.scsi.dma, 180); eesoxscsi_probe()
567 info->info.ifcfg.capabilities |= FASCAP_DMA; eesoxscsi_probe()
568 info->info.ifcfg.cntl3 |= CNTL3_BS8; eesoxscsi_probe()
576 if (info->info.scsi.dma != NO_DMA) eesoxscsi_probe()
577 free_dma(info->info.scsi.dma); eesoxscsi_probe()
597 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; eesoxscsi_remove() local
602 if (info->info.scsi.dma != NO_DMA) eesoxscsi_remove()
603 free_dma(info->info.scsi.dma); eesoxscsi_remove()
604 free_irq(ec->irq, info); eesoxscsi_remove()
H A Dcumana_2.c77 FAS216_Info info; member in struct:cumanascsi2_info
95 struct cumanascsi2_info *info = ec->irq_data; cumanascsi_2_irqenable() local
96 writeb(ALATCH_ENA_INT, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_irqenable()
107 struct cumanascsi2_info *info = ec->irq_data; cumanascsi_2_irqdisable() local
108 writeb(ALATCH_DIS_INT, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_irqdisable()
124 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; cumanascsi_2_terminator_ctl() local
127 info->terms = 1; cumanascsi_2_terminator_ctl()
128 writeb(ALATCH_ENA_TERM, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_terminator_ctl()
130 info->terms = 0; cumanascsi_2_terminator_ctl()
131 writeb(ALATCH_DIS_TERM, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_terminator_ctl()
143 struct cumanascsi2_info *info = dev_id; cumanascsi_2_intr() local
145 return fas216_intr(&info->info); cumanascsi_2_intr()
160 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; cumanascsi_2_dma_setup() local
162 int dmach = info->info.scsi.dma; cumanascsi_2_dma_setup()
164 writeb(ALATCH_DIS_DMA, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_dma_setup()
170 bufs = copy_SCp_to_sg(&info->sg[0], SCp, NR_SG); cumanascsi_2_dma_setup()
181 dma_map_sg(dev, info->sg, bufs, map_dir); cumanascsi_2_dma_setup()
184 set_dma_sg(dmach, info->sg, bufs); cumanascsi_2_dma_setup()
185 writeb(alatch_dir, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_dma_setup()
188 writeb(ALATCH_ENA_DMA, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_dma_setup()
189 writeb(ALATCH_DIS_BIT32, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_dma_setup()
212 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; cumanascsi_2_dma_pseudo() local
223 unsigned int status = readb(info->base + CUMANASCSI2_STATUS); cumanascsi_2_dma_pseudo()
232 writew(word, info->base + CUMANASCSI2_PSEUDODMA); cumanascsi_2_dma_pseudo()
242 unsigned int status = readb(info->base + CUMANASCSI2_STATUS); cumanascsi_2_dma_pseudo()
250 readsw(info->base + CUMANASCSI2_PSEUDODMA, cumanascsi_2_dma_pseudo()
259 unsigned int status = readb(info->base + CUMANASCSI2_STATUS); cumanascsi_2_dma_pseudo()
267 word = readw(info->base + CUMANASCSI2_PSEUDODMA); cumanascsi_2_dma_pseudo()
285 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; cumanascsi_2_dma_stop() local
286 if (info->info.scsi.dma != NO_DMA) { cumanascsi_2_dma_stop()
287 writeb(ALATCH_DIS_DMA, info->base + CUMANASCSI2_ALATCH); cumanascsi_2_dma_stop()
288 disable_dma(info->info.scsi.dma); cumanascsi_2_dma_stop()
294 * Params : host - driver host structure to return info for.
299 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; cumanascsi_2_info() local
303 host->hostt->name, info->info.scsi.type, info->ec->slot_no, cumanascsi_2_info()
304 VERSION, info->terms ? "n" : "ff"); cumanascsi_2_info()
342 struct cumanascsi2_info *info; cumanascsi_2_show_info() local
343 info = (struct cumanascsi2_info *)host->hostdata; cumanascsi_2_show_info()
346 fas216_print_host(&info->info, m); cumanascsi_2_show_info()
348 info->terms ? "n" : "ff"); cumanascsi_2_show_info()
350 fas216_print_stats(&info->info, m); cumanascsi_2_show_info()
351 fas216_print_devices(&info->info, m); cumanascsi_2_show_info()
360 .info = cumanascsi_2_info,
378 struct cumanascsi2_info *info; cumanascsi2_probe() local
401 info = (struct cumanascsi2_info *)host->hostdata; cumanascsi2_probe()
402 info->ec = ec; cumanascsi2_probe()
403 info->base = base; cumanascsi2_probe()
407 info->info.scsi.io_base = base + CUMANASCSI2_FAS216_OFFSET; cumanascsi2_probe()
408 info->info.scsi.io_shift = CUMANASCSI2_FAS216_SHIFT; cumanascsi2_probe()
409 info->info.scsi.irq = ec->irq; cumanascsi2_probe()
410 info->info.scsi.dma = ec->dma; cumanascsi2_probe()
411 info->info.ifcfg.clockrate = 40; /* MHz */ cumanascsi2_probe()
412 info->info.ifcfg.select_timeout = 255; cumanascsi2_probe()
413 info->info.ifcfg.asyncperiod = 200; /* ns */ cumanascsi2_probe()
414 info->info.ifcfg.sync_max_depth = 7; cumanascsi2_probe()
415 info->info.ifcfg.cntl3 = CNTL3_BS8 | CNTL3_FASTSCSI | CNTL3_FASTCLK; cumanascsi2_probe()
416 info->info.ifcfg.disconnect_ok = 1; cumanascsi2_probe()
417 info->info.ifcfg.wide_max_size = 0; cumanascsi2_probe()
418 info->info.ifcfg.capabilities = FASCAP_PSEUDODMA; cumanascsi2_probe()
419 info->info.dma.setup = cumanascsi_2_dma_setup; cumanascsi2_probe()
420 info->info.dma.pseudo = cumanascsi_2_dma_pseudo; cumanascsi2_probe()
421 info->info.dma.stop = cumanascsi_2_dma_stop; cumanascsi2_probe()
423 ec->irqaddr = info->base + CUMANASCSI2_STATUS; cumanascsi2_probe()
426 ecard_setirq(ec, &cumanascsi_2_ops, info); cumanascsi2_probe()
433 0, "cumanascsi2", info); cumanascsi2_probe()
440 if (info->info.scsi.dma != NO_DMA) { cumanascsi2_probe()
441 if (request_dma(info->info.scsi.dma, "cumanascsi2")) { cumanascsi2_probe()
443 host->host_no, info->info.scsi.dma); cumanascsi2_probe()
444 info->info.scsi.dma = NO_DMA; cumanascsi2_probe()
446 set_dma_speed(info->info.scsi.dma, 180); cumanascsi2_probe()
447 info->info.ifcfg.capabilities |= FASCAP_DMA; cumanascsi2_probe()
455 if (info->info.scsi.dma != NO_DMA) cumanascsi2_probe()
456 free_dma(info->info.scsi.dma); cumanascsi2_probe()
475 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; cumanascsi2_remove() local
480 if (info->info.scsi.dma != NO_DMA) cumanascsi2_remove()
481 free_dma(info->info.scsi.dma); cumanascsi2_remove()
482 free_irq(ec->irq, info); cumanascsi2_remove()
H A Darxescsi.c42 FAS216_Info info; member in struct:arxescsi_info
63 * Returns : 0 if we should not set CMD_WITHDMA for transfer info command
115 struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata; arxescsi_dma_pseudo() local
117 void __iomem *base = info->info.scsi.io_base; arxescsi_dma_pseudo()
208 * Params : host - driver host structure to return info for.
213 struct arxescsi_info *info = (struct arxescsi_info *)host->hostdata; arxescsi_info() local
217 host->hostt->name, info->info.scsi.type, info->ec->slot_no, arxescsi_info()
226 struct arxescsi_info *info; arxescsi_show_info() local
227 info = (struct arxescsi_info *)host->hostdata; arxescsi_show_info()
230 fas216_print_host(&info->info, m); arxescsi_show_info()
231 fas216_print_stats(&info->info, m); arxescsi_show_info()
232 fas216_print_devices(&info->info, m); arxescsi_show_info()
239 .info = arxescsi_info,
255 struct arxescsi_info *info; arxescsi_probe() local
275 info = (struct arxescsi_info *)host->hostdata; arxescsi_probe()
276 info->ec = ec; arxescsi_probe()
277 info->base = base; arxescsi_probe()
279 info->info.scsi.io_base = base + 0x2000; arxescsi_probe()
280 info->info.scsi.irq = 0; arxescsi_probe()
281 info->info.scsi.dma = NO_DMA; arxescsi_probe()
282 info->info.scsi.io_shift = 5; arxescsi_probe()
283 info->info.ifcfg.clockrate = 24; /* MHz */ arxescsi_probe()
284 info->info.ifcfg.select_timeout = 255; arxescsi_probe()
285 info->info.ifcfg.asyncperiod = 200; /* ns */ arxescsi_probe()
286 info->info.ifcfg.sync_max_depth = 0; arxescsi_probe()
287 info->info.ifcfg.cntl3 = CNTL3_FASTSCSI | CNTL3_FASTCLK; arxescsi_probe()
288 info->info.ifcfg.disconnect_ok = 0; arxescsi_probe()
289 info->info.ifcfg.wide_max_size = 0; arxescsi_probe()
290 info->info.ifcfg.capabilities = FASCAP_PSEUDODMA; arxescsi_probe()
291 info->info.dma.setup = arxescsi_dma_setup; arxescsi_probe()
292 info->info.dma.pseudo = arxescsi_dma_pseudo; arxescsi_probe()
293 info->info.dma.stop = arxescsi_dma_stop; arxescsi_probe()
/linux-4.4.14/drivers/mtd/nand/
H A Dpxa3xx_nand.c139 #define nand_writel(info, off, val) \
140 writel_relaxed((val), (info)->mmio_base + (off))
142 #define nand_readl(info, off) \
143 readl_relaxed((info)->mmio_base + (off))
391 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_set_timing() local
392 unsigned long nand_clk = clk_get_rate(info->clk); pxa3xx_nand_set_timing()
406 info->ndtr0cs0 = ndtr0; pxa3xx_nand_set_timing()
407 info->ndtr1cs0 = ndtr1; pxa3xx_nand_set_timing()
408 nand_writel(info, NDTR0CS0, ndtr0); pxa3xx_nand_set_timing()
409 nand_writel(info, NDTR1CS0, ndtr1); pxa3xx_nand_set_timing()
415 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_set_sdr_timing() local
417 unsigned long nand_clk = clk_get_rate(info->clk); pxa3xx_nand_set_sdr_timing()
445 info->ndtr0cs0 = ndtr0; pxa3xx_nand_set_sdr_timing()
446 info->ndtr1cs0 = ndtr1; pxa3xx_nand_set_sdr_timing()
447 nand_writel(info, NDTR0CS0, ndtr0); pxa3xx_nand_set_sdr_timing()
448 nand_writel(info, NDTR1CS0, ndtr1); pxa3xx_nand_set_sdr_timing()
456 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_init_timings_compat() local
475 dev_err(&info->pdev->dev, "Error: timings not found\n"); pxa3xx_nand_init_timings_compat()
508 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_init() local
520 info->reg_ndcr |= NDCR_DWIDTH_M; pxa3xx_nand_init()
524 info->reg_ndcr |= (dfc_width == 16) ? NDCR_DWIDTH_C : 0; pxa3xx_nand_init()
539 static void pxa3xx_set_datasize(struct pxa3xx_nand_info *info, pxa3xx_set_datasize() argument
542 int oob_enable = info->reg_ndcr & NDCR_SPARE_EN; pxa3xx_set_datasize()
544 info->data_size = mtd->writesize; pxa3xx_set_datasize()
548 info->oob_size = info->spare_size; pxa3xx_set_datasize()
549 if (!info->use_ecc) pxa3xx_set_datasize()
550 info->oob_size += info->ecc_size; pxa3xx_set_datasize()
559 static void pxa3xx_nand_start(struct pxa3xx_nand_info *info) pxa3xx_nand_start() argument
563 ndcr = info->reg_ndcr; pxa3xx_nand_start()
565 if (info->use_ecc) { pxa3xx_nand_start()
567 if (info->ecc_bch) pxa3xx_nand_start()
568 nand_writel(info, NDECCCTRL, 0x1); pxa3xx_nand_start()
571 if (info->ecc_bch) pxa3xx_nand_start()
572 nand_writel(info, NDECCCTRL, 0x0); pxa3xx_nand_start()
575 if (info->use_dma) pxa3xx_nand_start()
580 if (info->use_spare) pxa3xx_nand_start()
588 nand_writel(info, NDSR, NDSR_MASK); pxa3xx_nand_start()
589 nand_writel(info, NDCR, 0); pxa3xx_nand_start()
590 nand_writel(info, NDCR, ndcr); pxa3xx_nand_start()
593 static void pxa3xx_nand_stop(struct pxa3xx_nand_info *info) pxa3xx_nand_stop() argument
599 ndcr = nand_readl(info, NDCR); pxa3xx_nand_stop()
601 ndcr = nand_readl(info, NDCR); pxa3xx_nand_stop()
607 nand_writel(info, NDCR, ndcr); pxa3xx_nand_stop()
609 if (info->dma_chan) pxa3xx_nand_stop()
610 dmaengine_terminate_all(info->dma_chan); pxa3xx_nand_stop()
613 nand_writel(info, NDSR, NDSR_MASK); pxa3xx_nand_stop()
617 enable_int(struct pxa3xx_nand_info *info, uint32_t int_mask) enable_int() argument
621 ndcr = nand_readl(info, NDCR); enable_int()
622 nand_writel(info, NDCR, ndcr & ~int_mask); enable_int()
625 static void disable_int(struct pxa3xx_nand_info *info, uint32_t int_mask) disable_int() argument
629 ndcr = nand_readl(info, NDCR); disable_int()
630 nand_writel(info, NDCR, ndcr | int_mask); disable_int()
633 static void drain_fifo(struct pxa3xx_nand_info *info, void *data, int len) drain_fifo() argument
635 if (info->ecc_bch) { drain_fifo()
648 ioread32_rep(info->mmio_base + NDDB, data, 8); drain_fifo()
650 ret = readl_relaxed_poll_timeout(info->mmio_base + NDSR, val, drain_fifo()
653 dev_err(&info->pdev->dev, drain_fifo()
663 ioread32_rep(info->mmio_base + NDDB, data, len); drain_fifo()
666 static void handle_data_pio(struct pxa3xx_nand_info *info) handle_data_pio() argument
668 unsigned int do_bytes = min(info->data_size, info->chunk_size); handle_data_pio()
670 switch (info->state) { handle_data_pio()
672 writesl(info->mmio_base + NDDB, handle_data_pio()
673 info->data_buff + info->data_buff_pos, handle_data_pio()
676 if (info->oob_size > 0) handle_data_pio()
677 writesl(info->mmio_base + NDDB, handle_data_pio()
678 info->oob_buff + info->oob_buff_pos, handle_data_pio()
679 DIV_ROUND_UP(info->oob_size, 4)); handle_data_pio()
682 drain_fifo(info, handle_data_pio()
683 info->data_buff + info->data_buff_pos, handle_data_pio()
686 if (info->oob_size > 0) handle_data_pio()
687 drain_fifo(info, handle_data_pio()
688 info->oob_buff + info->oob_buff_pos, handle_data_pio()
689 DIV_ROUND_UP(info->oob_size, 4)); handle_data_pio()
692 dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__, handle_data_pio()
693 info->state); handle_data_pio()
698 info->data_buff_pos += do_bytes; handle_data_pio()
699 info->oob_buff_pos += info->oob_size; handle_data_pio()
700 info->data_size -= do_bytes; handle_data_pio()
705 struct pxa3xx_nand_info *info = data; pxa3xx_nand_data_dma_irq() local
709 status = dmaengine_tx_status(info->dma_chan, info->dma_cookie, &state); pxa3xx_nand_data_dma_irq()
711 info->state = STATE_DMA_DONE; pxa3xx_nand_data_dma_irq()
713 dev_err(&info->pdev->dev, "DMA error on data channel\n"); pxa3xx_nand_data_dma_irq()
714 info->retcode = ERR_DMABUSERR; pxa3xx_nand_data_dma_irq()
716 dma_unmap_sg(info->dma_chan->device->dev, &info->sg, 1, info->dma_dir); pxa3xx_nand_data_dma_irq()
718 nand_writel(info, NDSR, NDSR_WRDREQ | NDSR_RDDREQ); pxa3xx_nand_data_dma_irq()
719 enable_int(info, NDCR_INT_MASK); pxa3xx_nand_data_dma_irq()
722 static void start_data_dma(struct pxa3xx_nand_info *info) start_data_dma() argument
727 switch (info->state) { start_data_dma()
729 info->dma_dir = DMA_TO_DEVICE; start_data_dma()
733 info->dma_dir = DMA_FROM_DEVICE; start_data_dma()
737 dev_err(&info->pdev->dev, "%s: invalid state %d\n", __func__, start_data_dma()
738 info->state); start_data_dma()
741 info->sg.length = info->data_size + start_data_dma()
742 (info->oob_size ? info->spare_size + info->ecc_size : 0); start_data_dma()
743 dma_map_sg(info->dma_chan->device->dev, &info->sg, 1, info->dma_dir); start_data_dma()
745 tx = dmaengine_prep_slave_sg(info->dma_chan, &info->sg, 1, direction, start_data_dma()
748 dev_err(&info->pdev->dev, "prep_slave_sg() failed\n"); start_data_dma()
752 tx->callback_param = info; start_data_dma()
753 info->dma_cookie = dmaengine_submit(tx); start_data_dma()
754 dma_async_issue_pending(info->dma_chan); start_data_dma()
755 dev_dbg(&info->pdev->dev, "%s(dir=%d cookie=%x size=%u)\n", start_data_dma()
756 __func__, direction, info->dma_cookie, info->sg.length); start_data_dma()
761 struct pxa3xx_nand_info *info = data; pxa3xx_nand_irq_thread() local
763 handle_data_pio(info); pxa3xx_nand_irq_thread()
765 info->state = STATE_CMD_DONE; pxa3xx_nand_irq_thread()
766 nand_writel(info, NDSR, NDSR_WRDREQ | NDSR_RDDREQ); pxa3xx_nand_irq_thread()
773 struct pxa3xx_nand_info *info = devid; pxa3xx_nand_irq() local
778 if (info->cs == 0) { pxa3xx_nand_irq()
786 status = nand_readl(info, NDSR); pxa3xx_nand_irq()
789 info->retcode = ERR_UNCORERR; pxa3xx_nand_irq()
791 info->retcode = ERR_CORERR; pxa3xx_nand_irq()
792 if (info->variant == PXA3XX_NAND_VARIANT_ARMADA370 && pxa3xx_nand_irq()
793 info->ecc_bch) pxa3xx_nand_irq()
794 info->ecc_err_cnt = NDSR_ERR_CNT(status); pxa3xx_nand_irq()
796 info->ecc_err_cnt = 1; pxa3xx_nand_irq()
803 info->max_bitflips = max_t(unsigned int, pxa3xx_nand_irq()
804 info->max_bitflips, pxa3xx_nand_irq()
805 info->ecc_err_cnt); pxa3xx_nand_irq()
809 if (info->use_dma) { pxa3xx_nand_irq()
810 disable_int(info, NDCR_INT_MASK); pxa3xx_nand_irq()
811 info->state = (status & NDSR_RDDREQ) ? pxa3xx_nand_irq()
813 start_data_dma(info); pxa3xx_nand_irq()
816 info->state = (status & NDSR_RDDREQ) ? pxa3xx_nand_irq()
823 info->state = STATE_CMD_DONE; pxa3xx_nand_irq()
827 info->state = STATE_READY; pxa3xx_nand_irq()
836 nand_writel(info, NDSR, status); pxa3xx_nand_irq()
840 info->state = STATE_CMD_HANDLE; pxa3xx_nand_irq()
850 nand_writel(info, NDCB0, info->ndcb0); pxa3xx_nand_irq()
851 nand_writel(info, NDCB0, info->ndcb1); pxa3xx_nand_irq()
852 nand_writel(info, NDCB0, info->ndcb2); pxa3xx_nand_irq()
855 if (info->variant == PXA3XX_NAND_VARIANT_ARMADA370) pxa3xx_nand_irq()
856 nand_writel(info, NDCB0, info->ndcb3); pxa3xx_nand_irq()
860 complete(&info->cmd_complete); pxa3xx_nand_irq()
862 complete(&info->dev_ready); pxa3xx_nand_irq()
875 static void set_command_address(struct pxa3xx_nand_info *info, set_command_address() argument
880 info->ndcb1 = ((page_addr & 0xFFFFFF) << 8) set_command_address()
883 info->ndcb2 = 0; set_command_address()
885 info->ndcb1 = ((page_addr & 0xFFFF) << 16) set_command_address()
889 info->ndcb2 = (page_addr & 0xFF0000) >> 16; set_command_address()
891 info->ndcb2 = 0; set_command_address()
895 static void prepare_start_command(struct pxa3xx_nand_info *info, int command) prepare_start_command() argument
897 struct pxa3xx_nand_host *host = info->host[info->cs]; prepare_start_command()
901 info->buf_start = 0; prepare_start_command()
902 info->buf_count = 0; prepare_start_command()
903 info->oob_size = 0; prepare_start_command()
904 info->data_buff_pos = 0; prepare_start_command()
905 info->oob_buff_pos = 0; prepare_start_command()
906 info->use_ecc = 0; prepare_start_command()
907 info->use_spare = 1; prepare_start_command()
908 info->retcode = ERR_NONE; prepare_start_command()
909 info->ecc_err_cnt = 0; prepare_start_command()
910 info->ndcb3 = 0; prepare_start_command()
911 info->need_wait = 0; prepare_start_command()
916 info->use_ecc = 1; prepare_start_command()
918 pxa3xx_set_datasize(info, mtd); prepare_start_command()
921 info->use_spare = 0; prepare_start_command()
924 info->ndcb1 = 0; prepare_start_command()
925 info->ndcb2 = 0; prepare_start_command()
937 info->buf_count = mtd->writesize + mtd->oobsize; prepare_start_command()
938 memset(info->data_buff, 0xFF, info->buf_count); prepare_start_command()
943 static int prepare_set_command(struct pxa3xx_nand_info *info, int command, prepare_set_command() argument
950 host = info->host[info->cs]; prepare_set_command()
955 if (info->cs != 0) prepare_set_command()
956 info->ndcb0 = NDCB0_CSEL; prepare_set_command()
958 info->ndcb0 = 0; prepare_set_command()
969 info->buf_start = column; prepare_set_command()
970 info->ndcb0 |= NDCB0_CMD_TYPE(0) prepare_set_command()
975 info->buf_start += mtd->writesize; prepare_set_command()
983 info->ndcb0 |= NDCB0_DBC | (NAND_CMD_READSTART << 8); prepare_set_command()
985 info->ndcb0 |= NDCB0_DBC | (NAND_CMD_READSTART << 8) prepare_set_command()
988 info->ndcb3 = info->chunk_size + prepare_set_command()
989 info->oob_size; prepare_set_command()
992 set_command_address(info, mtd->writesize, column, page_addr); prepare_set_command()
997 info->buf_start = column; prepare_set_command()
998 set_command_address(info, mtd->writesize, 0, page_addr); prepare_set_command()
1005 info->ndcb0 |= NDCB0_CMD_TYPE(0x1) prepare_set_command()
1010 info->data_size = 0; prepare_set_command()
1016 if (is_buf_blank(info->data_buff, prepare_set_command()
1029 info->ndcb0 |= NDCB0_CMD_TYPE(0x1) prepare_set_command()
1032 info->ndcb3 = info->chunk_size + prepare_set_command()
1033 info->oob_size; prepare_set_command()
1039 if (info->data_size == 0) { prepare_set_command()
1040 info->ndcb0 = NDCB0_CMD_TYPE(0x1) prepare_set_command()
1043 info->ndcb1 = 0; prepare_set_command()
1044 info->ndcb2 = 0; prepare_set_command()
1045 info->ndcb3 = 0; prepare_set_command()
1048 info->ndcb0 |= NDCB0_CMD_TYPE(0x1) prepare_set_command()
1059 info->buf_count = INIT_BUFFER_SIZE; prepare_set_command()
1060 info->ndcb0 |= NDCB0_CMD_TYPE(0) prepare_set_command()
1064 info->ndcb1 = (column & 0xFF); prepare_set_command()
1065 info->ndcb3 = INIT_BUFFER_SIZE; prepare_set_command()
1066 info->data_size = INIT_BUFFER_SIZE; prepare_set_command()
1070 info->buf_count = READ_ID_BYTES; prepare_set_command()
1071 info->ndcb0 |= NDCB0_CMD_TYPE(3) prepare_set_command()
1074 info->ndcb1 = (column & 0xFF); prepare_set_command()
1076 info->data_size = 8; prepare_set_command()
1079 info->buf_count = 1; prepare_set_command()
1080 info->ndcb0 |= NDCB0_CMD_TYPE(4) prepare_set_command()
1084 info->data_size = 8; prepare_set_command()
1088 info->ndcb0 |= NDCB0_CMD_TYPE(2) prepare_set_command()
1094 info->ndcb1 = page_addr; prepare_set_command()
1095 info->ndcb2 = 0; prepare_set_command()
1099 info->ndcb0 |= NDCB0_CMD_TYPE(5) prepare_set_command()
1110 dev_err(&info->pdev->dev, "non-supported command %x\n", prepare_set_command()
1122 struct pxa3xx_nand_info *info = host->info_data; nand_cmdfunc() local
1130 if (info->reg_ndcr & NDCR_DWIDTH_M) nand_cmdfunc()
1138 if (info->cs != host->cs) { nand_cmdfunc()
1139 info->cs = host->cs; nand_cmdfunc()
1140 nand_writel(info, NDTR0CS0, info->ndtr0cs0); nand_cmdfunc()
1141 nand_writel(info, NDTR1CS0, info->ndtr1cs0); nand_cmdfunc()
1144 prepare_start_command(info, command); nand_cmdfunc()
1146 info->state = STATE_PREPARED; nand_cmdfunc()
1147 exec_cmd = prepare_set_command(info, command, 0, column, page_addr); nand_cmdfunc()
1150 init_completion(&info->cmd_complete); nand_cmdfunc()
1151 init_completion(&info->dev_ready); nand_cmdfunc()
1152 info->need_wait = 1; nand_cmdfunc()
1153 pxa3xx_nand_start(info); nand_cmdfunc()
1155 if (!wait_for_completion_timeout(&info->cmd_complete, nand_cmdfunc()
1157 dev_err(&info->pdev->dev, "Wait time out!!!\n"); nand_cmdfunc()
1159 pxa3xx_nand_stop(info); nand_cmdfunc()
1162 info->state = STATE_IDLE; nand_cmdfunc()
1170 struct pxa3xx_nand_info *info = host->info_data; nand_cmdfunc_extended() local
1178 if (info->reg_ndcr & NDCR_DWIDTH_M) nand_cmdfunc_extended()
1186 if (info->cs != host->cs) { nand_cmdfunc_extended()
1187 info->cs = host->cs; nand_cmdfunc_extended()
1188 nand_writel(info, NDTR0CS0, info->ndtr0cs0); nand_cmdfunc_extended()
1189 nand_writel(info, NDTR1CS0, info->ndtr1cs0); nand_cmdfunc_extended()
1209 prepare_start_command(info, command); nand_cmdfunc_extended()
1219 info->need_wait = 1; nand_cmdfunc_extended()
1220 init_completion(&info->dev_ready); nand_cmdfunc_extended()
1222 info->state = STATE_PREPARED; nand_cmdfunc_extended()
1223 exec_cmd = prepare_set_command(info, command, ext_cmd_type, nand_cmdfunc_extended()
1226 info->need_wait = 0; nand_cmdfunc_extended()
1227 complete(&info->dev_ready); nand_cmdfunc_extended()
1231 init_completion(&info->cmd_complete); nand_cmdfunc_extended()
1232 pxa3xx_nand_start(info); nand_cmdfunc_extended()
1234 if (!wait_for_completion_timeout(&info->cmd_complete, nand_cmdfunc_extended()
1236 dev_err(&info->pdev->dev, "Wait time out!!!\n"); nand_cmdfunc_extended()
1238 pxa3xx_nand_stop(info); nand_cmdfunc_extended()
1243 if (info->data_size == 0 && command != NAND_CMD_PAGEPROG) nand_cmdfunc_extended()
1250 if (info->data_size == 0 && nand_cmdfunc_extended()
1257 if (info->data_size == info->chunk_size) nand_cmdfunc_extended()
1267 info->data_size == 0) { nand_cmdfunc_extended()
1272 info->state = STATE_IDLE; nand_cmdfunc_extended()
1290 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_read_page_hwecc() local
1295 if (info->retcode == ERR_CORERR && info->use_ecc) { pxa3xx_nand_read_page_hwecc()
1296 mtd->ecc_stats.corrected += info->ecc_err_cnt; pxa3xx_nand_read_page_hwecc()
1298 } else if (info->retcode == ERR_UNCORERR) { pxa3xx_nand_read_page_hwecc()
1305 info->retcode = ERR_NONE; pxa3xx_nand_read_page_hwecc()
1310 return info->max_bitflips; pxa3xx_nand_read_page_hwecc()
1316 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_read_byte() local
1319 if (info->buf_start < info->buf_count) pxa3xx_nand_read_byte()
1321 retval = info->data_buff[info->buf_start++]; pxa3xx_nand_read_byte()
1329 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_read_word() local
1332 if (!(info->buf_start & 0x01) && info->buf_start < info->buf_count) { pxa3xx_nand_read_word()
1333 retval = *((u16 *)(info->data_buff+info->buf_start)); pxa3xx_nand_read_word()
1334 info->buf_start += 2; pxa3xx_nand_read_word()
1342 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_read_buf() local
1343 int real_len = min_t(size_t, len, info->buf_count - info->buf_start); pxa3xx_nand_read_buf()
1345 memcpy(buf, info->data_buff + info->buf_start, real_len); pxa3xx_nand_read_buf()
1346 info->buf_start += real_len; pxa3xx_nand_read_buf()
1353 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_write_buf() local
1354 int real_len = min_t(size_t, len, info->buf_count - info->buf_start); pxa3xx_nand_write_buf()
1356 memcpy(info->data_buff + info->buf_start, buf, real_len); pxa3xx_nand_write_buf()
1357 info->buf_start += real_len; pxa3xx_nand_write_buf()
1368 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_waitfunc() local
1370 if (info->need_wait) { pxa3xx_nand_waitfunc()
1371 info->need_wait = 0; pxa3xx_nand_waitfunc()
1372 if (!wait_for_completion_timeout(&info->dev_ready, pxa3xx_nand_waitfunc()
1374 dev_err(&info->pdev->dev, "Ready time out!!!\n"); pxa3xx_nand_waitfunc()
1381 if (info->retcode == ERR_NONE) pxa3xx_nand_waitfunc()
1390 static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info) pxa3xx_nand_config_flash() argument
1392 struct platform_device *pdev = info->pdev; pxa3xx_nand_config_flash()
1394 struct pxa3xx_nand_host *host = info->host[info->cs]; pxa3xx_nand_config_flash()
1399 info->reg_ndcr = 0x0; /* enable all interrupts */ pxa3xx_nand_config_flash()
1400 info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0; pxa3xx_nand_config_flash()
1401 info->reg_ndcr |= NDCR_RD_ID_CNT(READ_ID_BYTES); pxa3xx_nand_config_flash()
1402 info->reg_ndcr |= NDCR_SPARE_EN; /* enable spare by default */ pxa3xx_nand_config_flash()
1403 info->reg_ndcr |= (host->col_addr_cycles == 2) ? NDCR_RA_START : 0; pxa3xx_nand_config_flash()
1404 info->reg_ndcr |= (chip->page_shift == 6) ? NDCR_PG_PER_BLK : 0; pxa3xx_nand_config_flash()
1405 info->reg_ndcr |= (mtd->writesize == 2048) ? NDCR_PAGE_SZ : 0; pxa3xx_nand_config_flash()
1410 static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) pxa3xx_nand_detect_config() argument
1412 uint32_t ndcr = nand_readl(info, NDCR); pxa3xx_nand_detect_config()
1415 info->chunk_size = ndcr & NDCR_PAGE_SZ ? 2048 : 512; pxa3xx_nand_detect_config()
1416 info->reg_ndcr = ndcr & pxa3xx_nand_detect_config()
1418 info->ndtr0cs0 = nand_readl(info, NDTR0CS0); pxa3xx_nand_detect_config()
1419 info->ndtr1cs0 = nand_readl(info, NDTR1CS0); pxa3xx_nand_detect_config()
1423 static int pxa3xx_nand_init_buff(struct pxa3xx_nand_info *info) pxa3xx_nand_init_buff() argument
1425 struct platform_device *pdev = info->pdev; pxa3xx_nand_init_buff()
1431 info->data_buff = kmalloc(info->buf_size, GFP_KERNEL); pxa3xx_nand_init_buff()
1432 if (info->data_buff == NULL) pxa3xx_nand_init_buff()
1441 sg_init_one(&info->sg, info->data_buff, info->buf_size); pxa3xx_nand_init_buff()
1445 param.drcmr = info->drcmr_dat; pxa3xx_nand_init_buff()
1446 info->dma_chan = dma_request_slave_channel_compat(mask, pxad_filter_fn, pxa3xx_nand_init_buff()
1449 if (!info->dma_chan) { pxa3xx_nand_init_buff()
1457 config.src_addr = info->mmio_phys + NDDB; pxa3xx_nand_init_buff()
1458 config.dst_addr = info->mmio_phys + NDDB; pxa3xx_nand_init_buff()
1461 ret = dmaengine_slave_config(info->dma_chan, &config); pxa3xx_nand_init_buff()
1463 dev_err(&info->pdev->dev, pxa3xx_nand_init_buff()
1473 info->use_dma = 1; pxa3xx_nand_init_buff()
1477 static void pxa3xx_nand_free_buff(struct pxa3xx_nand_info *info) pxa3xx_nand_free_buff() argument
1479 if (info->use_dma) { pxa3xx_nand_free_buff()
1480 dmaengine_terminate_all(info->dma_chan); pxa3xx_nand_free_buff()
1481 dma_release_channel(info->dma_chan); pxa3xx_nand_free_buff()
1483 kfree(info->data_buff); pxa3xx_nand_free_buff()
1488 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_sensing() local
1494 mtd = info->host[info->cs]->mtd; pxa3xx_nand_sensing()
1512 static int pxa_ecc_init(struct pxa3xx_nand_info *info, pxa_ecc_init() argument
1517 info->chunk_size = 2048; pxa_ecc_init()
1518 info->spare_size = 40; pxa_ecc_init()
1519 info->ecc_size = 24; pxa_ecc_init()
1525 info->chunk_size = 512; pxa_ecc_init()
1526 info->spare_size = 8; pxa_ecc_init()
1527 info->ecc_size = 8; pxa_ecc_init()
1537 info->ecc_bch = 1; pxa_ecc_init()
1538 info->chunk_size = 2048; pxa_ecc_init()
1539 info->spare_size = 32; pxa_ecc_init()
1540 info->ecc_size = 32; pxa_ecc_init()
1542 ecc->size = info->chunk_size; pxa_ecc_init()
1547 info->ecc_bch = 1; pxa_ecc_init()
1548 info->chunk_size = 2048; pxa_ecc_init()
1549 info->spare_size = 32; pxa_ecc_init()
1550 info->ecc_size = 32; pxa_ecc_init()
1552 ecc->size = info->chunk_size; pxa_ecc_init()
1561 info->ecc_bch = 1; pxa_ecc_init()
1562 info->chunk_size = 1024; pxa_ecc_init()
1563 info->spare_size = 0; pxa_ecc_init()
1564 info->ecc_size = 32; pxa_ecc_init()
1566 ecc->size = info->chunk_size; pxa_ecc_init()
1570 dev_err(&info->pdev->dev, pxa_ecc_init()
1576 dev_info(&info->pdev->dev, "ECC strength %d, ECC step size %d\n", pxa_ecc_init()
1584 struct pxa3xx_nand_info *info = host->info_data; pxa3xx_nand_scan() local
1585 struct platform_device *pdev = info->pdev; pxa3xx_nand_scan()
1591 if (pdata->keep_config && !pxa3xx_nand_detect_config(info)) pxa3xx_nand_scan()
1595 info->chunk_size = 512; pxa3xx_nand_scan()
1597 ret = pxa3xx_nand_config_flash(info); pxa3xx_nand_scan()
1603 dev_info(&info->pdev->dev, "There is no chip on cs %d!\n", pxa3xx_nand_scan()
1604 info->cs); pxa3xx_nand_scan()
1610 info->reg_ndcr |= (pdata->enable_arbiter) ? NDCR_ND_ARB_EN : 0; pxa3xx_nand_scan()
1611 if (info->reg_ndcr & NDCR_DWIDTH_M) pxa3xx_nand_scan()
1615 if (info->variant == PXA3XX_NAND_VARIANT_ARMADA370) pxa3xx_nand_scan()
1616 nand_writel(info, NDECCCTRL, 0x0); pxa3xx_nand_scan()
1624 dev_err(&info->pdev->dev, "Failed to init nand: %d\n", pxa3xx_nand_scan()
1647 if (info->variant == PXA3XX_NAND_VARIANT_ARMADA370) { pxa3xx_nand_scan()
1650 dev_err(&info->pdev->dev, pxa3xx_nand_scan()
1670 ret = pxa_ecc_init(info, &chip->ecc, ecc_strength, pxa3xx_nand_scan()
1682 kfree(info->data_buff); pxa3xx_nand_scan()
1685 info->buf_size = mtd->writesize + mtd->oobsize; pxa3xx_nand_scan()
1686 ret = pxa3xx_nand_init_buff(info); pxa3xx_nand_scan()
1689 info->oob_buff = info->data_buff + mtd->writesize; pxa3xx_nand_scan()
1701 struct pxa3xx_nand_info *info; alloc_nand_resource() local
1711 info = devm_kzalloc(&pdev->dev, sizeof(*info) + (sizeof(*mtd) + alloc_nand_resource()
1713 if (!info) alloc_nand_resource()
1716 info->pdev = pdev; alloc_nand_resource()
1717 info->variant = pxa3xx_nand_get_variant(pdev); alloc_nand_resource()
1719 mtd = (void *)&info[1] + (sizeof(*mtd) + sizeof(*host)) * cs; alloc_nand_resource()
1722 info->host[cs] = host; alloc_nand_resource()
1725 host->info_data = info; alloc_nand_resource()
1731 chip->controller = &info->controller; alloc_nand_resource()
1744 info->clk = devm_clk_get(&pdev->dev, NULL); alloc_nand_resource()
1745 if (IS_ERR(info->clk)) { alloc_nand_resource()
1747 return PTR_ERR(info->clk); alloc_nand_resource()
1749 ret = clk_prepare_enable(info->clk); alloc_nand_resource()
1761 info->drcmr_dat = r->start; alloc_nand_resource()
1770 info->drcmr_cmd = r->start; alloc_nand_resource()
1781 info->mmio_base = devm_ioremap_resource(&pdev->dev, r); alloc_nand_resource()
1782 if (IS_ERR(info->mmio_base)) { alloc_nand_resource()
1783 ret = PTR_ERR(info->mmio_base); alloc_nand_resource()
1786 info->mmio_phys = r->start; alloc_nand_resource()
1789 info->buf_size = INIT_BUFFER_SIZE; alloc_nand_resource()
1790 info->data_buff = kmalloc(info->buf_size, GFP_KERNEL); alloc_nand_resource()
1791 if (info->data_buff == NULL) { alloc_nand_resource()
1797 disable_int(info, NDSR_MASK); alloc_nand_resource()
1801 pdev->name, info); alloc_nand_resource()
1807 platform_set_drvdata(pdev, info); alloc_nand_resource()
1812 free_irq(irq, info); alloc_nand_resource()
1813 kfree(info->data_buff); alloc_nand_resource()
1815 clk_disable_unprepare(info->clk); alloc_nand_resource()
1821 struct pxa3xx_nand_info *info = platform_get_drvdata(pdev); pxa3xx_nand_remove() local
1825 if (!info) pxa3xx_nand_remove()
1832 free_irq(irq, info); pxa3xx_nand_remove()
1833 pxa3xx_nand_free_buff(info); pxa3xx_nand_remove()
1842 nand_writel(info, NDCR, pxa3xx_nand_remove()
1843 (nand_readl(info, NDCR) & ~NDCR_ND_ARB_EN) | pxa3xx_nand_remove()
1845 clk_disable_unprepare(info->clk); pxa3xx_nand_remove()
1848 nand_release(info->host[cs]->mtd); pxa3xx_nand_remove()
1890 struct pxa3xx_nand_info *info; pxa3xx_nand_probe() local
1917 info = platform_get_drvdata(pdev); pxa3xx_nand_probe()
1920 struct mtd_info *mtd = info->host[cs]->mtd; pxa3xx_nand_probe()
1928 info->cs = cs; pxa3xx_nand_probe()
1955 struct pxa3xx_nand_info *info = dev_get_drvdata(dev); pxa3xx_nand_suspend() local
1957 if (info->state) { pxa3xx_nand_suspend()
1958 dev_err(dev, "driver busy, state = %d\n", info->state); pxa3xx_nand_suspend()
1967 struct pxa3xx_nand_info *info = dev_get_drvdata(dev); pxa3xx_nand_resume() local
1970 disable_int(info, NDCR_INT_MASK); pxa3xx_nand_resume()
1977 info->cs = 0xff; pxa3xx_nand_resume()
1985 nand_writel(info, NDSR, NDSR_MASK); pxa3xx_nand_resume()
H A Domap_elm.c95 static void elm_write_reg(struct elm_info *info, int offset, u32 val) elm_write_reg() argument
97 writel(val, info->elm_base + offset); elm_write_reg()
100 static u32 elm_read_reg(struct elm_info *info, int offset) elm_read_reg() argument
102 return readl(info->elm_base + offset); elm_read_reg()
114 struct elm_info *info = dev_get_drvdata(dev); elm_config() local
116 if (!info) { elm_config()
132 elm_write_reg(info, ELM_LOCATION_CONFIG, reg_val); elm_config()
133 info->bch_type = bch_type; elm_config()
134 info->ecc_steps = ecc_steps; elm_config()
135 info->ecc_syndrome_size = ecc_syndrome_size; elm_config()
143 * @info: elm info
149 static void elm_configure_page_mode(struct elm_info *info, int index, elm_configure_page_mode() argument
154 reg_val = elm_read_reg(info, ELM_PAGE_CTRL); elm_configure_page_mode()
160 elm_write_reg(info, ELM_PAGE_CTRL, reg_val); elm_configure_page_mode()
165 * @info: elm info
171 static void elm_load_syndrome(struct elm_info *info, elm_load_syndrome() argument
177 for (i = 0; i < info->ecc_steps; i++) { elm_load_syndrome()
181 elm_configure_page_mode(info, i, true); elm_load_syndrome()
184 switch (info->bch_type) { elm_load_syndrome()
188 elm_write_reg(info, offset, val); elm_load_syndrome()
193 elm_write_reg(info, offset, val); elm_load_syndrome()
198 elm_write_reg(info, offset, val); elm_load_syndrome()
203 elm_write_reg(info, offset, val); elm_load_syndrome()
209 elm_write_reg(info, offset, val); elm_load_syndrome()
214 elm_write_reg(info, offset, val); elm_load_syndrome()
218 elm_write_reg(info, offset, val); elm_load_syndrome()
221 elm_write_reg(info, offset, val); elm_load_syndrome()
224 elm_write_reg(info, offset, val); elm_load_syndrome()
227 elm_write_reg(info, offset, val); elm_load_syndrome()
230 elm_write_reg(info, offset, val); elm_load_syndrome()
233 elm_write_reg(info, offset, val); elm_load_syndrome()
236 elm_write_reg(info, offset, val); elm_load_syndrome()
244 ecc += info->ecc_syndrome_size; elm_load_syndrome()
250 * @info: elm info
257 static void elm_start_processing(struct elm_info *info, elm_start_processing() argument
267 for (i = 0; i < info->ecc_steps; i++) { elm_start_processing()
271 reg_val = elm_read_reg(info, offset); elm_start_processing()
273 elm_write_reg(info, offset, reg_val); elm_start_processing()
280 * @info: elm info
289 static void elm_error_correction(struct elm_info *info, elm_error_correction() argument
296 for (i = 0; i < info->ecc_steps; i++) { elm_error_correction()
301 reg_val = elm_read_reg(info, offset); elm_error_correction()
315 reg_val = elm_read_reg(info, offset); elm_error_correction()
329 elm_write_reg(info, ELM_IRQSTATUS, BIT(i)); elm_error_correction()
332 elm_configure_page_mode(info, i, false); elm_error_correction()
349 struct elm_info *info = dev_get_drvdata(dev); elm_decode_bch_error_page() local
353 reg_val = elm_read_reg(info, ELM_IRQSTATUS); elm_decode_bch_error_page()
354 elm_write_reg(info, ELM_IRQSTATUS, reg_val & INTR_STATUS_PAGE_VALID); elm_decode_bch_error_page()
355 elm_write_reg(info, ELM_IRQENABLE, INTR_EN_PAGE_MASK); elm_decode_bch_error_page()
358 elm_load_syndrome(info, err_vec, ecc_calc); elm_decode_bch_error_page()
361 elm_start_processing(info, err_vec); elm_decode_bch_error_page()
364 wait_for_completion(&info->elm_completion); elm_decode_bch_error_page()
367 reg_val = elm_read_reg(info, ELM_IRQENABLE); elm_decode_bch_error_page()
368 elm_write_reg(info, ELM_IRQENABLE, reg_val & ~INTR_EN_PAGE_MASK); elm_decode_bch_error_page()
369 elm_error_correction(info, err_vec); elm_decode_bch_error_page()
376 struct elm_info *info = dev_id; elm_isr() local
378 reg_val = elm_read_reg(info, ELM_IRQSTATUS); elm_isr()
382 elm_write_reg(info, ELM_IRQSTATUS, elm_isr()
384 complete(&info->elm_completion); elm_isr()
395 struct elm_info *info; elm_probe() local
397 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); elm_probe()
398 if (!info) elm_probe()
401 info->dev = &pdev->dev; elm_probe()
410 info->elm_base = devm_ioremap_resource(&pdev->dev, res); elm_probe()
411 if (IS_ERR(info->elm_base)) elm_probe()
412 return PTR_ERR(info->elm_base); elm_probe()
415 pdev->name, info); elm_probe()
429 init_completion(&info->elm_completion); elm_probe()
430 INIT_LIST_HEAD(&info->list); elm_probe()
431 list_add(&info->list, &elm_devices); elm_probe()
432 platform_set_drvdata(pdev, info); elm_probe()
448 static int elm_context_save(struct elm_info *info) elm_context_save() argument
450 struct elm_registers *regs = &info->elm_regs; elm_context_save()
451 enum bch_ecc bch_type = info->bch_type; elm_context_save()
454 regs->elm_irqenable = elm_read_reg(info, ELM_IRQENABLE); elm_context_save()
455 regs->elm_sysconfig = elm_read_reg(info, ELM_SYSCONFIG); elm_context_save()
456 regs->elm_location_config = elm_read_reg(info, ELM_LOCATION_CONFIG); elm_context_save()
457 regs->elm_page_ctrl = elm_read_reg(info, ELM_PAGE_CTRL); elm_context_save()
462 regs->elm_syndrome_fragment_6[i] = elm_read_reg(info, elm_context_save()
464 regs->elm_syndrome_fragment_5[i] = elm_read_reg(info, elm_context_save()
466 regs->elm_syndrome_fragment_4[i] = elm_read_reg(info, elm_context_save()
469 regs->elm_syndrome_fragment_3[i] = elm_read_reg(info, elm_context_save()
471 regs->elm_syndrome_fragment_2[i] = elm_read_reg(info, elm_context_save()
474 regs->elm_syndrome_fragment_1[i] = elm_read_reg(info, elm_context_save()
476 regs->elm_syndrome_fragment_0[i] = elm_read_reg(info, elm_context_save()
484 regs->elm_syndrome_fragment_6[i] = elm_read_reg(info, elm_context_save()
494 static int elm_context_restore(struct elm_info *info) elm_context_restore() argument
496 struct elm_registers *regs = &info->elm_regs; elm_context_restore()
497 enum bch_ecc bch_type = info->bch_type; elm_context_restore()
500 elm_write_reg(info, ELM_IRQENABLE, regs->elm_irqenable); elm_context_restore()
501 elm_write_reg(info, ELM_SYSCONFIG, regs->elm_sysconfig); elm_context_restore()
502 elm_write_reg(info, ELM_LOCATION_CONFIG, regs->elm_location_config); elm_context_restore()
503 elm_write_reg(info, ELM_PAGE_CTRL, regs->elm_page_ctrl); elm_context_restore()
508 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_6 + offset, elm_context_restore()
510 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_5 + offset, elm_context_restore()
512 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_4 + offset, elm_context_restore()
515 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_3 + offset, elm_context_restore()
517 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_2 + offset, elm_context_restore()
520 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_1 + offset, elm_context_restore()
522 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset, elm_context_restore()
529 elm_write_reg(info, ELM_SYNDROME_FRAGMENT_6 + offset, elm_context_restore()
538 struct elm_info *info = dev_get_drvdata(dev); elm_suspend() local
539 elm_context_save(info); elm_suspend()
546 struct elm_info *info = dev_get_drvdata(dev); elm_resume() local
548 elm_context_restore(info); elm_resume()
H A Ds3c2410.c103 * @info: Link back to the hardware information.
110 struct s3c2410_nand_info *info; member in struct:s3c2410_nand_mtd
144 /* mtd info */
149 /* device info */
176 return s3c2410_nand_mtd_toours(mtd)->info; s3c2410_nand_mtd_toinfo()
189 static inline int allow_clk_suspend(struct s3c2410_nand_info *info) allow_clk_suspend() argument
200 * @info: The controller instance.
203 static void s3c2410_nand_clk_set_state(struct s3c2410_nand_info *info, s3c2410_nand_clk_set_state() argument
206 if (!allow_clk_suspend(info) && new_state == CLOCK_SUSPEND) s3c2410_nand_clk_set_state()
209 if (info->clk_state == CLOCK_ENABLE) { s3c2410_nand_clk_set_state()
211 clk_disable_unprepare(info->clk); s3c2410_nand_clk_set_state()
214 clk_prepare_enable(info->clk); s3c2410_nand_clk_set_state()
217 info->clk_state = new_state; s3c2410_nand_clk_set_state()
258 * @info: The controller instance.
264 static int s3c2410_nand_setrate(struct s3c2410_nand_info *info) s3c2410_nand_setrate() argument
266 struct s3c2410_platform_nand *plat = info->platform; s3c2410_nand_setrate()
267 int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4; s3c2410_nand_setrate()
269 unsigned long clkrate = clk_get_rate(info->clk); s3c2410_nand_setrate()
275 info->clk_rate = clkrate; s3c2410_nand_setrate()
290 dev_err(info->device, "cannot get suitable timings\n"); s3c2410_nand_setrate()
294 dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n", s3c2410_nand_setrate()
298 switch (info->cpu_type) { s3c2410_nand_setrate()
326 cfg = readl(info->regs + S3C2410_NFCONF); s3c2410_nand_setrate()
329 writel(cfg, info->regs + S3C2410_NFCONF); s3c2410_nand_setrate()
333 dev_dbg(info->device, "NF_CONF is 0x%lx\n", cfg); s3c2410_nand_setrate()
340 * @info: The hardware state.
345 static int s3c2410_nand_inithw(struct s3c2410_nand_info *info) s3c2410_nand_inithw() argument
349 ret = s3c2410_nand_setrate(info); s3c2410_nand_inithw()
353 switch (info->cpu_type) { s3c2410_nand_inithw()
362 writel(S3C2440_NFCONT_ENABLE, info->regs + S3C2440_NFCONT); s3c2410_nand_inithw()
383 struct s3c2410_nand_info *info; s3c2410_nand_select_chip() local
389 info = nmtd->info; s3c2410_nand_select_chip()
392 s3c2410_nand_clk_set_state(info, CLOCK_ENABLE); s3c2410_nand_select_chip()
394 cur = readl(info->sel_reg); s3c2410_nand_select_chip()
397 cur |= info->sel_bit; s3c2410_nand_select_chip()
400 dev_err(info->device, "invalid chip %d\n", chip); s3c2410_nand_select_chip()
404 if (info->platform != NULL) { s3c2410_nand_select_chip()
405 if (info->platform->select_chip != NULL) s3c2410_nand_select_chip()
406 (info->platform->select_chip) (nmtd->set, chip); s3c2410_nand_select_chip()
409 cur &= ~info->sel_bit; s3c2410_nand_select_chip()
412 writel(cur, info->sel_reg); s3c2410_nand_select_chip()
415 s3c2410_nand_clk_set_state(info, CLOCK_SUSPEND); s3c2410_nand_select_chip()
426 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2410_nand_hwcontrol() local
432 writeb(cmd, info->regs + S3C2410_NFCMD); s3c2410_nand_hwcontrol()
434 writeb(cmd, info->regs + S3C2410_NFADDR); s3c2410_nand_hwcontrol()
442 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2440_nand_hwcontrol() local
448 writeb(cmd, info->regs + S3C2440_NFCMD); s3c2440_nand_hwcontrol()
450 writeb(cmd, info->regs + S3C2440_NFADDR); s3c2440_nand_hwcontrol()
460 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2410_nand_devready() local
461 return readb(info->regs + S3C2410_NFSTAT) & S3C2410_NFSTAT_BUSY; s3c2410_nand_devready()
466 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2440_nand_devready() local
467 return readb(info->regs + S3C2440_NFSTAT) & S3C2440_NFSTAT_READY; s3c2440_nand_devready()
472 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2412_nand_devready() local
473 return readb(info->regs + S3C2412_NFSTAT) & S3C2412_NFSTAT_READY; s3c2412_nand_devready()
482 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2410_nand_correct_data() local
504 && info->platform->ignore_unset_ecc) s3c2410_nand_correct_data()
531 dev_dbg(info->device, "correcting error bit %d, byte %d\n", s3c2410_nand_correct_data()
559 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2410_nand_enable_hwecc() local
562 ctrl = readl(info->regs + S3C2410_NFCONF); s3c2410_nand_enable_hwecc()
564 writel(ctrl, info->regs + S3C2410_NFCONF); s3c2410_nand_enable_hwecc()
569 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2412_nand_enable_hwecc() local
572 ctrl = readl(info->regs + S3C2440_NFCONT); s3c2412_nand_enable_hwecc()
574 info->regs + S3C2440_NFCONT); s3c2412_nand_enable_hwecc()
579 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2440_nand_enable_hwecc() local
582 ctrl = readl(info->regs + S3C2440_NFCONT); s3c2440_nand_enable_hwecc()
583 writel(ctrl | S3C2440_NFCONT_INITECC, info->regs + S3C2440_NFCONT); s3c2440_nand_enable_hwecc()
589 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2410_nand_calculate_ecc() local
591 ecc_code[0] = readb(info->regs + S3C2410_NFECC + 0); s3c2410_nand_calculate_ecc()
592 ecc_code[1] = readb(info->regs + S3C2410_NFECC + 1); s3c2410_nand_calculate_ecc()
593 ecc_code[2] = readb(info->regs + S3C2410_NFECC + 2); s3c2410_nand_calculate_ecc()
603 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2412_nand_calculate_ecc() local
604 unsigned long ecc = readl(info->regs + S3C2412_NFMECC0); s3c2412_nand_calculate_ecc()
618 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2440_nand_calculate_ecc() local
619 unsigned long ecc = readl(info->regs + S3C2440_NFMECC0); s3c2440_nand_calculate_ecc()
643 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2440_nand_read_buf() local
645 readsl(info->regs + S3C2440_NFDATA, buf, len >> 2); s3c2440_nand_read_buf()
652 *buf++ = readb(info->regs + S3C2440_NFDATA); s3c2440_nand_read_buf()
666 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); s3c2440_nand_write_buf() local
668 writesl(info->regs + S3C2440_NFDATA, buf, len >> 2); s3c2440_nand_write_buf()
675 writeb(*buf, info->regs + S3C2440_NFDATA); s3c2440_nand_write_buf()
686 struct s3c2410_nand_info *info; s3c2410_nand_cpufreq_transition() local
689 info = container_of(nb, struct s3c2410_nand_info, freq_transition); s3c2410_nand_cpufreq_transition()
690 newclk = clk_get_rate(info->clk); s3c2410_nand_cpufreq_transition()
692 if ((val == CPUFREQ_POSTCHANGE && newclk < info->clk_rate) || s3c2410_nand_cpufreq_transition()
693 (val == CPUFREQ_PRECHANGE && newclk > info->clk_rate)) { s3c2410_nand_cpufreq_transition()
694 s3c2410_nand_setrate(info); s3c2410_nand_cpufreq_transition()
700 static inline int s3c2410_nand_cpufreq_register(struct s3c2410_nand_info *info) s3c2410_nand_cpufreq_register() argument
702 info->freq_transition.notifier_call = s3c2410_nand_cpufreq_transition; s3c2410_nand_cpufreq_register()
704 return cpufreq_register_notifier(&info->freq_transition, s3c2410_nand_cpufreq_register()
709 s3c2410_nand_cpufreq_deregister(struct s3c2410_nand_info *info) s3c2410_nand_cpufreq_deregister() argument
711 cpufreq_unregister_notifier(&info->freq_transition, s3c2410_nand_cpufreq_deregister()
716 static inline int s3c2410_nand_cpufreq_register(struct s3c2410_nand_info *info) s3c2410_nand_cpufreq_register() argument
722 s3c2410_nand_cpufreq_deregister(struct s3c2410_nand_info *info) s3c2410_nand_cpufreq_deregister() argument
731 struct s3c2410_nand_info *info = to_nand_info(pdev); s3c24xx_nand_remove() local
733 if (info == NULL) s3c24xx_nand_remove()
736 s3c2410_nand_cpufreq_deregister(info); s3c24xx_nand_remove()
742 if (info->mtds != NULL) { s3c24xx_nand_remove()
743 struct s3c2410_nand_mtd *ptr = info->mtds; s3c24xx_nand_remove()
746 for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) { s3c24xx_nand_remove()
754 if (!IS_ERR(info->clk)) s3c24xx_nand_remove()
755 s3c2410_nand_clk_set_state(info, CLOCK_DISABLE); s3c24xx_nand_remove()
760 static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info, s3c2410_nand_add_partition() argument
776 * @info: The base NAND controller the chip is on.
780 * Initialise the given @nmtd from the information in @info and @set. This
784 static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info, s3c2410_nand_init_chip() argument
789 void __iomem *regs = info->regs; s3c2410_nand_init_chip()
797 chip->controller = &info->controller; s3c2410_nand_init_chip()
799 switch (info->cpu_type) { s3c2410_nand_init_chip()
802 info->sel_reg = regs + S3C2410_NFCONF; s3c2410_nand_init_chip()
803 info->sel_bit = S3C2410_NFCONF_nFCE; s3c2410_nand_init_chip()
810 info->sel_reg = regs + S3C2440_NFCONT; s3c2410_nand_init_chip()
811 info->sel_bit = S3C2440_NFCONT_nFCE; s3c2410_nand_init_chip()
820 info->sel_reg = regs + S3C2440_NFCONT; s3c2410_nand_init_chip()
821 info->sel_bit = S3C2412_NFCONT_nFCE0; s3c2410_nand_init_chip()
826 dev_info(info->device, "System booted from NAND\n"); s3c2410_nand_init_chip()
833 nmtd->info = info; s3c2410_nand_init_chip()
843 switch (info->cpu_type) { s3c2410_nand_init_chip()
871 dev_info(info->device, "NAND ECC disabled\n"); s3c2410_nand_init_chip()
874 dev_info(info->device, "NAND soft ECC\n"); s3c2410_nand_init_chip()
877 dev_info(info->device, "NAND hardware ECC\n"); s3c2410_nand_init_chip()
880 dev_info(info->device, "NAND ECC UNKNOWN\n"); s3c2410_nand_init_chip()
895 * @info: The controller instance.
904 static void s3c2410_nand_update_chip(struct s3c2410_nand_info *info, s3c2410_nand_update_chip() argument
909 dev_dbg(info->device, "chip %p => page shift %d\n", s3c2410_nand_update_chip()
939 struct s3c2410_nand_info *info; s3c24xx_nand_probe() local
950 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); s3c24xx_nand_probe()
951 if (info == NULL) { s3c24xx_nand_probe()
956 platform_set_drvdata(pdev, info); s3c24xx_nand_probe()
958 spin_lock_init(&info->controller.lock); s3c24xx_nand_probe()
959 init_waitqueue_head(&info->controller.wq); s3c24xx_nand_probe()
963 info->clk = devm_clk_get(&pdev->dev, "nand"); s3c24xx_nand_probe()
964 if (IS_ERR(info->clk)) { s3c24xx_nand_probe()
970 s3c2410_nand_clk_set_state(info, CLOCK_ENABLE); s3c24xx_nand_probe()
978 info->device = &pdev->dev; s3c24xx_nand_probe()
979 info->platform = plat; s3c24xx_nand_probe()
980 info->cpu_type = cpu_type; s3c24xx_nand_probe()
982 info->regs = devm_ioremap_resource(&pdev->dev, res); s3c24xx_nand_probe()
983 if (IS_ERR(info->regs)) { s3c24xx_nand_probe()
984 err = PTR_ERR(info->regs); s3c24xx_nand_probe()
988 dev_dbg(&pdev->dev, "mapped registers at %p\n", info->regs); s3c24xx_nand_probe()
992 err = s3c2410_nand_inithw(info); s3c24xx_nand_probe()
999 info->mtd_count = nr_sets; s3c24xx_nand_probe()
1003 size = nr_sets * sizeof(*info->mtds); s3c24xx_nand_probe()
1004 info->mtds = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); s3c24xx_nand_probe()
1005 if (info->mtds == NULL) { s3c24xx_nand_probe()
1012 nmtd = info->mtds; s3c24xx_nand_probe()
1015 pr_debug("initialising set %d (%p, info %p)\n", s3c24xx_nand_probe()
1016 setno, nmtd, info); s3c24xx_nand_probe()
1019 s3c2410_nand_init_chip(info, nmtd, sets); s3c24xx_nand_probe()
1026 s3c2410_nand_update_chip(info, nmtd); s3c24xx_nand_probe()
1028 s3c2410_nand_add_partition(info, nmtd, sets); s3c24xx_nand_probe()
1035 err = s3c2410_nand_cpufreq_register(info); s3c24xx_nand_probe()
1041 if (allow_clk_suspend(info)) { s3c24xx_nand_probe()
1043 s3c2410_nand_clk_set_state(info, CLOCK_SUSPEND); s3c24xx_nand_probe()
1061 struct s3c2410_nand_info *info = platform_get_drvdata(dev); s3c24xx_nand_suspend() local
1063 if (info) { s3c24xx_nand_suspend()
1064 info->save_sel = readl(info->sel_reg); s3c24xx_nand_suspend()
1071 writel(info->save_sel | info->sel_bit, info->sel_reg); s3c24xx_nand_suspend()
1073 s3c2410_nand_clk_set_state(info, CLOCK_DISABLE); s3c24xx_nand_suspend()
1081 struct s3c2410_nand_info *info = platform_get_drvdata(dev); s3c24xx_nand_resume() local
1084 if (info) { s3c24xx_nand_resume()
1085 s3c2410_nand_clk_set_state(info, CLOCK_ENABLE); s3c24xx_nand_resume()
1086 s3c2410_nand_inithw(info); s3c24xx_nand_resume()
1090 sel = readl(info->sel_reg); s3c24xx_nand_resume()
1091 sel &= ~info->sel_bit; s3c24xx_nand_resume()
1092 sel |= info->save_sel & info->sel_bit; s3c24xx_nand_resume()
1093 writel(sel, info->sel_reg); s3c24xx_nand_resume()
1095 s3c2410_nand_clk_set_state(info, CLOCK_SUSPEND); s3c24xx_nand_resume()
/linux-4.4.14/drivers/uio/
H A Duio_mf624.c46 struct uio_info *info) mf624_disable_interrupt()
48 void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; mf624_disable_interrupt()
74 struct uio_info *info) mf624_enable_interrupt()
76 void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; mf624_enable_interrupt()
101 static irqreturn_t mf624_irq_handler(int irq, struct uio_info *info) mf624_irq_handler() argument
103 void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; mf624_irq_handler()
107 mf624_disable_interrupt(ADC, info); mf624_irq_handler()
113 mf624_disable_interrupt(CTR4, info); mf624_irq_handler()
120 static int mf624_irqcontrol(struct uio_info *info, s32 irq_on) mf624_irqcontrol() argument
123 mf624_disable_interrupt(ALL, info); mf624_irqcontrol()
125 mf624_enable_interrupt(ALL, info); mf624_irqcontrol()
132 struct uio_info *info; mf624_pci_probe() local
134 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); mf624_pci_probe()
135 if (!info) mf624_pci_probe()
144 info->name = "mf624"; mf624_pci_probe()
145 info->version = "0.0.1"; mf624_pci_probe()
150 info->mem[0].name = "PCI chipset, interrupts, status " mf624_pci_probe()
152 info->mem[0].addr = pci_resource_start(dev, 0); mf624_pci_probe()
153 if (!info->mem[0].addr) mf624_pci_probe()
155 info->mem[0].size = pci_resource_len(dev, 0); mf624_pci_probe()
156 info->mem[0].memtype = UIO_MEM_PHYS; mf624_pci_probe()
157 info->mem[0].internal_addr = pci_ioremap_bar(dev, 0); mf624_pci_probe()
158 if (!info->mem[0].internal_addr) mf624_pci_probe()
162 info->mem[1].name = "ADC, DAC, DIO"; mf624_pci_probe()
163 info->mem[1].addr = pci_resource_start(dev, 2); mf624_pci_probe()
164 if (!info->mem[1].addr) mf624_pci_probe()
166 info->mem[1].size = pci_resource_len(dev, 2); mf624_pci_probe()
167 info->mem[1].memtype = UIO_MEM_PHYS; mf624_pci_probe()
168 info->mem[1].internal_addr = pci_ioremap_bar(dev, 2); mf624_pci_probe()
169 if (!info->mem[1].internal_addr) mf624_pci_probe()
173 info->mem[2].name = "Counter/timer chip"; mf624_pci_probe()
174 info->mem[2].addr = pci_resource_start(dev, 4); mf624_pci_probe()
175 if (!info->mem[2].addr) mf624_pci_probe()
177 info->mem[2].size = pci_resource_len(dev, 4); mf624_pci_probe()
178 info->mem[2].memtype = UIO_MEM_PHYS; mf624_pci_probe()
179 info->mem[2].internal_addr = pci_ioremap_bar(dev, 4); mf624_pci_probe()
180 if (!info->mem[2].internal_addr) mf624_pci_probe()
183 info->irq = dev->irq; mf624_pci_probe()
184 info->irq_flags = IRQF_SHARED; mf624_pci_probe()
185 info->handler = mf624_irq_handler; mf624_pci_probe()
187 info->irqcontrol = mf624_irqcontrol; mf624_pci_probe()
189 if (uio_register_device(&dev->dev, info)) mf624_pci_probe()
192 pci_set_drvdata(dev, info); mf624_pci_probe()
197 iounmap(info->mem[2].internal_addr); mf624_pci_probe()
199 iounmap(info->mem[1].internal_addr); mf624_pci_probe()
201 iounmap(info->mem[0].internal_addr); mf624_pci_probe()
210 kfree(info); mf624_pci_probe()
216 struct uio_info *info = pci_get_drvdata(dev); mf624_pci_remove() local
218 mf624_disable_interrupt(ALL, info); mf624_pci_remove()
220 uio_unregister_device(info); mf624_pci_remove()
224 iounmap(info->mem[0].internal_addr); mf624_pci_remove()
225 iounmap(info->mem[1].internal_addr); mf624_pci_remove()
226 iounmap(info->mem[2].internal_addr); mf624_pci_remove()
228 kfree(info); mf624_pci_remove()
45 mf624_disable_interrupt(enum mf624_interrupt_source source, struct uio_info *info) mf624_disable_interrupt() argument
73 mf624_enable_interrupt(enum mf624_interrupt_source source, struct uio_info *info) mf624_enable_interrupt() argument
H A Duio_cif.c46 struct uio_info *info; hilscher_pci_probe() local
48 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); hilscher_pci_probe()
49 if (!info) hilscher_pci_probe()
58 info->mem[0].addr = pci_resource_start(dev, 0); hilscher_pci_probe()
59 if (!info->mem[0].addr) hilscher_pci_probe()
61 info->mem[0].internal_addr = pci_ioremap_bar(dev, 0); hilscher_pci_probe()
62 if (!info->mem[0].internal_addr) hilscher_pci_probe()
65 info->mem[0].size = pci_resource_len(dev, 0); hilscher_pci_probe()
66 info->mem[0].memtype = UIO_MEM_PHYS; hilscher_pci_probe()
67 info->mem[1].addr = pci_resource_start(dev, 2); hilscher_pci_probe()
68 info->mem[1].size = pci_resource_len(dev, 2); hilscher_pci_probe()
69 info->mem[1].memtype = UIO_MEM_PHYS; hilscher_pci_probe()
72 info->name = "CIF_Profibus"; hilscher_pci_probe()
75 info->name = "CIF_Devicenet"; hilscher_pci_probe()
78 info->name = "CIF_???"; hilscher_pci_probe()
80 info->version = "0.0.1"; hilscher_pci_probe()
81 info->irq = dev->irq; hilscher_pci_probe()
82 info->irq_flags = IRQF_SHARED; hilscher_pci_probe()
83 info->handler = hilscher_handler; hilscher_pci_probe()
85 if (uio_register_device(&dev->dev, info)) hilscher_pci_probe()
88 pci_set_drvdata(dev, info); hilscher_pci_probe()
92 iounmap(info->mem[0].internal_addr); hilscher_pci_probe()
98 kfree (info); hilscher_pci_probe()
104 struct uio_info *info = pci_get_drvdata(dev); hilscher_pci_remove() local
106 uio_unregister_device(info); hilscher_pci_remove()
109 iounmap(info->mem[0].internal_addr); hilscher_pci_remove()
111 kfree (info); hilscher_pci_remove()
H A Duio_sercos3.c51 static void sercos3_disable_interrupts(struct uio_info *info, sercos3_disable_interrupts() argument
54 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET; sercos3_disable_interrupts()
64 static void sercos3_enable_interrupts(struct uio_info *info, sercos3_enable_interrupts() argument
67 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET; sercos3_enable_interrupts()
74 static irqreturn_t sercos3_handler(int irq, struct uio_info *info) sercos3_handler() argument
76 struct sercos3_priv *priv = info->priv; sercos3_handler()
77 void __iomem *isr0 = info->mem[3].internal_addr + ISR0_OFFSET; sercos3_handler()
78 void __iomem *ier0 = info->mem[3].internal_addr + IER0_OFFSET; sercos3_handler()
84 sercos3_disable_interrupts(info, priv); sercos3_handler()
90 static int sercos3_irqcontrol(struct uio_info *info, s32 irq_on) sercos3_irqcontrol() argument
92 struct sercos3_priv *priv = info->priv; sercos3_irqcontrol()
96 sercos3_enable_interrupts(info, priv); sercos3_irqcontrol()
98 sercos3_disable_interrupts(info, priv); sercos3_irqcontrol()
104 static int sercos3_setup_iomem(struct pci_dev *dev, struct uio_info *info, sercos3_setup_iomem() argument
107 info->mem[n].addr = pci_resource_start(dev, pci_bar); sercos3_setup_iomem()
108 if (!info->mem[n].addr) sercos3_setup_iomem()
110 info->mem[n].internal_addr = ioremap(pci_resource_start(dev, pci_bar), sercos3_setup_iomem()
112 if (!info->mem[n].internal_addr) sercos3_setup_iomem()
114 info->mem[n].size = pci_resource_len(dev, pci_bar); sercos3_setup_iomem()
115 info->mem[n].memtype = UIO_MEM_PHYS; sercos3_setup_iomem()
122 struct uio_info *info; sercos3_pci_probe() local
126 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); sercos3_pci_probe()
127 if (!info) sercos3_pci_probe()
141 if (sercos3_setup_iomem(dev, info, 0, 0)) sercos3_pci_probe()
143 if (sercos3_setup_iomem(dev, info, 1, 2)) sercos3_pci_probe()
145 if (sercos3_setup_iomem(dev, info, 2, 3)) sercos3_pci_probe()
147 if (sercos3_setup_iomem(dev, info, 3, 4)) sercos3_pci_probe()
149 if (sercos3_setup_iomem(dev, info, 4, 5)) sercos3_pci_probe()
153 info->priv = priv; sercos3_pci_probe()
154 info->name = "Sercos_III_PCI"; sercos3_pci_probe()
155 info->version = "0.0.1"; sercos3_pci_probe()
156 info->irq = dev->irq; sercos3_pci_probe()
157 info->irq_flags = IRQF_SHARED; sercos3_pci_probe()
158 info->handler = sercos3_handler; sercos3_pci_probe()
159 info->irqcontrol = sercos3_irqcontrol; sercos3_pci_probe()
161 pci_set_drvdata(dev, info); sercos3_pci_probe()
163 if (uio_register_device(&dev->dev, info)) sercos3_pci_probe()
170 if (info->mem[i].internal_addr) sercos3_pci_probe()
171 iounmap(info->mem[i].internal_addr); sercos3_pci_probe()
179 kfree(info); sercos3_pci_probe()
185 struct uio_info *info = pci_get_drvdata(dev); sercos3_pci_remove() local
188 uio_unregister_device(info); sercos3_pci_remove()
192 if (info->mem[i].internal_addr) sercos3_pci_remove()
193 iounmap(info->mem[i].internal_addr); sercos3_pci_remove()
195 kfree(info->priv); sercos3_pci_remove()
196 kfree(info); sercos3_pci_remove()
H A Duio_netx.c54 struct uio_info *info; netx_pci_probe() local
57 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); netx_pci_probe()
58 if (!info) netx_pci_probe()
70 info->name = "netx"; netx_pci_probe()
74 info->name = "netplc"; netx_pci_probe()
78 info->name = "netx_plx"; netx_pci_probe()
82 info->mem[0].addr = pci_resource_start(dev, bar); netx_pci_probe()
83 if (!info->mem[0].addr) netx_pci_probe()
85 info->mem[0].internal_addr = ioremap(pci_resource_start(dev, bar), netx_pci_probe()
88 if (!info->mem[0].internal_addr) netx_pci_probe()
91 info->mem[0].size = pci_resource_len(dev, bar); netx_pci_probe()
92 info->mem[0].memtype = UIO_MEM_PHYS; netx_pci_probe()
93 info->irq = dev->irq; netx_pci_probe()
94 info->irq_flags = IRQF_SHARED; netx_pci_probe()
95 info->handler = netx_handler; netx_pci_probe()
96 info->version = "0.0.1"; netx_pci_probe()
99 iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0); netx_pci_probe()
101 if (uio_register_device(&dev->dev, info)) netx_pci_probe()
104 pci_set_drvdata(dev, info); netx_pci_probe()
106 info->name); netx_pci_probe()
111 iounmap(info->mem[0].internal_addr); netx_pci_probe()
117 kfree(info); netx_pci_probe()
123 struct uio_info *info = pci_get_drvdata(dev); netx_pci_remove() local
126 iowrite32(0, info->mem[0].internal_addr + DPM_HOST_INT_EN0); netx_pci_remove()
127 uio_unregister_device(info); netx_pci_remove()
130 iounmap(info->mem[0].internal_addr); netx_pci_remove()
132 kfree(info); netx_pci_remove()
H A Duio_aec.c83 struct uio_info *info; probe() local
86 info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); probe()
87 if (!info) probe()
96 info->name = "aectc"; probe()
97 info->port[0].start = pci_resource_start(pdev, 0); probe()
98 if (!info->port[0].start) probe()
100 info->priv = pci_iomap(pdev, 0, 0); probe()
101 if (!info->priv) probe()
103 info->port[0].size = pci_resource_len(pdev, 0); probe()
104 info->port[0].porttype = UIO_PORT_GPIO; probe()
106 info->version = "0.0.1"; probe()
107 info->irq = pdev->irq; probe()
108 info->irq_flags = IRQF_SHARED; probe()
109 info->handler = aectc_irq; probe()
111 print_board_data(pdev, info); probe()
112 ret = uio_register_device(&pdev->dev, info); probe()
116 iowrite32(INT_ENABLE, info->priv + INT_ENABLE_ADDR); probe()
117 iowrite8(INT_MASK_ALL, info->priv + INT_MASK_ADDR); probe()
118 if (!(ioread8(info->priv + INTA_DRVR_ADDR) probe()
122 pci_set_drvdata(pdev, info); probe()
127 pci_iounmap(pdev, info->priv); probe()
133 kfree(info); probe()
139 struct uio_info *info = pci_get_drvdata(pdev); remove() local
142 iowrite8(INT_DISABLE, info->priv + INT_MASK_ADDR); remove()
143 iowrite32(INT_DISABLE, info->priv + INT_ENABLE_ADDR); remove()
145 ioread8(info->priv + MAILBOX); remove()
147 uio_unregister_device(info); remove()
150 iounmap(info->priv); remove()
152 kfree(info); remove()
/linux-4.4.14/arch/arm/mach-mmp/
H A Dsram.c44 struct sram_bank_info *info = NULL; sram_get_gpool() local
51 list_for_each_entry(info, &sram_bank_list, node) sram_get_gpool()
52 if (!strcmp(pool_name, info->pool_name)) sram_get_gpool()
57 if (&info->node == &sram_bank_list) sram_get_gpool()
60 return info->gpool; sram_get_gpool()
67 struct sram_bank_info *info; sram_probe() local
74 info = kzalloc(sizeof(*info), GFP_KERNEL); sram_probe()
75 if (!info) sram_probe()
88 info->sram_phys = (phys_addr_t)res->start; sram_probe()
89 info->sram_size = resource_size(res); sram_probe()
90 info->sram_virt = ioremap(info->sram_phys, info->sram_size); sram_probe()
91 info->pool_name = kstrdup(pdata->pool_name, GFP_KERNEL); sram_probe()
92 info->granularity = pdata->granularity; sram_probe()
94 info->gpool = gen_pool_create(ilog2(info->granularity), -1); sram_probe()
95 if (!info->gpool) { sram_probe()
101 ret = gen_pool_add_virt(info->gpool, (unsigned long)info->sram_virt, sram_probe()
102 info->sram_phys, info->sram_size, -1); sram_probe()
110 list_add(&info->node, &sram_bank_list); sram_probe()
113 platform_set_drvdata(pdev, info); sram_probe()
119 gen_pool_destroy(info->gpool); sram_probe()
121 iounmap(info->sram_virt); sram_probe()
122 kfree(info->pool_name); sram_probe()
124 kfree(info); sram_probe()
130 struct sram_bank_info *info; sram_remove() local
132 info = platform_get_drvdata(pdev); sram_remove()
133 if (info == NULL) sram_remove()
137 list_del(&info->node); sram_remove()
140 gen_pool_destroy(info->gpool); sram_remove()
141 iounmap(info->sram_virt); sram_remove()
142 kfree(info->pool_name); sram_remove()
143 kfree(info); sram_remove()
/linux-4.4.14/net/bridge/netfilter/
H A Debt_limit.c37 struct ebt_limit_info *info = (void *)par->matchinfo; ebt_limit_mt() local
41 info->credit += (now - xchg(&info->prev, now)) * CREDITS_PER_JIFFY; ebt_limit_mt()
42 if (info->credit > info->credit_cap) ebt_limit_mt()
43 info->credit = info->credit_cap; ebt_limit_mt()
45 if (info->credit >= info->cost) { ebt_limit_mt()
47 info->credit -= info->cost; ebt_limit_mt()
70 struct ebt_limit_info *info = par->matchinfo; ebt_limit_mt_check() local
73 if (info->burst == 0 || ebt_limit_mt_check()
74 user2credits(info->avg * info->burst) < user2credits(info->avg)) { ebt_limit_mt_check()
76 info->avg, info->burst); ebt_limit_mt_check()
81 info->prev = jiffies; ebt_limit_mt_check()
82 info->credit = user2credits(info->avg * info->burst); ebt_limit_mt_check()
83 info->credit_cap = user2credits(info->avg * info->burst); ebt_limit_mt_check()
84 info->cost = user2credits(info->avg); ebt_limit_mt_check()
H A Debt_ip.c30 const struct ebt_ip_info *info = par->matchinfo; ebt_ip_mt() local
39 if (info->bitmask & EBT_IP_TOS && ebt_ip_mt()
40 FWINV(info->tos != ih->tos, EBT_IP_TOS)) ebt_ip_mt()
42 if (info->bitmask & EBT_IP_SOURCE && ebt_ip_mt()
43 FWINV((ih->saddr & info->smsk) != ebt_ip_mt()
44 info->saddr, EBT_IP_SOURCE)) ebt_ip_mt()
46 if ((info->bitmask & EBT_IP_DEST) && ebt_ip_mt()
47 FWINV((ih->daddr & info->dmsk) != ebt_ip_mt()
48 info->daddr, EBT_IP_DEST)) ebt_ip_mt()
50 if (info->bitmask & EBT_IP_PROTO) { ebt_ip_mt()
51 if (FWINV(info->protocol != ih->protocol, EBT_IP_PROTO)) ebt_ip_mt()
53 if (!(info->bitmask & EBT_IP_DPORT) && ebt_ip_mt()
54 !(info->bitmask & EBT_IP_SPORT)) ebt_ip_mt()
62 if (info->bitmask & EBT_IP_DPORT) { ebt_ip_mt()
64 if (FWINV(dst < info->dport[0] || ebt_ip_mt()
65 dst > info->dport[1], ebt_ip_mt()
69 if (info->bitmask & EBT_IP_SPORT) { ebt_ip_mt()
71 if (FWINV(src < info->sport[0] || ebt_ip_mt()
72 src > info->sport[1], ebt_ip_mt()
82 const struct ebt_ip_info *info = par->matchinfo; ebt_ip_mt_check() local
88 if (info->bitmask & ~EBT_IP_MASK || info->invflags & ~EBT_IP_MASK) ebt_ip_mt_check()
90 if (info->bitmask & (EBT_IP_DPORT | EBT_IP_SPORT)) { ebt_ip_mt_check()
91 if (info->invflags & EBT_IP_PROTO) ebt_ip_mt_check()
93 if (info->protocol != IPPROTO_TCP && ebt_ip_mt_check()
94 info->protocol != IPPROTO_UDP && ebt_ip_mt_check()
95 info->protocol != IPPROTO_UDPLITE && ebt_ip_mt_check()
96 info->protocol != IPPROTO_SCTP && ebt_ip_mt_check()
97 info->protocol != IPPROTO_DCCP) ebt_ip_mt_check()
100 if (info->bitmask & EBT_IP_DPORT && info->dport[0] > info->dport[1]) ebt_ip_mt_check()
102 if (info->bitmask & EBT_IP_SPORT && info->sport[0] > info->sport[1]) ebt_ip_mt_check()
H A Debt_ip6.c39 const struct ebt_ip6_info *info = par->matchinfo; ebt_ip6_mt() local
48 if (info->bitmask & EBT_IP6_TCLASS && ebt_ip6_mt()
49 FWINV(info->tclass != ipv6_get_dsfield(ih6), EBT_IP6_TCLASS)) ebt_ip6_mt()
51 if ((info->bitmask & EBT_IP6_SOURCE && ebt_ip6_mt()
52 FWINV(ipv6_masked_addr_cmp(&ih6->saddr, &info->smsk, ebt_ip6_mt()
53 &info->saddr), EBT_IP6_SOURCE)) || ebt_ip6_mt()
54 (info->bitmask & EBT_IP6_DEST && ebt_ip6_mt()
55 FWINV(ipv6_masked_addr_cmp(&ih6->daddr, &info->dmsk, ebt_ip6_mt()
56 &info->daddr), EBT_IP6_DEST))) ebt_ip6_mt()
58 if (info->bitmask & EBT_IP6_PROTO) { ebt_ip6_mt()
66 if (FWINV(info->protocol != nexthdr, EBT_IP6_PROTO)) ebt_ip6_mt()
68 if (!(info->bitmask & ( EBT_IP6_DPORT | ebt_ip6_mt()
77 if (info->bitmask & EBT_IP6_DPORT) { ebt_ip6_mt()
79 if (FWINV(dst < info->dport[0] || ebt_ip6_mt()
80 dst > info->dport[1], EBT_IP6_DPORT)) ebt_ip6_mt()
83 if (info->bitmask & EBT_IP6_SPORT) { ebt_ip6_mt()
85 if (FWINV(src < info->sport[0] || ebt_ip6_mt()
86 src > info->sport[1], EBT_IP6_SPORT)) ebt_ip6_mt()
89 if ((info->bitmask & EBT_IP6_ICMP6) && ebt_ip6_mt()
90 FWINV(pptr->icmphdr.type < info->icmpv6_type[0] || ebt_ip6_mt()
91 pptr->icmphdr.type > info->icmpv6_type[1] || ebt_ip6_mt()
92 pptr->icmphdr.code < info->icmpv6_code[0] || ebt_ip6_mt()
93 pptr->icmphdr.code > info->icmpv6_code[1], ebt_ip6_mt()
103 struct ebt_ip6_info *info = par->matchinfo; ebt_ip6_mt_check() local
107 if (info->bitmask & ~EBT_IP6_MASK || info->invflags & ~EBT_IP6_MASK) ebt_ip6_mt_check()
109 if (info->bitmask & (EBT_IP6_DPORT | EBT_IP6_SPORT)) { ebt_ip6_mt_check()
110 if (info->invflags & EBT_IP6_PROTO) ebt_ip6_mt_check()
112 if (info->protocol != IPPROTO_TCP && ebt_ip6_mt_check()
113 info->protocol != IPPROTO_UDP && ebt_ip6_mt_check()
114 info->protocol != IPPROTO_UDPLITE && ebt_ip6_mt_check()
115 info->protocol != IPPROTO_SCTP && ebt_ip6_mt_check()
116 info->protocol != IPPROTO_DCCP) ebt_ip6_mt_check()
119 if (info->bitmask & EBT_IP6_DPORT && info->dport[0] > info->dport[1]) ebt_ip6_mt_check()
121 if (info->bitmask & EBT_IP6_SPORT && info->sport[0] > info->sport[1]) ebt_ip6_mt_check()
123 if (info->bitmask & EBT_IP6_ICMP6) { ebt_ip6_mt_check()
124 if ((info->invflags & EBT_IP6_PROTO) || ebt_ip6_mt_check()
125 info->protocol != IPPROTO_ICMPV6) ebt_ip6_mt_check()
127 if (info->icmpv6_type[0] > info->icmpv6_type[1] || ebt_ip6_mt_check()
128 info->icmpv6_code[0] > info->icmpv6_code[1]) ebt_ip6_mt_check()
H A Debt_arp.c21 const struct ebt_arp_info *info = par->matchinfo; ebt_arp_mt() local
28 if (info->bitmask & EBT_ARP_OPCODE && FWINV(info->opcode != ebt_arp_mt()
31 if (info->bitmask & EBT_ARP_HTYPE && FWINV(info->htype != ebt_arp_mt()
34 if (info->bitmask & EBT_ARP_PTYPE && FWINV(info->ptype != ebt_arp_mt()
38 if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_GRAT)) { ebt_arp_mt()
54 if (info->bitmask & EBT_ARP_SRC_IP && ebt_arp_mt()
55 FWINV(info->saddr != (*sap & info->smsk), EBT_ARP_SRC_IP)) ebt_arp_mt()
57 if (info->bitmask & EBT_ARP_DST_IP && ebt_arp_mt()
58 FWINV(info->daddr != (*dap & info->dmsk), EBT_ARP_DST_IP)) ebt_arp_mt()
60 if (info->bitmask & EBT_ARP_GRAT && ebt_arp_mt()
65 if (info->bitmask & (EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)) { ebt_arp_mt()
72 if (info->bitmask & EBT_ARP_SRC_MAC) { ebt_arp_mt()
79 verdict |= (mp[i] ^ info->smaddr[i]) & ebt_arp_mt()
80 info->smmsk[i]; ebt_arp_mt()
85 if (info->bitmask & EBT_ARP_DST_MAC) { ebt_arp_mt()
93 verdict |= (mp[i] ^ info->dmaddr[i]) & ebt_arp_mt()
94 info->dmmsk[i]; ebt_arp_mt()
105 const struct ebt_arp_info *info = par->matchinfo; ebt_arp_mt_check() local
112 if (info->bitmask & ~EBT_ARP_MASK || info->invflags & ~EBT_ARP_MASK) ebt_arp_mt_check()
H A Debt_mark_m.c18 const struct ebt_mark_m_info *info = par->matchinfo; ebt_mark_mt() local
20 if (info->bitmask & EBT_MARK_OR) ebt_mark_mt()
21 return !!(skb->mark & info->mask) ^ info->invert; ebt_mark_mt()
22 return ((skb->mark & info->mask) == info->mark) ^ info->invert; ebt_mark_mt()
27 const struct ebt_mark_m_info *info = par->matchinfo; ebt_mark_mt_check() local
29 if (info->bitmask & ~EBT_MARK_MASK) ebt_mark_mt_check()
31 if ((info->bitmask & EBT_MARK_OR) && (info->bitmask & EBT_MARK_AND)) ebt_mark_mt_check()
33 if (!info->bitmask) ebt_mark_mt_check()
/linux-4.4.14/drivers/power/
H A D88pm860x_charger.c119 static int measure_vchg(struct pm860x_charger_info *info, int *data) measure_vchg() argument
124 ret = pm860x_bulk_read(info->i2c, PM8607_VCHG_MEAS1, 2, buf); measure_vchg()
132 dev_dbg(info->dev, "%s, vchg: %d mv\n", __func__, *data); measure_vchg()
137 static void set_vchg_threshold(struct pm860x_charger_info *info, set_vchg_threshold() argument
147 pm860x_reg_write(info->i2c, PM8607_VCHG_LOWTH, data); set_vchg_threshold()
148 dev_dbg(info->dev, "VCHG_LOWTH:%dmv, 0x%x\n", min, data); set_vchg_threshold()
154 pm860x_reg_write(info->i2c, PM8607_VCHG_HIGHTH, data); set_vchg_threshold()
155 dev_dbg(info->dev, "VCHG_HIGHTH:%dmv, 0x%x\n", max, data); set_vchg_threshold()
159 static void set_vbatt_threshold(struct pm860x_charger_info *info, set_vbatt_threshold() argument
169 pm860x_reg_write(info->i2c, PM8607_VBAT_LOWTH, data); set_vbatt_threshold()
170 dev_dbg(info->dev, "VBAT Min:%dmv, LOWTH:0x%x\n", min, data); set_vbatt_threshold()
176 pm860x_reg_write(info->i2c, PM8607_VBAT_HIGHTH, data); set_vbatt_threshold()
177 dev_dbg(info->dev, "VBAT Max:%dmv, HIGHTH:0x%x\n", max, data); set_vbatt_threshold()
182 static int start_precharge(struct pm860x_charger_info *info) start_precharge() argument
186 dev_dbg(info->dev, "Start Pre-charging!\n"); start_precharge()
187 set_vbatt_threshold(info, 0, 0); start_precharge()
189 ret = pm860x_reg_write(info->i2c_8606, PM8606_PREREGULATORA, start_precharge()
194 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL1, 3, start_precharge()
199 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL3, (0xf << 4), start_precharge()
204 ret = pm860x_reg_write(info->i2c, PM8607_CHG_CTRL4, start_precharge()
209 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL7, start_precharge()
215 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL1, 3, start_precharge()
221 static int start_fastcharge(struct pm860x_charger_info *info) start_fastcharge() argument
225 dev_dbg(info->dev, "Start Fast-charging!\n"); start_fastcharge()
228 ret = pm860x_reg_write(info->i2c, PM8607_CHG_CTRL1, start_fastcharge()
233 ret = pm860x_reg_write(info->i2c_8606, PM8606_PREREGULATORA, start_fastcharge()
237 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL2, 0x1f, start_fastcharge()
242 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL3, (0xf << 4), start_fastcharge()
247 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL4, start_fastcharge()
252 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL6, start_fastcharge()
259 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL7, start_fastcharge()
265 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL1, 3, start_fastcharge()
268 set_vchg_threshold(info, VCHG_NORMAL_LOW, VCHG_NORMAL_HIGH); start_fastcharge()
273 static void stop_charge(struct pm860x_charger_info *info, int vbatt) stop_charge() argument
275 dev_dbg(info->dev, "Stop charging!\n"); stop_charge()
276 pm860x_set_bits(info->i2c, PM8607_CHG_CTRL1, 3, CC1_MODE_OFF); stop_charge()
277 if (vbatt > CHARGE_THRESHOLD && info->online) stop_charge()
278 set_vbatt_threshold(info, CHARGE_THRESHOLD, 0); stop_charge()
281 static void power_off_notification(struct pm860x_charger_info *info) power_off_notification() argument
283 dev_dbg(info->dev, "Power-off notification!\n"); power_off_notification()
286 static int set_charging_fsm(struct pm860x_charger_info *info) set_charging_fsm() argument
314 mutex_lock(&info->lock); set_charging_fsm()
315 info->present = data.intval; set_charging_fsm()
317 dev_dbg(info->dev, "Entering FSM:%s, Charger:%s, Battery:%s, " set_charging_fsm()
319 &fsm_state[info->state][0], set_charging_fsm()
320 (info->online) ? "online" : "N/A", set_charging_fsm()
321 (info->present) ? "present" : "N/A", info->allowed); set_charging_fsm()
322 dev_dbg(info->dev, "set_charging_fsm:vbatt:%d(mV)\n", vbatt); set_charging_fsm()
324 switch (info->state) { set_charging_fsm()
326 if (info->online && info->present && info->allowed) { set_charging_fsm()
328 info->state = FSM_PRECHARGE; set_charging_fsm()
329 start_precharge(info); set_charging_fsm()
331 info->state = FSM_DISCHARGE; set_charging_fsm()
332 stop_charge(info, vbatt); set_charging_fsm()
334 info->state = FSM_FASTCHARGE; set_charging_fsm()
335 start_fastcharge(info); set_charging_fsm()
339 power_off_notification(info); set_charging_fsm()
341 info->state = FSM_DISCHARGE; set_charging_fsm()
342 stop_charge(info, vbatt); set_charging_fsm()
347 if (info->online && info->present && info->allowed) { set_charging_fsm()
349 info->state = FSM_FASTCHARGE; set_charging_fsm()
350 start_fastcharge(info); set_charging_fsm()
353 info->state = FSM_DISCHARGE; set_charging_fsm()
354 stop_charge(info, vbatt); set_charging_fsm()
358 if (info->online && info->present && info->allowed) { set_charging_fsm()
360 info->state = FSM_PRECHARGE; set_charging_fsm()
361 start_precharge(info); set_charging_fsm()
364 info->state = FSM_DISCHARGE; set_charging_fsm()
365 stop_charge(info, vbatt); set_charging_fsm()
369 if (info->online && info->present && info->allowed) { set_charging_fsm()
371 info->state = FSM_PRECHARGE; set_charging_fsm()
372 start_precharge(info); set_charging_fsm()
374 info->state = FSM_FASTCHARGE; set_charging_fsm()
375 start_fastcharge(info); set_charging_fsm()
379 power_off_notification(info); set_charging_fsm()
380 else if (vbatt > CHARGE_THRESHOLD && info->online) set_charging_fsm()
381 set_vbatt_threshold(info, CHARGE_THRESHOLD, 0); set_charging_fsm()
385 dev_warn(info->dev, "FSM meets wrong state:%d\n", set_charging_fsm()
386 info->state); set_charging_fsm()
389 dev_dbg(info->dev, set_charging_fsm()
391 &fsm_state[info->state][0], set_charging_fsm()
392 (info->online) ? "online" : "N/A", set_charging_fsm()
393 (info->present) ? "present" : "N/A", info->allowed); set_charging_fsm()
394 mutex_unlock(&info->lock); set_charging_fsm()
401 struct pm860x_charger_info *info = data; pm860x_charger_handler() local
404 mutex_lock(&info->lock); pm860x_charger_handler()
405 ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2); pm860x_charger_handler()
407 mutex_unlock(&info->lock); pm860x_charger_handler()
411 info->online = 1; pm860x_charger_handler()
412 info->allowed = 1; pm860x_charger_handler()
414 info->online = 0; pm860x_charger_handler()
415 info->allowed = 0; pm860x_charger_handler()
417 mutex_unlock(&info->lock); pm860x_charger_handler()
418 dev_dbg(info->dev, "%s, Charger:%s, Allowed:%d\n", __func__, pm860x_charger_handler()
419 (info->online) ? "online" : "N/A", info->allowed); pm860x_charger_handler()
421 set_charging_fsm(info); pm860x_charger_handler()
423 power_supply_changed(info->usb); pm860x_charger_handler()
431 struct pm860x_charger_info *info = data; pm860x_temp_handler() local
444 mutex_lock(&info->lock); pm860x_temp_handler()
447 info->allowed = 0; pm860x_temp_handler()
449 info->allowed = 1; pm860x_temp_handler()
450 dev_dbg(info->dev, "%s, Allowed: %d\n", __func__, info->allowed); pm860x_temp_handler()
451 mutex_unlock(&info->lock); pm860x_temp_handler()
453 set_charging_fsm(info); pm860x_temp_handler()
461 struct pm860x_charger_info *info = data; pm860x_exception_handler() local
463 mutex_lock(&info->lock); pm860x_exception_handler()
464 info->allowed = 0; pm860x_exception_handler()
465 mutex_unlock(&info->lock); pm860x_exception_handler()
466 dev_dbg(info->dev, "%s, irq: %d\n", __func__, irq); pm860x_exception_handler()
468 set_charging_fsm(info); pm860x_exception_handler()
474 struct pm860x_charger_info *info = data; pm860x_done_handler() local
480 mutex_lock(&info->lock); pm860x_done_handler()
482 if (info->state == FSM_PRECHARGE) { pm860x_done_handler()
483 info->allowed = 1; pm860x_done_handler()
491 info->allowed = 0; pm860x_done_handler()
502 * plug in/out usb, So we can not rely on info->online, we pm860x_done_handler()
507 ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2); pm860x_done_handler()
517 mutex_unlock(&info->lock); pm860x_done_handler()
518 dev_dbg(info->dev, "%s, Allowed: %d\n", __func__, info->allowed); pm860x_done_handler()
519 set_charging_fsm(info); pm860x_done_handler()
526 struct pm860x_charger_info *info = data; pm860x_vbattery_handler() local
528 mutex_lock(&info->lock); pm860x_vbattery_handler()
530 set_vbatt_threshold(info, 0, 0); pm860x_vbattery_handler()
532 if (info->present && info->online) pm860x_vbattery_handler()
533 info->allowed = 1; pm860x_vbattery_handler()
535 info->allowed = 0; pm860x_vbattery_handler()
536 mutex_unlock(&info->lock); pm860x_vbattery_handler()
537 dev_dbg(info->dev, "%s, Allowed: %d\n", __func__, info->allowed); pm860x_vbattery_handler()
539 set_charging_fsm(info); pm860x_vbattery_handler()
546 struct pm860x_charger_info *info = data; pm860x_vchg_handler() local
549 if (info->present) pm860x_vchg_handler()
552 measure_vchg(info, &vchg); pm860x_vchg_handler()
554 mutex_lock(&info->lock); pm860x_vchg_handler()
555 if (!info->online) { pm860x_vchg_handler()
558 status = pm860x_reg_read(info->i2c_8606, PM8606_FLAGS); pm860x_vchg_handler()
561 pm860x_set_bits(info->i2c_8606, PM8606_FLAGS, pm860x_vchg_handler()
563 pm860x_set_bits(info->i2c_8606, pm860x_vchg_handler()
567 dev_dbg(info->dev, pm860x_vchg_handler()
573 set_vchg_threshold(info, VCHG_OVP_LOW, 0); pm860x_vchg_handler()
574 info->allowed = 0; pm860x_vchg_handler()
575 dev_dbg(info->dev, pm860x_vchg_handler()
579 set_vchg_threshold(info, VCHG_NORMAL_LOW, pm860x_vchg_handler()
581 info->allowed = 1; pm860x_vchg_handler()
582 dev_dbg(info->dev, pm860x_vchg_handler()
586 mutex_unlock(&info->lock); pm860x_vchg_handler()
588 dev_dbg(info->dev, "%s, Allowed: %d\n", __func__, info->allowed); pm860x_vchg_handler()
589 set_charging_fsm(info); pm860x_vchg_handler()
598 struct pm860x_charger_info *info = power_supply_get_drvdata(psy); pm860x_usb_get_prop() local
602 if (info->state == FSM_FASTCHARGE || pm860x_usb_get_prop()
603 info->state == FSM_PRECHARGE) pm860x_usb_get_prop()
609 val->intval = info->online; pm860x_usb_get_prop()
622 static int pm860x_init_charger(struct pm860x_charger_info *info) pm860x_init_charger() argument
626 ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2); pm860x_init_charger()
630 mutex_lock(&info->lock); pm860x_init_charger()
631 info->state = FSM_INIT; pm860x_init_charger()
633 info->online = 1; pm860x_init_charger()
634 info->allowed = 1; pm860x_init_charger()
636 info->online = 0; pm860x_init_charger()
637 info->allowed = 0; pm860x_init_charger()
639 mutex_unlock(&info->lock); pm860x_init_charger()
641 set_charging_fsm(info); pm860x_init_charger()
670 struct pm860x_charger_info *info; pm860x_charger_probe() local
676 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); pm860x_charger_probe()
677 if (!info) pm860x_charger_probe()
682 info->irq[j] = platform_get_irq(pdev, i); pm860x_charger_probe()
683 if (info->irq[j] < 0) pm860x_charger_probe()
687 info->irq_nums = j; pm860x_charger_probe()
689 info->chip = chip; pm860x_charger_probe()
690 info->i2c = pm860x_charger_probe()
692 info->i2c_8606 = pm860x_charger_probe()
694 if (!info->i2c_8606) { pm860x_charger_probe()
699 info->dev = &pdev->dev; pm860x_charger_probe()
702 set_vchg_threshold(info, VCHG_NORMAL_LOW, VCHG_OVP_LOW); pm860x_charger_probe()
704 mutex_init(&info->lock); pm860x_charger_probe()
705 platform_set_drvdata(pdev, info); pm860x_charger_probe()
707 psy_cfg.drv_data = info; pm860x_charger_probe()
710 info->usb = power_supply_register(&pdev->dev, &pm860x_charger_desc, pm860x_charger_probe()
712 if (IS_ERR(info->usb)) { pm860x_charger_probe()
713 ret = PTR_ERR(info->usb); pm860x_charger_probe()
717 pm860x_init_charger(info); pm860x_charger_probe()
719 for (i = 0; i < ARRAY_SIZE(info->irq); i++) { pm860x_charger_probe()
720 ret = request_threaded_irq(info->irq[i], NULL, pm860x_charger_probe()
722 IRQF_ONESHOT, pm860x_irq_descs[i].name, info); pm860x_charger_probe()
725 info->irq[i], ret); pm860x_charger_probe()
732 power_supply_unregister(info->usb); pm860x_charger_probe()
734 free_irq(info->irq[i], info); pm860x_charger_probe()
741 struct pm860x_charger_info *info = platform_get_drvdata(pdev); pm860x_charger_remove() local
744 power_supply_unregister(info->usb); pm860x_charger_remove()
745 for (i = 0; i < info->irq_nums; i++) pm860x_charger_remove()
746 free_irq(info->irq[i], info); pm860x_charger_remove()
H A Daxp288_charger.c187 static inline int axp288_charger_set_cc(struct axp288_chrg_info *info, int cc) axp288_charger_set_cc() argument
194 else if (cc > info->max_cc) axp288_charger_set_cc()
195 cc = info->max_cc; axp288_charger_set_cc()
201 ret = regmap_update_bits(info->regmap, axp288_charger_set_cc()
205 info->cc = cc; axp288_charger_set_cc()
210 static inline int axp288_charger_set_cv(struct axp288_chrg_info *info, int cv) axp288_charger_set_cv() argument
231 ret = regmap_update_bits(info->regmap, axp288_charger_set_cv()
236 info->cv = cv; axp288_charger_set_cv()
241 static inline int axp288_charger_set_vbus_inlmt(struct axp288_chrg_info *info, axp288_charger_set_vbus_inlmt() argument
249 ret = regmap_read(info->regmap, AXP20X_CHRG_BAK_CTRL, &val); axp288_charger_set_vbus_inlmt()
278 ret = regmap_write(info->regmap, AXP20X_CHRG_BAK_CTRL, reg_val); axp288_charger_set_vbus_inlmt()
280 info->inlmt = inlmt; axp288_charger_set_vbus_inlmt()
282 dev_err(&info->pdev->dev, "charger BAK control %d\n", ret); axp288_charger_set_vbus_inlmt()
289 static int axp288_charger_vbus_path_select(struct axp288_chrg_info *info, axp288_charger_vbus_path_select() argument
295 ret = regmap_update_bits(info->regmap, AXP20X_VBUS_IPSOUT_MGMT, axp288_charger_vbus_path_select()
298 ret = regmap_update_bits(info->regmap, AXP20X_VBUS_IPSOUT_MGMT, axp288_charger_vbus_path_select()
302 dev_err(&info->pdev->dev, "axp288 vbus path select %d\n", ret); axp288_charger_vbus_path_select()
308 static int axp288_charger_enable_charger(struct axp288_chrg_info *info, axp288_charger_enable_charger() argument
314 ret = regmap_update_bits(info->regmap, AXP20X_CHRG_CTRL1, axp288_charger_enable_charger()
317 ret = regmap_update_bits(info->regmap, AXP20X_CHRG_CTRL1, axp288_charger_enable_charger()
320 dev_err(&info->pdev->dev, "axp288 enable charger %d\n", ret); axp288_charger_enable_charger()
322 info->is_charger_enabled = enable; axp288_charger_enable_charger()
327 static int axp288_charger_is_present(struct axp288_chrg_info *info) axp288_charger_is_present() argument
332 ret = regmap_read(info->regmap, AXP20X_PWR_INPUT_STATUS, &val); axp288_charger_is_present()
341 static int axp288_charger_is_online(struct axp288_chrg_info *info) axp288_charger_is_online() argument
346 ret = regmap_read(info->regmap, AXP20X_PWR_INPUT_STATUS, &val); axp288_charger_is_online()
355 static int axp288_get_charger_health(struct axp288_chrg_info *info) axp288_get_charger_health() argument
361 ret = regmap_read(info->regmap, AXP20X_PWR_INPUT_STATUS, &val); axp288_get_charger_health()
367 ret = regmap_read(info->regmap, AXP20X_PWR_OP_MODE, &val); axp288_get_charger_health()
390 struct axp288_chrg_info *info = power_supply_get_drvdata(psy); axp288_charger_usb_set_property() local
394 mutex_lock(&info->lock); axp288_charger_usb_set_property()
398 scaled_val = min(val->intval, info->max_cc); axp288_charger_usb_set_property()
400 ret = axp288_charger_set_cc(info, scaled_val); axp288_charger_usb_set_property()
402 dev_warn(&info->pdev->dev, "set charge current failed\n"); axp288_charger_usb_set_property()
405 scaled_val = min(val->intval, info->max_cv); axp288_charger_usb_set_property()
407 ret = axp288_charger_set_cv(info, scaled_val); axp288_charger_usb_set_property()
409 dev_warn(&info->pdev->dev, "set charge voltage failed\n"); axp288_charger_usb_set_property()
415 mutex_unlock(&info->lock); axp288_charger_usb_set_property()
423 struct axp288_chrg_info *info = power_supply_get_drvdata(psy); axp288_charger_usb_get_property() local
426 mutex_lock(&info->lock); axp288_charger_usb_get_property()
431 if (info->otg.id_short) { axp288_charger_usb_get_property()
435 ret = axp288_charger_is_present(info); axp288_charger_usb_get_property()
438 info->present = ret; axp288_charger_usb_get_property()
439 val->intval = info->present; axp288_charger_usb_get_property()
443 if (info->otg.id_short) { axp288_charger_usb_get_property()
447 ret = axp288_charger_is_online(info); axp288_charger_usb_get_property()
450 info->online = ret; axp288_charger_usb_get_property()
451 val->intval = info->online; axp288_charger_usb_get_property()
454 val->intval = axp288_get_charger_health(info); axp288_charger_usb_get_property()
457 val->intval = info->cc * 1000; axp288_charger_usb_get_property()
460 val->intval = info->max_cc * 1000; axp288_charger_usb_get_property()
463 val->intval = info->cv * 1000; axp288_charger_usb_get_property()
466 val->intval = info->max_cv * 1000; axp288_charger_usb_get_property()
469 val->intval = info->inlmt * 1000; axp288_charger_usb_get_property()
477 mutex_unlock(&info->lock); axp288_charger_usb_get_property()
522 struct axp288_chrg_info *info = dev; axp288_charger_irq_thread_handler() local
526 if (info->irq[i] == irq) axp288_charger_irq_thread_handler()
531 dev_warn(&info->pdev->dev, "spurious interrupt!!\n"); axp288_charger_irq_thread_handler()
537 dev_dbg(&info->pdev->dev, "VBUS Over Voltage INTR\n"); axp288_charger_irq_thread_handler()
540 dev_dbg(&info->pdev->dev, "Charging Done INTR\n"); axp288_charger_irq_thread_handler()
543 dev_dbg(&info->pdev->dev, "Start Charging IRQ\n"); axp288_charger_irq_thread_handler()
546 dev_dbg(&info->pdev->dev, axp288_charger_irq_thread_handler()
550 dev_dbg(&info->pdev->dev, axp288_charger_irq_thread_handler()
554 dev_dbg(&info->pdev->dev, axp288_charger_irq_thread_handler()
558 dev_dbg(&info->pdev->dev, axp288_charger_irq_thread_handler()
562 dev_dbg(&info->pdev->dev, axp288_charger_irq_thread_handler()
566 dev_dbg(&info->pdev->dev, axp288_charger_irq_thread_handler()
570 dev_warn(&info->pdev->dev, "Spurious Interrupt!!!\n"); axp288_charger_irq_thread_handler()
574 power_supply_changed(info->psy_usb); axp288_charger_irq_thread_handler()
581 struct axp288_chrg_info *info = axp288_charger_extcon_evt_worker() local
585 struct extcon_dev *edev = info->cable.edev; axp288_charger_extcon_evt_worker()
586 bool old_connected = info->cable.connected; axp288_charger_extcon_evt_worker()
590 dev_dbg(&info->pdev->dev, "USB SDP charger is connected"); axp288_charger_extcon_evt_worker()
591 info->cable.connected = true; axp288_charger_extcon_evt_worker()
592 info->cable.chg_type = POWER_SUPPLY_TYPE_USB; axp288_charger_extcon_evt_worker()
595 dev_dbg(&info->pdev->dev, "USB CDP charger is connected"); axp288_charger_extcon_evt_worker()
596 info->cable.connected = true; axp288_charger_extcon_evt_worker()
597 info->cable.chg_type = POWER_SUPPLY_TYPE_USB_CDP; axp288_charger_extcon_evt_worker()
600 dev_dbg(&info->pdev->dev, "USB DCP charger is connected"); axp288_charger_extcon_evt_worker()
601 info->cable.connected = true; axp288_charger_extcon_evt_worker()
602 info->cable.chg_type = POWER_SUPPLY_TYPE_USB_DCP; axp288_charger_extcon_evt_worker()
605 dev_dbg(&info->pdev->dev, "USB charger disconnected"); axp288_charger_extcon_evt_worker()
606 info->cable.connected = false; axp288_charger_extcon_evt_worker()
607 info->cable.chg_type = POWER_SUPPLY_TYPE_USB; axp288_charger_extcon_evt_worker()
611 if (old_connected != info->cable.connected) axp288_charger_extcon_evt_worker()
617 mutex_lock(&info->lock); axp288_charger_extcon_evt_worker()
619 if (info->is_charger_enabled && !info->cable.connected) { axp288_charger_extcon_evt_worker()
620 info->enable_charger = false; axp288_charger_extcon_evt_worker()
621 ret = axp288_charger_enable_charger(info, info->enable_charger); axp288_charger_extcon_evt_worker()
623 dev_err(&info->pdev->dev, axp288_charger_extcon_evt_worker()
626 } else if (!info->is_charger_enabled && info->cable.connected) { axp288_charger_extcon_evt_worker()
627 switch (info->cable.chg_type) { axp288_charger_extcon_evt_worker()
644 ret = axp288_charger_set_vbus_inlmt(info, current_limit); axp288_charger_extcon_evt_worker()
646 dev_err(&info->pdev->dev, axp288_charger_extcon_evt_worker()
649 info->enable_charger = (current_limit > 0); axp288_charger_extcon_evt_worker()
650 ret = axp288_charger_enable_charger(info, axp288_charger_extcon_evt_worker()
651 info->enable_charger); axp288_charger_extcon_evt_worker()
653 dev_err(&info->pdev->dev, axp288_charger_extcon_evt_worker()
659 info->health = axp288_get_charger_health(info); axp288_charger_extcon_evt_worker()
661 mutex_unlock(&info->lock); axp288_charger_extcon_evt_worker()
664 power_supply_changed(info->psy_usb); axp288_charger_extcon_evt_worker()
670 struct axp288_chrg_info *info = axp288_charger_handle_cable_evt() local
673 schedule_work(&info->cable.work); axp288_charger_handle_cable_evt()
680 struct axp288_chrg_info *info = axp288_charger_otg_evt_worker() local
685 ret = axp288_charger_vbus_path_select(info, !info->otg.id_short); axp288_charger_otg_evt_worker()
687 dev_warn(&info->pdev->dev, "vbus path disable failed\n"); axp288_charger_otg_evt_worker()
693 struct axp288_chrg_info *info = axp288_charger_handle_otg_evt() local
698 dev_dbg(&info->pdev->dev, "external connector USB-Host is %s\n", axp288_charger_handle_otg_evt()
705 info->otg.id_short = usb_host; axp288_charger_handle_otg_evt()
706 schedule_work(&info->otg.work); axp288_charger_handle_otg_evt()
711 static void charger_init_hw_regs(struct axp288_chrg_info *info) charger_init_hw_regs() argument
717 ret = regmap_write(info->regmap, AXP20X_V_LTF_CHRG, CHRG_VLTFC_0C); charger_init_hw_regs()
719 dev_warn(&info->pdev->dev, "register(%x) write error(%d)\n", charger_init_hw_regs()
722 ret = regmap_write(info->regmap, AXP20X_V_HTF_CHRG, CHRG_VHTFC_45C); charger_init_hw_regs()
724 dev_warn(&info->pdev->dev, "register(%x) write error(%d)\n", charger_init_hw_regs()
728 ret = regmap_update_bits(info->regmap, charger_init_hw_regs()
732 dev_warn(&info->pdev->dev, "register(%x) write error(%d)\n", charger_init_hw_regs()
736 ret = regmap_update_bits(info->regmap, charger_init_hw_regs()
740 dev_warn(&info->pdev->dev, "register(%x) write error(%d)\n", charger_init_hw_regs()
743 ret = regmap_update_bits(info->regmap, AXP20X_IRQ3_EN, charger_init_hw_regs()
746 dev_warn(&info->pdev->dev, "register(%x) write error(%d)\n", charger_init_hw_regs()
750 ret = regmap_update_bits(info->regmap, charger_init_hw_regs()
754 dev_warn(&info->pdev->dev, "register(%x) write error(%d)\n", charger_init_hw_regs()
758 ret = regmap_update_bits(info->regmap, charger_init_hw_regs()
762 dev_warn(&info->pdev->dev, "register(%x) write error(%d)\n", charger_init_hw_regs()
766 info->max_cc = info->pdata->max_cc; charger_init_hw_regs()
767 info->max_cv = info->pdata->max_cv; charger_init_hw_regs()
770 ret = regmap_read(info->regmap, AXP20X_CHRG_CTRL1, &val); charger_init_hw_regs()
773 info->cc = info->pdata->def_cc; charger_init_hw_regs()
774 info->cv = info->pdata->def_cv; charger_init_hw_regs()
780 info->cv = CV_4100MV; charger_init_hw_regs()
783 info->cv = CV_4150MV; charger_init_hw_regs()
786 info->cv = CV_4200MV; charger_init_hw_regs()
789 info->cv = CV_4350MV; charger_init_hw_regs()
792 info->cv = INT_MAX; charger_init_hw_regs()
799 info->cc = cc; charger_init_hw_regs()
802 cc = min(info->pdata->def_cc, info->max_cc); charger_init_hw_regs()
803 cv = min(info->pdata->def_cv, info->max_cv); charger_init_hw_regs()
805 ret = axp288_charger_set_cc(info, cc); charger_init_hw_regs()
807 dev_warn(&info->pdev->dev, charger_init_hw_regs()
810 ret = axp288_charger_set_cv(info, cv); charger_init_hw_regs()
812 dev_warn(&info->pdev->dev, charger_init_hw_regs()
820 struct axp288_chrg_info *info; axp288_charger_probe() local
824 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); axp288_charger_probe()
825 if (!info) axp288_charger_probe()
828 info->pdev = pdev; axp288_charger_probe()
829 info->regmap = axp20x->regmap; axp288_charger_probe()
830 info->regmap_irqc = axp20x->regmap_irqc; axp288_charger_probe()
831 info->pdata = pdev->dev.platform_data; axp288_charger_probe()
833 if (!info->pdata) { axp288_charger_probe()
841 info->cable.edev = extcon_get_extcon_dev(AXP288_EXTCON_DEV_NAME); axp288_charger_probe()
842 if (info->cable.edev == NULL) { axp288_charger_probe()
849 INIT_WORK(&info->cable.work, axp288_charger_extcon_evt_worker); axp288_charger_probe()
850 info->cable.nb.notifier_call = axp288_charger_handle_cable_evt; axp288_charger_probe()
851 ret = extcon_register_notifier(info->cable.edev, EXTCON_NONE, &info->cable.nb); axp288_charger_probe()
853 dev_err(&info->pdev->dev, axp288_charger_probe()
858 platform_set_drvdata(pdev, info); axp288_charger_probe()
859 mutex_init(&info->lock); axp288_charger_probe()
862 charger_cfg.drv_data = info; axp288_charger_probe()
863 info->psy_usb = power_supply_register(&pdev->dev, &axp288_charger_desc, axp288_charger_probe()
865 if (IS_ERR(info->psy_usb)) { axp288_charger_probe()
867 ret = PTR_ERR(info->psy_usb); axp288_charger_probe()
872 INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker); axp288_charger_probe()
873 info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt; axp288_charger_probe()
874 ret = extcon_register_interest(&info->otg.cable, NULL, "USB-Host", axp288_charger_probe()
875 &info->otg.id_nb); axp288_charger_probe()
879 if (info->otg.cable.edev) axp288_charger_probe()
880 info->otg.id_short = extcon_get_cable_state( axp288_charger_probe()
881 info->otg.cable.edev, "USB-Host"); axp288_charger_probe()
885 pirq = platform_get_irq(info->pdev, i); axp288_charger_probe()
886 info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq); axp288_charger_probe()
887 if (info->irq[i] < 0) { axp288_charger_probe()
888 dev_warn(&info->pdev->dev, axp288_charger_probe()
890 ret = info->irq[i]; axp288_charger_probe()
893 ret = devm_request_threaded_irq(&info->pdev->dev, info->irq[i], axp288_charger_probe()
895 IRQF_ONESHOT, info->pdev->name, info); axp288_charger_probe()
898 info->irq[i]); axp288_charger_probe()
903 charger_init_hw_regs(info); axp288_charger_probe()
908 if (info->otg.cable.edev) axp288_charger_probe()
909 extcon_unregister_interest(&info->otg.cable); axp288_charger_probe()
910 power_supply_unregister(info->psy_usb); axp288_charger_probe()
912 extcon_unregister_notifier(info->cable.edev, EXTCON_NONE, &info->cable.nb); axp288_charger_probe()
918 struct axp288_chrg_info *info = dev_get_drvdata(&pdev->dev); axp288_charger_remove() local
920 if (info->otg.cable.edev) axp288_charger_remove()
921 extcon_unregister_interest(&info->otg.cable); axp288_charger_remove()
923 extcon_unregister_notifier(info->cable.edev, EXTCON_NONE, &info->cable.nb); axp288_charger_remove()
924 power_supply_unregister(info->psy_usb); axp288_charger_remove()
H A D88pm860x_battery.c157 static int measure_12bit_voltage(struct pm860x_battery_info *info, measure_12bit_voltage() argument
163 ret = pm860x_bulk_read(info->i2c, offset, 2, buf); measure_12bit_voltage()
173 static int measure_vbatt(struct pm860x_battery_info *info, int state, measure_vbatt() argument
181 ret = measure_12bit_voltage(info, PM8607_VBAT_MEAS1, data); measure_vbatt()
197 ret = pm860x_bulk_read(info->i2c, PM8607_LDO5, 5, buf); measure_vbatt()
216 static int measure_current(struct pm860x_battery_info *info, int *data) measure_current() argument
222 ret = pm860x_bulk_read(info->i2c, PM8607_IBAT_MEAS1, 2, buf); measure_current()
232 static int set_charger_current(struct pm860x_battery_info *info, int data, set_charger_current() argument
241 *old = pm860x_reg_read(info->i2c, PM8607_CHG_CTRL2); set_charger_current()
243 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL2, 0x1f, data); set_charger_current()
249 static int read_ccnt(struct pm860x_battery_info *info, int offset, read_ccnt() argument
255 ret = pm860x_set_bits(info->i2c, PM8607_CCNT, 7, offset & 7); read_ccnt()
258 ret = pm860x_bulk_read(info->i2c, PM8607_CCNT_MEAS1, 2, buf); read_ccnt()
267 static int calc_ccnt(struct pm860x_battery_info *info, struct ccnt *ccnt) calc_ccnt() argument
273 ret = read_ccnt(info, CCNT_POS1, &data); calc_ccnt()
277 ret = read_ccnt(info, CCNT_POS2, &data); calc_ccnt()
283 ret = read_ccnt(info, CCNT_NEG1, &data); calc_ccnt()
287 ret = read_ccnt(info, CCNT_NEG2, &data); calc_ccnt()
294 ret = read_ccnt(info, CCNT_SPOS, &data); calc_ccnt()
298 ret = read_ccnt(info, CCNT_SNEG, &data); calc_ccnt()
314 static int clear_ccnt(struct pm860x_battery_info *info, struct ccnt *ccnt) clear_ccnt() argument
320 read_ccnt(info, CCNT_POS1, &data); clear_ccnt()
321 read_ccnt(info, CCNT_POS2, &data); clear_ccnt()
322 read_ccnt(info, CCNT_NEG1, &data); clear_ccnt()
323 read_ccnt(info, CCNT_NEG2, &data); clear_ccnt()
324 read_ccnt(info, CCNT_SPOS, &data); clear_ccnt()
325 read_ccnt(info, CCNT_SNEG, &data); clear_ccnt()
330 static int calc_ocv(struct pm860x_battery_info *info, int *ocv) calc_ocv() argument
344 ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); calc_ocv()
348 ret = measure_current(info, &data); calc_ocv()
356 mutex_lock(&info->lock); calc_ocv()
357 if (info->present) calc_ocv()
358 *ocv = vbatt_avg - ibatt_avg * info->resistor / 1000; calc_ocv()
361 mutex_unlock(&info->lock); calc_ocv()
362 dev_dbg(info->dev, "VBAT average:%d, OCV:%d\n", vbatt_avg, *ocv); calc_ocv()
369 static int calc_soc(struct pm860x_battery_info *info, int state, int *soc) calc_soc() argument
381 ret = calc_ocv(info, &ocv); calc_soc()
384 ret = measure_vbatt(info, OCV_MODE_SLEEP, &ocv); calc_soc()
407 struct pm860x_battery_info *info = data; pm860x_coulomb_handler() local
409 calc_ccnt(info, &ccnt_data); pm860x_coulomb_handler()
415 struct pm860x_battery_info *info = data; pm860x_batt_handler() local
418 mutex_lock(&info->lock); pm860x_batt_handler()
419 ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2); pm860x_batt_handler()
421 info->present = 1; pm860x_batt_handler()
422 info->temp_type = PM860X_TEMP_TBAT; pm860x_batt_handler()
424 info->present = 0; pm860x_batt_handler()
425 info->temp_type = PM860X_TEMP_TINT; pm860x_batt_handler()
427 mutex_unlock(&info->lock); pm860x_batt_handler()
429 clear_ccnt(info, &ccnt_data); pm860x_batt_handler()
433 static void pm860x_init_battery(struct pm860x_battery_info *info) pm860x_init_battery() argument
443 if (info->temp_type == PM860X_TEMP_TINT) pm860x_init_battery()
445 ret = pm860x_set_bits(info->i2c, PM8607_MEAS_EN1, data, data); pm860x_init_battery()
451 ret = pm860x_set_bits(info->i2c, PM8607_MEAS_EN3, data, data); pm860x_init_battery()
456 ret = pm860x_reg_write(info->i2c, PM8607_MEAS_OFF_TIME1, 0x82); pm860x_init_battery()
459 ret = pm860x_reg_write(info->i2c, PM8607_MEAS_OFF_TIME2, 0x6c); pm860x_init_battery()
464 ret = pm860x_set_bits(info->i2c, PM8607_GPADC_MISC1, pm860x_init_battery()
470 ret = pm860x_set_bits(info->i2c, PM8607_CHG_CTRL6, pm860x_init_battery()
475 ret = pm860x_set_bits(info->i2c, PM8607_CCNT, 7 << 3, pm860x_init_battery()
481 ret = pm860x_set_bits(info->i2c, PM8607_GP_BIAS2, 0xF << 4, pm860x_init_battery()
487 mutex_lock(&info->lock); pm860x_init_battery()
488 ret = pm860x_reg_read(info->i2c, PM8607_STATUS_2); pm860x_init_battery()
490 mutex_unlock(&info->lock); pm860x_init_battery()
494 info->present = 1; pm860x_init_battery()
495 info->temp_type = PM860X_TEMP_TBAT; pm860x_init_battery()
497 info->present = 0; pm860x_init_battery()
498 info->temp_type = PM860X_TEMP_TINT; pm860x_init_battery()
500 mutex_unlock(&info->lock); pm860x_init_battery()
502 calc_soc(info, OCV_MODE_ACTIVE, &soc); pm860x_init_battery()
504 data = pm860x_reg_read(info->i2c, PM8607_POWER_UP_LOG); pm860x_init_battery()
507 dev_dbg(info->dev, "battery wake up? %s\n", pm860x_init_battery()
512 buf[0] = pm860x_reg_read(info->i2c, PM8607_RTC_MISC2); pm860x_init_battery()
513 buf[1] = pm860x_reg_read(info->i2c, PM8607_RTC1); pm860x_init_battery()
516 info->start_soc = soc; pm860x_init_battery()
518 info->start_soc = soc; pm860x_init_battery()
520 info->start_soc = data; pm860x_init_battery()
521 dev_dbg(info->dev, "soc_rtc %d, soc_ocv :%d\n", data, soc); pm860x_init_battery()
523 pm860x_set_bits(info->i2c, PM8607_POWER_UP_LOG, pm860x_init_battery()
525 info->start_soc = soc; pm860x_init_battery()
527 info->last_capacity = info->start_soc; pm860x_init_battery()
528 dev_dbg(info->dev, "init soc : %d\n", info->last_capacity); pm860x_init_battery()
533 static void set_temp_threshold(struct pm860x_battery_info *info, set_temp_threshold() argument
543 pm860x_reg_write(info->i2c, PM8607_GPADC1_HIGHTH, data); set_temp_threshold()
544 dev_dbg(info->dev, "TEMP_HIGHTH : min: %d, 0x%x\n", min, data); set_temp_threshold()
550 pm860x_reg_write(info->i2c, PM8607_GPADC1_LOWTH, data); set_temp_threshold()
551 dev_dbg(info->dev, "TEMP_LOWTH:max : %d, 0x%x\n", max, data); set_temp_threshold()
554 static int measure_temp(struct pm860x_battery_info *info, int *data) measure_temp() argument
561 if (info->temp_type == PM860X_TEMP_TINT) { measure_temp()
562 ret = measure_12bit_voltage(info, PM8607_TINT_MEAS1, data); measure_temp()
567 ret = measure_12bit_voltage(info, PM8607_GPADC1_MEAS1, data); measure_temp()
576 set_temp_threshold(info, 0, max); measure_temp()
580 set_temp_threshold(info, 0, max); measure_temp()
585 set_temp_threshold(info, min, max); measure_temp()
590 set_temp_threshold(info, min, max); measure_temp()
595 set_temp_threshold(info, min, max); measure_temp()
600 set_temp_threshold(info, min, max); measure_temp()
605 set_temp_threshold(info, min, max); measure_temp()
608 set_temp_threshold(info, min, 0); measure_temp()
612 dev_dbg(info->dev, "temp_C:%d C,temp_mv:%d mv\n", temp, *data); measure_temp()
618 static int calc_resistor(struct pm860x_battery_info *info) calc_resistor() argument
629 ret = measure_current(info, &data); calc_resistor()
634 ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); calc_resistor()
642 if (set_charger_current(info, 500, &chg_current)) calc_resistor()
652 ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); calc_resistor()
656 ret = measure_current(info, &data); calc_resistor()
666 if (set_charger_current(info, 100, &ret)) calc_resistor()
675 ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); calc_resistor()
679 ret = measure_current(info, &data); calc_resistor()
690 if (set_charger_current(info, chg_current, &ret)) calc_resistor()
698 if ((data - info->resistor > 0) && calc_resistor()
699 (data - info->resistor < info->resistor)) calc_resistor()
700 info->resistor = data; calc_resistor()
701 if ((info->resistor - data > 0) && calc_resistor()
702 (info->resistor - data < data)) calc_resistor()
703 info->resistor = data; calc_resistor()
708 set_charger_current(info, chg_current, &ret); calc_resistor()
713 static int calc_capacity(struct pm860x_battery_info *info, int *cap) calc_capacity() argument
721 ret = calc_ccnt(info, &ccnt_data); calc_capacity()
725 data = info->max_capacity * info->start_soc / 100; calc_capacity()
730 clear_ccnt(info, &ccnt_data); calc_capacity()
731 calc_soc(info, OCV_MODE_ACTIVE, &info->start_soc); calc_capacity()
732 dev_dbg(info->dev, "restart soc = %d !\n", calc_capacity()
733 info->start_soc); calc_capacity()
737 cap_cc = cap_cc * 100 / info->max_capacity; calc_capacity()
743 dev_dbg(info->dev, "%s, last cap : %d", __func__, calc_capacity()
744 info->last_capacity); calc_capacity()
746 ret = measure_current(info, &ibat); calc_capacity()
751 ret = calc_soc(info, OCV_MODE_ACTIVE, &cap_ocv); calc_capacity()
753 cap_ocv = info->last_capacity; calc_capacity()
754 ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); calc_capacity()
776 if (*cap > info->last_capacity) calc_capacity()
777 *cap = info->last_capacity; calc_capacity()
781 info->last_capacity = *cap; calc_capacity()
783 dev_dbg(info->dev, "%s, cap_ocv:%d cap_cc:%d, cap:%d\n", calc_capacity()
790 pm860x_set_bits(info->i2c, PM8607_RTC_MISC2, RTC_SOC_5LSB, calc_capacity()
792 pm860x_set_bits(info->i2c, PM8607_RTC1, RTC_SOC_3MSB, calc_capacity()
801 struct pm860x_battery_info *info = dev_get_drvdata(psy->dev.parent); pm860x_external_power_changed() local
803 calc_resistor(info); pm860x_external_power_changed()
810 struct pm860x_battery_info *info = dev_get_drvdata(psy->dev.parent); pm860x_batt_get_prop() local
816 val->intval = info->present; pm860x_batt_get_prop()
819 ret = calc_capacity(info, &data); pm860x_batt_get_prop()
827 if (!info->present) pm860x_batt_get_prop()
836 ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); pm860x_batt_get_prop()
843 ret = calc_ocv(info, &data); pm860x_batt_get_prop()
849 ret = measure_current(info, &data); pm860x_batt_get_prop()
855 if (info->present) { pm860x_batt_get_prop()
856 ret = measure_temp(info, &data); pm860x_batt_get_prop()
876 struct pm860x_battery_info *info = dev_get_drvdata(psy->dev.parent); pm860x_batt_set_prop() local
880 clear_ccnt(info, &ccnt_data); pm860x_batt_set_prop()
881 info->start_soc = 100; pm860x_batt_set_prop()
882 dev_dbg(info->dev, "chg done, update soc = %d\n", pm860x_batt_set_prop()
883 info->start_soc); pm860x_batt_set_prop()
916 struct pm860x_battery_info *info; pm860x_battery_probe() local
920 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); pm860x_battery_probe()
921 if (!info) pm860x_battery_probe()
924 info->irq_cc = platform_get_irq(pdev, 0); pm860x_battery_probe()
925 if (info->irq_cc <= 0) { pm860x_battery_probe()
930 info->irq_batt = platform_get_irq(pdev, 1); pm860x_battery_probe()
931 if (info->irq_batt <= 0) { pm860x_battery_probe()
936 info->chip = chip; pm860x_battery_probe()
937 info->i2c = pm860x_battery_probe()
939 info->dev = &pdev->dev; pm860x_battery_probe()
940 info->status = POWER_SUPPLY_STATUS_UNKNOWN; pm860x_battery_probe()
943 mutex_init(&info->lock); pm860x_battery_probe()
944 platform_set_drvdata(pdev, info); pm860x_battery_probe()
946 pm860x_init_battery(info); pm860x_battery_probe()
949 info->max_capacity = pdata->max_capacity; pm860x_battery_probe()
951 info->max_capacity = 1500; /* set default capacity */ pm860x_battery_probe()
953 info->resistor = pdata->resistor; pm860x_battery_probe()
955 info->resistor = 300; /* set default internal resistor */ pm860x_battery_probe()
957 info->battery = devm_power_supply_register(&pdev->dev, pm860x_battery_probe()
960 if (IS_ERR(info->battery)) pm860x_battery_probe()
961 return PTR_ERR(info->battery); pm860x_battery_probe()
962 info->battery->dev.parent = &pdev->dev; pm860x_battery_probe()
964 ret = devm_request_threaded_irq(chip->dev, info->irq_cc, NULL, pm860x_battery_probe()
966 "coulomb", info); pm860x_battery_probe()
969 info->irq_cc, ret); pm860x_battery_probe()
973 ret = devm_request_threaded_irq(chip->dev, info->irq_batt, NULL, pm860x_battery_probe()
975 IRQF_ONESHOT, "battery", info); pm860x_battery_probe()
978 info->irq_batt, ret); pm860x_battery_probe()
H A Dltc2941-battery-gauge.c71 const struct ltc294x_info *info, int Q) convert_bin_to_uAh()
73 return ((Q * (info->Qlsb / 10))) / 100; convert_bin_to_uAh()
77 const struct ltc294x_info *info, int uAh) convert_uAh_to_bin()
81 Q = (uAh * 100) / (info->Qlsb/10); convert_uAh_to_bin()
131 static int ltc294x_reset(const struct ltc294x_info *info, int prescaler_exp) ltc294x_reset() argument
138 ret = ltc294x_read_regs(info->client, LTC294X_REG_CONTROL, &value, 1); ltc294x_reset()
140 dev_err(&info->client->dev, ltc294x_reset()
148 if (info->num_regs == LTC2943_NUM_REGS) ltc294x_reset()
152 ret = ltc294x_write_regs(info->client, ltc294x_reset()
155 dev_err(&info->client->dev, ltc294x_reset()
167 static int ltc294x_read_charge_register(const struct ltc294x_info *info) ltc294x_read_charge_register() argument
172 ret = ltc294x_read_regs(info->client, ltc294x_read_charge_register()
179 static int ltc294x_get_charge_now(const struct ltc294x_info *info, int *val) ltc294x_get_charge_now() argument
181 int value = ltc294x_read_charge_register(info); ltc294x_get_charge_now()
186 if (info->Qlsb < 0) ltc294x_get_charge_now()
188 *val = convert_bin_to_uAh(info, value); ltc294x_get_charge_now()
192 static int ltc294x_set_charge_now(const struct ltc294x_info *info, int val) ltc294x_set_charge_now() argument
199 value = convert_uAh_to_bin(info, val); ltc294x_set_charge_now()
201 if (info->Qlsb < 0) ltc294x_set_charge_now()
207 ret = ltc294x_read_regs(info->client, ltc294x_set_charge_now()
213 ret = ltc294x_write_regs(info->client, ltc294x_set_charge_now()
220 ret = ltc294x_write_regs(info->client, ltc294x_set_charge_now()
227 ret = ltc294x_write_regs(info->client, ltc294x_set_charge_now()
234 const struct ltc294x_info *info, int *val) ltc294x_get_charge_counter()
236 int value = ltc294x_read_charge_register(info); ltc294x_get_charge_counter()
241 *val = convert_bin_to_uAh(info, value); ltc294x_get_charge_counter()
245 static int ltc294x_get_voltage(const struct ltc294x_info *info, int *val) ltc294x_get_voltage() argument
251 ret = ltc294x_read_regs(info->client, ltc294x_get_voltage()
258 static int ltc294x_get_current(const struct ltc294x_info *info, int *val) ltc294x_get_current() argument
264 ret = ltc294x_read_regs(info->client, ltc294x_get_current()
271 *val = 1000 * ((60000 * value) / (info->r_sense * 0x7FFF)); /* in uA */ ltc294x_get_current()
275 static int ltc294x_get_temperature(const struct ltc294x_info *info, int *val) ltc294x_get_temperature() argument
281 ret = ltc294x_read_regs(info->client, ltc294x_get_temperature()
293 struct ltc294x_info *info = power_supply_get_drvdata(psy); ltc294x_get_property() local
297 return ltc294x_get_charge_now(info, &val->intval); ltc294x_get_property()
299 return ltc294x_get_charge_counter(info, &val->intval); ltc294x_get_property()
301 return ltc294x_get_voltage(info, &val->intval); ltc294x_get_property()
303 return ltc294x_get_current(info, &val->intval); ltc294x_get_property()
305 return ltc294x_get_temperature(info, &val->intval); ltc294x_get_property()
315 struct ltc294x_info *info = power_supply_get_drvdata(psy); ltc294x_set_property() local
319 return ltc294x_set_charge_now(info, val->intval); ltc294x_set_property()
336 static void ltc294x_update(struct ltc294x_info *info) ltc294x_update() argument
338 int charge = ltc294x_read_charge_register(info); ltc294x_update()
340 if (charge != info->charge) { ltc294x_update()
341 info->charge = charge; ltc294x_update()
342 power_supply_changed(info->supply); ltc294x_update()
348 struct ltc294x_info *info; ltc294x_work() local
350 info = container_of(work, struct ltc294x_info, work.work); ltc294x_work()
351 ltc294x_update(info); ltc294x_work()
352 schedule_delayed_work(&info->work, LTC294X_WORK_DELAY * HZ); ltc294x_work()
365 struct ltc294x_info *info = i2c_get_clientdata(client); ltc294x_i2c_remove() local
367 cancel_delayed_work(&info->work); ltc294x_i2c_remove()
368 power_supply_unregister(info->supply); ltc294x_i2c_remove()
376 struct ltc294x_info *info; ltc294x_i2c_probe() local
382 info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); ltc294x_i2c_probe()
383 if (info == NULL) ltc294x_i2c_probe()
386 i2c_set_clientdata(client, info); ltc294x_i2c_probe()
390 info->num_regs = id->driver_data; ltc294x_i2c_probe()
391 info->supply_desc.name = np->name; ltc294x_i2c_probe()
401 info->r_sense = r_sense; ltc294x_i2c_probe()
411 if (info->num_regs == LTC2943_NUM_REGS) { ltc294x_i2c_probe()
414 info->Qlsb = ((340 * 50000) / r_sense) / ltc294x_i2c_probe()
419 info->Qlsb = ((85 * 50000) / r_sense) / ltc294x_i2c_probe()
423 info->client = client; ltc294x_i2c_probe()
424 info->supply_desc.type = POWER_SUPPLY_TYPE_BATTERY; ltc294x_i2c_probe()
425 info->supply_desc.properties = ltc294x_properties; ltc294x_i2c_probe()
426 if (info->num_regs >= LTC294X_REG_TEMPERATURE_LSB) ltc294x_i2c_probe()
427 info->supply_desc.num_properties = ltc294x_i2c_probe()
429 else if (info->num_regs >= LTC294X_REG_CURRENT_LSB) ltc294x_i2c_probe()
430 info->supply_desc.num_properties = ltc294x_i2c_probe()
432 else if (info->num_regs >= LTC294X_REG_VOLTAGE_LSB) ltc294x_i2c_probe()
433 info->supply_desc.num_properties = ltc294x_i2c_probe()
436 info->supply_desc.num_properties = ltc294x_i2c_probe()
438 info->supply_desc.get_property = ltc294x_get_property; ltc294x_i2c_probe()
439 info->supply_desc.set_property = ltc294x_set_property; ltc294x_i2c_probe()
440 info->supply_desc.property_is_writeable = ltc294x_property_is_writeable; ltc294x_i2c_probe()
441 info->supply_desc.external_power_changed = NULL; ltc294x_i2c_probe()
443 psy_cfg.drv_data = info; ltc294x_i2c_probe()
445 INIT_DELAYED_WORK(&info->work, ltc294x_work); ltc294x_i2c_probe()
447 ret = ltc294x_reset(info, prescaler_exp); ltc294x_i2c_probe()
453 info->supply = power_supply_register(&client->dev, &info->supply_desc, ltc294x_i2c_probe()
455 if (IS_ERR(info->supply)) { ltc294x_i2c_probe()
457 return PTR_ERR(info->supply); ltc294x_i2c_probe()
459 schedule_delayed_work(&info->work, LTC294X_WORK_DELAY * HZ); ltc294x_i2c_probe()
470 struct ltc294x_info *info = i2c_get_clientdata(client); ltc294x_suspend() local
472 cancel_delayed_work(&info->work); ltc294x_suspend()
479 struct ltc294x_info *info = i2c_get_clientdata(client); ltc294x_resume() local
481 schedule_delayed_work(&info->work, LTC294X_WORK_DELAY * HZ); ltc294x_resume()
70 convert_bin_to_uAh( const struct ltc294x_info *info, int Q) convert_bin_to_uAh() argument
76 convert_uAh_to_bin( const struct ltc294x_info *info, int uAh) convert_uAh_to_bin() argument
233 ltc294x_get_charge_counter( const struct ltc294x_info *info, int *val) ltc294x_get_charge_counter() argument
H A Dds2782_battery.c51 int (*get_battery_current)(struct ds278x_info *info, int *current_uA);
52 int (*get_battery_voltage)(struct ds278x_info *info, int *voltage_uV);
53 int (*get_battery_capacity)(struct ds278x_info *info, int *capacity);
73 static inline int ds278x_read_reg(struct ds278x_info *info, int reg, u8 *val) ds278x_read_reg() argument
77 ret = i2c_smbus_read_byte_data(info->client, reg); ds278x_read_reg()
79 dev_err(&info->client->dev, "register read failed\n"); ds278x_read_reg()
87 static inline int ds278x_read_reg16(struct ds278x_info *info, int reg_msb, ds278x_read_reg16() argument
92 ret = i2c_smbus_read_word_data(info->client, reg_msb); ds278x_read_reg16()
94 dev_err(&info->client->dev, "register read failed\n"); ds278x_read_reg16()
102 static int ds278x_get_temp(struct ds278x_info *info, int *temp) ds278x_get_temp() argument
113 err = ds278x_read_reg16(info, DS278x_REG_TEMP_MSB, &raw); ds278x_get_temp()
120 static int ds2782_get_current(struct ds278x_info *info, int *current_uA) ds2782_get_current() argument
131 err = ds278x_read_reg(info, DS2782_REG_RSNSP, &sense_res_raw); ds2782_get_current()
135 dev_err(&info->client->dev, "sense resistor value is 0\n"); ds2782_get_current()
140 dev_dbg(&info->client->dev, "sense resistor = %d milli-ohms\n", ds2782_get_current()
142 err = ds278x_read_reg16(info, DS278x_REG_CURRENT_MSB, &raw); ds2782_get_current()
149 static int ds2782_get_voltage(struct ds278x_info *info, int *voltage_uV) ds2782_get_voltage() argument
158 err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw); ds2782_get_voltage()
165 static int ds2782_get_capacity(struct ds278x_info *info, int *capacity) ds2782_get_capacity() argument
170 err = ds278x_read_reg(info, DS2782_REG_RARC, &raw); ds2782_get_capacity()
177 static int ds2786_get_current(struct ds278x_info *info, int *current_uA) ds2786_get_current() argument
182 err = ds278x_read_reg16(info, DS278x_REG_CURRENT_MSB, &raw); ds2786_get_current()
185 *current_uA = (raw / 16) * (DS2786_CURRENT_UNITS / info->rsns); ds2786_get_current()
189 static int ds2786_get_voltage(struct ds278x_info *info, int *voltage_uV) ds2786_get_voltage() argument
198 err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw); ds2786_get_voltage()
205 static int ds2786_get_capacity(struct ds278x_info *info, int *capacity) ds2786_get_capacity() argument
210 err = ds278x_read_reg(info, DS2786_REG_RARC, &raw); ds2786_get_capacity()
218 static int ds278x_get_status(struct ds278x_info *info, int *status) ds278x_get_status() argument
224 err = info->ops->get_battery_current(info, &current_uA); ds278x_get_status()
228 err = info->ops->get_battery_capacity(info, &capacity); ds278x_get_status()
232 info->capacity = capacity; ds278x_get_status()
250 struct ds278x_info *info = to_ds278x_info(psy); ds278x_battery_get_property() local
255 ret = ds278x_get_status(info, &val->intval); ds278x_battery_get_property()
259 ret = info->ops->get_battery_capacity(info, &val->intval); ds278x_battery_get_property()
263 ret = info->ops->get_battery_voltage(info, &val->intval); ds278x_battery_get_property()
267 ret = info->ops->get_battery_current(info, &val->intval); ds278x_battery_get_property()
271 ret = ds278x_get_temp(info, &val->intval); ds278x_battery_get_property()
281 static void ds278x_bat_update(struct ds278x_info *info) ds278x_bat_update() argument
283 int old_status = info->status; ds278x_bat_update()
284 int old_capacity = info->capacity; ds278x_bat_update()
286 ds278x_get_status(info, &info->status); ds278x_bat_update()
288 if ((old_status != info->status) || (old_capacity != info->capacity)) ds278x_bat_update()
289 power_supply_changed(info->battery); ds278x_bat_update()
294 struct ds278x_info *info; ds278x_bat_work() local
296 info = container_of(work, struct ds278x_info, bat_work.work); ds278x_bat_work()
297 ds278x_bat_update(info); ds278x_bat_work()
299 schedule_delayed_work(&info->bat_work, DS278x_DELAY); ds278x_bat_work()
321 struct ds278x_info *info = i2c_get_clientdata(client); ds278x_battery_remove() local
323 power_supply_unregister(info->battery); ds278x_battery_remove()
324 kfree(info->battery_desc.name); ds278x_battery_remove()
327 idr_remove(&battery_id, info->id); ds278x_battery_remove()
330 cancel_delayed_work(&info->bat_work); ds278x_battery_remove()
332 kfree(info); ds278x_battery_remove()
341 struct ds278x_info *info = i2c_get_clientdata(client); ds278x_suspend() local
343 cancel_delayed_work(&info->bat_work); ds278x_suspend()
350 struct ds278x_info *info = i2c_get_clientdata(client); ds278x_resume() local
352 schedule_delayed_work(&info->bat_work, DS278x_DELAY); ds278x_resume()
382 struct ds278x_info *info; ds278x_battery_probe() local
403 info = kzalloc(sizeof(*info), GFP_KERNEL); ds278x_battery_probe()
404 if (!info) { ds278x_battery_probe()
409 info->battery_desc.name = kasprintf(GFP_KERNEL, "%s-%d", ds278x_battery_probe()
411 if (!info->battery_desc.name) { ds278x_battery_probe()
417 info->rsns = pdata->rsns; ds278x_battery_probe()
419 i2c_set_clientdata(client, info); ds278x_battery_probe()
420 info->client = client; ds278x_battery_probe()
421 info->id = num; ds278x_battery_probe()
422 info->ops = &ds278x_ops[id->driver_data]; ds278x_battery_probe()
423 ds278x_power_supply_init(&info->battery_desc); ds278x_battery_probe()
424 psy_cfg.drv_data = info; ds278x_battery_probe()
426 info->capacity = 100; ds278x_battery_probe()
427 info->status = POWER_SUPPLY_STATUS_FULL; ds278x_battery_probe()
429 INIT_DELAYED_WORK(&info->bat_work, ds278x_bat_work); ds278x_battery_probe()
431 info->battery = power_supply_register(&client->dev, ds278x_battery_probe()
432 &info->battery_desc, &psy_cfg); ds278x_battery_probe()
433 if (IS_ERR(info->battery)) { ds278x_battery_probe()
435 ret = PTR_ERR(info->battery); ds278x_battery_probe()
438 schedule_delayed_work(&info->bat_work, DS278x_DELAY); ds278x_battery_probe()
444 kfree(info->battery_desc.name); ds278x_battery_probe()
446 kfree(info); ds278x_battery_probe()
H A Daxp288_fuel_gauge.c160 static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg) fuel_gauge_reg_readb() argument
166 ret = regmap_read(info->regmap, reg, &val); fuel_gauge_reg_readb()
174 dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret); fuel_gauge_reg_readb()
179 static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val) fuel_gauge_reg_writeb() argument
183 ret = regmap_write(info->regmap, reg, (unsigned int)val); fuel_gauge_reg_writeb()
186 dev_err(&info->pdev->dev, "axp288 reg write err:%d\n", ret); fuel_gauge_reg_writeb()
192 struct axp288_fg_info *info) pmic_read_adc_val()
204 dev_err(&info->pdev->dev, pmic_read_adc_val()
209 dev_dbg(&info->pdev->dev, "adc raw val=%x\n", val); pmic_read_adc_val()
221 struct axp288_fg_info *info = s->private; fuel_gauge_debug_show() local
226 fuel_gauge_reg_readb(info, AXP20X_PWR_INPUT_STATUS)); fuel_gauge_debug_show()
229 fuel_gauge_reg_readb(info, AXP20X_PWR_OP_MODE)); fuel_gauge_debug_show()
232 fuel_gauge_reg_readb(info, AXP20X_CHRG_CTRL1)); fuel_gauge_debug_show()
235 fuel_gauge_reg_readb(info, AXP20X_V_LTF_DISCHRG)); fuel_gauge_debug_show()
238 fuel_gauge_reg_readb(info, AXP20X_V_HTF_DISCHRG)); fuel_gauge_debug_show()
241 fuel_gauge_reg_readb(info, AXP20X_CC_CTRL)); fuel_gauge_debug_show()
244 fuel_gauge_reg_readb(info, AXP20X_FG_RES)); fuel_gauge_debug_show()
247 fuel_gauge_reg_readb(info, AXP288_FG_RDC1_REG)); fuel_gauge_debug_show()
250 fuel_gauge_reg_readb(info, AXP288_FG_RDC0_REG)); fuel_gauge_debug_show()
253 fuel_gauge_reg_readb(info, AXP288_FG_OCVH_REG)); fuel_gauge_debug_show()
256 fuel_gauge_reg_readb(info, AXP288_FG_OCVL_REG)); fuel_gauge_debug_show()
259 fuel_gauge_reg_readb(info, AXP288_FG_DES_CAP1_REG)); fuel_gauge_debug_show()
262 fuel_gauge_reg_readb(info, AXP288_FG_DES_CAP0_REG)); fuel_gauge_debug_show()
265 fuel_gauge_reg_readb(info, AXP288_FG_CC_MTR1_REG)); fuel_gauge_debug_show()
268 fuel_gauge_reg_readb(info, AXP288_FG_CC_MTR0_REG)); fuel_gauge_debug_show()
271 fuel_gauge_reg_readb(info, AXP288_FG_OCV_CAP_REG)); fuel_gauge_debug_show()
274 fuel_gauge_reg_readb(info, AXP288_FG_CC_CAP_REG)); fuel_gauge_debug_show()
277 fuel_gauge_reg_readb(info, AXP288_FG_LOW_CAP_REG)); fuel_gauge_debug_show()
280 fuel_gauge_reg_readb(info, AXP288_FG_TUNE0)); fuel_gauge_debug_show()
283 fuel_gauge_reg_readb(info, AXP288_FG_TUNE1)); fuel_gauge_debug_show()
286 fuel_gauge_reg_readb(info, AXP288_FG_TUNE2)); fuel_gauge_debug_show()
289 fuel_gauge_reg_readb(info, AXP288_FG_TUNE3)); fuel_gauge_debug_show()
292 fuel_gauge_reg_readb(info, AXP288_FG_TUNE4)); fuel_gauge_debug_show()
295 fuel_gauge_reg_readb(info, AXP288_FG_TUNE5)); fuel_gauge_debug_show()
297 ret = pmic_read_adc_val("axp288-batt-temp", &raw_val, info); fuel_gauge_debug_show()
300 ret = pmic_read_adc_val("axp288-pmic-temp", &raw_val, info); fuel_gauge_debug_show()
303 ret = pmic_read_adc_val("axp288-system-temp", &raw_val, info); fuel_gauge_debug_show()
306 ret = pmic_read_adc_val("axp288-chrg-curr", &raw_val, info); fuel_gauge_debug_show()
309 ret = pmic_read_adc_val("axp288-chrg-d-curr", &raw_val, info); fuel_gauge_debug_show()
312 ret = pmic_read_adc_val("axp288-batt-volt", &raw_val, info); fuel_gauge_debug_show()
331 static void fuel_gauge_create_debugfs(struct axp288_fg_info *info) fuel_gauge_create_debugfs() argument
333 info->debug_file = debugfs_create_file("fuelgauge", 0666, NULL, fuel_gauge_create_debugfs()
334 info, &fg_debug_fops); fuel_gauge_create_debugfs()
337 static void fuel_gauge_remove_debugfs(struct axp288_fg_info *info) fuel_gauge_remove_debugfs() argument
339 debugfs_remove(info->debug_file); fuel_gauge_remove_debugfs()
342 static inline void fuel_gauge_create_debugfs(struct axp288_fg_info *info) fuel_gauge_create_debugfs() argument
345 static inline void fuel_gauge_remove_debugfs(struct axp288_fg_info *info) fuel_gauge_remove_debugfs() argument
350 static void fuel_gauge_get_status(struct axp288_fg_info *info) fuel_gauge_get_status() argument
355 pwr_stat = fuel_gauge_reg_readb(info, AXP20X_PWR_INPUT_STATUS); fuel_gauge_get_status()
357 dev_err(&info->pdev->dev, fuel_gauge_get_status()
361 ret = pmic_read_adc_val("axp288-chrg-curr", &charge, info); fuel_gauge_get_status()
363 dev_err(&info->pdev->dev, fuel_gauge_get_status()
367 ret = pmic_read_adc_val("axp288-chrg-d-curr", &discharge, info); fuel_gauge_get_status()
369 dev_err(&info->pdev->dev, fuel_gauge_get_status()
375 info->status = POWER_SUPPLY_STATUS_CHARGING; fuel_gauge_get_status()
377 info->status = POWER_SUPPLY_STATUS_DISCHARGING; fuel_gauge_get_status()
380 info->status = POWER_SUPPLY_STATUS_FULL; fuel_gauge_get_status()
382 info->status = POWER_SUPPLY_STATUS_NOT_CHARGING; fuel_gauge_get_status()
386 static int fuel_gauge_get_vbatt(struct axp288_fg_info *info, int *vbatt) fuel_gauge_get_vbatt() argument
390 ret = pmic_read_adc_val("axp288-batt-volt", &raw_val, info); fuel_gauge_get_vbatt()
399 static int fuel_gauge_get_current(struct axp288_fg_info *info, int *cur) fuel_gauge_get_current() argument
404 ret = pmic_read_adc_val("axp288-chrg-curr", &charge, info); fuel_gauge_get_current()
407 ret = pmic_read_adc_val("axp288-chrg-d-curr", &discharge, info); fuel_gauge_get_current()
421 static int temp_to_adc(struct axp288_fg_info *info, int tval) temp_to_adc() argument
425 int tcsz = info->pdata->tcsz; temp_to_adc()
428 if (tval > info->pdata->thermistor_curve[0][1]) { temp_to_adc()
429 rntc = info->pdata->thermistor_curve[0][0]; temp_to_adc()
430 } else if (tval <= info->pdata->thermistor_curve[tcsz-1][1]) { temp_to_adc()
431 rntc = info->pdata->thermistor_curve[tcsz-1][0]; temp_to_adc()
434 if (tval > info->pdata->thermistor_curve[i][1]) { temp_to_adc()
435 rmin = info->pdata->thermistor_curve[i-1][0]; temp_to_adc()
436 rmax = info->pdata->thermistor_curve[i][0]; temp_to_adc()
437 tmin = info->pdata->thermistor_curve[i-1][1]; temp_to_adc()
438 tmax = info->pdata->thermistor_curve[i][1]; temp_to_adc()
447 ret = fuel_gauge_reg_readb(info, AXP20X_ADC_RATE); temp_to_adc()
449 dev_err(&info->pdev->dev, "%s:read err:%d\n", __func__, ret); temp_to_adc()
463 static int adc_to_temp(struct axp288_fg_info *info, int adc_val) adc_to_temp() argument
467 int tcsz = info->pdata->tcsz; adc_to_temp()
469 ret = fuel_gauge_reg_readb(info, AXP20X_ADC_RATE); adc_to_temp()
471 dev_err(&info->pdev->dev, "%s:read err:%d\n", __func__, ret); adc_to_temp()
482 if (r < info->pdata->thermistor_curve[0][0]) { adc_to_temp()
483 tval = info->pdata->thermistor_curve[0][1]; adc_to_temp()
484 } else if (r >= info->pdata->thermistor_curve[tcsz-1][0]) { adc_to_temp()
485 tval = info->pdata->thermistor_curve[tcsz-1][1]; adc_to_temp()
488 if (r < info->pdata->thermistor_curve[i][0]) { adc_to_temp()
489 rmin = info->pdata->thermistor_curve[i-1][0]; adc_to_temp()
490 rmax = info->pdata->thermistor_curve[i][0]; adc_to_temp()
491 tmin = info->pdata->thermistor_curve[i-1][1]; adc_to_temp()
492 tmax = info->pdata->thermistor_curve[i][1]; adc_to_temp()
503 static int fuel_gauge_get_btemp(struct axp288_fg_info *info, int *btemp) fuel_gauge_get_btemp() argument
507 ret = pmic_read_adc_val("axp288-batt-temp", &raw_val, info); fuel_gauge_get_btemp()
511 *btemp = adc_to_temp(info, raw_val); fuel_gauge_get_btemp()
517 static int fuel_gauge_get_vocv(struct axp288_fg_info *info, int *vocv) fuel_gauge_get_vocv() argument
522 ret = fuel_gauge_reg_readb(info, AXP288_FG_OCVH_REG); fuel_gauge_get_vocv()
527 ret = fuel_gauge_reg_readb(info, AXP288_FG_OCVL_REG); fuel_gauge_get_vocv()
537 static int fuel_gauge_battery_health(struct axp288_fg_info *info) fuel_gauge_battery_health() argument
542 ret = fuel_gauge_get_btemp(info, &temp); fuel_gauge_battery_health()
546 ret = fuel_gauge_get_vocv(info, &vocv); fuel_gauge_battery_health()
550 if (vocv > info->pdata->max_volt) fuel_gauge_battery_health()
552 else if (temp > info->pdata->max_temp) fuel_gauge_battery_health()
554 else if (temp < info->pdata->min_temp) fuel_gauge_battery_health()
556 else if (vocv < info->pdata->min_volt) fuel_gauge_battery_health()
565 static int fuel_gauge_set_high_btemp_alert(struct axp288_fg_info *info) fuel_gauge_set_high_btemp_alert() argument
570 adc_val = temp_to_adc(info, info->pdata->max_temp); fuel_gauge_set_high_btemp_alert()
571 ret = fuel_gauge_reg_writeb(info, AXP20X_V_HTF_DISCHRG, adc_val >> 4); fuel_gauge_set_high_btemp_alert()
576 static int fuel_gauge_set_low_btemp_alert(struct axp288_fg_info *info) fuel_gauge_set_low_btemp_alert() argument
581 adc_val = temp_to_adc(info, info->pdata->min_temp); fuel_gauge_set_low_btemp_alert()
582 ret = fuel_gauge_reg_writeb(info, AXP20X_V_LTF_DISCHRG, adc_val >> 4); fuel_gauge_set_low_btemp_alert()
591 struct axp288_fg_info *info = power_supply_get_drvdata(ps); fuel_gauge_get_property() local
594 mutex_lock(&info->lock); fuel_gauge_get_property()
597 fuel_gauge_get_status(info); fuel_gauge_get_property()
598 val->intval = info->status; fuel_gauge_get_property()
601 val->intval = fuel_gauge_battery_health(info); fuel_gauge_get_property()
604 ret = fuel_gauge_get_vbatt(info, &value); fuel_gauge_get_property()
610 ret = fuel_gauge_get_vocv(info, &value); fuel_gauge_get_property()
616 ret = fuel_gauge_get_current(info, &value); fuel_gauge_get_property()
622 ret = fuel_gauge_reg_readb(info, AXP20X_PWR_OP_MODE); fuel_gauge_get_property()
632 ret = fuel_gauge_reg_readb(info, AXP20X_FG_RES); fuel_gauge_get_property()
637 dev_err(&info->pdev->dev, fuel_gauge_get_property()
642 ret = fuel_gauge_reg_readb(info, AXP288_FG_LOW_CAP_REG); fuel_gauge_get_property()
648 ret = fuel_gauge_get_btemp(info, &value); fuel_gauge_get_property()
655 val->intval = PROP_TEMP(info->pdata->max_temp); fuel_gauge_get_property()
659 val->intval = PROP_TEMP(info->pdata->min_temp); fuel_gauge_get_property()
665 ret = fuel_gauge_reg_readb(info, AXP288_FG_CC_MTR1_REG); fuel_gauge_get_property()
670 ret = fuel_gauge_reg_readb(info, AXP288_FG_CC_MTR0_REG); fuel_gauge_get_property()
677 ret = fuel_gauge_reg_readb(info, AXP288_FG_DES_CAP1_REG); fuel_gauge_get_property()
682 ret = fuel_gauge_reg_readb(info, AXP288_FG_DES_CAP0_REG); fuel_gauge_get_property()
689 val->intval = PROP_CURR(info->pdata->design_cap); fuel_gauge_get_property()
692 val->intval = PROP_VOLT(info->pdata->max_volt); fuel_gauge_get_property()
695 val->intval = PROP_VOLT(info->pdata->min_volt); fuel_gauge_get_property()
698 val->strval = info->pdata->battid; fuel_gauge_get_property()
701 mutex_unlock(&info->lock); fuel_gauge_get_property()
705 mutex_unlock(&info->lock); fuel_gauge_get_property()
709 mutex_unlock(&info->lock); fuel_gauge_get_property()
717 struct axp288_fg_info *info = power_supply_get_drvdata(ps); fuel_gauge_set_property() local
720 mutex_lock(&info->lock); fuel_gauge_set_property()
723 info->status = val->intval; fuel_gauge_set_property()
732 info->pdata->min_temp = UNPROP_TEMP(val->intval); fuel_gauge_set_property()
733 ret = fuel_gauge_set_low_btemp_alert(info); fuel_gauge_set_property()
735 dev_err(&info->pdev->dev, fuel_gauge_set_property()
745 info->pdata->max_temp = UNPROP_TEMP(val->intval); fuel_gauge_set_property()
746 ret = fuel_gauge_set_high_btemp_alert(info); fuel_gauge_set_property()
748 dev_err(&info->pdev->dev, fuel_gauge_set_property()
756 ret = fuel_gauge_reg_readb(info, AXP288_FG_LOW_CAP_REG); fuel_gauge_set_property()
761 ret = fuel_gauge_reg_writeb(info, AXP288_FG_LOW_CAP_REG, ret); fuel_gauge_set_property()
768 mutex_unlock(&info->lock); fuel_gauge_set_property()
795 struct axp288_fg_info *info = container_of(work, fuel_gauge_status_monitor() local
798 fuel_gauge_get_status(info); fuel_gauge_status_monitor()
799 power_supply_changed(info->bat); fuel_gauge_status_monitor()
800 schedule_delayed_work(&info->status_monitor, STATUS_MON_DELAY_JIFFIES); fuel_gauge_status_monitor()
805 struct axp288_fg_info *info = dev; fuel_gauge_thread_handler() local
809 if (info->irq[i] == irq) fuel_gauge_thread_handler()
814 dev_warn(&info->pdev->dev, "spurious interrupt!!\n"); fuel_gauge_thread_handler()
820 dev_info(&info->pdev->dev, fuel_gauge_thread_handler()
824 dev_info(&info->pdev->dev, fuel_gauge_thread_handler()
828 dev_info(&info->pdev->dev, fuel_gauge_thread_handler()
832 dev_info(&info->pdev->dev, fuel_gauge_thread_handler()
836 dev_info(&info->pdev->dev, "Low Batt Warning(2) INTR\n"); fuel_gauge_thread_handler()
839 dev_info(&info->pdev->dev, "Low Batt Warning(1) INTR\n"); fuel_gauge_thread_handler()
842 dev_warn(&info->pdev->dev, "Spurious Interrupt!!!\n"); fuel_gauge_thread_handler()
845 power_supply_changed(info->bat); fuel_gauge_thread_handler()
851 struct axp288_fg_info *info = power_supply_get_drvdata(psy); fuel_gauge_external_power_changed() local
853 power_supply_changed(info->bat); fuel_gauge_external_power_changed()
867 static int fuel_gauge_set_lowbatt_thresholds(struct axp288_fg_info *info) fuel_gauge_set_lowbatt_thresholds() argument
872 ret = fuel_gauge_reg_readb(info, AXP20X_FG_RES); fuel_gauge_set_lowbatt_thresholds()
874 dev_err(&info->pdev->dev, "%s:read err:%d\n", __func__, ret); fuel_gauge_set_lowbatt_thresholds()
887 ret = fuel_gauge_reg_writeb(info, AXP288_FG_LOW_CAP_REG, reg_val); fuel_gauge_set_lowbatt_thresholds()
889 dev_err(&info->pdev->dev, "%s:write err:%d\n", __func__, ret); fuel_gauge_set_lowbatt_thresholds()
894 static int fuel_gauge_program_vbatt_full(struct axp288_fg_info *info) fuel_gauge_program_vbatt_full() argument
899 ret = fuel_gauge_reg_readb(info, AXP20X_CHRG_CTRL1); fuel_gauge_program_vbatt_full()
905 switch (info->pdata->max_volt) { fuel_gauge_program_vbatt_full()
923 ret = fuel_gauge_reg_writeb(info, AXP20X_CHRG_CTRL1, val); fuel_gauge_program_vbatt_full()
928 static int fuel_gauge_program_design_cap(struct axp288_fg_info *info) fuel_gauge_program_design_cap() argument
932 ret = fuel_gauge_reg_writeb(info, fuel_gauge_program_design_cap()
933 AXP288_FG_DES_CAP1_REG, info->pdata->cap1); fuel_gauge_program_design_cap()
937 ret = fuel_gauge_reg_writeb(info, fuel_gauge_program_design_cap()
938 AXP288_FG_DES_CAP0_REG, info->pdata->cap0); fuel_gauge_program_design_cap()
944 static int fuel_gauge_program_ocv_curve(struct axp288_fg_info *info) fuel_gauge_program_ocv_curve() argument
949 ret = fuel_gauge_reg_writeb(info, fuel_gauge_program_ocv_curve()
950 AXP288_FG_OCV_CURVE_REG + i, info->pdata->ocv_curve[i]); fuel_gauge_program_ocv_curve()
959 static int fuel_gauge_program_rdc_vals(struct axp288_fg_info *info) fuel_gauge_program_rdc_vals() argument
963 ret = fuel_gauge_reg_writeb(info, fuel_gauge_program_rdc_vals()
964 AXP288_FG_RDC1_REG, info->pdata->rdc1); fuel_gauge_program_rdc_vals()
968 ret = fuel_gauge_reg_writeb(info, fuel_gauge_program_rdc_vals()
969 AXP288_FG_RDC0_REG, info->pdata->rdc0); fuel_gauge_program_rdc_vals()
975 static void fuel_gauge_init_config_regs(struct axp288_fg_info *info) fuel_gauge_init_config_regs() argument
984 ret = fuel_gauge_reg_readb(info, AXP288_FG_DES_CAP1_REG); fuel_gauge_init_config_regs()
986 dev_warn(&info->pdev->dev, "CAP1 reg read err!!\n"); fuel_gauge_init_config_regs()
988 dev_info(&info->pdev->dev, "FG data needs to be initialized\n"); fuel_gauge_init_config_regs()
990 dev_info(&info->pdev->dev, "FG data is already initialized\n"); fuel_gauge_init_config_regs()
994 ret = fuel_gauge_program_vbatt_full(info); fuel_gauge_init_config_regs()
996 dev_err(&info->pdev->dev, "set vbatt full fail:%d\n", ret); fuel_gauge_init_config_regs()
998 ret = fuel_gauge_program_design_cap(info); fuel_gauge_init_config_regs()
1000 dev_err(&info->pdev->dev, "set design cap fail:%d\n", ret); fuel_gauge_init_config_regs()
1002 ret = fuel_gauge_program_rdc_vals(info); fuel_gauge_init_config_regs()
1004 dev_err(&info->pdev->dev, "set rdc fail:%d\n", ret); fuel_gauge_init_config_regs()
1006 ret = fuel_gauge_program_ocv_curve(info); fuel_gauge_init_config_regs()
1008 dev_err(&info->pdev->dev, "set ocv curve fail:%d\n", ret); fuel_gauge_init_config_regs()
1010 ret = fuel_gauge_set_lowbatt_thresholds(info); fuel_gauge_init_config_regs()
1012 dev_err(&info->pdev->dev, "lowbatt thr set fail:%d\n", ret); fuel_gauge_init_config_regs()
1014 ret = fuel_gauge_reg_writeb(info, AXP20X_CC_CTRL, 0xef); fuel_gauge_init_config_regs()
1016 dev_err(&info->pdev->dev, "gauge cntl set fail:%d\n", ret); fuel_gauge_init_config_regs()
1019 static void fuel_gauge_init_irq(struct axp288_fg_info *info) fuel_gauge_init_irq() argument
1024 pirq = platform_get_irq(info->pdev, i); fuel_gauge_init_irq()
1025 info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq); fuel_gauge_init_irq()
1026 if (info->irq[i] < 0) { fuel_gauge_init_irq()
1027 dev_warn(&info->pdev->dev, fuel_gauge_init_irq()
1029 pirq, info->irq[i]); fuel_gauge_init_irq()
1030 info->irq[i] = -1; fuel_gauge_init_irq()
1033 ret = request_threaded_irq(info->irq[i], fuel_gauge_init_irq()
1035 IRQF_ONESHOT, DEV_NAME, info); fuel_gauge_init_irq()
1037 dev_warn(&info->pdev->dev, fuel_gauge_init_irq()
1039 pirq, info->irq[i]); fuel_gauge_init_irq()
1040 info->irq[i] = -1; fuel_gauge_init_irq()
1043 dev_info(&info->pdev->dev, "HW IRQ %d -> VIRQ %d\n", fuel_gauge_init_irq()
1044 pirq, info->irq[i]); fuel_gauge_init_irq()
1051 free_irq(info->irq[i - 1], info); fuel_gauge_init_irq()
1052 info->irq[i - 1] = -1; fuel_gauge_init_irq()
1056 static void fuel_gauge_init_hw_regs(struct axp288_fg_info *info) fuel_gauge_init_hw_regs() argument
1061 ret = fuel_gauge_set_high_btemp_alert(info); fuel_gauge_init_hw_regs()
1063 dev_err(&info->pdev->dev, "high batt temp set fail:%d\n", ret); fuel_gauge_init_hw_regs()
1065 ret = fuel_gauge_set_low_btemp_alert(info); fuel_gauge_init_hw_regs()
1067 dev_err(&info->pdev->dev, "low batt temp set fail:%d\n", ret); fuel_gauge_init_hw_regs()
1070 val = fuel_gauge_reg_readb(info, AXP20X_IRQ3_EN); fuel_gauge_init_hw_regs()
1072 fuel_gauge_reg_writeb(info, AXP20X_IRQ3_EN, val); fuel_gauge_init_hw_regs()
1074 val = fuel_gauge_reg_readb(info, AXP20X_IRQ4_EN); fuel_gauge_init_hw_regs()
1076 val = fuel_gauge_reg_writeb(info, AXP20X_IRQ4_EN, val); fuel_gauge_init_hw_regs()
1082 struct axp288_fg_info *info; axp288_fuel_gauge_probe() local
1086 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); axp288_fuel_gauge_probe()
1087 if (!info) axp288_fuel_gauge_probe()
1090 info->pdev = pdev; axp288_fuel_gauge_probe()
1091 info->regmap = axp20x->regmap; axp288_fuel_gauge_probe()
1092 info->regmap_irqc = axp20x->regmap_irqc; axp288_fuel_gauge_probe()
1093 info->status = POWER_SUPPLY_STATUS_UNKNOWN; axp288_fuel_gauge_probe()
1094 info->pdata = pdev->dev.platform_data; axp288_fuel_gauge_probe()
1095 if (!info->pdata) axp288_fuel_gauge_probe()
1098 platform_set_drvdata(pdev, info); axp288_fuel_gauge_probe()
1100 mutex_init(&info->lock); axp288_fuel_gauge_probe()
1101 INIT_DELAYED_WORK(&info->status_monitor, fuel_gauge_status_monitor); axp288_fuel_gauge_probe()
1103 psy_cfg.drv_data = info; axp288_fuel_gauge_probe()
1104 info->bat = power_supply_register(&pdev->dev, &fuel_gauge_desc, &psy_cfg); axp288_fuel_gauge_probe()
1105 if (IS_ERR(info->bat)) { axp288_fuel_gauge_probe()
1106 ret = PTR_ERR(info->bat); axp288_fuel_gauge_probe()
1111 fuel_gauge_create_debugfs(info); axp288_fuel_gauge_probe()
1112 fuel_gauge_init_config_regs(info); axp288_fuel_gauge_probe()
1113 fuel_gauge_init_irq(info); axp288_fuel_gauge_probe()
1114 fuel_gauge_init_hw_regs(info); axp288_fuel_gauge_probe()
1115 schedule_delayed_work(&info->status_monitor, STATUS_MON_DELAY_JIFFIES); axp288_fuel_gauge_probe()
1127 struct axp288_fg_info *info = platform_get_drvdata(pdev); axp288_fuel_gauge_remove() local
1130 cancel_delayed_work_sync(&info->status_monitor); axp288_fuel_gauge_remove()
1131 power_supply_unregister(info->bat); axp288_fuel_gauge_remove()
1132 fuel_gauge_remove_debugfs(info); axp288_fuel_gauge_remove()
1135 if (info->irq[i] >= 0) axp288_fuel_gauge_remove()
1136 free_irq(info->irq[i], info); axp288_fuel_gauge_remove()
191 pmic_read_adc_val(const char *name, int *raw_val, struct axp288_fg_info *info) pmic_read_adc_val() argument
H A Dmax8925_power.c88 static int __set_charger(struct max8925_power_info *info, int enable) __set_charger() argument
90 struct max8925_chip *chip = info->chip; __set_charger()
93 if (info->set_charger) __set_charger()
94 info->set_charger(1); __set_charger()
96 max8925_set_bits(info->gpm, MAX8925_CHG_CNTL1, 1 << 7, 0); __set_charger()
99 max8925_set_bits(info->gpm, MAX8925_CHG_CNTL1, 1 << 7, 1 << 7); __set_charger()
100 if (info->set_charger) __set_charger()
101 info->set_charger(0); __set_charger()
110 struct max8925_power_info *info = (struct max8925_power_info *)data; max8925_charger_handler() local
111 struct max8925_chip *chip = info->chip; max8925_charger_handler()
115 info->ac_online = 1; max8925_charger_handler()
116 __set_charger(info, 1); max8925_charger_handler()
120 info->ac_online = 0; max8925_charger_handler()
121 __set_charger(info, 0); max8925_charger_handler()
129 __set_charger(info, 0); max8925_charger_handler()
143 __set_charger(info, 0); max8925_charger_handler()
150 __set_charger(info, 0); max8925_charger_handler()
154 __set_charger(info, 0); max8925_charger_handler()
161 static int start_measure(struct max8925_power_info *info, int type) start_measure() argument
188 max8925_reg_write(info->adc, meas_cmd, 0); start_measure()
189 max8925_bulk_read(info->adc, meas_reg, 2, buf); start_measure()
199 struct max8925_power_info *info = dev_get_drvdata(psy->dev.parent); max8925_ac_get_prop() local
204 val->intval = info->ac_online; max8925_ac_get_prop()
207 if (info->ac_online) { max8925_ac_get_prop()
208 ret = start_measure(info, MEASURE_VCHG); max8925_ac_get_prop()
233 struct max8925_power_info *info = dev_get_drvdata(psy->dev.parent); max8925_usb_get_prop() local
238 val->intval = info->usb_online; max8925_usb_get_prop()
241 if (info->usb_online) { max8925_usb_get_prop()
242 ret = start_measure(info, MEASURE_VCHG); max8925_usb_get_prop()
267 struct max8925_power_info *info = dev_get_drvdata(psy->dev.parent); max8925_bat_get_prop() local
272 val->intval = info->bat_online; max8925_bat_get_prop()
275 if (info->bat_online) { max8925_bat_get_prop()
276 ret = start_measure(info, MEASURE_VMBATT); max8925_bat_get_prop()
286 if (info->bat_online) { max8925_bat_get_prop()
287 ret = start_measure(info, MEASURE_ISNS); max8925_bat_get_prop()
301 if (!info->bat_online) { max8925_bat_get_prop()
305 ret = max8925_reg_read(info->gpm, MAX8925_CHG_STATUS); max8925_bat_get_prop()
322 if (!info->bat_online) { max8925_bat_get_prop()
326 ret = max8925_reg_read(info->gpm, MAX8925_CHG_STATUS); max8925_bat_get_prop()
327 if (info->usb_online || info->ac_online) { max8925_bat_get_prop()
378 IRQF_ONESHOT, _name, info); \
385 struct max8925_power_info *info) max8925_init_charger()
390 if (!info->no_insert_detect) { max8925_init_charger()
394 if (!info->no_temp_support) { max8925_init_charger()
405 info->usb_online = 0; max8925_init_charger()
406 info->bat_online = 0; max8925_init_charger()
409 if (start_measure(info, MEASURE_VCHG) * 2000 > 500000) max8925_init_charger()
410 info->ac_online = 1; max8925_init_charger()
412 info->ac_online = 0; max8925_init_charger()
414 ret = max8925_reg_read(info->gpm, MAX8925_CHG_STATUS); max8925_init_charger()
422 if (info->batt_detect) max8925_init_charger()
423 info->bat_online = (ret & MAX8925_CHG_MBDET) ? 0 : 1; max8925_init_charger()
425 info->bat_online = 1; max8925_init_charger()
427 info->ac_online = 1; max8925_init_charger()
429 info->ac_online = 0; max8925_init_charger()
432 max8925_set_bits(info->gpm, MAX8925_CHG_CNTL1, 1 << 7, 1 << 7); max8925_init_charger()
434 max8925_set_bits(info->gpm, MAX8925_CHG_CNTL1, 3 << 5, max8925_init_charger()
435 info->topoff_threshold << 5); max8925_init_charger()
437 max8925_set_bits(info->gpm, MAX8925_CHG_CNTL1, 7, info->fast_charge); max8925_init_charger()
442 static int max8925_deinit_charger(struct max8925_power_info *info) max8925_deinit_charger() argument
444 struct max8925_chip *chip = info->chip; max8925_deinit_charger()
449 free_irq(irq, info); max8925_deinit_charger()
511 struct max8925_power_info *info; max8925_power_probe() local
521 info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_power_info), max8925_power_probe()
523 if (!info) max8925_power_probe()
525 info->chip = chip; max8925_power_probe()
526 info->gpm = chip->i2c; max8925_power_probe()
527 info->adc = chip->adc; max8925_power_probe()
528 platform_set_drvdata(pdev, info); max8925_power_probe()
533 info->ac = power_supply_register(&pdev->dev, &ac_desc, &psy_cfg); max8925_power_probe()
534 if (IS_ERR(info->ac)) { max8925_power_probe()
535 ret = PTR_ERR(info->ac); max8925_power_probe()
538 info->ac->dev.parent = &pdev->dev; max8925_power_probe()
540 info->usb = power_supply_register(&pdev->dev, &usb_desc, &psy_cfg); max8925_power_probe()
541 if (IS_ERR(info->usb)) { max8925_power_probe()
542 ret = PTR_ERR(info->usb); max8925_power_probe()
545 info->usb->dev.parent = &pdev->dev; max8925_power_probe()
547 info->battery = power_supply_register(&pdev->dev, &battery_desc, NULL); max8925_power_probe()
548 if (IS_ERR(info->battery)) { max8925_power_probe()
549 ret = PTR_ERR(info->battery); max8925_power_probe()
552 info->battery->dev.parent = &pdev->dev; max8925_power_probe()
554 info->batt_detect = pdata->batt_detect; max8925_power_probe()
555 info->topoff_threshold = pdata->topoff_threshold; max8925_power_probe()
556 info->fast_charge = pdata->fast_charge; max8925_power_probe()
557 info->set_charger = pdata->set_charger; max8925_power_probe()
558 info->no_temp_support = pdata->no_temp_support; max8925_power_probe()
559 info->no_insert_detect = pdata->no_insert_detect; max8925_power_probe()
561 max8925_init_charger(chip, info); max8925_power_probe()
564 power_supply_unregister(info->battery); max8925_power_probe()
566 power_supply_unregister(info->ac); max8925_power_probe()
573 struct max8925_power_info *info = platform_get_drvdata(pdev); max8925_power_remove() local
575 if (info) { max8925_power_remove()
576 power_supply_unregister(info->ac); max8925_power_remove()
577 power_supply_unregister(info->usb); max8925_power_remove()
578 power_supply_unregister(info->battery); max8925_power_remove()
579 max8925_deinit_charger(info); max8925_power_remove()
384 max8925_init_charger(struct max8925_chip *chip, struct max8925_power_info *info) max8925_init_charger() argument
H A Dz2_battery.c24 struct z2_battery_info *info; member in struct:z2_charger
37 charger->info->batt_I2C_reg); z2_read_bat()
41 return data * charger->info->batt_mult / charger->info->batt_div; z2_read_bat()
49 struct z2_battery_info *info = charger->info; z2_batt_get_property() local
56 val->intval = info->batt_tech; z2_batt_get_property()
59 if (info->batt_I2C_reg >= 0) z2_batt_get_property()
65 if (info->max_voltage >= 0) z2_batt_get_property()
66 val->intval = info->max_voltage; z2_batt_get_property()
71 if (info->min_voltage >= 0) z2_batt_get_property()
72 val->intval = info->min_voltage; z2_batt_get_property()
96 struct z2_battery_info *info; z2_batt_update() local
98 info = charger->info; z2_batt_update()
102 charger->bat_status = (info->charge_gpio >= 0) ? z2_batt_update()
103 (gpio_get_value(info->charge_gpio) ? z2_batt_update()
136 struct z2_battery_info *info = charger->info; z2_batt_ps_init() local
138 if (info->charge_gpio >= 0) z2_batt_ps_init()
140 if (info->batt_tech >= 0) z2_batt_ps_init()
142 if (info->batt_I2C_reg >= 0) z2_batt_ps_init()
144 if (info->max_voltage >= 0) z2_batt_ps_init()
146 if (info->min_voltage >= 0) z2_batt_ps_init()
154 if (info->charge_gpio >= 0) z2_batt_ps_init()
156 if (info->batt_tech >= 0) z2_batt_ps_init()
158 if (info->batt_I2C_reg >= 0) z2_batt_ps_init()
160 if (info->max_voltage >= 0) z2_batt_ps_init()
162 if (info->min_voltage >= 0) z2_batt_ps_init()
165 if (!info->batt_name) { z2_batt_ps_init()
172 charger->batt_ps_desc.name = info->batt_name; z2_batt_ps_init()
191 struct z2_battery_info *info = client->dev.platform_data; z2_batt_probe() local
194 if (info == NULL) { z2_batt_probe()
206 charger->info = info; z2_batt_probe()
213 if (info->charge_gpio >= 0 && gpio_is_valid(info->charge_gpio)) { z2_batt_probe()
214 ret = gpio_request(info->charge_gpio, "BATT CHRG"); z2_batt_probe()
218 ret = gpio_direction_input(info->charge_gpio); z2_batt_probe()
222 irq_set_irq_type(gpio_to_irq(info->charge_gpio), z2_batt_probe()
224 ret = request_irq(gpio_to_irq(info->charge_gpio), z2_batt_probe()
252 if (info->charge_gpio >= 0 && gpio_is_valid(info->charge_gpio)) z2_batt_probe()
253 free_irq(gpio_to_irq(info->charge_gpio), charger); z2_batt_probe()
255 if (info->charge_gpio >= 0 && gpio_is_valid(info->charge_gpio)) z2_batt_probe()
256 gpio_free(info->charge_gpio); z2_batt_probe()
265 struct z2_battery_info *info = charger->info; z2_batt_remove() local
271 if (info->charge_gpio >= 0 && gpio_is_valid(info->charge_gpio)) { z2_batt_remove()
272 free_irq(gpio_to_irq(info->charge_gpio), charger); z2_batt_remove()
273 gpio_free(info->charge_gpio); z2_batt_remove()
/linux-4.4.14/drivers/video/fbdev/
H A Dep93xx-fb.c152 static void ep93xxfb_set_video_attribs(struct fb_info *info) ep93xxfb_set_video_attribs() argument
154 struct ep93xx_fbi *fbi = info->par; ep93xxfb_set_video_attribs()
162 static int ep93xxfb_set_pixelmode(struct fb_info *info) ep93xxfb_set_pixelmode() argument
164 struct ep93xx_fbi *fbi = info->par; ep93xxfb_set_pixelmode()
167 info->var.transp.offset = 0; ep93xxfb_set_pixelmode()
168 info->var.transp.length = 0; ep93xxfb_set_pixelmode()
170 switch (info->var.bits_per_pixel) { ep93xxfb_set_pixelmode()
175 info->var.red.offset = 0; ep93xxfb_set_pixelmode()
176 info->var.red.length = 8; ep93xxfb_set_pixelmode()
177 info->var.green.offset = 0; ep93xxfb_set_pixelmode()
178 info->var.green.length = 8; ep93xxfb_set_pixelmode()
179 info->var.blue.offset = 0; ep93xxfb_set_pixelmode()
180 info->var.blue.length = 8; ep93xxfb_set_pixelmode()
181 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; ep93xxfb_set_pixelmode()
188 info->var.red.offset = 11; ep93xxfb_set_pixelmode()
189 info->var.red.length = 5; ep93xxfb_set_pixelmode()
190 info->var.green.offset = 5; ep93xxfb_set_pixelmode()
191 info->var.green.length = 6; ep93xxfb_set_pixelmode()
192 info->var.blue.offset = 0; ep93xxfb_set_pixelmode()
193 info->var.blue.length = 5; ep93xxfb_set_pixelmode()
194 info->fix.visual = FB_VISUAL_TRUECOLOR; ep93xxfb_set_pixelmode()
201 info->var.red.offset = 16; ep93xxfb_set_pixelmode()
202 info->var.red.length = 8; ep93xxfb_set_pixelmode()
203 info->var.green.offset = 8; ep93xxfb_set_pixelmode()
204 info->var.green.length = 8; ep93xxfb_set_pixelmode()
205 info->var.blue.offset = 0; ep93xxfb_set_pixelmode()
206 info->var.blue.length = 8; ep93xxfb_set_pixelmode()
207 info->fix.visual = FB_VISUAL_TRUECOLOR; ep93xxfb_set_pixelmode()
214 info->var.red.offset = 16; ep93xxfb_set_pixelmode()
215 info->var.red.length = 8; ep93xxfb_set_pixelmode()
216 info->var.green.offset = 8; ep93xxfb_set_pixelmode()
217 info->var.green.length = 8; ep93xxfb_set_pixelmode()
218 info->var.blue.offset = 0; ep93xxfb_set_pixelmode()
219 info->var.blue.length = 8; ep93xxfb_set_pixelmode()
220 info->fix.visual = FB_VISUAL_TRUECOLOR; ep93xxfb_set_pixelmode()
231 static void ep93xxfb_set_timing(struct fb_info *info) ep93xxfb_set_timing() argument
233 struct ep93xx_fbi *fbi = info->par; ep93xxfb_set_timing()
236 vlines_total = info->var.yres + info->var.upper_margin + ep93xxfb_set_timing()
237 info->var.lower_margin + info->var.vsync_len - 1; ep93xxfb_set_timing()
239 hclks_total = info->var.xres + info->var.left_margin + ep93xxfb_set_timing()
240 info->var.right_margin + info->var.hsync_len - 1; ep93xxfb_set_timing()
246 stop = vlines_total - info->var.vsync_len; ep93xxfb_set_timing()
249 start = vlines_total - info->var.vsync_len - info->var.upper_margin; ep93xxfb_set_timing()
250 stop = info->var.lower_margin - 1; ep93xxfb_set_timing()
259 stop = hclks_total - info->var.hsync_len; ep93xxfb_set_timing()
262 start = hclks_total - info->var.hsync_len - info->var.left_margin; ep93xxfb_set_timing()
263 stop = info->var.right_margin - 1; ep93xxfb_set_timing()
274 static int ep93xxfb_set_par(struct fb_info *info) ep93xxfb_set_par() argument
276 struct ep93xx_fbi *fbi = info->par; ep93xxfb_set_par()
278 clk_set_rate(fbi->clk, 1000 * PICOS2KHZ(info->var.pixclock)); ep93xxfb_set_par()
280 ep93xxfb_set_timing(info); ep93xxfb_set_par()
282 info->fix.line_length = info->var.xres_virtual * ep93xxfb_set_par()
283 info->var.bits_per_pixel / 8; ep93xxfb_set_par()
285 ep93xxfb_writel(fbi, info->fix.smem_start, EP93XXFB_SCREEN_PAGE); ep93xxfb_set_par()
286 ep93xxfb_writel(fbi, info->var.yres - 1, EP93XXFB_SCREEN_LINES); ep93xxfb_set_par()
287 ep93xxfb_writel(fbi, ((info->var.xres * info->var.bits_per_pixel) ep93xxfb_set_par()
289 ep93xxfb_writel(fbi, info->fix.line_length / 4, EP93XXFB_VLINE_STEP); ep93xxfb_set_par()
290 ep93xxfb_set_video_attribs(info); ep93xxfb_set_par()
295 struct fb_info *info) ep93xxfb_check_var()
299 err = ep93xxfb_set_pixelmode(info); ep93xxfb_check_var()
314 static int ep93xxfb_mmap(struct fb_info *info, struct vm_area_struct *vma) ep93xxfb_mmap() argument
318 if (offset < info->fix.smem_len) { ep93xxfb_mmap()
319 return dma_mmap_writecombine(info->dev, vma, info->screen_base, ep93xxfb_mmap()
320 info->fix.smem_start, ep93xxfb_mmap()
321 info->fix.smem_len); ep93xxfb_mmap()
327 static int ep93xxfb_blank(int blank_mode, struct fb_info *info) ep93xxfb_blank() argument
329 struct ep93xx_fbi *fbi = info->par; ep93xxfb_blank()
334 fbi->mach_info->blank(blank_mode, info); ep93xxfb_blank()
343 fbi->mach_info->blank(blank_mode, info); ep93xxfb_blank()
356 unsigned int transp, struct fb_info *info) ep93xxfb_setcolreg()
358 struct ep93xx_fbi *fbi = info->par; ep93xxfb_setcolreg()
359 unsigned int *pal = info->pseudo_palette; ep93xxfb_setcolreg()
362 switch (info->fix.visual) { ep93xxfb_setcolreg()
391 red = ep93xxfb_convert_color(red, info->var.red.length); ep93xxfb_setcolreg()
392 green = ep93xxfb_convert_color(green, info->var.green.length); ep93xxfb_setcolreg()
393 blue = ep93xxfb_convert_color(blue, info->var.blue.length); ep93xxfb_setcolreg()
395 info->var.transp.length); ep93xxfb_setcolreg()
397 pal[regno] = (red << info->var.red.offset) | ep93xxfb_setcolreg()
398 (green << info->var.green.offset) | ep93xxfb_setcolreg()
399 (blue << info->var.blue.offset) | ep93xxfb_setcolreg()
400 (transp << info->var.transp.offset); ep93xxfb_setcolreg()
422 static int ep93xxfb_alloc_videomem(struct fb_info *info) ep93xxfb_alloc_videomem() argument
431 virt_addr = dma_alloc_writecombine(info->dev, fb_size, ep93xxfb_alloc_videomem()
439 * See: http://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2 ep93xxfb_alloc_videomem()
445 dev_err(info->dev, "ep93xx framebuffer bug. phys addr (0x%x) " ep93xxfb_alloc_videomem()
449 dma_free_coherent(info->dev, fb_size, virt_addr, phys_addr); ep93xxfb_alloc_videomem()
453 info->fix.smem_start = phys_addr; ep93xxfb_alloc_videomem()
454 info->fix.smem_len = fb_size; ep93xxfb_alloc_videomem()
455 info->screen_base = virt_addr; ep93xxfb_alloc_videomem()
460 static void ep93xxfb_dealloc_videomem(struct fb_info *info) ep93xxfb_dealloc_videomem() argument
462 if (info->screen_base) ep93xxfb_dealloc_videomem()
463 dma_free_coherent(info->dev, info->fix.smem_len, ep93xxfb_dealloc_videomem()
464 info->screen_base, info->fix.smem_start); ep93xxfb_dealloc_videomem()
470 struct fb_info *info; ep93xxfb_probe() local
479 info = framebuffer_alloc(sizeof(struct ep93xx_fbi), &pdev->dev); ep93xxfb_probe()
480 if (!info) ep93xxfb_probe()
483 info->dev = &pdev->dev; ep93xxfb_probe()
484 platform_set_drvdata(pdev, info); ep93xxfb_probe()
485 fbi = info->par; ep93xxfb_probe()
488 err = fb_alloc_cmap(&info->cmap, 256, 0); ep93xxfb_probe()
492 err = ep93xxfb_alloc_videomem(info); ep93xxfb_probe()
519 strcpy(info->fix.id, pdev->name); ep93xxfb_probe()
520 info->fbops = &ep93xxfb_ops; ep93xxfb_probe()
521 info->fix.type = FB_TYPE_PACKED_PIXELS; ep93xxfb_probe()
522 info->fix.accel = FB_ACCEL_NONE; ep93xxfb_probe()
523 info->var.activate = FB_ACTIVATE_NOW; ep93xxfb_probe()
524 info->var.vmode = FB_VMODE_NONINTERLACED; ep93xxfb_probe()
525 info->flags = FBINFO_DEFAULT; ep93xxfb_probe()
526 info->node = -1; ep93xxfb_probe()
527 info->state = FBINFO_STATE_RUNNING; ep93xxfb_probe()
528 info->pseudo_palette = &fbi->pseudo_palette; ep93xxfb_probe()
531 err = fb_find_mode(&info->var, info, video_mode, ep93xxfb_probe()
534 dev_err(info->dev, "No suitable video mode found\n"); ep93xxfb_probe()
545 err = ep93xxfb_check_var(&info->var, info); ep93xxfb_probe()
556 ep93xxfb_set_par(info); ep93xxfb_probe()
559 err = register_framebuffer(info); ep93xxfb_probe()
563 dev_info(info->dev, "registered. Mode = %dx%d-%d\n", ep93xxfb_probe()
564 info->var.xres, info->var.yres, info->var.bits_per_pixel); ep93xxfb_probe()
571 ep93xxfb_dealloc_videomem(info); ep93xxfb_probe()
573 fb_dealloc_cmap(&info->cmap); ep93xxfb_probe()
575 kfree(info); ep93xxfb_probe()
582 struct fb_info *info = platform_get_drvdata(pdev); ep93xxfb_remove() local
583 struct ep93xx_fbi *fbi = info->par; ep93xxfb_remove()
585 unregister_framebuffer(info); ep93xxfb_remove()
587 ep93xxfb_dealloc_videomem(info); ep93xxfb_remove()
588 fb_dealloc_cmap(&info->cmap); ep93xxfb_remove()
593 kfree(info); ep93xxfb_remove()
294 ep93xxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ep93xxfb_check_var() argument
354 ep93xxfb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, unsigned int blue, unsigned int transp, struct fb_info *info) ep93xxfb_setcolreg() argument
H A Dcobalt_lcdfb.c67 static inline void lcd_write_control(struct fb_info *info, u8 control) lcd_write_control() argument
69 writel((u32)control << 24, info->screen_base); lcd_write_control()
72 static inline u8 lcd_read_control(struct fb_info *info) lcd_read_control() argument
74 return readl(info->screen_base) >> 24; lcd_read_control()
77 static inline void lcd_write_data(struct fb_info *info, u8 data) lcd_write_data() argument
79 writel((u32)data << 24, info->screen_base + LCD_DATA_REG_OFFSET); lcd_write_data()
82 static inline u8 lcd_read_data(struct fb_info *info) lcd_read_data() argument
84 return readl(info->screen_base + LCD_DATA_REG_OFFSET) >> 24; lcd_read_data()
93 static inline void cpld_wait(struct fb_info *info) cpld_wait() argument
96 } while (readl(info->screen_base + CPLD_STATUS) & 1); cpld_wait()
99 static inline void lcd_write_control(struct fb_info *info, u8 control) lcd_write_control() argument
101 cpld_wait(info); lcd_write_control()
102 writel(control, info->screen_base + LCD_CTL); lcd_write_control()
105 static inline u8 lcd_read_control(struct fb_info *info) lcd_read_control() argument
107 cpld_wait(info); lcd_read_control()
108 readl(info->screen_base + LCD_CTL); lcd_read_control()
109 cpld_wait(info); lcd_read_control()
110 return readl(info->screen_base + CPLD_DATA) & 0xff; lcd_read_control()
113 static inline void lcd_write_data(struct fb_info *info, u8 data) lcd_write_data() argument
115 cpld_wait(info); lcd_write_data()
116 writel(data, info->screen_base + LCD_DATA); lcd_write_data()
119 static inline u8 lcd_read_data(struct fb_info *info) lcd_read_data() argument
121 cpld_wait(info); lcd_read_data()
122 readl(info->screen_base + LCD_DATA); lcd_read_data()
123 cpld_wait(info); lcd_read_data()
124 return readl(info->screen_base + CPLD_DATA) & 0xff; lcd_read_data()
128 static int lcd_busy_wait(struct fb_info *info) lcd_busy_wait() argument
134 val = lcd_read_control(info); lcd_busy_wait()
151 static void lcd_clear(struct fb_info *info) lcd_clear() argument
158 lcd_write_control(info, LCD_PRERESET); lcd_clear()
163 lcd_write_control(info, LCD_CLEAR); lcd_clear()
167 lcd_write_control(info, LCD_RESET); lcd_clear()
179 static ssize_t cobalt_lcdfb_read(struct fb_info *info, char __user *buf, cobalt_lcdfb_read() argument
197 retval = lcd_busy_wait(info); cobalt_lcdfb_read()
201 lcd_write_control(info, LCD_TEXT_POS(pos)); cobalt_lcdfb_read()
203 retval = lcd_busy_wait(info); cobalt_lcdfb_read()
207 src[len] = lcd_read_data(info); cobalt_lcdfb_read()
225 static ssize_t cobalt_lcdfb_write(struct fb_info *info, const char __user *buf, cobalt_lcdfb_write() argument
246 retval = lcd_busy_wait(info); cobalt_lcdfb_write()
250 lcd_write_control(info, LCD_TEXT_POS(pos)); cobalt_lcdfb_write()
252 retval = lcd_busy_wait(info); cobalt_lcdfb_write()
256 lcd_write_data(info, dst[len]); cobalt_lcdfb_write()
271 static int cobalt_lcdfb_blank(int blank_mode, struct fb_info *info) cobalt_lcdfb_blank() argument
275 retval = lcd_busy_wait(info); cobalt_lcdfb_blank()
281 lcd_write_control(info, LCD_ON); cobalt_lcdfb_blank()
284 lcd_write_control(info, LCD_OFF); cobalt_lcdfb_blank()
291 static int cobalt_lcdfb_cursor(struct fb_info *info, struct fb_cursor *cursor) cobalt_lcdfb_cursor() argument
303 retval = lcd_busy_wait(info); cobalt_lcdfb_cursor()
307 lcd_write_control(info, cobalt_lcdfb_cursor()
308 LCD_TEXT_POS(info->fix.line_length * y + x)); cobalt_lcdfb_cursor()
314 retval = lcd_busy_wait(info); cobalt_lcdfb_cursor()
319 lcd_write_control(info, LCD_CURSOR_ON); cobalt_lcdfb_cursor()
321 lcd_write_control(info, LCD_CURSOR_OFF); cobalt_lcdfb_cursor()
336 struct fb_info *info; cobalt_lcdfb_probe() local
340 info = framebuffer_alloc(0, &dev->dev); cobalt_lcdfb_probe()
341 if (!info) cobalt_lcdfb_probe()
346 framebuffer_release(info); cobalt_lcdfb_probe()
350 info->screen_size = resource_size(res); cobalt_lcdfb_probe()
351 info->screen_base = devm_ioremap(&dev->dev, res->start, cobalt_lcdfb_probe()
352 info->screen_size); cobalt_lcdfb_probe()
353 info->fbops = &cobalt_lcd_fbops; cobalt_lcdfb_probe()
354 info->fix = cobalt_lcdfb_fix; cobalt_lcdfb_probe()
355 info->fix.smem_start = res->start; cobalt_lcdfb_probe()
356 info->fix.smem_len = info->screen_size; cobalt_lcdfb_probe()
357 info->pseudo_palette = NULL; cobalt_lcdfb_probe()
358 info->par = NULL; cobalt_lcdfb_probe()
359 info->flags = FBINFO_DEFAULT; cobalt_lcdfb_probe()
361 retval = register_framebuffer(info); cobalt_lcdfb_probe()
363 framebuffer_release(info); cobalt_lcdfb_probe()
367 platform_set_drvdata(dev, info); cobalt_lcdfb_probe()
369 lcd_clear(info); cobalt_lcdfb_probe()
371 fb_info(info, "Cobalt server LCD frame buffer device\n"); cobalt_lcdfb_probe()
378 struct fb_info *info; cobalt_lcdfb_remove() local
380 info = platform_get_drvdata(dev); cobalt_lcdfb_remove()
381 if (info) { cobalt_lcdfb_remove()
382 unregister_framebuffer(info); cobalt_lcdfb_remove()
383 framebuffer_release(info); cobalt_lcdfb_remove()
H A Dvt8623fb.c114 static void vt8623fb_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor) vt8623fb_tilecursor() argument
116 struct vt8623fb_info *par = info->par; vt8623fb_tilecursor()
118 svga_tilecursor(par->state.vgabase, info, cursor); vt8623fb_tilecursor()
141 static void vt8623fb_iplan_imageblit(struct fb_info *info, const struct fb_image *image) vt8623fb_iplan_imageblit() argument
152 dst1 = info->screen_base + (image->dy * info->fix.line_length) vt8623fb_iplan_imageblit()
164 dst1 += info->fix.line_length; vt8623fb_iplan_imageblit()
169 static void vt8623fb_iplan_fillrect(struct fb_info *info, const struct fb_fillrect *rect) vt8623fb_iplan_fillrect() argument
176 dst1 = info->screen_base + (rect->dy * info->fix.line_length) vt8623fb_iplan_fillrect()
184 dst1 += info->fix.line_length; vt8623fb_iplan_fillrect()
197 static void vt8623fb_cfb4_imageblit(struct fb_info *info, const struct fb_image *image) vt8623fb_cfb4_imageblit() argument
208 dst1 = info->screen_base + (image->dy * info->fix.line_length) vt8623fb_cfb4_imageblit()
220 dst1 += info->fix.line_length; vt8623fb_cfb4_imageblit()
224 static void vt8623fb_imageblit(struct fb_info *info, const struct fb_image *image) vt8623fb_imageblit() argument
226 if ((info->var.bits_per_pixel == 4) && (image->depth == 1) vt8623fb_imageblit()
228 if (info->fix.type == FB_TYPE_INTERLEAVED_PLANES) vt8623fb_imageblit()
229 vt8623fb_iplan_imageblit(info, image); vt8623fb_imageblit()
231 vt8623fb_cfb4_imageblit(info, image); vt8623fb_imageblit()
233 cfb_imageblit(info, image); vt8623fb_imageblit()
236 static void vt8623fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) vt8623fb_fillrect() argument
238 if ((info->var.bits_per_pixel == 4) vt8623fb_fillrect()
240 && (info->fix.type == FB_TYPE_INTERLEAVED_PLANES)) vt8623fb_fillrect()
241 vt8623fb_iplan_fillrect(info, rect); vt8623fb_fillrect()
243 cfb_fillrect(info, rect); vt8623fb_fillrect()
250 static void vt8623_set_pixclock(struct fb_info *info, u32 pixclock) vt8623_set_pixclock() argument
252 struct vt8623fb_info *par = info->par; vt8623_set_pixclock()
257 rv = svga_compute_pll(&vt8623_pll, 1000000000 / pixclock, &m, &n, &r, info->node); vt8623_set_pixclock()
259 fb_err(info, "cannot set requested pixclock, keeping old value\n"); vt8623_set_pixclock()
279 static int vt8623fb_open(struct fb_info *info, int user) vt8623fb_open() argument
281 struct vt8623fb_info *par = info->par; vt8623fb_open()
301 static int vt8623fb_release(struct fb_info *info, int user) vt8623fb_release() argument
303 struct vt8623fb_info *par = info->par; vt8623fb_release()
320 static int vt8623fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) vt8623fb_check_var() argument
328 fb_err(info, "unsupported mode requested\n"); vt8623fb_check_var()
345 if (mem > info->screen_size) vt8623fb_check_var()
347 fb_err(info, "not enough framebuffer memory (%d kB requested, %d kB available)\n", vt8623fb_check_var()
348 mem >> 10, (unsigned int) (info->screen_size >> 10)); vt8623fb_check_var()
355 fb_err(info, "text framebuffer size too large (%d kB requested, 256 kB possible)\n", vt8623fb_check_var()
360 rv = svga_check_timings (&vt8623_timing_regs, var, info->node); vt8623fb_check_var()
363 fb_err(info, "invalid timings requested\n"); vt8623fb_check_var()
375 static int vt8623fb_set_par(struct fb_info *info) vt8623fb_set_par() argument
378 struct vt8623fb_info *par = info->par; vt8623fb_set_par()
379 u32 bpp = info->var.bits_per_pixel; vt8623fb_set_par()
382 info->fix.ypanstep = 1; vt8623fb_set_par()
383 info->fix.line_length = (info->var.xres_virtual * bpp) / 8; vt8623fb_set_par()
385 info->flags &= ~FBINFO_MISC_TILEBLITTING; vt8623fb_set_par()
386 info->tileops = NULL; vt8623fb_set_par()
389 info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0); vt8623fb_set_par()
390 info->pixmap.blit_y = ~(u32)0; vt8623fb_set_par()
392 offset_value = (info->var.xres_virtual * bpp) / 64; vt8623fb_set_par()
393 fetch_value = ((info->var.xres * bpp) / 128) + 4; vt8623fb_set_par()
396 fetch_value = (info->var.xres / 8) + 8; /* + 0 is OK */ vt8623fb_set_par()
398 screen_size = info->var.yres_virtual * info->fix.line_length; vt8623fb_set_par()
400 info->fix.ypanstep = 16; vt8623fb_set_par()
401 info->fix.line_length = 0; vt8623fb_set_par()
403 info->flags |= FBINFO_MISC_TILEBLITTING; vt8623fb_set_par()
404 info->tileops = &vt8623fb_tile_ops; vt8623fb_set_par()
407 info->pixmap.blit_x = 1 << (8 - 1); vt8623fb_set_par()
408 info->pixmap.blit_y = 1 << (16 - 1); vt8623fb_set_par()
410 offset_value = info->var.xres_virtual / 16; vt8623fb_set_par()
411 fetch_value = (info->var.xres / 8) + 8; vt8623fb_set_par()
412 screen_size = (info->var.xres_virtual * info->var.yres_virtual) / 64; vt8623fb_set_par()
415 info->var.xoffset = 0; vt8623fb_set_par()
416 info->var.yoffset = 0; vt8623fb_set_par()
417 info->var.activate = FB_ACTIVATE_NOW; vt8623fb_set_par()
444 if (info->var.vmode & FB_VMODE_DOUBLE) vt8623fb_set_par()
466 mode = svga_match_format(vt8623fb_formats, &(info->var), &(info->fix)); vt8623fb_set_par()
469 fb_dbg(info, "text mode\n"); vt8623fb_set_par()
475 fb_dbg(info, "4 bit pseudocolor\n"); vt8623fb_set_par()
481 fb_dbg(info, "4 bit pseudocolor, planar\n"); vt8623fb_set_par()
486 fb_dbg(info, "8 bit pseudocolor\n"); vt8623fb_set_par()
490 fb_dbg(info, "5/6/5 truecolor\n"); vt8623fb_set_par()
494 fb_dbg(info, "8/8/8 truecolor\n"); vt8623fb_set_par()
502 vt8623_set_pixclock(info, info->var.pixclock); vt8623fb_set_par()
503 svga_set_timings(par->state.vgabase, &vt8623_timing_regs, &(info->var), 1, 1, vt8623fb_set_par()
504 (info->var.vmode & FB_VMODE_DOUBLE) ? 2 : 1, 1, vt8623fb_set_par()
505 1, info->node); vt8623fb_set_par()
507 memset_io(info->screen_base, 0x00, screen_size); vt8623fb_set_par()
573 static int vt8623fb_blank(int blank_mode, struct fb_info *info) vt8623fb_blank() argument
575 struct vt8623fb_info *par = info->par; vt8623fb_blank()
579 fb_dbg(info, "unblank\n"); vt8623fb_blank()
584 fb_dbg(info, "blank\n"); vt8623fb_blank()
589 fb_dbg(info, "DPMS standby (hsync off)\n"); vt8623fb_blank()
594 fb_dbg(info, "DPMS suspend (vsync off)\n"); vt8623fb_blank()
599 fb_dbg(info, "DPMS off (no sync)\n"); vt8623fb_blank()
609 static int vt8623fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) vt8623fb_pan_display() argument
611 struct vt8623fb_info *par = info->par; vt8623fb_pan_display()
615 if (info->var.bits_per_pixel == 0) { vt8623fb_pan_display()
616 offset = (var->yoffset / 16) * info->var.xres_virtual vt8623fb_pan_display()
620 offset = (var->yoffset * info->fix.line_length) + vt8623fb_pan_display()
621 (var->xoffset * info->var.bits_per_pixel / 8); vt8623fb_pan_display()
622 offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 1); vt8623fb_pan_display()
659 struct fb_info *info; vt8623_pci_probe() local
671 info = framebuffer_alloc(sizeof(struct vt8623fb_info), &(dev->dev)); vt8623_pci_probe()
672 if (! info) { vt8623_pci_probe()
677 par = info->par; vt8623_pci_probe()
680 info->flags = FBINFO_PARTIAL_PAN_OK | FBINFO_HWACCEL_YPAN; vt8623_pci_probe()
681 info->fbops = &vt8623fb_ops; vt8623_pci_probe()
687 dev_err(info->device, "cannot enable PCI device\n"); vt8623_pci_probe()
693 dev_err(info->device, "cannot reserve framebuffer region\n"); vt8623_pci_probe()
697 info->fix.smem_start = pci_resource_start(dev, 0); vt8623_pci_probe()
698 info->fix.smem_len = pci_resource_len(dev, 0); vt8623_pci_probe()
699 info->fix.mmio_start = pci_resource_start(dev, 1); vt8623_pci_probe()
700 info->fix.mmio_len = pci_resource_len(dev, 1); vt8623_pci_probe()
703 info->screen_base = pci_iomap_wc(dev, 0, 0); vt8623_pci_probe()
704 if (! info->screen_base) { vt8623_pci_probe()
706 dev_err(info->device, "iomap for framebuffer failed\n"); vt8623_pci_probe()
713 dev_err(info->device, "iomap for MMIO failed\n"); vt8623_pci_probe()
731 info->screen_size = memsize1 << 20; vt8623_pci_probe()
733 dev_err(info->device, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2); vt8623_pci_probe()
734 info->screen_size = 16 << 20; vt8623_pci_probe()
737 info->fix.smem_len = info->screen_size; vt8623_pci_probe()
738 strcpy(info->fix.id, "VIA VT8623"); vt8623_pci_probe()
739 info->fix.type = FB_TYPE_PACKED_PIXELS; vt8623_pci_probe()
740 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; vt8623_pci_probe()
741 info->fix.ypanstep = 0; vt8623_pci_probe()
742 info->fix.accel = FB_ACCEL_NONE; vt8623_pci_probe()
743 info->pseudo_palette = (void*)par->pseudo_palette; vt8623_pci_probe()
748 rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); vt8623_pci_probe()
752 dev_err(info->device, "mode %s not found\n", mode_option); vt8623_pci_probe()
756 rc = fb_alloc_cmap(&info->cmap, 256, 0); vt8623_pci_probe()
758 dev_err(info->device, "cannot allocate colormap\n"); vt8623_pci_probe()
762 rc = register_framebuffer(info); vt8623_pci_probe()
764 dev_err(info->device, "cannot register framebuffer\n"); vt8623_pci_probe()
768 fb_info(info, "%s on %s, %d MB RAM\n", vt8623_pci_probe()
769 info->fix.id, pci_name(dev), info->fix.smem_len >> 20); vt8623_pci_probe()
772 pci_set_drvdata(dev, info); vt8623_pci_probe()
775 par->wc_cookie = arch_phys_wc_add(info->fix.smem_start, vt8623_pci_probe()
776 info->fix.smem_len); vt8623_pci_probe()
782 fb_dealloc_cmap(&info->cmap); vt8623_pci_probe()
787 pci_iounmap(dev, info->screen_base); vt8623_pci_probe()
793 framebuffer_release(info); vt8623_pci_probe()
801 struct fb_info *info = pci_get_drvdata(dev); vt8623_pci_remove() local
803 if (info) { vt8623_pci_remove()
804 struct vt8623fb_info *par = info->par; vt8623_pci_remove()
807 unregister_framebuffer(info); vt8623_pci_remove()
808 fb_dealloc_cmap(&info->cmap); vt8623_pci_remove()
810 pci_iounmap(dev, info->screen_base); vt8623_pci_remove()
815 framebuffer_release(info); vt8623_pci_remove()
825 struct fb_info *info = pci_get_drvdata(dev); vt8623_pci_suspend() local
826 struct vt8623fb_info *par = info->par; vt8623_pci_suspend()
828 dev_info(info->device, "suspend\n"); vt8623_pci_suspend()
839 fb_set_suspend(info, 1); vt8623_pci_suspend()
856 struct fb_info *info = pci_get_drvdata(dev); vt8623_pci_resume() local
857 struct vt8623fb_info *par = info->par; vt8623_pci_resume()
859 dev_info(info->device, "resume\n"); vt8623_pci_resume()
875 vt8623fb_set_par(info); vt8623_pci_resume()
876 fb_set_suspend(info, 0); vt8623_pci_resume()
H A Dxen-fbfront.c73 static void xenfb_send_event(struct xenfb_info *info, xenfb_send_event() argument
78 prod = info->page->out_prod; xenfb_send_event()
81 XENFB_OUT_RING_REF(info->page, prod) = *event; xenfb_send_event()
83 info->page->out_prod = prod + 1; xenfb_send_event()
85 notify_remote_via_irq(info->irq); xenfb_send_event()
88 static void xenfb_do_update(struct xenfb_info *info, xenfb_do_update() argument
101 xenfb_send_event(info, &event); xenfb_do_update()
104 static void xenfb_do_resize(struct xenfb_info *info) xenfb_do_resize() argument
109 event.resize = info->resize; xenfb_do_resize()
112 xenfb_send_event(info, &event); xenfb_do_resize()
115 static int xenfb_queue_full(struct xenfb_info *info) xenfb_queue_full() argument
119 prod = info->page->out_prod; xenfb_queue_full()
120 cons = info->page->out_cons; xenfb_queue_full()
124 static void xenfb_handle_resize_dpy(struct xenfb_info *info) xenfb_handle_resize_dpy() argument
128 spin_lock_irqsave(&info->resize_lock, flags); xenfb_handle_resize_dpy()
129 if (info->resize_dpy) { xenfb_handle_resize_dpy()
130 if (!xenfb_queue_full(info)) { xenfb_handle_resize_dpy()
131 info->resize_dpy = 0; xenfb_handle_resize_dpy()
132 xenfb_do_resize(info); xenfb_handle_resize_dpy()
135 spin_unlock_irqrestore(&info->resize_lock, flags); xenfb_handle_resize_dpy()
138 static void xenfb_refresh(struct xenfb_info *info, xenfb_refresh() argument
145 xenfb_handle_resize_dpy(info); xenfb_refresh()
147 if (!info->update_wanted) xenfb_refresh()
150 spin_lock_irqsave(&info->dirty_lock, flags); xenfb_refresh()
153 if (info->y1 < y1) xenfb_refresh()
154 y1 = info->y1; xenfb_refresh()
155 if (info->y2 > y2) xenfb_refresh()
156 y2 = info->y2; xenfb_refresh()
157 if (info->x1 < x1) xenfb_refresh()
158 x1 = info->x1; xenfb_refresh()
159 if (info->x2 > x2) xenfb_refresh()
160 x2 = info->x2; xenfb_refresh()
162 if (xenfb_queue_full(info)) { xenfb_refresh()
164 info->x1 = x1; xenfb_refresh()
165 info->x2 = x2; xenfb_refresh()
166 info->y1 = y1; xenfb_refresh()
167 info->y2 = y2; xenfb_refresh()
168 spin_unlock_irqrestore(&info->dirty_lock, flags); xenfb_refresh()
173 info->x1 = info->y1 = INT_MAX; xenfb_refresh()
174 info->x2 = info->y2 = 0; xenfb_refresh()
176 spin_unlock_irqrestore(&info->dirty_lock, flags); xenfb_refresh()
179 xenfb_do_update(info, x1, y1, x2 - x1 + 1, y2 - y1 + 1); xenfb_refresh()
185 struct xenfb_info *info = fb_info->par; xenfb_deferred_io() local
204 xenfb_refresh(info, 0, miny, fb_info->var.xres, maxy - miny + 1);
214 struct fb_info *info) xenfb_setcolreg()
218 if (regno > info->cmap.len) xenfb_setcolreg()
222 red = CNVT_TOHW(red, info->var.red.length); xenfb_setcolreg()
223 green = CNVT_TOHW(green, info->var.green.length); xenfb_setcolreg()
224 blue = CNVT_TOHW(blue, info->var.blue.length); xenfb_setcolreg()
225 transp = CNVT_TOHW(transp, info->var.transp.length); xenfb_setcolreg()
228 v = (red << info->var.red.offset) | xenfb_setcolreg()
229 (green << info->var.green.offset) | xenfb_setcolreg()
230 (blue << info->var.blue.offset); xenfb_setcolreg()
232 switch (info->var.bits_per_pixel) { xenfb_setcolreg()
236 ((u32 *)info->pseudo_palette)[regno] = v; xenfb_setcolreg()
245 struct xenfb_info *info = p->par; xenfb_fillrect() local
248 xenfb_refresh(info, rect->dx, rect->dy, rect->width, rect->height); xenfb_fillrect()
253 struct xenfb_info *info = p->par; xenfb_imageblit() local
256 xenfb_refresh(info, image->dx, image->dy, image->width, image->height); xenfb_imageblit()
261 struct xenfb_info *info = p->par; xenfb_copyarea() local
264 xenfb_refresh(info, area->dx, area->dy, area->width, area->height); xenfb_copyarea()
270 struct xenfb_info *info = p->par; xenfb_write() local
274 xenfb_refresh(info, 0, 0, info->page->width, info->page->height); xenfb_write()
279 xenfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) xenfb_check_var() argument
284 xenfb_info = info->par; xenfb_check_var()
301 var->xres <= info->fix.line_length / (XENFB_DEPTH / 8) && xenfb_check_var()
302 required_mem_len <= info->fix.smem_len) { xenfb_check_var()
310 static int xenfb_set_par(struct fb_info *info) xenfb_set_par() argument
315 xenfb_info = info->par; xenfb_set_par()
319 xenfb_info->resize.width = info->var.xres; xenfb_set_par()
320 xenfb_info->resize.height = info->var.yres; xenfb_set_par()
321 xenfb_info->resize.stride = info->fix.line_length; xenfb_set_par()
322 xenfb_info->resize.depth = info->var.bits_per_pixel; xenfb_set_par()
348 struct xenfb_info *info = dev_id; xenfb_event_handler() local
349 struct xenfb_page *page = info->page; xenfb_event_handler()
352 info->page->in_cons = info->page->in_prod; xenfb_event_handler()
353 notify_remote_via_irq(info->irq); xenfb_event_handler()
357 xenfb_refresh(info, INT_MAX, INT_MAX, -INT_MAX, -INT_MAX); xenfb_event_handler()
365 struct xenfb_info *info; xenfb_probe() local
371 info = kzalloc(sizeof(*info), GFP_KERNEL); xenfb_probe()
372 if (info == NULL) { xenfb_probe()
373 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure"); xenfb_probe()
392 dev_set_drvdata(&dev->dev, info); xenfb_probe()
393 info->xbdev = dev; xenfb_probe()
394 info->irq = -1; xenfb_probe()
395 info->x1 = info->y1 = INT_MAX; xenfb_probe()
396 spin_lock_init(&info->dirty_lock); xenfb_probe()
397 spin_lock_init(&info->resize_lock); xenfb_probe()
399 info->fb = vzalloc(fb_size); xenfb_probe()
400 if (info->fb == NULL) xenfb_probe()
403 info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT; xenfb_probe()
405 info->gfns = vmalloc(sizeof(unsigned long) * info->nr_pages); xenfb_probe()
406 if (!info->gfns) xenfb_probe()
410 info->page = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); xenfb_probe()
411 if (!info->page) xenfb_probe()
421 fb_info->par = info; xenfb_probe()
423 fb_info->screen_base = info->fb; xenfb_probe()
459 xenfb_init_shared_page(info, fb_info); xenfb_probe()
461 ret = xenfb_connect_backend(dev, info); xenfb_probe()
472 info->fb_info = fb_info; xenfb_probe()
514 struct xenfb_info *info = dev_get_drvdata(&dev->dev); xenfb_resume() local
516 xenfb_disconnect_backend(info); xenfb_resume()
517 xenfb_init_shared_page(info, info->fb_info); xenfb_resume()
518 return xenfb_connect_backend(dev, info); xenfb_resume()
523 struct xenfb_info *info = dev_get_drvdata(&dev->dev); xenfb_remove() local
525 xenfb_disconnect_backend(info); xenfb_remove()
526 if (info->fb_info) { xenfb_remove()
527 fb_deferred_io_cleanup(info->fb_info); xenfb_remove()
528 unregister_framebuffer(info->fb_info); xenfb_remove()
529 fb_dealloc_cmap(&info->fb_info->cmap); xenfb_remove()
530 framebuffer_release(info->fb_info); xenfb_remove()
532 free_page((unsigned long)info->page); xenfb_remove()
533 vfree(info->gfns); xenfb_remove()
534 vfree(info->fb); xenfb_remove()
535 kfree(info); xenfb_remove()
545 static void xenfb_init_shared_page(struct xenfb_info *info, xenfb_init_shared_page() argument
549 int epd = PAGE_SIZE / sizeof(info->gfns[0]); xenfb_init_shared_page()
551 for (i = 0; i < info->nr_pages; i++) xenfb_init_shared_page()
552 info->gfns[i] = vmalloc_to_gfn(info->fb + i * PAGE_SIZE); xenfb_init_shared_page()
554 for (i = 0; i * epd < info->nr_pages; i++) xenfb_init_shared_page()
555 info->page->pd[i] = vmalloc_to_gfn(&info->gfns[i * epd]); xenfb_init_shared_page()
557 info->page->width = fb_info->var.xres; xenfb_init_shared_page()
558 info->page->height = fb_info->var.yres; xenfb_init_shared_page()
559 info->page->depth = fb_info->var.bits_per_pixel; xenfb_init_shared_page()
560 info->page->line_length = fb_info->fix.line_length; xenfb_init_shared_page()
561 info->page->mem_length = fb_info->fix.smem_len; xenfb_init_shared_page()
562 info->page->in_cons = info->page->in_prod = 0; xenfb_init_shared_page()
563 info->page->out_cons = info->page->out_prod = 0; xenfb_init_shared_page()
567 struct xenfb_info *info) xenfb_connect_backend()
576 0, dev->devicetype, info); xenfb_connect_backend()
589 virt_to_gfn(info->page)); xenfb_connect_backend()
612 info->irq = irq; xenfb_connect_backend()
619 unbind_from_irqhandler(irq, info); xenfb_connect_backend()
623 static void xenfb_disconnect_backend(struct xenfb_info *info) xenfb_disconnect_backend() argument
626 info->update_wanted = 0; xenfb_disconnect_backend()
627 if (info->irq >= 0) xenfb_disconnect_backend()
628 unbind_from_irqhandler(info->irq, info); xenfb_disconnect_backend()
629 info->irq = -1; xenfb_disconnect_backend()
635 struct xenfb_info *info = dev_get_drvdata(&dev->dev); xenfb_backend_changed() local
660 if (xenbus_scanf(XBT_NIL, info->xbdev->otherend, xenfb_backend_changed()
664 info->update_wanted = 1; xenfb_backend_changed()
669 info->feature_resize = val; xenfb_backend_changed()
212 xenfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) xenfb_setcolreg() argument
566 xenfb_connect_backend(struct xenbus_device *dev, struct xenfb_info *info) xenfb_connect_backend() argument
H A Dsh7760fb.c73 static int sh7760fb_blank(int blank, struct fb_info *info) sh7760fb_blank() argument
75 struct sh7760fb_par *par = info->par; sh7760fb_blank()
102 u_int transp, struct fb_info *info) sh7760_setcolreg()
104 u32 *palette = info->pseudo_palette; sh7760_setcolreg()
111 red >>= 16 - info->var.red.length; sh7760_setcolreg()
112 green >>= 16 - info->var.green.length; sh7760_setcolreg()
113 blue >>= 16 - info->var.blue.length; sh7760_setcolreg()
114 transp >>= 16 - info->var.transp.length; sh7760_setcolreg()
116 palette[regno] = (red << info->var.red.offset) | sh7760_setcolreg()
117 (green << info->var.green.offset) | sh7760_setcolreg()
118 (blue << info->var.blue.offset) | sh7760_setcolreg()
119 (transp << info->var.transp.offset); sh7760_setcolreg()
169 struct fb_info *info) sh7760fb_check_var()
171 struct fb_fix_screeninfo *fix = &info->fix; sh7760fb_check_var()
172 struct sh7760fb_par *par = info->par; sh7760fb_check_var()
175 /* get color info from register value */ sh7760fb_check_var()
176 ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, NULL); sh7760fb_check_var()
199 static int sh7760fb_set_par(struct fb_info *info) sh7760fb_set_par() argument
201 struct sh7760fb_par *par = info->par; sh7760fb_set_par()
213 dev_dbg(info->dev, "rotation disabled due to display size\n"); sh7760fb_set_par()
227 /* get color info from register value */ sh7760fb_set_par()
228 ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, &gray); sh7760fb_set_par()
232 dev_dbg(info->dev, "%dx%d %dbpp %s (orientation %s)\n", hdcn, sh7760fb_set_par()
250 sh7760fb_blank(FB_BLANK_POWERDOWN, info); sh7760fb_set_par()
312 dev_dbg(info->dev, " ***** DSTN untested! *****\n"); sh7760fb_set_par()
326 info->fix.line_length = stride; sh7760fb_set_par()
328 sh7760fb_check_var(&info->var, info); sh7760fb_set_par()
330 sh7760fb_blank(FB_BLANK_UNBLANK, info); /* panel on! */ sh7760fb_set_par()
332 dev_dbg(info->dev, "hdcn : %6d htcn : %6d\n", hdcn, htcn); sh7760fb_set_par()
333 dev_dbg(info->dev, "hsynw : %6d hsynp : %6d\n", hsynw, hsynp); sh7760fb_set_par()
334 dev_dbg(info->dev, "vdln : %6d vtln : %6d\n", vdln, vtln); sh7760fb_set_par()
335 dev_dbg(info->dev, "vsynw : %6d vsynp : %6d\n", vsynw, vsynp); sh7760fb_set_par()
336 dev_dbg(info->dev, "clksrc: %6d clkdiv: %6d\n", sh7760fb_set_par()
338 dev_dbg(info->dev, "ldpmmr: 0x%04x ldpspr: 0x%04x\n", par->pd->ldpmmr, sh7760fb_set_par()
340 dev_dbg(info->dev, "ldmtr : 0x%04x lddfr : 0x%04x\n", ldmtr, lddfr); sh7760fb_set_par()
341 dev_dbg(info->dev, "ldlaor: %ld\n", stride); sh7760fb_set_par()
342 dev_dbg(info->dev, "ldsaru: 0x%08lx ldsarl: 0x%08lx\n", sbase, ldsarl); sh7760fb_set_par()
358 static void sh7760fb_free_mem(struct fb_info *info) sh7760fb_free_mem() argument
360 struct sh7760fb_par *par = info->par; sh7760fb_free_mem()
362 if (!info->screen_base) sh7760fb_free_mem()
365 dma_free_coherent(info->dev, info->screen_size, sh7760fb_free_mem()
366 info->screen_base, par->fbdma); sh7760fb_free_mem()
369 info->screen_base = NULL; sh7760fb_free_mem()
370 info->screen_size = 0; sh7760fb_free_mem()
376 static int sh7760fb_alloc_mem(struct fb_info *info) sh7760fb_alloc_mem() argument
378 struct sh7760fb_par *par = info->par; sh7760fb_alloc_mem()
383 if (info->screen_base) sh7760fb_alloc_mem()
386 /* get color info from register value */ sh7760fb_alloc_mem()
387 ret = sh7760fb_get_color_info(info->dev, par->pd->lddfr, &bpp, NULL); sh7760fb_alloc_mem()
396 vram = info->var.xres * info->var.yres; sh7760fb_alloc_mem()
397 if (info->var.grayscale) { sh7760fb_alloc_mem()
407 dev_dbg(info->dev, "too much VRAM required. Check settings\n"); sh7760fb_alloc_mem()
414 fbmem = dma_alloc_coherent(info->dev, vram, &par->fbdma, GFP_KERNEL); sh7760fb_alloc_mem()
420 sh7760fb_free_mem(info); sh7760fb_alloc_mem()
421 dev_err(info->dev, "kernel gave me memory at 0x%08lx, which is" sh7760fb_alloc_mem()
426 info->screen_base = fbmem; sh7760fb_alloc_mem()
427 info->screen_size = vram; sh7760fb_alloc_mem()
428 info->fix.smem_start = (unsigned long)info->screen_base; sh7760fb_alloc_mem()
429 info->fix.smem_len = info->screen_size; sh7760fb_alloc_mem()
436 struct fb_info *info; sh7760fb_probe() local
447 info = framebuffer_alloc(sizeof(struct sh7760fb_par), &pdev->dev); sh7760fb_probe()
448 if (!info) sh7760fb_probe()
451 par = info->par; sh7760fb_probe()
456 dev_dbg(info->dev, "no display setup data!\n"); sh7760fb_probe()
488 fb_videomode_to_var(&info->var, par->pd->def_mode); sh7760fb_probe()
490 ret = sh7760fb_alloc_mem(info); sh7760fb_probe()
492 dev_dbg(info->dev, "framebuffer memory allocation failed!\n"); sh7760fb_probe()
496 info->pseudo_palette = par->pseudo_palette; sh7760fb_probe()
499 info->var.red.offset = 11; sh7760fb_probe()
500 info->var.red.length = 5; sh7760fb_probe()
501 info->var.red.msb_right = 0; sh7760fb_probe()
503 info->var.green.offset = 5; sh7760fb_probe()
504 info->var.green.length = 6; sh7760fb_probe()
505 info->var.green.msb_right = 0; sh7760fb_probe()
507 info->var.blue.offset = 0; sh7760fb_probe()
508 info->var.blue.length = 5; sh7760fb_probe()
509 info->var.blue.msb_right = 0; sh7760fb_probe()
511 info->var.transp.offset = 0; sh7760fb_probe()
512 info->var.transp.length = 0; sh7760fb_probe()
513 info->var.transp.msb_right = 0; sh7760fb_probe()
515 strcpy(info->fix.id, "sh7760-lcdc"); sh7760fb_probe()
521 info->fbops = &sh7760fb_ops; sh7760fb_probe()
523 ret = fb_alloc_cmap(&info->cmap, 256, 0); sh7760fb_probe()
525 dev_dbg(info->dev, "Unable to allocate cmap memory\n"); sh7760fb_probe()
529 ret = register_framebuffer(info); sh7760fb_probe()
531 dev_dbg(info->dev, "cannot register fb!\n"); sh7760fb_probe()
534 platform_set_drvdata(pdev, info); sh7760fb_probe()
539 (unsigned long)(par->fbdma + info->screen_size - 1), sh7760fb_probe()
540 info->screen_size >> 10); sh7760fb_probe()
545 sh7760fb_blank(FB_BLANK_POWERDOWN, info); sh7760fb_probe()
546 fb_dealloc_cmap(&info->cmap); sh7760fb_probe()
548 sh7760fb_free_mem(info); sh7760fb_probe()
556 framebuffer_release(info); sh7760fb_probe()
562 struct fb_info *info = platform_get_drvdata(dev); sh7760fb_remove() local
563 struct sh7760fb_par *par = info->par; sh7760fb_remove()
565 sh7760fb_blank(FB_BLANK_POWERDOWN, info); sh7760fb_remove()
566 unregister_framebuffer(info); sh7760fb_remove()
567 fb_dealloc_cmap(&info->cmap); sh7760fb_remove()
568 sh7760fb_free_mem(info); sh7760fb_remove()
573 framebuffer_release(info); sh7760fb_remove()
100 sh7760_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) sh7760_setcolreg() argument
168 sh7760fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) sh7760fb_check_var() argument
H A Dq40fb.c56 struct fb_info *info) q40fb_setcolreg()
71 ((u32 *)info->pseudo_palette)[regno] = ((red & 31) <<6) | q40fb_setcolreg()
88 struct fb_info *info; q40fb_probe() local
96 info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev); q40fb_probe()
97 if (!info) q40fb_probe()
100 info->var = q40fb_var; q40fb_probe()
101 info->fix = q40fb_fix; q40fb_probe()
102 info->fbops = &q40fb_ops; q40fb_probe()
103 info->flags = FBINFO_DEFAULT; /* not as module for now */ q40fb_probe()
104 info->pseudo_palette = info->par; q40fb_probe()
105 info->par = NULL; q40fb_probe()
106 info->screen_base = (char *) q40fb_fix.smem_start; q40fb_probe()
108 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { q40fb_probe()
109 framebuffer_release(info); q40fb_probe()
115 if (register_framebuffer(info) < 0) { q40fb_probe()
117 fb_dealloc_cmap(&info->cmap); q40fb_probe()
118 framebuffer_release(info); q40fb_probe()
122 fb_info(info, "Q40 frame buffer alive and kicking !\n"); q40fb_probe()
54 q40fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) q40fb_setcolreg() argument
H A Dbw2.c119 * @info: frame buffer structure that represents a single frame buffer
122 bw2_blank(int blank, struct fb_info *info) bw2_blank() argument
124 struct bw2_par *par = (struct bw2_par *) info->par; bw2_blank()
162 static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) bw2_mmap() argument
164 struct bw2_par *par = (struct bw2_par *)info->par; bw2_mmap()
167 info->fix.smem_start, info->fix.smem_len, bw2_mmap()
172 static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) bw2_ioctl() argument
174 return sbusfb_ioctl_helper(cmd, arg, info, bw2_ioctl()
175 FBTYPE_SUN2BW, 1, info->fix.smem_len); bw2_ioctl()
182 static void bw2_init_fix(struct fb_info *info, int linebytes) bw2_init_fix() argument
184 strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id)); bw2_init_fix()
186 info->fix.type = FB_TYPE_PACKED_PIXELS; bw2_init_fix()
187 info->fix.visual = FB_VISUAL_MONO01; bw2_init_fix()
189 info->fix.line_length = linebytes; bw2_init_fix()
191 info->fix.accel = FB_ACCEL_SUN_BWTWO; bw2_init_fix()
229 static int bw2_do_default_mode(struct bw2_par *par, struct fb_info *info, bw2_do_default_mode() argument
241 info->var.xres = info->var.xres_virtual = 1600; bw2_do_default_mode()
242 info->var.yres = info->var.yres_virtual = 1280; bw2_do_default_mode()
278 struct fb_info *info; bw2_probe() local
282 info = framebuffer_alloc(sizeof(struct bw2_par), &op->dev); bw2_probe()
285 if (!info) bw2_probe()
287 par = info->par; bw2_probe()
291 info->fix.smem_start = op->resource[0].start; bw2_probe()
294 sbusfb_fill_var(&info->var, dp, 1); bw2_probe()
296 info->var.xres); bw2_probe()
298 info->var.red.length = info->var.green.length = bw2_probe()
299 info->var.blue.length = info->var.bits_per_pixel; bw2_probe()
300 info->var.red.offset = info->var.green.offset = bw2_probe()
301 info->var.blue.offset = 0; bw2_probe()
309 err = bw2_do_default_mode(par, info, &linebytes); bw2_probe()
314 info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); bw2_probe()
316 info->flags = FBINFO_DEFAULT; bw2_probe()
317 info->fbops = &bw2_ops; bw2_probe()
319 info->screen_base = of_ioremap(&op->resource[0], 0, bw2_probe()
320 info->fix.smem_len, "bw2 ram"); bw2_probe()
321 if (!info->screen_base) { bw2_probe()
326 bw2_blank(FB_BLANK_UNBLANK, info); bw2_probe()
328 bw2_init_fix(info, linebytes); bw2_probe()
330 err = register_framebuffer(info); bw2_probe()
334 dev_set_drvdata(&op->dev, info); bw2_probe()
337 dp->full_name, par->which_io, info->fix.smem_start); bw2_probe()
342 of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len); bw2_probe()
348 framebuffer_release(info); bw2_probe()
356 struct fb_info *info = dev_get_drvdata(&op->dev); bw2_remove() local
357 struct bw2_par *par = info->par; bw2_remove()
359 unregister_framebuffer(info); bw2_remove()
362 of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len); bw2_remove()
364 framebuffer_release(info); bw2_remove()
H A Dsunxvr2500.c16 struct fb_info *info; member in struct:s3d_info
49 unsigned transp, struct fb_info *info) s3d_setcolreg()
59 ((u32 *)info->pseudo_palette)[regno] = value; s3d_setcolreg()
75 struct fb_info *info = sp->info; s3d_set_fbinfo() local
76 struct fb_var_screeninfo *var = &info->var; s3d_set_fbinfo()
78 info->flags = FBINFO_DEFAULT; s3d_set_fbinfo()
79 info->fbops = &s3d_ops; s3d_set_fbinfo()
80 info->screen_base = sp->fb_base; s3d_set_fbinfo()
81 info->screen_size = sp->fb_size; s3d_set_fbinfo()
83 info->pseudo_palette = sp->pseudo_palette; s3d_set_fbinfo()
86 strlcpy(info->fix.id, "s3d", sizeof(info->fix.id)); s3d_set_fbinfo()
87 info->fix.smem_start = sp->fb_base_phys; s3d_set_fbinfo()
88 info->fix.smem_len = sp->fb_size; s3d_set_fbinfo()
89 info->fix.type = FB_TYPE_PACKED_PIXELS; s3d_set_fbinfo()
91 info->fix.visual = FB_VISUAL_TRUECOLOR; s3d_set_fbinfo()
93 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; s3d_set_fbinfo()
110 if (fb_alloc_cmap(&info->cmap, 256, 0)) { s3d_set_fbinfo()
121 struct fb_info *info; s3d_pci_register() local
132 info = framebuffer_alloc(sizeof(struct s3d_info), &pdev->dev); s3d_pci_register()
133 if (!info) { s3d_pci_register()
139 sp = info->par; s3d_pci_register()
140 sp->info = info; s3d_pci_register()
169 info->fix.line_length = sp->width; s3d_pci_register()
172 info->fix.line_length = sp->width * 2; s3d_pci_register()
175 info->fix.line_length = sp->width * 3; s3d_pci_register()
178 info->fix.line_length = sp->width * 4; s3d_pci_register()
181 sp->fb_size = info->fix.line_length * sp->height; s3d_pci_register()
193 pci_set_drvdata(pdev, info); s3d_pci_register()
197 err = register_framebuffer(info); s3d_pci_register()
213 framebuffer_release(info); s3d_pci_register()
224 struct fb_info *info = pci_get_drvdata(pdev); s3d_pci_unregister() local
225 struct s3d_info *sp = info->par; s3d_pci_unregister()
227 unregister_framebuffer(info); s3d_pci_unregister()
233 framebuffer_release(info); s3d_pci_unregister()
47 s3d_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) s3d_setcolreg() argument
H A Dp9100.c146 * @info: frame buffer info structure
150 unsigned transp, struct fb_info *info) p9100_setcolreg()
152 struct p9100_par *par = (struct p9100_par *) info->par; p9100_setcolreg()
178 * @info: frame buffer structure that represents a single frame buffer
181 p9100_blank(int blank, struct fb_info *info) p9100_blank() argument
183 struct p9100_par *par = (struct p9100_par *) info->par; p9100_blank()
219 static int p9100_mmap(struct fb_info *info, struct vm_area_struct *vma) p9100_mmap() argument
221 struct p9100_par *par = (struct p9100_par *)info->par; p9100_mmap()
224 info->fix.smem_start, info->fix.smem_len, p9100_mmap()
228 static int p9100_ioctl(struct fb_info *info, unsigned int cmd, p9100_ioctl() argument
232 return sbusfb_ioctl_helper(cmd, arg, info, p9100_ioctl()
233 FBTYPE_SUN3COLOR, 8, info->fix.smem_len); p9100_ioctl()
240 static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) p9100_init_fix() argument
242 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); p9100_init_fix()
244 info->fix.type = FB_TYPE_PACKED_PIXELS; p9100_init_fix()
245 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; p9100_init_fix()
247 info->fix.line_length = linebytes; p9100_init_fix()
249 info->fix.accel = FB_ACCEL_SUN_CGTHREE; p9100_init_fix()
255 struct fb_info *info; p9100_probe() local
259 info = framebuffer_alloc(sizeof(struct p9100_par), &op->dev); p9100_probe()
262 if (!info) p9100_probe()
264 par = info->par; p9100_probe()
269 info->fix.smem_start = op->resource[2].start; p9100_probe()
272 sbusfb_fill_var(&info->var, dp, 8); p9100_probe()
273 info->var.red.length = 8; p9100_probe()
274 info->var.green.length = 8; p9100_probe()
275 info->var.blue.length = 8; p9100_probe()
277 linebytes = of_getintprop_default(dp, "linebytes", info->var.xres); p9100_probe()
278 info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); p9100_probe()
285 info->flags = FBINFO_DEFAULT; p9100_probe()
286 info->fbops = &p9100_ops; p9100_probe()
287 info->screen_base = of_ioremap(&op->resource[2], 0, p9100_probe()
288 info->fix.smem_len, "p9100 ram"); p9100_probe()
289 if (!info->screen_base) p9100_probe()
292 p9100_blank(FB_BLANK_UNBLANK, info); p9100_probe()
294 if (fb_alloc_cmap(&info->cmap, 256, 0)) p9100_probe()
297 p9100_init_fix(info, linebytes, dp); p9100_probe()
299 err = register_framebuffer(info); p9100_probe()
303 fb_set_cmap(&info->cmap, info); p9100_probe()
305 dev_set_drvdata(&op->dev, info); p9100_probe()
309 par->which_io, info->fix.smem_start); p9100_probe()
314 fb_dealloc_cmap(&info->cmap); p9100_probe()
317 of_iounmap(&op->resource[2], info->screen_base, info->fix.smem_len); p9100_probe()
323 framebuffer_release(info); p9100_probe()
331 struct fb_info *info = dev_get_drvdata(&op->dev); p9100_remove() local
332 struct p9100_par *par = info->par; p9100_remove()
334 unregister_framebuffer(info); p9100_remove()
335 fb_dealloc_cmap(&info->cmap); p9100_remove()
338 of_iounmap(&op->resource[2], info->screen_base, info->fix.smem_len); p9100_remove()
340 framebuffer_release(info); p9100_remove()
148 p9100_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) p9100_setcolreg() argument
H A Dtcx.c125 static void __tcx_set_control_plane(struct fb_info *info) __tcx_set_control_plane() argument
127 struct tcx_par *par = info->par; __tcx_set_control_plane()
136 for (pend = p + info->fix.smem_len; p < pend; p++) { __tcx_set_control_plane()
144 static void tcx_reset(struct fb_info *info) tcx_reset() argument
146 struct tcx_par *par = (struct tcx_par *) info->par; tcx_reset()
150 __tcx_set_control_plane(info); tcx_reset()
154 static int tcx_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) tcx_pan_display() argument
156 tcx_reset(info); tcx_pan_display()
167 * @info: frame buffer info structure
171 unsigned transp, struct fb_info *info) tcx_setcolreg()
173 struct tcx_par *par = (struct tcx_par *) info->par; tcx_setcolreg()
199 * @info: frame buffer structure that represents a single frame buffer
202 tcx_blank(int blank, struct fb_info *info) tcx_blank() argument
204 struct tcx_par *par = (struct tcx_par *) info->par; tcx_blank()
300 static int tcx_mmap(struct fb_info *info, struct vm_area_struct *vma) tcx_mmap() argument
302 struct tcx_par *par = (struct tcx_par *)info->par; tcx_mmap()
305 info->fix.smem_start, info->fix.smem_len, tcx_mmap()
309 static int tcx_ioctl(struct fb_info *info, unsigned int cmd, tcx_ioctl() argument
312 struct tcx_par *par = (struct tcx_par *) info->par; tcx_ioctl()
314 return sbusfb_ioctl_helper(cmd, arg, info, tcx_ioctl()
317 info->fix.smem_len); tcx_ioctl()
325 tcx_init_fix(struct fb_info *info, int linebytes) tcx_init_fix() argument
327 struct tcx_par *par = (struct tcx_par *)info->par; tcx_init_fix()
335 strlcpy(info->fix.id, tcx_name, sizeof(info->fix.id)); tcx_init_fix()
337 info->fix.type = FB_TYPE_PACKED_PIXELS; tcx_init_fix()
338 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; tcx_init_fix()
340 info->fix.line_length = linebytes; tcx_init_fix()
342 info->fix.accel = FB_ACCEL_SUN_TCX; tcx_init_fix()
345 static void tcx_unmap_regs(struct platform_device *op, struct fb_info *info, tcx_unmap_regs() argument
359 par->cplane, info->fix.smem_len * sizeof(u32)); tcx_unmap_regs()
360 if (info->screen_base) tcx_unmap_regs()
362 info->screen_base, info->fix.smem_len); tcx_unmap_regs()
368 struct fb_info *info; tcx_probe() local
372 info = framebuffer_alloc(sizeof(struct tcx_par), &op->dev); tcx_probe()
375 if (!info) tcx_probe()
377 par = info->par; tcx_probe()
384 sbusfb_fill_var(&info->var, dp, 8); tcx_probe()
385 info->var.red.length = 8; tcx_probe()
386 info->var.green.length = 8; tcx_probe()
387 info->var.blue.length = 8; tcx_probe()
390 info->var.xres); tcx_probe()
391 info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); tcx_probe()
399 info->screen_base = of_ioremap(&op->resource[0], 0, tcx_probe()
400 info->fix.smem_len, "tcx ram"); tcx_probe()
402 !par->bt || !info->screen_base) tcx_probe()
408 info->fix.smem_len * sizeof(u32), tcx_probe()
419 info->fix.smem_start = op->resource[0].start; tcx_probe()
441 info->flags = FBINFO_DEFAULT; tcx_probe()
442 info->fbops = &tcx_ops; tcx_probe()
454 tcx_reset(info); tcx_probe()
456 tcx_blank(FB_BLANK_UNBLANK, info); tcx_probe()
458 if (fb_alloc_cmap(&info->cmap, 256, 0)) tcx_probe()
461 fb_set_cmap(&info->cmap, info); tcx_probe()
462 tcx_init_fix(info, linebytes); tcx_probe()
464 err = register_framebuffer(info); tcx_probe()
468 dev_set_drvdata(&op->dev, info); tcx_probe()
473 info->fix.smem_start, tcx_probe()
479 fb_dealloc_cmap(&info->cmap); tcx_probe()
482 tcx_unmap_regs(op, info, par); tcx_probe()
483 framebuffer_release(info); tcx_probe()
491 struct fb_info *info = dev_get_drvdata(&op->dev); tcx_remove() local
492 struct tcx_par *par = info->par; tcx_remove()
494 unregister_framebuffer(info); tcx_remove()
495 fb_dealloc_cmap(&info->cmap); tcx_remove()
497 tcx_unmap_regs(op, info, par); tcx_remove()
499 framebuffer_release(info); tcx_remove()
169 tcx_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) tcx_setcolreg() argument
H A Darkfb.c119 static void arkfb_settile(struct fb_info *info, struct fb_tilemap *map) arkfb_settile() argument
122 u8 __iomem *fb = (u8 __iomem *)info->screen_base; arkfb_settile()
127 fb_err(info, "unsupported font parameters: width %d, height %d, depth %d, length %d\n", arkfb_settile()
147 static void arkfb_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor) arkfb_tilecursor() argument
149 struct arkfb_info *par = info->par; arkfb_tilecursor()
151 svga_tilecursor(par->state.vgabase, info, cursor); arkfb_tilecursor()
174 static void arkfb_iplan_imageblit(struct fb_info *info, const struct fb_image *image) arkfb_iplan_imageblit() argument
185 dst1 = info->screen_base + (image->dy * info->fix.line_length) arkfb_iplan_imageblit()
197 dst1 += info->fix.line_length; arkfb_iplan_imageblit()
203 static void arkfb_iplan_fillrect(struct fb_info *info, const struct fb_fillrect *rect) arkfb_iplan_fillrect() argument
210 dst1 = info->screen_base + (rect->dy * info->fix.line_length) arkfb_iplan_fillrect()
218 dst1 += info->fix.line_length; arkfb_iplan_fillrect()
232 static void arkfb_cfb4_imageblit(struct fb_info *info, const struct fb_image *image) arkfb_cfb4_imageblit() argument
243 dst1 = info->screen_base + (image->dy * info->fix.line_length) arkfb_cfb4_imageblit()
255 dst1 += info->fix.line_length; arkfb_cfb4_imageblit()
260 static void arkfb_imageblit(struct fb_info *info, const struct fb_image *image) arkfb_imageblit() argument
262 if ((info->var.bits_per_pixel == 4) && (image->depth == 1) arkfb_imageblit()
264 if (info->fix.type == FB_TYPE_INTERLEAVED_PLANES) arkfb_imageblit()
265 arkfb_iplan_imageblit(info, image); arkfb_imageblit()
267 arkfb_cfb4_imageblit(info, image); arkfb_imageblit()
269 cfb_imageblit(info, image); arkfb_imageblit()
272 static void arkfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) arkfb_fillrect() argument
274 if ((info->var.bits_per_pixel == 4) arkfb_fillrect()
276 && (info->fix.type == FB_TYPE_INTERLEAVED_PLANES)) arkfb_fillrect()
277 arkfb_iplan_fillrect(info, rect); arkfb_fillrect()
279 cfb_fillrect(info, rect); arkfb_fillrect()
302 int (*dac_get_mode)(struct dac_info *info);
303 int (*dac_set_mode)(struct dac_info *info, int mode);
304 int (*dac_get_freq)(struct dac_info *info, int channel);
305 int (*dac_set_freq)(struct dac_info *info, int channel, u32 freq);
306 void (*dac_release)(struct dac_info *info);
321 static inline u8 dac_read_reg(struct dac_info *info, u8 reg) dac_read_reg() argument
324 info->dac_read_regs(info->data, code, 1); dac_read_reg()
328 static inline void dac_read_regs(struct dac_info *info, u8 *code, int count) dac_read_regs() argument
330 info->dac_read_regs(info->data, code, count); dac_read_regs()
333 static inline void dac_write_reg(struct dac_info *info, u8 reg, u8 val) dac_write_reg() argument
336 info->dac_write_regs(info->data, code, 1); dac_write_reg()
339 static inline void dac_write_regs(struct dac_info *info, u8 *code, int count) dac_write_regs() argument
341 info->dac_write_regs(info->data, code, count); dac_write_regs()
344 static inline int dac_set_mode(struct dac_info *info, int mode) dac_set_mode() argument
346 return info->dacops->dac_set_mode(info, mode); dac_set_mode()
349 static inline int dac_set_freq(struct dac_info *info, int channel, u32 freq) dac_set_freq() argument
351 return info->dacops->dac_set_freq(info, channel, freq); dac_set_freq()
354 static inline void dac_release(struct dac_info *info) dac_release() argument
356 info->dacops->dac_release(info); dac_release()
371 #define DAC_PAR(info) ((struct ics5342_info *) info)
380 static int ics5342_set_mode(struct dac_info *info, int mode) ics5342_set_mode() argument
392 dac_write_reg(info, 6, code & 0xF0); ics5342_set_mode()
393 DAC_PAR(info)->mode = mode; ics5342_set_mode()
408 static int ics5342_set_freq(struct dac_info *info, int channel, u32 freq) ics5342_set_freq() argument
413 int rv = svga_compute_pll((DAC_PAR(info)->mode == DAC_PSEUDO8_16) ics5342_set_freq()
421 dac_write_regs(info, code, 3); ics5342_set_freq()
426 static void ics5342_release(struct dac_info *info) ics5342_release() argument
428 ics5342_set_mode(info, DAC_PSEUDO8_8); ics5342_release()
429 kfree(info); ics5342_release()
441 struct dac_info *info = kzalloc(sizeof(struct ics5342_info), GFP_KERNEL); ics5342_init() local
443 if (! info) ics5342_init()
446 info->dacops = &ics5342_ops; ics5342_init()
447 info->dac_read_regs = drr; ics5342_init()
448 info->dac_write_regs = dwr; ics5342_init()
449 info->data = data; ics5342_init()
450 DAC_PAR(info)->mode = DAC_PSEUDO8_8; /* estimation */ ics5342_init()
451 return info; ics5342_init()
462 struct fb_info *info = data; ark_dac_read_regs() local
466 par = info->par; ark_dac_read_regs()
481 struct fb_info *info = data; ark_dac_write_regs() local
485 par = info->par; ark_dac_write_regs()
499 static void ark_set_pixclock(struct fb_info *info, u32 pixclock) ark_set_pixclock() argument
501 struct arkfb_info *par = info->par; ark_set_pixclock()
506 fb_err(info, "cannot set requested pixclock, keeping old value\n"); ark_set_pixclock()
518 static int arkfb_open(struct fb_info *info, int user) arkfb_open() argument
520 struct arkfb_info *par = info->par; arkfb_open()
542 static int arkfb_release(struct fb_info *info, int user) arkfb_release() argument
544 struct arkfb_info *par = info->par; arkfb_release()
565 static int arkfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) arkfb_check_var() argument
573 fb_err(info, "unsupported mode requested\n"); arkfb_check_var()
591 if (mem > info->screen_size) arkfb_check_var()
593 fb_err(info, "not enough framebuffer memory (%d kB requested, %d kB available)\n", arkfb_check_var()
594 mem >> 10, (unsigned int) (info->screen_size >> 10)); arkfb_check_var()
598 rv = svga_check_timings (&ark_timing_regs, var, info->node); arkfb_check_var()
601 fb_err(info, "invalid timings requested\n"); arkfb_check_var()
614 static int arkfb_set_par(struct fb_info *info) arkfb_set_par() argument
616 struct arkfb_info *par = info->par; arkfb_set_par()
618 u32 bpp = info->var.bits_per_pixel; arkfb_set_par()
622 info->fix.ypanstep = 1; arkfb_set_par()
623 info->fix.line_length = (info->var.xres_virtual * bpp) / 8; arkfb_set_par()
625 info->flags &= ~FBINFO_MISC_TILEBLITTING; arkfb_set_par()
626 info->tileops = NULL; arkfb_set_par()
629 info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0); arkfb_set_par()
630 info->pixmap.blit_y = ~(u32)0; arkfb_set_par()
632 offset_value = (info->var.xres_virtual * bpp) / 64; arkfb_set_par()
633 screen_size = info->var.yres_virtual * info->fix.line_length; arkfb_set_par()
635 info->fix.ypanstep = 16; arkfb_set_par()
636 info->fix.line_length = 0; arkfb_set_par()
638 info->flags |= FBINFO_MISC_TILEBLITTING; arkfb_set_par()
639 info->tileops = &arkfb_tile_ops; arkfb_set_par()
642 info->pixmap.blit_x = 1 << (8 - 1); arkfb_set_par()
643 info->pixmap.blit_y = 1 << (16 - 1); arkfb_set_par()
645 offset_value = info->var.xres_virtual / 16; arkfb_set_par()
646 screen_size = (info->var.xres_virtual * info->var.yres_virtual) / 64; arkfb_set_par()
649 info->var.xoffset = 0; arkfb_set_par()
650 info->var.yoffset = 0; arkfb_set_par()
651 info->var.activate = FB_ACTIVATE_NOW; arkfb_set_par()
672 vga_wseq(par->state.vgabase, 0x13, info->fix.smem_start >> 16); arkfb_set_par()
673 vga_wseq(par->state.vgabase, 0x14, info->fix.smem_start >> 24); arkfb_set_par()
683 fb_dbg(info, "offset register : %d\n", offset_value); arkfb_set_par()
689 if (info->var.vmode & FB_VMODE_DOUBLE) arkfb_set_par()
694 if (info->var.vmode & FB_VMODE_INTERLACED) arkfb_set_par()
701 mode = svga_match_format(arkfb_formats, &(info->var), &(info->fix)); arkfb_set_par()
706 fb_dbg(info, "text mode\n"); arkfb_set_par()
715 fb_dbg(info, "4 bit pseudocolor\n"); arkfb_set_par()
723 fb_dbg(info, "4 bit pseudocolor, planar\n"); arkfb_set_par()
730 fb_dbg(info, "8 bit pseudocolor\n"); arkfb_set_par()
734 if (info->var.pixclock > 20000) { arkfb_set_par()
735 fb_dbg(info, "not using multiplex\n"); arkfb_set_par()
739 fb_dbg(info, "using multiplex\n"); arkfb_set_par()
746 fb_dbg(info, "5/5/5 truecolor\n"); arkfb_set_par()
753 fb_dbg(info, "5/6/5 truecolor\n"); arkfb_set_par()
760 fb_dbg(info, "8/8/8 truecolor\n"); arkfb_set_par()
769 fb_dbg(info, "8/8/8/8 truecolor\n"); arkfb_set_par()
777 fb_err(info, "unsupported mode - bug\n"); arkfb_set_par()
781 ark_set_pixclock(info, (hdiv * info->var.pixclock) / hmul); arkfb_set_par()
782 svga_set_timings(par->state.vgabase, &ark_timing_regs, &(info->var), hmul, hdiv, arkfb_set_par()
783 (info->var.vmode & FB_VMODE_DOUBLE) ? 2 : 1, arkfb_set_par()
784 (info->var.vmode & FB_VMODE_INTERLACED) ? 2 : 1, arkfb_set_par()
785 hmul, info->node); arkfb_set_par()
788 value = info->var.xres + info->var.left_margin + info->var.right_margin + info->var.hsync_len; arkfb_set_par()
792 memset_io(info->screen_base, 0x00, screen_size); arkfb_set_par()
863 static int arkfb_blank(int blank_mode, struct fb_info *info) arkfb_blank() argument
865 struct arkfb_info *par = info->par; arkfb_blank()
869 fb_dbg(info, "unblank\n"); arkfb_blank()
874 fb_dbg(info, "blank\n"); arkfb_blank()
881 fb_dbg(info, "sync down\n"); arkfb_blank()
892 static int arkfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) arkfb_pan_display() argument
894 struct arkfb_info *par = info->par; arkfb_pan_display()
898 if (info->var.bits_per_pixel == 0) { arkfb_pan_display()
899 offset = (var->yoffset / 16) * (info->var.xres_virtual / 2) arkfb_pan_display()
903 offset = (var->yoffset * info->fix.line_length) + arkfb_pan_display()
904 (var->xoffset * info->var.bits_per_pixel / 8); arkfb_pan_display()
905 offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 3); arkfb_pan_display()
944 struct fb_info *info; ark_pci_probe() local
956 info = framebuffer_alloc(sizeof(struct arkfb_info), &(dev->dev)); ark_pci_probe()
957 if (! info) { ark_pci_probe()
962 par = info->par; ark_pci_probe()
965 info->flags = FBINFO_PARTIAL_PAN_OK | FBINFO_HWACCEL_YPAN; ark_pci_probe()
966 info->fbops = &arkfb_ops; ark_pci_probe()
971 dev_err(info->device, "cannot enable PCI device\n"); ark_pci_probe()
977 dev_err(info->device, "cannot reserve framebuffer region\n"); ark_pci_probe()
981 par->dac = ics5342_init(ark_dac_read_regs, ark_dac_write_regs, info); ark_pci_probe()
984 dev_err(info->device, "RAMDAC initialization failed\n"); ark_pci_probe()
988 info->fix.smem_start = pci_resource_start(dev, 0); ark_pci_probe()
989 info->fix.smem_len = pci_resource_len(dev, 0); ark_pci_probe()
992 info->screen_base = pci_iomap_wc(dev, 0, 0); ark_pci_probe()
993 if (! info->screen_base) { ark_pci_probe()
995 dev_err(info->device, "iomap for framebuffer failed\n"); ark_pci_probe()
1010 info->screen_size = (1 << (regval >> 6)) << 20; ark_pci_probe()
1011 info->fix.smem_len = info->screen_size; ark_pci_probe()
1013 strcpy(info->fix.id, "ARK 2000PV"); ark_pci_probe()
1014 info->fix.mmio_start = 0; ark_pci_probe()
1015 info->fix.mmio_len = 0; ark_pci_probe()
1016 info->fix.type = FB_TYPE_PACKED_PIXELS; ark_pci_probe()
1017 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; ark_pci_probe()
1018 info->fix.ypanstep = 0; ark_pci_probe()
1019 info->fix.accel = FB_ACCEL_NONE; ark_pci_probe()
1020 info->pseudo_palette = (void*) (par->pseudo_palette); ark_pci_probe()
1023 rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8); ark_pci_probe()
1026 dev_err(info->device, "mode %s not found\n", mode_option); ark_pci_probe()
1030 rc = fb_alloc_cmap(&info->cmap, 256, 0); ark_pci_probe()
1032 dev_err(info->device, "cannot allocate colormap\n"); ark_pci_probe()
1036 rc = register_framebuffer(info); ark_pci_probe()
1038 dev_err(info->device, "cannot register framebuffer\n"); ark_pci_probe()
1042 fb_info(info, "%s on %s, %d MB RAM\n", ark_pci_probe()
1043 info->fix.id, pci_name(dev), info->fix.smem_len >> 20); ark_pci_probe()
1046 pci_set_drvdata(dev, info); ark_pci_probe()
1047 par->wc_cookie = arch_phys_wc_add(info->fix.smem_start, ark_pci_probe()
1048 info->fix.smem_len); ark_pci_probe()
1053 fb_dealloc_cmap(&info->cmap); ark_pci_probe()
1056 pci_iounmap(dev, info->screen_base); ark_pci_probe()
1064 framebuffer_release(info); ark_pci_probe()
1072 struct fb_info *info = pci_get_drvdata(dev); ark_pci_remove() local
1074 if (info) { ark_pci_remove()
1075 struct arkfb_info *par = info->par; ark_pci_remove()
1078 unregister_framebuffer(info); ark_pci_remove()
1079 fb_dealloc_cmap(&info->cmap); ark_pci_remove()
1081 pci_iounmap(dev, info->screen_base); ark_pci_remove()
1085 framebuffer_release(info); ark_pci_remove()
1095 struct fb_info *info = pci_get_drvdata(dev); ark_pci_suspend() local
1096 struct arkfb_info *par = info->par; ark_pci_suspend()
1098 dev_info(info->device, "suspend\n"); ark_pci_suspend()
1109 fb_set_suspend(info, 1); ark_pci_suspend()
1126 struct fb_info *info = pci_get_drvdata(dev); ark_pci_resume() local
1127 struct arkfb_info *par = info->par; ark_pci_resume()
1129 dev_info(info->device, "resume\n"); ark_pci_resume()
1145 arkfb_set_par(info); ark_pci_resume()
1146 fb_set_suspend(info, 0); ark_pci_resume()
H A Dsunxvr1000.c13 struct fb_info *info; member in struct:gfb_info
45 unsigned transp, struct fb_info *info) gfb_setcolreg()
55 ((u32 *)info->pseudo_palette)[regno] = value; gfb_setcolreg()
71 struct fb_info *info = gp->info; gfb_set_fbinfo() local
72 struct fb_var_screeninfo *var = &info->var; gfb_set_fbinfo()
74 info->flags = FBINFO_DEFAULT; gfb_set_fbinfo()
75 info->fbops = &gfb_ops; gfb_set_fbinfo()
76 info->screen_base = gp->fb_base; gfb_set_fbinfo()
77 info->screen_size = gp->fb_size; gfb_set_fbinfo()
79 info->pseudo_palette = gp->pseudo_palette; gfb_set_fbinfo()
82 strlcpy(info->fix.id, "gfb", sizeof(info->fix.id)); gfb_set_fbinfo()
83 info->fix.smem_start = gp->fb_base_phys; gfb_set_fbinfo()
84 info->fix.smem_len = gp->fb_size; gfb_set_fbinfo()
85 info->fix.type = FB_TYPE_PACKED_PIXELS; gfb_set_fbinfo()
87 info->fix.visual = FB_VISUAL_TRUECOLOR; gfb_set_fbinfo()
89 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; gfb_set_fbinfo()
106 if (fb_alloc_cmap(&info->cmap, 256, 0)) { gfb_set_fbinfo()
117 struct fb_info *info; gfb_probe() local
121 info = framebuffer_alloc(sizeof(struct gfb_info), &op->dev); gfb_probe()
122 if (!info) { gfb_probe()
128 gp = info->par; gfb_probe()
129 gp->info = info; gfb_probe()
139 info->fix.line_length = 16384; gfb_probe()
140 gp->fb_size = info->fix.line_length * gp->height; gfb_probe()
155 err = register_framebuffer(info); gfb_probe()
162 dev_set_drvdata(&op->dev, info); gfb_probe()
170 framebuffer_release(info); gfb_probe()
178 struct fb_info *info = dev_get_drvdata(&op->dev); gfb_remove() local
179 struct gfb_info *gp = info->par; gfb_remove()
181 unregister_framebuffer(info); gfb_remove()
187 framebuffer_release(info); gfb_remove()
43 gfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) gfb_setcolreg() argument
H A Dclps711x-fb.c49 u_int blue, u_int transp, struct fb_info *info) clps711x_fb_setcolreg()
51 struct clps711x_fb_info *cfb = info->par; clps711x_fb_setcolreg()
54 if (regno >= BIT(info->var.bits_per_pixel)) clps711x_fb_setcolreg()
72 struct fb_info *info) clps711x_fb_check_var()
105 static int clps711x_fb_set_par(struct fb_info *info) clps711x_fb_set_par() argument
107 struct clps711x_fb_info *cfb = info->par; clps711x_fb_set_par()
111 size = (info->var.xres * info->var.yres * info->var.bits_per_pixel) / 8; clps711x_fb_set_par()
115 switch (info->var.bits_per_pixel) { clps711x_fb_set_par()
117 info->fix.visual = FB_VISUAL_MONO01; clps711x_fb_set_par()
121 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; clps711x_fb_set_par()
127 info->fix.line_length = info->var.xres * info->var.bits_per_pixel / 8; clps711x_fb_set_par()
128 info->fix.smem_len = size; clps711x_fb_set_par()
130 lcdcon = (info->var.xres * info->var.yres * clps711x_fb_set_par()
131 info->var.bits_per_pixel) / 128 - 1; clps711x_fb_set_par()
132 lcdcon |= ((info->var.xres / 16) - 1) << 13; clps711x_fb_set_par()
135 pps = clk_get_rate(cfb->clk) / (PICOS2KHZ(info->var.pixclock) * 1000); clps711x_fb_set_par()
140 if (info->var.bits_per_pixel == 4) clps711x_fb_set_par()
142 if (info->var.bits_per_pixel >= 2) clps711x_fb_set_par()
154 static int clps711x_fb_blank(int blank, struct fb_info *info) clps711x_fb_blank() argument
218 struct fb_info *info; clps711x_fb_probe() local
226 info = framebuffer_alloc(sizeof(*cfb), dev); clps711x_fb_probe()
227 if (!info) clps711x_fb_probe()
230 cfb = info->par; clps711x_fb_probe()
231 platform_set_drvdata(pdev, info); clps711x_fb_probe()
242 info->fix.mmio_start = res->start; clps711x_fb_probe()
243 info->fix.mmio_len = resource_size(res); clps711x_fb_probe()
246 info->screen_base = devm_ioremap_resource(dev, res); clps711x_fb_probe()
247 if (IS_ERR(info->screen_base)) { clps711x_fb_probe()
248 ret = PTR_ERR(info->screen_base); clps711x_fb_probe()
258 info->apertures = alloc_apertures(1); clps711x_fb_probe()
259 if (!info->apertures) { clps711x_fb_probe()
265 info->fix.smem_start = res->start; clps711x_fb_probe()
266 info->apertures->ranges[0].base = info->fix.smem_start; clps711x_fb_probe()
267 info->apertures->ranges[0].size = cfb->buffsize; clps711x_fb_probe()
297 &info->var.bits_per_pixel); clps711x_fb_probe()
302 if (info->fix.smem_start != (readb(cfb->base + CLPS711X_FBADDR) << 28)) clps711x_fb_probe()
312 writeb(info->fix.smem_start >> 28, cfb->base + CLPS711X_FBADDR); clps711x_fb_probe()
314 memset_io(info->screen_base, 0, cfb->buffsize); clps711x_fb_probe()
323 info->fbops = &clps711x_fb_ops; clps711x_fb_probe()
324 info->flags = FBINFO_DEFAULT; clps711x_fb_probe()
325 info->var.activate = FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW; clps711x_fb_probe()
326 info->var.height = -1; clps711x_fb_probe()
327 info->var.width = -1; clps711x_fb_probe()
328 info->var.vmode = FB_VMODE_NONINTERLACED; clps711x_fb_probe()
329 info->fix.type = FB_TYPE_PACKED_PIXELS; clps711x_fb_probe()
330 info->fix.accel = FB_ACCEL_NONE; clps711x_fb_probe()
331 strlcpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id)); clps711x_fb_probe()
332 fb_videomode_to_var(&info->var, &cfb->mode); clps711x_fb_probe()
334 ret = fb_alloc_cmap(&info->cmap, BIT(CLPS711X_FB_BPP_MAX), 0); clps711x_fb_probe()
338 ret = fb_set_var(info, &info->var); clps711x_fb_probe()
342 ret = register_framebuffer(info); clps711x_fb_probe()
352 unregister_framebuffer(info); clps711x_fb_probe()
356 fb_dealloc_cmap(&info->cmap); clps711x_fb_probe()
359 framebuffer_release(info); clps711x_fb_probe()
366 struct fb_info *info = platform_get_drvdata(pdev); clps711x_fb_remove() local
367 struct clps711x_fb_info *cfb = info->par; clps711x_fb_remove()
371 unregister_framebuffer(info); clps711x_fb_remove()
372 fb_dealloc_cmap(&info->cmap); clps711x_fb_remove()
373 framebuffer_release(info); clps711x_fb_remove()
48 clps711x_fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) clps711x_fb_setcolreg() argument
71 clps711x_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) clps711x_fb_check_var() argument
H A Datafb.h4 void atafb_mfb_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
6 void atafb_mfb_fillrect(struct fb_info *info, u_long next_line, u32 color,
8 void atafb_mfb_linefill(struct fb_info *info, u_long next_line,
12 void atafb_iplan2p2_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
14 void atafb_iplan2p2_fillrect(struct fb_info *info, u_long next_line, u32 color,
16 void atafb_iplan2p2_linefill(struct fb_info *info, u_long next_line,
20 void atafb_iplan2p4_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
22 void atafb_iplan2p4_fillrect(struct fb_info *info, u_long next_line, u32 color,
24 void atafb_iplan2p4_linefill(struct fb_info *info, u_long next_line,
28 void atafb_iplan2p8_copyarea(struct fb_info *info, u_long next_line, int sy, int sx, int dy,
30 void atafb_iplan2p8_fillrect(struct fb_info *info, u_long next_line, u32 color,
32 void atafb_iplan2p8_linefill(struct fb_info *info, u_long next_line,
H A Dclps711xfb.c51 u_int transp, struct fb_info *info) clps7111fb_setcolreg()
55 if (regno >= (1 << info->var.bits_per_pixel)) clps7111fb_setcolreg()
90 clps7111fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) clps7111fb_check_var() argument
111 clps7111fb_set_par(struct fb_info *info) clps7111fb_set_par() argument
115 switch (info->var.bits_per_pixel) { clps7111fb_set_par()
117 info->fix.visual = FB_VISUAL_MONO01; clps7111fb_set_par()
120 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; clps7111fb_set_par()
123 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; clps7111fb_set_par()
127 info->fix.line_length = info->var.xres_virtual * info->var.bits_per_pixel / 8; clps7111fb_set_par()
129 lcdcon = (info->var.xres_virtual * info->var.yres_virtual * info->var.bits_per_pixel) / 128 - 1; clps7111fb_set_par()
130 lcdcon |= ((info->var.xres_virtual / 16) - 1) << 13; clps7111fb_set_par()
142 pixclock = 9 * info->var.pixclock / 244140 - 1; clps7111fb_set_par()
145 if (info->var.bits_per_pixel == 4) clps7111fb_set_par()
147 if (info->var.bits_per_pixel >= 2) clps7111fb_set_par()
160 static int clps7111fb_blank(int blank, struct fb_info *info) clps7111fb_blank() argument
182 static void clps711x_guess_lcd_params(struct fb_info *info) clps711x_guess_lcd_params() argument
188 info->var.xres_virtual = 640; clps711x_guess_lcd_params()
189 info->var.yres_virtual = 240; clps711x_guess_lcd_params()
190 info->var.bits_per_pixel = 4; clps711x_guess_lcd_params()
191 info->var.activate = FB_ACTIVATE_NOW; clps711x_guess_lcd_params()
192 info->var.height = -1; clps711x_guess_lcd_params()
193 info->var.width = -1; clps711x_guess_lcd_params()
194 info->var.pixclock = 93006; /* 10.752MHz pixel clock */ clps711x_guess_lcd_params()
209 info->var.bits_per_pixel = 4; clps711x_guess_lcd_params()
213 info->var.bits_per_pixel = 2; clps711x_guess_lcd_params()
217 info->var.bits_per_pixel = 1; clps711x_guess_lcd_params()
224 info->var.xres_virtual = (((lcdcon >> 13) & 0x3f) + 1) * 16; clps711x_guess_lcd_params()
225 info->var.yres_virtual = (((lcdcon & 0x1fff) + 1) * 128) / clps711x_guess_lcd_params()
226 (info->var.xres_virtual * clps711x_guess_lcd_params()
227 info->var.bits_per_pixel); clps711x_guess_lcd_params()
232 info->var.pixclock = (((lcdcon >> 19) & 0x3f) + 1) * 244140 / 9; clps711x_guess_lcd_params()
240 info->var.xres = info->var.xres_virtual; clps711x_guess_lcd_params()
241 info->var.yres = info->var.yres_virtual; clps711x_guess_lcd_params()
242 info->var.grayscale = info->var.bits_per_pixel > 1; clps711x_guess_lcd_params()
244 size = info->var.xres * info->var.yres * info->var.bits_per_pixel / 8; clps711x_guess_lcd_params()
264 info->screen_base = virt_base; clps711x_guess_lcd_params()
265 info->fix.smem_start = phys_base; clps711x_guess_lcd_params()
266 info->fix.smem_len = PAGE_ALIGN(size); clps711x_guess_lcd_params()
267 info->fix.type = FB_TYPE_PACKED_PIXELS; clps711x_guess_lcd_params()
50 clps7111fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) clps7111fb_setcolreg() argument
H A Dwmt_ge_rops.h3 extern void wmt_ge_fillrect(struct fb_info *info,
5 extern void wmt_ge_copyarea(struct fb_info *info,
7 extern int wmt_ge_sync(struct fb_info *info);
H A Dvt8500lcdfb.c47 static int vt8500lcd_set_par(struct fb_info *info) vt8500lcd_set_par() argument
49 struct vt8500lcd_info *fbi = to_vt8500lcd_info(info); vt8500lcd_set_par()
57 if (info->var.bits_per_pixel <= 8) { vt8500lcd_set_par()
59 info->var.red.offset = 0; vt8500lcd_set_par()
60 info->var.red.length = info->var.bits_per_pixel; vt8500lcd_set_par()
61 info->var.red.msb_right = 0; vt8500lcd_set_par()
63 info->var.green.offset = 0; vt8500lcd_set_par()
64 info->var.green.length = info->var.bits_per_pixel; vt8500lcd_set_par()
65 info->var.green.msb_right = 0; vt8500lcd_set_par()
67 info->var.blue.offset = 0; vt8500lcd_set_par()
68 info->var.blue.length = info->var.bits_per_pixel; vt8500lcd_set_par()
69 info->var.blue.msb_right = 0; vt8500lcd_set_par()
71 info->var.transp.offset = 0; vt8500lcd_set_par()
72 info->var.transp.length = 0; vt8500lcd_set_par()
73 info->var.transp.msb_right = 0; vt8500lcd_set_par()
75 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; vt8500lcd_set_par()
76 info->fix.line_length = info->var.xres_virtual / vt8500lcd_set_par()
77 (8/info->var.bits_per_pixel); vt8500lcd_set_par()
80 info->var.transp.offset = 0; vt8500lcd_set_par()
81 info->var.transp.length = 0; vt8500lcd_set_par()
82 info->var.transp.msb_right = 0; vt8500lcd_set_par()
84 if (info->var.bits_per_pixel == 16) { vt8500lcd_set_par()
86 info->var.red.offset = 11; vt8500lcd_set_par()
87 info->var.red.length = 5; vt8500lcd_set_par()
88 info->var.red.msb_right = 0; vt8500lcd_set_par()
89 info->var.green.offset = 5; vt8500lcd_set_par()
90 info->var.green.length = 6; vt8500lcd_set_par()
91 info->var.green.msb_right = 0; vt8500lcd_set_par()
92 info->var.blue.offset = 0; vt8500lcd_set_par()
93 info->var.blue.length = 5; vt8500lcd_set_par()
94 info->var.blue.msb_right = 0; vt8500lcd_set_par()
97 info->var.red.offset = info->var.bits_per_pixel vt8500lcd_set_par()
99 info->var.red.length = info->var.bits_per_pixel / 3; vt8500lcd_set_par()
100 info->var.red.msb_right = 0; vt8500lcd_set_par()
101 info->var.green.offset = info->var.bits_per_pixel / 3; vt8500lcd_set_par()
102 info->var.green.length = info->var.bits_per_pixel / 3; vt8500lcd_set_par()
103 info->var.green.msb_right = 0; vt8500lcd_set_par()
104 info->var.blue.offset = 0; vt8500lcd_set_par()
105 info->var.blue.length = info->var.bits_per_pixel / 3; vt8500lcd_set_par()
106 info->var.blue.msb_right = 0; vt8500lcd_set_par()
109 info->fix.visual = FB_VISUAL_TRUECOLOR; vt8500lcd_set_par()
110 info->fix.line_length = info->var.bits_per_pixel > 16 ? vt8500lcd_set_par()
111 info->var.xres_virtual << 2 : vt8500lcd_set_par()
112 info->var.xres_virtual << 1; vt8500lcd_set_par()
116 if (bpp_values[i] == info->var.bits_per_pixel) vt8500lcd_set_par()
124 writel((((info->var.hsync_len - 1) & 0x3f) << 26) vt8500lcd_set_par()
125 | ((info->var.left_margin & 0xff) << 18) vt8500lcd_set_par()
126 | (((info->var.xres - 1) & 0x3ff) << 8) vt8500lcd_set_par()
127 | (info->var.right_margin & 0xff), fbi->regbase + 0x4); vt8500lcd_set_par()
128 writel((((info->var.vsync_len - 1) & 0x3f) << 26) vt8500lcd_set_par()
129 | ((info->var.upper_margin & 0xff) << 18) vt8500lcd_set_par()
130 | (((info->var.yres - 1) & 0x3ff) << 8) vt8500lcd_set_par()
131 | (info->var.lower_margin & 0xff), fbi->regbase + 0x8); vt8500lcd_set_par()
132 writel((((info->var.yres - 1) & 0x400) << 2) vt8500lcd_set_par()
133 | ((info->var.xres - 1) & 0x400), fbi->regbase + 0x10); vt8500lcd_set_par()
149 struct fb_info *info) { vt8500lcd_setcolreg()
150 struct vt8500lcd_info *fbi = to_vt8500lcd_info(info); vt8500lcd_setcolreg()
156 if (info->var.grayscale) vt8500lcd_setcolreg()
186 static int vt8500lcd_ioctl(struct fb_info *info, unsigned int cmd, vt8500lcd_ioctl() argument
190 struct vt8500lcd_info *fbi = to_vt8500lcd_info(info); vt8500lcd_ioctl()
209 struct fb_info *info) vt8500lcd_pan_display()
211 unsigned pixlen = info->fix.line_length / info->var.xres_virtual; vt8500lcd_pan_display()
213 + info->fix.line_length * var->yoffset; vt8500lcd_pan_display()
214 struct vt8500lcd_info *fbi = to_vt8500lcd_info(info); vt8500lcd_pan_display()
217 | (((info->var.xres_virtual - info->var.xres) * pixlen / 4) << 20) vt8500lcd_pan_display()
228 static int vt8500lcd_blank(int blank, struct fb_info *info) vt8500lcd_blank() argument
237 if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR || vt8500lcd_blank()
238 info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR) vt8500lcd_blank()
240 vt8500lcd_setcolreg(i, 0, 0, 0, 0, info); vt8500lcd_blank()
242 if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR || vt8500lcd_blank()
243 info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR) vt8500lcd_blank()
244 fb_set_cmap(&info->cmap, info); vt8500lcd_blank()
147 vt8500lcd_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) vt8500lcd_setcolreg() argument
208 vt8500lcd_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) vt8500lcd_pan_display() argument
H A Dsimplefb.c50 u_int transp, struct fb_info *info) simplefb_setcolreg()
52 u32 *pal = info->pseudo_palette; simplefb_setcolreg()
53 u32 cr = red >> (16 - info->var.red.length); simplefb_setcolreg()
54 u32 cg = green >> (16 - info->var.green.length); simplefb_setcolreg()
55 u32 cb = blue >> (16 - info->var.blue.length); simplefb_setcolreg()
61 value = (cr << info->var.red.offset) | simplefb_setcolreg()
62 (cg << info->var.green.offset) | simplefb_setcolreg()
63 (cb << info->var.blue.offset); simplefb_setcolreg()
64 if (info->var.transp.length > 0) { simplefb_setcolreg()
65 u32 mask = (1 << info->var.transp.length) - 1; simplefb_setcolreg()
66 mask <<= info->var.transp.offset; simplefb_setcolreg()
74 static void simplefb_destroy(struct fb_info *info) simplefb_destroy() argument
76 if (info->screen_base) simplefb_destroy()
77 iounmap(info->screen_base); simplefb_destroy()
276 struct fb_info *info; simplefb_probe() local
298 info = framebuffer_alloc(sizeof(struct simplefb_par), &pdev->dev); simplefb_probe()
299 if (!info) simplefb_probe()
301 platform_set_drvdata(pdev, info); simplefb_probe()
303 par = info->par; simplefb_probe()
305 info->fix = simplefb_fix; simplefb_probe()
306 info->fix.smem_start = mem->start; simplefb_probe()
307 info->fix.smem_len = resource_size(mem); simplefb_probe()
308 info->fix.line_length = params.stride; simplefb_probe()
310 info->var = simplefb_var; simplefb_probe()
311 info->var.xres = params.width; simplefb_probe()
312 info->var.yres = params.height; simplefb_probe()
313 info->var.xres_virtual = params.width; simplefb_probe()
314 info->var.yres_virtual = params.height; simplefb_probe()
315 info->var.bits_per_pixel = params.format->bits_per_pixel; simplefb_probe()
316 info->var.red = params.format->red; simplefb_probe()
317 info->var.green = params.format->green; simplefb_probe()
318 info->var.blue = params.format->blue; simplefb_probe()
319 info->var.transp = params.format->transp; simplefb_probe()
321 info->apertures = alloc_apertures(1); simplefb_probe()
322 if (!info->apertures) { simplefb_probe()
326 info->apertures->ranges[0].base = info->fix.smem_start; simplefb_probe()
327 info->apertures->ranges[0].size = info->fix.smem_len; simplefb_probe()
329 info->fbops = &simplefb_ops; simplefb_probe()
330 info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE; simplefb_probe()
331 info->screen_base = ioremap_wc(info->fix.smem_start, simplefb_probe()
332 info->fix.smem_len); simplefb_probe()
333 if (!info->screen_base) { simplefb_probe()
337 info->pseudo_palette = par->palette; simplefb_probe()
344 info->fix.smem_start, info->fix.smem_len, simplefb_probe()
345 info->screen_base); simplefb_probe()
348 info->var.xres, info->var.yres, simplefb_probe()
349 info->var.bits_per_pixel, info->fix.line_length); simplefb_probe()
351 ret = register_framebuffer(info); simplefb_probe()
357 dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node); simplefb_probe()
364 iounmap(info->screen_base); simplefb_probe()
366 framebuffer_release(info); simplefb_probe()
372 struct fb_info *info = platform_get_drvdata(pdev); simplefb_remove() local
373 struct simplefb_par *par = info->par; simplefb_remove()
375 unregister_framebuffer(info); simplefb_remove()
377 framebuffer_release(info); simplefb_remove()
49 simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) simplefb_setcolreg() argument
H A Dfb-puv3.c104 static void unifb_sync(struct fb_info *info) unifb_sync() argument
115 dev_warn(info->device, "Warning: UniGFX GE time out ...\n"); unifb_sync()
118 static void unifb_prim_fillrect(struct fb_info *info, unifb_prim_fillrect() argument
123 int m_iBpp = info->var.bits_per_pixel; unifb_prim_fillrect()
124 int screen_width = info->var.xres; unifb_prim_fillrect()
146 int bottom = info->var.yres - 1; unifb_prim_fillrect()
147 int right = info->var.xres - 1; unifb_prim_fillrect()
162 unifb_sync(info); unifb_prim_fillrect()
164 writel(((u32 *)(info->pseudo_palette))[fg_color], UGE_FCOLOR); unifb_prim_fillrect()
178 static void unifb_fillrect(struct fb_info *info, unifb_fillrect() argument
184 if (info->flags & FBINFO_HWACCEL_DISABLED) { unifb_fillrect()
185 sys_fillrect(info, region); unifb_fillrect()
189 vxres = info->var.xres_virtual; unifb_fillrect()
190 vyres = info->var.yres_virtual; unifb_fillrect()
203 unifb_prim_fillrect(info, &modded); unifb_fillrect()
206 static void unifb_prim_copyarea(struct fb_info *info, unifb_prim_copyarea() argument
211 int m_iBpp = info->var.bits_per_pixel; unifb_prim_copyarea()
212 int screen_width = info->var.xres; unifb_prim_copyarea()
236 int bottom = info->var.yres; unifb_prim_copyarea()
237 int right = info->var.xres; unifb_prim_copyarea()
269 unifb_sync(info); unifb_prim_copyarea()
285 static void unifb_copyarea(struct fb_info *info, const struct fb_copyarea *area) unifb_copyarea() argument
296 if (info->flags & FBINFO_HWACCEL_DISABLED) { unifb_copyarea()
297 sys_copyarea(info, area); unifb_copyarea()
301 vxres = info->var.xres_virtual; unifb_copyarea()
302 vyres = info->var.yres_virtual; unifb_copyarea()
318 unifb_prim_copyarea(info, &modded); unifb_copyarea()
321 static void unifb_imageblit(struct fb_info *info, const struct fb_image *image) unifb_imageblit() argument
323 sys_imageblit(info, image); unifb_imageblit()
344 struct fb_info *info) unifb_check_var()
355 var->xoffset = info->var.xoffset; unifb_check_var()
356 var->yoffset = info->var.yoffset; unifb_check_var()
465 * the hardware state info->par and fix which can be affected by the
468 static int unifb_set_par(struct fb_info *info) unifb_set_par() argument
479 if (info->var.xres == unifb_modes[i].xres unifb_set_par()
480 && info->var.yres == unifb_modes[i].yres unifb_set_par()
481 && info->var.upper_margin == unifb_modes[i].upper_margin unifb_set_par()
482 && info->var.lower_margin == unifb_modes[i].lower_margin unifb_set_par()
483 && info->var.left_margin == unifb_modes[i].left_margin unifb_set_par()
484 && info->var.right_margin == unifb_modes[i].right_margin unifb_set_par()
485 && info->var.hsync_len == unifb_modes[i].hsync_len unifb_set_par()
486 && info->var.vsync_len == unifb_modes[i].vsync_len) { unifb_set_par()
493 clk_vga = clk_get(info->device, "VGA_CLK"); unifb_set_par()
499 info->fix = unifb_fix; unifb_set_par()
500 info->var = unifb_default; unifb_set_par()
507 info->fix.line_length = get_line_length(info->var.xres_virtual, unifb_set_par()
508 info->var.bits_per_pixel); unifb_set_par()
510 hSyncStart = info->var.xres + info->var.right_margin; unifb_set_par()
511 hSyncEnd = hSyncStart + info->var.hsync_len; unifb_set_par()
512 hTotal = hSyncEnd + info->var.left_margin; unifb_set_par()
514 vSyncStart = info->var.yres + info->var.lower_margin; unifb_set_par()
515 vSyncEnd = vSyncStart + info->var.vsync_len; unifb_set_par()
516 vTotal = vSyncEnd + info->var.upper_margin; unifb_set_par()
518 switch (info->var.bits_per_pixel) { unifb_set_par()
535 writel(info->fix.smem_start, UDE_FSA); unifb_set_par()
536 writel(info->var.yres, UDE_LS); unifb_set_par()
537 writel(get_line_length(info->var.xres, unifb_set_par()
538 info->var.bits_per_pixel) >> 3, UDE_PS); unifb_set_par()
540 writel((hTotal << 16) | (info->var.xres), UDE_HAT); unifb_set_par()
541 writel(((hTotal - 1) << 16) | (info->var.xres - 1), UDE_HBT); unifb_set_par()
543 writel((vTotal << 16) | (info->var.yres), UDE_VAT); unifb_set_par()
544 writel(((vTotal - 1) << 16) | (info->var.yres - 1), UDE_VBT); unifb_set_par()
558 u_int transp, struct fb_info *info) unifb_setcolreg()
564 if (info->var.grayscale) { unifb_setcolreg()
571 switch (info->fix.visual) { unifb_setcolreg()
574 red = CNVT_TOHW(red, info->var.red.length); unifb_setcolreg()
575 green = CNVT_TOHW(green, info->var.green.length); unifb_setcolreg()
576 blue = CNVT_TOHW(blue, info->var.blue.length); unifb_setcolreg()
577 transp = CNVT_TOHW(transp, info->var.transp.length); unifb_setcolreg()
589 if (info->fix.visual == FB_VISUAL_TRUECOLOR) { unifb_setcolreg()
595 v = (red << info->var.red.offset) | unifb_setcolreg()
596 (green << info->var.green.offset) | unifb_setcolreg()
597 (blue << info->var.blue.offset) | unifb_setcolreg()
598 (transp << info->var.transp.offset); unifb_setcolreg()
599 switch (info->var.bits_per_pixel) { unifb_setcolreg()
605 ((u32 *) (info->pseudo_palette))[regno] = v; unifb_setcolreg()
621 struct fb_info *info) unifb_pan_display()
625 || var->yoffset >= info->var.yres_virtual unifb_pan_display()
629 if (var->xoffset + info->var.xres > info->var.xres_virtual || unifb_pan_display()
630 var->yoffset + info->var.yres > info->var.yres_virtual) unifb_pan_display()
633 info->var.xoffset = var->xoffset; unifb_pan_display()
634 info->var.yoffset = var->yoffset; unifb_pan_display()
636 info->var.vmode |= FB_VMODE_YWRAP; unifb_pan_display()
638 info->var.vmode &= ~FB_VMODE_YWRAP; unifb_pan_display()
642 int unifb_mmap(struct fb_info *info, unifb_mmap() argument
647 return vm_iomap_memory(vma, info->fix.smem_start, info->fix.smem_len); unifb_mmap()
668 struct fb_info *info; unifb_probe() local
687 info = framebuffer_alloc(sizeof(u32)*256, &dev->dev); unifb_probe()
688 if (!info) unifb_probe()
691 info->screen_base = (char __iomem *)videomemory; unifb_probe()
692 info->fbops = &unifb_ops; unifb_probe()
694 retval = fb_find_mode(&info->var, info, NULL, unifb_probe()
698 info->var = unifb_default; unifb_probe()
700 info->fix = unifb_fix; unifb_probe()
701 info->pseudo_palette = info->par; unifb_probe()
702 info->par = NULL; unifb_probe()
703 info->flags = FBINFO_FLAG_DEFAULT; unifb_probe()
705 info->fix.accel = FB_ACCEL_PUV3_UNIGFX; unifb_probe()
708 retval = fb_alloc_cmap(&info->cmap, 256, 0); unifb_probe()
712 retval = register_framebuffer(info); unifb_probe()
715 platform_set_drvdata(dev, info); unifb_probe()
718 fb_info(info, "Virtual frame buffer device, using %dM of video memory\n", unifb_probe()
722 fb_dealloc_cmap(&info->cmap); unifb_probe()
724 framebuffer_release(info); unifb_probe()
731 struct fb_info *info = platform_get_drvdata(dev); unifb_remove() local
733 if (info) { unifb_remove()
734 unregister_framebuffer(info); unifb_remove()
735 fb_dealloc_cmap(&info->cmap); unifb_remove()
736 framebuffer_release(info); unifb_remove()
343 unifb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) unifb_check_var() argument
557 unifb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) unifb_setcolreg() argument
620 unifb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) unifb_pan_display() argument
H A Dgrvga.c84 struct fb_info *info) grvga_check_var()
86 struct grvga_par *par = info->par; grvga_check_var()
107 if (info->fix.smem_len) { grvga_check_var()
108 if ((var->yres_virtual*var->xres_virtual*var->bits_per_pixel/8) > info->fix.smem_len) grvga_check_var()
122 switch (info->var.bits_per_pixel) { grvga_check_var()
149 static int grvga_set_par(struct fb_info *info) grvga_set_par() argument
153 struct grvga_par *par = info->par; grvga_set_par()
155 __raw_writel(((info->var.yres - 1) << 16) | (info->var.xres - 1), grvga_set_par()
158 __raw_writel((info->var.lower_margin << 16) | (info->var.right_margin), grvga_set_par()
161 __raw_writel((info->var.vsync_len << 16) | (info->var.hsync_len), grvga_set_par()
164 __raw_writel(((info->var.yres + info->var.lower_margin + info->var.upper_margin + info->var.vsync_len - 1) << 16) | grvga_set_par()
165 (info->var.xres + info->var.right_margin + info->var.left_margin + info->var.hsync_len - 1), grvga_set_par()
168 switch (info->var.bits_per_pixel) { grvga_set_par()
170 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; grvga_set_par()
174 info->fix.visual = FB_VISUAL_TRUECOLOR; grvga_set_par()
179 info->fix.visual = FB_VISUAL_TRUECOLOR; grvga_set_par()
189 info->fix.line_length = (info->var.xres_virtual*info->var.bits_per_pixel)/8; grvga_set_par()
193 static int grvga_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) grvga_setcolreg() argument
196 par = info->par; grvga_setcolreg()
201 if (info->var.grayscale) { grvga_setcolreg()
210 red = CNVT_TOHW(red, info->var.red.length); grvga_setcolreg()
211 green = CNVT_TOHW(green, info->var.green.length); grvga_setcolreg()
212 blue = CNVT_TOHW(blue, info->var.blue.length); grvga_setcolreg()
213 transp = CNVT_TOHW(transp, info->var.transp.length); grvga_setcolreg()
218 if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) grvga_setcolreg()
223 else if (info->fix.visual == FB_VISUAL_TRUECOLOR) { grvga_setcolreg()
229 v = (red << info->var.red.offset) | grvga_setcolreg()
230 (green << info->var.green.offset) | grvga_setcolreg()
231 (blue << info->var.blue.offset) | grvga_setcolreg()
232 (transp << info->var.transp.offset); grvga_setcolreg()
234 ((u32 *) (info->pseudo_palette))[regno] = v; grvga_setcolreg()
240 struct fb_info *info) grvga_pan_display()
242 struct grvga_par *par = info->par; grvga_pan_display()
243 struct fb_fix_screeninfo *fix = &info->fix; grvga_pan_display()
334 struct fb_info *info; grvga_probe() local
343 info = framebuffer_alloc(sizeof(struct grvga_par), &dev->dev); grvga_probe()
344 if (!info) { grvga_probe()
370 if (grvga_parse_custom(this_opt, &info->var) < 0) { grvga_probe()
383 par = info->par; grvga_probe()
384 info->fbops = &grvga_ops; grvga_probe()
385 info->fix = grvga_fix; grvga_probe()
386 info->pseudo_palette = par->color_palette; grvga_probe()
387 info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK | FBINFO_HWACCEL_YPAN; grvga_probe()
388 info->fix.smem_len = grvga_mem_size; grvga_probe()
407 retval = fb_alloc_cmap(&info->cmap, 256, 0); grvga_probe()
415 retval = fb_find_mode(&info->var, info, mode_opt, grvga_probe()
424 grvga_mem_size = info->var.xres_virtual * info->var.yres_virtual * info->var.bits_per_pixel/8; grvga_probe()
475 info->screen_base = (char __iomem *) virtual_start; grvga_probe()
476 info->fix.smem_start = physical_start; grvga_probe()
477 info->fix.smem_len = grvga_mem_size; grvga_probe()
479 dev_set_drvdata(&dev->dev, info); grvga_probe()
483 info->node, info->var.xres, info->var.yres, info->var.bits_per_pixel, grvga_probe()
484 grvga_mem_size >> 10, info->screen_base); grvga_probe()
486 retval = register_framebuffer(info); grvga_probe()
504 fb_dealloc_cmap(&info->cmap); grvga_probe()
509 framebuffer_release(info); grvga_probe()
516 struct fb_info *info = dev_get_drvdata(&device->dev); grvga_remove() local
519 if (info) { grvga_remove()
520 par = info->par; grvga_remove()
521 unregister_framebuffer(info); grvga_remove()
522 fb_dealloc_cmap(&info->cmap); grvga_remove()
528 iounmap(info->screen_base); grvga_remove()
530 kfree((void *)info->screen_base); grvga_remove()
532 framebuffer_release(info); grvga_remove()
83 grvga_check_var(struct fb_var_screeninfo *var, struct fb_info *info) grvga_check_var() argument
239 grvga_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) grvga_pan_display() argument
H A Dpmag-aa-fb.c53 struct fb_info *info);
85 struct fb_info info; member in struct:aafb_info
105 static void aafb_set_cursor(struct aafb_info *info, int on) aafb_set_cursor() argument
107 struct aafb_cursor *c = &info->cursor; aafb_set_cursor()
110 bt431_position_cursor(info->bt431, c->x, c->y); aafb_set_cursor()
111 bt431_enable_cursor(info->bt431); aafb_set_cursor()
113 bt431_erase_cursor(info->bt431); aafb_set_cursor()
118 struct aafb_info *info = (struct aafb_info *)disp->fb_info; aafbcon_cursor() local
119 struct aafb_cursor *c = &info->cursor; aafbcon_cursor()
129 aafb_set_cursor(info, 0); aafbcon_cursor()
140 aafb_set_cursor(info, c->on); aafbcon_cursor()
150 struct aafb_info *info = (struct aafb_info *)disp->fb_info; aafbcon_set_font() local
151 struct aafb_cursor *c = &info->cursor; aafbcon_set_font()
152 u8 fgc = ~attr_bgcol_ec(disp, disp->conp, &info->info); aafbcon_set_font()
160 bt431_set_font(info->bt431, fgc, width, height); aafbcon_set_font()
167 struct aafb_info *info = (struct aafb_info *)data; aafb_cursor_timer_handler() local
168 struct aafb_cursor *c = &info->cursor; aafb_cursor_timer_handler()
175 aafb_set_cursor(info, c->on); aafb_cursor_timer_handler()
184 static void __init aafb_cursor_init(struct aafb_info *info) aafb_cursor_init() argument
186 struct aafb_cursor *c = &info->cursor; aafb_cursor_init()
196 c->timer.data = (unsigned long)info; aafb_cursor_init()
201 static void __exit aafb_cursor_exit(struct aafb_info *info) aafb_cursor_exit() argument
203 struct aafb_cursor *c = &info->cursor; aafb_cursor_exit()
227 struct fb_info *info) aafb_get_fix()
229 struct aafb_info *ip = (struct aafb_info *)info; aafb_get_fix()
246 struct aafb_info *info) aafb_set_disp()
250 disp->fb_info = &info->info; aafb_set_disp()
251 aafb_set_var(&disp->var, con, &info->info); aafb_set_disp()
257 aafb_get_fix(&fix, con, &info->info); aafb_set_disp()
274 struct fb_info *info) aafb_get_cmap()
284 struct fb_info *info) aafb_set_cmap()
299 static int aafb_ioctl(struct fb_info *info, u32 cmd, unsigned long arg) aafb_ioctl() argument
305 static int aafb_switch(int con, struct fb_info *info) aafb_switch() argument
307 struct aafb_info *ip = (struct aafb_info *)info; aafb_switch()
352 struct fb_info *info) aafb_get_var()
361 *var = info->var; aafb_get_var()
367 struct fb_info *info) aafb_set_var()
373 info->var = *var; aafb_set_var()
378 static int aafb_update_var(int con, struct fb_info *info) aafb_update_var() argument
380 struct aafb_info *ip = (struct aafb_info *)info; aafb_update_var()
391 static void aafb_blank(int blank, struct fb_info *info) aafb_blank() argument
393 struct aafb_info *ip = (struct aafb_info *)info; aafb_blank()
430 strcpy(ip->info.modename, "PMAG-AA"); init_one()
431 ip->info.node = -1; init_one()
432 ip->info.flags = FBINFO_FLAG_DEFAULT; init_one()
433 ip->info.fbops = &aafb_ops; init_one()
434 ip->info.disp = &ip->disp; init_one()
435 ip->info.changevar = NULL; init_one()
436 ip->info.switch_con = &aafb_switch; init_one()
437 ip->info.updatevar = &aafb_update_var; init_one()
438 ip->info.blank = &aafb_blank; init_one()
458 if (register_framebuffer(&ip->info) < 0) init_one()
462 GET_FB_IDX(ip->info.node), ip->info.modename, slot); init_one()
471 if (unregister_framebuffer(&ip->info) < 0) exit_one()
226 aafb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) aafb_get_fix() argument
245 aafb_set_disp(struct display *disp, int con, struct aafb_info *info) aafb_set_disp() argument
273 aafb_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) aafb_get_cmap() argument
283 aafb_set_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) aafb_set_cmap() argument
351 aafb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) aafb_get_var() argument
366 aafb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) aafb_set_var() argument
H A Dsunxvr500.c27 struct fb_info *info; member in struct:e3d_info
112 unsigned transp, struct fb_info *info) e3d_setcolreg()
114 struct e3d_info *ep = info->par; e3d_setcolreg()
128 if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16) e3d_setcolreg()
129 ((u32 *)info->pseudo_palette)[regno] = value; e3d_setcolreg()
149 static void e3d_imageblit(struct fb_info *info, const struct fb_image *image) e3d_imageblit() argument
151 struct e3d_info *ep = info->par; e3d_imageblit()
155 cfb_imageblit(info, image); e3d_imageblit()
156 info->screen_base += ep->fb8_buf_diff; e3d_imageblit()
157 cfb_imageblit(info, image); e3d_imageblit()
158 info->screen_base -= ep->fb8_buf_diff; e3d_imageblit()
162 static void e3d_fillrect(struct fb_info *info, const struct fb_fillrect *rect) e3d_fillrect() argument
164 struct e3d_info *ep = info->par; e3d_fillrect()
168 cfb_fillrect(info, rect); e3d_fillrect()
169 info->screen_base += ep->fb8_buf_diff; e3d_fillrect()
170 cfb_fillrect(info, rect); e3d_fillrect()
171 info->screen_base -= ep->fb8_buf_diff; e3d_fillrect()
175 static void e3d_copyarea(struct fb_info *info, const struct fb_copyarea *area) e3d_copyarea() argument
177 struct e3d_info *ep = info->par; e3d_copyarea()
181 cfb_copyarea(info, area); e3d_copyarea()
182 info->screen_base += ep->fb8_buf_diff; e3d_copyarea()
183 cfb_copyarea(info, area); e3d_copyarea()
184 info->screen_base -= ep->fb8_buf_diff; e3d_copyarea()
198 struct fb_info *info = ep->info; e3d_set_fbinfo() local
199 struct fb_var_screeninfo *var = &info->var; e3d_set_fbinfo()
201 info->flags = FBINFO_DEFAULT; e3d_set_fbinfo()
202 info->fbops = &e3d_ops; e3d_set_fbinfo()
203 info->screen_base = ep->fb_base; e3d_set_fbinfo()
204 info->screen_size = ep->fb_size; e3d_set_fbinfo()
206 info->pseudo_palette = ep->pseudo_palette; e3d_set_fbinfo()
209 strlcpy(info->fix.id, "e3d", sizeof(info->fix.id)); e3d_set_fbinfo()
210 info->fix.smem_start = ep->fb_base_phys; e3d_set_fbinfo()
211 info->fix.smem_len = ep->fb_size; e3d_set_fbinfo()
212 info->fix.type = FB_TYPE_PACKED_PIXELS; e3d_set_fbinfo()
214 info->fix.visual = FB_VISUAL_TRUECOLOR; e3d_set_fbinfo()
216 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; e3d_set_fbinfo()
233 if (fb_alloc_cmap(&info->cmap, 256, 0)) { e3d_set_fbinfo()
246 struct fb_info *info; e3d_pci_register() local
272 info = framebuffer_alloc(sizeof(struct e3d_info), &pdev->dev); e3d_pci_register()
273 if (!info) { e3d_pci_register()
279 ep = info->par; e3d_pci_register()
280 ep->info = info; e3d_pci_register()
333 info->fix.line_length = line_length; e3d_pci_register()
336 info->fix.line_length = line_length * 2; e3d_pci_register()
339 info->fix.line_length = line_length * 3; e3d_pci_register()
342 info->fix.line_length = line_length * 4; e3d_pci_register()
345 ep->fb_size = info->fix.line_length * ep->height; e3d_pci_register()
357 pci_set_drvdata(pdev, info); e3d_pci_register()
361 err = register_framebuffer(info); e3d_pci_register()
371 fb_dealloc_cmap(&info->cmap); e3d_pci_register()
386 framebuffer_release(info); e3d_pci_register()
397 struct fb_info *info = pci_get_drvdata(pdev); e3d_pci_unregister() local
398 struct e3d_info *ep = info->par; e3d_pci_unregister()
400 unregister_framebuffer(info); e3d_pci_unregister()
408 fb_dealloc_cmap(&info->cmap); e3d_pci_unregister()
409 framebuffer_release(info); e3d_pci_unregister()
110 e3d_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) e3d_setcolreg() argument
H A Dcg3.c130 * @info: frame buffer info structure
139 unsigned transp, struct fb_info *info) cg3_setcolreg()
141 struct cg3_par *par = (struct cg3_par *) info->par; cg3_setcolreg()
182 * @info: frame buffer structure that represents a single frame buffer
184 static int cg3_blank(int blank, struct fb_info *info) cg3_blank() argument
186 struct cg3_par *par = (struct cg3_par *) info->par; cg3_blank()
226 static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma) cg3_mmap() argument
228 struct cg3_par *par = (struct cg3_par *)info->par; cg3_mmap()
231 info->fix.smem_start, info->fix.smem_len, cg3_mmap()
236 static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) cg3_ioctl() argument
238 return sbusfb_ioctl_helper(cmd, arg, info, cg3_ioctl()
239 FBTYPE_SUN3COLOR, 8, info->fix.smem_len); cg3_ioctl()
246 static void cg3_init_fix(struct fb_info *info, int linebytes, cg3_init_fix() argument
249 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); cg3_init_fix()
251 info->fix.type = FB_TYPE_PACKED_PIXELS; cg3_init_fix()
252 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; cg3_init_fix()
254 info->fix.line_length = linebytes; cg3_init_fix()
256 info->fix.accel = FB_ACCEL_SUN_CGTHREE; cg3_init_fix()
352 struct fb_info *info; cg3_probe() local
356 info = framebuffer_alloc(sizeof(struct cg3_par), &op->dev); cg3_probe()
359 if (!info) cg3_probe()
361 par = info->par; cg3_probe()
365 info->fix.smem_start = op->resource[0].start; cg3_probe()
368 sbusfb_fill_var(&info->var, dp, 8); cg3_probe()
369 info->var.red.length = 8; cg3_probe()
370 info->var.green.length = 8; cg3_probe()
371 info->var.blue.length = 8; cg3_probe()
375 cg3_rdi_maybe_fixup_var(&info->var, dp); cg3_probe()
378 info->var.xres); cg3_probe()
379 info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); cg3_probe()
386 info->flags = FBINFO_DEFAULT; cg3_probe()
387 info->fbops = &cg3_ops; cg3_probe()
388 info->screen_base = of_ioremap(&op->resource[0], CG3_RAM_OFFSET, cg3_probe()
389 info->fix.smem_len, "cg3 ram"); cg3_probe()
390 if (!info->screen_base) cg3_probe()
393 cg3_blank(FB_BLANK_UNBLANK, info); cg3_probe()
401 err = fb_alloc_cmap(&info->cmap, 256, 0); cg3_probe()
405 fb_set_cmap(&info->cmap, info); cg3_probe()
407 cg3_init_fix(info, linebytes, dp); cg3_probe()
409 err = register_framebuffer(info); cg3_probe()
413 dev_set_drvdata(&op->dev, info); cg3_probe()
416 dp->full_name, par->which_io, info->fix.smem_start); cg3_probe()
421 fb_dealloc_cmap(&info->cmap); cg3_probe()
424 of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len); cg3_probe()
430 framebuffer_release(info); cg3_probe()
438 struct fb_info *info = dev_get_drvdata(&op->dev); cg3_remove() local
439 struct cg3_par *par = info->par; cg3_remove()
441 unregister_framebuffer(info); cg3_remove()
442 fb_dealloc_cmap(&info->cmap); cg3_remove()
445 of_iounmap(&op->resource[0], info->screen_base, info->fix.smem_len); cg3_remove()
447 framebuffer_release(info); cg3_remove()
137 cg3_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) cg3_setcolreg() argument
H A Dpmagb-b-fb.c100 unsigned int transp, struct fb_info *info) pmagbbfb_setcolreg()
102 struct pmagbbfb_par *par = info->par; pmagbbfb_setcolreg()
104 if (regno >= info->cmap.len) pmagbbfb_setcolreg()
136 static void __init pmagbbfb_erase_cursor(struct fb_info *info) pmagbbfb_erase_cursor() argument
138 struct pmagbbfb_par *par = info->par; pmagbbfb_erase_cursor()
150 static void pmagbbfb_screen_setup(struct fb_info *info) pmagbbfb_screen_setup() argument
152 struct pmagbbfb_par *par = info->par; pmagbbfb_screen_setup()
154 info->var.xres = ((sfb_read(par, SFB_REG_VID_HOR) >> pmagbbfb_screen_setup()
156 info->var.xres_virtual = info->var.xres; pmagbbfb_screen_setup()
157 info->var.yres = (sfb_read(par, SFB_REG_VID_VER) >> pmagbbfb_screen_setup()
159 info->var.yres_virtual = info->var.yres; pmagbbfb_screen_setup()
160 info->var.left_margin = ((sfb_read(par, SFB_REG_VID_HOR) >> pmagbbfb_screen_setup()
163 info->var.right_margin = ((sfb_read(par, SFB_REG_VID_HOR) >> pmagbbfb_screen_setup()
166 info->var.upper_margin = (sfb_read(par, SFB_REG_VID_VER) >> pmagbbfb_screen_setup()
168 info->var.lower_margin = (sfb_read(par, SFB_REG_VID_VER) >> pmagbbfb_screen_setup()
170 info->var.hsync_len = ((sfb_read(par, SFB_REG_VID_HOR) >> pmagbbfb_screen_setup()
173 info->var.vsync_len = (sfb_read(par, SFB_REG_VID_VER) >> pmagbbfb_screen_setup()
176 info->fix.line_length = info->var.xres; pmagbbfb_screen_setup()
182 static void pmagbbfb_osc_setup(struct fb_info *info) pmagbbfb_osc_setup() argument
188 struct pmagbbfb_par *par = info->par; pmagbbfb_osc_setup()
189 struct tc_bus *tbus = to_tc_dev(info->device)->bus; pmagbbfb_osc_setup()
243 info->var.pixclock = par->osc1 ? pmagbbfb_osc_setup()
253 struct fb_info *info; pmagbbfb_probe() local
259 info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); pmagbbfb_probe()
260 if (!info) { pmagbbfb_probe()
265 par = info->par; pmagbbfb_probe()
266 dev_set_drvdata(dev, info); pmagbbfb_probe()
268 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { pmagbbfb_probe()
275 info->fbops = &pmagbbfb_ops; pmagbbfb_probe()
276 info->fix = pmagbbfb_fix; pmagbbfb_probe()
277 info->var = pmagbbfb_defined; pmagbbfb_probe()
278 info->flags = FBINFO_DEFAULT; pmagbbfb_probe()
291 info->fix.mmio_start = start; pmagbbfb_probe()
292 par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); pmagbbfb_probe()
302 info->fix.smem_start = start + PMAGB_B_FBMEM; pmagbbfb_probe()
303 par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len); pmagbbfb_probe()
310 info->screen_base = (void __iomem *)par->smem + vid_base * 0x1000; pmagbbfb_probe()
311 info->screen_size = info->fix.smem_len - 2 * vid_base * 0x1000; pmagbbfb_probe()
313 pmagbbfb_erase_cursor(info); pmagbbfb_probe()
314 pmagbbfb_screen_setup(info); pmagbbfb_probe()
315 pmagbbfb_osc_setup(info); pmagbbfb_probe()
317 err = register_framebuffer(info); pmagbbfb_probe()
331 fb_info(info, "%s frame buffer device at %s\n", pmagbbfb_probe()
332 info->fix.id, dev_name(dev)); pmagbbfb_probe()
333 fb_info(info, "Osc0: %s, Osc1: %s, Osc%u selected\n", pmagbbfb_probe()
349 fb_dealloc_cmap(&info->cmap); pmagbbfb_probe()
352 framebuffer_release(info); pmagbbfb_probe()
359 struct fb_info *info = dev_get_drvdata(dev); pmagbbfb_remove() local
360 struct pmagbbfb_par *par = info->par; pmagbbfb_remove()
364 unregister_framebuffer(info); pmagbbfb_remove()
370 fb_dealloc_cmap(&info->cmap); pmagbbfb_remove()
371 framebuffer_release(info); pmagbbfb_remove()
98 pmagbbfb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, unsigned int blue, unsigned int transp, struct fb_info *info) pmagbbfb_setcolreg() argument
H A Dwm8505fb.c51 static int wm8505fb_init_hw(struct fb_info *info) wm8505fb_init_hw() argument
53 struct wm8505fb_info *fbi = to_wm8505fb_info(info); wm8505fb_init_hw()
74 writel(info->var.xres, fbi->regbase + WMT_GOVR_XRES); wm8505fb_init_hw()
75 writel(info->var.xres_virtual, fbi->regbase + WMT_GOVR_XRES_VIRTUAL); wm8505fb_init_hw()
86 static int wm8505fb_set_timing(struct fb_info *info) wm8505fb_set_timing() argument
88 struct wm8505fb_info *fbi = to_wm8505fb_info(info); wm8505fb_set_timing()
90 int h_start = info->var.left_margin; wm8505fb_set_timing()
91 int h_end = h_start + info->var.xres; wm8505fb_set_timing()
92 int h_all = h_end + info->var.right_margin; wm8505fb_set_timing()
93 int h_sync = info->var.hsync_len; wm8505fb_set_timing()
95 int v_start = info->var.upper_margin; wm8505fb_set_timing()
96 int v_end = v_start + info->var.yres; wm8505fb_set_timing()
97 int v_all = v_end + info->var.lower_margin; wm8505fb_set_timing()
98 int v_sync = info->var.vsync_len; wm8505fb_set_timing()
118 static int wm8505fb_set_par(struct fb_info *info) wm8505fb_set_par() argument
120 struct wm8505fb_info *fbi = to_wm8505fb_info(info); wm8505fb_set_par()
125 if (info->var.bits_per_pixel == 32) { wm8505fb_set_par()
126 info->var.red.offset = 16; wm8505fb_set_par()
127 info->var.red.length = 8; wm8505fb_set_par()
128 info->var.red.msb_right = 0; wm8505fb_set_par()
129 info->var.green.offset = 8; wm8505fb_set_par()
130 info->var.green.length = 8; wm8505fb_set_par()
131 info->var.green.msb_right = 0; wm8505fb_set_par()
132 info->var.blue.offset = 0; wm8505fb_set_par()
133 info->var.blue.length = 8; wm8505fb_set_par()
134 info->var.blue.msb_right = 0; wm8505fb_set_par()
135 info->fix.visual = FB_VISUAL_TRUECOLOR; wm8505fb_set_par()
136 info->fix.line_length = info->var.xres_virtual << 2; wm8505fb_set_par()
137 } else if (info->var.bits_per_pixel == 16) { wm8505fb_set_par()
138 info->var.red.offset = 11; wm8505fb_set_par()
139 info->var.red.length = 5; wm8505fb_set_par()
140 info->var.red.msb_right = 0; wm8505fb_set_par()
141 info->var.green.offset = 5; wm8505fb_set_par()
142 info->var.green.length = 6; wm8505fb_set_par()
143 info->var.green.msb_right = 0; wm8505fb_set_par()
144 info->var.blue.offset = 0; wm8505fb_set_par()
145 info->var.blue.length = 5; wm8505fb_set_par()
146 info->var.blue.msb_right = 0; wm8505fb_set_par()
147 info->fix.visual = FB_VISUAL_TRUECOLOR; wm8505fb_set_par()
148 info->fix.line_length = info->var.xres_virtual << 1; wm8505fb_set_par()
151 wm8505fb_set_timing(info); wm8505fb_set_par()
162 struct fb_info *info = dev_get_drvdata(dev); contrast_show() local
163 struct wm8505fb_info *fbi = to_wm8505fb_info(info); contrast_show()
172 struct fb_info *info = dev_get_drvdata(dev); contrast_store() local
173 struct wm8505fb_info *fbi = to_wm8505fb_info(info); contrast_store()
180 wm8505fb_set_par(info); contrast_store()
196 struct fb_info *info) { wm8505fb_setcolreg()
197 struct wm8505fb_info *fbi = to_wm8505fb_info(info); wm8505fb_setcolreg()
203 if (info->var.grayscale) wm8505fb_setcolreg()
210 u32 *pal = info->pseudo_palette; wm8505fb_setcolreg()
226 struct fb_info *info) wm8505fb_pan_display()
228 struct wm8505fb_info *fbi = to_wm8505fb_info(info); wm8505fb_pan_display()
235 static int wm8505fb_blank(int blank, struct fb_info *info) wm8505fb_blank() argument
237 struct wm8505fb_info *fbi = to_wm8505fb_info(info); wm8505fb_blank()
241 wm8505fb_set_timing(info); wm8505fb_blank()
194 wm8505fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) wm8505fb_setcolreg() argument
225 wm8505fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) wm8505fb_pan_display() argument
H A Ds3fb.c247 static int s3fb_setup_ddc_bus(struct fb_info *info) s3fb_setup_ddc_bus() argument
249 struct s3fb_info *par = info->par; s3fb_setup_ddc_bus()
251 strlcpy(par->ddc_adapter.name, info->fix.id, s3fb_setup_ddc_bus()
256 par->ddc_adapter.dev.parent = info->device; s3fb_setup_ddc_bus()
290 static void s3fb_settile_fast(struct fb_info *info, struct fb_tilemap *map) s3fb_settile_fast() argument
293 u8 __iomem *fb = (u8 __iomem *) info->screen_base; s3fb_settile_fast()
298 fb_err(info, "unsupported font parameters: width %d, height %d, depth %d, length %d\n", s3fb_settile_fast()
312 static void s3fb_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor) s3fb_tilecursor() argument
314 struct s3fb_info *par = info->par; s3fb_tilecursor()
316 svga_tilecursor(par->state.vgabase, info, cursor); s3fb_tilecursor()
347 static void s3fb_iplan_imageblit(struct fb_info *info, const struct fb_image *image) s3fb_iplan_imageblit() argument
358 dst1 = info->screen_base + (image->dy * info->fix.line_length) s3fb_iplan_imageblit()
370 dst1 += info->fix.line_length; s3fb_iplan_imageblit()
376 static void s3fb_iplan_fillrect(struct fb_info *info, const struct fb_fillrect *rect) s3fb_iplan_fillrect() argument
383 dst1 = info->screen_base + (rect->dy * info->fix.line_length) s3fb_iplan_fillrect()
391 dst1 += info->fix.line_length; s3fb_iplan_fillrect()
404 static void s3fb_cfb4_imageblit(struct fb_info *info, const struct fb_image *image) s3fb_cfb4_imageblit() argument
415 dst1 = info->screen_base + (image->dy * info->fix.line_length) s3fb_cfb4_imageblit()
427 dst1 += info->fix.line_length; s3fb_cfb4_imageblit()
431 static void s3fb_imageblit(struct fb_info *info, const struct fb_image *image) s3fb_imageblit() argument
433 if ((info->var.bits_per_pixel == 4) && (image->depth == 1) s3fb_imageblit()
435 if (info->fix.type == FB_TYPE_INTERLEAVED_PLANES) s3fb_imageblit()
436 s3fb_iplan_imageblit(info, image); s3fb_imageblit()
438 s3fb_cfb4_imageblit(info, image); s3fb_imageblit()
440 cfb_imageblit(info, image); s3fb_imageblit()
443 static void s3fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) s3fb_fillrect() argument
445 if ((info->var.bits_per_pixel == 4) s3fb_fillrect()
447 && (info->fix.type == FB_TYPE_INTERLEAVED_PLANES)) s3fb_fillrect()
448 s3fb_iplan_fillrect(info, rect); s3fb_fillrect()
450 cfb_fillrect(info, rect); s3fb_fillrect()
458 static void s3_set_pixclock(struct fb_info *info, u32 pixclock) s3_set_pixclock() argument
460 struct s3fb_info *par = info->par; s3_set_pixclock()
466 1000000000 / pixclock, &m, &n, &r, info->node); s3_set_pixclock()
468 fb_err(info, "cannot set requested pixclock, keeping old value\n"); s3_set_pixclock()
501 static int s3fb_open(struct fb_info *info, int user) s3fb_open() argument
503 struct s3fb_info *par = info->par; s3fb_open()
525 static int s3fb_release(struct fb_info *info, int user) s3fb_release() argument
527 struct s3fb_info *par = info->par; s3fb_release()
546 static int s3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) s3fb_check_var() argument
548 struct s3fb_info *par = info->par; s3fb_check_var()
561 fb_err(info, "unsupported mode requested\n"); s3fb_check_var()
578 if (mem > info->screen_size) { s3fb_check_var()
579 fb_err(info, "not enough framebuffer memory (%d kB requested , %u kB available)\n", s3fb_check_var()
580 mem >> 10, (unsigned int) (info->screen_size >> 10)); s3fb_check_var()
584 rv = svga_check_timings (&s3_timing_regs, var, info->node); s3fb_check_var()
586 fb_err(info, "invalid timings requested\n"); s3fb_check_var()
591 info->node); s3fb_check_var()
593 fb_err(info, "invalid pixclock value requested\n"); s3fb_check_var()
602 static int s3fb_set_par(struct fb_info *info) s3fb_set_par() argument
604 struct s3fb_info *par = info->par; s3fb_set_par()
606 u32 bpp = info->var.bits_per_pixel; s3fb_set_par()
610 info->fix.ypanstep = 1; s3fb_set_par()
611 info->fix.line_length = (info->var.xres_virtual * bpp) / 8; s3fb_set_par()
613 info->flags &= ~FBINFO_MISC_TILEBLITTING; s3fb_set_par()
614 info->tileops = NULL; s3fb_set_par()
617 info->pixmap.blit_x = (bpp == 4) ? (1 << (8 - 1)) : (~(u32)0); s3fb_set_par()
618 info->pixmap.blit_y = ~(u32)0; s3fb_set_par()
620 offset_value = (info->var.xres_virtual * bpp) / 64; s3fb_set_par()
621 screen_size = info->var.yres_virtual * info->fix.line_length; s3fb_set_par()
623 info->fix.ypanstep = 16; s3fb_set_par()
624 info->fix.line_length = 0; s3fb_set_par()
626 info->flags |= FBINFO_MISC_TILEBLITTING; s3fb_set_par()
627 info->tileops = fasttext ? &s3fb_fast_tile_ops : &s3fb_tile_ops; s3fb_set_par()
630 info->pixmap.blit_x = 1 << (8 - 1); s3fb_set_par()
631 info->pixmap.blit_y = 1 << (16 - 1); s3fb_set_par()
633 offset_value = info->var.xres_virtual / 16; s3fb_set_par()
634 screen_size = (info->var.xres_virtual * info->var.yres_virtual) / 64; s3fb_set_par()
637 info->var.xoffset = 0; s3fb_set_par()
638 info->var.yoffset = 0; s3fb_set_par()
639 info->var.activate = FB_ACTIVATE_NOW; s3fb_set_par()
677 fb_dbg(info, "offset register : %d\n", offset_value); s3fb_set_par()
695 if (info->var.vmode & FB_VMODE_DOUBLE) s3fb_set_par()
700 if (info->var.vmode & FB_VMODE_INTERLACED) s3fb_set_par()
710 mode = svga_match_format(s3fb_formats, &(info->var), &(info->fix)); s3fb_set_par()
736 dbytes = info->var.xres * ((bpp+7)/8); s3fb_set_par()
760 fb_dbg(info, "text mode\n"); s3fb_set_par()
771 fb_dbg(info, "high speed text mode set\n"); s3fb_set_par()
776 fb_dbg(info, "4 bit pseudocolor\n"); s3fb_set_par()
787 fb_dbg(info, "4 bit pseudocolor, planar\n"); s3fb_set_par()
797 fb_dbg(info, "8 bit pseudocolor\n"); s3fb_set_par()
799 if (info->var.pixclock > 20000 || s3fb_set_par()
813 fb_dbg(info, "5/5/5 truecolor\n"); s3fb_set_par()
815 if (info->var.pixclock > 20000) s3fb_set_par()
821 if (info->var.pixclock > 8695) { s3fb_set_par()
841 fb_dbg(info, "5/6/5 truecolor\n"); s3fb_set_par()
843 if (info->var.pixclock > 20000) s3fb_set_par()
849 if (info->var.pixclock > 8695) { s3fb_set_par()
870 fb_dbg(info, "8/8/8 truecolor\n"); s3fb_set_par()
874 fb_dbg(info, "8/8/8/8 truecolor\n"); s3fb_set_par()
879 fb_err(info, "unsupported mode - bug\n"); s3fb_set_par()
888 s3_set_pixclock(info, info->var.pixclock); s3fb_set_par()
889 svga_set_timings(par->state.vgabase, &s3_timing_regs, &(info->var), hmul, 1, s3fb_set_par()
890 (info->var.vmode & FB_VMODE_DOUBLE) ? 2 : 1, s3fb_set_par()
891 (info->var.vmode & FB_VMODE_INTERLACED) ? 2 : 1, s3fb_set_par()
892 hmul, info->node); s3fb_set_par()
895 htotal = info->var.xres + info->var.left_margin + info->var.right_margin + info->var.hsync_len; s3fb_set_par()
900 hsstart = ((info->var.xres + info->var.right_margin) * hmul) / 8; s3fb_set_par()
905 memset_io(info->screen_base, 0x00, screen_size); s3fb_set_par()
976 static int s3fb_blank(int blank_mode, struct fb_info *info) s3fb_blank() argument
978 struct s3fb_info *par = info->par; s3fb_blank()
982 fb_dbg(info, "unblank\n"); s3fb_blank()
987 fb_dbg(info, "blank\n"); s3fb_blank()
992 fb_dbg(info, "hsync\n"); s3fb_blank()
997 fb_dbg(info, "vsync\n"); s3fb_blank()
1002 fb_dbg(info, "sync down\n"); s3fb_blank()
1014 static int s3fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) s3fb_pan_display() argument
1016 struct s3fb_info *par = info->par; s3fb_pan_display()
1020 if (info->var.bits_per_pixel == 0) { s3fb_pan_display()
1021 offset = (var->yoffset / 16) * (info->var.xres_virtual / 2) s3fb_pan_display()
1025 offset = (var->yoffset * info->fix.line_length) + s3fb_pan_display()
1026 (var->xoffset * info->var.bits_per_pixel / 8); s3fb_pan_display()
1117 struct fb_info *info; s3_pci_probe() local
1130 info = framebuffer_alloc(sizeof(struct s3fb_info), &(dev->dev)); s3_pci_probe()
1131 if (!info) { s3_pci_probe()
1136 par = info->par; s3_pci_probe()
1139 info->flags = FBINFO_PARTIAL_PAN_OK | FBINFO_HWACCEL_YPAN; s3_pci_probe()
1140 info->fbops = &s3fb_ops; s3_pci_probe()
1145 dev_err(info->device, "cannot enable PCI device\n"); s3_pci_probe()
1151 dev_err(info->device, "cannot reserve framebuffer region\n"); s3_pci_probe()
1156 info->fix.smem_start = pci_resource_start(dev, 0); s3_pci_probe()
1157 info->fix.smem_len = pci_resource_len(dev, 0); s3_pci_probe()
1160 info->screen_base = pci_iomap_wc(dev, 0, 0); s3_pci_probe()
1161 if (! info->screen_base) { s3_pci_probe()
1163 dev_err(info->device, "iomap for framebuffer failed\n"); s3_pci_probe()
1200 info->screen_size = 4 << 20; s3_pci_probe()
1204 info->screen_size = 2 << 20; s3_pci_probe()
1212 info->screen_size = 4 << 20; s3_pci_probe()
1215 info->screen_size = 2 << 20; s3_pci_probe()
1221 info->screen_size = 2 << 20; s3_pci_probe()
1224 info->screen_size = 4 << 20; s3_pci_probe()
1227 info->screen_size = 6 << 20; s3_pci_probe()
1230 info->screen_size = 8 << 20; s3_pci_probe()
1237 info->screen_size -= 4 << 20; s3_pci_probe()
1240 info->screen_size -= 2 << 20; s3_pci_probe()
1244 info->screen_size = s3_memsizes[regval >> 5] << 10; s3_pci_probe()
1245 info->fix.smem_len = info->screen_size; s3_pci_probe()
1256 strcpy(info->fix.id, s3_names [par->chip]); s3_pci_probe()
1257 info->fix.mmio_start = 0; s3_pci_probe()
1258 info->fix.mmio_len = 0; s3_pci_probe()
1259 info->fix.type = FB_TYPE_PACKED_PIXELS; s3_pci_probe()
1260 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; s3_pci_probe()
1261 info->fix.ypanstep = 0; s3_pci_probe()
1262 info->fix.accel = FB_ACCEL_NONE; s3_pci_probe()
1263 info->pseudo_palette = (void*) (par->pseudo_palette); s3_pci_probe()
1264 info->var.bits_per_pixel = 8; s3_pci_probe()
1269 par->mmio = ioremap(info->fix.smem_start + MMIO_OFFSET, MMIO_SIZE); s3_pci_probe()
1273 dev_err(info->device, "unable to map MMIO at 0x%lx, disabling DDC", s3_pci_probe()
1274 info->fix.smem_start + MMIO_OFFSET); s3_pci_probe()
1277 if (s3fb_setup_ddc_bus(info) == 0) { s3_pci_probe()
1281 fb_edid_to_monspecs(edid, &info->monspecs); s3_pci_probe()
1283 if (!info->monspecs.modedb) s3_pci_probe()
1284 dev_err(info->device, "error getting mode database\n"); s3_pci_probe()
1288 fb_videomode_to_modelist(info->monspecs.modedb, s3_pci_probe()
1289 info->monspecs.modedb_len, s3_pci_probe()
1290 &info->modelist); s3_pci_probe()
1291 m = fb_find_best_display(&info->monspecs, &info->modelist); s3_pci_probe()
1293 fb_videomode_to_var(&info->var, m); s3_pci_probe()
1294 /* fill all other info->var's fields */ s3_pci_probe()
1295 if (s3fb_check_var(&info->var, info) == 0) s3_pci_probe()
1307 rc = fb_find_mode(&info->var, info, mode_option, s3_pci_probe()
1308 info->monspecs.modedb, info->monspecs.modedb_len, s3_pci_probe()
1309 NULL, info->var.bits_per_pixel); s3_pci_probe()
1312 dev_err(info->device, "mode %s not found\n", mode_option); s3_pci_probe()
1313 fb_destroy_modedb(info->monspecs.modedb); s3_pci_probe()
1314 info->monspecs.modedb = NULL; s3_pci_probe()
1319 fb_destroy_modedb(info->monspecs.modedb); s3_pci_probe()
1320 info->monspecs.modedb = NULL; s3_pci_probe()
1323 info->var.yres_virtual = info->fix.smem_len * 8 / s3_pci_probe()
1324 (info->var.bits_per_pixel * info->var.xres_virtual); s3_pci_probe()
1325 if (info->var.yres_virtual < info->var.yres) { s3_pci_probe()
1326 dev_err(info->device, "virtual vertical size smaller than real\n"); s3_pci_probe()
1331 rc = fb_alloc_cmap(&info->cmap, 256, 0); s3_pci_probe()
1333 dev_err(info->device, "cannot allocate colormap\n"); s3_pci_probe()
1337 rc = register_framebuffer(info); s3_pci_probe()
1339 dev_err(info->device, "cannot register framebuffer\n"); s3_pci_probe()
1343 fb_info(info, "%s on %s, %d MB RAM, %d MHz MCLK\n", s3_pci_probe()
1344 info->fix.id, pci_name(dev), s3_pci_probe()
1345 info->fix.smem_len >> 20, (par->mclk_freq + 500) / 1000); s3_pci_probe()
1348 fb_info(info, "unknown chip, CR2D=%x, CR2E=%x, CRT2F=%x, CRT30=%x\n", s3_pci_probe()
1355 pci_set_drvdata(dev, info); s3_pci_probe()
1358 par->wc_cookie = arch_phys_wc_add(info->fix.smem_start, s3_pci_probe()
1359 info->fix.smem_len); s3_pci_probe()
1365 fb_dealloc_cmap(&info->cmap); s3_pci_probe()
1374 pci_iounmap(dev, info->screen_base); s3_pci_probe()
1380 framebuffer_release(info); s3_pci_probe()
1389 struct fb_info *info = pci_get_drvdata(dev); s3_pci_remove() local
1392 if (info) { s3_pci_remove()
1393 par = info->par; s3_pci_remove()
1395 unregister_framebuffer(info); s3_pci_remove()
1396 fb_dealloc_cmap(&info->cmap); s3_pci_remove()
1405 pci_iounmap(dev, info->screen_base); s3_pci_remove()
1409 framebuffer_release(info); s3_pci_remove()
1417 struct fb_info *info = pci_get_drvdata(dev); s3_pci_suspend() local
1418 struct s3fb_info *par = info->par; s3_pci_suspend()
1420 dev_info(info->device, "suspend\n"); s3_pci_suspend()
1431 fb_set_suspend(info, 1); s3_pci_suspend()
1448 struct fb_info *info = pci_get_drvdata(dev); s3_pci_resume() local
1449 struct s3fb_info *par = info->par; s3_pci_resume()
1452 dev_info(info->device, "resume\n"); s3_pci_resume()
1469 dev_err(info->device, "error %d enabling device for resume\n", err); s3_pci_resume()
1474 s3fb_set_par(info); s3_pci_resume()
1475 fb_set_suspend(info, 0); s3_pci_resume()
H A Dhyperv_fb.c215 struct fb_info *info; member in struct:hvfb_par
261 /* Send screen resolution info to host */ synthvid_send_situ()
264 struct fb_info *info = hv_get_drvdata(hdev); synthvid_send_situ() local
267 if (!info) synthvid_send_situ()
279 msg.situ.video_output[0].depth_bits = info->var.bits_per_pixel; synthvid_send_situ()
280 msg.situ.video_output[0].width_pixels = info->var.xres; synthvid_send_situ()
281 msg.situ.video_output[0].height_pixels = info->var.yres; synthvid_send_situ()
282 msg.situ.video_output[0].pitch_bytes = info->fix.line_length; synthvid_send_situ()
289 /* Send mouse pointer info to host */ synthvid_send_ptr()
324 static int synthvid_update(struct fb_info *info) synthvid_update() argument
326 struct hv_device *hdev = device_to_hv_device(info->device); synthvid_update()
338 msg.dirt.rect[0].x2 = info->var.xres; synthvid_update()
339 msg.dirt.rect[0].y2 = info->var.yres; synthvid_update()
350 * Or, reply with screen and cursor info.
354 struct fb_info *info = hv_get_drvdata(hdev); synthvid_recv_sub() local
358 if (!info) synthvid_recv_sub()
361 par = info->par; synthvid_recv_sub()
372 /* Reply with screen and cursor info */ synthvid_recv_sub()
389 struct fb_info *info = hv_get_drvdata(hdev); synthvid_receive() local
396 if (!info) synthvid_receive()
399 par = info->par; synthvid_receive()
415 struct fb_info *info = hv_get_drvdata(hdev); synthvid_negotiate_ver() local
416 struct hvfb_par *par = info->par; synthvid_negotiate_ver()
448 struct fb_info *info = hv_get_drvdata(hdev); synthvid_connect_vsp() local
449 struct hvfb_par *par = info->par; synthvid_connect_vsp()
489 struct fb_info *info = hv_get_drvdata(hdev); synthvid_send_config() local
490 struct hvfb_par *par = info->par; synthvid_send_config()
500 msg->vram.user_ctx = msg->vram.vram_gpa = info->fix.smem_start; synthvid_send_config()
510 if (msg->vram_ack.user_ctx != info->fix.smem_start) { synthvid_send_config()
533 struct fb_info *info = par->info; hvfb_update_work() local
536 synthvid_update(info); hvfb_update_work()
546 struct fb_info *info; hvfb_on_panic() local
550 info = par->info; hvfb_on_panic()
551 synthvid_update(info); hvfb_on_panic()
558 static int hvfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) hvfb_check_var() argument
571 static int hvfb_set_par(struct fb_info *info) hvfb_set_par() argument
573 struct hv_device *hdev = device_to_hv_device(info->device); hvfb_set_par()
585 unsigned blue, unsigned transp, struct fb_info *info) hvfb_setcolreg()
587 u32 *pal = info->pseudo_palette; hvfb_setcolreg()
592 pal[regno] = chan_to_field(red, &info->var.red) hvfb_setcolreg()
593 | chan_to_field(green, &info->var.green) hvfb_setcolreg()
594 | chan_to_field(blue, &info->var.blue) hvfb_setcolreg()
595 | chan_to_field(transp, &info->var.transp); hvfb_setcolreg()
600 static int hvfb_blank(int blank, struct fb_info *info) hvfb_blank() argument
648 static void hvfb_get_option(struct fb_info *info) hvfb_get_option() argument
650 struct hvfb_par *par = info->par; hvfb_get_option()
680 static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) hvfb_getmem() argument
682 struct hvfb_par *par = info->par; hvfb_getmem()
719 info->apertures = alloc_apertures(1); hvfb_getmem()
720 if (!info->apertures) hvfb_getmem()
724 info->apertures->ranges[0].base = screen_info.lfb_base; hvfb_getmem()
725 info->apertures->ranges[0].size = screen_info.lfb_size; hvfb_getmem()
726 remove_conflicting_framebuffers(info->apertures, hvfb_getmem()
729 info->apertures->ranges[0].base = pci_resource_start(pdev, 0); hvfb_getmem()
730 info->apertures->ranges[0].size = pci_resource_len(pdev, 0); hvfb_getmem()
733 info->fix.smem_start = par->mem->start; hvfb_getmem()
734 info->fix.smem_len = screen_fb_size; hvfb_getmem()
735 info->screen_base = fb_virt; hvfb_getmem()
736 info->screen_size = screen_fb_size; hvfb_getmem()
756 static void hvfb_putmem(struct fb_info *info) hvfb_putmem() argument
758 struct hvfb_par *par = info->par; hvfb_putmem()
760 iounmap(info->screen_base); hvfb_putmem()
769 struct fb_info *info; hvfb_probe() local
773 info = framebuffer_alloc(sizeof(struct hvfb_par), &hdev->device); hvfb_probe()
774 if (!info) { hvfb_probe()
775 pr_err("No memory for framebuffer info\n"); hvfb_probe()
779 par = info->par; hvfb_probe()
780 par->info = info; hvfb_probe()
786 hv_set_drvdata(hdev, info); hvfb_probe()
793 ret = hvfb_getmem(hdev, info); hvfb_probe()
799 hvfb_get_option(info); hvfb_probe()
805 info->flags = FBINFO_DEFAULT; hvfb_probe()
807 info->var.xres_virtual = info->var.xres = screen_width; hvfb_probe()
808 info->var.yres_virtual = info->var.yres = screen_height; hvfb_probe()
809 info->var.bits_per_pixel = screen_depth; hvfb_probe()
811 if (info->var.bits_per_pixel == 16) { hvfb_probe()
812 info->var.red = (struct fb_bitfield){11, 5, 0}; hvfb_probe()
813 info->var.green = (struct fb_bitfield){5, 6, 0}; hvfb_probe()
814 info->var.blue = (struct fb_bitfield){0, 5, 0}; hvfb_probe()
815 info->var.transp = (struct fb_bitfield){0, 0, 0}; hvfb_probe()
817 info->var.red = (struct fb_bitfield){16, 8, 0}; hvfb_probe()
818 info->var.green = (struct fb_bitfield){8, 8, 0}; hvfb_probe()
819 info->var.blue = (struct fb_bitfield){0, 8, 0}; hvfb_probe()
820 info->var.transp = (struct fb_bitfield){24, 8, 0}; hvfb_probe()
823 info->var.activate = FB_ACTIVATE_NOW; hvfb_probe()
824 info->var.height = -1; hvfb_probe()
825 info->var.width = -1; hvfb_probe()
826 info->var.vmode = FB_VMODE_NONINTERLACED; hvfb_probe()
828 strcpy(info->fix.id, KBUILD_MODNAME); hvfb_probe()
829 info->fix.type = FB_TYPE_PACKED_PIXELS; hvfb_probe()
830 info->fix.visual = FB_VISUAL_TRUECOLOR; hvfb_probe()
831 info->fix.line_length = screen_width * screen_depth / 8; hvfb_probe()
832 info->fix.accel = FB_ACCEL_NONE; hvfb_probe()
834 info->fbops = &hvfb_ops; hvfb_probe()
835 info->pseudo_palette = par->pseudo_palette; hvfb_probe()
842 ret = register_framebuffer(info); hvfb_probe()
858 hvfb_putmem(info); hvfb_probe()
864 framebuffer_release(info); hvfb_probe()
871 struct fb_info *info = hv_get_drvdata(hdev); hvfb_remove() local
872 struct hvfb_par *par = info->par; hvfb_remove()
880 unregister_framebuffer(info); hvfb_remove()
886 hvfb_putmem(info); hvfb_remove()
887 framebuffer_release(info); hvfb_remove()
584 hvfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) hvfb_setcolreg() argument
H A Dhecubafb.c105 unsigned char *buf = (unsigned char __force *)par->info->screen_base; hecubafb_dpy_update()
118 static void hecubafb_dpy_deferred_io(struct fb_info *info, hecubafb_dpy_deferred_io() argument
121 hecubafb_dpy_update(info->par); hecubafb_dpy_deferred_io()
124 static void hecubafb_fillrect(struct fb_info *info, hecubafb_fillrect() argument
127 struct hecubafb_par *par = info->par; hecubafb_fillrect()
129 sys_fillrect(info, rect); hecubafb_fillrect()
134 static void hecubafb_copyarea(struct fb_info *info, hecubafb_copyarea() argument
137 struct hecubafb_par *par = info->par; hecubafb_copyarea()
139 sys_copyarea(info, area); hecubafb_copyarea()
144 static void hecubafb_imageblit(struct fb_info *info, hecubafb_imageblit() argument
147 struct hecubafb_par *par = info->par; hecubafb_imageblit()
149 sys_imageblit(info, image); hecubafb_imageblit()
158 static ssize_t hecubafb_write(struct fb_info *info, const char __user *buf, hecubafb_write() argument
161 struct hecubafb_par *par = info->par; hecubafb_write()
167 if (info->state != FBINFO_STATE_RUNNING) hecubafb_write()
170 total_size = info->fix.smem_len; hecubafb_write()
187 dst = (void __force *) (info->screen_base + p); hecubafb_write()
216 struct fb_info *info; hecubafb_probe() local
238 info = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev); hecubafb_probe()
239 if (!info) hecubafb_probe()
242 info->screen_base = (char __force __iomem *)videomemory; hecubafb_probe()
243 info->fbops = &hecubafb_ops; hecubafb_probe()
245 info->var = hecubafb_var; hecubafb_probe()
246 info->fix = hecubafb_fix; hecubafb_probe()
247 info->fix.smem_len = videomemorysize; hecubafb_probe()
248 par = info->par; hecubafb_probe()
249 par->info = info; hecubafb_probe()
254 info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; hecubafb_probe()
256 info->fbdefio = &hecubafb_defio; hecubafb_probe()
257 fb_deferred_io_init(info); hecubafb_probe()
259 retval = register_framebuffer(info); hecubafb_probe()
262 platform_set_drvdata(dev, info); hecubafb_probe()
264 fb_info(info, "Hecuba frame buffer device, using %dK of video memory\n", hecubafb_probe()
274 framebuffer_release(info); hecubafb_probe()
284 struct fb_info *info = platform_get_drvdata(dev); hecubafb_remove() local
286 if (info) { hecubafb_remove()
287 struct hecubafb_par *par = info->par; hecubafb_remove()
288 fb_deferred_io_cleanup(info); hecubafb_remove()
289 unregister_framebuffer(info); hecubafb_remove()
290 vfree((void __force *)info->screen_base); hecubafb_remove()
294 framebuffer_release(info); hecubafb_remove()
H A Dleo.c208 static void leo_switch_from_graph(struct fb_info *info) leo_switch_from_graph() argument
210 struct leo_par *par = (struct leo_par *) info->par; leo_switch_from_graph()
218 par->extent = ((info->var.xres - 1) | leo_switch_from_graph()
219 ((info->var.yres - 1) << 16)); leo_switch_from_graph()
229 sbus_writel((info->var.xres-1) | ((info->var.yres-1) << 11), leo_switch_from_graph()
250 static int leo_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) leo_pan_display() argument
255 leo_switch_from_graph(info); leo_pan_display()
269 * @info: frame buffer info structure
273 unsigned transp, struct fb_info *info) leo_setcolreg()
275 struct leo_par *par = (struct leo_par *) info->par; leo_setcolreg()
311 * @info: frame buffer structure that represents a single frame buffer
313 static int leo_blank(int blank, struct fb_info *info) leo_blank() argument
315 struct leo_par *par = (struct leo_par *) info->par; leo_blank()
415 static int leo_mmap(struct fb_info *info, struct vm_area_struct *vma) leo_mmap() argument
417 struct leo_par *par = (struct leo_par *)info->par; leo_mmap()
420 info->fix.smem_start, info->fix.smem_len, leo_mmap()
424 static int leo_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) leo_ioctl() argument
426 return sbusfb_ioctl_helper(cmd, arg, info, leo_ioctl()
427 FBTYPE_SUNLEO, 32, info->fix.smem_len); leo_ioctl()
435 leo_init_fix(struct fb_info *info, struct device_node *dp) leo_init_fix() argument
437 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); leo_init_fix()
439 info->fix.type = FB_TYPE_PACKED_PIXELS; leo_init_fix()
440 info->fix.visual = FB_VISUAL_TRUECOLOR; leo_init_fix()
442 info->fix.line_length = 8192; leo_init_fix()
444 info->fix.accel = FB_ACCEL_SUN_LEO; leo_init_fix()
447 static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl) leo_wid_put() argument
449 struct leo_par *par = (struct leo_par *) info->par; leo_wid_put()
485 static void leo_init_wids(struct fb_info *info) leo_init_wids() argument
495 leo_wid_put(info, &wl); leo_init_wids()
498 leo_wid_put(info, &wl); leo_init_wids()
501 leo_wid_put(info, &wl); leo_init_wids()
505 leo_wid_put(info, &wl); leo_init_wids()
508 static void leo_init_hw(struct fb_info *info) leo_init_hw() argument
510 struct leo_par *par = (struct leo_par *) info->par; leo_init_hw()
517 leo_switch_from_graph(info); leo_init_hw()
532 static void leo_unmap_regs(struct platform_device *op, struct fb_info *info, leo_unmap_regs() argument
546 if (info->screen_base) leo_unmap_regs()
547 of_iounmap(&op->resource[0], info->screen_base, 0x800000); leo_unmap_regs()
553 struct fb_info *info; leo_probe() local
557 info = framebuffer_alloc(sizeof(struct leo_par), &op->dev); leo_probe()
560 if (!info) leo_probe()
562 par = info->par; leo_probe()
566 info->fix.smem_start = op->resource[0].start; leo_probe()
569 sbusfb_fill_var(&info->var, dp, 32); leo_probe()
570 leo_fixup_var_rgb(&info->var); leo_probe()
573 info->var.xres); leo_probe()
574 info->fix.smem_len = PAGE_ALIGN(linebytes * info->var.yres); leo_probe()
591 info->screen_base = leo_probe()
599 !info->screen_base) leo_probe()
602 info->flags = FBINFO_DEFAULT; leo_probe()
603 info->fbops = &leo_ops; leo_probe()
604 info->pseudo_palette = par->clut_data; leo_probe()
606 leo_init_wids(info); leo_probe()
607 leo_init_hw(info); leo_probe()
609 leo_blank(FB_BLANK_UNBLANK, info); leo_probe()
611 if (fb_alloc_cmap(&info->cmap, 256, 0)) leo_probe()
614 leo_init_fix(info, dp); leo_probe()
616 err = register_framebuffer(info); leo_probe()
620 dev_set_drvdata(&op->dev, info); leo_probe()
624 par->which_io, info->fix.smem_start); leo_probe()
629 fb_dealloc_cmap(&info->cmap); leo_probe()
632 leo_unmap_regs(op, info, par); leo_probe()
633 framebuffer_release(info); leo_probe()
641 struct fb_info *info = dev_get_drvdata(&op->dev); leo_remove() local
642 struct leo_par *par = info->par; leo_remove()
644 unregister_framebuffer(info); leo_remove()
645 fb_dealloc_cmap(&info->cmap); leo_remove()
647 leo_unmap_regs(op, info, par); leo_remove()
649 framebuffer_release(info); leo_remove()
271 leo_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) leo_setcolreg() argument
/linux-4.4.14/drivers/input/misc/
H A Dtwl6040-vibra.c70 struct vibra_info *info = data; twl6040_vib_irq_handler() local
71 struct twl6040 *twl6040 = info->twl6040; twl6040_vib_irq_handler()
76 dev_warn(info->dev, "Left Vibrator overcurrent detected\n"); twl6040_vib_irq_handler()
81 dev_warn(info->dev, "Right Vibrator overcurrent detected\n"); twl6040_vib_irq_handler()
89 static void twl6040_vibra_enable(struct vibra_info *info) twl6040_vibra_enable() argument
91 struct twl6040 *twl6040 = info->twl6040; twl6040_vibra_enable()
94 ret = regulator_bulk_enable(ARRAY_SIZE(info->supplies), info->supplies); twl6040_vibra_enable()
96 dev_err(info->dev, "failed to enable regulators %d\n", ret); twl6040_vibra_enable()
100 twl6040_power(info->twl6040, 1); twl6040_vibra_enable()
119 info->enabled = true; twl6040_vibra_enable()
122 static void twl6040_vibra_disable(struct vibra_info *info) twl6040_vibra_disable() argument
124 struct twl6040 *twl6040 = info->twl6040; twl6040_vibra_disable()
128 twl6040_power(info->twl6040, 0); twl6040_vibra_disable()
130 regulator_bulk_disable(ARRAY_SIZE(info->supplies), info->supplies); twl6040_vibra_disable()
132 info->enabled = false; twl6040_vibra_disable()
159 static void twl6040_vibra_set_effect(struct vibra_info *info) twl6040_vibra_set_effect() argument
161 struct twl6040 *twl6040 = info->twl6040; twl6040_vibra_set_effect()
166 volt = regulator_get_voltage(info->supplies[0].consumer) / 1000; twl6040_vibra_set_effect()
167 vibdatl = twl6040_vibra_code(volt, info->vibldrv_res, twl6040_vibra_set_effect()
168 info->viblmotor_res, twl6040_vibra_set_effect()
169 info->weak_speed, info->direction); twl6040_vibra_set_effect()
172 volt = regulator_get_voltage(info->supplies[1].consumer) / 1000; twl6040_vibra_set_effect()
173 vibdatr = twl6040_vibra_code(volt, info->vibrdrv_res, twl6040_vibra_set_effect()
174 info->vibrmotor_res, twl6040_vibra_set_effect()
175 info->strong_speed, info->direction); twl6040_vibra_set_effect()
183 struct vibra_info *info = container_of(work, vibra_play_work() local
186 mutex_lock(&info->mutex); vibra_play_work()
188 if (info->weak_speed || info->strong_speed) { vibra_play_work()
189 if (!info->enabled) vibra_play_work()
190 twl6040_vibra_enable(info); vibra_play_work()
192 twl6040_vibra_set_effect(info); vibra_play_work()
193 } else if (info->enabled) vibra_play_work()
194 twl6040_vibra_disable(info); vibra_play_work()
196 mutex_unlock(&info->mutex); vibra_play_work()
202 struct vibra_info *info = input_get_drvdata(input); vibra_play() local
206 ret = twl6040_get_vibralr_status(info->twl6040); vibra_play()
212 info->weak_speed = effect->u.rumble.weak_magnitude; vibra_play()
213 info->strong_speed = effect->u.rumble.strong_magnitude; vibra_play()
214 info->direction = effect->direction < EFFECT_DIR_180_DEG ? 1 : -1; vibra_play()
216 ret = queue_work(info->workqueue, &info->play_work); vibra_play()
227 struct vibra_info *info = input_get_drvdata(input); twl6040_vibra_close() local
229 cancel_work_sync(&info->play_work); twl6040_vibra_close()
231 mutex_lock(&info->mutex); twl6040_vibra_close()
233 if (info->enabled) twl6040_vibra_close()
234 twl6040_vibra_disable(info); twl6040_vibra_close()
236 mutex_unlock(&info->mutex); twl6040_vibra_close()
242 struct vibra_info *info = platform_get_drvdata(pdev); twl6040_vibra_suspend() local
244 mutex_lock(&info->mutex); twl6040_vibra_suspend()
246 if (info->enabled) twl6040_vibra_suspend()
247 twl6040_vibra_disable(info); twl6040_vibra_suspend()
249 mutex_unlock(&info->mutex); twl6040_vibra_suspend()
260 struct vibra_info *info; twl6040_vibra_probe() local
272 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); twl6040_vibra_probe()
273 if (!info) { twl6040_vibra_probe()
279 info->dev = &pdev->dev; twl6040_vibra_probe()
281 info->twl6040 = dev_get_drvdata(pdev->dev.parent); twl6040_vibra_probe()
284 &info->vibldrv_res); twl6040_vibra_probe()
286 &info->vibrdrv_res); twl6040_vibra_probe()
288 &info->viblmotor_res); twl6040_vibra_probe()
290 &info->vibrmotor_res); twl6040_vibra_probe()
296 if ((!info->vibldrv_res && !info->viblmotor_res) || twl6040_vibra_probe()
297 (!info->vibrdrv_res && !info->vibrmotor_res)) { twl6040_vibra_probe()
298 dev_err(info->dev, "invalid vibra driver/motor resistance\n"); twl6040_vibra_probe()
302 info->irq = platform_get_irq(pdev, 0); twl6040_vibra_probe()
303 if (info->irq < 0) { twl6040_vibra_probe()
304 dev_err(info->dev, "invalid irq\n"); twl6040_vibra_probe()
308 mutex_init(&info->mutex); twl6040_vibra_probe()
310 error = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, twl6040_vibra_probe()
313 "twl6040_irq_vib", info); twl6040_vibra_probe()
315 dev_err(info->dev, "VIB IRQ request failed: %d\n", error); twl6040_vibra_probe()
319 info->supplies[0].supply = "vddvibl"; twl6040_vibra_probe()
320 info->supplies[1].supply = "vddvibr"; twl6040_vibra_probe()
326 ARRAY_SIZE(info->supplies), twl6040_vibra_probe()
327 info->supplies); twl6040_vibra_probe()
329 dev_err(info->dev, "couldn't get regulators %d\n", error); twl6040_vibra_probe()
334 error = regulator_set_voltage(info->supplies[0].consumer, twl6040_vibra_probe()
337 dev_err(info->dev, "failed to set VDDVIBL volt %d\n", twl6040_vibra_probe()
344 error = regulator_set_voltage(info->supplies[1].consumer, twl6040_vibra_probe()
347 dev_err(info->dev, "failed to set VDDVIBR volt %d\n", twl6040_vibra_probe()
353 INIT_WORK(&info->play_work, vibra_play_work); twl6040_vibra_probe()
355 info->input_dev = devm_input_allocate_device(&pdev->dev); twl6040_vibra_probe()
356 if (!info->input_dev) { twl6040_vibra_probe()
357 dev_err(info->dev, "couldn't allocate input device\n"); twl6040_vibra_probe()
361 input_set_drvdata(info->input_dev, info); twl6040_vibra_probe()
363 info->input_dev->name = "twl6040:vibrator"; twl6040_vibra_probe()
364 info->input_dev->id.version = 1; twl6040_vibra_probe()
365 info->input_dev->dev.parent = pdev->dev.parent; twl6040_vibra_probe()
366 info->input_dev->close = twl6040_vibra_close; twl6040_vibra_probe()
367 __set_bit(FF_RUMBLE, info->input_dev->ffbit); twl6040_vibra_probe()
369 error = input_ff_create_memless(info->input_dev, NULL, vibra_play); twl6040_vibra_probe()
371 dev_err(info->dev, "couldn't register vibrator to FF\n"); twl6040_vibra_probe()
375 error = input_register_device(info->input_dev); twl6040_vibra_probe()
377 dev_err(info->dev, "couldn't register input device\n"); twl6040_vibra_probe()
381 platform_set_drvdata(pdev, info); twl6040_vibra_probe()
H A Dtwl4030-vibra.c66 static void vibra_enable(struct vibra_info *info) vibra_enable() argument
80 info->enabled = true; vibra_enable()
83 static void vibra_disable(struct vibra_info *info) vibra_disable() argument
96 info->enabled = false; vibra_disable()
101 struct vibra_info *info = container_of(work, vibra_play_work() local
107 dir = info->direction; vibra_play_work()
108 pwm = info->speed; vibra_play_work()
112 if (pwm && (!info->coexist || !(reg & TWL4030_VIBRA_SEL))) { vibra_play_work()
114 if (!info->enabled) vibra_play_work()
115 vibra_enable(info); vibra_play_work()
129 if (info->enabled) vibra_play_work()
130 vibra_disable(info); vibra_play_work()
139 struct vibra_info *info = input_get_drvdata(input); vibra_play() local
141 info->speed = effect->u.rumble.strong_magnitude >> 8; vibra_play()
142 if (!info->speed) vibra_play()
143 info->speed = effect->u.rumble.weak_magnitude >> 9; vibra_play()
144 info->direction = effect->direction < EFFECT_DIR_180_DEG ? 0 : 1; vibra_play()
145 schedule_work(&info->play_work); vibra_play()
151 struct vibra_info *info = input_get_drvdata(input); twl4030_vibra_close() local
153 cancel_work_sync(&info->play_work); twl4030_vibra_close()
155 if (info->enabled) twl4030_vibra_close()
156 vibra_disable(info); twl4030_vibra_close()
163 struct vibra_info *info = platform_get_drvdata(pdev); twl4030_vibra_suspend() local
165 if (info->enabled) twl4030_vibra_suspend()
166 vibra_disable(info); twl4030_vibra_suspend()
199 struct vibra_info *info; twl4030_vibra_probe() local
207 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); twl4030_vibra_probe()
208 if (!info) twl4030_vibra_probe()
211 info->dev = &pdev->dev; twl4030_vibra_probe()
212 info->coexist = twl4030_vibra_check_coexist(pdata, twl4030_core_node); twl4030_vibra_probe()
213 INIT_WORK(&info->play_work, vibra_play_work); twl4030_vibra_probe()
215 info->input_dev = devm_input_allocate_device(&pdev->dev); twl4030_vibra_probe()
216 if (info->input_dev == NULL) { twl4030_vibra_probe()
221 input_set_drvdata(info->input_dev, info); twl4030_vibra_probe()
223 info->input_dev->name = "twl4030:vibrator"; twl4030_vibra_probe()
224 info->input_dev->id.version = 1; twl4030_vibra_probe()
225 info->input_dev->dev.parent = pdev->dev.parent; twl4030_vibra_probe()
226 info->input_dev->close = twl4030_vibra_close; twl4030_vibra_probe()
227 __set_bit(FF_RUMBLE, info->input_dev->ffbit); twl4030_vibra_probe()
229 ret = input_ff_create_memless(info->input_dev, NULL, vibra_play); twl4030_vibra_probe()
235 ret = input_register_device(info->input_dev); twl4030_vibra_probe()
243 platform_set_drvdata(pdev, info); twl4030_vibra_probe()
247 input_ff_destroy(info->input_dev); twl4030_vibra_probe()
H A D88pm80x_onkey.c45 struct pm80x_onkey_info *info = data; pm80x_onkey_handler() local
49 ret = regmap_read(info->map, PM800_STATUS_1, &val); pm80x_onkey_handler()
51 dev_err(info->idev->dev.parent, "failed to read status: %d\n", ret); pm80x_onkey_handler()
56 input_report_key(info->idev, KEY_POWER, val); pm80x_onkey_handler()
57 input_sync(info->idev); pm80x_onkey_handler()
69 struct pm80x_onkey_info *info; pm80x_onkey_probe() local
72 info = kzalloc(sizeof(struct pm80x_onkey_info), GFP_KERNEL); pm80x_onkey_probe()
73 if (!info) pm80x_onkey_probe()
76 info->pm80x = chip; pm80x_onkey_probe()
78 info->irq = platform_get_irq(pdev, 0); pm80x_onkey_probe()
79 if (info->irq < 0) { pm80x_onkey_probe()
85 info->map = info->pm80x->regmap; pm80x_onkey_probe()
86 if (!info->map) { pm80x_onkey_probe()
92 info->idev = input_allocate_device(); pm80x_onkey_probe()
93 if (!info->idev) { pm80x_onkey_probe()
99 info->idev->name = "88pm80x_on"; pm80x_onkey_probe()
100 info->idev->phys = "88pm80x_on/input0"; pm80x_onkey_probe()
101 info->idev->id.bustype = BUS_I2C; pm80x_onkey_probe()
102 info->idev->dev.parent = &pdev->dev; pm80x_onkey_probe()
103 info->idev->evbit[0] = BIT_MASK(EV_KEY); pm80x_onkey_probe()
104 __set_bit(KEY_POWER, info->idev->keybit); pm80x_onkey_probe()
106 err = pm80x_request_irq(info->pm80x, info->irq, pm80x_onkey_handler, pm80x_onkey_probe()
107 IRQF_ONESHOT, "onkey", info); pm80x_onkey_probe()
110 info->irq, err); pm80x_onkey_probe()
114 err = input_register_device(info->idev); pm80x_onkey_probe()
120 platform_set_drvdata(pdev, info); pm80x_onkey_probe()
123 regmap_update_bits(info->map, PM800_RTC_MISC4, PM800_LONG_ONKEY_EN, pm80x_onkey_probe()
126 regmap_update_bits(info->map, PM800_RTC_MISC3, pm80x_onkey_probe()
134 pm80x_free_irq(info->pm80x, info->irq, info); pm80x_onkey_probe()
136 input_free_device(info->idev); pm80x_onkey_probe()
138 kfree(info); pm80x_onkey_probe()
144 struct pm80x_onkey_info *info = platform_get_drvdata(pdev); pm80x_onkey_remove() local
147 pm80x_free_irq(info->pm80x, info->irq, info); pm80x_onkey_remove()
148 input_unregister_device(info->idev); pm80x_onkey_remove()
149 kfree(info); pm80x_onkey_remove()
H A Dxen-kbdfront.c55 struct xenkbd_info *info = dev_id; input_handler() local
56 struct xenkbd_page *page = info->page; input_handler()
68 dev = info->ptr; input_handler()
79 if (test_bit(event->key.keycode, info->kbd->keybit)) input_handler()
80 dev = info->kbd; input_handler()
81 if (test_bit(event->key.keycode, info->ptr->keybit)) input_handler()
82 dev = info->ptr; input_handler()
103 notify_remote_via_irq(info->irq); input_handler()
112 struct xenkbd_info *info; xenkbd_probe() local
115 info = kzalloc(sizeof(*info), GFP_KERNEL); xenkbd_probe()
116 if (!info) { xenkbd_probe()
117 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure"); xenkbd_probe()
120 dev_set_drvdata(&dev->dev, info); xenkbd_probe()
121 info->xbdev = dev; xenkbd_probe()
122 info->irq = -1; xenkbd_probe()
123 info->gref = -1; xenkbd_probe()
124 snprintf(info->phys, sizeof(info->phys), "xenbus/%s", dev->nodename); xenkbd_probe()
126 info->page = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); xenkbd_probe()
127 if (!info->page) xenkbd_probe()
146 kbd->phys = info->phys; xenkbd_probe()
163 info->kbd = kbd; xenkbd_probe()
170 ptr->phys = info->phys; xenkbd_probe()
195 info->ptr = ptr; xenkbd_probe()
197 ret = xenkbd_connect_backend(dev, info); xenkbd_probe()
213 struct xenkbd_info *info = dev_get_drvdata(&dev->dev); xenkbd_resume() local
215 xenkbd_disconnect_backend(info); xenkbd_resume()
216 memset(info->page, 0, PAGE_SIZE); xenkbd_resume()
217 return xenkbd_connect_backend(dev, info); xenkbd_resume()
222 struct xenkbd_info *info = dev_get_drvdata(&dev->dev); xenkbd_remove() local
224 xenkbd_disconnect_backend(info); xenkbd_remove()
225 if (info->kbd) xenkbd_remove()
226 input_unregister_device(info->kbd); xenkbd_remove()
227 if (info->ptr) xenkbd_remove()
228 input_unregister_device(info->ptr); xenkbd_remove()
229 free_page((unsigned long)info->page); xenkbd_remove()
230 kfree(info); xenkbd_remove()
235 struct xenkbd_info *info) xenkbd_connect_backend()
241 virt_to_gfn(info->page), 0); xenkbd_connect_backend()
244 info->gref = ret; xenkbd_connect_backend()
250 0, dev->devicetype, info); xenkbd_connect_backend()
255 info->irq = ret; xenkbd_connect_backend()
264 virt_to_gfn(info->page)); xenkbd_connect_backend()
267 ret = xenbus_printf(xbt, dev->nodename, "page-gref", "%u", info->gref); xenkbd_connect_backend()
289 unbind_from_irqhandler(info->irq, info); xenkbd_connect_backend()
290 info->irq = -1; xenkbd_connect_backend()
294 gnttab_end_foreign_access(info->gref, 0, 0UL); xenkbd_connect_backend()
295 info->gref = -1; xenkbd_connect_backend()
299 static void xenkbd_disconnect_backend(struct xenkbd_info *info) xenkbd_disconnect_backend() argument
301 if (info->irq >= 0) xenkbd_disconnect_backend()
302 unbind_from_irqhandler(info->irq, info); xenkbd_disconnect_backend()
303 info->irq = -1; xenkbd_disconnect_backend()
304 if (info->gref >= 0) xenkbd_disconnect_backend()
305 gnttab_end_foreign_access(info->gref, 0, 0UL); xenkbd_disconnect_backend()
306 info->gref = -1; xenkbd_disconnect_backend()
312 struct xenkbd_info *info = dev_get_drvdata(&dev->dev); xenkbd_backend_changed() local
325 ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend, xenkbd_backend_changed()
330 ret = xenbus_printf(XBT_NIL, info->xbdev->nodename, xenkbd_backend_changed()
349 if (xenbus_scanf(XBT_NIL, info->xbdev->otherend, xenkbd_backend_changed()
351 input_set_abs_params(info->ptr, ABS_X, 0, val, 0, 0); xenkbd_backend_changed()
353 if (xenbus_scanf(XBT_NIL, info->xbdev->otherend, xenkbd_backend_changed()
355 input_set_abs_params(info->ptr, ABS_Y, 0, val, 0, 0); xenkbd_backend_changed()
234 xenkbd_connect_backend(struct xenbus_device *dev, struct xenkbd_info *info) xenkbd_connect_backend() argument
/linux-4.4.14/drivers/isdn/i4l/
H A Disdn_tty.c61 isdn_tty_try_read(modem_info *info, struct sk_buff *skb) isdn_tty_try_read() argument
63 struct tty_port *port = &info->port; isdn_tty_try_read()
68 if (!info->online) isdn_tty_try_read()
71 if (!(info->mcr & UART_MCR_RTS)) isdn_tty_try_read()
104 if (info->emu.mdmreg[REG_CPPP] & BIT_CPPP) isdn_tty_try_read()
125 modem_info *info; isdn_tty_readmodem() local
132 info = &dev->mdm.info[midx]; isdn_tty_readmodem()
133 if (!info->online) isdn_tty_readmodem()
138 isdn_audio_eval_dtmf(info); isdn_tty_readmodem()
139 if ((info->vonline & 1) && (info->emu.vpar[1])) isdn_tty_readmodem()
140 isdn_audio_eval_silence(info); isdn_tty_readmodem()
142 if (info->mcr & UART_MCR_RTS) { isdn_tty_readmodem()
144 if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) isdn_tty_readmodem()
145 r = isdn_readbchan_tty(info->isdn_driver, isdn_tty_readmodem()
146 info->isdn_channel, isdn_tty_readmodem()
147 &info->port, 0); isdn_tty_readmodem()
149 r = isdn_readbchan_tty(info->isdn_driver, isdn_tty_readmodem()
150 info->isdn_channel, isdn_tty_readmodem()
151 &info->port, 1); isdn_tty_readmodem()
153 tty_flip_buffer_push(&info->port); isdn_tty_readmodem()
158 info->rcvsched = 0; isdn_tty_readmodem()
161 info->rcvsched = 1; isdn_tty_readmodem()
175 modem_info *info; isdn_tty_rcv_skb() local
181 info = &dev->mdm.info[midx]; isdn_tty_rcv_skb()
185 if ((info->vonline) && (!info->emu.vpar[4])) isdn_tty_rcv_skb()
186 isdn_audio_calc_dtmf(info, skb->data, skb->len, ifmt); isdn_tty_rcv_skb()
187 if ((info->vonline & 1) && (info->emu.vpar[1])) isdn_tty_rcv_skb()
188 isdn_audio_calc_silence(info, skb->data, skb->len, ifmt); isdn_tty_rcv_skb()
190 if ((info->online < 2) isdn_tty_rcv_skb()
192 && (!(info->vonline & 1)) isdn_tty_rcv_skb()
199 if (info->emu.mdmreg[REG_T70] & BIT_T70) { isdn_tty_rcv_skb()
200 if (info->emu.mdmreg[REG_T70] & BIT_T70_EXT) { isdn_tty_rcv_skb()
215 if (info->vonline & 1) { isdn_tty_rcv_skb()
217 switch (info->emu.vpar[3]) { isdn_tty_rcv_skb()
225 skb_trim(skb, isdn_audio_xlaw2adpcm(info->adpcmr, isdn_tty_rcv_skb()
247 if (info->faxonline & 2) { isdn_tty_rcv_skb()
248 isdn_tty_fax_bitorder(info, skb); isdn_tty_rcv_skb()
256 spin_lock_irqsave(&info->readlock, flags); isdn_tty_rcv_skb()
258 if (isdn_tty_try_read(info, skb)) { isdn_tty_rcv_skb()
259 spin_unlock_irqrestore(&info->readlock, flags); isdn_tty_rcv_skb()
272 spin_unlock_irqrestore(&info->readlock, flags); isdn_tty_rcv_skb()
274 if ((dev->modempoll) && (info->rcvsched)) isdn_tty_rcv_skb()
280 isdn_tty_cleanup_xmit(modem_info *info) isdn_tty_cleanup_xmit() argument
282 skb_queue_purge(&info->xmit_queue); isdn_tty_cleanup_xmit()
284 skb_queue_purge(&info->dtmf_queue); isdn_tty_cleanup_xmit()
289 isdn_tty_tint(modem_info *info) isdn_tty_tint() argument
291 struct sk_buff *skb = skb_dequeue(&info->xmit_queue); isdn_tty_tint()
297 if ((slen = isdn_writebuf_skb_stub(info->isdn_driver, isdn_tty_tint()
298 info->isdn_channel, 1, skb)) == len) { isdn_tty_tint()
299 struct tty_struct *tty = info->port.tty; isdn_tty_tint()
300 info->send_outstanding++; isdn_tty_tint()
301 info->msr &= ~UART_MSR_CTS; isdn_tty_tint()
302 info->lsr &= ~UART_LSR_TEMT; isdn_tty_tint()
311 skb_queue_head(&info->xmit_queue, skb); isdn_tty_tint()
330 isdn_tty_handleDLEdown(modem_info *info, atemu *m, int len) isdn_tty_handleDLEdown() argument
332 unsigned char *p = &info->port.xmit_buf[info->xmit_count]; isdn_tty_handleDLEdown()
348 info->vonline |= 4; isdn_tty_handleDLEdown()
352 info->vonline &= ~1; isdn_tty_handleDLEdown()
356 info->line); isdn_tty_handleDLEdown()
358 isdn_tty_at_cout("\020\003", info); isdn_tty_handleDLEdown()
359 if (!info->vonline) { isdn_tty_handleDLEdown()
363 info->line); isdn_tty_handleDLEdown()
365 isdn_tty_at_cout("\r\nVCON\r\n", info); isdn_tty_handleDLEdown()
421 isdn_tty_senddown(modem_info *info) isdn_tty_senddown() argument
431 if (info->vonline & 4) { isdn_tty_senddown()
432 info->vonline &= ~6; isdn_tty_senddown()
433 if (!info->vonline) { isdn_tty_senddown()
437 info->line); isdn_tty_senddown()
439 isdn_tty_at_cout("\r\nVCON\r\n", info); isdn_tty_senddown()
443 if (!(buflen = info->xmit_count)) isdn_tty_senddown()
445 if ((info->emu.mdmreg[REG_CTS] & BIT_CTS) != 0) isdn_tty_senddown()
446 info->msr &= ~UART_MSR_CTS; isdn_tty_senddown()
447 info->lsr &= ~UART_LSR_TEMT; isdn_tty_senddown()
448 /* info->xmit_count is modified here and in isdn_tty_write(). isdn_tty_senddown()
452 atomic_inc(&info->xmit_lock); isdn_tty_senddown()
453 if (!(atomic_dec_and_test(&info->xmit_lock))) isdn_tty_senddown()
455 if (info->isdn_driver < 0) { isdn_tty_senddown()
456 info->xmit_count = 0; isdn_tty_senddown()
459 skb_res = dev->drv[info->isdn_driver]->interface->hl_hdrlen + 4; isdn_tty_senddown()
461 if (info->vonline & 2) isdn_tty_senddown()
462 audio_len = buflen * voice_cf[info->emu.vpar[3]]; isdn_tty_senddown()
472 info->line); isdn_tty_senddown()
476 memcpy(skb_put(skb, buflen), info->port.xmit_buf, buflen); isdn_tty_senddown()
477 info->xmit_count = 0; isdn_tty_senddown()
479 if (info->vonline & 2) { isdn_tty_senddown()
489 switch (info->emu.vpar[3]) { isdn_tty_senddown()
496 audio_len = isdn_audio_adpcm2xlaw(info->adpcms, isdn_tty_senddown()
519 if (info->emu.mdmreg[REG_T70] & BIT_T70) { isdn_tty_senddown()
521 if (info->emu.mdmreg[REG_T70] & BIT_T70_EXT) isdn_tty_senddown()
526 skb_queue_tail(&info->xmit_queue, skb); isdn_tty_senddown()
545 modem_info *info = (modem_info *) data; isdn_tty_modem_do_ncarrier() local
546 isdn_tty_modem_result(RESULT_NO_CARRIER, info); isdn_tty_modem_do_ncarrier()
555 isdn_tty_modem_ncarrier(modem_info *info) isdn_tty_modem_ncarrier() argument
557 if (info->ncarrier) { isdn_tty_modem_ncarrier()
558 info->nc_timer.expires = jiffies + HZ; isdn_tty_modem_ncarrier()
559 add_timer(&info->nc_timer); isdn_tty_modem_ncarrier()
596 isdn_tty_dial(char *n, modem_info *info, atemu *m) isdn_tty_dial() argument
628 isdn_tty_modem_result(RESULT_NO_DIALTONE, info); isdn_tty_dial()
630 info->isdn_driver = dev->drvmap[i]; isdn_tty_dial()
631 info->isdn_channel = dev->chanmap[i]; isdn_tty_dial()
632 info->drv_index = i; isdn_tty_dial()
633 dev->m_idx[i] = info->line; isdn_tty_dial()
635 info->last_dir = 1; isdn_tty_dial()
636 strcpy(info->last_num, n); isdn_tty_dial()
639 cmd.driver = info->isdn_driver; isdn_tty_dial()
640 cmd.arg = info->isdn_channel; isdn_tty_dial()
643 strcpy(cmd.parm.num, isdn_map_eaz2msn(m->msn, info->isdn_driver)); isdn_tty_dial()
644 cmd.driver = info->isdn_driver; isdn_tty_dial()
647 cmd.driver = info->isdn_driver; isdn_tty_dial()
649 info->last_l2 = l2; isdn_tty_dial()
650 cmd.arg = info->isdn_channel + (l2 << 8); isdn_tty_dial()
652 cmd.driver = info->isdn_driver; isdn_tty_dial()
654 cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8); isdn_tty_dial()
657 cmd.parm.fax = info->fax; isdn_tty_dial()
658 info->fax->direction = ISDN_TTY_FAX_CONN_OUT; isdn_tty_dial()
662 cmd.driver = info->isdn_driver; isdn_tty_dial()
663 cmd.arg = info->isdn_channel; isdn_tty_dial()
666 isdn_map_eaz2msn(m->msn, info->isdn_driver)); isdn_tty_dial()
670 info->dialing = 1; isdn_tty_dial()
671 info->emu.carrierwait = 0; isdn_tty_dial()
684 isdn_tty_modem_hup(modem_info *info, int local) isdn_tty_modem_hup() argument
689 if (!info) isdn_tty_modem_hup()
692 di = info->isdn_driver; isdn_tty_modem_hup()
693 ch = info->isdn_channel; isdn_tty_modem_hup()
697 info->isdn_driver = -1; isdn_tty_modem_hup()
698 info->isdn_channel = -1; isdn_tty_modem_hup()
701 printk(KERN_DEBUG "Mhup ttyI%d\n", info->line); isdn_tty_modem_hup()
703 info->rcvsched = 0; isdn_tty_modem_hup()
704 isdn_tty_flush_buffer(info->port.tty); isdn_tty_modem_hup()
705 if (info->online) { isdn_tty_modem_hup()
706 info->last_lhup = local; isdn_tty_modem_hup()
707 info->online = 0; isdn_tty_modem_hup()
708 isdn_tty_modem_result(RESULT_NO_CARRIER, info); isdn_tty_modem_hup()
711 info->vonline = 0; isdn_tty_modem_hup()
713 info->faxonline = 0; isdn_tty_modem_hup()
714 info->fax->phase = ISDN_FAX_PHASE_IDLE; isdn_tty_modem_hup()
716 info->emu.vpar[4] = 0; isdn_tty_modem_hup()
717 info->emu.vpar[5] = 8; isdn_tty_modem_hup()
718 kfree(info->dtmf_state); isdn_tty_modem_hup()
719 info->dtmf_state = NULL; isdn_tty_modem_hup()
720 kfree(info->silence_state); isdn_tty_modem_hup()
721 info->silence_state = NULL; isdn_tty_modem_hup()
722 kfree(info->adpcms); isdn_tty_modem_hup()
723 info->adpcms = NULL; isdn_tty_modem_hup()
724 kfree(info->adpcmr); isdn_tty_modem_hup()
725 info->adpcmr = NULL; isdn_tty_modem_hup()
727 if ((info->msr & UART_MSR_RI) && isdn_tty_modem_hup()
728 (info->emu.mdmreg[REG_RUNG] & BIT_RUNG)) isdn_tty_modem_hup()
729 isdn_tty_modem_result(RESULT_RUNG, info); isdn_tty_modem_hup()
730 info->msr &= ~(UART_MSR_DCD | UART_MSR_RI); isdn_tty_modem_hup()
731 info->lsr |= UART_LSR_TEMT; isdn_tty_modem_hup()
741 info->emu.mdmreg[REG_RINGCNT] = 0; isdn_tty_modem_hup()
744 if (info->drv_index >= 0) { isdn_tty_modem_hup()
745 dev->m_idx[info->drv_index] = -1; isdn_tty_modem_hup()
746 info->drv_index = -1; isdn_tty_modem_hup()
765 isdn_tty_suspend(char *id, modem_info *info, atemu *m) isdn_tty_suspend() argument
771 if (!info) isdn_tty_suspend()
775 printk(KERN_DEBUG "Msusp ttyI%d\n", info->line); isdn_tty_suspend()
778 if ((info->isdn_driver >= 0)) { isdn_tty_suspend()
782 cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; isdn_tty_suspend()
791 cmd.driver = info->isdn_driver; isdn_tty_suspend()
792 cmd.arg = info->isdn_channel; isdn_tty_suspend()
805 isdn_tty_resume(char *id, modem_info *info, atemu *m) isdn_tty_resume() argument
839 isdn_tty_modem_result(RESULT_NO_DIALTONE, info); isdn_tty_resume()
841 info->isdn_driver = dev->drvmap[i]; isdn_tty_resume()
842 info->isdn_channel = dev->chanmap[i]; isdn_tty_resume()
843 info->drv_index = i; isdn_tty_resume()
844 dev->m_idx[i] = info->line; isdn_tty_resume()
846 info->last_dir = 1; isdn_tty_resume()
847 // strcpy(info->last_num, n); isdn_tty_resume()
850 cmd.driver = info->isdn_driver; isdn_tty_resume()
851 cmd.arg = info->isdn_channel; isdn_tty_resume()
854 strcpy(cmd.parm.num, isdn_map_eaz2msn(m->msn, info->isdn_driver)); isdn_tty_resume()
855 cmd.driver = info->isdn_driver; isdn_tty_resume()
858 cmd.driver = info->isdn_driver; isdn_tty_resume()
860 info->last_l2 = l2; isdn_tty_resume()
861 cmd.arg = info->isdn_channel + (l2 << 8); isdn_tty_resume()
863 cmd.driver = info->isdn_driver; isdn_tty_resume()
865 cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8); isdn_tty_resume()
867 cmd.driver = info->isdn_driver; isdn_tty_resume()
868 cmd.arg = info->isdn_channel; isdn_tty_resume()
872 cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; isdn_tty_resume()
881 info->dialing = 1; isdn_tty_resume()
894 isdn_tty_send_msg(modem_info *info, atemu *m, char *msg) isdn_tty_send_msg() argument
909 isdn_tty_modem_result(RESULT_ERROR, info); isdn_tty_send_msg()
934 isdn_tty_modem_result(RESULT_NO_DIALTONE, info); isdn_tty_send_msg()
936 info->isdn_driver = dev->drvmap[i]; isdn_tty_send_msg()
937 info->isdn_channel = dev->chanmap[i]; isdn_tty_send_msg()
938 info->drv_index = i; isdn_tty_send_msg()
939 dev->m_idx[i] = info->line; isdn_tty_send_msg()
941 info->last_dir = 1; isdn_tty_send_msg()
944 cmd.driver = info->isdn_driver; isdn_tty_send_msg()
945 cmd.arg = info->isdn_channel; isdn_tty_send_msg()
948 strcpy(cmd.parm.num, isdn_map_eaz2msn(m->msn, info->isdn_driver)); isdn_tty_send_msg()
949 cmd.driver = info->isdn_driver; isdn_tty_send_msg()
952 cmd.driver = info->isdn_driver; isdn_tty_send_msg()
954 info->last_l2 = l2; isdn_tty_send_msg()
955 cmd.arg = info->isdn_channel + (l2 << 8); isdn_tty_send_msg()
957 cmd.driver = info->isdn_driver; isdn_tty_send_msg()
959 cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8); isdn_tty_send_msg()
961 cmd.driver = info->isdn_driver; isdn_tty_send_msg()
962 cmd.arg = info->isdn_channel; isdn_tty_send_msg()
966 cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; isdn_tty_send_msg()
971 /* info->dialing = 1; isdn_tty_send_msg()
980 isdn_tty_paranoia_check(modem_info *info, char *name, const char *routine) isdn_tty_paranoia_check() argument
983 if (!info) { isdn_tty_paranoia_check()
988 if (info->magic != ISDN_ASYNC_MAGIC) { isdn_tty_paranoia_check()
1002 isdn_tty_change_speed(modem_info *info) isdn_tty_change_speed() argument
1004 struct tty_port *port = &info->port; isdn_tty_change_speed()
1023 info->mcr |= UART_MCR_DTR; isdn_tty_change_speed()
1024 isdn_tty_modem_ncarrier(info); isdn_tty_change_speed()
1026 info->mcr &= ~UART_MCR_DTR; isdn_tty_change_speed()
1027 if (info->emu.mdmreg[REG_DTRHUP] & BIT_DTRHUP) { isdn_tty_change_speed()
1031 if (info->online) isdn_tty_change_speed()
1032 info->ncarrier = 1; isdn_tty_change_speed()
1033 isdn_tty_modem_reset_regs(info, 0); isdn_tty_change_speed()
1034 isdn_tty_modem_hup(info, 1); isdn_tty_change_speed()
1054 isdn_tty_startup(modem_info *info) isdn_tty_startup() argument
1056 if (info->port.flags & ASYNC_INITIALIZED) isdn_tty_startup()
1060 printk(KERN_DEBUG "starting up ttyi%d ...\n", info->line); isdn_tty_startup()
1065 info->mcr = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2; isdn_tty_startup()
1066 if (info->port.tty) isdn_tty_startup()
1067 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); isdn_tty_startup()
1071 isdn_tty_change_speed(info); isdn_tty_startup()
1073 info->port.flags |= ASYNC_INITIALIZED; isdn_tty_startup()
1074 info->msr |= (UART_MSR_DSR | UART_MSR_CTS); isdn_tty_startup()
1075 info->send_outstanding = 0; isdn_tty_startup()
1084 isdn_tty_shutdown(modem_info *info) isdn_tty_shutdown() argument
1086 if (!(info->port.flags & ASYNC_INITIALIZED)) isdn_tty_shutdown()
1089 printk(KERN_DEBUG "Shutting down isdnmodem port %d ....\n", info->line); isdn_tty_shutdown()
1092 info->msr &= ~UART_MSR_RI; isdn_tty_shutdown()
1093 if (!info->port.tty || (info->port.tty->termios.c_cflag & HUPCL)) { isdn_tty_shutdown()
1094 info->mcr &= ~(UART_MCR_DTR | UART_MCR_RTS); isdn_tty_shutdown()
1095 if (info->emu.mdmreg[REG_DTRHUP] & BIT_DTRHUP) { isdn_tty_shutdown()
1096 isdn_tty_modem_reset_regs(info, 0); isdn_tty_shutdown()
1100 isdn_tty_modem_hup(info, 1); isdn_tty_shutdown()
1103 if (info->port.tty) isdn_tty_shutdown()
1104 set_bit(TTY_IO_ERROR, &info->port.tty->flags); isdn_tty_shutdown()
1106 info->port.flags &= ~ASYNC_INITIALIZED; isdn_tty_shutdown()
1123 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_write() local
1124 atemu *m = &info->emu; isdn_tty_write()
1126 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_write")) isdn_tty_write()
1129 atomic_inc(&info->xmit_lock); isdn_tty_write()
1132 if (c > info->xmit_size - info->xmit_count) isdn_tty_write()
1133 c = info->xmit_size - info->xmit_count; isdn_tty_write()
1134 if (info->isdn_driver >= 0 && c > dev->drv[info->isdn_driver]->maxbufsize) isdn_tty_write()
1135 c = dev->drv[info->isdn_driver]->maxbufsize; isdn_tty_write()
1138 if ((info->online > 1) isdn_tty_write()
1140 || (info->vonline & 3) isdn_tty_write()
1144 if (!info->vonline) isdn_tty_write()
1149 memcpy(&info->port.xmit_buf[info->xmit_count], buf, c); isdn_tty_write()
1151 if (info->vonline) { isdn_tty_write()
1152 int cc = isdn_tty_handleDLEdown(info, m, c); isdn_tty_write()
1153 if (info->vonline & 2) { isdn_tty_write()
1159 info->msr |= UART_MSR_CTS; isdn_tty_write()
1160 info->lsr |= UART_LSR_TEMT; isdn_tty_write()
1162 info->xmit_count += cc; isdn_tty_write()
1164 if ((info->vonline & 3) == 1) { isdn_tty_write()
1169 info->vonline &= ~1; isdn_tty_write()
1173 info->line); isdn_tty_write()
1175 isdn_tty_at_cout("\020\003\r\nVCON\r\n", info); isdn_tty_write()
1179 if (TTY_IS_FCLASS1(info)) { isdn_tty_write()
1180 int cc = isdn_tty_handleDLEdown(info, m, c); isdn_tty_write()
1182 if (info->vonline & 4) { /* ETX seen */ isdn_tty_write()
1186 c.driver = info->isdn_driver; isdn_tty_write()
1187 c.arg = info->isdn_channel; isdn_tty_write()
1192 info->vonline = 0; isdn_tty_write()
1196 info->xmit_count += cc; isdn_tty_write()
1199 info->xmit_count += c; isdn_tty_write()
1201 info->msr |= UART_MSR_CTS; isdn_tty_write()
1202 info->lsr |= UART_LSR_TEMT; isdn_tty_write()
1203 if (info->dialing) { isdn_tty_write()
1204 info->dialing = 0; isdn_tty_write()
1208 isdn_tty_modem_result(RESULT_NO_CARRIER, info); isdn_tty_write()
1209 isdn_tty_modem_hup(info, 1); isdn_tty_write()
1211 c = isdn_tty_edit_at(buf, c, info); isdn_tty_write()
1217 atomic_dec(&info->xmit_lock); isdn_tty_write()
1218 if ((info->xmit_count) || !skb_queue_empty(&info->xmit_queue)) { isdn_tty_write()
1220 isdn_tty_senddown(info); isdn_tty_write()
1221 isdn_tty_tint(info); isdn_tty_write()
1231 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_write_room() local
1234 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_write_room")) isdn_tty_write_room()
1236 if (!info->online) isdn_tty_write_room()
1237 return info->xmit_size; isdn_tty_write_room()
1238 ret = info->xmit_size - info->xmit_count; isdn_tty_write_room()
1245 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_chars_in_buffer() local
1247 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_chars_in_buffer")) isdn_tty_chars_in_buffer()
1249 if (!info->online) isdn_tty_chars_in_buffer()
1251 return (info->xmit_count); isdn_tty_chars_in_buffer()
1257 modem_info *info; isdn_tty_flush_buffer() local
1262 info = (modem_info *) tty->driver_data; isdn_tty_flush_buffer()
1263 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_flush_buffer")) { isdn_tty_flush_buffer()
1266 isdn_tty_cleanup_xmit(info); isdn_tty_flush_buffer()
1267 info->xmit_count = 0; isdn_tty_flush_buffer()
1274 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_flush_chars() local
1276 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_flush_chars")) isdn_tty_flush_chars()
1278 if ((info->xmit_count) || !skb_queue_empty(&info->xmit_queue)) isdn_tty_flush_chars()
1293 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_throttle() local
1295 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_throttle")) isdn_tty_throttle()
1298 info->x_char = STOP_CHAR(tty); isdn_tty_throttle()
1299 info->mcr &= ~UART_MCR_RTS; isdn_tty_throttle()
1305 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_unthrottle() local
1307 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_unthrottle")) isdn_tty_unthrottle()
1310 if (info->x_char) isdn_tty_unthrottle()
1311 info->x_char = 0; isdn_tty_unthrottle()
1313 info->x_char = START_CHAR(tty); isdn_tty_unthrottle()
1315 info->mcr |= UART_MCR_RTS; isdn_tty_unthrottle()
1325 * isdn_tty_get_lsr_info - get line status register info
1327 * Purpose: Let user call ioctl() to get info when the UART physically
1335 isdn_tty_get_lsr_info(modem_info *info, uint __user *value) isdn_tty_get_lsr_info() argument
1340 status = info->lsr; isdn_tty_get_lsr_info()
1349 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_tiocmget() local
1352 if (isdn_tty_paranoia_check(info, tty->name, __func__)) isdn_tty_tiocmget()
1359 printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line); isdn_tty_tiocmget()
1362 control = info->mcr; isdn_tty_tiocmget()
1363 status = info->msr; isdn_tty_tiocmget()
1377 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_tiocmset() local
1379 if (isdn_tty_paranoia_check(info, tty->name, __func__)) isdn_tty_tiocmset()
1385 printk(KERN_DEBUG "ttyI%d ioctl TIOCMxxx: %x %x\n", info->line, set, clear); isdn_tty_tiocmset()
1390 info->mcr |= UART_MCR_RTS; isdn_tty_tiocmset()
1392 info->mcr |= UART_MCR_DTR; isdn_tty_tiocmset()
1393 isdn_tty_modem_ncarrier(info); isdn_tty_tiocmset()
1397 info->mcr &= ~UART_MCR_RTS; isdn_tty_tiocmset()
1399 info->mcr &= ~UART_MCR_DTR; isdn_tty_tiocmset()
1400 if (info->emu.mdmreg[REG_DTRHUP] & BIT_DTRHUP) { isdn_tty_tiocmset()
1401 isdn_tty_modem_reset_regs(info, 0); isdn_tty_tiocmset()
1405 if (info->online) isdn_tty_tiocmset()
1406 info->ncarrier = 1; isdn_tty_tiocmset()
1407 isdn_tty_modem_hup(info, 1); isdn_tty_tiocmset()
1417 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_ioctl() local
1420 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_ioctl")) isdn_tty_ioctl()
1427 printk(KERN_DEBUG "ttyI%d ioctl TCSBRK\n", info->line); isdn_tty_ioctl()
1436 printk(KERN_DEBUG "ttyI%d ioctl TCSBRKP\n", info->line); isdn_tty_ioctl()
1445 printk(KERN_DEBUG "ttyI%d ioctl TIOCSERGETLSR\n", info->line); isdn_tty_ioctl()
1447 return isdn_tty_get_lsr_info(info, (uint __user *) arg); isdn_tty_ioctl()
1450 printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line); isdn_tty_ioctl()
1460 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_set_termios() local
1463 isdn_tty_change_speed(info); isdn_tty_set_termios()
1469 isdn_tty_change_speed(info); isdn_tty_set_termios()
1481 modem_info *info = &dev->mdm.info[tty->index]; isdn_tty_install() local
1483 if (isdn_tty_paranoia_check(info, tty->name, __func__)) isdn_tty_install()
1486 tty->driver_data = info; isdn_tty_install()
1488 return tty_port_install(&info->port, driver, tty); isdn_tty_install()
1500 modem_info *info = tty->driver_data; isdn_tty_open() local
1501 struct tty_port *port = &info->port; isdn_tty_open()
1513 retval = isdn_tty_startup(info); isdn_tty_open()
1528 printk(KERN_DEBUG "isdn_tty_open ttyi%d successful...\n", info->line); isdn_tty_open()
1540 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_close() local
1541 struct tty_port *port = &info->port; isdn_tty_close()
1544 if (!info || isdn_tty_paranoia_check(info, tty->name, "isdn_tty_close")) isdn_tty_close()
1561 "info->count is %d\n", port->count); isdn_tty_close()
1566 info->line, port->count); isdn_tty_close()
1571 printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n"); isdn_tty_close()
1592 while (!(info->lsr & UART_LSR_TEMT)) { isdn_tty_close()
1599 isdn_tty_shutdown(info); isdn_tty_close()
1603 info->ncarrier = 0; isdn_tty_close()
1617 modem_info *info = (modem_info *) tty->driver_data; isdn_tty_hangup() local
1618 struct tty_port *port = &info->port; isdn_tty_hangup()
1620 if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_hangup")) isdn_tty_hangup()
1622 isdn_tty_shutdown(info); isdn_tty_hangup()
1675 isdn_tty_modem_reset_faxpar(modem_info *info) isdn_tty_modem_reset_faxpar() argument
1677 T30_s *f = info->fax; isdn_tty_modem_reset_faxpar()
1708 isdn_tty_modem_reset_regs(modem_info *info, int force) isdn_tty_modem_reset_regs() argument
1710 atemu *m = &info->emu; isdn_tty_modem_reset_regs()
1715 info->xmit_size = m->mdmreg[REG_PSIZE] * 16; isdn_tty_modem_reset_regs()
1721 isdn_tty_modem_reset_faxpar(info); isdn_tty_modem_reset_regs()
1756 modem_info *info = container_of(port, modem_info, port); isdn_tty_carrier_raised() local
1757 return info->msr & UART_MSR_DCD; isdn_tty_carrier_raised()
1769 modem_info *info; isdn_tty_modem_init() local
1791 info = &m->info[i]; isdn_tty_modem_init()
1793 if (!(info->fax = kmalloc(sizeof(T30_s), GFP_KERNEL))) { isdn_tty_modem_init()
1799 tty_port_init(&info->port); isdn_tty_modem_init()
1800 info->port.ops = &isdn_tty_port_ops; isdn_tty_modem_init()
1801 spin_lock_init(&info->readlock); isdn_tty_modem_init()
1802 sprintf(info->last_cause, "0000"); isdn_tty_modem_init()
1803 sprintf(info->last_num, "none"); isdn_tty_modem_init()
1804 info->last_dir = 0; isdn_tty_modem_init()
1805 info->last_lhup = 1; isdn_tty_modem_init()
1806 info->last_l2 = -1; isdn_tty_modem_init()
1807 info->last_si = 0; isdn_tty_modem_init()
1808 isdn_tty_reset_profile(&info->emu); isdn_tty_modem_init()
1809 isdn_tty_modem_reset_regs(info, 1); isdn_tty_modem_init()
1810 info->magic = ISDN_ASYNC_MAGIC; isdn_tty_modem_init()
1811 info->line = i; isdn_tty_modem_init()
1812 info->x_char = 0; isdn_tty_modem_init()
1813 info->isdn_driver = -1; isdn_tty_modem_init()
1814 info->isdn_channel = -1; isdn_tty_modem_init()
1815 info->drv_index = -1; isdn_tty_modem_init()
1816 info->xmit_size = ISDN_SERIAL_XMIT_SIZE; isdn_tty_modem_init()
1817 init_timer(&info->nc_timer); isdn_tty_modem_init()
1818 info->nc_timer.function = isdn_tty_modem_do_ncarrier; isdn_tty_modem_init()
1819 info->nc_timer.data = (unsigned long) info; isdn_tty_modem_init()
1820 skb_queue_head_init(&info->xmit_queue); isdn_tty_modem_init()
1822 skb_queue_head_init(&info->dtmf_queue); isdn_tty_modem_init()
1824 info->port.xmit_buf = kmalloc(ISDN_SERIAL_XMIT_MAX + 5, isdn_tty_modem_init()
1826 if (!info->port.xmit_buf) { isdn_tty_modem_init()
1832 info->port.xmit_buf += 4; isdn_tty_modem_init()
1837 info = &m->info[i]; isdn_tty_modem_init()
1839 kfree(info->fax); isdn_tty_modem_init()
1841 kfree(info->port.xmit_buf - 4); isdn_tty_modem_init()
1842 info->port.xmit_buf = NULL; isdn_tty_modem_init()
1843 tty_port_destroy(&info->port); isdn_tty_modem_init()
1855 modem_info *info; isdn_tty_exit() local
1859 info = &dev->mdm.info[i]; isdn_tty_exit()
1860 isdn_tty_cleanup_xmit(info); isdn_tty_exit()
1862 kfree(info->fax); isdn_tty_exit()
1864 kfree(info->port.xmit_buf - 4); isdn_tty_exit()
1865 info->port.xmit_buf = NULL; isdn_tty_exit()
1866 tty_port_destroy(&info->port); isdn_tty_exit()
1966 modem_info *info = &dev->mdm.info[i]; isdn_tty_find_icall() local
1968 if (info->port.count == 0) isdn_tty_find_icall()
1970 if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */ isdn_tty_find_icall()
1971 (info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */ isdn_tty_find_icall()
1976 info->port.flags, info->isdn_driver, isdn_tty_find_icall()
1977 info->isdn_channel, dev->usage[idx]); isdn_tty_find_icall()
1981 (info->port.flags & ASYNC_NORMAL_ACTIVE) && isdn_tty_find_icall()
1983 (info->isdn_driver == -1) && isdn_tty_find_icall()
1984 (info->isdn_channel == -1) && isdn_tty_find_icall()
1988 if ((matchret = isdn_tty_match_icall(eaz, &info->emu, di)) > wret) isdn_tty_find_icall()
1991 info->isdn_driver = di; isdn_tty_find_icall()
1992 info->isdn_channel = ch; isdn_tty_find_icall()
1993 info->drv_index = idx; isdn_tty_find_icall()
1994 dev->m_idx[idx] = info->line; isdn_tty_find_icall()
1996 dev->usage[idx] |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]); isdn_tty_find_icall()
1998 strcpy(info->emu.cpn, eaz); isdn_tty_find_icall()
1999 info->emu.mdmreg[REG_SI1I] = si2bit[si1]; isdn_tty_find_icall()
2000 info->emu.mdmreg[REG_PLAN] = setup->plan; isdn_tty_find_icall()
2001 info->emu.mdmreg[REG_SCREEN] = setup->screen; isdn_tty_find_icall()
2005 info->line); isdn_tty_find_icall()
2006 info->msr |= UART_MSR_RI; isdn_tty_find_icall()
2007 isdn_tty_modem_result(RESULT_RING, info); isdn_tty_find_icall()
2020 #define TTY_IS_ACTIVE(info) (info->port.flags & ASYNC_NORMAL_ACTIVE)
2026 modem_info *info; isdn_tty_stat_callback() local
2032 info = &dev->mdm.info[mi]; isdn_tty_stat_callback()
2035 printk(KERN_DEBUG "CHARGEINFO on ttyI%d: %ld %s\n", info->line, c->arg, c->parm.num); isdn_tty_stat_callback()
2036 info->emu.charge = (unsigned) simple_strtoul(c->parm.num, &e, 10); isdn_tty_stat_callback()
2038 info->emu.charge = 0; isdn_tty_stat_callback()
2043 printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line); isdn_tty_stat_callback()
2045 if ((info->isdn_driver == c->driver) && isdn_tty_stat_callback()
2046 (info->isdn_channel == c->arg)) { isdn_tty_stat_callback()
2047 info->msr |= UART_MSR_CTS; isdn_tty_stat_callback()
2048 if (info->send_outstanding) isdn_tty_stat_callback()
2049 if (!(--info->send_outstanding)) isdn_tty_stat_callback()
2050 info->lsr |= UART_LSR_TEMT; isdn_tty_stat_callback()
2051 isdn_tty_tint(info); isdn_tty_stat_callback()
2057 printk(KERN_DEBUG "tty_STAT_CAUSE ttyI%d\n", info->line); isdn_tty_stat_callback()
2060 strncpy(info->last_cause, c->parm.num, 5); isdn_tty_stat_callback()
2064 printk(KERN_DEBUG "tty_STAT_DISPLAY ttyI%d\n", info->line); isdn_tty_stat_callback()
2067 if ((info->emu.mdmreg[REG_DISPLAY] & BIT_DISPLAY) && isdn_tty_stat_callback()
2068 !(info->emu.mdmreg[REG_RESPNUM] & BIT_RESPNUM)) { isdn_tty_stat_callback()
2069 isdn_tty_at_cout("\r\n", info); isdn_tty_stat_callback()
2070 isdn_tty_at_cout("DISPLAY: ", info); isdn_tty_stat_callback()
2071 isdn_tty_at_cout(c->parm.display, info); isdn_tty_stat_callback()
2072 isdn_tty_at_cout("\r\n", info); isdn_tty_stat_callback()
2077 printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line); isdn_tty_stat_callback()
2079 if (TTY_IS_ACTIVE(info)) { isdn_tty_stat_callback()
2080 if (info->dialing == 1) { isdn_tty_stat_callback()
2081 info->dialing = 2; isdn_tty_stat_callback()
2088 printk(KERN_DEBUG "tty_STAT_DHUP ttyI%d\n", info->line); isdn_tty_stat_callback()
2090 if (TTY_IS_ACTIVE(info)) { isdn_tty_stat_callback()
2091 if (info->dialing == 1) isdn_tty_stat_callback()
2092 isdn_tty_modem_result(RESULT_BUSY, info); isdn_tty_stat_callback()
2093 if (info->dialing > 1) isdn_tty_stat_callback()
2094 isdn_tty_modem_result(RESULT_NO_CARRIER, info); isdn_tty_stat_callback()
2095 info->dialing = 0; isdn_tty_stat_callback()
2099 isdn_tty_modem_hup(info, 0); isdn_tty_stat_callback()
2105 printk(KERN_DEBUG "tty_STAT_BCONN ttyI%d\n", info->line); isdn_tty_stat_callback()
2111 if (info->port.blocked_open && isdn_tty_stat_callback()
2112 (info->emu.mdmreg[REG_DCD] & BIT_DCD)) { isdn_tty_stat_callback()
2113 wake_up_interruptible(&info->port.open_wait); isdn_tty_stat_callback()
2120 if (TTY_IS_ACTIVE(info) || isdn_tty_stat_callback()
2121 (info->port.blocked_open && isdn_tty_stat_callback()
2122 (info->emu.mdmreg[REG_DCD] & BIT_DCD))) { isdn_tty_stat_callback()
2123 info->msr |= UART_MSR_DCD; isdn_tty_stat_callback()
2124 info->emu.charge = 0; isdn_tty_stat_callback()
2125 if (info->dialing & 0xf) isdn_tty_stat_callback()
2126 info->last_dir = 1; isdn_tty_stat_callback()
2128 info->last_dir = 0; isdn_tty_stat_callback()
2129 info->dialing = 0; isdn_tty_stat_callback()
2130 info->rcvsched = 1; isdn_tty_stat_callback()
2132 if (info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) { isdn_tty_stat_callback()
2133 strcpy(info->emu.connmsg, c->parm.num); isdn_tty_stat_callback()
2134 isdn_tty_modem_result(RESULT_CONNECT, info); isdn_tty_stat_callback()
2136 isdn_tty_modem_result(RESULT_CONNECT64000, info); isdn_tty_stat_callback()
2139 isdn_tty_modem_result(RESULT_VCON, info); isdn_tty_stat_callback()
2145 printk(KERN_DEBUG "tty_STAT_BHUP ttyI%d\n", info->line); isdn_tty_stat_callback()
2147 if (TTY_IS_ACTIVE(info)) { isdn_tty_stat_callback()
2151 isdn_tty_modem_hup(info, 0); isdn_tty_stat_callback()
2157 printk(KERN_DEBUG "tty_STAT_NODCH ttyI%d\n", info->line); isdn_tty_stat_callback()
2159 if (TTY_IS_ACTIVE(info)) { isdn_tty_stat_callback()
2160 if (info->dialing) { isdn_tty_stat_callback()
2161 info->dialing = 0; isdn_tty_stat_callback()
2162 info->last_l2 = -1; isdn_tty_stat_callback()
2163 info->last_si = 0; isdn_tty_stat_callback()
2164 sprintf(info->last_cause, "0000"); isdn_tty_stat_callback()
2165 isdn_tty_modem_result(RESULT_NO_DIALTONE, info); isdn_tty_stat_callback()
2167 isdn_tty_modem_hup(info, 0); isdn_tty_stat_callback()
2173 printk(KERN_DEBUG "tty_STAT_UNLOAD ttyI%d\n", info->line); isdn_tty_stat_callback()
2176 info = &dev->mdm.info[i]; isdn_tty_stat_callback()
2177 if (info->isdn_driver == c->driver) { isdn_tty_stat_callback()
2178 if (info->online) isdn_tty_stat_callback()
2179 isdn_tty_modem_hup(info, 1); isdn_tty_stat_callback()
2185 if (TTY_IS_ACTIVE(info)) { isdn_tty_stat_callback()
2186 isdn_tty_fax_command(info, c); isdn_tty_stat_callback()
2192 if (TTY_IS_ACTIVE(info)) { isdn_tty_stat_callback()
2195 if (info->vonline) { isdn_tty_stat_callback()
2196 isdn_audio_put_dle_code(info, isdn_tty_stat_callback()
2220 isdn_tty_at_cout(char *msg, modem_info *info) isdn_tty_at_cout() argument
2222 struct tty_port *port = &info->port; isdn_tty_at_cout()
2223 atemu *m = &info->emu; isdn_tty_at_cout()
2238 spin_lock_irqsave(&info->readlock, flags); isdn_tty_at_cout()
2240 spin_unlock_irqrestore(&info->readlock, flags); isdn_tty_at_cout()
2246 if (info->online && ((tty_buffer_request_room(port, l) < l) || isdn_tty_at_cout()
2247 !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) { isdn_tty_at_cout()
2250 spin_unlock_irqrestore(&info->readlock, flags); isdn_tty_at_cout()
2282 __skb_queue_tail(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel], skb); isdn_tty_at_cout()
2283 dev->drv[info->isdn_driver]->rcvcount[info->isdn_channel] += skb->len; isdn_tty_at_cout()
2284 spin_unlock_irqrestore(&info->readlock, flags); isdn_tty_at_cout()
2286 if (dev->modempoll && info->rcvsched) isdn_tty_at_cout()
2290 spin_unlock_irqrestore(&info->readlock, flags); isdn_tty_at_cout()
2299 isdn_tty_on_hook(modem_info *info) isdn_tty_on_hook() argument
2301 if (info->isdn_channel >= 0) { isdn_tty_on_hook()
2305 isdn_tty_modem_hup(info, 1); isdn_tty_on_hook()
2370 isdn_tty_modem_result(int code, modem_info *info) isdn_tty_modem_result() argument
2372 atemu *m = &info->emu; isdn_tty_modem_result()
2384 isdn_tty_cmd_ATA(info); isdn_tty_modem_result()
2389 (info->port.flags & ASYNC_CLOSING), isdn_tty_modem_result()
2390 (!info->port.tty)); isdn_tty_modem_result()
2393 del_timer(&info->nc_timer); isdn_tty_modem_result()
2394 info->ncarrier = 0; isdn_tty_modem_result()
2395 if ((info->port.flags & ASYNC_CLOSING) || (!info->port.tty)) isdn_tty_modem_result()
2399 if (info->vonline & 1) { isdn_tty_modem_result()
2402 info->line); isdn_tty_modem_result()
2405 isdn_tty_at_cout("\020\003", info); isdn_tty_modem_result()
2407 if (info->vonline & 2) { isdn_tty_modem_result()
2410 info->line); isdn_tty_modem_result()
2413 isdn_tty_at_cout("\020\024", info); isdn_tty_modem_result()
2419 sprintf(info->last_cause, "0000"); isdn_tty_modem_result()
2420 if (!info->online) isdn_tty_modem_result()
2421 info->online = 2; isdn_tty_modem_result()
2426 info->line); isdn_tty_modem_result()
2428 sprintf(info->last_cause, "0000"); isdn_tty_modem_result()
2429 if (!info->online) isdn_tty_modem_result()
2430 info->online = 1; isdn_tty_modem_result()
2439 isdn_tty_at_cout(s, info); isdn_tty_modem_result()
2448 isdn_tty_at_cout("\r\nCALLER NUMBER: ", info); isdn_tty_modem_result()
2449 isdn_tty_at_cout(dev->num[info->drv_index], info); isdn_tty_modem_result()
2451 isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); isdn_tty_modem_result()
2452 isdn_tty_at_cout(info->emu.cpn, info); isdn_tty_modem_result()
2456 isdn_tty_at_cout("\r\n", info); isdn_tty_modem_result()
2457 isdn_tty_at_cout(msg[code], info); isdn_tty_modem_result()
2462 isdn_tty_at_cout(" ", info); isdn_tty_modem_result()
2463 isdn_tty_at_cout(m->connmsg, info); isdn_tty_modem_result()
2471 isdn_tty_at_cout(s, info); isdn_tty_modem_result()
2476 isdn_tty_at_cout("\r\n", info); isdn_tty_modem_result()
2477 isdn_tty_at_cout("CALLER NUMBER: ", info); isdn_tty_modem_result()
2478 isdn_tty_at_cout(dev->num[info->drv_index], info); isdn_tty_modem_result()
2480 isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); isdn_tty_modem_result()
2481 isdn_tty_at_cout(info->emu.cpn, info); isdn_tty_modem_result()
2492 sprintf(s, "/%s", info->last_cause); isdn_tty_modem_result()
2493 isdn_tty_at_cout(s, info); isdn_tty_modem_result()
2502 isdn_tty_at_cout("/X.75", info); isdn_tty_modem_result()
2505 isdn_tty_at_cout("/HDLC", info); isdn_tty_modem_result()
2508 isdn_tty_at_cout("/V110/9600", info); isdn_tty_modem_result()
2511 isdn_tty_at_cout("/V110/19200", info); isdn_tty_modem_result()
2514 isdn_tty_at_cout("/V110/38400", info); isdn_tty_modem_result()
2518 isdn_tty_at_cout("/T.70", info); isdn_tty_modem_result()
2520 isdn_tty_at_cout("+", info); isdn_tty_modem_result()
2524 isdn_tty_at_cout("\r\n", info); isdn_tty_modem_result()
2528 if ((info->port.flags & ASYNC_CLOSING) || (!info->port.tty)) isdn_tty_modem_result()
2531 if (info->port.flags & ASYNC_CHECK_CD) isdn_tty_modem_result()
2532 tty_hangup(info->port.tty); isdn_tty_modem_result()
2541 isdn_tty_show_profile(int ridx, modem_info *info) isdn_tty_show_profile() argument
2545 sprintf(v, "\r\n%d", info->emu.mdmreg[ridx]); isdn_tty_show_profile()
2546 isdn_tty_at_cout(v, info); isdn_tty_show_profile()
2590 #define PARSE_ERROR { isdn_tty_modem_result(RESULT_ERROR, info); return; }
2591 #define PARSE_ERROR1 { isdn_tty_modem_result(RESULT_ERROR, info); return 1; }
2594 isdn_tty_report(modem_info *info) isdn_tty_report() argument
2596 atemu *m = &info->emu; isdn_tty_report()
2599 isdn_tty_at_cout("\r\nStatistics of last connection:\r\n\r\n", info); isdn_tty_report()
2600 sprintf(s, " Remote Number: %s\r\n", info->last_num); isdn_tty_report()
2601 isdn_tty_at_cout(s, info); isdn_tty_report()
2602 sprintf(s, " Direction: %s\r\n", info->last_dir ? "outgoing" : "incoming"); isdn_tty_report()
2603 isdn_tty_at_cout(s, info); isdn_tty_report()
2604 isdn_tty_at_cout(" Layer-2 Protocol: ", info); isdn_tty_report()
2605 switch (info->last_l2) { isdn_tty_report()
2607 isdn_tty_at_cout("X.75i", info); isdn_tty_report()
2610 isdn_tty_at_cout("X.75ui", info); isdn_tty_report()
2613 isdn_tty_at_cout("X.75bui", info); isdn_tty_report()
2616 isdn_tty_at_cout("HDLC", info); isdn_tty_report()
2619 isdn_tty_at_cout("V.110 9600 Baud", info); isdn_tty_report()
2622 isdn_tty_at_cout("V.110 19200 Baud", info); isdn_tty_report()
2625 isdn_tty_at_cout("V.110 38400 Baud", info); isdn_tty_report()
2628 isdn_tty_at_cout("transparent", info); isdn_tty_report()
2631 isdn_tty_at_cout("modem", info); isdn_tty_report()
2634 isdn_tty_at_cout("fax", info); isdn_tty_report()
2637 isdn_tty_at_cout("unknown", info); isdn_tty_report()
2641 isdn_tty_at_cout("/T.70", info); isdn_tty_report()
2643 isdn_tty_at_cout("+", info); isdn_tty_report()
2645 isdn_tty_at_cout("\r\n", info); isdn_tty_report()
2646 isdn_tty_at_cout(" Service: ", info); isdn_tty_report()
2647 switch (info->last_si) { isdn_tty_report()
2649 isdn_tty_at_cout("audio\r\n", info); isdn_tty_report()
2652 isdn_tty_at_cout("btx\r\n", info); isdn_tty_report()
2655 isdn_tty_at_cout("data\r\n", info); isdn_tty_report()
2658 sprintf(s, "%d\r\n", info->last_si); isdn_tty_report()
2659 isdn_tty_at_cout(s, info); isdn_tty_report()
2662 sprintf(s, " Hangup location: %s\r\n", info->last_lhup ? "local" : "remote"); isdn_tty_report()
2663 isdn_tty_at_cout(s, info); isdn_tty_report()
2664 sprintf(s, " Last cause: %s\r\n", info->last_cause); isdn_tty_report()
2665 isdn_tty_at_cout(s, info); isdn_tty_report()
2672 isdn_tty_cmd_ATand(char **p, modem_info *info) isdn_tty_cmd_ATand() argument
2674 atemu *m = &info->emu; isdn_tty_cmd_ATand()
2692 info->xmit_size = m->mdmreg[REG_PSIZE] * 16; isdn_tty_cmd_ATand()
2697 info->xmit_size /= 10; isdn_tty_cmd_ATand()
2742 if (info->msr & UART_MSR_DCD) isdn_tty_cmd_ATand()
2745 isdn_tty_modem_reset_regs(info, 1); isdn_tty_cmd_ATand()
2773 info->xmit_size = m->mdmreg[REG_PSIZE] * 16; isdn_tty_cmd_ATand()
2778 info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; isdn_tty_cmd_ATand()
2783 info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; isdn_tty_cmd_ATand()
2788 info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; isdn_tty_cmd_ATand()
2810 isdn_tty_at_cout("\r\n", info); isdn_tty_cmd_ATand()
2814 isdn_tty_at_cout(rb, info); isdn_tty_cmd_ATand()
2818 isdn_tty_at_cout(rb, info); isdn_tty_cmd_ATand()
2820 isdn_tty_at_cout("\r\nListen: ", info); isdn_tty_cmd_ATand()
2821 isdn_tty_at_cout(m->lmsn, info); isdn_tty_cmd_ATand()
2822 isdn_tty_at_cout("\r\n", info); isdn_tty_cmd_ATand()
2843 info->xmit_size = m->mdmreg[REG_PSIZE] * 16; isdn_tty_cmd_ATand()
2849 info->xmit_size = 112; isdn_tty_cmd_ATand()
2856 info->xmit_size = 112; isdn_tty_cmd_ATand()
2871 isdn_tty_check_ats(int mreg, int mval, modem_info *info, atemu *m) isdn_tty_check_ats() argument
2886 info->xmit_size = mval * 16; isdn_tty_check_ats()
2891 info->xmit_size /= 10; isdn_tty_check_ats()
2907 isdn_tty_cmd_ATS(char **p, modem_info *info) isdn_tty_cmd_ATS() argument
2909 atemu *m = &info->emu; isdn_tty_cmd_ATS()
2924 if (isdn_tty_check_ats(mreg, mval, info, m)) isdn_tty_cmd_ATS()
2944 if (isdn_tty_check_ats(mreg, mval, info, m)) isdn_tty_cmd_ATS()
2950 isdn_tty_at_cout("\r\n", info); isdn_tty_cmd_ATS()
2952 info); isdn_tty_cmd_ATS()
2960 isdn_tty_show_profile(mreg, info); isdn_tty_cmd_ATS()
2973 isdn_tty_cmd_ATA(modem_info *info) isdn_tty_cmd_ATA() argument
2975 atemu *m = &info->emu; isdn_tty_cmd_ATA()
2979 if (info->msr & UART_MSR_RI) { isdn_tty_cmd_ATA()
2981 info->last_dir = 0; isdn_tty_cmd_ATA()
2982 strcpy(info->last_num, dev->num[info->drv_index]); isdn_tty_cmd_ATA()
2984 info->msr &= ~UART_MSR_RI; isdn_tty_cmd_ATA()
2996 cmd.driver = info->isdn_driver; isdn_tty_cmd_ATA()
2998 cmd.arg = info->isdn_channel + (l2 << 8); isdn_tty_cmd_ATA()
2999 info->last_l2 = l2; isdn_tty_cmd_ATA()
3001 cmd.driver = info->isdn_driver; isdn_tty_cmd_ATA()
3003 cmd.arg = info->isdn_channel + (m->mdmreg[REG_L3PROT] << 8); isdn_tty_cmd_ATA()
3006 cmd.parm.fax = info->fax; isdn_tty_cmd_ATA()
3007 info->fax->direction = ISDN_TTY_FAX_CONN_IN; isdn_tty_cmd_ATA()
3011 cmd.driver = info->isdn_driver; isdn_tty_cmd_ATA()
3012 cmd.arg = info->isdn_channel; isdn_tty_cmd_ATA()
3014 info->dialing = 16; isdn_tty_cmd_ATA()
3015 info->emu.carrierwait = 0; isdn_tty_cmd_ATA()
3019 isdn_tty_modem_result(RESULT_NO_ANSWER, info); isdn_tty_cmd_ATA()
3027 isdn_tty_cmd_PLUSF(char **p, modem_info *info) isdn_tty_cmd_PLUSF() argument
3029 atemu *m = &info->emu; isdn_tty_cmd_PLUSF()
3040 if (TTY_IS_FCLASS2(info)) isdn_tty_cmd_PLUSF()
3042 else if (TTY_IS_FCLASS1(info)) isdn_tty_cmd_PLUSF()
3045 isdn_tty_at_cout(rs, info); isdn_tty_cmd_PLUSF()
3055 info->xmit_size = isdn_tty_cmd_PLUSF()
3067 info->xmit_size = isdn_tty_cmd_PLUSF()
3078 info->xmit_size = isdn_tty_cmd_PLUSF()
3088 info->xmit_size = VBUF; isdn_tty_cmd_PLUSF()
3102 isdn_tty_at_cout(rs, info); isdn_tty_cmd_PLUSF()
3114 return (isdn_tty_cmd_PLUSF_FAX(p, info)); isdn_tty_cmd_PLUSF()
3124 isdn_tty_cmd_PLUSV(char **p, modem_info *info) isdn_tty_cmd_PLUSV() argument
3126 atemu *m = &info->emu; isdn_tty_cmd_PLUSV()
3149 isdn_tty_at_cout("\r\n1", info); isdn_tty_cmd_PLUSV()
3159 isdn_tty_at_cout("\r\n1", info); isdn_tty_cmd_PLUSV()
3179 isdn_tty_at_cout(rs, info); isdn_tty_cmd_PLUSV()
3194 isdn_tty_at_cout("\r\n0,2", info); isdn_tty_cmd_PLUSV()
3208 if (info->online != 1) { isdn_tty_cmd_PLUSV()
3209 isdn_tty_modem_result(RESULT_NO_ANSWER, info); isdn_tty_cmd_PLUSV()
3212 info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state); isdn_tty_cmd_PLUSV()
3213 if (!info->dtmf_state) { isdn_tty_cmd_PLUSV()
3217 info->silence_state = isdn_audio_silence_init(info->silence_state); isdn_tty_cmd_PLUSV()
3218 if (!info->silence_state) { isdn_tty_cmd_PLUSV()
3223 info->adpcmr = isdn_audio_adpcm_init(info->adpcmr, m->vpar[3]); isdn_tty_cmd_PLUSV()
3224 if (!info->adpcmr) { isdn_tty_cmd_PLUSV()
3232 info->vonline |= 1; isdn_tty_cmd_PLUSV()
3233 isdn_tty_modem_result(RESULT_CONNECT, info); isdn_tty_cmd_PLUSV()
3244 isdn_tty_at_cout(rs, info); isdn_tty_cmd_PLUSV()
3265 info); isdn_tty_cmd_PLUSV()
3282 isdn_tty_at_cout(rs, info); isdn_tty_cmd_PLUSV()
3300 info); isdn_tty_cmd_PLUSV()
3302 info); isdn_tty_cmd_PLUSV()
3304 info); isdn_tty_cmd_PLUSV()
3306 info); isdn_tty_cmd_PLUSV()
3308 info); isdn_tty_cmd_PLUSV()
3322 if (info->online != 1) { isdn_tty_cmd_PLUSV()
3323 isdn_tty_modem_result(RESULT_NO_ANSWER, info); isdn_tty_cmd_PLUSV()
3326 info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state); isdn_tty_cmd_PLUSV()
3327 if (!info->dtmf_state) { isdn_tty_cmd_PLUSV()
3332 info->adpcms = isdn_audio_adpcm_init(info->adpcms, m->vpar[3]); isdn_tty_cmd_PLUSV()
3333 if (!info->adpcms) { isdn_tty_cmd_PLUSV()
3342 info->vonline |= 2; isdn_tty_cmd_PLUSV()
3343 isdn_tty_modem_result(RESULT_CONNECT, info); isdn_tty_cmd_PLUSV()
3354 isdn_tty_at_cout(rs, info); isdn_tty_cmd_PLUSV()
3359 if (info->online != 1) isdn_tty_cmd_PLUSV()
3372 cmd.driver = info->isdn_driver; isdn_tty_cmd_PLUSV()
3374 cmd.arg = info->isdn_channel + (ISDN_AUDIO_SETDD << 8); isdn_tty_cmd_PLUSV()
3383 info); isdn_tty_cmd_PLUSV()
3403 isdn_tty_parse_at(modem_info *info) isdn_tty_parse_at() argument
3405 atemu *m = &info->emu; isdn_tty_parse_at()
3420 isdn_tty_cmd_ATA(info); isdn_tty_parse_at()
3424 if (info->msr & UART_MSR_DCD) isdn_tty_parse_at()
3426 if (info->msr & UART_MSR_RI) { isdn_tty_parse_at()
3427 isdn_tty_modem_result(RESULT_NO_CARRIER, info); isdn_tty_parse_at()
3433 isdn_tty_modem_result(RESULT_NO_MSN_EAZ, info); isdn_tty_parse_at()
3435 isdn_tty_dial(ds, info, m); isdn_tty_parse_at()
3459 isdn_tty_on_hook(info); isdn_tty_parse_at()
3466 isdn_tty_on_hook(info); isdn_tty_parse_at()
3473 isdn_tty_at_cout("\r\nLinux ISDN", info); isdn_tty_parse_at()
3481 isdn_tty_report(info); isdn_tty_parse_at()
3485 snprintf(ds, sizeof(ds), "\r\n%d", info->emu.charge); isdn_tty_parse_at()
3486 isdn_tty_at_cout(ds, info); isdn_tty_parse_at()
3503 if (info->msr & UART_MSR_DCD) isdn_tty_parse_at()
3505 isdn_tty_modem_result((m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) ? RESULT_CONNECT : RESULT_CONNECT64000, info); isdn_tty_parse_at()
3507 isdn_tty_modem_result(RESULT_NO_CARRIER, info); isdn_tty_parse_at()
3526 if (isdn_tty_cmd_ATS(&p, info)) isdn_tty_parse_at()
3546 if (info->msr & UART_MSR_DCD) { isdn_tty_parse_at()
3547 info->online = 0; isdn_tty_parse_at()
3548 isdn_tty_on_hook(info); isdn_tty_parse_at()
3550 isdn_tty_modem_reset_regs(info, 1); isdn_tty_parse_at()
3558 if (isdn_tty_cmd_PLUSF(&p, info)) isdn_tty_parse_at()
3566 if (isdn_tty_cmd_PLUSV(&p, info)) isdn_tty_parse_at()
3573 isdn_tty_suspend(ds, info, m); isdn_tty_parse_at()
3578 isdn_tty_resume(ds, info, m); isdn_tty_parse_at()
3582 isdn_tty_send_msg(info, m, p); isdn_tty_parse_at()
3590 if (isdn_tty_cmd_ATand(&p, info)) isdn_tty_parse_at()
3598 if (!info->vonline) isdn_tty_parse_at()
3600 isdn_tty_modem_result(RESULT_OK, info); isdn_tty_parse_at()
3617 isdn_tty_edit_at(const char *p, int count, modem_info *info) isdn_tty_edit_at() argument
3619 atemu *m = &info->emu; isdn_tty_edit_at()
3634 isdn_tty_at_cout(eb, info); isdn_tty_edit_at()
3637 isdn_tty_parse_at(info); isdn_tty_edit_at()
3647 isdn_tty_at_cout("\b", info); isdn_tty_edit_at()
3655 isdn_tty_at_cout(eb, info); isdn_tty_edit_at()
3699 modem_info *info = &dev->mdm.info[midx]; isdn_tty_modem_escape() local
3700 if (info->online) { isdn_tty_modem_escape()
3702 if ((info->emu.pluscount == 3) && isdn_tty_modem_escape()
3704 info->emu.lastplus + PLUSWAIT2)) { isdn_tty_modem_escape()
3705 info->emu.pluscount = 0; isdn_tty_modem_escape()
3706 info->online = 0; isdn_tty_modem_escape()
3707 isdn_tty_modem_result(RESULT_OK, info); isdn_tty_modem_escape()
3726 modem_info *info = &dev->mdm.info[i]; isdn_tty_modem_ring() local
3727 if (info->msr & UART_MSR_RI) { isdn_tty_modem_ring()
3729 isdn_tty_modem_result(RESULT_RING, info); isdn_tty_modem_ring()
3746 modem_info *info = &dev->mdm.info[i]; isdn_tty_modem_xmit() local
3747 if (info->online) { isdn_tty_modem_xmit()
3749 isdn_tty_senddown(info); isdn_tty_modem_xmit()
3750 isdn_tty_tint(info); isdn_tty_modem_xmit()
3767 modem_info *info = &dev->mdm.info[i]; isdn_tty_carrier_timeout() local
3768 if (!info->dialing) isdn_tty_carrier_timeout()
3770 if (info->emu.carrierwait++ > info->emu.mdmreg[REG_WAITC]) { isdn_tty_carrier_timeout()
3771 info->dialing = 0; isdn_tty_carrier_timeout()
3772 isdn_tty_modem_result(RESULT_NO_CARRIER, info); isdn_tty_carrier_timeout()
3773 isdn_tty_modem_hup(info, 1); isdn_tty_carrier_timeout()
H A Disdn_ttyfax.c25 #define PARSE_ERROR1 { isdn_tty_fax_modem_result(1, info); return 1; }
48 isdn_tty_fax_modem_result(int code, modem_info *info) isdn_tty_fax_modem_result() argument
50 atemu *m = &info->emu; isdn_tty_fax_modem_result()
51 T30_s *f = info->fax; isdn_tty_fax_modem_result()
62 isdn_tty_at_cout("\r\n", info); isdn_tty_fax_modem_result()
63 isdn_tty_at_cout(msg[code], info); isdn_tty_fax_modem_result()
67 msg[code], info->line); isdn_tty_fax_modem_result()
77 (!(dev->usage[info->isdn_channel] & ISDN_USAGE_OUTGOING))) { isdn_tty_fax_modem_result()
79 isdn_tty_at_cout(rs, info); isdn_tty_fax_modem_result()
81 info->online = 1; isdn_tty_fax_modem_result()
89 isdn_tty_at_cout(rs, info); isdn_tty_fax_modem_result()
99 isdn_tty_at_cout(rs, info); isdn_tty_fax_modem_result()
102 rs, info->line); isdn_tty_fax_modem_result()
107 isdn_tty_at_cout(rs, info); isdn_tty_fax_modem_result()
108 info->faxonline = 0; isdn_tty_fax_modem_result()
118 isdn_tty_at_cout(rs, info); isdn_tty_fax_modem_result()
121 rs, info->line); isdn_tty_fax_modem_result()
125 info->faxonline |= 2; isdn_tty_fax_modem_result()
130 isdn_tty_at_cout("1", info); isdn_tty_fax_modem_result()
134 isdn_tty_at_cout(rs, info); isdn_tty_fax_modem_result()
138 isdn_tty_at_cout("\r\n", info); isdn_tty_fax_modem_result()
142 info->online = 2; isdn_tty_fax_modem_result()
143 if (info->faxonline & 1) { isdn_tty_fax_modem_result()
145 isdn_tty_at_cout(rs, info); isdn_tty_fax_modem_result()
152 isdn_tty_fax_command1(modem_info *info, isdn_ctrl *c) isdn_tty_fax_command1() argument
161 if (info->online) isdn_tty_fax_command1()
162 info->online = 1; isdn_tty_fax_command1()
163 isdn_tty_at_cout("\r\n", info); isdn_tty_fax_command1()
164 isdn_tty_at_cout(msg[c->parm.aux.cmd], info); isdn_tty_fax_command1()
165 isdn_tty_at_cout("\r\n", info); isdn_tty_fax_command1()
169 info->online = 2; isdn_tty_fax_command1()
177 isdn_tty_at_cout("\r\n", info); isdn_tty_fax_command1()
179 isdn_tty_at_cout(msg[ISDN_FAX_CLASS1_ERROR], info); isdn_tty_fax_command1()
180 isdn_tty_at_cout("\r\n", info); isdn_tty_fax_command1()
182 isdn_tty_at_cout(c->parm.aux.para, info); isdn_tty_fax_command1()
183 isdn_tty_at_cout("\r\nOK\r\n", info); isdn_tty_fax_command1()
191 isdn_tty_fax_command(modem_info *info, isdn_ctrl *c) isdn_tty_fax_command() argument
193 T30_s *f = info->fax; isdn_tty_fax_command()
196 if (TTY_IS_FCLASS1(info)) isdn_tty_fax_command()
197 return (isdn_tty_fax_command1(info, c)); isdn_tty_fax_command()
201 f->r_code, info->line); isdn_tty_fax_command()
205 info->faxonline = 1; isdn_tty_fax_command()
206 isdn_tty_fax_modem_result(2, info); /* +FCON */ isdn_tty_fax_command()
209 info->faxonline = 16; isdn_tty_fax_command()
210 isdn_tty_fax_modem_result(2, info); /* +FCON */ isdn_tty_fax_command()
213 if (info->faxonline & 1) isdn_tty_fax_command()
214 isdn_tty_fax_modem_result(3, info); /* +FCSI */ isdn_tty_fax_command()
215 if (info->faxonline & 16) isdn_tty_fax_command()
216 isdn_tty_fax_modem_result(8, info); /* +FTSI */ isdn_tty_fax_command()
219 isdn_tty_fax_modem_result(4, info); /* +FDIS */ isdn_tty_fax_command()
225 isdn_tty_at_cout(rs, info); isdn_tty_fax_command()
228 isdn_tty_at_cout(rs, info); isdn_tty_fax_command()
230 info->faxonline &= ~2; /* leave data mode */ isdn_tty_fax_command()
231 info->online = 1; isdn_tty_fax_command()
234 isdn_tty_fax_modem_result(5, info); /* +FHNG */ isdn_tty_fax_command()
235 isdn_tty_fax_modem_result(0, info); /* OK */ isdn_tty_fax_command()
238 isdn_tty_fax_modem_result(6, info); /* +FDCS */ isdn_tty_fax_command()
239 isdn_tty_fax_modem_result(7, info); /* CONNECT */ isdn_tty_fax_command()
243 isdn_tty_fax_modem_result(6, info); /* +FDCS */ isdn_tty_fax_command()
244 isdn_tty_fax_modem_result(0, info); /* OK */ isdn_tty_fax_command()
247 isdn_tty_fax_modem_result(0, info); /* OK */ isdn_tty_fax_command()
250 isdn_tty_fax_modem_result(9, info); /* +FCFR */ isdn_tty_fax_command()
254 isdn_tty_at_cout(rs, info); isdn_tty_fax_command()
255 isdn_tty_fax_modem_result(10, info); /* +FPTS */ isdn_tty_fax_command()
256 isdn_tty_fax_modem_result(11, info); /* +FET */ isdn_tty_fax_command()
257 isdn_tty_fax_modem_result(0, info); /* OK */ isdn_tty_fax_command()
258 info->faxonline &= ~2; /* leave data mode */ isdn_tty_fax_command()
259 info->online = 1; isdn_tty_fax_command()
263 isdn_tty_fax_modem_result(10, info); /* +FPTS */ isdn_tty_fax_command()
268 isdn_tty_fax_modem_result(0, info); /* OK */ isdn_tty_fax_command()
272 info->faxonline &= ~2; /* leave data mode */ isdn_tty_fax_command()
273 info->online = 1; isdn_tty_fax_command()
283 isdn_tty_fax_bitorder(modem_info *info, struct sk_buff *skb) isdn_tty_fax_bitorder() argument
291 if (!info->fax->bor) { isdn_tty_fax_bitorder()
320 isdn_tty_cmd_FCLASS1(char **p, modem_info *info) isdn_tty_cmd_FCLASS1() argument
368 if (info->isdn_driver < 0) { isdn_tty_cmd_FCLASS1()
381 info->isdn_driver = dev->drvmap[i]; isdn_tty_cmd_FCLASS1()
382 info->isdn_channel = dev->chanmap[i]; isdn_tty_cmd_FCLASS1()
383 info->drv_index = i; isdn_tty_cmd_FCLASS1()
384 dev->m_idx[i] = info->line; isdn_tty_cmd_FCLASS1()
386 c.driver = info->isdn_driver; isdn_tty_cmd_FCLASS1()
387 c.arg = info->isdn_channel; isdn_tty_cmd_FCLASS1()
390 isdn_free_channel(info->isdn_driver, info->isdn_channel, isdn_tty_cmd_FCLASS1()
392 info->isdn_driver = -1; isdn_tty_cmd_FCLASS1()
393 info->isdn_channel = -1; isdn_tty_cmd_FCLASS1()
394 if (info->drv_index >= 0) { isdn_tty_cmd_FCLASS1()
395 dev->m_idx[info->drv_index] = -1; isdn_tty_cmd_FCLASS1()
396 info->drv_index = -1; isdn_tty_cmd_FCLASS1()
400 c.driver = info->isdn_driver; isdn_tty_cmd_FCLASS1()
401 c.arg = info->isdn_channel; isdn_tty_cmd_FCLASS1()
412 isdn_tty_cmd_FCLASS2(char **p, modem_info *info) isdn_tty_cmd_FCLASS2() argument
414 atemu *m = &info->emu; isdn_tty_cmd_FCLASS2()
415 T30_s *f = info->fax; isdn_tty_cmd_FCLASS2()
430 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
450 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
457 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
480 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
487 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
510 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
517 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
540 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
547 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
571 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
582 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
589 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
619 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
626 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
649 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
656 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
679 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
686 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
717 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
722 isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info); isdn_tty_cmd_FCLASS2()
763 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
768 isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info); isdn_tty_cmd_FCLASS2()
797 if ((info->faxonline & 16) && /* incoming connection */ isdn_tty_cmd_FCLASS2()
803 cmd.driver = info->isdn_driver; isdn_tty_cmd_FCLASS2()
804 cmd.arg = info->isdn_channel; isdn_tty_cmd_FCLASS2()
813 isdn_tty_fax_modem_result(7, info); /* CONNECT */ isdn_tty_cmd_FCLASS2()
837 if (!(info->faxonline & 1)) /* not outgoing connection */ isdn_tty_cmd_FCLASS2()
858 cmd.driver = info->isdn_driver; isdn_tty_cmd_FCLASS2()
859 cmd.arg = info->isdn_channel; isdn_tty_cmd_FCLASS2()
864 isdn_tty_fax_modem_result(7, info); /* CONNECT */ isdn_tty_cmd_FCLASS2()
878 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
885 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
907 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
910 (!(info->faxonline & 1))) isdn_tty_cmd_FCLASS2()
917 cmd.driver = info->isdn_driver; isdn_tty_cmd_FCLASS2()
918 cmd.arg = info->isdn_channel; isdn_tty_cmd_FCLASS2()
933 isdn_tty_modem_hup(info, 1); isdn_tty_cmd_FCLASS2()
944 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
951 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
981 isdn_tty_at_cout("\r\nisdn4linux", info); isdn_tty_cmd_FCLASS2()
990 isdn_tty_at_cout("\r\nisdn4linux", info); isdn_tty_cmd_FCLASS2()
1000 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
1007 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
1030 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
1037 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
1061 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
1068 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
1092 isdn_tty_at_cout(rs, info); isdn_tty_cmd_FCLASS2()
1116 isdn_tty_cmd_PLUSF_FAX(char **p, modem_info *info) isdn_tty_cmd_PLUSF_FAX() argument
1118 if (TTY_IS_FCLASS2(info)) isdn_tty_cmd_PLUSF_FAX()
1119 return (isdn_tty_cmd_FCLASS2(p, info)); isdn_tty_cmd_PLUSF_FAX()
1120 else if (TTY_IS_FCLASS1(info)) isdn_tty_cmd_PLUSF_FAX()
1121 return (isdn_tty_cmd_FCLASS1(p, info)); isdn_tty_cmd_PLUSF_FAX()
/linux-4.4.14/drivers/gpu/drm/nouveau/nvkm/subdev/bios/
H A Dpll.c223 nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info) nvbios_pll_parse() argument
241 memset(info, 0, sizeof(*info)); nvbios_pll_parse()
242 info->type = type; nvbios_pll_parse()
243 info->reg = reg; nvbios_pll_parse()
250 info->vco1.min_freq = nvbios_rd32(bios, data + 0); nvbios_pll_parse()
251 info->vco1.max_freq = nvbios_rd32(bios, data + 4); nvbios_pll_parse()
252 info->vco2.min_freq = nvbios_rd32(bios, data + 8); nvbios_pll_parse()
253 info->vco2.max_freq = nvbios_rd32(bios, data + 12); nvbios_pll_parse()
254 info->vco1.min_inputfreq = nvbios_rd32(bios, data + 16); nvbios_pll_parse()
255 info->vco2.min_inputfreq = nvbios_rd32(bios, data + 20); nvbios_pll_parse()
256 info->vco1.max_inputfreq = INT_MAX; nvbios_pll_parse()
257 info->vco2.max_inputfreq = INT_MAX; nvbios_pll_parse()
259 info->max_p = 0x7; nvbios_pll_parse()
260 info->max_p_usable = 0x6; nvbios_pll_parse()
265 info->vco1.min_n = 0x5; nvbios_pll_parse()
268 info->vco1.min_n = 0x1; nvbios_pll_parse()
271 info->vco1.max_n = 0xff; nvbios_pll_parse()
272 info->vco1.min_m = 0x1; nvbios_pll_parse()
273 info->vco1.max_m = 0xd; nvbios_pll_parse()
281 info->vco2.min_n = 0x4; nvbios_pll_parse()
285 info->vco2.max_n = 0x1f; nvbios_pll_parse()
288 info->vco2.max_n = 0x28; nvbios_pll_parse()
291 info->vco2.min_m = 0x1; nvbios_pll_parse()
292 info->vco2.max_m = 0x4; nvbios_pll_parse()
296 info->vco1.min_freq = nvbios_rd16(bios, data + 4) * 1000; nvbios_pll_parse()
297 info->vco1.max_freq = nvbios_rd16(bios, data + 6) * 1000; nvbios_pll_parse()
298 info->vco2.min_freq = nvbios_rd16(bios, data + 8) * 1000; nvbios_pll_parse()
299 info->vco2.max_freq = nvbios_rd16(bios, data + 10) * 1000; nvbios_pll_parse()
300 info->vco1.min_inputfreq = nvbios_rd16(bios, data + 12) * 1000; nvbios_pll_parse()
301 info->vco2.min_inputfreq = nvbios_rd16(bios, data + 14) * 1000; nvbios_pll_parse()
302 info->vco1.max_inputfreq = nvbios_rd16(bios, data + 16) * 1000; nvbios_pll_parse()
303 info->vco2.max_inputfreq = nvbios_rd16(bios, data + 18) * 1000; nvbios_pll_parse()
304 info->vco1.min_n = nvbios_rd08(bios, data + 20); nvbios_pll_parse()
305 info->vco1.max_n = nvbios_rd08(bios, data + 21); nvbios_pll_parse()
306 info->vco1.min_m = nvbios_rd08(bios, data + 22); nvbios_pll_parse()
307 info->vco1.max_m = nvbios_rd08(bios, data + 23); nvbios_pll_parse()
308 info->vco2.min_n = nvbios_rd08(bios, data + 24); nvbios_pll_parse()
309 info->vco2.max_n = nvbios_rd08(bios, data + 25); nvbios_pll_parse()
310 info->vco2.min_m = nvbios_rd08(bios, data + 26); nvbios_pll_parse()
311 info->vco2.max_m = nvbios_rd08(bios, data + 27); nvbios_pll_parse()
313 info->max_p = nvbios_rd08(bios, data + 29); nvbios_pll_parse()
314 info->max_p_usable = info->max_p; nvbios_pll_parse()
316 info->max_p_usable = 0x6; nvbios_pll_parse()
317 info->bias_p = nvbios_rd08(bios, data + 30); nvbios_pll_parse()
320 info->refclk = nvbios_rd32(bios, data + 31); nvbios_pll_parse()
325 info->vco1.min_freq = nvbios_rd16(bios, data + 0) * 1000; nvbios_pll_parse()
326 info->vco1.max_freq = nvbios_rd16(bios, data + 2) * 1000; nvbios_pll_parse()
327 info->vco2.min_freq = nvbios_rd16(bios, data + 4) * 1000; nvbios_pll_parse()
328 info->vco2.max_freq = nvbios_rd16(bios, data + 6) * 1000; nvbios_pll_parse()
329 info->vco1.min_inputfreq = nvbios_rd16(bios, data + 8) * 1000; nvbios_pll_parse()
330 info->vco2.min_inputfreq = nvbios_rd16(bios, data + 10) * 1000; nvbios_pll_parse()
331 info->vco1.max_inputfreq = nvbios_rd16(bios, data + 12) * 1000; nvbios_pll_parse()
332 info->vco2.max_inputfreq = nvbios_rd16(bios, data + 14) * 1000; nvbios_pll_parse()
333 info->vco1.min_n = nvbios_rd08(bios, data + 16); nvbios_pll_parse()
334 info->vco1.max_n = nvbios_rd08(bios, data + 17); nvbios_pll_parse()
335 info->vco1.min_m = nvbios_rd08(bios, data + 18); nvbios_pll_parse()
336 info->vco1.max_m = nvbios_rd08(bios, data + 19); nvbios_pll_parse()
337 info->vco2.min_n = nvbios_rd08(bios, data + 20); nvbios_pll_parse()
338 info->vco2.max_n = nvbios_rd08(bios, data + 21); nvbios_pll_parse()
339 info->vco2.min_m = nvbios_rd08(bios, data + 22); nvbios_pll_parse()
340 info->vco2.max_m = nvbios_rd08(bios, data + 23); nvbios_pll_parse()
341 info->max_p_usable = info->max_p = nvbios_rd08(bios, data + 25); nvbios_pll_parse()
342 info->bias_p = nvbios_rd08(bios, data + 27); nvbios_pll_parse()
343 info->refclk = nvbios_rd32(bios, data + 28); nvbios_pll_parse()
346 info->refclk = nvbios_rd16(bios, data + 9) * 1000; nvbios_pll_parse()
349 info->vco1.min_freq = nvbios_rd16(bios, data + 0) * 1000; nvbios_pll_parse()
350 info->vco1.max_freq = nvbios_rd16(bios, data + 2) * 1000; nvbios_pll_parse()
351 info->vco1.min_inputfreq = nvbios_rd16(bios, data + 4) * 1000; nvbios_pll_parse()
352 info->vco1.max_inputfreq = nvbios_rd16(bios, data + 6) * 1000; nvbios_pll_parse()
353 info->vco1.min_m = nvbios_rd08(bios, data + 8); nvbios_pll_parse()
354 info->vco1.max_m = nvbios_rd08(bios, data + 9); nvbios_pll_parse()
355 info->vco1.min_n = nvbios_rd08(bios, data + 10); nvbios_pll_parse()
356 info->vco1.max_n = nvbios_rd08(bios, data + 11); nvbios_pll_parse()
357 info->min_p = nvbios_rd08(bios, data + 12); nvbios_pll_parse()
358 info->max_p = nvbios_rd08(bios, data + 13); nvbios_pll_parse()
365 if (!info->refclk) { nvbios_pll_parse()
366 info->refclk = device->crystal; nvbios_pll_parse()
369 if ((info->reg == 0x680508 && sel_clk & 0x20) || nvbios_pll_parse()
370 (info->reg == 0x680520 && sel_clk & 0x80)) { nvbios_pll_parse()
372 info->refclk = 200000; nvbios_pll_parse()
374 info->refclk = 25000; nvbios_pll_parse()
384 if (!info->vco1.max_freq) { nvbios_pll_parse()
385 info->vco1.max_freq = nvbios_rd32(bios, bios->bmp_offset + 67); nvbios_pll_parse()
386 info->vco1.min_freq = nvbios_rd32(bios, bios->bmp_offset + 71); nvbios_pll_parse()
388 info->vco1.max_freq = 256000; nvbios_pll_parse()
389 info->vco1.min_freq = 128000; nvbios_pll_parse()
392 info->vco1.min_inputfreq = 0; nvbios_pll_parse()
393 info->vco1.max_inputfreq = INT_MAX; nvbios_pll_parse()
394 info->vco1.min_n = 0x1; nvbios_pll_parse()
395 info->vco1.max_n = 0xff; nvbios_pll_parse()
396 info->vco1.min_m = 0x1; nvbios_pll_parse()
401 info->vco1.min_m = 0x7; nvbios_pll_parse()
402 info->vco1.max_m = 0xd; nvbios_pll_parse()
405 info->vco1.min_m = 0x8; nvbios_pll_parse()
406 info->vco1.max_m = 0xe; nvbios_pll_parse()
412 info->max_p = 4; nvbios_pll_parse()
414 info->max_p = 5; nvbios_pll_parse()
415 info->max_p_usable = info->max_p; nvbios_pll_parse()
H A Di2c.c71 dcb_i2c_parse(struct nvkm_bios *bios, u8 idx, struct dcb_i2c_entry *info) dcb_i2c_parse() argument
83 info->type = DCB_I2C_UNUSED; dcb_i2c_parse()
85 info->type = DCB_I2C_PMGR; dcb_i2c_parse()
88 info->type = nvbios_rd08(bios, ent + 0x03); dcb_i2c_parse()
90 info->type = nvbios_rd08(bios, ent + 0x03) & 0x07; dcb_i2c_parse()
91 if (info->type == 0x07) dcb_i2c_parse()
92 info->type = DCB_I2C_UNUSED; dcb_i2c_parse()
95 info->drive = DCB_I2C_UNUSED; dcb_i2c_parse()
96 info->sense = DCB_I2C_UNUSED; dcb_i2c_parse()
97 info->share = DCB_I2C_UNUSED; dcb_i2c_parse()
98 info->auxch = DCB_I2C_UNUSED; dcb_i2c_parse()
100 switch (info->type) { dcb_i2c_parse()
102 info->drive = nvbios_rd08(bios, ent + 0); dcb_i2c_parse()
103 info->sense = nvbios_rd08(bios, ent + 1); dcb_i2c_parse()
106 info->drive = nvbios_rd08(bios, ent + 1); dcb_i2c_parse()
109 info->drive = nvbios_rd08(bios, ent + 0) & 0x0f; dcb_i2c_parse()
111 info->share = nvbios_rd08(bios, ent + 1) >> 1; dcb_i2c_parse()
114 info->auxch = nvbios_rd08(bios, ent + 0) & 0x0f; dcb_i2c_parse()
116 info->share = info->auxch; dcb_i2c_parse()
119 info->drive = (nvbios_rd16(bios, ent + 0) & 0x01f) >> 0; dcb_i2c_parse()
120 if (info->drive == 0x1f) dcb_i2c_parse()
121 info->drive = DCB_I2C_UNUSED; dcb_i2c_parse()
122 info->auxch = (nvbios_rd16(bios, ent + 0) & 0x3e0) >> 5; dcb_i2c_parse()
123 if (info->auxch == 0x1f) dcb_i2c_parse()
124 info->auxch = DCB_I2C_UNUSED; dcb_i2c_parse()
125 info->share = info->auxch; dcb_i2c_parse()
130 nvkm_warn(subdev, "unknown i2c type %d\n", info->type); dcb_i2c_parse()
131 info->type = DCB_I2C_UNUSED; dcb_i2c_parse()
137 /* BMP (from v4.0 has i2c info in the structure, it's in a dcb_i2c_parse()
146 info->drive = nvbios_rd08(bios, ent + 4); dcb_i2c_parse()
147 if (!info->drive) info->drive = 0x3f; dcb_i2c_parse()
148 info->sense = nvbios_rd08(bios, ent + 5); dcb_i2c_parse()
149 if (!info->sense) info->sense = 0x3e; dcb_i2c_parse()
152 info->drive = nvbios_rd08(bios, ent + 6); dcb_i2c_parse()
153 if (!info->drive) info->drive = 0x37; dcb_i2c_parse()
154 info->sense = nvbios_rd08(bios, ent + 7); dcb_i2c_parse()
155 if (!info->sense) info->sense = 0x36; dcb_i2c_parse()
158 info->type = DCB_I2C_NV04_BIT; dcb_i2c_parse()
159 info->share = DCB_I2C_UNUSED; dcb_i2c_parse()
H A Dvolt.c70 struct nvbios_volt *info) nvbios_volt_parse()
73 memset(info, 0x00, sizeof(*info)); nvbios_volt_parse()
76 info->type = NVBIOS_VOLT_GPIO; nvbios_volt_parse()
77 info->vidmask = nvbios_rd08(bios, volt + 0x04); nvbios_volt_parse()
80 info->type = NVBIOS_VOLT_GPIO; nvbios_volt_parse()
81 info->vidmask = nvbios_rd08(bios, volt + 0x05); nvbios_volt_parse()
84 info->type = NVBIOS_VOLT_GPIO; nvbios_volt_parse()
85 info->vidmask = nvbios_rd08(bios, volt + 0x04); nvbios_volt_parse()
88 info->type = NVBIOS_VOLT_GPIO; nvbios_volt_parse()
89 info->base = nvbios_rd32(bios, volt + 0x04); nvbios_volt_parse()
90 info->step = nvbios_rd16(bios, volt + 0x08); nvbios_volt_parse()
91 info->vidmask = nvbios_rd08(bios, volt + 0x0b); nvbios_volt_parse()
93 info->min = 0; nvbios_volt_parse()
94 info->max = info->base; nvbios_volt_parse()
97 info->min = nvbios_rd32(bios, volt + 0x0a); nvbios_volt_parse()
98 info->max = nvbios_rd32(bios, volt + 0x0e); nvbios_volt_parse()
99 info->base = nvbios_rd32(bios, volt + 0x12) & 0x00ffffff; nvbios_volt_parse()
103 info->type = NVBIOS_VOLT_PWM; nvbios_volt_parse()
104 info->pwm_freq = nvbios_rd32(bios, volt + 0x5) / 1000; nvbios_volt_parse()
105 info->pwm_range = nvbios_rd32(bios, volt + 0x16); nvbios_volt_parse()
107 info->type = NVBIOS_VOLT_GPIO; nvbios_volt_parse()
108 info->vidmask = nvbios_rd08(bios, volt + 0x06); nvbios_volt_parse()
109 info->step = nvbios_rd16(bios, volt + 0x16); nvbios_volt_parse()
130 struct nvbios_volt_entry *info) nvbios_volt_entry_parse()
133 memset(info, 0x00, sizeof(*info)); nvbios_volt_entry_parse()
137 info->voltage = nvbios_rd08(bios, volt + 0x00) * 10000; nvbios_volt_entry_parse()
138 info->vid = nvbios_rd08(bios, volt + 0x01); nvbios_volt_entry_parse()
141 info->voltage = nvbios_rd08(bios, volt + 0x00) * 10000; nvbios_volt_entry_parse()
142 info->vid = nvbios_rd08(bios, volt + 0x01) >> 2; nvbios_volt_entry_parse()
69 nvbios_volt_parse(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_volt *info) nvbios_volt_parse() argument
129 nvbios_volt_entry_parse(struct nvkm_bios *bios, int idx, u8 *ver, u8 *len, struct nvbios_volt_entry *info) nvbios_volt_entry_parse() argument
H A Dvmap.c58 struct nvbios_vmap *info) nvbios_vmap_parse()
61 memset(info, 0x00, sizeof(*info)); nvbios_vmap_parse()
84 struct nvbios_vmap_entry *info) nvbios_vmap_entry_parse()
87 memset(info, 0x00, sizeof(*info)); nvbios_vmap_entry_parse()
90 info->link = 0xff; nvbios_vmap_entry_parse()
91 info->min = nvbios_rd32(bios, vmap + 0x00); nvbios_vmap_entry_parse()
92 info->max = nvbios_rd32(bios, vmap + 0x04); nvbios_vmap_entry_parse()
93 info->arg[0] = nvbios_rd32(bios, vmap + 0x08); nvbios_vmap_entry_parse()
94 info->arg[1] = nvbios_rd32(bios, vmap + 0x0c); nvbios_vmap_entry_parse()
95 info->arg[2] = nvbios_rd32(bios, vmap + 0x10); nvbios_vmap_entry_parse()
98 info->unk0 = nvbios_rd08(bios, vmap + 0x00); nvbios_vmap_entry_parse()
99 info->link = nvbios_rd08(bios, vmap + 0x01); nvbios_vmap_entry_parse()
100 info->min = nvbios_rd32(bios, vmap + 0x02); nvbios_vmap_entry_parse()
101 info->max = nvbios_rd32(bios, vmap + 0x06); nvbios_vmap_entry_parse()
102 info->arg[0] = nvbios_rd32(bios, vmap + 0x0a); nvbios_vmap_entry_parse()
103 info->arg[1] = nvbios_rd32(bios, vmap + 0x0e); nvbios_vmap_entry_parse()
104 info->arg[2] = nvbios_rd32(bios, vmap + 0x12); nvbios_vmap_entry_parse()
105 info->arg[3] = nvbios_rd32(bios, vmap + 0x16); nvbios_vmap_entry_parse()
106 info->arg[4] = nvbios_rd32(bios, vmap + 0x1a); nvbios_vmap_entry_parse()
107 info->arg[5] = nvbios_rd32(bios, vmap + 0x1e); nvbios_vmap_entry_parse()
57 nvbios_vmap_parse(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len, struct nvbios_vmap *info) nvbios_vmap_parse() argument
83 nvbios_vmap_entry_parse(struct nvkm_bios *bios, int idx, u8 *ver, u8 *len, struct nvbios_vmap_entry *info) nvbios_vmap_entry_parse() argument
/linux-4.4.14/drivers/gpu/drm/nouveau/nvkm/subdev/clk/
H A Dpllgt215.c30 gt215_pll_calc(struct nvkm_subdev *subdev, struct nvbios_pll *info, gt215_pll_calc() argument
36 *P = info->vco1.max_freq / freq; gt215_pll_calc()
37 if (*P > info->max_p) gt215_pll_calc()
38 *P = info->max_p; gt215_pll_calc()
39 if (*P < info->min_p) gt215_pll_calc()
40 *P = info->min_p; gt215_pll_calc()
42 lM = (info->refclk + info->vco1.max_inputfreq) / info->vco1.max_inputfreq; gt215_pll_calc()
43 lM = max(lM, (int)info->vco1.min_m); gt215_pll_calc()
44 hM = (info->refclk + info->vco1.min_inputfreq) / info->vco1.min_inputfreq; gt215_pll_calc()
45 hM = min(hM, (int)info->vco1.max_m); gt215_pll_calc()
50 N = tmp / info->refclk; gt215_pll_calc()
51 fN = tmp % info->refclk; gt215_pll_calc()
54 if (fN >= info->refclk / 2) gt215_pll_calc()
57 if (fN < info->refclk / 2) gt215_pll_calc()
59 fN = tmp - (N * info->refclk); gt215_pll_calc()
62 if (N < info->vco1.min_n) gt215_pll_calc()
64 if (N > info->vco1.max_n) gt215_pll_calc()
67 err = abs(freq - (info->refclk * N / M / *P)); gt215_pll_calc()
75 *pfN = ((fN << 13) + info->refclk / 2) / info->refclk; gt215_pll_calc()
86 return info->refclk * *pN / *pM / *P; gt215_pll_calc()
/linux-4.4.14/sound/soc/cirrus/
H A Dep93xx-i2s.c84 static inline void ep93xx_i2s_write_reg(struct ep93xx_i2s_info *info, ep93xx_i2s_write_reg() argument
87 __raw_writel(val, info->regs + reg); ep93xx_i2s_write_reg()
90 static inline unsigned ep93xx_i2s_read_reg(struct ep93xx_i2s_info *info, ep93xx_i2s_read_reg() argument
93 return __raw_readl(info->regs + reg); ep93xx_i2s_read_reg()
96 static void ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream) ep93xx_i2s_enable() argument
101 if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 && ep93xx_i2s_enable()
102 (ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) { ep93xx_i2s_enable()
104 clk_enable(info->mclk); ep93xx_i2s_enable()
105 clk_enable(info->sclk); ep93xx_i2s_enable()
106 clk_enable(info->lrclk); ep93xx_i2s_enable()
109 ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 1); ep93xx_i2s_enable()
118 ep93xx_i2s_write_reg(info, base_reg + (i * 4), 1); ep93xx_i2s_enable()
121 static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream) ep93xx_i2s_disable() argument
132 ep93xx_i2s_write_reg(info, base_reg + (i * 4), 0); ep93xx_i2s_disable()
134 if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 && ep93xx_i2s_disable()
135 (ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) { ep93xx_i2s_disable()
137 ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 0); ep93xx_i2s_disable()
140 clk_disable(info->lrclk); ep93xx_i2s_disable()
141 clk_disable(info->sclk); ep93xx_i2s_disable()
142 clk_disable(info->mclk); ep93xx_i2s_disable()
148 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); ep93xx_i2s_dai_probe() local
150 info->dma_params_tx.filter_data = ep93xx_i2s_dai_probe()
152 info->dma_params_rx.filter_data = ep93xx_i2s_dai_probe()
155 dai->playback_dma_data = &info->dma_params_tx; ep93xx_i2s_dai_probe()
156 dai->capture_dma_data = &info->dma_params_rx; ep93xx_i2s_dai_probe()
164 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); ep93xx_i2s_shutdown() local
166 ep93xx_i2s_disable(info, substream->stream); ep93xx_i2s_shutdown()
172 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai); ep93xx_i2s_set_dai_fmt() local
175 clk_cfg = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXCLKCFG); ep93xx_i2s_set_dai_fmt()
176 lin_ctrl = ep93xx_i2s_read_reg(info, EP93XX_I2S_RXLINCTRLDATA); ep93xx_i2s_set_dai_fmt()
238 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXCLKCFG, clk_cfg); ep93xx_i2s_set_dai_fmt()
239 ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCLKCFG, clk_cfg); ep93xx_i2s_set_dai_fmt()
240 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXLINCTRLDATA, lin_ctrl); ep93xx_i2s_set_dai_fmt()
241 ep93xx_i2s_write_reg(info, EP93XX_I2S_TXLINCTRLDATA, lin_ctrl); ep93xx_i2s_set_dai_fmt()
249 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); ep93xx_i2s_hw_params() local
271 ep93xx_i2s_write_reg(info, EP93XX_I2S_TXWRDLEN, word_len); ep93xx_i2s_hw_params()
273 ep93xx_i2s_write_reg(info, EP93XX_I2S_RXWRDLEN, word_len); ep93xx_i2s_hw_params()
283 div = clk_get_rate(info->mclk) / params_rate(params); ep93xx_i2s_hw_params()
293 err = clk_set_rate(info->sclk, clk_get_rate(info->mclk) / sdiv); ep93xx_i2s_hw_params()
297 err = clk_set_rate(info->lrclk, clk_get_rate(info->sclk) / lrdiv); ep93xx_i2s_hw_params()
301 ep93xx_i2s_enable(info, substream->stream); ep93xx_i2s_hw_params()
308 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(cpu_dai); ep93xx_i2s_set_sysclk() local
313 return clk_set_rate(info->mclk, freq); ep93xx_i2s_set_sysclk()
319 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); ep93xx_i2s_suspend() local
324 ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK); ep93xx_i2s_suspend()
325 ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_CAPTURE); ep93xx_i2s_suspend()
332 struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); ep93xx_i2s_resume() local
337 ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK); ep93xx_i2s_resume()
338 ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_CAPTURE); ep93xx_i2s_resume()
382 struct ep93xx_i2s_info *info; ep93xx_i2s_probe() local
386 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); ep93xx_i2s_probe()
387 if (!info) ep93xx_i2s_probe()
391 info->regs = devm_ioremap_resource(&pdev->dev, res); ep93xx_i2s_probe()
392 if (IS_ERR(info->regs)) ep93xx_i2s_probe()
393 return PTR_ERR(info->regs); ep93xx_i2s_probe()
395 info->mclk = clk_get(&pdev->dev, "mclk"); ep93xx_i2s_probe()
396 if (IS_ERR(info->mclk)) { ep93xx_i2s_probe()
397 err = PTR_ERR(info->mclk); ep93xx_i2s_probe()
401 info->sclk = clk_get(&pdev->dev, "sclk"); ep93xx_i2s_probe()
402 if (IS_ERR(info->sclk)) { ep93xx_i2s_probe()
403 err = PTR_ERR(info->sclk); ep93xx_i2s_probe()
407 info->lrclk = clk_get(&pdev->dev, "lrclk"); ep93xx_i2s_probe()
408 if (IS_ERR(info->lrclk)) { ep93xx_i2s_probe()
409 err = PTR_ERR(info->lrclk); ep93xx_i2s_probe()
413 dev_set_drvdata(&pdev->dev, info); ep93xx_i2s_probe()
429 clk_put(info->lrclk); ep93xx_i2s_probe()
431 clk_put(info->sclk); ep93xx_i2s_probe()
433 clk_put(info->mclk); ep93xx_i2s_probe()
440 struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev); ep93xx_i2s_remove() local
443 clk_put(info->lrclk); ep93xx_i2s_remove()
444 clk_put(info->sclk); ep93xx_i2s_remove()
445 clk_put(info->mclk); ep93xx_i2s_remove()
H A Dep93xx-ac97.c90 * struct ep93xx_ac97_info - EP93xx AC97 controller info structure
120 static inline unsigned ep93xx_ac97_read_reg(struct ep93xx_ac97_info *info, ep93xx_ac97_read_reg() argument
123 return __raw_readl(info->regs + reg); ep93xx_ac97_read_reg()
126 static inline void ep93xx_ac97_write_reg(struct ep93xx_ac97_info *info, ep93xx_ac97_write_reg() argument
129 __raw_writel(val, info->regs + reg); ep93xx_ac97_write_reg()
135 struct ep93xx_ac97_info *info = ep93xx_ac97_info; ep93xx_ac97_read() local
138 mutex_lock(&info->lock); ep93xx_ac97_read()
140 ep93xx_ac97_write_reg(info, AC97S1DATA, reg); ep93xx_ac97_read()
141 ep93xx_ac97_write_reg(info, AC97IM, AC97_SLOT2RXVALID); ep93xx_ac97_read()
142 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT)) { ep93xx_ac97_read()
143 dev_warn(info->dev, "timeout reading register %x\n", reg); ep93xx_ac97_read()
144 mutex_unlock(&info->lock); ep93xx_ac97_read()
147 val = (unsigned short)ep93xx_ac97_read_reg(info, AC97S2DATA); ep93xx_ac97_read()
149 mutex_unlock(&info->lock); ep93xx_ac97_read()
157 struct ep93xx_ac97_info *info = ep93xx_ac97_info; ep93xx_ac97_write() local
159 mutex_lock(&info->lock); ep93xx_ac97_write()
165 ep93xx_ac97_write_reg(info, AC97S2DATA, val); ep93xx_ac97_write()
166 ep93xx_ac97_write_reg(info, AC97S1DATA, reg); ep93xx_ac97_write()
168 ep93xx_ac97_write_reg(info, AC97IM, AC97_SLOT2TXCOMPLETE); ep93xx_ac97_write()
169 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT)) ep93xx_ac97_write()
170 dev_warn(info->dev, "timeout writing register %x\n", reg); ep93xx_ac97_write()
172 mutex_unlock(&info->lock); ep93xx_ac97_write()
177 struct ep93xx_ac97_info *info = ep93xx_ac97_info; ep93xx_ac97_warm_reset() local
179 mutex_lock(&info->lock); ep93xx_ac97_warm_reset()
187 ep93xx_ac97_write_reg(info, AC97SYNC, AC97SYNC_TIMEDSYNC); ep93xx_ac97_warm_reset()
188 ep93xx_ac97_write_reg(info, AC97IM, AC97_CODECREADY); ep93xx_ac97_warm_reset()
189 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT)) ep93xx_ac97_warm_reset()
190 dev_warn(info->dev, "codec warm reset timeout\n"); ep93xx_ac97_warm_reset()
192 mutex_unlock(&info->lock); ep93xx_ac97_warm_reset()
197 struct ep93xx_ac97_info *info = ep93xx_ac97_info; ep93xx_ac97_cold_reset() local
199 mutex_lock(&info->lock); ep93xx_ac97_cold_reset()
205 ep93xx_ac97_write_reg(info, AC97GCR, 0); ep93xx_ac97_cold_reset()
206 ep93xx_ac97_write_reg(info, AC97EOI, AC97EOI_CODECREADY | AC97EOI_WINT); ep93xx_ac97_cold_reset()
207 ep93xx_ac97_write_reg(info, AC97GCR, AC97GCR_AC97IFE); ep93xx_ac97_cold_reset()
212 ep93xx_ac97_write_reg(info, AC97RESET, AC97RESET_TIMEDRESET); ep93xx_ac97_cold_reset()
213 ep93xx_ac97_write_reg(info, AC97IM, AC97_CODECREADY); ep93xx_ac97_cold_reset()
214 if (!wait_for_completion_timeout(&info->done, AC97_TIMEOUT)) ep93xx_ac97_cold_reset()
215 dev_warn(info->dev, "codec cold reset timeout\n"); ep93xx_ac97_cold_reset()
223 mutex_unlock(&info->lock); ep93xx_ac97_cold_reset()
228 struct ep93xx_ac97_info *info = dev_id; ep93xx_ac97_interrupt() local
236 status = ep93xx_ac97_read_reg(info, AC97GIS); ep93xx_ac97_interrupt()
237 mask = ep93xx_ac97_read_reg(info, AC97IM); ep93xx_ac97_interrupt()
239 ep93xx_ac97_write_reg(info, AC97IM, mask); ep93xx_ac97_interrupt()
241 complete(&info->done); ep93xx_ac97_interrupt()
255 struct ep93xx_ac97_info *info = snd_soc_dai_get_drvdata(dai); ep93xx_ac97_trigger() local
270 ep93xx_ac97_write_reg(info, AC97TXCR(1), v); ep93xx_ac97_trigger()
279 ep93xx_ac97_write_reg(info, AC97RXCR(1), v); ep93xx_ac97_trigger()
298 v = ep93xx_ac97_read_reg(info, AC97SR(1)); ep93xx_ac97_trigger()
300 dev_warn(info->dev, "TX timeout\n"); ep93xx_ac97_trigger()
306 ep93xx_ac97_write_reg(info, AC97TXCR(1), 0); ep93xx_ac97_trigger()
309 ep93xx_ac97_write_reg(info, AC97RXCR(1), 0); ep93xx_ac97_trigger()
314 dev_warn(info->dev, "unknown command %d\n", cmd); ep93xx_ac97_trigger()
323 struct ep93xx_ac97_info *info = snd_soc_dai_get_drvdata(dai); ep93xx_ac97_dai_probe() local
325 info->dma_params_tx.filter_data = &ep93xx_ac97_pcm_out; ep93xx_ac97_dai_probe()
326 info->dma_params_rx.filter_data = &ep93xx_ac97_pcm_in; ep93xx_ac97_dai_probe()
328 dai->playback_dma_data = &info->dma_params_tx; ep93xx_ac97_dai_probe()
329 dai->capture_dma_data = &info->dma_params_rx; ep93xx_ac97_dai_probe()
366 struct ep93xx_ac97_info *info; ep93xx_ac97_probe() local
371 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); ep93xx_ac97_probe()
372 if (!info) ep93xx_ac97_probe()
376 info->regs = devm_ioremap_resource(&pdev->dev, res); ep93xx_ac97_probe()
377 if (IS_ERR(info->regs)) ep93xx_ac97_probe()
378 return PTR_ERR(info->regs); ep93xx_ac97_probe()
385 IRQF_TRIGGER_HIGH, pdev->name, info); ep93xx_ac97_probe()
389 dev_set_drvdata(&pdev->dev, info); ep93xx_ac97_probe()
391 mutex_init(&info->lock); ep93xx_ac97_probe()
392 init_completion(&info->done); ep93xx_ac97_probe()
393 info->dev = &pdev->dev; ep93xx_ac97_probe()
395 ep93xx_ac97_info = info; ep93xx_ac97_probe()
396 platform_set_drvdata(pdev, info); ep93xx_ac97_probe()
423 struct ep93xx_ac97_info *info = platform_get_drvdata(pdev); ep93xx_ac97_remove() local
428 ep93xx_ac97_write_reg(info, AC97GCR, 0); ep93xx_ac97_remove()
/linux-4.4.14/drivers/char/pcmcia/
H A Dsynclink_cs.c321 #define write_reg(info, reg, val) outb((val),(info)->io_base + (reg))
322 #define read_reg(info, reg) inb((info)->io_base + (reg))
324 #define read_reg16(info, reg) inw((info)->io_base + (reg))
325 #define write_reg16(info, reg, val) outw((val), (info)->io_base + (reg))
327 #define set_reg_bits(info, reg, mask) \
328 write_reg(info, (reg), \
329 (unsigned char) (read_reg(info, (reg)) | (mask)))
330 #define clear_reg_bits(info, reg, mask) \
331 write_reg(info, (reg), \
332 (unsigned char) (read_reg(info, (reg)) & ~(mask)))
336 static void irq_disable(MGSLPC_INFO *info, unsigned char channel, unsigned short mask) irq_disable() argument
339 info->imra_value |= mask; irq_disable()
340 write_reg16(info, CHA + IMR, info->imra_value); irq_disable()
342 info->imrb_value |= mask; irq_disable()
343 write_reg16(info, CHB + IMR, info->imrb_value); irq_disable()
346 static void irq_enable(MGSLPC_INFO *info, unsigned char channel, unsigned short mask) irq_enable() argument
349 info->imra_value &= ~mask; irq_enable()
350 write_reg16(info, CHA + IMR, info->imra_value); irq_enable()
352 info->imrb_value &= ~mask; irq_enable()
353 write_reg16(info, CHB + IMR, info->imrb_value); irq_enable()
357 #define port_irq_disable(info, mask) \
358 { info->pim_value |= (mask); write_reg(info, PIM, info->pim_value); }
360 #define port_irq_enable(info, mask) \
361 { info->pim_value &= ~(mask); write_reg(info, PIM, info->pim_value); }
363 static void rx_start(MGSLPC_INFO *info);
364 static void rx_stop(MGSLPC_INFO *info);
366 static void tx_start(MGSLPC_INFO *info, struct tty_struct *tty);
367 static void tx_stop(MGSLPC_INFO *info);
368 static void tx_set_idle(MGSLPC_INFO *info);
370 static void get_signals(MGSLPC_INFO *info);
371 static void set_signals(MGSLPC_INFO *info);
373 static void reset_device(MGSLPC_INFO *info);
375 static void hdlc_mode(MGSLPC_INFO *info);
376 static void async_mode(MGSLPC_INFO *info);
385 static void hdlcdev_tx_done(MGSLPC_INFO *info);
386 static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size);
387 static int hdlcdev_init(MGSLPC_INFO *info);
388 static void hdlcdev_exit(MGSLPC_INFO *info);
391 static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit);
393 static bool register_test(MGSLPC_INFO *info);
394 static bool irq_test(MGSLPC_INFO *info);
395 static int adapter_test(MGSLPC_INFO *info);
397 static int claim_resources(MGSLPC_INFO *info);
398 static void release_resources(MGSLPC_INFO *info);
399 static int mgslpc_add_device(MGSLPC_INFO *info);
400 static void mgslpc_remove_device(MGSLPC_INFO *info);
402 static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty);
403 static void rx_reset_buffers(MGSLPC_INFO *info);
404 static int rx_alloc_buffers(MGSLPC_INFO *info);
405 static void rx_free_buffers(MGSLPC_INFO *info);
413 static void bh_transmit(MGSLPC_INFO *info, struct tty_struct *tty);
414 static void bh_status(MGSLPC_INFO *info);
422 static int get_stats(MGSLPC_INFO *info, struct mgsl_icount __user *user_icount);
423 static int get_params(MGSLPC_INFO *info, MGSL_PARAMS __user *user_params);
424 static int set_params(MGSLPC_INFO *info, MGSL_PARAMS __user *new_params, struct tty_struct *tty);
425 static int get_txidle(MGSLPC_INFO *info, int __user *idle_mode);
426 static int set_txidle(MGSLPC_INFO *info, int idle_mode);
427 static int set_txenable(MGSLPC_INFO *info, int enable, struct tty_struct *tty);
428 static int tx_abort(MGSLPC_INFO *info);
429 static int set_rxenable(MGSLPC_INFO *info, int enable);
430 static int wait_events(MGSLPC_INFO *info, int __user *mask);
466 static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty);
516 MGSLPC_INFO *info; mgslpc_probe() local
522 info = kzalloc(sizeof(MGSLPC_INFO), GFP_KERNEL); mgslpc_probe()
523 if (!info) { mgslpc_probe()
528 info->magic = MGSLPC_MAGIC; mgslpc_probe()
529 tty_port_init(&info->port); mgslpc_probe()
530 info->port.ops = &mgslpc_port_ops; mgslpc_probe()
531 INIT_WORK(&info->task, bh_handler); mgslpc_probe()
532 info->max_frame_size = 4096; mgslpc_probe()
533 info->port.close_delay = 5*HZ/10; mgslpc_probe()
534 info->port.closing_wait = 30*HZ; mgslpc_probe()
535 init_waitqueue_head(&info->status_event_wait_q); mgslpc_probe()
536 init_waitqueue_head(&info->event_wait_q); mgslpc_probe()
537 spin_lock_init(&info->lock); mgslpc_probe()
538 spin_lock_init(&info->netlock); mgslpc_probe()
539 memcpy(&info->params,&default_params,sizeof(MGSL_PARAMS)); mgslpc_probe()
540 info->idle_mode = HDLC_TXIDLE_FLAGS; mgslpc_probe()
541 info->imra_value = 0xffff; mgslpc_probe()
542 info->imrb_value = 0xffff; mgslpc_probe()
543 info->pim_value = 0xff; mgslpc_probe()
545 info->p_dev = link; mgslpc_probe()
546 link->priv = info; mgslpc_probe()
554 ret = mgslpc_add_device(info); mgslpc_probe()
563 tty_port_destroy(&info->port); mgslpc_probe()
564 kfree(info); mgslpc_probe()
578 MGSLPC_INFO *info = link->priv; mgslpc_config() local
600 info->io_base = link->resource[0]->start; mgslpc_config()
601 info->irq_level = link->irq; mgslpc_config()
636 MGSLPC_INFO *info = link->priv; mgslpc_suspend() local
638 info->stop = 1; mgslpc_suspend()
645 MGSLPC_INFO *info = link->priv; mgslpc_resume() local
647 info->stop = 0; mgslpc_resume()
653 static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info, mgslpc_paranoia_check() argument
662 if (!info) { mgslpc_paranoia_check()
666 if (info->magic != MGSLPC_MAGIC) { mgslpc_paranoia_check()
671 if (!info) mgslpc_paranoia_check()
686 static bool wait_command_complete(MGSLPC_INFO *info, unsigned char channel) wait_command_complete() argument
690 while (read_reg(info, (unsigned char)(channel+STAR)) & BIT2) { wait_command_complete()
698 static void issue_command(MGSLPC_INFO *info, unsigned char channel, unsigned char cmd) issue_command() argument
700 wait_command_complete(info, channel); issue_command()
701 write_reg(info, (unsigned char) (channel + CMDR), cmd); issue_command()
706 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; tx_pause() local
709 if (mgslpc_paranoia_check(info, tty->name, "tx_pause")) tx_pause()
712 printk("tx_pause(%s)\n", info->device_name); tx_pause()
714 spin_lock_irqsave(&info->lock, flags); tx_pause()
715 if (info->tx_enabled) tx_pause()
716 tx_stop(info); tx_pause()
717 spin_unlock_irqrestore(&info->lock, flags); tx_pause()
722 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; tx_release() local
725 if (mgslpc_paranoia_check(info, tty->name, "tx_release")) tx_release()
728 printk("tx_release(%s)\n", info->device_name); tx_release()
730 spin_lock_irqsave(&info->lock, flags); tx_release()
731 if (!info->tx_enabled) tx_release()
732 tx_start(info, tty); tx_release()
733 spin_unlock_irqrestore(&info->lock, flags); tx_release()
739 static int bh_action(MGSLPC_INFO *info) bh_action() argument
744 spin_lock_irqsave(&info->lock, flags); bh_action()
746 if (info->pending_bh & BH_RECEIVE) { bh_action()
747 info->pending_bh &= ~BH_RECEIVE; bh_action()
749 } else if (info->pending_bh & BH_TRANSMIT) { bh_action()
750 info->pending_bh &= ~BH_TRANSMIT; bh_action()
752 } else if (info->pending_bh & BH_STATUS) { bh_action()
753 info->pending_bh &= ~BH_STATUS; bh_action()
759 info->bh_running = false; bh_action()
760 info->bh_requested = false; bh_action()
763 spin_unlock_irqrestore(&info->lock, flags); bh_action()
770 MGSLPC_INFO *info = container_of(work, MGSLPC_INFO, task); bh_handler() local
776 __FILE__,__LINE__,info->device_name); bh_handler()
778 info->bh_running = true; bh_handler()
779 tty = tty_port_tty_get(&info->port); bh_handler()
781 while((action = bh_action(info)) != 0) { bh_handler()
791 while(rx_get_frame(info, tty)); bh_handler()
794 bh_transmit(info, tty); bh_handler()
797 bh_status(info); bh_handler()
809 __FILE__,__LINE__,info->device_name); bh_handler()
812 static void bh_transmit(MGSLPC_INFO *info, struct tty_struct *tty) bh_transmit() argument
815 printk("bh_transmit() entry on %s\n", info->device_name); bh_transmit()
821 static void bh_status(MGSLPC_INFO *info) bh_status() argument
823 info->ri_chkcount = 0; bh_status()
824 info->dsr_chkcount = 0; bh_status()
825 info->dcd_chkcount = 0; bh_status()
826 info->cts_chkcount = 0; bh_status()
830 static void rx_ready_hdlc(MGSLPC_INFO *info, int eom) rx_ready_hdlc() argument
834 RXBUF *buf = (RXBUF*)(info->rx_buf + (info->rx_put * info->rx_buf_size)); rx_ready_hdlc()
839 if (!info->rx_enabled) rx_ready_hdlc()
842 if (info->rx_frame_count >= info->rx_buf_count) { rx_ready_hdlc()
844 issue_command(info, CHA, CMD_RXRESET); rx_ready_hdlc()
845 info->pending_bh |= BH_RECEIVE; rx_ready_hdlc()
846 info->rx_overflow = true; rx_ready_hdlc()
847 info->icount.buf_overrun++; rx_ready_hdlc()
853 fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f); rx_ready_hdlc()
862 data[0] = read_reg(info, CHA + RXFIFO); rx_ready_hdlc()
865 *((unsigned short *) data) = read_reg16(info, CHA + RXFIFO); rx_ready_hdlc()
872 if (buf->count >= info->max_frame_size) { rx_ready_hdlc()
874 issue_command(info, CHA, CMD_RXRESET); rx_ready_hdlc()
884 info->pending_bh |= BH_RECEIVE; rx_ready_hdlc()
885 info->rx_frame_count++; rx_ready_hdlc()
886 info->rx_put++; rx_ready_hdlc()
887 if (info->rx_put >= info->rx_buf_count) rx_ready_hdlc()
888 info->rx_put = 0; rx_ready_hdlc()
890 issue_command(info, CHA, CMD_RXFIFO); rx_ready_hdlc()
893 static void rx_ready_async(MGSLPC_INFO *info, int tcd) rx_ready_async() argument
895 struct tty_port *port = &info->port; rx_ready_async()
899 struct mgsl_icount *icount = &info->icount; rx_ready_async()
903 fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f); rx_ready_async()
908 if (!fifo_count && (read_reg(info,CHA+STAR) & BIT5)) rx_ready_async()
916 data = read_reg(info, CHA + RXFIFO); rx_ready_async()
917 status = read_reg(info, CHA + RXFIFO); rx_ready_async()
934 if (status & info->ignore_status_mask) rx_ready_async()
937 status &= info->read_status_mask; rx_ready_async()
946 issue_command(info, CHA, CMD_RXFIFO); rx_ready_async()
961 static void tx_done(MGSLPC_INFO *info, struct tty_struct *tty) tx_done() argument
963 if (!info->tx_active) tx_done()
966 info->tx_active = false; tx_done()
967 info->tx_aborting = false; tx_done()
969 if (info->params.mode == MGSL_MODE_ASYNC) tx_done()
972 info->tx_count = info->tx_put = info->tx_get = 0; tx_done()
973 del_timer(&info->tx_timer); tx_done()
975 if (info->drop_rts_on_tx_done) { tx_done()
976 get_signals(info); tx_done()
977 if (info->serial_signals & SerialSignal_RTS) { tx_done()
978 info->serial_signals &= ~SerialSignal_RTS; tx_done()
979 set_signals(info); tx_done()
981 info->drop_rts_on_tx_done = false; tx_done()
985 if (info->netcount) tx_done()
986 hdlcdev_tx_done(info); tx_done()
991 tx_stop(info); tx_done()
994 info->pending_bh |= BH_TRANSMIT; tx_done()
998 static void tx_ready(MGSLPC_INFO *info, struct tty_struct *tty) tx_ready() argument
1004 printk("%s(%d):tx_ready(%s)\n", __FILE__, __LINE__, info->device_name); tx_ready()
1006 if (info->params.mode == MGSL_MODE_HDLC) { tx_ready()
1007 if (!info->tx_active) tx_ready()
1011 tx_stop(info); tx_ready()
1014 if (!info->tx_count) tx_ready()
1015 info->tx_active = false; tx_ready()
1018 if (!info->tx_count) tx_ready()
1021 while (info->tx_count && fifo_count) { tx_ready()
1022 c = min(2, min_t(int, fifo_count, min(info->tx_count, TXBUFSIZE - info->tx_get))); tx_ready()
1025 write_reg(info, CHA + TXFIFO, *(info->tx_buf + info->tx_get)); tx_ready()
1027 write_reg16(info, CHA + TXFIFO, tx_ready()
1028 *((unsigned short*)(info->tx_buf + info->tx_get))); tx_ready()
1030 info->tx_count -= c; tx_ready()
1031 info->tx_get = (info->tx_get + c) & (TXBUFSIZE - 1); tx_ready()
1035 if (info->params.mode == MGSL_MODE_ASYNC) { tx_ready()
1036 if (info->tx_count < WAKEUP_CHARS) tx_ready()
1037 info->pending_bh |= BH_TRANSMIT; tx_ready()
1038 issue_command(info, CHA, CMD_TXFIFO); tx_ready()
1040 if (info->tx_count) tx_ready()
1041 issue_command(info, CHA, CMD_TXFIFO); tx_ready()
1043 issue_command(info, CHA, CMD_TXFIFO + CMD_TXEOM); tx_ready()
1047 static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty) cts_change() argument
1049 get_signals(info); cts_change()
1050 if ((info->cts_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) cts_change()
1051 irq_disable(info, CHB, IRQ_CTS); cts_change()
1052 info->icount.cts++; cts_change()
1053 if (info->serial_signals & SerialSignal_CTS) cts_change()
1054 info->input_signal_events.cts_up++; cts_change()
1056 info->input_signal_events.cts_down++; cts_change()
1057 wake_up_interruptible(&info->status_event_wait_q); cts_change()
1058 wake_up_interruptible(&info->event_wait_q); cts_change()
1060 if (tty && tty_port_cts_enabled(&info->port)) { cts_change()
1062 if (info->serial_signals & SerialSignal_CTS) { cts_change()
1066 tx_start(info, tty); cts_change()
1067 info->pending_bh |= BH_TRANSMIT; cts_change()
1071 if (!(info->serial_signals & SerialSignal_CTS)) { cts_change()
1075 tx_stop(info); cts_change()
1079 info->pending_bh |= BH_STATUS; cts_change()
1082 static void dcd_change(MGSLPC_INFO *info, struct tty_struct *tty) dcd_change() argument
1084 get_signals(info); dcd_change()
1085 if ((info->dcd_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) dcd_change()
1086 irq_disable(info, CHB, IRQ_DCD); dcd_change()
1087 info->icount.dcd++; dcd_change()
1088 if (info->serial_signals & SerialSignal_DCD) { dcd_change()
1089 info->input_signal_events.dcd_up++; dcd_change()
1092 info->input_signal_events.dcd_down++; dcd_change()
1094 if (info->netcount) { dcd_change()
1095 if (info->serial_signals & SerialSignal_DCD) dcd_change()
1096 netif_carrier_on(info->netdev); dcd_change()
1098 netif_carrier_off(info->netdev); dcd_change()
1101 wake_up_interruptible(&info->status_event_wait_q); dcd_change()
1102 wake_up_interruptible(&info->event_wait_q); dcd_change()
1104 if (info->port.flags & ASYNC_CHECK_CD) { dcd_change()
1106 printk("%s CD now %s...", info->device_name, dcd_change()
1107 (info->serial_signals & SerialSignal_DCD) ? "on" : "off"); dcd_change()
1108 if (info->serial_signals & SerialSignal_DCD) dcd_change()
1109 wake_up_interruptible(&info->port.open_wait); dcd_change()
1117 info->pending_bh |= BH_STATUS; dcd_change()
1120 static void dsr_change(MGSLPC_INFO *info) dsr_change() argument
1122 get_signals(info); dsr_change()
1123 if ((info->dsr_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) dsr_change()
1124 port_irq_disable(info, PVR_DSR); dsr_change()
1125 info->icount.dsr++; dsr_change()
1126 if (info->serial_signals & SerialSignal_DSR) dsr_change()
1127 info->input_signal_events.dsr_up++; dsr_change()
1129 info->input_signal_events.dsr_down++; dsr_change()
1130 wake_up_interruptible(&info->status_event_wait_q); dsr_change()
1131 wake_up_interruptible(&info->event_wait_q); dsr_change()
1132 info->pending_bh |= BH_STATUS; dsr_change()
1135 static void ri_change(MGSLPC_INFO *info) ri_change() argument
1137 get_signals(info); ri_change()
1138 if ((info->ri_chkcount)++ >= IO_PIN_SHUTDOWN_LIMIT) ri_change()
1139 port_irq_disable(info, PVR_RI); ri_change()
1140 info->icount.rng++; ri_change()
1141 if (info->serial_signals & SerialSignal_RI) ri_change()
1142 info->input_signal_events.ri_up++; ri_change()
1144 info->input_signal_events.ri_down++; ri_change()
1145 wake_up_interruptible(&info->status_event_wait_q); ri_change()
1146 wake_up_interruptible(&info->event_wait_q); ri_change()
1147 info->pending_bh |= BH_STATUS; ri_change()
1159 MGSLPC_INFO *info = dev_id; mgslpc_isr() local
1166 printk("mgslpc_isr(%d) entry.\n", info->irq_level); mgslpc_isr()
1168 if (!(info->p_dev->_locked)) mgslpc_isr()
1171 tty = tty_port_tty_get(&info->port); mgslpc_isr()
1173 spin_lock(&info->lock); mgslpc_isr()
1175 while ((gis = read_reg(info, CHA + GIS))) { mgslpc_isr()
1177 printk("mgslpc_isr %s gis=%04X\n", info->device_name,gis); mgslpc_isr()
1186 isr = read_reg16(info, CHB + ISR); mgslpc_isr()
1188 dcd_change(info, tty); mgslpc_isr()
1190 cts_change(info, tty); mgslpc_isr()
1194 isr = read_reg16(info, CHA + ISR); mgslpc_isr()
1196 info->irq_occurred = true; mgslpc_isr()
1197 irq_disable(info, CHA, IRQ_TIMER); mgslpc_isr()
1202 info->icount.exithunt++; mgslpc_isr()
1203 wake_up_interruptible(&info->event_wait_q); mgslpc_isr()
1206 info->icount.brk++; mgslpc_isr()
1207 if (info->port.flags & ASYNC_SAK) mgslpc_isr()
1211 issue_command(info, CHA, CMD_RXFIFO_READ); mgslpc_isr()
1214 if (info->params.mode == MGSL_MODE_HDLC) mgslpc_isr()
1215 rx_ready_hdlc(info, isr & IRQ_RXEOM); mgslpc_isr()
1217 rx_ready_async(info, isr & IRQ_RXEOM); mgslpc_isr()
1222 if (info->tx_aborting) mgslpc_isr()
1223 info->icount.txabort++; mgslpc_isr()
1225 info->icount.txunder++; mgslpc_isr()
1226 tx_done(info, tty); mgslpc_isr()
1229 info->icount.txok++; mgslpc_isr()
1230 tx_done(info, tty); mgslpc_isr()
1233 tx_ready(info, tty); mgslpc_isr()
1236 pis = read_reg(info, CHA + PIS); mgslpc_isr()
1238 dsr_change(info); mgslpc_isr()
1240 ri_change(info); mgslpc_isr()
1248 if (info->pending_bh && !info->bh_running && !info->bh_requested) { mgslpc_isr()
1251 __FILE__,__LINE__,info->device_name); mgslpc_isr()
1252 schedule_work(&info->task); mgslpc_isr()
1253 info->bh_requested = true; mgslpc_isr()
1256 spin_unlock(&info->lock); mgslpc_isr()
1261 __FILE__, __LINE__, info->irq_level); mgslpc_isr()
1268 static int startup(MGSLPC_INFO * info, struct tty_struct *tty) startup() argument
1273 printk("%s(%d):startup(%s)\n", __FILE__, __LINE__, info->device_name); startup()
1275 if (info->port.flags & ASYNC_INITIALIZED) startup()
1278 if (!info->tx_buf) { startup()
1280 info->tx_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL); startup()
1281 if (!info->tx_buf) { startup()
1283 __FILE__, __LINE__, info->device_name); startup()
1288 info->pending_bh = 0; startup()
1290 memset(&info->icount, 0, sizeof(info->icount)); startup()
1292 setup_timer(&info->tx_timer, tx_timeout, (unsigned long)info); startup()
1295 retval = claim_resources(info); startup()
1299 retval = adapter_test(info); startup()
1304 release_resources(info); startup()
1309 mgslpc_change_params(info, tty); startup()
1314 info->port.flags |= ASYNC_INITIALIZED; startup()
1321 static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty) shutdown() argument
1325 if (!(info->port.flags & ASYNC_INITIALIZED)) shutdown()
1330 __FILE__, __LINE__, info->device_name); shutdown()
1334 wake_up_interruptible(&info->status_event_wait_q); shutdown()
1335 wake_up_interruptible(&info->event_wait_q); shutdown()
1337 del_timer_sync(&info->tx_timer); shutdown()
1339 if (info->tx_buf) { shutdown()
1340 free_page((unsigned long) info->tx_buf); shutdown()
1341 info->tx_buf = NULL; shutdown()
1344 spin_lock_irqsave(&info->lock, flags); shutdown()
1346 rx_stop(info); shutdown()
1347 tx_stop(info); shutdown()
1350 reset_device(info); shutdown()
1353 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); shutdown()
1354 set_signals(info); shutdown()
1357 spin_unlock_irqrestore(&info->lock, flags); shutdown()
1359 release_resources(info); shutdown()
1364 info->port.flags &= ~ASYNC_INITIALIZED; shutdown()
1367 static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty) mgslpc_program_hw() argument
1371 spin_lock_irqsave(&info->lock, flags); mgslpc_program_hw()
1373 rx_stop(info); mgslpc_program_hw()
1374 tx_stop(info); mgslpc_program_hw()
1375 info->tx_count = info->tx_put = info->tx_get = 0; mgslpc_program_hw()
1377 if (info->params.mode == MGSL_MODE_HDLC || info->netcount) mgslpc_program_hw()
1378 hdlc_mode(info); mgslpc_program_hw()
1380 async_mode(info); mgslpc_program_hw()
1382 set_signals(info); mgslpc_program_hw()
1384 info->dcd_chkcount = 0; mgslpc_program_hw()
1385 info->cts_chkcount = 0; mgslpc_program_hw()
1386 info->ri_chkcount = 0; mgslpc_program_hw()
1387 info->dsr_chkcount = 0; mgslpc_program_hw()
1389 irq_enable(info, CHB, IRQ_DCD | IRQ_CTS); mgslpc_program_hw()
1390 port_irq_enable(info, (unsigned char) PVR_DSR | PVR_RI); mgslpc_program_hw()
1391 get_signals(info); mgslpc_program_hw()
1393 if (info->netcount || (tty && (tty->termios.c_cflag & CREAD))) mgslpc_program_hw()
1394 rx_start(info); mgslpc_program_hw()
1396 spin_unlock_irqrestore(&info->lock, flags); mgslpc_program_hw()
1401 static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) mgslpc_change_params() argument
1411 __FILE__, __LINE__, info->device_name); mgslpc_change_params()
1418 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; mgslpc_change_params()
1420 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); mgslpc_change_params()
1425 case CS5: info->params.data_bits = 5; break; mgslpc_change_params()
1426 case CS6: info->params.data_bits = 6; break; mgslpc_change_params()
1427 case CS7: info->params.data_bits = 7; break; mgslpc_change_params()
1428 case CS8: info->params.data_bits = 8; break; mgslpc_change_params()
1429 default: info->params.data_bits = 7; break; mgslpc_change_params()
1433 info->params.stop_bits = 2; mgslpc_change_params()
1435 info->params.stop_bits = 1; mgslpc_change_params()
1437 info->params.parity = ASYNC_PARITY_NONE; mgslpc_change_params()
1440 info->params.parity = ASYNC_PARITY_ODD; mgslpc_change_params()
1442 info->params.parity = ASYNC_PARITY_EVEN; mgslpc_change_params()
1445 info->params.parity = ASYNC_PARITY_SPACE; mgslpc_change_params()
1452 bits_per_char = info->params.data_bits + mgslpc_change_params()
1453 info->params.stop_bits + 1; mgslpc_change_params()
1459 if (info->params.data_rate <= 460800) { mgslpc_change_params()
1460 info->params.data_rate = tty_get_baud_rate(tty); mgslpc_change_params()
1463 if (info->params.data_rate) { mgslpc_change_params()
1464 info->timeout = (32*HZ*bits_per_char) / mgslpc_change_params()
1465 info->params.data_rate; mgslpc_change_params()
1467 info->timeout += HZ/50; /* Add .02 seconds of slop */ mgslpc_change_params()
1470 info->port.flags |= ASYNC_CTS_FLOW; mgslpc_change_params()
1472 info->port.flags &= ~ASYNC_CTS_FLOW; mgslpc_change_params()
1475 info->port.flags &= ~ASYNC_CHECK_CD; mgslpc_change_params()
1477 info->port.flags |= ASYNC_CHECK_CD; mgslpc_change_params()
1481 info->read_status_mask = 0; mgslpc_change_params()
1483 info->read_status_mask |= BIT7 | BIT6; mgslpc_change_params()
1485 info->ignore_status_mask |= BIT7 | BIT6; mgslpc_change_params()
1487 mgslpc_program_hw(info, tty); mgslpc_change_params()
1494 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_put_char() local
1499 __FILE__, __LINE__, ch, info->device_name); mgslpc_put_char()
1502 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char")) mgslpc_put_char()
1505 if (!info->tx_buf) mgslpc_put_char()
1508 spin_lock_irqsave(&info->lock, flags); mgslpc_put_char()
1510 if (info->params.mode == MGSL_MODE_ASYNC || !info->tx_active) { mgslpc_put_char()
1511 if (info->tx_count < TXBUFSIZE - 1) { mgslpc_put_char()
1512 info->tx_buf[info->tx_put++] = ch; mgslpc_put_char()
1513 info->tx_put &= TXBUFSIZE-1; mgslpc_put_char()
1514 info->tx_count++; mgslpc_put_char()
1518 spin_unlock_irqrestore(&info->lock, flags); mgslpc_put_char()
1527 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_flush_chars() local
1532 __FILE__, __LINE__, info->device_name, info->tx_count); mgslpc_flush_chars()
1534 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_chars")) mgslpc_flush_chars()
1537 if (info->tx_count <= 0 || tty->stopped || mgslpc_flush_chars()
1538 tty->hw_stopped || !info->tx_buf) mgslpc_flush_chars()
1543 __FILE__, __LINE__, info->device_name); mgslpc_flush_chars()
1545 spin_lock_irqsave(&info->lock, flags); mgslpc_flush_chars()
1546 if (!info->tx_active) mgslpc_flush_chars()
1547 tx_start(info, tty); mgslpc_flush_chars()
1548 spin_unlock_irqrestore(&info->lock, flags); mgslpc_flush_chars()
1565 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_write() local
1570 __FILE__, __LINE__, info->device_name, count); mgslpc_write()
1572 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") || mgslpc_write()
1573 !info->tx_buf) mgslpc_write()
1576 if (info->params.mode == MGSL_MODE_HDLC) { mgslpc_write()
1581 if (info->tx_active) mgslpc_write()
1583 else if (info->tx_count) mgslpc_write()
1589 min(TXBUFSIZE - info->tx_count - 1, mgslpc_write()
1590 TXBUFSIZE - info->tx_put)); mgslpc_write()
1594 memcpy(info->tx_buf + info->tx_put, buf, c); mgslpc_write()
1596 spin_lock_irqsave(&info->lock, flags); mgslpc_write()
1597 info->tx_put = (info->tx_put + c) & (TXBUFSIZE-1); mgslpc_write()
1598 info->tx_count += c; mgslpc_write()
1599 spin_unlock_irqrestore(&info->lock, flags); mgslpc_write()
1606 if (info->tx_count && !tty->stopped && !tty->hw_stopped) { mgslpc_write()
1607 spin_lock_irqsave(&info->lock, flags); mgslpc_write()
1608 if (!info->tx_active) mgslpc_write()
1609 tx_start(info, tty); mgslpc_write()
1610 spin_unlock_irqrestore(&info->lock, flags); mgslpc_write()
1615 __FILE__, __LINE__, info->device_name, ret); mgslpc_write()
1623 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_write_room() local
1626 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write_room")) mgslpc_write_room()
1629 if (info->params.mode == MGSL_MODE_HDLC) { mgslpc_write_room()
1631 if (info->tx_active) mgslpc_write_room()
1636 ret = TXBUFSIZE - info->tx_count - 1; mgslpc_write_room()
1643 __FILE__, __LINE__, info->device_name, ret); mgslpc_write_room()
1651 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_chars_in_buffer() local
1656 __FILE__, __LINE__, info->device_name); mgslpc_chars_in_buffer()
1658 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_chars_in_buffer")) mgslpc_chars_in_buffer()
1661 if (info->params.mode == MGSL_MODE_HDLC) mgslpc_chars_in_buffer()
1662 rc = info->tx_active ? info->max_frame_size : 0; mgslpc_chars_in_buffer()
1664 rc = info->tx_count; mgslpc_chars_in_buffer()
1668 __FILE__, __LINE__, info->device_name, rc); mgslpc_chars_in_buffer()
1677 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_flush_buffer() local
1682 __FILE__, __LINE__, info->device_name); mgslpc_flush_buffer()
1684 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_flush_buffer")) mgslpc_flush_buffer()
1687 spin_lock_irqsave(&info->lock, flags); mgslpc_flush_buffer()
1688 info->tx_count = info->tx_put = info->tx_get = 0; mgslpc_flush_buffer()
1689 del_timer(&info->tx_timer); mgslpc_flush_buffer()
1690 spin_unlock_irqrestore(&info->lock, flags); mgslpc_flush_buffer()
1700 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_send_xchar() local
1705 __FILE__, __LINE__, info->device_name, ch); mgslpc_send_xchar()
1707 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_send_xchar")) mgslpc_send_xchar()
1710 info->x_char = ch; mgslpc_send_xchar()
1712 spin_lock_irqsave(&info->lock, flags); mgslpc_send_xchar()
1713 if (!info->tx_enabled) mgslpc_send_xchar()
1714 tx_start(info, tty); mgslpc_send_xchar()
1715 spin_unlock_irqrestore(&info->lock, flags); mgslpc_send_xchar()
1723 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_throttle() local
1728 __FILE__, __LINE__, info->device_name); mgslpc_throttle()
1730 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_throttle")) mgslpc_throttle()
1737 spin_lock_irqsave(&info->lock, flags); mgslpc_throttle()
1738 info->serial_signals &= ~SerialSignal_RTS; mgslpc_throttle()
1739 set_signals(info); mgslpc_throttle()
1740 spin_unlock_irqrestore(&info->lock, flags); mgslpc_throttle()
1748 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_unthrottle() local
1753 __FILE__, __LINE__, info->device_name); mgslpc_unthrottle()
1755 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_unthrottle")) mgslpc_unthrottle()
1759 if (info->x_char) mgslpc_unthrottle()
1760 info->x_char = 0; mgslpc_unthrottle()
1766 spin_lock_irqsave(&info->lock, flags); mgslpc_unthrottle()
1767 info->serial_signals |= SerialSignal_RTS; mgslpc_unthrottle()
1768 set_signals(info); mgslpc_unthrottle()
1769 spin_unlock_irqrestore(&info->lock, flags); mgslpc_unthrottle()
1775 static int get_stats(MGSLPC_INFO * info, struct mgsl_icount __user *user_icount) get_stats() argument
1779 printk("get_params(%s)\n", info->device_name); get_stats()
1781 memset(&info->icount, 0, sizeof(info->icount)); get_stats()
1783 COPY_TO_USER(err, user_icount, &info->icount, sizeof(struct mgsl_icount)); get_stats()
1792 static int get_params(MGSLPC_INFO * info, MGSL_PARAMS __user *user_params) get_params() argument
1796 printk("get_params(%s)\n", info->device_name); get_params()
1797 COPY_TO_USER(err,user_params, &info->params, sizeof(MGSL_PARAMS)); get_params()
1807 * info pointer to device instance data
1812 static int set_params(MGSLPC_INFO * info, MGSL_PARAMS __user *new_params, struct tty_struct *tty) set_params() argument
1820 info->device_name); set_params()
1825 __FILE__, __LINE__, info->device_name); set_params()
1829 spin_lock_irqsave(&info->lock, flags); set_params()
1830 memcpy(&info->params,&tmp_params,sizeof(MGSL_PARAMS)); set_params()
1831 spin_unlock_irqrestore(&info->lock, flags); set_params()
1833 mgslpc_change_params(info, tty); set_params()
1838 static int get_txidle(MGSLPC_INFO * info, int __user *idle_mode) get_txidle() argument
1842 printk("get_txidle(%s)=%d\n", info->device_name, info->idle_mode); get_txidle()
1843 COPY_TO_USER(err,idle_mode, &info->idle_mode, sizeof(int)); get_txidle()
1849 static int set_txidle(MGSLPC_INFO * info, int idle_mode) set_txidle() argument
1853 printk("set_txidle(%s,%d)\n", info->device_name, idle_mode); set_txidle()
1854 spin_lock_irqsave(&info->lock, flags); set_txidle()
1855 info->idle_mode = idle_mode; set_txidle()
1856 tx_set_idle(info); set_txidle()
1857 spin_unlock_irqrestore(&info->lock, flags); set_txidle()
1861 static int get_interface(MGSLPC_INFO * info, int __user *if_mode) get_interface() argument
1865 printk("get_interface(%s)=%d\n", info->device_name, info->if_mode); get_interface()
1866 COPY_TO_USER(err,if_mode, &info->if_mode, sizeof(int)); get_interface()
1872 static int set_interface(MGSLPC_INFO * info, int if_mode) set_interface() argument
1877 printk("set_interface(%s,%d)\n", info->device_name, if_mode); set_interface()
1878 spin_lock_irqsave(&info->lock, flags); set_interface()
1879 info->if_mode = if_mode; set_interface()
1881 val = read_reg(info, PVR) & 0x0f; set_interface()
1882 switch (info->if_mode) set_interface()
1888 write_reg(info, PVR, val); set_interface()
1890 spin_unlock_irqrestore(&info->lock, flags); set_interface()
1894 static int set_txenable(MGSLPC_INFO * info, int enable, struct tty_struct *tty) set_txenable() argument
1899 printk("set_txenable(%s,%d)\n", info->device_name, enable); set_txenable()
1901 spin_lock_irqsave(&info->lock, flags); set_txenable()
1903 if (!info->tx_enabled) set_txenable()
1904 tx_start(info, tty); set_txenable()
1906 if (info->tx_enabled) set_txenable()
1907 tx_stop(info); set_txenable()
1909 spin_unlock_irqrestore(&info->lock, flags); set_txenable()
1913 static int tx_abort(MGSLPC_INFO * info) tx_abort() argument
1918 printk("tx_abort(%s)\n", info->device_name); tx_abort()
1920 spin_lock_irqsave(&info->lock, flags); tx_abort()
1921 if (info->tx_active && info->tx_count && tx_abort()
1922 info->params.mode == MGSL_MODE_HDLC) { tx_abort()
1926 info->tx_count = info->tx_put = info->tx_get = 0; tx_abort()
1927 info->tx_aborting = true; tx_abort()
1929 spin_unlock_irqrestore(&info->lock, flags); tx_abort()
1933 static int set_rxenable(MGSLPC_INFO * info, int enable) set_rxenable() argument
1938 printk("set_rxenable(%s,%d)\n", info->device_name, enable); set_rxenable()
1940 spin_lock_irqsave(&info->lock, flags); set_rxenable()
1942 if (!info->rx_enabled) set_rxenable()
1943 rx_start(info); set_rxenable()
1945 if (info->rx_enabled) set_rxenable()
1946 rx_stop(info); set_rxenable()
1948 spin_unlock_irqrestore(&info->lock, flags); set_rxenable()
1954 * Arguments: info pointer to device instance data
1960 static int wait_events(MGSLPC_INFO * info, int __user *mask_ptr) wait_events() argument
1976 printk("wait_events(%s,%d)\n", info->device_name, mask); wait_events()
1978 spin_lock_irqsave(&info->lock, flags); wait_events()
1981 get_signals(info); wait_events()
1982 s = info->serial_signals; wait_events()
1989 spin_unlock_irqrestore(&info->lock, flags); wait_events()
1994 cprev = info->icount; wait_events()
1995 oldsigs = info->input_signal_events; wait_events()
1997 if ((info->params.mode == MGSL_MODE_HDLC) && wait_events()
1999 irq_enable(info, CHA, IRQ_EXITHUNT); wait_events()
2002 add_wait_queue(&info->event_wait_q, &wait); wait_events()
2004 spin_unlock_irqrestore(&info->lock, flags); wait_events()
2015 spin_lock_irqsave(&info->lock, flags); wait_events()
2016 cnow = info->icount; wait_events()
2017 newsigs = info->input_signal_events; wait_events()
2019 spin_unlock_irqrestore(&info->lock, flags); wait_events()
2054 remove_wait_queue(&info->event_wait_q, &wait); wait_events()
2058 spin_lock_irqsave(&info->lock, flags); wait_events()
2059 if (!waitqueue_active(&info->event_wait_q)) wait_events()
2060 irq_disable(info, CHA, IRQ_EXITHUNT); wait_events()
2061 spin_unlock_irqrestore(&info->lock, flags); wait_events()
2069 static int modem_input_wait(MGSLPC_INFO *info,int arg) modem_input_wait() argument
2077 spin_lock_irqsave(&info->lock, flags); modem_input_wait()
2078 cprev = info->icount; modem_input_wait()
2079 add_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
2081 spin_unlock_irqrestore(&info->lock, flags); modem_input_wait()
2091 spin_lock_irqsave(&info->lock, flags); modem_input_wait()
2092 cnow = info->icount; modem_input_wait()
2094 spin_unlock_irqrestore(&info->lock, flags); modem_input_wait()
2114 remove_wait_queue(&info->status_event_wait_q, &wait); modem_input_wait()
2123 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; tiocmget() local
2127 spin_lock_irqsave(&info->lock, flags); tiocmget()
2128 get_signals(info); tiocmget()
2129 spin_unlock_irqrestore(&info->lock, flags); tiocmget()
2131 result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS:0) + tiocmget()
2132 ((info->serial_signals & SerialSignal_DTR) ? TIOCM_DTR:0) + tiocmget()
2133 ((info->serial_signals & SerialSignal_DCD) ? TIOCM_CAR:0) + tiocmget()
2134 ((info->serial_signals & SerialSignal_RI) ? TIOCM_RNG:0) + tiocmget()
2135 ((info->serial_signals & SerialSignal_DSR) ? TIOCM_DSR:0) + tiocmget()
2136 ((info->serial_signals & SerialSignal_CTS) ? TIOCM_CTS:0); tiocmget()
2140 __FILE__, __LINE__, info->device_name, result); tiocmget()
2149 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; tiocmset() local
2154 __FILE__, __LINE__, info->device_name, set, clear); tiocmset()
2157 info->serial_signals |= SerialSignal_RTS; tiocmset()
2159 info->serial_signals |= SerialSignal_DTR; tiocmset()
2161 info->serial_signals &= ~SerialSignal_RTS; tiocmset()
2163 info->serial_signals &= ~SerialSignal_DTR; tiocmset()
2165 spin_lock_irqsave(&info->lock, flags); tiocmset()
2166 set_signals(info); tiocmset()
2167 spin_unlock_irqrestore(&info->lock, flags); tiocmset()
2179 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; mgslpc_break() local
2184 __FILE__, __LINE__, info->device_name, break_state); mgslpc_break()
2186 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_break")) mgslpc_break()
2189 spin_lock_irqsave(&info->lock, flags); mgslpc_break()
2191 set_reg_bits(info, CHA+DAFO, BIT6); mgslpc_break()
2193 clear_reg_bits(info, CHA+DAFO, BIT6); mgslpc_break()
2194 spin_unlock_irqrestore(&info->lock, flags); mgslpc_break()
2201 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; mgslpc_get_icount() local
2205 spin_lock_irqsave(&info->lock, flags); mgslpc_get_icount()
2206 cnow = info->icount; mgslpc_get_icount()
2207 spin_unlock_irqrestore(&info->lock, flags); mgslpc_get_icount()
2237 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; mgslpc_ioctl() local
2242 info->device_name, cmd); mgslpc_ioctl()
2244 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_ioctl")) mgslpc_ioctl()
2255 return get_params(info, argp); mgslpc_ioctl()
2257 return set_params(info, argp, tty); mgslpc_ioctl()
2259 return get_txidle(info, argp); mgslpc_ioctl()
2261 return set_txidle(info, (int)arg); mgslpc_ioctl()
2263 return get_interface(info, argp); mgslpc_ioctl()
2265 return set_interface(info,(int)arg); mgslpc_ioctl()
2267 return set_txenable(info,(int)arg, tty); mgslpc_ioctl()
2269 return set_rxenable(info,(int)arg); mgslpc_ioctl()
2271 return tx_abort(info); mgslpc_ioctl()
2273 return get_stats(info, argp); mgslpc_ioctl()
2275 return wait_events(info, argp); mgslpc_ioctl()
2277 return modem_input_wait(info,(int)arg); mgslpc_ioctl()
2293 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; mgslpc_set_termios() local
2306 mgslpc_change_params(info, tty); mgslpc_set_termios()
2311 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); mgslpc_set_termios()
2312 spin_lock_irqsave(&info->lock, flags); mgslpc_set_termios()
2313 set_signals(info); mgslpc_set_termios()
2314 spin_unlock_irqrestore(&info->lock, flags); mgslpc_set_termios()
2320 info->serial_signals |= SerialSignal_DTR; mgslpc_set_termios()
2323 info->serial_signals |= SerialSignal_RTS; mgslpc_set_termios()
2325 spin_lock_irqsave(&info->lock, flags); mgslpc_set_termios()
2326 set_signals(info); mgslpc_set_termios()
2327 spin_unlock_irqrestore(&info->lock, flags); mgslpc_set_termios()
2340 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; mgslpc_close() local
2341 struct tty_port *port = &info->port; mgslpc_close()
2343 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_close")) mgslpc_close()
2348 __FILE__, __LINE__, info->device_name, port->count); mgslpc_close()
2354 mgslpc_wait_until_sent(tty, info->timeout); mgslpc_close()
2359 shutdown(info, tty); mgslpc_close()
2373 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; mgslpc_wait_until_sent() local
2376 if (!info) mgslpc_wait_until_sent()
2381 __FILE__, __LINE__, info->device_name); mgslpc_wait_until_sent()
2383 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent")) mgslpc_wait_until_sent()
2386 if (!(info->port.flags & ASYNC_INITIALIZED)) mgslpc_wait_until_sent()
2397 if (info->params.data_rate) { mgslpc_wait_until_sent()
2398 char_time = info->timeout/(32 * 5); mgslpc_wait_until_sent()
2407 if (info->params.mode == MGSL_MODE_HDLC) { mgslpc_wait_until_sent()
2408 while (info->tx_active) { mgslpc_wait_until_sent()
2416 while ((info->tx_count || info->tx_active) && mgslpc_wait_until_sent()
2417 info->tx_enabled) { mgslpc_wait_until_sent()
2429 __FILE__, __LINE__, info->device_name); mgslpc_wait_until_sent()
2437 MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data; mgslpc_hangup() local
2441 __FILE__, __LINE__, info->device_name); mgslpc_hangup()
2443 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_hangup")) mgslpc_hangup()
2447 shutdown(info, tty); mgslpc_hangup()
2448 tty_port_hangup(&info->port); mgslpc_hangup()
2453 MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); carrier_raised() local
2456 spin_lock_irqsave(&info->lock, flags); carrier_raised()
2457 get_signals(info); carrier_raised()
2458 spin_unlock_irqrestore(&info->lock, flags); carrier_raised()
2460 if (info->serial_signals & SerialSignal_DCD) carrier_raised()
2467 MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port); dtr_rts() local
2470 spin_lock_irqsave(&info->lock, flags); dtr_rts()
2472 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; dtr_rts()
2474 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); dtr_rts()
2475 set_signals(info); dtr_rts()
2476 spin_unlock_irqrestore(&info->lock, flags); dtr_rts()
2482 MGSLPC_INFO *info; mgslpc_open() local
2495 /* find the info structure for the specified line */ mgslpc_open()
2496 info = mgslpc_device_list; mgslpc_open()
2497 while(info && info->line != line) mgslpc_open()
2498 info = info->next_device; mgslpc_open()
2499 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_open")) mgslpc_open()
2502 port = &info->port; mgslpc_open()
2503 tty->driver_data = info; mgslpc_open()
2512 spin_lock_irqsave(&info->netlock, flags); mgslpc_open()
2513 if (info->netcount) { mgslpc_open()
2515 spin_unlock_irqrestore(&info->netlock, flags); mgslpc_open()
2521 spin_unlock_irqrestore(&info->netlock, flags); mgslpc_open()
2525 retval = startup(info, tty); mgslpc_open()
2530 retval = tty_port_block_til_ready(&info->port, tty, filp); mgslpc_open()
2534 __FILE__, __LINE__, info->device_name, retval); mgslpc_open()
2540 __FILE__, __LINE__, info->device_name); mgslpc_open()
2551 static inline void line_info(struct seq_file *m, MGSLPC_INFO *info) line_info() argument
2557 info->device_name, info->io_base, info->irq_level); line_info()
2560 spin_lock_irqsave(&info->lock, flags); line_info()
2561 get_signals(info); line_info()
2562 spin_unlock_irqrestore(&info->lock, flags); line_info()
2566 if (info->serial_signals & SerialSignal_RTS) line_info()
2568 if (info->serial_signals & SerialSignal_CTS) line_info()
2570 if (info->serial_signals & SerialSignal_DTR) line_info()
2572 if (info->serial_signals & SerialSignal_DSR) line_info()
2574 if (info->serial_signals & SerialSignal_DCD) line_info()
2576 if (info->serial_signals & SerialSignal_RI) line_info()
2579 if (info->params.mode == MGSL_MODE_HDLC) { line_info()
2581 info->icount.txok, info->icount.rxok); line_info()
2582 if (info->icount.txunder) line_info()
2583 seq_printf(m, " txunder:%d", info->icount.txunder); line_info()
2584 if (info->icount.txabort) line_info()
2585 seq_printf(m, " txabort:%d", info->icount.txabort); line_info()
2586 if (info->icount.rxshort) line_info()
2587 seq_printf(m, " rxshort:%d", info->icount.rxshort); line_info()
2588 if (info->icount.rxlong) line_info()
2589 seq_printf(m, " rxlong:%d", info->icount.rxlong); line_info()
2590 if (info->icount.rxover) line_info()
2591 seq_printf(m, " rxover:%d", info->icount.rxover); line_info()
2592 if (info->icount.rxcrc) line_info()
2593 seq_printf(m, " rxcrc:%d", info->icount.rxcrc); line_info()
2596 info->icount.tx, info->icount.rx); line_info()
2597 if (info->icount.frame) line_info()
2598 seq_printf(m, " fe:%d", info->icount.frame); line_info()
2599 if (info->icount.parity) line_info()
2600 seq_printf(m, " pe:%d", info->icount.parity); line_info()
2601 if (info->icount.brk) line_info()
2602 seq_printf(m, " brk:%d", info->icount.brk); line_info()
2603 if (info->icount.overrun) line_info()
2604 seq_printf(m, " oe:%d", info->icount.overrun); line_info()
2611 info->tx_active,info->bh_requested,info->bh_running, line_info()
2612 info->pending_bh); line_info()
2619 MGSLPC_INFO *info; mgslpc_proc_show() local
2623 info = mgslpc_device_list; mgslpc_proc_show()
2624 while (info) { mgslpc_proc_show()
2625 line_info(m, info); mgslpc_proc_show()
2626 info = info->next_device; mgslpc_proc_show()
2644 static int rx_alloc_buffers(MGSLPC_INFO *info) rx_alloc_buffers() argument
2647 info->rx_buf_size = sizeof(RXBUF) + info->max_frame_size; rx_alloc_buffers()
2650 info->rx_buf_total_size = info->rx_buf_size * 8; rx_alloc_buffers()
2653 if (info->rx_buf_total_size > 0x10000) rx_alloc_buffers()
2654 info->rx_buf_total_size = 0x10000; rx_alloc_buffers()
2657 info->rx_buf_count = info->rx_buf_total_size / info->rx_buf_size; rx_alloc_buffers()
2659 info->rx_buf = kmalloc(info->rx_buf_total_size, GFP_KERNEL); rx_alloc_buffers()
2660 if (info->rx_buf == NULL) rx_alloc_buffers()
2664 info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL); rx_alloc_buffers()
2665 if (!info->flag_buf) { rx_alloc_buffers()
2666 kfree(info->rx_buf); rx_alloc_buffers()
2667 info->rx_buf = NULL; rx_alloc_buffers()
2671 rx_reset_buffers(info); rx_alloc_buffers()
2675 static void rx_free_buffers(MGSLPC_INFO *info) rx_free_buffers() argument
2677 kfree(info->rx_buf); rx_free_buffers()
2678 info->rx_buf = NULL; rx_free_buffers()
2679 kfree(info->flag_buf); rx_free_buffers()
2680 info->flag_buf = NULL; rx_free_buffers()
2683 static int claim_resources(MGSLPC_INFO *info) claim_resources() argument
2685 if (rx_alloc_buffers(info) < 0) { claim_resources()
2686 printk("Can't allocate rx buffer %s\n", info->device_name); claim_resources()
2687 release_resources(info); claim_resources()
2693 static void release_resources(MGSLPC_INFO *info) release_resources() argument
2696 printk("release_resources(%s)\n", info->device_name); release_resources()
2697 rx_free_buffers(info); release_resources()
2703 * Arguments: info pointer to device instance data
2705 static int mgslpc_add_device(MGSLPC_INFO *info) mgslpc_add_device() argument
2711 info->next_device = NULL; mgslpc_add_device()
2712 info->line = mgslpc_device_count; mgslpc_add_device()
2713 sprintf(info->device_name,"ttySLP%d",info->line); mgslpc_add_device()
2715 if (info->line < MAX_DEVICE_COUNT) { mgslpc_add_device()
2716 if (maxframe[info->line]) mgslpc_add_device()
2717 info->max_frame_size = maxframe[info->line]; mgslpc_add_device()
2723 mgslpc_device_list = info; mgslpc_add_device()
2728 current_dev->next_device = info; mgslpc_add_device()
2731 if (info->max_frame_size < 4096) mgslpc_add_device()
2732 info->max_frame_size = 4096; mgslpc_add_device()
2733 else if (info->max_frame_size > 65535) mgslpc_add_device()
2734 info->max_frame_size = 65535; mgslpc_add_device()
2737 info->device_name, info->io_base, info->irq_level); mgslpc_add_device()
2740 ret = hdlcdev_init(info); mgslpc_add_device()
2745 tty_dev = tty_port_register_device(&info->port, serial_driver, info->line, mgslpc_add_device()
2746 &info->p_dev->dev); mgslpc_add_device()
2750 hdlcdev_exit(info); mgslpc_add_device()
2768 MGSLPC_INFO *info = mgslpc_device_list; mgslpc_remove_device() local
2771 while(info) { mgslpc_remove_device()
2772 if (info == remove_info) { mgslpc_remove_device()
2774 last->next_device = info->next_device; mgslpc_remove_device()
2776 mgslpc_device_list = info->next_device; mgslpc_remove_device()
2777 tty_unregister_device(serial_driver, info->line); mgslpc_remove_device()
2779 hdlcdev_exit(info); mgslpc_remove_device()
2781 release_resources(info); mgslpc_remove_device()
2782 tty_port_destroy(&info->port); mgslpc_remove_device()
2783 kfree(info); mgslpc_remove_device()
2787 last = info; mgslpc_remove_device()
2788 info = info->next_device; mgslpc_remove_device()
2895 static void mgslpc_set_rate(MGSLPC_INFO *info, unsigned char channel, unsigned int rate) mgslpc_set_rate() argument
2921 write_reg(info, (unsigned char) (channel + BGR), mgslpc_set_rate()
2923 val = read_reg(info, (unsigned char) (channel + CCR2)) & 0x3f; mgslpc_set_rate()
2925 write_reg(info, (unsigned char) (channel + CCR2), val); mgslpc_set_rate()
2931 static void enable_auxclk(MGSLPC_INFO *info) enable_auxclk() argument
2950 if (info->params.mode == MGSL_MODE_HDLC && info->params.clock_speed) enable_auxclk()
2952 write_reg(info, CHB + MODE, val); enable_auxclk()
2964 write_reg(info, CHB + CCR0, 0xc0); enable_auxclk()
2977 write_reg(info, CHB + CCR1, 0x17); enable_auxclk()
2991 if (info->params.mode == MGSL_MODE_HDLC && info->params.clock_speed) enable_auxclk()
2992 write_reg(info, CHB + CCR2, 0x38); enable_auxclk()
2994 write_reg(info, CHB + CCR2, 0x30); enable_auxclk()
3007 write_reg(info, CHB + CCR4, 0x50); enable_auxclk()
3012 if (info->params.mode == MGSL_MODE_HDLC && info->params.clock_speed) enable_auxclk()
3013 mgslpc_set_rate(info, CHB, info->params.clock_speed); enable_auxclk()
3015 mgslpc_set_rate(info, CHB, 921600); enable_auxclk()
3018 static void loopback_enable(MGSLPC_INFO *info) loopback_enable() argument
3023 val = read_reg(info, CHA + CCR1) | (BIT2 | BIT1 | BIT0); loopback_enable()
3024 write_reg(info, CHA + CCR1, val); loopback_enable()
3027 val = read_reg(info, CHA + CCR2) | (BIT4 | BIT5); loopback_enable()
3028 write_reg(info, CHA + CCR2, val); loopback_enable()
3031 if (info->params.clock_speed) loopback_enable()
3032 mgslpc_set_rate(info, CHA, info->params.clock_speed); loopback_enable()
3034 mgslpc_set_rate(info, CHA, 1843200); loopback_enable()
3037 val = read_reg(info, CHA + MODE) | BIT0; loopback_enable()
3038 write_reg(info, CHA + MODE, val); loopback_enable()
3041 static void hdlc_mode(MGSLPC_INFO *info) hdlc_mode() argument
3047 irq_disable(info, CHA, 0xffff); hdlc_mode()
3048 irq_disable(info, CHB, 0xffff); hdlc_mode()
3049 port_irq_disable(info, 0xff); hdlc_mode()
3053 if (info->params.flags & HDLC_FLAG_RXC_DPLL hdlc_mode()
3054 && info->params.flags & HDLC_FLAG_TXC_DPLL) { hdlc_mode()
3057 } else if (info->params.flags & HDLC_FLAG_RXC_BRG hdlc_mode()
3058 && info->params.flags & HDLC_FLAG_TXC_BRG) { hdlc_mode()
3062 } else if (info->params.flags & HDLC_FLAG_RXC_DPLL) { hdlc_mode()
3063 if (info->params.flags & HDLC_FLAG_TXC_BRG) { hdlc_mode()
3071 } else if (info->params.flags & HDLC_FLAG_TXC_BRG) { hdlc_mode()
3089 if (info->params.loopback) hdlc_mode()
3093 if (info->serial_signals & SerialSignal_RTS) hdlc_mode()
3095 write_reg(info, CHA + MODE, val); hdlc_mode()
3108 switch (info->params.encoding) hdlc_mode()
3123 write_reg(info, CHA + CCR0, val); hdlc_mode()
3137 write_reg(info, CHA + CCR1, val); hdlc_mode()
3157 if (info->params.crc_type == HDLC_CRC_32_CCITT) hdlc_mode()
3159 if (info->params.encoding == HDLC_ENCODING_NRZB) hdlc_mode()
3161 write_reg(info, CHA + CCR2, val); hdlc_mode()
3176 if (info->params.crc_type == HDLC_CRC_NONE) hdlc_mode()
3178 if (info->params.preamble != HDLC_PREAMBLE_PATTERN_NONE) hdlc_mode()
3180 switch (info->params.preamble_length) hdlc_mode()
3192 write_reg(info, CHA + CCR3, val); hdlc_mode()
3196 switch (info->params.preamble) hdlc_mode()
3203 write_reg(info, CHA + PRE, val); hdlc_mode()
3217 write_reg(info, CHA + CCR4, val); hdlc_mode()
3218 if (info->params.flags & HDLC_FLAG_RXC_DPLL) hdlc_mode()
3219 mgslpc_set_rate(info, CHA, info->params.clock_speed * 16); hdlc_mode()
3221 mgslpc_set_rate(info, CHA, info->params.clock_speed); hdlc_mode()
3228 write_reg(info, CHA + RLCR, 0); hdlc_mode()
3241 if (info->params.flags & HDLC_FLAG_AUTO_DCD) hdlc_mode()
3243 write_reg(info, CHA + XBCH, val); hdlc_mode()
3244 enable_auxclk(info); hdlc_mode()
3245 if (info->params.loopback || info->testing_irq) hdlc_mode()
3246 loopback_enable(info); hdlc_mode()
3247 if (info->params.flags & HDLC_FLAG_AUTO_CTS) hdlc_mode()
3249 irq_enable(info, CHB, IRQ_CTS); hdlc_mode()
3251 set_reg_bits(info, CHA + PVR, BIT3); hdlc_mode()
3253 clear_reg_bits(info, CHA + PVR, BIT3); hdlc_mode()
3255 irq_enable(info, CHA, hdlc_mode()
3258 issue_command(info, CHA, CMD_TXRESET + CMD_RXRESET); hdlc_mode()
3259 wait_command_complete(info, CHA); hdlc_mode()
3260 read_reg16(info, CHA + ISR); /* clear pending IRQs */ hdlc_mode()
3272 if (!info->testing_irq) hdlc_mode()
3273 clear_reg_bits(info, CHA + CCR0, BIT6); hdlc_mode()
3275 tx_set_idle(info); hdlc_mode()
3277 tx_stop(info); hdlc_mode()
3278 rx_stop(info); hdlc_mode()
3281 static void rx_stop(MGSLPC_INFO *info) rx_stop() argument
3285 __FILE__, __LINE__, info->device_name); rx_stop()
3288 clear_reg_bits(info, CHA + MODE, BIT3); rx_stop()
3290 info->rx_enabled = false; rx_stop()
3291 info->rx_overflow = false; rx_stop()
3294 static void rx_start(MGSLPC_INFO *info) rx_start() argument
3298 __FILE__, __LINE__, info->device_name); rx_start()
3300 rx_reset_buffers(info); rx_start()
3301 info->rx_enabled = false; rx_start()
3302 info->rx_overflow = false; rx_start()
3305 set_reg_bits(info, CHA + MODE, BIT3); rx_start()
3307 info->rx_enabled = true; rx_start()
3310 static void tx_start(MGSLPC_INFO *info, struct tty_struct *tty) tx_start() argument
3314 __FILE__, __LINE__, info->device_name); tx_start()
3316 if (info->tx_count) { tx_start()
3320 info->drop_rts_on_tx_done = false; tx_start()
3322 if (info->params.flags & HDLC_FLAG_AUTO_RTS) { tx_start()
3323 get_signals(info); tx_start()
3324 if (!(info->serial_signals & SerialSignal_RTS)) { tx_start()
3325 info->serial_signals |= SerialSignal_RTS; tx_start()
3326 set_signals(info); tx_start()
3327 info->drop_rts_on_tx_done = true; tx_start()
3331 if (info->params.mode == MGSL_MODE_ASYNC) { tx_start()
3332 if (!info->tx_active) { tx_start()
3333 info->tx_active = true; tx_start()
3334 tx_ready(info, tty); tx_start()
3337 info->tx_active = true; tx_start()
3338 tx_ready(info, tty); tx_start()
3339 mod_timer(&info->tx_timer, jiffies + tx_start()
3344 if (!info->tx_enabled) tx_start()
3345 info->tx_enabled = true; tx_start()
3348 static void tx_stop(MGSLPC_INFO *info) tx_stop() argument
3352 __FILE__, __LINE__, info->device_name); tx_stop()
3354 del_timer(&info->tx_timer); tx_stop()
3356 info->tx_enabled = false; tx_stop()
3357 info->tx_active = false; tx_stop()
3362 static void reset_device(MGSLPC_INFO *info) reset_device() argument
3365 write_reg(info, CHA + CCR0, 0x80); reset_device()
3366 write_reg(info, CHB + CCR0, 0x80); reset_device()
3367 write_reg(info, CHA + MODE, 0); reset_device()
3368 write_reg(info, CHB + MODE, 0); reset_device()
3371 irq_disable(info, CHA, 0xffff); reset_device()
3372 irq_disable(info, CHB, 0xffff); reset_device()
3373 port_irq_disable(info, 0xff); reset_device()
3385 write_reg(info, PCR, 0x06); reset_device()
3397 // write_reg(info, PVR, PVR_DTR); reset_device()
3409 write_reg(info, IPC, 0x05); reset_device()
3412 static void async_mode(MGSLPC_INFO *info) async_mode() argument
3417 irq_disable(info, CHA, 0xffff); async_mode()
3418 irq_disable(info, CHB, 0xffff); async_mode()
3419 port_irq_disable(info, 0xff); async_mode()
3435 if (info->params.loopback) async_mode()
3439 if (!(info->serial_signals & SerialSignal_RTS)) async_mode()
3441 write_reg(info, CHA + MODE, val); async_mode()
3453 write_reg(info, CHA + CCR0, 0x83); async_mode()
3464 write_reg(info, CHA + CCR1, 0x1f); async_mode()
3478 write_reg(info, CHA + CCR2, 0x10); async_mode()
3487 write_reg(info, CHA + CCR3, 0); async_mode()
3499 write_reg(info, CHA + CCR4, 0x50); async_mode()
3500 mgslpc_set_rate(info, CHA, info->params.data_rate * 16); async_mode()
3513 if (info->params.data_bits != 8) async_mode()
3515 if (info->params.stop_bits != 1) async_mode()
3517 if (info->params.parity != ASYNC_PARITY_NONE) async_mode()
3520 if (info->params.parity == ASYNC_PARITY_ODD) async_mode()
3525 write_reg(info, CHA + DAFO, val); async_mode()
3539 write_reg(info, CHA + RFC, 0x5c); async_mode()
3545 write_reg(info, CHA + RLCR, 0); async_mode()
3558 if (info->params.flags & HDLC_FLAG_AUTO_DCD) async_mode()
3560 write_reg(info, CHA + XBCH, val); async_mode()
3561 if (info->params.flags & HDLC_FLAG_AUTO_CTS) async_mode()
3562 irq_enable(info, CHA, IRQ_CTS); async_mode()
3565 set_reg_bits(info, CHA + MODE, BIT3); async_mode()
3566 enable_auxclk(info); async_mode()
3567 if (info->params.flags & HDLC_FLAG_AUTO_CTS) { async_mode()
3568 irq_enable(info, CHB, IRQ_CTS); async_mode()
3570 set_reg_bits(info, CHA + PVR, BIT3); async_mode()
3572 clear_reg_bits(info, CHA + PVR, BIT3); async_mode()
3573 irq_enable(info, CHA, async_mode()
3576 issue_command(info, CHA, CMD_TXRESET + CMD_RXRESET); async_mode()
3577 wait_command_complete(info, CHA); async_mode()
3578 read_reg16(info, CHA + ISR); /* clear pending IRQs */ async_mode()
3583 static void tx_set_idle(MGSLPC_INFO *info) tx_set_idle() argument
3586 if (info->idle_mode == HDLC_TXIDLE_FLAGS) tx_set_idle()
3587 set_reg_bits(info, CHA + CCR1, BIT3); tx_set_idle()
3589 clear_reg_bits(info, CHA + CCR1, BIT3); tx_set_idle()
3594 static void get_signals(MGSLPC_INFO *info) get_signals() argument
3599 info->serial_signals &= SerialSignal_RTS | SerialSignal_DTR; get_signals()
3601 if (read_reg(info, CHB + VSTR) & BIT7) get_signals()
3602 info->serial_signals |= SerialSignal_DCD; get_signals()
3603 if (read_reg(info, CHB + STAR) & BIT1) get_signals()
3604 info->serial_signals |= SerialSignal_CTS; get_signals()
3606 status = read_reg(info, CHA + PVR); get_signals()
3608 info->serial_signals |= SerialSignal_RI; get_signals()
3610 info->serial_signals |= SerialSignal_DSR; get_signals()
3616 static void set_signals(MGSLPC_INFO *info) set_signals() argument
3620 val = read_reg(info, CHA + MODE); set_signals()
3621 if (info->params.mode == MGSL_MODE_ASYNC) { set_signals()
3622 if (info->serial_signals & SerialSignal_RTS) set_signals()
3627 if (info->serial_signals & SerialSignal_RTS) set_signals()
3632 write_reg(info, CHA + MODE, val); set_signals()
3634 if (info->serial_signals & SerialSignal_DTR) set_signals()
3635 clear_reg_bits(info, CHA + PVR, PVR_DTR); set_signals()
3637 set_reg_bits(info, CHA + PVR, PVR_DTR); set_signals()
3640 static void rx_reset_buffers(MGSLPC_INFO *info) rx_reset_buffers() argument
3645 info->rx_put = 0; rx_reset_buffers()
3646 info->rx_get = 0; rx_reset_buffers()
3647 info->rx_frame_count = 0; rx_reset_buffers()
3648 for (i=0 ; i < info->rx_buf_count ; i++) { rx_reset_buffers()
3649 buf = (RXBUF*)(info->rx_buf + (i * info->rx_buf_size)); rx_reset_buffers()
3659 static bool rx_get_frame(MGSLPC_INFO *info, struct tty_struct *tty) rx_get_frame() argument
3667 if (info->rx_frame_count == 0) rx_get_frame()
3670 buf = (RXBUF*)(info->rx_buf + (info->rx_get * info->rx_buf_size)); rx_get_frame()
3681 info->icount.rxabort++; rx_get_frame()
3683 info->icount.rxover++; rx_get_frame()
3685 info->icount.rxcrc++; rx_get_frame()
3686 if (info->params.crc_type & HDLC_CRC_RETURN_EX) rx_get_frame()
3692 info->netdev->stats.rx_errors++; rx_get_frame()
3693 info->netdev->stats.rx_frame_errors++; rx_get_frame()
3704 __FILE__, __LINE__, info->device_name, status, framesize); rx_get_frame()
3707 trace_block(info, buf->data, framesize, 0); rx_get_frame()
3710 if ((info->params.crc_type & HDLC_CRC_RETURN_EX && rx_get_frame()
3711 framesize+1 > info->max_frame_size) || rx_get_frame()
3712 framesize > info->max_frame_size) rx_get_frame()
3713 info->icount.rxlong++; rx_get_frame()
3716 info->icount.rxok++; rx_get_frame()
3718 if (info->params.crc_type & HDLC_CRC_RETURN_EX) { rx_get_frame()
3724 if (info->netcount) rx_get_frame()
3725 hdlcdev_rx(info, buf->data, framesize); rx_get_frame()
3728 ldisc_receive_buf(tty, buf->data, info->flag_buf, framesize); rx_get_frame()
3732 spin_lock_irqsave(&info->lock, flags); rx_get_frame()
3734 info->rx_frame_count--; rx_get_frame()
3735 info->rx_get++; rx_get_frame()
3736 if (info->rx_get >= info->rx_buf_count) rx_get_frame()
3737 info->rx_get = 0; rx_get_frame()
3738 spin_unlock_irqrestore(&info->lock, flags); rx_get_frame()
3743 static bool register_test(MGSLPC_INFO *info) register_test() argument
3752 spin_lock_irqsave(&info->lock, flags); register_test()
3753 reset_device(info); register_test()
3756 write_reg(info, XAD1, patterns[i]); register_test()
3757 write_reg(info, XAD2, patterns[(i + 1) % count]); register_test()
3758 if ((read_reg(info, XAD1) != patterns[i]) || register_test()
3759 (read_reg(info, XAD2) != patterns[(i + 1) % count])) { register_test()
3765 spin_unlock_irqrestore(&info->lock, flags); register_test()
3769 static bool irq_test(MGSLPC_INFO *info) irq_test() argument
3774 spin_lock_irqsave(&info->lock, flags); irq_test()
3775 reset_device(info); irq_test()
3777 info->testing_irq = true; irq_test()
3778 hdlc_mode(info); irq_test()
3780 info->irq_occurred = false; irq_test()
3784 irq_enable(info, CHA, IRQ_TIMER); irq_test()
3785 write_reg(info, CHA + TIMR, 0); /* 512 cycles */ irq_test()
3786 issue_command(info, CHA, CMD_START_TIMER); irq_test()
3788 spin_unlock_irqrestore(&info->lock, flags); irq_test()
3791 while(end_time-- && !info->irq_occurred) { irq_test()
3795 info->testing_irq = false; irq_test()
3797 spin_lock_irqsave(&info->lock, flags); irq_test()
3798 reset_device(info); irq_test()
3799 spin_unlock_irqrestore(&info->lock, flags); irq_test()
3801 return info->irq_occurred; irq_test()
3804 static int adapter_test(MGSLPC_INFO *info) adapter_test() argument
3806 if (!register_test(info)) { adapter_test()
3807 info->init_error = DiagStatus_AddressFailure; adapter_test()
3809 __FILE__, __LINE__, info->device_name, (unsigned short)(info->io_base)); adapter_test()
3813 if (!irq_test(info)) { adapter_test()
3814 info->init_error = DiagStatus_IrqFailure; adapter_test()
3816 __FILE__, __LINE__, info->device_name, (unsigned short)(info->irq_level)); adapter_test()
3822 __FILE__, __LINE__, info->device_name); adapter_test()
3826 static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit) trace_block() argument
3831 printk("%s tx data:\n", info->device_name); trace_block()
3833 printk("%s rx data:\n", info->device_name); trace_block()
3863 MGSLPC_INFO *info = (MGSLPC_INFO*)context; tx_timeout() local
3868 __FILE__, __LINE__, info->device_name); tx_timeout()
3869 if (info->tx_active && tx_timeout()
3870 info->params.mode == MGSL_MODE_HDLC) { tx_timeout()
3871 info->icount.txtimeout++; tx_timeout()
3873 spin_lock_irqsave(&info->lock, flags); tx_timeout()
3874 info->tx_active = false; tx_timeout()
3875 info->tx_count = info->tx_put = info->tx_get = 0; tx_timeout()
3877 spin_unlock_irqrestore(&info->lock, flags); tx_timeout()
3880 if (info->netcount) tx_timeout()
3881 hdlcdev_tx_done(info); tx_timeout()
3885 struct tty_struct *tty = tty_port_tty_get(&info->port); tx_timeout()
3886 bh_transmit(info, tty); tx_timeout()
3906 MGSLPC_INFO *info = dev_to_port(dev); hdlcdev_attach() local
3912 if (info->port.count) hdlcdev_attach()
3933 info->params.encoding = new_encoding; hdlcdev_attach()
3934 info->params.crc_type = new_crctype; hdlcdev_attach()
3937 if (info->netcount) { hdlcdev_attach()
3938 tty = tty_port_tty_get(&info->port); hdlcdev_attach()
3939 mgslpc_program_hw(info, tty); hdlcdev_attach()
3955 MGSLPC_INFO *info = dev_to_port(dev); hdlcdev_xmit() local
3965 skb_copy_from_linear_data(skb, info->tx_buf, skb->len); hdlcdev_xmit()
3966 info->tx_get = 0; hdlcdev_xmit()
3967 info->tx_put = info->tx_count = skb->len; hdlcdev_xmit()
3980 spin_lock_irqsave(&info->lock, flags); hdlcdev_xmit()
3981 if (!info->tx_active) { hdlcdev_xmit()
3982 struct tty_struct *tty = tty_port_tty_get(&info->port); hdlcdev_xmit()
3983 tx_start(info, tty); hdlcdev_xmit()
3986 spin_unlock_irqrestore(&info->lock, flags); hdlcdev_xmit()
4001 MGSLPC_INFO *info = dev_to_port(dev); hdlcdev_open() local
4015 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
4016 if (info->port.count != 0 || info->netcount != 0) { hdlcdev_open()
4018 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
4021 info->netcount=1; hdlcdev_open()
4022 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
4024 tty = tty_port_tty_get(&info->port); hdlcdev_open()
4026 rc = startup(info, tty); hdlcdev_open()
4029 spin_lock_irqsave(&info->netlock, flags); hdlcdev_open()
4030 info->netcount=0; hdlcdev_open()
4031 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_open()
4035 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; hdlcdev_open()
4036 mgslpc_program_hw(info, tty); hdlcdev_open()
4044 spin_lock_irqsave(&info->lock, flags); hdlcdev_open()
4045 get_signals(info); hdlcdev_open()
4046 spin_unlock_irqrestore(&info->lock, flags); hdlcdev_open()
4047 if (info->serial_signals & SerialSignal_DCD) hdlcdev_open()
4064 MGSLPC_INFO *info = dev_to_port(dev); hdlcdev_close() local
4065 struct tty_struct *tty = tty_port_tty_get(&info->port); hdlcdev_close()
4074 shutdown(info, tty); hdlcdev_close()
4078 spin_lock_irqsave(&info->netlock, flags); hdlcdev_close()
4079 info->netcount=0; hdlcdev_close()
4080 spin_unlock_irqrestore(&info->netlock, flags); hdlcdev_close()
4099 MGSLPC_INFO *info = dev_to_port(dev); hdlcdev_ioctl() local
4106 if (info->port.count) hdlcdev_ioctl()
4123 flags = info->params.flags & (HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
4136 new_line.clock_rate = info->params.clock_speed; hdlcdev_ioctl()
4137 new_line.loopback = info->params.loopback ? 1:0; hdlcdev_ioctl()
4156 case CLOCK_DEFAULT: flags = info->params.flags & hdlcdev_ioctl()
4167 info->params.flags &= ~(HDLC_FLAG_RXC_RXCPIN | HDLC_FLAG_RXC_DPLL | hdlcdev_ioctl()
4171 info->params.flags |= flags; hdlcdev_ioctl()
4173 info->params.loopback = new_line.loopback; hdlcdev_ioctl()
4176 info->params.clock_speed = new_line.clock_rate; hdlcdev_ioctl()
4178 info->params.clock_speed = 0; hdlcdev_ioctl()
4181 if (info->netcount) { hdlcdev_ioctl()
4182 struct tty_struct *tty = tty_port_tty_get(&info->port); hdlcdev_ioctl()
4183 mgslpc_program_hw(info, tty); hdlcdev_ioctl()
4200 MGSLPC_INFO *info = dev_to_port(dev); hdlcdev_tx_timeout() local
4209 spin_lock_irqsave(&info->lock, flags); hdlcdev_tx_timeout()
4210 tx_stop(info); hdlcdev_tx_timeout()
4211 spin_unlock_irqrestore(&info->lock, flags); hdlcdev_tx_timeout()
4220 * info pointer to device instance information
4222 static void hdlcdev_tx_done(MGSLPC_INFO *info) hdlcdev_tx_done() argument
4224 if (netif_queue_stopped(info->netdev)) hdlcdev_tx_done()
4225 netif_wake_queue(info->netdev); hdlcdev_tx_done()
4232 * info pointer to device instance information
4236 static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size) hdlcdev_rx() argument
4239 struct net_device *dev = info->netdev; hdlcdev_rx()
4273 * info pointer to device instance information
4277 static int hdlcdev_init(MGSLPC_INFO *info) hdlcdev_init() argument
4285 dev = alloc_hdlcdev(info); hdlcdev_init()
4292 dev->base_addr = info->io_base; hdlcdev_init()
4293 dev->irq = info->irq_level; hdlcdev_init()
4313 info->netdev = dev; hdlcdev_init()
4321 * info pointer to device instance information
4323 static void hdlcdev_exit(MGSLPC_INFO *info) hdlcdev_exit() argument
4325 unregister_hdlc_device(info->netdev); hdlcdev_exit()
4326 free_netdev(info->netdev); hdlcdev_exit()
4327 info->netdev = NULL; hdlcdev_exit()
/linux-4.4.14/arch/arm/mach-omap1/include/mach/
H A Dcamera.h8 static inline void omap1_set_camera_info(struct omap1_cam_platform_data *info) omap1_set_camera_info() argument
10 omap1_camera_init(info); omap1_set_camera_info()
/linux-4.4.14/drivers/extcon/
H A Dextcon-arizona.c146 static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info);
148 static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info, arizona_extcon_hp_clamp() argument
151 struct arizona *arizona = info->arizona; arizona_extcon_hp_clamp()
233 static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode) arizona_extcon_set_mode() argument
235 struct arizona *arizona = info->arizona; arizona_extcon_set_mode()
237 mode %= info->micd_num_modes; arizona_extcon_set_mode()
241 info->micd_modes[mode].gpio); arizona_extcon_set_mode()
243 gpiod_set_value_cansleep(info->micd_pol_gpio, arizona_extcon_set_mode()
244 info->micd_modes[mode].gpio); arizona_extcon_set_mode()
248 info->micd_modes[mode].bias << arizona_extcon_set_mode()
251 ARIZONA_ACCDET_SRC, info->micd_modes[mode].src); arizona_extcon_set_mode()
253 info->micd_mode = mode; arizona_extcon_set_mode()
258 static const char *arizona_extcon_get_micbias(struct arizona_extcon_info *info) arizona_extcon_get_micbias() argument
260 switch (info->micd_modes[0].bias) { arizona_extcon_get_micbias()
272 static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info) arizona_extcon_pulse_micbias() argument
274 struct arizona *arizona = info->arizona; arizona_extcon_pulse_micbias()
275 const char *widget = arizona_extcon_get_micbias(info); arizona_extcon_pulse_micbias()
296 static void arizona_start_mic(struct arizona_extcon_info *info) arizona_start_mic() argument
298 struct arizona *arizona = info->arizona; arizona_start_mic()
304 pm_runtime_get(info->dev); arizona_start_mic()
306 if (info->detecting) { arizona_start_mic()
307 ret = regulator_allow_bypass(info->micvdd, false); arizona_start_mic()
315 ret = regulator_enable(info->micvdd); arizona_start_mic()
321 if (info->micd_reva) { arizona_start_mic()
327 if (info->detecting && arizona->pdata.micd_software_compare) arizona_start_mic()
336 arizona_extcon_pulse_micbias(info); arizona_start_mic()
342 regulator_disable(info->micvdd); arizona_start_mic()
343 pm_runtime_put_autosuspend(info->dev); arizona_start_mic()
347 static void arizona_stop_mic(struct arizona_extcon_info *info) arizona_stop_mic() argument
349 struct arizona *arizona = info->arizona; arizona_stop_mic()
350 const char *widget = arizona_extcon_get_micbias(info); arizona_stop_mic()
367 if (info->micd_reva) { arizona_stop_mic()
373 ret = regulator_allow_bypass(info->micvdd, true); arizona_stop_mic()
380 regulator_disable(info->micvdd); arizona_stop_mic()
381 pm_runtime_mark_last_busy(info->dev); arizona_stop_mic()
382 pm_runtime_put_autosuspend(info->dev); arizona_stop_mic()
408 static int arizona_hpdet_read(struct arizona_extcon_info *info) arizona_hpdet_read() argument
410 struct arizona *arizona = info->arizona; arizona_hpdet_read()
421 switch (info->hpdet_ip_version) { arizona_hpdet_read()
520 info->hpdet_ip_version); arizona_hpdet_read()
528 static int arizona_hpdet_do_id(struct arizona_extcon_info *info, int *reading, arizona_hpdet_do_id() argument
531 struct arizona *arizona = info->arizona; arizona_hpdet_do_id()
539 info->hpdet_res[info->num_hpdet_res++] = *reading; arizona_hpdet_do_id()
542 if (id_gpio && info->num_hpdet_res == 1) { arizona_hpdet_do_id()
550 info->micd_modes[0].src); arizona_hpdet_do_id()
562 info->hpdet_res[0], info->hpdet_res[1]); arizona_hpdet_do_id()
565 *reading = info->hpdet_res[0]; arizona_hpdet_do_id()
568 if (*reading >= ARIZONA_HPDET_MAX && !info->hpdet_retried) { arizona_hpdet_do_id()
570 info->num_hpdet_res = 0; arizona_hpdet_do_id()
571 info->hpdet_retried = true; arizona_hpdet_do_id()
572 arizona_start_hpdet_acc_id(info); arizona_hpdet_do_id()
573 pm_runtime_put(info->dev); arizona_hpdet_do_id()
580 if (!id_gpio || info->hpdet_res[1] > 50) { arizona_hpdet_do_id()
583 info->detecting = true; arizona_hpdet_do_id()
592 info->micd_modes[0].src); arizona_hpdet_do_id()
600 struct arizona_extcon_info *info = data; arizona_hpdet_irq() local
601 struct arizona *arizona = info->arizona; arizona_hpdet_irq()
607 mutex_lock(&info->lock); arizona_hpdet_irq()
610 if (!info->hpdet_active) { arizona_hpdet_irq()
612 mutex_unlock(&info->lock); arizona_hpdet_irq()
617 ret = extcon_get_cable_state_(info->edev, EXTCON_MECHANICAL); arizona_hpdet_irq()
627 ret = arizona_hpdet_read(info); arizona_hpdet_irq()
640 ret = arizona_hpdet_do_id(info, &reading, &mic); arizona_hpdet_irq()
652 ret = extcon_set_cable_state_(info->edev, report, true); arizona_hpdet_irq()
664 arizona_extcon_hp_clamp(info, false); arizona_hpdet_irq()
675 if (mic || info->mic) arizona_hpdet_irq()
676 arizona_start_mic(info); arizona_hpdet_irq()
678 if (info->hpdet_active) { arizona_hpdet_irq()
679 pm_runtime_put_autosuspend(info->dev); arizona_hpdet_irq()
680 info->hpdet_active = false; arizona_hpdet_irq()
683 info->hpdet_done = true; arizona_hpdet_irq()
686 mutex_unlock(&info->lock); arizona_hpdet_irq()
691 static void arizona_identify_headphone(struct arizona_extcon_info *info) arizona_identify_headphone() argument
693 struct arizona *arizona = info->arizona; arizona_identify_headphone()
696 if (info->hpdet_done) arizona_identify_headphone()
702 pm_runtime_get(info->dev); arizona_identify_headphone()
704 info->hpdet_active = true; arizona_identify_headphone()
706 if (info->mic) arizona_identify_headphone()
707 arizona_stop_mic(info); arizona_identify_headphone()
709 arizona_extcon_hp_clamp(info, true); arizona_identify_headphone()
735 ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true); arizona_identify_headphone()
739 if (info->mic) arizona_identify_headphone()
740 arizona_start_mic(info); arizona_identify_headphone()
742 info->hpdet_active = false; arizona_identify_headphone()
745 static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) arizona_start_hpdet_acc_id() argument
747 struct arizona *arizona = info->arizona; arizona_start_hpdet_acc_id()
755 pm_runtime_get_sync(info->dev); arizona_start_hpdet_acc_id()
757 info->hpdet_active = true; arizona_start_hpdet_acc_id()
759 arizona_extcon_hp_clamp(info, true); arizona_start_hpdet_acc_id()
764 info->micd_modes[0].src | arizona_start_hpdet_acc_id()
782 arizona_hpdet_do_id(info, &hp_reading, &mic); arizona_start_hpdet_acc_id()
792 ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true); arizona_start_hpdet_acc_id()
796 info->hpdet_active = false; arizona_start_hpdet_acc_id()
801 struct arizona_extcon_info *info = container_of(work, arizona_micd_timeout_work() local
805 mutex_lock(&info->lock); arizona_micd_timeout_work()
807 dev_dbg(info->arizona->dev, "MICD timed out, reporting HP\n"); arizona_micd_timeout_work()
809 info->detecting = false; arizona_micd_timeout_work()
811 arizona_identify_headphone(info); arizona_micd_timeout_work()
813 arizona_stop_mic(info); arizona_micd_timeout_work()
815 mutex_unlock(&info->lock); arizona_micd_timeout_work()
820 struct arizona_extcon_info *info = container_of(work, arizona_micd_detect() local
823 struct arizona *arizona = info->arizona; arizona_micd_detect()
827 cancel_delayed_work_sync(&info->micd_timeout_work); arizona_micd_detect()
829 mutex_lock(&info->lock); arizona_micd_detect()
832 ret = extcon_get_cable_state_(info->edev, EXTCON_MECHANICAL); arizona_micd_detect()
836 mutex_unlock(&info->lock); arizona_micd_detect()
840 mutex_unlock(&info->lock); arizona_micd_detect()
844 if (info->detecting && arizona->pdata.micd_software_compare) { arizona_micd_detect()
853 mutex_unlock(&info->lock); arizona_micd_detect()
880 mutex_unlock(&info->lock); arizona_micd_detect()
889 mutex_unlock(&info->lock); arizona_micd_detect()
896 mutex_unlock(&info->lock); arizona_micd_detect()
903 info->mic = false; arizona_micd_detect()
904 arizona_stop_mic(info); arizona_micd_detect()
905 info->detecting = false; arizona_micd_detect()
906 arizona_identify_headphone(info); arizona_micd_detect()
911 if (info->detecting && (val & ARIZONA_MICD_LVL_8)) { arizona_micd_detect()
912 info->mic = true; arizona_micd_detect()
913 info->detecting = false; arizona_micd_detect()
915 arizona_identify_headphone(info); arizona_micd_detect()
917 ret = extcon_set_cable_state_(info->edev, arizona_micd_detect()
924 ret = regulator_allow_bypass(info->micvdd, true); arizona_micd_detect()
939 if (info->detecting && (val & MICD_LVL_1_TO_7)) { arizona_micd_detect()
940 if (info->jack_flips >= info->micd_num_modes * 10) { arizona_micd_detect()
943 info->detecting = false; arizona_micd_detect()
945 arizona_identify_headphone(info); arizona_micd_detect()
947 arizona_stop_mic(info); arizona_micd_detect()
949 info->micd_mode++; arizona_micd_detect()
950 if (info->micd_mode == info->micd_num_modes) arizona_micd_detect()
951 info->micd_mode = 0; arizona_micd_detect()
952 arizona_extcon_set_mode(info, info->micd_mode); arizona_micd_detect()
954 info->jack_flips++; arizona_micd_detect()
965 if (info->mic) { arizona_micd_detect()
971 for (i = 0; i < info->num_micd_ranges; i++) arizona_micd_detect()
972 input_report_key(info->input, arizona_micd_detect()
973 info->micd_ranges[i].key, 0); arizona_micd_detect()
976 WARN_ON(ffs(lvl) - 1 >= info->num_micd_ranges); arizona_micd_detect()
977 if (lvl && ffs(lvl) - 1 < info->num_micd_ranges) { arizona_micd_detect()
978 key = info->micd_ranges[ffs(lvl) - 1].key; arizona_micd_detect()
979 input_report_key(info->input, key, 1); arizona_micd_detect()
980 input_sync(info->input); arizona_micd_detect()
983 } else if (info->detecting) { arizona_micd_detect()
985 info->detecting = false; arizona_micd_detect()
986 arizona_stop_mic(info); arizona_micd_detect()
988 arizona_identify_headphone(info); arizona_micd_detect()
995 for (i = 0; i < info->num_micd_ranges; i++) arizona_micd_detect()
996 input_report_key(info->input, arizona_micd_detect()
997 info->micd_ranges[i].key, 0); arizona_micd_detect()
998 input_sync(info->input); arizona_micd_detect()
999 arizona_extcon_pulse_micbias(info); arizona_micd_detect()
1003 if (info->detecting) { arizona_micd_detect()
1011 &info->micd_timeout_work, arizona_micd_detect()
1012 msecs_to_jiffies(info->micd_timeout)); arizona_micd_detect()
1015 pm_runtime_mark_last_busy(info->dev); arizona_micd_detect()
1016 mutex_unlock(&info->lock); arizona_micd_detect()
1021 struct arizona_extcon_info *info = data; arizona_micdet() local
1022 struct arizona *arizona = info->arizona; arizona_micdet()
1025 cancel_delayed_work_sync(&info->micd_detect_work); arizona_micdet()
1026 cancel_delayed_work_sync(&info->micd_timeout_work); arizona_micdet()
1028 mutex_lock(&info->lock); arizona_micdet()
1029 if (!info->detecting) arizona_micdet()
1031 mutex_unlock(&info->lock); arizona_micdet()
1035 &info->micd_detect_work, arizona_micdet()
1038 arizona_micd_detect(&info->micd_detect_work.work); arizona_micdet()
1045 struct arizona_extcon_info *info = container_of(work, arizona_hpdet_work() local
1049 mutex_lock(&info->lock); arizona_hpdet_work()
1050 arizona_start_hpdet_acc_id(info); arizona_hpdet_work()
1051 mutex_unlock(&info->lock); arizona_hpdet_work()
1056 struct arizona_extcon_info *info = data; arizona_jackdet() local
1057 struct arizona *arizona = info->arizona; arizona_jackdet()
1062 cancelled_hp = cancel_delayed_work_sync(&info->hpdet_work); arizona_jackdet()
1063 cancelled_mic = cancel_delayed_work_sync(&info->micd_timeout_work); arizona_jackdet()
1065 pm_runtime_get_sync(info->dev); arizona_jackdet()
1067 mutex_lock(&info->lock); arizona_jackdet()
1069 if (info->micd_clamp) { arizona_jackdet()
1084 mutex_unlock(&info->lock); arizona_jackdet()
1085 pm_runtime_put_autosuspend(info->dev); arizona_jackdet()
1090 if (val == info->last_jackdet) { arizona_jackdet()
1094 &info->hpdet_work, arizona_jackdet()
1098 int micd_timeout = info->micd_timeout; arizona_jackdet()
1101 &info->micd_timeout_work, arizona_jackdet()
1107 info->last_jackdet = val; arizona_jackdet()
1109 if (info->last_jackdet == present) { arizona_jackdet()
1111 ret = extcon_set_cable_state_(info->edev, arizona_jackdet()
1119 info->detecting = true; arizona_jackdet()
1120 info->mic = false; arizona_jackdet()
1121 info->jack_flips = 0; arizona_jackdet()
1123 arizona_start_mic(info); arizona_jackdet()
1126 &info->hpdet_work, arizona_jackdet()
1130 if (info->micd_clamp || !arizona->pdata.jd_invert) arizona_jackdet()
1138 arizona_stop_mic(info); arizona_jackdet()
1140 info->num_hpdet_res = 0; arizona_jackdet()
1141 for (i = 0; i < ARRAY_SIZE(info->hpdet_res); i++) arizona_jackdet()
1142 info->hpdet_res[i] = 0; arizona_jackdet()
1143 info->mic = false; arizona_jackdet()
1144 info->hpdet_done = false; arizona_jackdet()
1145 info->hpdet_retried = false; arizona_jackdet()
1147 for (i = 0; i < info->num_micd_ranges; i++) arizona_jackdet()
1148 input_report_key(info->input, arizona_jackdet()
1149 info->micd_ranges[i].key, 0); arizona_jackdet()
1150 input_sync(info->input); arizona_jackdet()
1152 ret = extcon_update_state(info->edev, 0xffffffff, 0); arizona_jackdet()
1164 info->micd_timeout = arizona->pdata.micd_timeout; arizona_jackdet()
1166 info->micd_timeout = DEFAULT_MICD_TIMEOUT; arizona_jackdet()
1176 mutex_unlock(&info->lock); arizona_jackdet()
1178 pm_runtime_mark_last_busy(info->dev); arizona_jackdet()
1179 pm_runtime_put_autosuspend(info->dev); arizona_jackdet()
1246 struct arizona_extcon_info *info; arizona_extcon_probe() local
1255 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); arizona_extcon_probe()
1256 if (!info) arizona_extcon_probe()
1262 info->micvdd = devm_regulator_get(&pdev->dev, "MICVDD"); arizona_extcon_probe()
1263 if (IS_ERR(info->micvdd)) { arizona_extcon_probe()
1264 ret = PTR_ERR(info->micvdd); arizona_extcon_probe()
1269 mutex_init(&info->lock); arizona_extcon_probe()
1270 info->arizona = arizona; arizona_extcon_probe()
1271 info->dev = &pdev->dev; arizona_extcon_probe()
1272 info->last_jackdet = ~(ARIZONA_MICD_CLAMP_STS | ARIZONA_JD1_STS); arizona_extcon_probe()
1273 INIT_DELAYED_WORK(&info->hpdet_work, arizona_hpdet_work); arizona_extcon_probe()
1274 INIT_DELAYED_WORK(&info->micd_detect_work, arizona_micd_detect); arizona_extcon_probe()
1275 INIT_DELAYED_WORK(&info->micd_timeout_work, arizona_micd_timeout_work); arizona_extcon_probe()
1276 platform_set_drvdata(pdev, info); arizona_extcon_probe()
1282 info->micd_reva = true; arizona_extcon_probe()
1285 info->micd_clamp = true; arizona_extcon_probe()
1286 info->hpdet_ip_version = 1; arizona_extcon_probe()
1296 info->micd_clamp = true; arizona_extcon_probe()
1297 info->hpdet_ip_version = 2; arizona_extcon_probe()
1303 info->micd_clamp = true; arizona_extcon_probe()
1304 info->hpdet_ip_version = 2; arizona_extcon_probe()
1310 info->edev = devm_extcon_dev_allocate(&pdev->dev, arizona_cable); arizona_extcon_probe()
1311 if (IS_ERR(info->edev)) { arizona_extcon_probe()
1316 ret = devm_extcon_dev_register(&pdev->dev, info->edev); arizona_extcon_probe()
1323 info->input = devm_input_allocate_device(&pdev->dev); arizona_extcon_probe()
1324 if (!info->input) { arizona_extcon_probe()
1330 info->input->name = "Headset"; arizona_extcon_probe()
1331 info->input->phys = "arizona/extcon"; arizona_extcon_probe()
1334 info->micd_modes = pdata->micd_configs; arizona_extcon_probe()
1335 info->micd_num_modes = pdata->num_micd_configs; arizona_extcon_probe()
1337 info->micd_modes = micd_default_modes; arizona_extcon_probe()
1338 info->micd_num_modes = ARRAY_SIZE(micd_default_modes); arizona_extcon_probe()
1346 if (info->micd_modes[0].gpio) arizona_extcon_probe()
1361 if (info->micd_modes[0].gpio) arizona_extcon_probe()
1371 info->micd_pol_gpio = gpiod_get_optional(arizona->dev, arizona_extcon_probe()
1374 if (IS_ERR(info->micd_pol_gpio)) { arizona_extcon_probe()
1375 ret = PTR_ERR(info->micd_pol_gpio); arizona_extcon_probe()
1425 info->micd_ranges = pdata->micd_ranges; arizona_extcon_probe()
1426 info->num_micd_ranges = pdata->num_micd_ranges; arizona_extcon_probe()
1428 info->micd_ranges = micd_default_ranges; arizona_extcon_probe()
1429 info->num_micd_ranges = ARRAY_SIZE(micd_default_ranges); arizona_extcon_probe()
1437 if (info->num_micd_ranges > 1) { arizona_extcon_probe()
1438 for (i = 1; i < info->num_micd_ranges; i++) { arizona_extcon_probe()
1439 if (info->micd_ranges[i - 1].max > arizona_extcon_probe()
1440 info->micd_ranges[i].max) { arizona_extcon_probe()
1454 for (i = 0; i < info->num_micd_ranges; i++) { arizona_extcon_probe()
1456 if (arizona_micd_levels[j] >= info->micd_ranges[i].max) arizona_extcon_probe()
1461 info->micd_ranges[i].max); arizona_extcon_probe()
1470 input_set_capability(info->input, EV_KEY, arizona_extcon_probe()
1471 info->micd_ranges[i].key); arizona_extcon_probe()
1486 if (info->micd_clamp) { arizona_extcon_probe()
1517 arizona_extcon_set_mode(info, 0); arizona_extcon_probe()
1523 if (info->micd_clamp) { arizona_extcon_probe()
1532 "JACKDET rise", arizona_jackdet, info); arizona_extcon_probe()
1547 "JACKDET fall", arizona_jackdet, info); arizona_extcon_probe()
1561 "MICDET", arizona_micdet, info); arizona_extcon_probe()
1568 "HPDET", arizona_hpdet_irq, info); arizona_extcon_probe()
1580 ret = regulator_allow_bypass(info->micvdd, true); arizona_extcon_probe()
1587 ret = input_register_device(info->input); arizona_extcon_probe()
1596 arizona_free_irq(arizona, ARIZONA_IRQ_HPDET, info); arizona_extcon_probe()
1598 arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info); arizona_extcon_probe()
1602 arizona_free_irq(arizona, jack_irq_fall, info); arizona_extcon_probe()
1606 arizona_free_irq(arizona, jack_irq_rise, info); arizona_extcon_probe()
1608 gpiod_put(info->micd_pol_gpio); arizona_extcon_probe()
1616 struct arizona_extcon_info *info = platform_get_drvdata(pdev); arizona_extcon_remove() local
1617 struct arizona *arizona = info->arizona; arizona_extcon_remove()
1620 gpiod_put(info->micd_pol_gpio); arizona_extcon_remove()
1628 if (info->micd_clamp) { arizona_extcon_remove()
1638 arizona_free_irq(arizona, ARIZONA_IRQ_HPDET, info); arizona_extcon_remove()
1639 arizona_free_irq(arizona, ARIZONA_IRQ_MICDET, info); arizona_extcon_remove()
1640 arizona_free_irq(arizona, jack_irq_rise, info); arizona_extcon_remove()
1641 arizona_free_irq(arizona, jack_irq_fall, info); arizona_extcon_remove()
1642 cancel_delayed_work_sync(&info->hpdet_work); arizona_extcon_remove()
H A Dextcon-rt8973a.c223 static int rt8973a_muic_set_path(struct rt8973a_muic_info *info, rt8973a_muic_set_path() argument
232 if (info->auto_config) rt8973a_muic_set_path()
242 ret = regmap_update_bits(info->regmap, RT8973A_REG_MANUAL_SW1, rt8973a_muic_set_path()
247 dev_err(info->dev, rt8973a_muic_set_path()
253 dev_err(info->dev, "Unknown DM_CON/DP_CON switch type (%d)\n", rt8973a_muic_set_path()
261 static int rt8973a_muic_get_cable_type(struct rt8973a_muic_info *info) rt8973a_muic_get_cable_type() argument
267 ret = regmap_read(info->regmap, RT8973A_REG_ADC, &adc); rt8973a_muic_get_cable_type()
269 dev_err(info->dev, "failed to read ADC register\n"); rt8973a_muic_get_cable_type()
275 ret = regmap_read(info->regmap, RT8973A_REG_DEV1, &dev1); rt8973a_muic_get_cable_type()
277 dev_err(info->dev, "failed to read DEV1 register\n"); rt8973a_muic_get_cable_type()
297 static int rt8973a_muic_cable_handler(struct rt8973a_muic_info *info, rt8973a_muic_cable_handler() argument
308 cable_type = rt8973a_muic_get_cable_type(info); rt8973a_muic_cable_handler()
317 dev_warn(info->dev, rt8973a_muic_cable_handler()
324 dev_err(info->dev, rt8973a_muic_cable_handler()
360 dev_warn(info->dev, rt8973a_muic_cable_handler()
377 dev_warn(info->dev, rt8973a_muic_cable_handler()
388 dev_err(info->dev, rt8973a_muic_cable_handler()
395 ret = rt8973a_muic_set_path(info, con_sw, attached); rt8973a_muic_cable_handler()
400 extcon_set_cable_state_(info->edev, id, attached); rt8973a_muic_cable_handler()
407 struct rt8973a_muic_info *info = container_of(work, rt8973a_muic_irq_work() local
411 if (!info->edev) rt8973a_muic_irq_work()
414 mutex_lock(&info->mutex); rt8973a_muic_irq_work()
417 if (info->irq_attach) { rt8973a_muic_irq_work()
418 ret = rt8973a_muic_cable_handler(info, RT8973A_EVENT_ATTACH); rt8973a_muic_irq_work()
419 info->irq_attach = false; rt8973a_muic_irq_work()
422 if (info->irq_detach) { rt8973a_muic_irq_work()
423 ret = rt8973a_muic_cable_handler(info, RT8973A_EVENT_DETACH); rt8973a_muic_irq_work()
424 info->irq_detach = false; rt8973a_muic_irq_work()
427 if (info->irq_ovp) { rt8973a_muic_irq_work()
428 ret = rt8973a_muic_cable_handler(info, RT8973A_EVENT_OVP); rt8973a_muic_irq_work()
429 info->irq_ovp = false; rt8973a_muic_irq_work()
432 if (info->irq_otp) { rt8973a_muic_irq_work()
433 ret = rt8973a_muic_cable_handler(info, RT8973A_EVENT_OTP); rt8973a_muic_irq_work()
434 info->irq_otp = false; rt8973a_muic_irq_work()
438 dev_err(info->dev, "failed to handle MUIC interrupt\n"); rt8973a_muic_irq_work()
440 mutex_unlock(&info->mutex); rt8973a_muic_irq_work()
445 struct rt8973a_muic_info *info = data; rt8973a_muic_irq_handler() local
448 for (i = 0; i < info->num_muic_irqs; i++) rt8973a_muic_irq_handler()
449 if (irq == info->muic_irqs[i].virq) rt8973a_muic_irq_handler()
450 irq_type = info->muic_irqs[i].irq; rt8973a_muic_irq_handler()
454 info->irq_attach = true; rt8973a_muic_irq_handler()
457 info->irq_detach = true; rt8973a_muic_irq_handler()
460 info->irq_ovp = true; rt8973a_muic_irq_handler()
463 info->irq_otp = true; rt8973a_muic_irq_handler()
477 dev_dbg(info->dev, rt8973a_muic_irq_handler()
482 schedule_work(&info->irq_work); rt8973a_muic_irq_handler()
489 struct rt8973a_muic_info *info = container_of(to_delayed_work(work), rt8973a_muic_detect_cable_wq() local
494 ret = rt8973a_muic_cable_handler(info, RT8973A_EVENT_ATTACH); rt8973a_muic_detect_cable_wq()
496 dev_warn(info->dev, "failed to detect cable state\n"); rt8973a_muic_detect_cable_wq()
499 static void rt8973a_init_dev_type(struct rt8973a_muic_info *info) rt8973a_init_dev_type() argument
505 ret = regmap_read(info->regmap, RT8973A_REG_DEVICE_ID, &data); rt8973a_init_dev_type()
507 dev_err(info->dev, rt8973a_init_dev_type()
517 dev_info(info->dev, "Device type: version: 0x%x, vendor: 0x%x\n", rt8973a_init_dev_type()
521 for (i = 0; i < info->num_reg_data; i++) { rt8973a_init_dev_type()
522 u8 reg = info->reg_data[i].reg; rt8973a_init_dev_type()
523 u8 mask = info->reg_data[i].mask; rt8973a_init_dev_type()
526 if (info->reg_data[i].invert) rt8973a_init_dev_type()
527 val = ~info->reg_data[i].val; rt8973a_init_dev_type()
529 val = info->reg_data[i].val; rt8973a_init_dev_type()
531 regmap_update_bits(info->regmap, reg, mask, val); rt8973a_init_dev_type()
535 ret = regmap_read(info->regmap, RT8973A_REG_CONTROL1, &data); rt8973a_init_dev_type()
537 dev_err(info->dev, rt8973a_init_dev_type()
544 info->auto_config = true; rt8973a_init_dev_type()
545 dev_info(info->dev, rt8973a_init_dev_type()
554 struct rt8973a_muic_info *info; rt8973a_muic_i2c_probe() local
560 info = devm_kzalloc(&i2c->dev, sizeof(*info), GFP_KERNEL); rt8973a_muic_i2c_probe()
561 if (!info) rt8973a_muic_i2c_probe()
563 i2c_set_clientdata(i2c, info); rt8973a_muic_i2c_probe()
565 info->dev = &i2c->dev; rt8973a_muic_i2c_probe()
566 info->i2c = i2c; rt8973a_muic_i2c_probe()
567 info->irq = i2c->irq; rt8973a_muic_i2c_probe()
568 info->muic_irqs = rt8973a_muic_irqs; rt8973a_muic_i2c_probe()
569 info->num_muic_irqs = ARRAY_SIZE(rt8973a_muic_irqs); rt8973a_muic_i2c_probe()
570 info->reg_data = rt8973a_reg_data; rt8973a_muic_i2c_probe()
571 info->num_reg_data = ARRAY_SIZE(rt8973a_reg_data); rt8973a_muic_i2c_probe()
573 mutex_init(&info->mutex); rt8973a_muic_i2c_probe()
575 INIT_WORK(&info->irq_work, rt8973a_muic_irq_work); rt8973a_muic_i2c_probe()
577 info->regmap = devm_regmap_init_i2c(i2c, &rt8973a_muic_regmap_config); rt8973a_muic_i2c_probe()
578 if (IS_ERR(info->regmap)) { rt8973a_muic_i2c_probe()
579 ret = PTR_ERR(info->regmap); rt8973a_muic_i2c_probe()
580 dev_err(info->dev, "failed to allocate register map: %d\n", rt8973a_muic_i2c_probe()
587 ret = regmap_add_irq_chip(info->regmap, info->irq, irq_flags, 0, rt8973a_muic_i2c_probe()
588 &rt8973a_muic_irq_chip, &info->irq_data); rt8973a_muic_i2c_probe()
590 dev_err(info->dev, "failed to add irq_chip (irq:%d, err:%d)\n", rt8973a_muic_i2c_probe()
591 info->irq, ret); rt8973a_muic_i2c_probe()
595 for (i = 0; i < info->num_muic_irqs; i++) { rt8973a_muic_i2c_probe()
596 struct muic_irq *muic_irq = &info->muic_irqs[i]; rt8973a_muic_i2c_probe()
599 virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq); rt8973a_muic_i2c_probe()
604 ret = devm_request_threaded_irq(info->dev, virq, NULL, rt8973a_muic_i2c_probe()
607 muic_irq->name, info); rt8973a_muic_i2c_probe()
609 dev_err(info->dev, rt8973a_muic_i2c_probe()
617 info->edev = devm_extcon_dev_allocate(info->dev, rt8973a_extcon_cable); rt8973a_muic_i2c_probe()
618 if (IS_ERR(info->edev)) { rt8973a_muic_i2c_probe()
619 dev_err(info->dev, "failed to allocate memory for extcon\n"); rt8973a_muic_i2c_probe()
624 ret = devm_extcon_dev_register(info->dev, info->edev); rt8973a_muic_i2c_probe()
626 dev_err(info->dev, "failed to register extcon device\n"); rt8973a_muic_i2c_probe()
638 INIT_DELAYED_WORK(&info->wq_detcable, rt8973a_muic_detect_cable_wq); rt8973a_muic_i2c_probe()
639 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, rt8973a_muic_i2c_probe()
643 rt8973a_init_dev_type(info); rt8973a_muic_i2c_probe()
650 struct rt8973a_muic_info *info = i2c_get_clientdata(i2c); rt8973a_muic_i2c_remove() local
652 regmap_del_irq_chip(info->irq, info->irq_data); rt8973a_muic_i2c_remove()
667 struct rt8973a_muic_info *info = i2c_get_clientdata(i2c); rt8973a_muic_suspend() local
669 enable_irq_wake(info->irq); rt8973a_muic_suspend()
677 struct rt8973a_muic_info *info = i2c_get_clientdata(i2c); rt8973a_muic_resume() local
679 disable_irq_wake(info->irq); rt8973a_muic_resume()
H A Dextcon-usb-gpio.c52 struct usb_extcon_info *info = container_of(to_delayed_work(work), usb_extcon_detect_cable() local
57 id = gpiod_get_value_cansleep(info->id_gpiod); usb_extcon_detect_cable()
64 extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, false); usb_extcon_detect_cable()
65 extcon_set_cable_state_(info->edev, EXTCON_USB, true); usb_extcon_detect_cable()
72 extcon_set_cable_state_(info->edev, EXTCON_USB, false); usb_extcon_detect_cable()
73 extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, true); usb_extcon_detect_cable()
79 struct usb_extcon_info *info = dev_id; usb_irq_handler() local
81 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, usb_irq_handler()
82 info->debounce_jiffies); usb_irq_handler()
91 struct usb_extcon_info *info; usb_extcon_probe() local
97 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); usb_extcon_probe()
98 if (!info) usb_extcon_probe()
101 info->dev = dev; usb_extcon_probe()
102 info->id_gpiod = devm_gpiod_get(&pdev->dev, "id", GPIOD_IN); usb_extcon_probe()
103 if (IS_ERR(info->id_gpiod)) { usb_extcon_probe()
105 return PTR_ERR(info->id_gpiod); usb_extcon_probe()
108 info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable); usb_extcon_probe()
109 if (IS_ERR(info->edev)) { usb_extcon_probe()
114 ret = devm_extcon_dev_register(dev, info->edev); usb_extcon_probe()
120 ret = gpiod_set_debounce(info->id_gpiod, usb_extcon_probe()
123 info->debounce_jiffies = msecs_to_jiffies(USB_GPIO_DEBOUNCE_MS); usb_extcon_probe()
125 INIT_DELAYED_WORK(&info->wq_detcable, usb_extcon_detect_cable); usb_extcon_probe()
127 info->id_irq = gpiod_to_irq(info->id_gpiod); usb_extcon_probe()
128 if (info->id_irq < 0) { usb_extcon_probe()
130 return info->id_irq; usb_extcon_probe()
133 ret = devm_request_threaded_irq(dev, info->id_irq, NULL, usb_extcon_probe()
137 pdev->name, info); usb_extcon_probe()
143 platform_set_drvdata(pdev, info); usb_extcon_probe()
147 usb_extcon_detect_cable(&info->wq_detcable.work); usb_extcon_probe()
154 struct usb_extcon_info *info = platform_get_drvdata(pdev); usb_extcon_remove() local
156 cancel_delayed_work_sync(&info->wq_detcable); usb_extcon_remove()
164 struct usb_extcon_info *info = dev_get_drvdata(dev); usb_extcon_suspend() local
168 ret = enable_irq_wake(info->id_irq); usb_extcon_suspend()
178 disable_irq(info->id_irq); usb_extcon_suspend()
185 struct usb_extcon_info *info = dev_get_drvdata(dev); usb_extcon_resume() local
189 ret = disable_irq_wake(info->id_irq); usb_extcon_resume()
194 enable_irq(info->id_irq); usb_extcon_resume()
H A Dextcon-axp288.c139 static void axp288_extcon_log_rsi(struct axp288_extcon_info *info) axp288_extcon_log_rsi() argument
145 ret = regmap_read(info->regmap, AXP288_PS_BOOT_REASON_REG, &val); axp288_extcon_log_rsi()
148 dev_dbg(info->dev, "%s\n", *rsi); axp288_extcon_log_rsi()
154 regmap_write(info->regmap, AXP288_PS_BOOT_REASON_REG, clear_mask); axp288_extcon_log_rsi()
157 static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info) axp288_handle_chrg_det_event() argument
165 ret = regmap_read(info->regmap, AXP288_PS_STAT_REG, &pwr_stat); axp288_handle_chrg_det_event()
167 dev_err(info->dev, "failed to read vbus status\n"); axp288_handle_chrg_det_event()
176 ret = regmap_read(info->regmap, AXP288_BC_GLOBAL_REG, &cfg); axp288_handle_chrg_det_event()
180 dev_dbg(info->dev, "can't complete the charger detection\n"); axp288_handle_chrg_det_event()
184 ret = regmap_read(info->regmap, AXP288_BC_DET_STAT_REG, &stat); axp288_handle_chrg_det_event()
192 dev_dbg(info->dev, "sdp cable is connecetd\n"); axp288_handle_chrg_det_event()
198 dev_dbg(info->dev, "cdp cable is connecetd\n"); axp288_handle_chrg_det_event()
204 dev_dbg(info->dev, "dcp cable is connecetd\n"); axp288_handle_chrg_det_event()
209 dev_warn(info->dev, axp288_handle_chrg_det_event()
219 if (info->pdata->gpio_mux_cntl) axp288_handle_chrg_det_event()
220 gpiod_set_value(info->pdata->gpio_mux_cntl, axp288_handle_chrg_det_event()
224 atomic_notifier_call_chain(&info->otg->notifier, axp288_handle_chrg_det_event()
229 extcon_set_cable_state_(info->edev, cable, vbus_attach); axp288_handle_chrg_det_event()
239 dev_err(info->dev, "failed to detect BC Mod\n"); axp288_handle_chrg_det_event()
246 struct axp288_extcon_info *info = data; axp288_extcon_isr() local
249 ret = axp288_handle_chrg_det_event(info); axp288_extcon_isr()
251 dev_err(info->dev, "failed to handle the interrupt\n"); axp288_extcon_isr()
256 static void axp288_extcon_enable_irq(struct axp288_extcon_info *info) axp288_extcon_enable_irq() argument
259 regmap_write(info->regmap, AXP288_PWRSRC_IRQ_CFG_REG, axp288_extcon_enable_irq()
261 regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG, axp288_extcon_enable_irq()
264 regmap_write(info->regmap, AXP288_BC12_IRQ_CFG_REG, BC12_IRQ_CFG_MASK); axp288_extcon_enable_irq()
266 regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG, axp288_extcon_enable_irq()
272 struct axp288_extcon_info *info; axp288_extcon_probe() local
276 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); axp288_extcon_probe()
277 if (!info) axp288_extcon_probe()
280 info->dev = &pdev->dev; axp288_extcon_probe()
281 info->regmap = axp20x->regmap; axp288_extcon_probe()
282 info->regmap_irqc = axp20x->regmap_irqc; axp288_extcon_probe()
283 info->pdata = pdev->dev.platform_data; axp288_extcon_probe()
285 if (!info->pdata) { axp288_extcon_probe()
292 platform_set_drvdata(pdev, info); axp288_extcon_probe()
294 axp288_extcon_log_rsi(info); axp288_extcon_probe()
297 info->edev = devm_extcon_dev_allocate(&pdev->dev, axp288_extcon_probe()
299 if (IS_ERR(info->edev)) { axp288_extcon_probe()
301 return PTR_ERR(info->edev); axp288_extcon_probe()
305 ret = devm_extcon_dev_register(&pdev->dev, info->edev); axp288_extcon_probe()
312 info->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); axp288_extcon_probe()
313 if (IS_ERR(info->otg)) { axp288_extcon_probe()
315 return PTR_ERR(info->otg); axp288_extcon_probe()
319 if (info->pdata->gpio_mux_cntl) { axp288_extcon_probe()
320 gpio = desc_to_gpio(info->pdata->gpio_mux_cntl); axp288_extcon_probe()
327 gpiod_direction_output(info->pdata->gpio_mux_cntl, axp288_extcon_probe()
333 info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq); axp288_extcon_probe()
334 if (info->irq[i] < 0) { axp288_extcon_probe()
337 ret = info->irq[i]; axp288_extcon_probe()
341 ret = devm_request_threaded_irq(&pdev->dev, info->irq[i], axp288_extcon_probe()
344 pdev->name, info); axp288_extcon_probe()
347 info->irq[i]); axp288_extcon_probe()
353 axp288_extcon_enable_irq(info); axp288_extcon_probe()
H A Dextcon-sm5502.c219 static int sm5502_muic_set_path(struct sm5502_muic_info *info, sm5502_muic_set_path() argument
235 ret = regmap_update_bits(info->regmap, SM5502_REG_MANUAL_SW1, sm5502_muic_set_path()
240 dev_err(info->dev, sm5502_muic_set_path()
246 dev_err(info->dev, "Unknown DM_CON/DP_CON switch type (%d)\n", sm5502_muic_set_path()
256 ret = regmap_update_bits(info->regmap, SM5502_REG_MANUAL_SW1, sm5502_muic_set_path()
260 dev_err(info->dev, sm5502_muic_set_path()
266 dev_err(info->dev, "Unknown VBUS switch type (%d)\n", vbus_sw); sm5502_muic_set_path()
274 static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info) sm5502_muic_get_cable_type() argument
280 ret = regmap_read(info->regmap, SM5502_REG_ADC, &adc); sm5502_muic_get_cable_type()
282 dev_err(info->dev, "failed to read ADC register\n"); sm5502_muic_get_cable_type()
335 ret = regmap_read(info->regmap, SM5502_REG_DEV_TYPE1, sm5502_muic_get_cable_type()
338 dev_err(info->dev, "failed to read DEV_TYPE1 reg\n"); sm5502_muic_get_cable_type()
353 dev_dbg(info->dev, sm5502_muic_get_cable_type()
360 dev_err(info->dev, sm5502_muic_get_cable_type()
368 static int sm5502_muic_cable_handler(struct sm5502_muic_info *info, sm5502_muic_cable_handler() argument
380 cable_type = sm5502_muic_get_cable_type(info); sm5502_muic_cable_handler()
402 dev_dbg(info->dev, sm5502_muic_cable_handler()
408 ret = sm5502_muic_set_path(info, con_sw, vbus_sw, attached); sm5502_muic_cable_handler()
413 extcon_set_cable_state_(info->edev, id, attached); sm5502_muic_cable_handler()
420 struct sm5502_muic_info *info = container_of(work, sm5502_muic_irq_work() local
424 if (!info->edev) sm5502_muic_irq_work()
427 mutex_lock(&info->mutex); sm5502_muic_irq_work()
430 if (info->irq_attach) { sm5502_muic_irq_work()
431 ret = sm5502_muic_cable_handler(info, true); sm5502_muic_irq_work()
432 info->irq_attach = false; sm5502_muic_irq_work()
434 if (info->irq_detach) { sm5502_muic_irq_work()
435 ret = sm5502_muic_cable_handler(info, false); sm5502_muic_irq_work()
436 info->irq_detach = false; sm5502_muic_irq_work()
440 dev_err(info->dev, "failed to handle MUIC interrupt\n"); sm5502_muic_irq_work()
442 mutex_unlock(&info->mutex); sm5502_muic_irq_work()
449 static int sm5502_parse_irq(struct sm5502_muic_info *info, int irq_type) sm5502_parse_irq() argument
453 info->irq_attach = true; sm5502_parse_irq()
456 info->irq_detach = true; sm5502_parse_irq()
479 struct sm5502_muic_info *info = data; sm5502_muic_irq_handler() local
482 for (i = 0; i < info->num_muic_irqs; i++) sm5502_muic_irq_handler()
483 if (irq == info->muic_irqs[i].virq) sm5502_muic_irq_handler()
484 irq_type = info->muic_irqs[i].irq; sm5502_muic_irq_handler()
486 ret = sm5502_parse_irq(info, irq_type); sm5502_muic_irq_handler()
488 dev_warn(info->dev, "cannot handle is interrupt:%d\n", sm5502_muic_irq_handler()
492 schedule_work(&info->irq_work); sm5502_muic_irq_handler()
499 struct sm5502_muic_info *info = container_of(to_delayed_work(work), sm5502_muic_detect_cable_wq() local
504 ret = sm5502_muic_cable_handler(info, true); sm5502_muic_detect_cable_wq()
506 dev_warn(info->dev, "failed to detect cable state\n"); sm5502_muic_detect_cable_wq()
509 static void sm5502_init_dev_type(struct sm5502_muic_info *info) sm5502_init_dev_type() argument
515 ret = regmap_read(info->regmap, SM5502_REG_DEVICE_ID, &reg_data); sm5502_init_dev_type()
517 dev_err(info->dev, sm5502_init_dev_type()
527 dev_info(info->dev, "Device type: version: 0x%x, vendor: 0x%x\n", sm5502_init_dev_type()
531 for (i = 0; i < info->num_reg_data; i++) { sm5502_init_dev_type()
534 if (!info->reg_data[i].invert) sm5502_init_dev_type()
535 val |= ~info->reg_data[i].val; sm5502_init_dev_type()
537 val = info->reg_data[i].val; sm5502_init_dev_type()
538 regmap_write(info->regmap, info->reg_data[i].reg, val); sm5502_init_dev_type()
546 struct sm5502_muic_info *info; sm5022_muic_i2c_probe() local
552 info = devm_kzalloc(&i2c->dev, sizeof(*info), GFP_KERNEL); sm5022_muic_i2c_probe()
553 if (!info) sm5022_muic_i2c_probe()
555 i2c_set_clientdata(i2c, info); sm5022_muic_i2c_probe()
557 info->dev = &i2c->dev; sm5022_muic_i2c_probe()
558 info->i2c = i2c; sm5022_muic_i2c_probe()
559 info->irq = i2c->irq; sm5022_muic_i2c_probe()
560 info->muic_irqs = sm5502_muic_irqs; sm5022_muic_i2c_probe()
561 info->num_muic_irqs = ARRAY_SIZE(sm5502_muic_irqs); sm5022_muic_i2c_probe()
562 info->reg_data = sm5502_reg_data; sm5022_muic_i2c_probe()
563 info->num_reg_data = ARRAY_SIZE(sm5502_reg_data); sm5022_muic_i2c_probe()
565 mutex_init(&info->mutex); sm5022_muic_i2c_probe()
567 INIT_WORK(&info->irq_work, sm5502_muic_irq_work); sm5022_muic_i2c_probe()
569 info->regmap = devm_regmap_init_i2c(i2c, &sm5502_muic_regmap_config); sm5022_muic_i2c_probe()
570 if (IS_ERR(info->regmap)) { sm5022_muic_i2c_probe()
571 ret = PTR_ERR(info->regmap); sm5022_muic_i2c_probe()
572 dev_err(info->dev, "failed to allocate register map: %d\n", sm5022_muic_i2c_probe()
579 ret = regmap_add_irq_chip(info->regmap, info->irq, irq_flags, 0, sm5022_muic_i2c_probe()
580 &sm5502_muic_irq_chip, &info->irq_data); sm5022_muic_i2c_probe()
582 dev_err(info->dev, "failed to request IRQ %d: %d\n", sm5022_muic_i2c_probe()
583 info->irq, ret); sm5022_muic_i2c_probe()
587 for (i = 0; i < info->num_muic_irqs; i++) { sm5022_muic_i2c_probe()
588 struct muic_irq *muic_irq = &info->muic_irqs[i]; sm5022_muic_i2c_probe()
591 virq = regmap_irq_get_virq(info->irq_data, muic_irq->irq); sm5022_muic_i2c_probe()
596 ret = devm_request_threaded_irq(info->dev, virq, NULL, sm5022_muic_i2c_probe()
599 muic_irq->name, info); sm5022_muic_i2c_probe()
601 dev_err(info->dev, sm5022_muic_i2c_probe()
609 info->edev = devm_extcon_dev_allocate(info->dev, sm5502_extcon_cable); sm5022_muic_i2c_probe()
610 if (IS_ERR(info->edev)) { sm5022_muic_i2c_probe()
611 dev_err(info->dev, "failed to allocate memory for extcon\n"); sm5022_muic_i2c_probe()
616 ret = devm_extcon_dev_register(info->dev, info->edev); sm5022_muic_i2c_probe()
618 dev_err(info->dev, "failed to register extcon device\n"); sm5022_muic_i2c_probe()
630 INIT_DELAYED_WORK(&info->wq_detcable, sm5502_muic_detect_cable_wq); sm5022_muic_i2c_probe()
631 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, sm5022_muic_i2c_probe()
635 sm5502_init_dev_type(info); sm5022_muic_i2c_probe()
642 struct sm5502_muic_info *info = i2c_get_clientdata(i2c); sm5502_muic_i2c_remove() local
644 regmap_del_irq_chip(info->irq, info->irq_data); sm5502_muic_i2c_remove()
659 struct sm5502_muic_info *info = i2c_get_clientdata(i2c); sm5502_muic_suspend() local
661 enable_irq_wake(info->irq); sm5502_muic_suspend()
669 struct sm5502_muic_info *info = i2c_get_clientdata(i2c); sm5502_muic_resume() local
671 disable_irq_wake(info->irq); sm5502_muic_resume()
H A Dextcon-max14577.c163 * @info: the instance including private data of max14577 MUIC
166 static int max14577_muic_set_debounce_time(struct max14577_muic_info *info, max14577_muic_set_debounce_time() argument
176 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_debounce_time()
181 dev_err(info->dev, "failed to set ADC debounce time\n"); max14577_muic_set_debounce_time()
186 dev_err(info->dev, "invalid ADC debounce time\n"); max14577_muic_set_debounce_time()
195 * @info: the instance including private data of max14577 MUIC
203 static int max14577_muic_set_path(struct max14577_muic_info *info, max14577_muic_set_path() argument
210 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_path()
214 dev_err(info->dev, "failed to update MUIC register\n"); max14577_muic_set_path()
223 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_path()
227 dev_err(info->dev, "failed to update MUIC register\n"); max14577_muic_set_path()
236 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_path()
240 dev_err(info->dev, "failed to update MUIC register\n"); max14577_muic_set_path()
244 dev_dbg(info->dev, max14577_muic_set_path()
253 * @info: the instance including private data of max14577 MUIC
262 static int max14577_muic_get_cable_type(struct max14577_muic_info *info, max14577_muic_get_cable_type() argument
275 adc = info->status[MAX14577_MUIC_STATUS1] & STATUS1_ADC_MASK; max14577_muic_get_cable_type()
280 * (info->prev_cable_type) for handling cable when cable is max14577_muic_get_cable_type()
286 cable_type = info->prev_cable_type; max14577_muic_get_cable_type()
287 info->prev_cable_type = MAX14577_MUIC_ADC_OPEN; max14577_muic_get_cable_type()
291 cable_type = info->prev_cable_type = adc; max14577_muic_get_cable_type()
299 chg_type = info->status[MAX14577_MUIC_STATUS2] & max14577_muic_get_cable_type()
306 cable_type = info->prev_chg_type; max14577_muic_get_cable_type()
307 info->prev_chg_type = MAX14577_CHARGER_TYPE_NONE; max14577_muic_get_cable_type()
313 * type(info->prev_chg_type) for handling cable when max14577_muic_get_cable_type()
316 cable_type = info->prev_chg_type = chg_type; max14577_muic_get_cable_type()
321 dev_err(info->dev, "Unknown cable group (%d)\n", group); max14577_muic_get_cable_type()
329 static int max14577_muic_jig_handler(struct max14577_muic_info *info, max14577_muic_jig_handler() argument
335 dev_dbg(info->dev, max14577_muic_jig_handler()
350 dev_err(info->dev, "failed to detect %s jig cable\n", max14577_muic_jig_handler()
355 ret = max14577_muic_set_path(info, path, attached); max14577_muic_jig_handler()
359 extcon_set_cable_state_(info->edev, EXTCON_JIG, attached); max14577_muic_jig_handler()
364 static int max14577_muic_adc_handler(struct max14577_muic_info *info) max14577_muic_adc_handler() argument
371 cable_type = max14577_muic_get_cable_type(info, max14577_muic_adc_handler()
374 dev_dbg(info->dev, max14577_muic_adc_handler()
377 info->prev_cable_type); max14577_muic_adc_handler()
384 ret = max14577_muic_jig_handler(info, cable_type, attached); max14577_muic_adc_handler()
421 dev_info(info->dev, max14577_muic_adc_handler()
426 dev_err(info->dev, max14577_muic_adc_handler()
435 static int max14577_muic_chg_handler(struct max14577_muic_info *info) max14577_muic_chg_handler() argument
441 chg_type = max14577_muic_get_cable_type(info, max14577_muic_chg_handler()
444 dev_dbg(info->dev, max14577_muic_chg_handler()
447 chg_type, info->prev_chg_type); max14577_muic_chg_handler()
452 ret = max14577_muic_set_path(info, info->path_usb, attached); max14577_muic_chg_handler()
456 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); max14577_muic_chg_handler()
459 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP, max14577_muic_chg_handler()
463 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP, max14577_muic_chg_handler()
467 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW, max14577_muic_chg_handler()
471 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST, max14577_muic_chg_handler()
478 dev_err(info->dev, max14577_muic_chg_handler()
489 struct max14577_muic_info *info = container_of(work, max14577_muic_irq_work() local
493 if (!info->edev) max14577_muic_irq_work()
496 mutex_lock(&info->mutex); max14577_muic_irq_work()
498 ret = max14577_bulk_read(info->max14577->regmap, max14577_muic_irq_work()
499 MAX14577_MUIC_REG_STATUS1, info->status, 2); max14577_muic_irq_work()
501 dev_err(info->dev, "failed to read MUIC register\n"); max14577_muic_irq_work()
502 mutex_unlock(&info->mutex); max14577_muic_irq_work()
506 if (info->irq_adc) { max14577_muic_irq_work()
507 ret = max14577_muic_adc_handler(info); max14577_muic_irq_work()
508 info->irq_adc = false; max14577_muic_irq_work()
510 if (info->irq_chg) { max14577_muic_irq_work()
511 ret = max14577_muic_chg_handler(info); max14577_muic_irq_work()
512 info->irq_chg = false; max14577_muic_irq_work()
516 dev_err(info->dev, "failed to handle MUIC interrupt\n"); max14577_muic_irq_work()
518 mutex_unlock(&info->mutex); max14577_muic_irq_work()
525 static int max14577_parse_irq(struct max14577_muic_info *info, int irq_type) max14577_parse_irq() argument
533 info->irq_adc = true; max14577_parse_irq()
541 info->irq_chg = true; max14577_parse_irq()
552 static int max77836_parse_irq(struct max14577_muic_info *info, int irq_type) max77836_parse_irq() argument
555 if (max14577_parse_irq(info, irq_type)) max77836_parse_irq()
560 info->irq_adc = true; max77836_parse_irq()
564 info->irq_chg = true; max77836_parse_irq()
573 struct max14577_muic_info *info = data; max14577_muic_irq_handler() local
583 for (i = 0; i < info->muic_irqs_num; i++) max14577_muic_irq_handler()
584 if (irq == info->muic_irqs[i].virq) max14577_muic_irq_handler()
585 irq_type = info->muic_irqs[i].irq; max14577_muic_irq_handler()
587 switch (info->max14577->dev_type) { max14577_muic_irq_handler()
589 irq_parsed = max77836_parse_irq(info, irq_type); max14577_muic_irq_handler()
593 irq_parsed = max14577_parse_irq(info, irq_type); max14577_muic_irq_handler()
598 dev_err(info->dev, "muic interrupt: irq %d occurred, skipped\n", max14577_muic_irq_handler()
602 schedule_work(&info->irq_work); max14577_muic_irq_handler()
607 static int max14577_muic_detect_accessory(struct max14577_muic_info *info) max14577_muic_detect_accessory() argument
614 mutex_lock(&info->mutex); max14577_muic_detect_accessory()
617 ret = max14577_bulk_read(info->max14577->regmap, max14577_muic_detect_accessory()
618 MAX14577_MUIC_REG_STATUS1, info->status, 2); max14577_muic_detect_accessory()
620 dev_err(info->dev, "failed to read MUIC register\n"); max14577_muic_detect_accessory()
621 mutex_unlock(&info->mutex); max14577_muic_detect_accessory()
625 adc = max14577_muic_get_cable_type(info, MAX14577_CABLE_GROUP_ADC, max14577_muic_detect_accessory()
628 ret = max14577_muic_adc_handler(info); max14577_muic_detect_accessory()
630 dev_err(info->dev, "Cannot detect accessory\n"); max14577_muic_detect_accessory()
631 mutex_unlock(&info->mutex); max14577_muic_detect_accessory()
636 chg_type = max14577_muic_get_cable_type(info, MAX14577_CABLE_GROUP_CHG, max14577_muic_detect_accessory()
639 ret = max14577_muic_chg_handler(info); max14577_muic_detect_accessory()
641 dev_err(info->dev, "Cannot detect charger accessory\n"); max14577_muic_detect_accessory()
642 mutex_unlock(&info->mutex); max14577_muic_detect_accessory()
647 mutex_unlock(&info->mutex); max14577_muic_detect_accessory()
654 struct max14577_muic_info *info = container_of(to_delayed_work(work), max14577_muic_detect_cable_wq() local
657 max14577_muic_detect_accessory(info); max14577_muic_detect_cable_wq()
663 struct max14577_muic_info *info; max14577_muic_probe() local
669 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); max14577_muic_probe()
670 if (!info) max14577_muic_probe()
673 info->dev = &pdev->dev; max14577_muic_probe()
674 info->max14577 = max14577; max14577_muic_probe()
676 platform_set_drvdata(pdev, info); max14577_muic_probe()
677 mutex_init(&info->mutex); max14577_muic_probe()
679 INIT_WORK(&info->irq_work, max14577_muic_irq_work); max14577_muic_probe()
683 info->muic_irqs = max77836_muic_irqs; max14577_muic_probe()
684 info->muic_irqs_num = ARRAY_SIZE(max77836_muic_irqs); max14577_muic_probe()
688 info->muic_irqs = max14577_muic_irqs; max14577_muic_probe()
689 info->muic_irqs_num = ARRAY_SIZE(max14577_muic_irqs); max14577_muic_probe()
693 for (i = 0; i < info->muic_irqs_num; i++) { max14577_muic_probe()
694 struct max14577_muic_irq *muic_irq = &info->muic_irqs[i]; max14577_muic_probe()
705 muic_irq->name, info); max14577_muic_probe()
715 info->edev = devm_extcon_dev_allocate(&pdev->dev, max14577_muic_probe()
717 if (IS_ERR(info->edev)) { max14577_muic_probe()
722 ret = devm_extcon_dev_register(&pdev->dev, info->edev); max14577_muic_probe()
729 info->path_usb = CTRL1_SW_USB; max14577_muic_probe()
730 info->path_uart = CTRL1_SW_UART; max14577_muic_probe()
734 max14577_muic_set_path(info, info->path_uart, true); max14577_muic_probe()
737 ret = max14577_read_reg(info->max14577->regmap, max14577_muic_probe()
743 dev_info(info->dev, "device ID : 0x%x\n", id); max14577_muic_probe()
746 max14577_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS); max14577_muic_probe()
756 INIT_DELAYED_WORK(&info->wq_detcable, max14577_muic_detect_cable_wq); max14577_muic_probe()
757 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, max14577_muic_probe()
765 struct max14577_muic_info *info = platform_get_drvdata(pdev); max14577_muic_remove() local
767 cancel_work_sync(&info->irq_work); max14577_muic_remove()
H A Dextcon-max8997.c163 * @info: the instance including private data of max8997 MUIC
166 static int max8997_muic_set_debounce_time(struct max8997_muic_info *info, max8997_muic_set_debounce_time() argument
176 ret = max8997_update_reg(info->muic, max8997_muic_set_debounce_time()
181 dev_err(info->dev, "failed to set ADC debounce time\n"); max8997_muic_set_debounce_time()
186 dev_err(info->dev, "invalid ADC debounce time\n"); max8997_muic_set_debounce_time()
195 * @info: the instance including private data of max8997 MUIC
203 static int max8997_muic_set_path(struct max8997_muic_info *info, max8997_muic_set_path() argument
214 ret = max8997_update_reg(info->muic, max8997_muic_set_path()
217 dev_err(info->dev, "failed to update MUIC register\n"); max8997_muic_set_path()
226 ret = max8997_update_reg(info->muic, max8997_muic_set_path()
230 dev_err(info->dev, "failed to update MUIC register\n"); max8997_muic_set_path()
234 dev_info(info->dev, max8997_muic_set_path()
243 * @info: the instance including private data of max8997 MUIC
252 static int max8997_muic_get_cable_type(struct max8997_muic_info *info, max8997_muic_get_cable_type() argument
265 adc = info->status[0] & STATUS1_ADC_MASK; max8997_muic_get_cable_type()
270 * (info->prev_cable_type) for handling cable when cable is max8997_muic_get_cable_type()
276 cable_type = info->prev_cable_type; max8997_muic_get_cable_type()
277 info->prev_cable_type = MAX8997_MUIC_ADC_OPEN; max8997_muic_get_cable_type()
281 cable_type = info->prev_cable_type = adc; max8997_muic_get_cable_type()
289 chg_type = info->status[1] & STATUS2_CHGTYP_MASK; max8997_muic_get_cable_type()
295 cable_type = info->prev_chg_type; max8997_muic_get_cable_type()
296 info->prev_chg_type = MAX8997_CHARGER_TYPE_NONE; max8997_muic_get_cable_type()
302 * type(info->prev_chg_type) for handling cable when max8997_muic_get_cable_type()
305 cable_type = info->prev_chg_type = chg_type; max8997_muic_get_cable_type()
310 dev_err(info->dev, "Unknown cable group (%d)\n", group); max8997_muic_get_cable_type()
318 static int max8997_muic_handle_usb(struct max8997_muic_info *info, max8997_muic_handle_usb() argument
324 ret = max8997_muic_set_path(info, info->path_usb, attached); max8997_muic_handle_usb()
326 dev_err(info->dev, "failed to update muic register\n"); max8997_muic_handle_usb()
333 extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, attached); max8997_muic_handle_usb()
336 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); max8997_muic_handle_usb()
339 dev_err(info->dev, "failed to detect %s usb cable\n", max8997_muic_handle_usb()
347 static int max8997_muic_handle_dock(struct max8997_muic_info *info, max8997_muic_handle_dock() argument
352 ret = max8997_muic_set_path(info, CONTROL1_SW_AUDIO, attached); max8997_muic_handle_dock()
354 dev_err(info->dev, "failed to update muic register\n"); max8997_muic_handle_dock()
361 extcon_set_cable_state_(info->edev, EXTCON_DOCK, attached); max8997_muic_handle_dock()
364 dev_err(info->dev, "failed to detect %s dock device\n", max8997_muic_handle_dock()
372 static int max8997_muic_handle_jig_uart(struct max8997_muic_info *info, max8997_muic_handle_jig_uart() argument
378 ret = max8997_muic_set_path(info, info->path_uart, attached); max8997_muic_handle_jig_uart()
380 dev_err(info->dev, "failed to update muic register\n"); max8997_muic_handle_jig_uart()
384 extcon_set_cable_state_(info->edev, EXTCON_JIG, attached); max8997_muic_handle_jig_uart()
389 static int max8997_muic_adc_handler(struct max8997_muic_info *info) max8997_muic_adc_handler() argument
396 cable_type = max8997_muic_get_cable_type(info, max8997_muic_adc_handler()
401 ret = max8997_muic_handle_usb(info, MAX8997_USB_HOST, attached); max8997_muic_adc_handler()
406 extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached); max8997_muic_adc_handler()
410 ret = max8997_muic_handle_usb(info, max8997_muic_adc_handler()
417 ret = max8997_muic_handle_dock(info, cable_type, attached); max8997_muic_adc_handler()
422 ret = max8997_muic_handle_jig_uart(info, attached); max8997_muic_adc_handler()
453 dev_info(info->dev, max8997_muic_adc_handler()
458 dev_err(info->dev, max8997_muic_adc_handler()
467 static int max8997_muic_chg_handler(struct max8997_muic_info *info) max8997_muic_chg_handler() argument
473 chg_type = max8997_muic_get_cable_type(info, max8997_muic_chg_handler()
480 adc = info->status[0] & STATUS1_ADC_MASK; max8997_muic_chg_handler()
484 max8997_muic_handle_usb(info, max8997_muic_chg_handler()
489 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP, max8997_muic_chg_handler()
493 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP, max8997_muic_chg_handler()
497 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW, max8997_muic_chg_handler()
501 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST, max8997_muic_chg_handler()
505 dev_err(info->dev, max8997_muic_chg_handler()
516 struct max8997_muic_info *info = container_of(work, max8997_muic_irq_work() local
521 if (!info->edev) max8997_muic_irq_work()
524 mutex_lock(&info->mutex); max8997_muic_irq_work()
527 if (info->irq == muic_irqs[i].virq) max8997_muic_irq_work()
530 ret = max8997_bulk_read(info->muic, MAX8997_MUIC_REG_STATUS1, max8997_muic_irq_work()
531 2, info->status); max8997_muic_irq_work()
533 dev_err(info->dev, "failed to read muic register\n"); max8997_muic_irq_work()
534 mutex_unlock(&info->mutex); max8997_muic_irq_work()
543 ret = max8997_muic_adc_handler(info); max8997_muic_irq_work()
551 ret = max8997_muic_chg_handler(info); max8997_muic_irq_work()
556 dev_info(info->dev, "misc interrupt: irq %d occurred\n", max8997_muic_irq_work()
558 mutex_unlock(&info->mutex); max8997_muic_irq_work()
563 dev_err(info->dev, "failed to handle MUIC interrupt\n"); max8997_muic_irq_work()
565 mutex_unlock(&info->mutex); max8997_muic_irq_work()
570 struct max8997_muic_info *info = data; max8997_muic_irq_handler() local
572 dev_dbg(info->dev, "irq:%d\n", irq); max8997_muic_irq_handler()
573 info->irq = irq; max8997_muic_irq_handler()
575 schedule_work(&info->irq_work); max8997_muic_irq_handler()
580 static int max8997_muic_detect_dev(struct max8997_muic_info *info) max8997_muic_detect_dev() argument
587 mutex_lock(&info->mutex); max8997_muic_detect_dev()
590 ret = max8997_bulk_read(info->muic, max8997_muic_detect_dev()
591 MAX8997_MUIC_REG_STATUS1, 2, info->status); max8997_muic_detect_dev()
593 dev_err(info->dev, "failed to read MUIC register\n"); max8997_muic_detect_dev()
594 mutex_unlock(&info->mutex); max8997_muic_detect_dev()
598 adc = max8997_muic_get_cable_type(info, MAX8997_CABLE_GROUP_ADC, max8997_muic_detect_dev()
601 ret = max8997_muic_adc_handler(info); max8997_muic_detect_dev()
603 dev_err(info->dev, "Cannot detect ADC cable\n"); max8997_muic_detect_dev()
604 mutex_unlock(&info->mutex); max8997_muic_detect_dev()
609 chg_type = max8997_muic_get_cable_type(info, MAX8997_CABLE_GROUP_CHG, max8997_muic_detect_dev()
612 ret = max8997_muic_chg_handler(info); max8997_muic_detect_dev()
614 dev_err(info->dev, "Cannot detect charger cable\n"); max8997_muic_detect_dev()
615 mutex_unlock(&info->mutex); max8997_muic_detect_dev()
620 mutex_unlock(&info->mutex); max8997_muic_detect_dev()
627 struct max8997_muic_info *info = container_of(to_delayed_work(work), max8997_muic_detect_cable_wq() local
631 ret = max8997_muic_detect_dev(info); max8997_muic_detect_cable_wq()
633 dev_err(info->dev, "failed to detect cable type\n"); max8997_muic_detect_cable_wq()
640 struct max8997_muic_info *info; max8997_muic_probe() local
644 info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info), max8997_muic_probe()
646 if (!info) max8997_muic_probe()
649 info->dev = &pdev->dev; max8997_muic_probe()
650 info->muic = max8997->muic; max8997_muic_probe()
652 platform_set_drvdata(pdev, info); max8997_muic_probe()
653 mutex_init(&info->mutex); max8997_muic_probe()
655 INIT_WORK(&info->irq_work, max8997_muic_irq_work); max8997_muic_probe()
671 muic_irq->name, info); max8997_muic_probe()
681 info->edev = devm_extcon_dev_allocate(&pdev->dev, max8997_extcon_cable); max8997_muic_probe()
682 if (IS_ERR(info->edev)) { max8997_muic_probe()
688 ret = devm_extcon_dev_register(&pdev->dev, info->edev); max8997_muic_probe()
700 max8997_write_reg(info->muic, max8997_muic_probe()
710 info->path_uart = muic_pdata->path_uart; max8997_muic_probe()
712 info->path_uart = CONTROL1_SW_UART; max8997_muic_probe()
715 info->path_usb = muic_pdata->path_usb; max8997_muic_probe()
717 info->path_usb = CONTROL1_SW_USB; max8997_muic_probe()
729 info->path_uart = CONTROL1_SW_UART; max8997_muic_probe()
730 info->path_usb = CONTROL1_SW_USB; max8997_muic_probe()
735 max8997_muic_set_path(info, info->path_uart, true); max8997_muic_probe()
738 max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS); max8997_muic_probe()
748 INIT_DELAYED_WORK(&info->wq_detcable, max8997_muic_detect_cable_wq); max8997_muic_probe()
749 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, max8997_muic_probe()
756 free_irq(muic_irqs[i].virq, info); max8997_muic_probe()
762 struct max8997_muic_info *info = platform_get_drvdata(pdev); max8997_muic_remove() local
766 free_irq(muic_irqs[i].virq, info); max8997_muic_remove()
767 cancel_work_sync(&info->irq_work); max8997_muic_remove()
H A Dextcon-max77843.c199 static int max77843_muic_set_path(struct max77843_muic_info *info, max77843_muic_set_path() argument
202 struct max77693_dev *max77843 = info->max77843; max77843_muic_set_path()
215 dev_err(info->dev, "Cannot switch MUIC port\n"); max77843_muic_set_path()
229 dev_err(info->dev, "Cannot update lowpower mode\n"); max77843_muic_set_path()
233 dev_dbg(info->dev, max77843_muic_set_path()
240 static int max77843_muic_get_cable_type(struct max77843_muic_info *info, max77843_muic_get_cable_type() argument
245 adc = info->status[MAX77843_MUIC_STATUS1] & max77843_muic_get_cable_type()
253 cable_type = info->prev_cable_type; max77843_muic_get_cable_type()
254 info->prev_cable_type = MAX77843_MUIC_ADC_OPEN; max77843_muic_get_cable_type()
257 cable_type = info->prev_cable_type = adc; max77843_muic_get_cable_type()
261 chg_type = info->status[MAX77843_MUIC_STATUS2] & max77843_muic_get_cable_type()
271 cable_type = info->prev_chg_type; max77843_muic_get_cable_type()
272 info->prev_chg_type = MAX77843_MUIC_CHG_NONE; max77843_muic_get_cable_type()
279 info->prev_chg_type = MAX77843_MUIC_CHG_GND; max77843_muic_get_cable_type()
286 cable_type = info->prev_chg_type; max77843_muic_get_cable_type()
287 info->prev_chg_type = MAX77843_MUIC_CHG_NONE; max77843_muic_get_cable_type()
290 cable_type = info->prev_chg_type = chg_type; max77843_muic_get_cable_type()
296 cable_type = info->prev_gnd_type; max77843_muic_get_cable_type()
297 info->prev_gnd_type = MAX77843_MUIC_ADC_OPEN; max77843_muic_get_cable_type()
307 gnd_type = (info->status[MAX77843_MUIC_STATUS1] & max77843_muic_get_cable_type()
311 gnd_type |= (info->status[MAX77843_MUIC_STATUS2] & max77843_muic_get_cable_type()
317 cable_type = info->prev_gnd_type = gnd_type; max77843_muic_get_cable_type()
321 dev_err(info->dev, "Unknown cable group (%d)\n", group); max77843_muic_get_cable_type()
329 static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info) max77843_muic_adc_gnd_handler() argument
334 gnd_cable_type = max77843_muic_get_cable_type(info, max77843_muic_adc_gnd_handler()
336 dev_dbg(info->dev, "external connector is %s (gnd:0x%02x)\n", max77843_muic_adc_gnd_handler()
342 ret = max77843_muic_set_path(info, max77843_muic_adc_gnd_handler()
348 extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, attached); max77843_muic_adc_gnd_handler()
352 ret = max77843_muic_set_path(info, max77843_muic_adc_gnd_handler()
358 extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached); max77843_muic_adc_gnd_handler()
361 dev_err(info->dev, "failed to detect %s accessory(gnd:0x%x)\n", max77843_muic_adc_gnd_handler()
369 static int max77843_muic_jig_handler(struct max77843_muic_info *info, max77843_muic_jig_handler() argument
375 dev_dbg(info->dev, "external connector is %s (adc:0x%02x)\n", max77843_muic_jig_handler()
390 ret = max77843_muic_set_path(info, path, attached); max77843_muic_jig_handler()
394 extcon_set_cable_state_(info->edev, EXTCON_JIG, attached); max77843_muic_jig_handler()
399 static int max77843_muic_adc_handler(struct max77843_muic_info *info) max77843_muic_adc_handler() argument
404 cable_type = max77843_muic_get_cable_type(info, max77843_muic_adc_handler()
407 dev_dbg(info->dev, max77843_muic_adc_handler()
410 info->prev_cable_type); max77843_muic_adc_handler()
414 ret = max77843_muic_adc_gnd_handler(info); max77843_muic_adc_handler()
421 ret = max77843_muic_jig_handler(info, cable_type, attached); max77843_muic_adc_handler()
453 dev_err(info->dev, max77843_muic_adc_handler()
458 dev_err(info->dev, max77843_muic_adc_handler()
467 static int max77843_muic_chg_handler(struct max77843_muic_info *info) max77843_muic_chg_handler() argument
472 chg_type = max77843_muic_get_cable_type(info, max77843_muic_chg_handler()
475 dev_dbg(info->dev, max77843_muic_chg_handler()
478 chg_type, info->prev_chg_type); max77843_muic_chg_handler()
482 ret = max77843_muic_set_path(info, max77843_muic_chg_handler()
488 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); max77843_muic_chg_handler()
491 ret = max77843_muic_set_path(info, max77843_muic_chg_handler()
497 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP, max77843_muic_chg_handler()
501 ret = max77843_muic_set_path(info, max77843_muic_chg_handler()
507 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP, max77843_muic_chg_handler()
511 ret = max77843_muic_set_path(info, max77843_muic_chg_handler()
517 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW, max77843_muic_chg_handler()
521 ret = max77843_muic_set_path(info, max77843_muic_chg_handler()
527 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST, max77843_muic_chg_handler()
531 gnd_type = max77843_muic_get_cable_type(info, max77843_muic_chg_handler()
536 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP, max77843_muic_chg_handler()
539 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP, max77843_muic_chg_handler()
545 dev_err(info->dev, max77843_muic_chg_handler()
549 max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_OPEN, max77843_muic_chg_handler()
559 struct max77843_muic_info *info = container_of(work, max77843_muic_irq_work() local
561 struct max77693_dev *max77843 = info->max77843; max77843_muic_irq_work()
564 mutex_lock(&info->mutex); max77843_muic_irq_work()
567 MAX77843_MUIC_REG_STATUS1, info->status, max77843_muic_irq_work()
570 dev_err(info->dev, "Cannot read STATUS registers\n"); max77843_muic_irq_work()
571 mutex_unlock(&info->mutex); max77843_muic_irq_work()
575 if (info->irq_adc) { max77843_muic_irq_work()
576 ret = max77843_muic_adc_handler(info); max77843_muic_irq_work()
578 dev_err(info->dev, "Unknown cable type\n"); max77843_muic_irq_work()
579 info->irq_adc = false; max77843_muic_irq_work()
582 if (info->irq_chg) { max77843_muic_irq_work()
583 ret = max77843_muic_chg_handler(info); max77843_muic_irq_work()
585 dev_err(info->dev, "Unknown charger type\n"); max77843_muic_irq_work()
586 info->irq_chg = false; max77843_muic_irq_work()
589 mutex_unlock(&info->mutex); max77843_muic_irq_work()
594 struct max77843_muic_info *info = data; max77843_muic_irq_handler() local
605 info->irq_adc = true; max77843_muic_irq_handler()
612 info->irq_chg = true; max77843_muic_irq_handler()
624 dev_err(info->dev, "Cannot recognize IRQ(%d)\n", irq_type); max77843_muic_irq_handler()
628 schedule_work(&info->irq_work); max77843_muic_irq_handler()
635 struct max77843_muic_info *info = container_of(to_delayed_work(work), max77843_muic_detect_cable_wq() local
637 struct max77693_dev *max77843 = info->max77843; max77843_muic_detect_cable_wq()
641 mutex_lock(&info->mutex); max77843_muic_detect_cable_wq()
644 MAX77843_MUIC_REG_STATUS1, info->status, max77843_muic_detect_cable_wq()
647 dev_err(info->dev, "Cannot read STATUS registers\n"); max77843_muic_detect_cable_wq()
651 adc = max77843_muic_get_cable_type(info, max77843_muic_detect_cable_wq()
654 ret = max77843_muic_adc_handler(info); max77843_muic_detect_cable_wq()
656 dev_err(info->dev, "Cannot detect accessory\n"); max77843_muic_detect_cable_wq()
661 chg_type = max77843_muic_get_cable_type(info, max77843_muic_detect_cable_wq()
664 ret = max77843_muic_chg_handler(info); max77843_muic_detect_cable_wq()
666 dev_err(info->dev, "Cannot detect charger accessory\n"); max77843_muic_detect_cable_wq()
672 mutex_unlock(&info->mutex); max77843_muic_detect_cable_wq()
675 static int max77843_muic_set_debounce_time(struct max77843_muic_info *info, max77843_muic_set_debounce_time() argument
678 struct max77693_dev *max77843 = info->max77843; max77843_muic_set_debounce_time()
691 dev_err(info->dev, "Cannot write MUIC regmap\n"); max77843_muic_set_debounce_time()
696 dev_err(info->dev, "Invalid ADC debounce time\n"); max77843_muic_set_debounce_time()
743 struct max77843_muic_info *info; max77843_muic_probe() local
747 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); max77843_muic_probe()
748 if (!info) max77843_muic_probe()
751 info->dev = &pdev->dev; max77843_muic_probe()
752 info->max77843 = max77843; max77843_muic_probe()
754 platform_set_drvdata(pdev, info); max77843_muic_probe()
755 mutex_init(&info->mutex); max77843_muic_probe()
772 info->edev = devm_extcon_dev_allocate(&pdev->dev, max77843_muic_probe()
774 if (IS_ERR(info->edev)) { max77843_muic_probe()
780 ret = devm_extcon_dev_register(&pdev->dev, info->edev); max77843_muic_probe()
787 max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS); max77843_muic_probe()
790 max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true); max77843_muic_probe()
798 dev_info(info->dev, "MUIC device ID : 0x%x\n", id); max77843_muic_probe()
801 INIT_WORK(&info->irq_work, max77843_muic_irq_work); max77843_muic_probe()
805 MAX77843_MUIC_REG_INT1, info->status, max77843_muic_probe()
826 muic_irq->name, info); max77843_muic_probe()
836 INIT_DELAYED_WORK(&info->wq_detcable, max77843_muic_detect_cable_wq); max77843_muic_probe()
838 &info->wq_detcable, msecs_to_jiffies(DELAY_MS_DEFAULT)); max77843_muic_probe()
851 struct max77843_muic_info *info = platform_get_drvdata(pdev); max77843_muic_remove() local
852 struct max77693_dev *max77843 = info->max77843; max77843_muic_remove()
854 cancel_work_sync(&info->irq_work); max77843_muic_remove()
H A Dextcon-max77693.c219 * @info: the instance including private data of max77693 MUIC
222 static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, max77693_muic_set_debounce_time() argument
237 ret = regmap_write(info->max77693->regmap_muic, max77693_muic_set_debounce_time()
241 dev_err(info->dev, "failed to set ADC debounce time\n"); max77693_muic_set_debounce_time()
246 dev_err(info->dev, "invalid ADC debounce time\n"); max77693_muic_set_debounce_time()
255 * @info: the instance including private data of max77693 MUIC
263 static int max77693_muic_set_path(struct max77693_muic_info *info, max77693_muic_set_path() argument
274 ret = regmap_update_bits(info->max77693->regmap_muic, max77693_muic_set_path()
277 dev_err(info->dev, "failed to update MUIC register\n"); max77693_muic_set_path()
286 ret = regmap_update_bits(info->max77693->regmap_muic, max77693_muic_set_path()
291 dev_err(info->dev, "failed to update MUIC register\n"); max77693_muic_set_path()
295 dev_info(info->dev, max77693_muic_set_path()
304 * @info: the instance including private data of max77693 MUIC
315 static int max77693_muic_get_cable_type(struct max77693_muic_info *info, max77693_muic_get_cable_type() argument
331 adc = info->status[0] & MAX77693_STATUS1_ADC_MASK; max77693_muic_get_cable_type()
336 * (info->prev_cable_type) for handling cable when cable is max77693_muic_get_cable_type()
342 cable_type = info->prev_cable_type; max77693_muic_get_cable_type()
343 info->prev_cable_type = MAX77693_MUIC_ADC_OPEN; max77693_muic_get_cable_type()
347 cable_type = info->prev_cable_type = adc; max77693_muic_get_cable_type()
355 adc = info->status[0] & MAX77693_STATUS1_ADC_MASK; max77693_muic_get_cable_type()
360 * (info->prev_cable_type/_gnd) for handling cable when cable max77693_muic_get_cable_type()
366 cable_type = info->prev_cable_type_gnd; max77693_muic_get_cable_type()
367 info->prev_cable_type_gnd = MAX77693_MUIC_ADC_OPEN; max77693_muic_get_cable_type()
371 adclow = info->status[0] & MAX77693_STATUS1_ADCLOW_MASK; max77693_muic_get_cable_type()
373 adc1k = info->status[0] & MAX77693_STATUS1_ADC1K_MASK; max77693_muic_get_cable_type()
376 vbvolt = info->status[1] & MAX77693_STATUS2_VBVOLT_MASK; max77693_muic_get_cable_type()
392 info->prev_cable_type = adc; max77693_muic_get_cable_type()
393 info->prev_cable_type_gnd = cable_type; max77693_muic_get_cable_type()
402 chg_type = info->status[1] & MAX77693_STATUS2_CHGTYP_MASK; max77693_muic_get_cable_type()
408 cable_type = info->prev_chg_type; max77693_muic_get_cable_type()
409 info->prev_chg_type = MAX77693_CHARGER_TYPE_NONE; max77693_muic_get_cable_type()
415 * type(info->prev_chg_type) for handling cable when max77693_muic_get_cable_type()
418 cable_type = info->prev_chg_type = chg_type; max77693_muic_get_cable_type()
427 adc = info->status[0] & MAX77693_STATUS1_ADC_MASK; max77693_muic_get_cable_type()
429 chg_type = info->status[1] & MAX77693_STATUS2_CHGTYP_MASK; max77693_muic_get_cable_type()
442 vbvolt = info->status[1] & MAX77693_STATUS2_VBVOLT_MASK; max77693_muic_get_cable_type()
448 dev_err(info->dev, "Unknown cable group (%d)\n", group); max77693_muic_get_cable_type()
456 static int max77693_muic_dock_handler(struct max77693_muic_info *info, max77693_muic_dock_handler() argument
464 dev_info(info->dev, max77693_muic_dock_handler()
476 vbvolt = max77693_muic_get_cable_type(info, max77693_muic_dock_handler()
479 dev_warn(info->dev, max77693_muic_dock_handler()
503 ret = max77693_muic_set_path(info, info->path_usb, attached); max77693_muic_dock_handler()
507 extcon_set_cable_state_(info->edev, EXTCON_DOCK, attached); max77693_muic_dock_handler()
508 extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached); max77693_muic_dock_handler()
516 extcon_set_cable_state_(info->edev, EXTCON_USB, false); max77693_muic_dock_handler()
519 dev_err(info->dev, "failed to detect %s dock device\n", max77693_muic_dock_handler()
525 ret = max77693_muic_set_path(info, MAX77693_CONTROL1_SW_AUDIO, max77693_muic_dock_handler()
529 extcon_set_cable_state_(info->edev, dock_id, attached); max77693_muic_dock_handler()
535 static int max77693_muic_dock_button_handler(struct max77693_muic_info *info, max77693_muic_dock_button_handler() argument
538 struct input_dev *dock = info->dock; max77693_muic_dock_button_handler()
566 dev_err(info->dev, max77693_muic_dock_button_handler()
578 static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info) max77693_muic_adc_ground_handler() argument
584 cable_type_gnd = max77693_muic_get_cable_type(info, max77693_muic_adc_ground_handler()
591 ret = max77693_muic_set_path(info, MAX77693_CONTROL1_SW_USB, max77693_muic_adc_ground_handler()
595 extcon_set_cable_state_(info->edev, EXTCON_USB_HOST, attached); max77693_muic_adc_ground_handler()
599 ret = max77693_muic_set_path(info, MAX77693_CONTROL1_SW_AUDIO, max77693_muic_adc_ground_handler()
603 extcon_set_cable_state_(info->edev, EXTCON_USB, attached); max77693_muic_adc_ground_handler()
608 extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, attached); max77693_muic_adc_ground_handler()
611 dev_err(info->dev, "failed to detect %s cable of gnd type\n", max77693_muic_adc_ground_handler()
619 static int max77693_muic_jig_handler(struct max77693_muic_info *info, max77693_muic_jig_handler() argument
625 dev_info(info->dev, max77693_muic_jig_handler()
641 dev_err(info->dev, "failed to detect %s jig cable\n", max77693_muic_jig_handler()
646 ret = max77693_muic_set_path(info, path, attached); max77693_muic_jig_handler()
650 extcon_set_cable_state_(info->edev, EXTCON_JIG, attached); max77693_muic_jig_handler()
655 static int max77693_muic_adc_handler(struct max77693_muic_info *info) max77693_muic_adc_handler() argument
663 cable_type = max77693_muic_get_cable_type(info, max77693_muic_adc_handler()
666 dev_info(info->dev, max77693_muic_adc_handler()
669 info->prev_cable_type); max77693_muic_adc_handler()
674 max77693_muic_adc_ground_handler(info); max77693_muic_adc_handler()
681 ret = max77693_muic_jig_handler(info, cable_type, attached); max77693_muic_adc_handler()
697 ret = max77693_muic_dock_handler(info, cable_type, attached); max77693_muic_adc_handler()
717 button_type = info->prev_button_type = cable_type; max77693_muic_adc_handler()
719 button_type = info->prev_button_type; max77693_muic_adc_handler()
721 ret = max77693_muic_dock_button_handler(info, button_type, max77693_muic_adc_handler()
749 dev_info(info->dev, max77693_muic_adc_handler()
754 dev_err(info->dev, max77693_muic_adc_handler()
763 static int max77693_muic_chg_handler(struct max77693_muic_info *info) max77693_muic_chg_handler() argument
772 chg_type = max77693_muic_get_cable_type(info, max77693_muic_chg_handler()
775 dev_info(info->dev, max77693_muic_chg_handler()
778 chg_type, info->prev_chg_type); max77693_muic_chg_handler()
785 cable_type_gnd = max77693_muic_get_cable_type(info, max77693_muic_chg_handler()
804 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP, max77693_muic_chg_handler()
807 extcon_set_cable_state_(info->edev, max77693_muic_chg_handler()
813 cable_type = max77693_muic_get_cable_type(info, max77693_muic_chg_handler()
831 extcon_set_cable_state_(info->edev, EXTCON_USB, max77693_muic_chg_handler()
835 extcon_set_cable_state_(info->edev, EXTCON_DOCK, max77693_muic_chg_handler()
859 ret = max77693_muic_set_path(info, info->path_usb, max77693_muic_chg_handler()
864 extcon_set_cable_state_(info->edev, EXTCON_DOCK, max77693_muic_chg_handler()
866 extcon_set_cable_state_(info->edev, EXTCON_DISP_MHL, max77693_muic_chg_handler()
895 ret = max77693_muic_set_path(info, info->path_usb, max77693_muic_chg_handler()
900 extcon_set_cable_state_(info->edev, EXTCON_USB, max77693_muic_chg_handler()
905 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_DCP, max77693_muic_chg_handler()
911 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_CDP, max77693_muic_chg_handler()
915 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_SLOW, max77693_muic_chg_handler()
919 extcon_set_cable_state_(info->edev, EXTCON_CHG_USB_FAST, max77693_muic_chg_handler()
925 dev_err(info->dev, max77693_muic_chg_handler()
936 struct max77693_muic_info *info = container_of(work, max77693_muic_irq_work() local
941 if (!info->edev) max77693_muic_irq_work()
944 mutex_lock(&info->mutex); max77693_muic_irq_work()
947 if (info->irq == muic_irqs[i].virq) max77693_muic_irq_work()
950 ret = regmap_bulk_read(info->max77693->regmap_muic, max77693_muic_irq_work()
951 MAX77693_MUIC_REG_STATUS1, info->status, 2); max77693_muic_irq_work()
953 dev_err(info->dev, "failed to read MUIC register\n"); max77693_muic_irq_work()
954 mutex_unlock(&info->mutex); max77693_muic_irq_work()
965 ret = max77693_muic_adc_handler(info); max77693_muic_irq_work()
974 ret = max77693_muic_chg_handler(info); max77693_muic_irq_work()
984 dev_err(info->dev, "muic interrupt: irq %d occurred\n", max77693_muic_irq_work()
986 mutex_unlock(&info->mutex); max77693_muic_irq_work()
991 dev_err(info->dev, "failed to handle MUIC interrupt\n"); max77693_muic_irq_work()
993 mutex_unlock(&info->mutex); max77693_muic_irq_work()
998 struct max77693_muic_info *info = data; max77693_muic_irq_handler() local
1000 info->irq = irq; max77693_muic_irq_handler()
1001 schedule_work(&info->irq_work); max77693_muic_irq_handler()
1011 static int max77693_muic_detect_accessory(struct max77693_muic_info *info) max77693_muic_detect_accessory() argument
1018 mutex_lock(&info->mutex); max77693_muic_detect_accessory()
1021 ret = regmap_bulk_read(info->max77693->regmap_muic, max77693_muic_detect_accessory()
1022 MAX77693_MUIC_REG_STATUS1, info->status, 2); max77693_muic_detect_accessory()
1024 dev_err(info->dev, "failed to read MUIC register\n"); max77693_muic_detect_accessory()
1025 mutex_unlock(&info->mutex); max77693_muic_detect_accessory()
1029 adc = max77693_muic_get_cable_type(info, MAX77693_CABLE_GROUP_ADC, max77693_muic_detect_accessory()
1032 ret = max77693_muic_adc_handler(info); max77693_muic_detect_accessory()
1034 dev_err(info->dev, "Cannot detect accessory\n"); max77693_muic_detect_accessory()
1035 mutex_unlock(&info->mutex); max77693_muic_detect_accessory()
1040 chg_type = max77693_muic_get_cable_type(info, MAX77693_CABLE_GROUP_CHG, max77693_muic_detect_accessory()
1043 ret = max77693_muic_chg_handler(info); max77693_muic_detect_accessory()
1045 dev_err(info->dev, "Cannot detect charger accessory\n"); max77693_muic_detect_accessory()
1046 mutex_unlock(&info->mutex); max77693_muic_detect_accessory()
1051 mutex_unlock(&info->mutex); max77693_muic_detect_accessory()
1058 struct max77693_muic_info *info = container_of(to_delayed_work(work), max77693_muic_detect_cable_wq() local
1061 max77693_muic_detect_accessory(info); max77693_muic_detect_cable_wq()
1068 struct max77693_muic_info *info; max77693_muic_probe() local
1076 info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info), max77693_muic_probe()
1078 if (!info) max77693_muic_probe()
1081 info->dev = &pdev->dev; max77693_muic_probe()
1082 info->max77693 = max77693; max77693_muic_probe()
1083 if (info->max77693->regmap_muic) { max77693_muic_probe()
1086 info->max77693->regmap_muic = devm_regmap_init_i2c( max77693_muic_probe()
1087 info->max77693->i2c_muic, max77693_muic_probe()
1089 if (IS_ERR(info->max77693->regmap_muic)) { max77693_muic_probe()
1090 ret = PTR_ERR(info->max77693->regmap_muic); max77693_muic_probe()
1098 info->dock = devm_input_allocate_device(&pdev->dev); max77693_muic_probe()
1099 if (!info->dock) { max77693_muic_probe()
1103 info->dock->name = "max77693-muic/dock"; max77693_muic_probe()
1104 info->dock->phys = "max77693-muic/extcon"; max77693_muic_probe()
1105 info->dock->dev.parent = &pdev->dev; max77693_muic_probe()
1107 __set_bit(EV_REP, info->dock->evbit); max77693_muic_probe()
1109 input_set_capability(info->dock, EV_KEY, KEY_VOLUMEUP); max77693_muic_probe()
1110 input_set_capability(info->dock, EV_KEY, KEY_VOLUMEDOWN); max77693_muic_probe()
1111 input_set_capability(info->dock, EV_KEY, KEY_PLAYPAUSE); max77693_muic_probe()
1112 input_set_capability(info->dock, EV_KEY, KEY_PREVIOUSSONG); max77693_muic_probe()
1113 input_set_capability(info->dock, EV_KEY, KEY_NEXTSONG); max77693_muic_probe()
1115 ret = input_register_device(info->dock); max77693_muic_probe()
1122 platform_set_drvdata(pdev, info); max77693_muic_probe()
1123 mutex_init(&info->mutex); max77693_muic_probe()
1125 INIT_WORK(&info->irq_work, max77693_muic_irq_work); max77693_muic_probe()
1141 muic_irq->name, info); max77693_muic_probe()
1151 info->edev = devm_extcon_dev_allocate(&pdev->dev, max77693_muic_probe()
1153 if (IS_ERR(info->edev)) { max77693_muic_probe()
1158 ret = devm_extcon_dev_register(&pdev->dev, info->edev); max77693_muic_probe()
1174 regmap_write(info->max77693->regmap_muic, max77693_muic_probe()
1188 info->path_uart = muic_pdata->path_uart; max77693_muic_probe()
1190 info->path_uart = MAX77693_CONTROL1_SW_UART; max77693_muic_probe()
1193 info->path_usb = muic_pdata->path_usb; max77693_muic_probe()
1195 info->path_usb = MAX77693_CONTROL1_SW_USB; max77693_muic_probe()
1207 info->path_usb = MAX77693_CONTROL1_SW_USB; max77693_muic_probe()
1208 info->path_uart = MAX77693_CONTROL1_SW_UART; max77693_muic_probe()
1213 max77693_muic_set_path(info, info->path_uart, true); max77693_muic_probe()
1216 ret = regmap_read(info->max77693->regmap_muic, max77693_muic_probe()
1222 dev_info(info->dev, "device ID : 0x%x\n", id); max77693_muic_probe()
1225 max77693_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS); max77693_muic_probe()
1235 INIT_DELAYED_WORK(&info->wq_detcable, max77693_muic_detect_cable_wq); max77693_muic_probe()
1236 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, max77693_muic_probe()
1244 struct max77693_muic_info *info = platform_get_drvdata(pdev); max77693_muic_remove() local
1246 cancel_work_sync(&info->irq_work); max77693_muic_remove()
1247 input_unregister_device(info->dock); max77693_muic_remove()
/linux-4.4.14/arch/x86/pci/
H A Dbus_numa.c11 struct pci_root_info *info; x86_find_pci_root_info() local
13 list_for_each_entry(info, &pci_root_infos, list) x86_find_pci_root_info()
14 if (info->busn.start == bus) x86_find_pci_root_info()
15 return info; x86_find_pci_root_info()
22 struct pci_root_info *info = x86_find_pci_root_info(bus); x86_pci_root_bus_node() local
24 if (!info) x86_pci_root_bus_node()
27 return info->node; x86_pci_root_bus_node()
32 struct pci_root_info *info = x86_find_pci_root_info(bus); x86_pci_root_bus_resources() local
37 if (!info) x86_pci_root_bus_resources()
51 pci_add_resource(resources, &info->busn);
53 list_for_each_entry(root_res, &info->resources, list)
72 struct pci_root_info *info; alloc_pci_root_info() local
74 info = kzalloc(sizeof(*info), GFP_KERNEL); alloc_pci_root_info()
76 if (!info) alloc_pci_root_info()
77 return info; alloc_pci_root_info()
79 sprintf(info->name, "PCI Bus #%02x", bus_min); alloc_pci_root_info()
81 INIT_LIST_HEAD(&info->resources); alloc_pci_root_info()
82 info->busn.name = info->name; alloc_pci_root_info()
83 info->busn.start = bus_min; alloc_pci_root_info()
84 info->busn.end = bus_max; alloc_pci_root_info()
85 info->busn.flags = IORESOURCE_BUS; alloc_pci_root_info()
86 info->node = node; alloc_pci_root_info()
87 info->link = link; alloc_pci_root_info()
89 list_add_tail(&info->list, &pci_root_infos); alloc_pci_root_info()
91 return info; alloc_pci_root_info()
94 void update_res(struct pci_root_info *info, resource_size_t start, update_res() argument
110 list_for_each_entry(root_res, &info->resources, list) { update_res()
139 res->name = info->name; update_res()
144 list_add_tail(&root_res->list, &info->resources); update_res()
/linux-4.4.14/drivers/video/fbdev/geode/
H A Dgx1fb_core.c100 static int gx1fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) gx1fb_check_var() argument
102 struct geodefb_par *par = info->par; gx1fb_check_var()
126 if (gx1_line_delta(var->xres, var->bits_per_pixel) * var->yres > info->fix.smem_len) gx1fb_check_var()
134 static int gx1fb_set_par(struct fb_info *info) gx1fb_set_par() argument
136 struct geodefb_par *par = info->par; gx1fb_set_par()
138 if (info->var.bits_per_pixel == 16) gx1fb_set_par()
139 info->fix.visual = FB_VISUAL_TRUECOLOR; gx1fb_set_par()
141 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; gx1fb_set_par()
143 info->fix.line_length = gx1_line_delta(info->var.xres, info->var.bits_per_pixel); gx1fb_set_par()
145 par->dc_ops->set_mode(info); gx1fb_set_par()
159 struct fb_info *info) gx1fb_setcolreg()
161 struct geodefb_par *par = info->par; gx1fb_setcolreg()
163 if (info->var.grayscale) { gx1fb_setcolreg()
169 if (info->fix.visual == FB_VISUAL_TRUECOLOR) { gx1fb_setcolreg()
170 u32 *pal = info->pseudo_palette; gx1fb_setcolreg()
176 v = chan_to_field(red, &info->var.red); gx1fb_setcolreg()
177 v |= chan_to_field(green, &info->var.green); gx1fb_setcolreg()
178 v |= chan_to_field(blue, &info->var.blue); gx1fb_setcolreg()
185 par->dc_ops->set_palette_reg(info, regno, red, green, blue); gx1fb_setcolreg()
191 static int gx1fb_blank(int blank_mode, struct fb_info *info) gx1fb_blank() argument
193 struct geodefb_par *par = info->par; gx1fb_blank()
195 return par->vid_ops->blank_display(info, blank_mode); gx1fb_blank()
198 static int gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *dev) gx1fb_map_video_memory() argument
200 struct geodefb_par *par = info->par; gx1fb_map_video_memory()
228 info->fix.smem_start = gx_base + 0x800000; gx1fb_map_video_memory()
229 info->fix.smem_len = fb_len; gx1fb_map_video_memory()
230 info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); gx1fb_map_video_memory()
231 if (!info->screen_base) gx1fb_map_video_memory()
235 info->fix.smem_len / 1024, info->fix.smem_start); gx1fb_map_video_memory()
240 static int parse_panel_option(struct fb_info *info) parse_panel_option() argument
242 struct geodefb_par *par = info->par; parse_panel_option()
274 struct fb_info *info; gx1fb_init_fbinfo() local
277 info = framebuffer_alloc(sizeof(struct geodefb_par) + sizeof(u32) * 16, dev); gx1fb_init_fbinfo()
278 if (!info) gx1fb_init_fbinfo()
281 par = info->par; gx1fb_init_fbinfo()
283 strcpy(info->fix.id, "GX1"); gx1fb_init_fbinfo()
285 info->fix.type = FB_TYPE_PACKED_PIXELS; gx1fb_init_fbinfo()
286 info->fix.type_aux = 0; gx1fb_init_fbinfo()
287 info->fix.xpanstep = 0; gx1fb_init_fbinfo()
288 info->fix.ypanstep = 0; gx1fb_init_fbinfo()
289 info->fix.ywrapstep = 0; gx1fb_init_fbinfo()
290 info->fix.accel = FB_ACCEL_NONE; gx1fb_init_fbinfo()
292 info->var.nonstd = 0; gx1fb_init_fbinfo()
293 info->var.activate = FB_ACTIVATE_NOW; gx1fb_init_fbinfo()
294 info->var.height = -1; gx1fb_init_fbinfo()
295 info->var.width = -1; gx1fb_init_fbinfo()
296 info->var.accel_flags = 0; gx1fb_init_fbinfo()
297 info->var.vmode = FB_VMODE_NONINTERLACED; gx1fb_init_fbinfo()
299 info->fbops = &gx1fb_ops; gx1fb_init_fbinfo()
300 info->flags = FBINFO_DEFAULT; gx1fb_init_fbinfo()
301 info->node = -1; gx1fb_init_fbinfo()
303 info->pseudo_palette = (void *)par + sizeof(struct geodefb_par); gx1fb_init_fbinfo()
305 info->var.grayscale = 0; gx1fb_init_fbinfo()
309 if (parse_panel_option(info) < 0) gx1fb_init_fbinfo()
314 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { gx1fb_init_fbinfo()
315 framebuffer_release(info); gx1fb_init_fbinfo()
318 return info; gx1fb_init_fbinfo()
324 struct fb_info *info; gx1fb_probe() local
327 info = gx1fb_init_fbinfo(&pdev->dev); gx1fb_probe()
328 if (!info) gx1fb_probe()
330 par = info->par; gx1fb_probe()
336 if ((ret = gx1fb_map_video_memory(info, pdev)) < 0) { gx1fb_probe()
341 ret = fb_find_mode(&info->var, info, mode_option, gx1fb_probe()
350 memset_io(info->screen_base, 0, info->fix.smem_len); gx1fb_probe()
352 gx1fb_check_var(&info->var, info); gx1fb_probe()
353 gx1fb_set_par(info); gx1fb_probe()
355 if (register_framebuffer(info) < 0) { gx1fb_probe()
359 pci_set_drvdata(pdev, info); gx1fb_probe()
360 fb_info(info, "%s frame buffer device\n", info->fix.id); gx1fb_probe()
364 if (info->screen_base) { gx1fb_probe()
365 iounmap(info->screen_base); gx1fb_probe()
377 fb_dealloc_cmap(&info->cmap); gx1fb_probe()
378 framebuffer_release(info); gx1fb_probe()
385 struct fb_info *info = pci_get_drvdata(pdev); gx1fb_remove() local
386 struct geodefb_par *par = info->par; gx1fb_remove()
388 unregister_framebuffer(info); gx1fb_remove()
390 iounmap((void __iomem *)info->screen_base); gx1fb_remove()
399 fb_dealloc_cmap(&info->cmap); gx1fb_remove()
401 framebuffer_release(info); gx1fb_remove()
157 gx1fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) gx1fb_setcolreg() argument
H A Dgxfb_core.c139 static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) gxfb_check_var() argument
163 if (gx_line_delta(var->xres, var->bits_per_pixel) * var->yres > info->fix.smem_len) gxfb_check_var()
171 static int gxfb_set_par(struct fb_info *info) gxfb_set_par() argument
173 if (info->var.bits_per_pixel > 8) gxfb_set_par()
174 info->fix.visual = FB_VISUAL_TRUECOLOR; gxfb_set_par()
176 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; gxfb_set_par()
178 info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel); gxfb_set_par()
180 gx_set_mode(info); gxfb_set_par()
194 struct fb_info *info) gxfb_setcolreg()
196 if (info->var.grayscale) { gxfb_setcolreg()
202 if (info->fix.visual == FB_VISUAL_TRUECOLOR) { gxfb_setcolreg()
203 u32 *pal = info->pseudo_palette; gxfb_setcolreg()
209 v = chan_to_field(red, &info->var.red); gxfb_setcolreg()
210 v |= chan_to_field(green, &info->var.green); gxfb_setcolreg()
211 v |= chan_to_field(blue, &info->var.blue); gxfb_setcolreg()
218 gx_set_hw_palette_reg(info, regno, red, green, blue); gxfb_setcolreg()
224 static int gxfb_blank(int blank_mode, struct fb_info *info) gxfb_blank() argument
226 return gx_blank_display(info, blank_mode); gxfb_blank()
229 static int gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) gxfb_map_video_memory() argument
231 struct gxfb_par *par = info->par; gxfb_map_video_memory()
264 info->fix.smem_start = pci_resource_start(dev, 0); gxfb_map_video_memory()
265 info->fix.smem_len = vram ? vram : gx_frame_buffer_size(); gxfb_map_video_memory()
266 info->screen_base = ioremap_wc(info->fix.smem_start, gxfb_map_video_memory()
267 info->fix.smem_len); gxfb_map_video_memory()
268 if (!info->screen_base) gxfb_map_video_memory()
274 write_dc(par, DC_GLIU0_MEM_OFFSET, info->fix.smem_start & 0xFF000000); gxfb_map_video_memory()
277 info->fix.smem_len / 1024, info->fix.smem_start); gxfb_map_video_memory()
297 struct fb_info *info; gxfb_init_fbinfo() local
300 info = framebuffer_alloc(sizeof(struct gxfb_par) + sizeof(u32) * 16, gxfb_init_fbinfo()
302 if (!info) gxfb_init_fbinfo()
305 par = info->par; gxfb_init_fbinfo()
307 strcpy(info->fix.id, "Geode GX"); gxfb_init_fbinfo()
309 info->fix.type = FB_TYPE_PACKED_PIXELS; gxfb_init_fbinfo()
310 info->fix.type_aux = 0; gxfb_init_fbinfo()
311 info->fix.xpanstep = 0; gxfb_init_fbinfo()
312 info->fix.ypanstep = 0; gxfb_init_fbinfo()
313 info->fix.ywrapstep = 0; gxfb_init_fbinfo()
314 info->fix.accel = FB_ACCEL_NONE; gxfb_init_fbinfo()
316 info->var.nonstd = 0; gxfb_init_fbinfo()
317 info->var.activate = FB_ACTIVATE_NOW; gxfb_init_fbinfo()
318 info->var.height = -1; gxfb_init_fbinfo()
319 info->var.width = -1; gxfb_init_fbinfo()
320 info->var.accel_flags = 0; gxfb_init_fbinfo()
321 info->var.vmode = FB_VMODE_NONINTERLACED; gxfb_init_fbinfo()
323 info->fbops = &gxfb_ops; gxfb_init_fbinfo()
324 info->flags = FBINFO_DEFAULT; gxfb_init_fbinfo()
325 info->node = -1; gxfb_init_fbinfo()
327 info->pseudo_palette = (void *)par + sizeof(struct gxfb_par); gxfb_init_fbinfo()
329 info->var.grayscale = 0; gxfb_init_fbinfo()
331 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { gxfb_init_fbinfo()
332 framebuffer_release(info); gxfb_init_fbinfo()
336 return info; gxfb_init_fbinfo()
342 struct fb_info *info = pci_get_drvdata(pdev); gxfb_suspend() local
346 gx_powerdown(info); gxfb_suspend()
347 fb_set_suspend(info, 1); gxfb_suspend()
359 struct fb_info *info = pci_get_drvdata(pdev); gxfb_resume() local
363 ret = gx_powerup(info); gxfb_resume()
369 fb_set_suspend(info, 0); gxfb_resume()
378 struct fb_info *info; gxfb_probe() local
385 info = gxfb_init_fbinfo(&pdev->dev); gxfb_probe()
386 if (!info) gxfb_probe()
388 par = info->par; gxfb_probe()
390 if ((ret = gxfb_map_video_memory(info, pdev)) < 0) { gxfb_probe()
405 ret = fb_find_mode(&info->var, info, mode_option, gxfb_probe()
415 memset_io(info->screen_base, 0, info->fix.smem_len); gxfb_probe()
417 gxfb_check_var(&info->var, info); gxfb_probe()
418 gxfb_set_par(info); gxfb_probe()
422 if (register_framebuffer(info) < 0) { gxfb_probe()
426 pci_set_drvdata(pdev, info); gxfb_probe()
427 fb_info(info, "%s frame buffer device\n", info->fix.id); gxfb_probe()
431 if (info->screen_base) { gxfb_probe()
432 iounmap(info->screen_base); gxfb_probe()
448 fb_dealloc_cmap(&info->cmap); gxfb_probe()
449 framebuffer_release(info); gxfb_probe()
455 struct fb_info *info = pci_get_drvdata(pdev); gxfb_remove() local
456 struct gxfb_par *par = info->par; gxfb_remove()
458 unregister_framebuffer(info); gxfb_remove()
460 iounmap((void __iomem *)info->screen_base); gxfb_remove()
472 fb_dealloc_cmap(&info->cmap); gxfb_remove()
474 framebuffer_release(info); gxfb_remove()
192 gxfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) gxfb_setcolreg() argument
H A Dlxfb_core.c248 static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) lxfb_check_var() argument
272 > info->fix.smem_len) lxfb_check_var()
278 static int lxfb_set_par(struct fb_info *info) lxfb_set_par() argument
280 if (info->var.bits_per_pixel > 8) lxfb_set_par()
281 info->fix.visual = FB_VISUAL_TRUECOLOR; lxfb_set_par()
283 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; lxfb_set_par()
285 info->fix.line_length = lx_get_pitch(info->var.xres, lxfb_set_par()
286 info->var.bits_per_pixel); lxfb_set_par()
288 lx_set_mode(info); lxfb_set_par()
301 struct fb_info *info) lxfb_setcolreg()
303 if (info->var.grayscale) { lxfb_setcolreg()
309 if (info->fix.visual == FB_VISUAL_TRUECOLOR) { lxfb_setcolreg()
310 u32 *pal = info->pseudo_palette; lxfb_setcolreg()
316 v = chan_to_field(red, &info->var.red); lxfb_setcolreg()
317 v |= chan_to_field(green, &info->var.green); lxfb_setcolreg()
318 v |= chan_to_field(blue, &info->var.blue); lxfb_setcolreg()
325 lx_set_palette_reg(info, regno, red, green, blue); lxfb_setcolreg()
331 static int lxfb_blank(int blank_mode, struct fb_info *info) lxfb_blank() argument
333 return lx_blank_display(info, blank_mode); lxfb_blank()
337 static int lxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) lxfb_map_video_memory() argument
339 struct lxfb_par *par = info->par; lxfb_map_video_memory()
367 info->fix.smem_start = pci_resource_start(dev, 0); lxfb_map_video_memory()
368 info->fix.smem_len = vram ? vram : lx_framebuffer_size(); lxfb_map_video_memory()
370 info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len); lxfb_map_video_memory()
374 if (info->screen_base == NULL) lxfb_map_video_memory()
393 write_dc(par, DC_GLIU0_MEM_OFFSET, info->fix.smem_start & 0xFF000000); lxfb_map_video_memory()
397 info->fix.smem_len / 1024, info->fix.smem_start); lxfb_map_video_memory()
417 struct fb_info *info; lxfb_init_fbinfo() local
420 info = framebuffer_alloc(sizeof(struct lxfb_par) + sizeof(u32) * 16, lxfb_init_fbinfo()
422 if (!info) lxfb_init_fbinfo()
425 par = info->par; lxfb_init_fbinfo()
427 strcpy(info->fix.id, "Geode LX"); lxfb_init_fbinfo()
429 info->fix.type = FB_TYPE_PACKED_PIXELS; lxfb_init_fbinfo()
430 info->fix.type_aux = 0; lxfb_init_fbinfo()
431 info->fix.xpanstep = 0; lxfb_init_fbinfo()
432 info->fix.ypanstep = 0; lxfb_init_fbinfo()
433 info->fix.ywrapstep = 0; lxfb_init_fbinfo()
434 info->fix.accel = FB_ACCEL_NONE; lxfb_init_fbinfo()
436 info->var.nonstd = 0; lxfb_init_fbinfo()
437 info->var.activate = FB_ACTIVATE_NOW; lxfb_init_fbinfo()
438 info->var.height = -1; lxfb_init_fbinfo()
439 info->var.width = -1; lxfb_init_fbinfo()
440 info->var.accel_flags = 0; lxfb_init_fbinfo()
441 info->var.vmode = FB_VMODE_NONINTERLACED; lxfb_init_fbinfo()
443 info->fbops = &lxfb_ops; lxfb_init_fbinfo()
444 info->flags = FBINFO_DEFAULT; lxfb_init_fbinfo()
445 info->node = -1; lxfb_init_fbinfo()
447 info->pseudo_palette = (void *)par + sizeof(struct lxfb_par); lxfb_init_fbinfo()
449 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { lxfb_init_fbinfo()
450 framebuffer_release(info); lxfb_init_fbinfo()
454 info->var.grayscale = 0; lxfb_init_fbinfo()
456 return info; lxfb_init_fbinfo()
462 struct fb_info *info = pci_get_drvdata(pdev); lxfb_suspend() local
466 lx_powerdown(info); lxfb_suspend()
467 fb_set_suspend(info, 1); lxfb_suspend()
479 struct fb_info *info = pci_get_drvdata(pdev); lxfb_resume() local
483 ret = lx_powerup(info); lxfb_resume()
489 fb_set_suspend(info, 0); lxfb_resume()
501 struct fb_info *info; lxfb_probe() local
507 info = lxfb_init_fbinfo(&pdev->dev); lxfb_probe()
509 if (info == NULL) lxfb_probe()
512 par = info->par; lxfb_probe()
514 ret = lxfb_map_video_memory(info, pdev); lxfb_probe()
531 ret = fb_find_mode(&info->var, info, mode_option, lxfb_probe()
544 memset_io(info->screen_base, 0, info->fix.smem_len); lxfb_probe()
548 lxfb_check_var(&info->var, info); lxfb_probe()
549 lxfb_set_par(info); lxfb_probe()
553 if (register_framebuffer(info) < 0) { lxfb_probe()
557 pci_set_drvdata(pdev, info); lxfb_probe()
558 fb_info(info, "%s frame buffer device\n", info->fix.id); lxfb_probe()
563 if (info->screen_base) { lxfb_probe()
564 iounmap(info->screen_base); lxfb_probe()
580 fb_dealloc_cmap(&info->cmap); lxfb_probe()
581 framebuffer_release(info); lxfb_probe()
588 struct fb_info *info = pci_get_drvdata(pdev); lxfb_remove() local
589 struct lxfb_par *par = info->par; lxfb_remove()
591 unregister_framebuffer(info); lxfb_remove()
593 iounmap(info->screen_base); lxfb_remove()
605 fb_dealloc_cmap(&info->cmap); lxfb_remove()
606 framebuffer_release(info); lxfb_remove()
299 lxfb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) lxfb_setcolreg() argument
/linux-4.4.14/drivers/iio/adc/
H A Dexynos_adc.c121 void (*init_hw)(struct exynos_adc *info);
122 void (*exit_hw)(struct exynos_adc *info);
123 void (*clear_irq)(struct exynos_adc *info);
124 void (*start_conv)(struct exynos_adc *info, unsigned long addr);
127 static void exynos_adc_unprepare_clk(struct exynos_adc *info) exynos_adc_unprepare_clk() argument
129 if (info->data->needs_sclk) exynos_adc_unprepare_clk()
130 clk_unprepare(info->sclk); exynos_adc_unprepare_clk()
131 clk_unprepare(info->clk); exynos_adc_unprepare_clk()
134 static int exynos_adc_prepare_clk(struct exynos_adc *info) exynos_adc_prepare_clk() argument
138 ret = clk_prepare(info->clk); exynos_adc_prepare_clk()
140 dev_err(info->dev, "failed preparing adc clock: %d\n", ret); exynos_adc_prepare_clk()
144 if (info->data->needs_sclk) { exynos_adc_prepare_clk()
145 ret = clk_prepare(info->sclk); exynos_adc_prepare_clk()
147 clk_unprepare(info->clk); exynos_adc_prepare_clk()
148 dev_err(info->dev, exynos_adc_prepare_clk()
157 static void exynos_adc_disable_clk(struct exynos_adc *info) exynos_adc_disable_clk() argument
159 if (info->data->needs_sclk) exynos_adc_disable_clk()
160 clk_disable(info->sclk); exynos_adc_disable_clk()
161 clk_disable(info->clk); exynos_adc_disable_clk()
164 static int exynos_adc_enable_clk(struct exynos_adc *info) exynos_adc_enable_clk() argument
168 ret = clk_enable(info->clk); exynos_adc_enable_clk()
170 dev_err(info->dev, "failed enabling adc clock: %d\n", ret); exynos_adc_enable_clk()
174 if (info->data->needs_sclk) { exynos_adc_enable_clk()
175 ret = clk_enable(info->sclk); exynos_adc_enable_clk()
177 clk_disable(info->clk); exynos_adc_enable_clk()
178 dev_err(info->dev, exynos_adc_enable_clk()
187 static void exynos_adc_v1_init_hw(struct exynos_adc *info) exynos_adc_v1_init_hw() argument
191 if (info->data->needs_adc_phy) exynos_adc_v1_init_hw()
192 regmap_write(info->pmu_map, info->data->phy_offset, 1); exynos_adc_v1_init_hw()
199 writel(con1, ADC_V1_CON(info->regs)); exynos_adc_v1_init_hw()
202 static void exynos_adc_v1_exit_hw(struct exynos_adc *info) exynos_adc_v1_exit_hw() argument
206 if (info->data->needs_adc_phy) exynos_adc_v1_exit_hw()
207 regmap_write(info->pmu_map, info->data->phy_offset, 0); exynos_adc_v1_exit_hw()
209 con = readl(ADC_V1_CON(info->regs)); exynos_adc_v1_exit_hw()
211 writel(con, ADC_V1_CON(info->regs)); exynos_adc_v1_exit_hw()
214 static void exynos_adc_v1_clear_irq(struct exynos_adc *info) exynos_adc_v1_clear_irq() argument
216 writel(1, ADC_V1_INTCLR(info->regs)); exynos_adc_v1_clear_irq()
219 static void exynos_adc_v1_start_conv(struct exynos_adc *info, exynos_adc_v1_start_conv() argument
224 writel(addr, ADC_V1_MUX(info->regs)); exynos_adc_v1_start_conv()
226 con1 = readl(ADC_V1_CON(info->regs)); exynos_adc_v1_start_conv()
227 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); exynos_adc_v1_start_conv()
242 static void exynos_adc_s3c2416_start_conv(struct exynos_adc *info, exynos_adc_s3c2416_start_conv() argument
248 con1 = readl(ADC_V1_CON(info->regs)); exynos_adc_s3c2416_start_conv()
250 writel(con1, ADC_V1_CON(info->regs)); exynos_adc_s3c2416_start_conv()
253 writel(addr, ADC_S3C2410_MUX(info->regs)); exynos_adc_s3c2416_start_conv()
255 con1 = readl(ADC_V1_CON(info->regs)); exynos_adc_s3c2416_start_conv()
256 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); exynos_adc_s3c2416_start_conv()
268 static void exynos_adc_s3c2443_start_conv(struct exynos_adc *info, exynos_adc_s3c2443_start_conv() argument
274 writel(addr, ADC_S3C2410_MUX(info->regs)); exynos_adc_s3c2443_start_conv()
276 con1 = readl(ADC_V1_CON(info->regs)); exynos_adc_s3c2443_start_conv()
277 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); exynos_adc_s3c2443_start_conv()
289 static void exynos_adc_s3c64xx_start_conv(struct exynos_adc *info, exynos_adc_s3c64xx_start_conv() argument
294 con1 = readl(ADC_V1_CON(info->regs)); exynos_adc_s3c64xx_start_conv()
297 writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs)); exynos_adc_s3c64xx_start_conv()
319 static void exynos_adc_v2_init_hw(struct exynos_adc *info) exynos_adc_v2_init_hw() argument
323 if (info->data->needs_adc_phy) exynos_adc_v2_init_hw()
324 regmap_write(info->pmu_map, info->data->phy_offset, 1); exynos_adc_v2_init_hw()
327 writel(con1, ADC_V2_CON1(info->regs)); exynos_adc_v2_init_hw()
331 writel(con2, ADC_V2_CON2(info->regs)); exynos_adc_v2_init_hw()
334 writel(1, ADC_V2_INT_EN(info->regs)); exynos_adc_v2_init_hw()
337 static void exynos_adc_v2_exit_hw(struct exynos_adc *info) exynos_adc_v2_exit_hw() argument
341 if (info->data->needs_adc_phy) exynos_adc_v2_exit_hw()
342 regmap_write(info->pmu_map, info->data->phy_offset, 0); exynos_adc_v2_exit_hw()
344 con = readl(ADC_V2_CON1(info->regs)); exynos_adc_v2_exit_hw()
346 writel(con, ADC_V2_CON1(info->regs)); exynos_adc_v2_exit_hw()
349 static void exynos_adc_v2_clear_irq(struct exynos_adc *info) exynos_adc_v2_clear_irq() argument
351 writel(1, ADC_V2_INT_ST(info->regs)); exynos_adc_v2_clear_irq()
354 static void exynos_adc_v2_start_conv(struct exynos_adc *info, exynos_adc_v2_start_conv() argument
359 con2 = readl(ADC_V2_CON2(info->regs)); exynos_adc_v2_start_conv()
362 writel(con2, ADC_V2_CON2(info->regs)); exynos_adc_v2_start_conv()
364 con1 = readl(ADC_V2_CON1(info->regs)); exynos_adc_v2_start_conv()
365 writel(con1 | ADC_CON_EN_START, ADC_V2_CON1(info->regs)); exynos_adc_v2_start_conv()
393 static void exynos_adc_exynos7_init_hw(struct exynos_adc *info) exynos_adc_exynos7_init_hw() argument
397 if (info->data->needs_adc_phy) exynos_adc_exynos7_init_hw()
398 regmap_write(info->pmu_map, info->data->phy_offset, 1); exynos_adc_exynos7_init_hw()
401 writel(con1, ADC_V2_CON1(info->regs)); exynos_adc_exynos7_init_hw()
403 con2 = readl(ADC_V2_CON2(info->regs)); exynos_adc_exynos7_init_hw()
406 writel(con2, ADC_V2_CON2(info->regs)); exynos_adc_exynos7_init_hw()
409 writel(1, ADC_V2_INT_EN(info->regs)); exynos_adc_exynos7_init_hw()
469 struct exynos_adc *info = iio_priv(indio_dev); exynos_read_raw() local
477 reinit_completion(&info->completion); exynos_read_raw()
480 if (info->data->start_conv) exynos_read_raw()
481 info->data->start_conv(info, chan->address); exynos_read_raw()
484 (&info->completion, EXYNOS_ADC_TIMEOUT); exynos_read_raw()
487 if (info->data->init_hw) exynos_read_raw()
488 info->data->init_hw(info); exynos_read_raw()
491 *val = info->value; exynos_read_raw()
503 struct exynos_adc *info = (struct exynos_adc *)dev_id; exynos_adc_isr() local
504 u32 mask = info->data->mask; exynos_adc_isr()
507 info->value = readl(ADC_V1_DATX(info->regs)) & mask; exynos_adc_isr()
510 if (info->data->clear_irq) exynos_adc_isr()
511 info->data->clear_irq(info); exynos_adc_isr()
513 complete(&info->completion); exynos_adc_isr()
522 struct exynos_adc *info = iio_priv(indio_dev); exynos_adc_reg_access() local
527 *readval = readl(info->regs + reg); exynos_adc_reg_access()
571 struct exynos_adc *info = NULL; exynos_adc_probe() local
587 info = iio_priv(indio_dev); exynos_adc_probe()
589 info->data = exynos_adc_get_data(pdev); exynos_adc_probe()
590 if (!info->data) { exynos_adc_probe()
596 info->regs = devm_ioremap_resource(&pdev->dev, mem); exynos_adc_probe()
597 if (IS_ERR(info->regs)) exynos_adc_probe()
598 return PTR_ERR(info->regs); exynos_adc_probe()
601 if (info->data->needs_adc_phy) { exynos_adc_probe()
602 info->pmu_map = syscon_regmap_lookup_by_phandle( exynos_adc_probe()
605 if (IS_ERR(info->pmu_map)) { exynos_adc_probe()
607 return PTR_ERR(info->pmu_map); exynos_adc_probe()
617 info->irq = irq; exynos_adc_probe()
618 info->dev = &pdev->dev; exynos_adc_probe()
620 init_completion(&info->completion); exynos_adc_probe()
622 info->clk = devm_clk_get(&pdev->dev, "adc"); exynos_adc_probe()
623 if (IS_ERR(info->clk)) { exynos_adc_probe()
625 PTR_ERR(info->clk)); exynos_adc_probe()
626 return PTR_ERR(info->clk); exynos_adc_probe()
629 if (info->data->needs_sclk) { exynos_adc_probe()
630 info->sclk = devm_clk_get(&pdev->dev, "sclk"); exynos_adc_probe()
631 if (IS_ERR(info->sclk)) { exynos_adc_probe()
634 PTR_ERR(info->sclk)); exynos_adc_probe()
635 return PTR_ERR(info->sclk); exynos_adc_probe()
639 info->vdd = devm_regulator_get(&pdev->dev, "vdd"); exynos_adc_probe()
640 if (IS_ERR(info->vdd)) { exynos_adc_probe()
642 PTR_ERR(info->vdd)); exynos_adc_probe()
643 return PTR_ERR(info->vdd); exynos_adc_probe()
646 ret = regulator_enable(info->vdd); exynos_adc_probe()
650 ret = exynos_adc_prepare_clk(info); exynos_adc_probe()
654 ret = exynos_adc_enable_clk(info); exynos_adc_probe()
663 indio_dev->info = &exynos_adc_iio_info; exynos_adc_probe()
666 indio_dev->num_channels = info->data->num_channels; exynos_adc_probe()
668 ret = request_irq(info->irq, exynos_adc_isr, exynos_adc_probe()
669 0, dev_name(&pdev->dev), info); exynos_adc_probe()
672 info->irq); exynos_adc_probe()
680 if (info->data->init_hw) exynos_adc_probe()
681 info->data->init_hw(info); exynos_adc_probe()
696 free_irq(info->irq, info); exynos_adc_probe()
698 if (info->data->exit_hw) exynos_adc_probe()
699 info->data->exit_hw(info); exynos_adc_probe()
700 exynos_adc_disable_clk(info); exynos_adc_probe()
702 exynos_adc_unprepare_clk(info); exynos_adc_probe()
704 regulator_disable(info->vdd); exynos_adc_probe()
711 struct exynos_adc *info = iio_priv(indio_dev); exynos_adc_remove() local
716 free_irq(info->irq, info); exynos_adc_remove()
717 if (info->data->exit_hw) exynos_adc_remove()
718 info->data->exit_hw(info); exynos_adc_remove()
719 exynos_adc_disable_clk(info); exynos_adc_remove()
720 exynos_adc_unprepare_clk(info); exynos_adc_remove()
721 regulator_disable(info->vdd); exynos_adc_remove()
730 struct exynos_adc *info = iio_priv(indio_dev); exynos_adc_suspend() local
732 if (info->data->exit_hw) exynos_adc_suspend()
733 info->data->exit_hw(info); exynos_adc_suspend()
734 exynos_adc_disable_clk(info); exynos_adc_suspend()
735 regulator_disable(info->vdd); exynos_adc_suspend()
743 struct exynos_adc *info = iio_priv(indio_dev); exynos_adc_resume() local
746 ret = regulator_enable(info->vdd); exynos_adc_resume()
750 ret = exynos_adc_enable_clk(info); exynos_adc_resume()
754 if (info->data->init_hw) exynos_adc_resume()
755 info->data->init_hw(info); exynos_adc_resume()
H A Drockchip_saradc.c64 struct rockchip_saradc *info = iio_priv(indio_dev); rockchip_saradc_read_raw() local
71 reinit_completion(&info->completion); rockchip_saradc_read_raw()
74 writel_relaxed(8, info->regs + SARADC_DLY_PU_SOC); rockchip_saradc_read_raw()
80 info->regs + SARADC_CTRL); rockchip_saradc_read_raw()
82 if (!wait_for_completion_timeout(&info->completion, rockchip_saradc_read_raw()
84 writel_relaxed(0, info->regs + SARADC_CTRL); rockchip_saradc_read_raw()
89 *val = info->last_val; rockchip_saradc_read_raw()
93 ret = regulator_get_voltage(info->vref); rockchip_saradc_read_raw()
100 *val2 = info->data->num_bits; rockchip_saradc_read_raw()
109 struct rockchip_saradc *info = (struct rockchip_saradc *)dev_id; rockchip_saradc_isr() local
112 info->last_val = readl_relaxed(info->regs + SARADC_DATA); rockchip_saradc_isr()
113 info->last_val &= GENMASK(info->data->num_bits - 1, 0); rockchip_saradc_isr()
116 writel_relaxed(0, info->regs + SARADC_CTRL); rockchip_saradc_isr()
118 complete(&info->completion); rockchip_saradc_isr()
176 struct rockchip_saradc *info = NULL; rockchip_saradc_probe() local
187 indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info)); rockchip_saradc_probe()
192 info = iio_priv(indio_dev); rockchip_saradc_probe()
195 info->data = match->data; rockchip_saradc_probe()
198 info->regs = devm_ioremap_resource(&pdev->dev, mem); rockchip_saradc_probe()
199 if (IS_ERR(info->regs)) rockchip_saradc_probe()
200 return PTR_ERR(info->regs); rockchip_saradc_probe()
202 init_completion(&info->completion); rockchip_saradc_probe()
211 0, dev_name(&pdev->dev), info); rockchip_saradc_probe()
217 info->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); rockchip_saradc_probe()
218 if (IS_ERR(info->pclk)) { rockchip_saradc_probe()
220 return PTR_ERR(info->pclk); rockchip_saradc_probe()
223 info->clk = devm_clk_get(&pdev->dev, "saradc"); rockchip_saradc_probe()
224 if (IS_ERR(info->clk)) { rockchip_saradc_probe()
226 return PTR_ERR(info->clk); rockchip_saradc_probe()
229 info->vref = devm_regulator_get(&pdev->dev, "vref"); rockchip_saradc_probe()
230 if (IS_ERR(info->vref)) { rockchip_saradc_probe()
232 PTR_ERR(info->vref)); rockchip_saradc_probe()
233 return PTR_ERR(info->vref); rockchip_saradc_probe()
240 ret = clk_set_rate(info->clk, info->data->clk_rate); rockchip_saradc_probe()
246 ret = regulator_enable(info->vref); rockchip_saradc_probe()
252 ret = clk_prepare_enable(info->pclk); rockchip_saradc_probe()
258 ret = clk_prepare_enable(info->clk); rockchip_saradc_probe()
269 indio_dev->info = &rockchip_saradc_iio_info; rockchip_saradc_probe()
272 indio_dev->channels = info->data->channels; rockchip_saradc_probe()
273 indio_dev->num_channels = info->data->num_channels; rockchip_saradc_probe()
282 clk_disable_unprepare(info->clk); rockchip_saradc_probe()
284 clk_disable_unprepare(info->pclk); rockchip_saradc_probe()
286 regulator_disable(info->vref); rockchip_saradc_probe()
293 struct rockchip_saradc *info = iio_priv(indio_dev); rockchip_saradc_remove() local
296 clk_disable_unprepare(info->clk); rockchip_saradc_remove()
297 clk_disable_unprepare(info->pclk); rockchip_saradc_remove()
298 regulator_disable(info->vref); rockchip_saradc_remove()
307 struct rockchip_saradc *info = iio_priv(indio_dev); rockchip_saradc_suspend() local
309 clk_disable_unprepare(info->clk); rockchip_saradc_suspend()
310 clk_disable_unprepare(info->pclk); rockchip_saradc_suspend()
311 regulator_disable(info->vref); rockchip_saradc_suspend()
319 struct rockchip_saradc *info = iio_priv(indio_dev); rockchip_saradc_resume() local
322 ret = regulator_enable(info->vref); rockchip_saradc_resume()
326 ret = clk_prepare_enable(info->pclk); rockchip_saradc_resume()
330 ret = clk_prepare_enable(info->clk); rockchip_saradc_resume()
H A Dvf610_adc.c189 static inline void vf610_adc_calculate_rates(struct vf610_adc *info) vf610_adc_calculate_rates() argument
191 struct vf610_adc_feature *adc_feature = &info->adc_feature; vf610_adc_calculate_rates()
192 unsigned long adck_rate, ipg_rate = clk_get_rate(info->clk); vf610_adc_calculate_rates()
196 adck_rate = info->max_adck_rate[adc_feature->conv_mode]; vf610_adc_calculate_rates()
234 info->sample_freq_avail[i] = vf610_adc_calculate_rates()
239 static inline void vf610_adc_cfg_init(struct vf610_adc *info) vf610_adc_cfg_init() argument
241 struct vf610_adc_feature *adc_feature = &info->adc_feature; vf610_adc_cfg_init()
255 vf610_adc_calculate_rates(info); vf610_adc_cfg_init()
258 static void vf610_adc_cfg_post_set(struct vf610_adc *info) vf610_adc_cfg_post_set() argument
260 struct vf610_adc_feature *adc_feature = &info->adc_feature; vf610_adc_cfg_post_set()
292 dev_err(info->dev, "error voltage reference\n"); vf610_adc_cfg_post_set()
299 writel(cfg_data, info->regs + VF610_REG_ADC_CFG); vf610_adc_cfg_post_set()
300 writel(gc_data, info->regs + VF610_REG_ADC_GC); vf610_adc_cfg_post_set()
303 static void vf610_adc_calibration(struct vf610_adc *info) vf610_adc_calibration() argument
307 if (!info->adc_feature.calibration) vf610_adc_calibration()
312 writel(hc_cfg, info->regs + VF610_REG_ADC_HC0); vf610_adc_calibration()
314 adc_gc = readl(info->regs + VF610_REG_ADC_GC); vf610_adc_calibration()
315 writel(adc_gc | VF610_ADC_CAL, info->regs + VF610_REG_ADC_GC); vf610_adc_calibration()
317 if (!wait_for_completion_timeout(&info->completion, VF610_ADC_TIMEOUT)) vf610_adc_calibration()
318 dev_err(info->dev, "Timeout for adc calibration\n"); vf610_adc_calibration()
320 adc_gc = readl(info->regs + VF610_REG_ADC_GS); vf610_adc_calibration()
322 dev_err(info->dev, "ADC calibration failed\n"); vf610_adc_calibration()
324 info->adc_feature.calibration = false; vf610_adc_calibration()
327 static void vf610_adc_cfg_set(struct vf610_adc *info) vf610_adc_cfg_set() argument
329 struct vf610_adc_feature *adc_feature = &(info->adc_feature); vf610_adc_cfg_set()
332 cfg_data = readl(info->regs + VF610_REG_ADC_CFG); vf610_adc_cfg_set()
342 writel(cfg_data, info->regs + VF610_REG_ADC_CFG); vf610_adc_cfg_set()
345 static void vf610_adc_sample_set(struct vf610_adc *info) vf610_adc_sample_set() argument
347 struct vf610_adc_feature *adc_feature = &(info->adc_feature); vf610_adc_sample_set()
350 cfg_data = readl(info->regs + VF610_REG_ADC_CFG); vf610_adc_sample_set()
351 gc_data = readl(info->regs + VF610_REG_ADC_GC); vf610_adc_sample_set()
366 dev_err(info->dev, "error resolution mode\n"); vf610_adc_sample_set()
390 dev_err(info->dev, "error clk divider\n"); vf610_adc_sample_set()
428 dev_err(info->dev, "error in sample time select\n"); vf610_adc_sample_set()
453 dev_err(info->dev, vf610_adc_sample_set()
457 writel(cfg_data, info->regs + VF610_REG_ADC_CFG); vf610_adc_sample_set()
458 writel(gc_data, info->regs + VF610_REG_ADC_GC); vf610_adc_sample_set()
461 static void vf610_adc_hw_init(struct vf610_adc *info) vf610_adc_hw_init() argument
464 vf610_adc_cfg_post_set(info); vf610_adc_hw_init()
465 vf610_adc_sample_set(info); vf610_adc_hw_init()
468 vf610_adc_calibration(info); vf610_adc_hw_init()
471 vf610_adc_cfg_set(info); vf610_adc_hw_init()
478 struct vf610_adc *info = iio_priv(indio_dev); vf610_set_conversion_mode() local
481 info->adc_feature.conv_mode = mode; vf610_set_conversion_mode()
482 vf610_adc_calculate_rates(info); vf610_set_conversion_mode()
483 vf610_adc_hw_init(info); vf610_set_conversion_mode()
492 struct vf610_adc *info = iio_priv(indio_dev); vf610_get_conversion_mode() local
494 return info->adc_feature.conv_mode; vf610_get_conversion_mode()
562 static int vf610_adc_read_data(struct vf610_adc *info) vf610_adc_read_data() argument
566 result = readl(info->regs + VF610_REG_ADC_R0); vf610_adc_read_data()
568 switch (info->adc_feature.res_mode) { vf610_adc_read_data()
588 struct vf610_adc *info = iio_priv(indio_dev); vf610_adc_isr() local
591 coco = readl(info->regs + VF610_REG_ADC_HS); vf610_adc_isr()
593 info->value = vf610_adc_read_data(info); vf610_adc_isr()
595 info->buffer[0] = info->value; vf610_adc_isr()
597 info->buffer, iio_get_time_ns()); vf610_adc_isr()
600 complete(&info->completion); vf610_adc_isr()
609 struct vf610_adc *info = iio_priv(dev_to_iio_dev(dev)); vf610_show_samp_freq_avail() local
613 for (i = 0; i < ARRAY_SIZE(info->sample_freq_avail); i++) vf610_show_samp_freq_avail()
615 "%u ", info->sample_freq_avail[i]); vf610_show_samp_freq_avail()
640 struct vf610_adc *info = iio_priv(indio_dev); vf610_read_raw() local
653 reinit_completion(&info->completion); vf610_read_raw()
656 writel(hc_cfg, info->regs + VF610_REG_ADC_HC0); vf610_read_raw()
658 (&info->completion, VF610_ADC_TIMEOUT); vf610_read_raw()
670 *val = info->value; vf610_read_raw()
678 *val = 25000 - ((int)info->value - VF610_VTEMP25_3V3) * vf610_read_raw()
691 *val = info->vref_uv / 1000; vf610_read_raw()
692 *val2 = info->adc_feature.res_mode; vf610_read_raw()
696 *val = info->sample_freq_avail[info->adc_feature.sample_rate]; vf610_read_raw()
713 struct vf610_adc *info = iio_priv(indio_dev); vf610_write_raw() local
719 i < ARRAY_SIZE(info->sample_freq_avail); vf610_write_raw()
721 if (val == info->sample_freq_avail[i]) { vf610_write_raw()
722 info->adc_feature.sample_rate = i; vf610_write_raw()
723 vf610_adc_sample_set(info); vf610_write_raw()
737 struct vf610_adc *info = iio_priv(indio_dev); vf610_adc_buffer_postenable() local
746 val = readl(info->regs + VF610_REG_ADC_GC); vf610_adc_buffer_postenable()
748 writel(val, info->regs + VF610_REG_ADC_GC); vf610_adc_buffer_postenable()
756 writel(val, info->regs + VF610_REG_ADC_HC0); vf610_adc_buffer_postenable()
763 struct vf610_adc *info = iio_priv(indio_dev); vf610_adc_buffer_predisable() local
767 val = readl(info->regs + VF610_REG_ADC_GC); vf610_adc_buffer_predisable()
769 writel(val, info->regs + VF610_REG_ADC_GC); vf610_adc_buffer_predisable()
774 writel(hc_cfg, info->regs + VF610_REG_ADC_HC0); vf610_adc_buffer_predisable()
789 struct vf610_adc *info = iio_priv(indio_dev); vf610_adc_reg_access() local
795 *readval = readl(info->regs + reg); vf610_adc_reg_access()
816 struct vf610_adc *info; vf610_adc_probe() local
828 info = iio_priv(indio_dev); vf610_adc_probe()
829 info->dev = &pdev->dev; vf610_adc_probe()
832 info->regs = devm_ioremap_resource(&pdev->dev, mem); vf610_adc_probe()
833 if (IS_ERR(info->regs)) vf610_adc_probe()
834 return PTR_ERR(info->regs); vf610_adc_probe()
842 ret = devm_request_irq(info->dev, irq, vf610_adc_probe()
850 info->clk = devm_clk_get(&pdev->dev, "adc"); vf610_adc_probe()
851 if (IS_ERR(info->clk)) { vf610_adc_probe()
853 PTR_ERR(info->clk)); vf610_adc_probe()
854 return PTR_ERR(info->clk); vf610_adc_probe()
857 info->vref = devm_regulator_get(&pdev->dev, "vref"); vf610_adc_probe()
858 if (IS_ERR(info->vref)) vf610_adc_probe()
859 return PTR_ERR(info->vref); vf610_adc_probe()
861 ret = regulator_enable(info->vref); vf610_adc_probe()
865 info->vref_uv = regulator_get_voltage(info->vref); vf610_adc_probe()
868 info->max_adck_rate, 3); vf610_adc_probe()
871 &info->adc_feature.default_sample_time); vf610_adc_probe()
873 info->adc_feature.default_sample_time = DEFAULT_SAMPLE_TIME; vf610_adc_probe()
877 init_completion(&info->completion); vf610_adc_probe()
882 indio_dev->info = &vf610_adc_iio_info; vf610_adc_probe()
887 ret = clk_prepare_enable(info->clk); vf610_adc_probe()
894 vf610_adc_cfg_init(info); vf610_adc_probe()
895 vf610_adc_hw_init(info); vf610_adc_probe()
915 clk_disable_unprepare(info->clk); vf610_adc_probe()
917 regulator_disable(info->vref); vf610_adc_probe()
925 struct vf610_adc *info = iio_priv(indio_dev); vf610_adc_remove() local
929 regulator_disable(info->vref); vf610_adc_remove()
930 clk_disable_unprepare(info->clk); vf610_adc_remove()
939 struct vf610_adc *info = iio_priv(indio_dev); vf610_adc_suspend() local
943 hc_cfg = readl(info->regs + VF610_REG_ADC_HC0); vf610_adc_suspend()
945 writel(hc_cfg, info->regs + VF610_REG_ADC_HC0); vf610_adc_suspend()
947 clk_disable_unprepare(info->clk); vf610_adc_suspend()
948 regulator_disable(info->vref); vf610_adc_suspend()
956 struct vf610_adc *info = iio_priv(indio_dev); vf610_adc_resume() local
959 ret = regulator_enable(info->vref); vf610_adc_resume()
963 ret = clk_prepare_enable(info->clk); vf610_adc_resume()
967 vf610_adc_hw_init(info); vf610_adc_resume()
972 regulator_disable(info->vref); vf610_adc_resume()
/linux-4.4.14/drivers/regulator/
H A Dab8500-ext.c62 struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev); ab8500_ext_regulator_enable() local
65 if (info == NULL) { ab8500_ext_regulator_enable()
66 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); ab8500_ext_regulator_enable()
74 if (info->cfg && info->cfg->hwreq) ab8500_ext_regulator_enable()
75 regval = info->update_val_hp; ab8500_ext_regulator_enable()
77 regval = info->update_val; ab8500_ext_regulator_enable()
79 ret = abx500_mask_and_set_register_interruptible(info->dev, ab8500_ext_regulator_enable()
80 info->update_bank, info->update_reg, ab8500_ext_regulator_enable()
81 info->update_mask, regval); ab8500_ext_regulator_enable()
83 dev_err(rdev_get_dev(info->rdev), ab8500_ext_regulator_enable()
90 info->desc.name, info->update_bank, info->update_reg, ab8500_ext_regulator_enable()
91 info->update_mask, regval); ab8500_ext_regulator_enable()
99 struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev); ab8500_ext_regulator_disable() local
102 if (info == NULL) { ab8500_ext_regulator_disable()
103 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); ab8500_ext_regulator_disable()
110 if (info->cfg && info->cfg->hwreq) ab8500_ext_regulator_disable()
111 regval = info->update_val_hw; ab8500_ext_regulator_disable()
115 ret = abx500_mask_and_set_register_interruptible(info->dev, ab8500_ext_regulator_disable()
116 info->update_bank, info->update_reg, ab8500_ext_regulator_disable()
117 info->update_mask, regval); ab8500_ext_regulator_disable()
119 dev_err(rdev_get_dev(info->rdev), ab8500_ext_regulator_disable()
126 info->desc.name, info->update_bank, info->update_reg, ab8500_ext_regulator_disable()
127 info->update_mask, regval); ab8500_ext_regulator_disable()
135 struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev); ab8500_ext_regulator_is_enabled() local
138 if (info == NULL) { ab8500_ext_regulator_is_enabled()
139 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); ab8500_ext_regulator_is_enabled()
143 ret = abx500_get_register_interruptible(info->dev, ab8500_ext_regulator_is_enabled()
144 info->update_bank, info->update_reg, &regval); ab8500_ext_regulator_is_enabled()
147 "couldn't read 0x%x register\n", info->update_reg); ab8500_ext_regulator_is_enabled()
153 info->desc.name, info->update_bank, info->update_reg, ab8500_ext_regulator_is_enabled()
154 info->update_mask, regval); ab8500_ext_regulator_is_enabled()
156 if (((regval & info->update_mask) == info->update_val_lp) || ab8500_ext_regulator_is_enabled()
157 ((regval & info->update_mask) == info->update_val_hp)) ab8500_ext_regulator_is_enabled()
167 struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev); ab8500_ext_regulator_set_mode() local
170 if (info == NULL) { ab8500_ext_regulator_set_mode()
171 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); ab8500_ext_regulator_set_mode()
177 regval = info->update_val_hp; ab8500_ext_regulator_set_mode()
180 regval = info->update_val_lp; ab8500_ext_regulator_set_mode()
187 /* If regulator is enabled and info->cfg->hwreq is set, the regulator ab8500_ext_regulator_set_mode()
192 !(info->cfg && info->cfg->hwreq)) { ab8500_ext_regulator_set_mode()
193 ret = abx500_mask_and_set_register_interruptible(info->dev, ab8500_ext_regulator_set_mode()
194 info->update_bank, info->update_reg, ab8500_ext_regulator_set_mode()
195 info->update_mask, regval); ab8500_ext_regulator_set_mode()
205 info->desc.name, info->update_bank, info->update_reg, ab8500_ext_regulator_set_mode()
206 info->update_mask, regval); ab8500_ext_regulator_set_mode()
209 info->update_val = regval; ab8500_ext_regulator_set_mode()
216 struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev); ab8500_ext_regulator_get_mode() local
219 if (info == NULL) { ab8500_ext_regulator_get_mode()
220 dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); ab8500_ext_regulator_get_mode()
224 if (info->update_val == info->update_val_hp) ab8500_ext_regulator_get_mode()
226 else if (info->update_val == info->update_val_lp) ab8500_ext_regulator_get_mode()
389 struct ab8500_ext_regulator_info *info; ab8500_ext_regulator_probe() local
392 info = &ab8500_ext_regulator_info[AB8500_EXT_SUPPLY3]; ab8500_ext_regulator_probe()
393 info->update_val = 0x30; ab8500_ext_regulator_probe()
394 info->update_val_hp = 0x30; ab8500_ext_regulator_probe()
395 info->update_val_lp = 0x10; ab8500_ext_regulator_probe()
400 struct ab8500_ext_regulator_info *info = NULL; ab8500_ext_regulator_probe() local
403 info = &ab8500_ext_regulator_info[i]; ab8500_ext_regulator_probe()
404 info->dev = &pdev->dev; ab8500_ext_regulator_probe()
405 info->cfg = (struct ab8500_ext_regulator_cfg *) ab8500_ext_regulator_probe()
409 config.driver_data = info; ab8500_ext_regulator_probe()
416 info->rdev = devm_regulator_register(&pdev->dev, &info->desc, ab8500_ext_regulator_probe()
418 if (IS_ERR(info->rdev)) { ab8500_ext_regulator_probe()
419 err = PTR_ERR(info->rdev); ab8500_ext_regulator_probe()
421 info->desc.name); ab8500_ext_regulator_probe()
425 dev_dbg(rdev_get_dev(info->rdev), ab8500_ext_regulator_probe()
426 "%s-probed\n", info->desc.name); ab8500_ext_regulator_probe()
H A Dmax8649.c64 struct max8649_regulator_info *info = rdev_get_drvdata(rdev); max8649_enable_time() local
69 ret = regmap_read(info->regmap, rdev->desc->vsel_reg, &val); max8649_enable_time()
76 ret = regmap_read(info->regmap, MAX8649_RAMP, &val); max8649_enable_time()
87 struct max8649_regulator_info *info = rdev_get_drvdata(rdev); max8649_set_mode() local
91 regmap_update_bits(info->regmap, rdev->desc->vsel_reg, max8649_set_mode()
95 regmap_update_bits(info->regmap, rdev->desc->vsel_reg, max8649_set_mode()
106 struct max8649_regulator_info *info = rdev_get_drvdata(rdev); max8649_get_mode() local
110 ret = regmap_read(info->regmap, rdev->desc->vsel_reg, &val); max8649_get_mode()
155 struct max8649_regulator_info *info = NULL; max8649_regulator_probe() local
162 info = devm_kzalloc(&client->dev, sizeof(struct max8649_regulator_info), max8649_regulator_probe()
164 if (!info) max8649_regulator_probe()
167 info->regmap = devm_regmap_init_i2c(client, &max8649_regmap_config); max8649_regulator_probe()
168 if (IS_ERR(info->regmap)) { max8649_regulator_probe()
169 ret = PTR_ERR(info->regmap); max8649_regulator_probe()
174 info->dev = &client->dev; max8649_regulator_probe()
175 i2c_set_clientdata(client, info); max8649_regulator_probe()
177 info->mode = pdata->mode; max8649_regulator_probe()
178 switch (info->mode) { max8649_regulator_probe()
195 ret = regmap_read(info->regmap, MAX8649_CHIP_ID1, &val); max8649_regulator_probe()
197 dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n", max8649_regulator_probe()
201 dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", val); max8649_regulator_probe()
204 regmap_update_bits(info->regmap, MAX8649_CONTROL, MAX8649_VID_MASK, 0); max8649_regulator_probe()
207 info->extclk = pdata->extclk; max8649_regulator_probe()
208 data = (info->extclk) ? MAX8649_SYNC_EXTCLK : 0; max8649_regulator_probe()
209 regmap_update_bits(info->regmap, dcdc_desc.vsel_reg, max8649_regulator_probe()
211 if (info->extclk) { max8649_regulator_probe()
213 info->extclk_freq = pdata->extclk_freq; max8649_regulator_probe()
214 regmap_update_bits(info->regmap, MAX8649_SYNC, MAX8649_EXT_MASK, max8649_regulator_probe()
215 info->extclk_freq << 6); max8649_regulator_probe()
219 info->ramp_timing = pdata->ramp_timing; max8649_regulator_probe()
220 regmap_update_bits(info->regmap, MAX8649_RAMP, MAX8649_RAMP_MASK, max8649_regulator_probe()
221 info->ramp_timing << 5); max8649_regulator_probe()
224 info->ramp_down = pdata->ramp_down; max8649_regulator_probe()
225 if (info->ramp_down) { max8649_regulator_probe()
226 regmap_update_bits(info->regmap, MAX8649_RAMP, MAX8649_RAMP_DOWN, max8649_regulator_probe()
232 config.driver_data = info; max8649_regulator_probe()
233 config.regmap = info->regmap; max8649_regulator_probe()
238 dev_err(info->dev, "failed to register regulator %s\n", max8649_regulator_probe()
/linux-4.4.14/drivers/bluetooth/
H A Dbluecard_cs.c160 struct bluecard_info *info = (struct bluecard_info *)arg; bluecard_activity_led_timeout() local
161 unsigned int iobase = info->p_dev->resource[0]->start; bluecard_activity_led_timeout()
163 if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) bluecard_activity_led_timeout()
166 if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) { bluecard_activity_led_timeout()
176 static void bluecard_enable_activity_led(struct bluecard_info *info) bluecard_enable_activity_led() argument
178 unsigned int iobase = info->p_dev->resource[0]->start; bluecard_enable_activity_led()
180 if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) bluecard_enable_activity_led()
183 if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) { bluecard_enable_activity_led()
188 mod_timer(&(info->timer), jiffies + HZ / 4); bluecard_enable_activity_led()
194 mod_timer(&(info->timer), jiffies + HZ / 2); bluecard_enable_activity_led()
218 static void bluecard_write_wakeup(struct bluecard_info *info) bluecard_write_wakeup() argument
220 if (!info) { bluecard_write_wakeup()
225 if (!test_bit(XMIT_SENDING_READY, &(info->tx_state))) bluecard_write_wakeup()
228 if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) { bluecard_write_wakeup()
229 set_bit(XMIT_WAKEUP, &(info->tx_state)); bluecard_write_wakeup()
234 unsigned int iobase = info->p_dev->resource[0]->start; bluecard_write_wakeup()
241 clear_bit(XMIT_WAKEUP, &(info->tx_state)); bluecard_write_wakeup()
243 if (!pcmcia_dev_present(info->p_dev)) bluecard_write_wakeup()
246 if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) { bluecard_write_wakeup()
247 if (!test_bit(XMIT_BUF_TWO_READY, &(info->tx_state))) bluecard_write_wakeup()
253 if (!test_bit(XMIT_BUF_ONE_READY, &(info->tx_state))) bluecard_write_wakeup()
260 skb = skb_dequeue(&(info->txq)); bluecard_write_wakeup()
266 info->ctrl_reg |= REG_CONTROL_RTS; bluecard_write_wakeup()
267 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_write_wakeup()
271 bluecard_enable_activity_led(info); bluecard_write_wakeup()
280 clear_bit(ready_bit, &(info->tx_state)); bluecard_write_wakeup()
311 info->ctrl_reg &= ~0x03; bluecard_write_wakeup()
312 info->ctrl_reg |= baud_reg; bluecard_write_wakeup()
313 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_write_wakeup()
316 info->ctrl_reg &= ~REG_CONTROL_RTS; bluecard_write_wakeup()
317 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_write_wakeup()
329 skb_queue_head(&(info->txq), skb); bluecard_write_wakeup()
332 info->hdev->stat.byte_tx += len; bluecard_write_wakeup()
335 change_bit(XMIT_BUFFER_NUMBER, &(info->tx_state)); bluecard_write_wakeup()
337 } while (test_bit(XMIT_WAKEUP, &(info->tx_state))); bluecard_write_wakeup()
339 clear_bit(XMIT_SENDING, &(info->tx_state)); bluecard_write_wakeup()
371 static void bluecard_receive(struct bluecard_info *info, bluecard_receive() argument
378 if (!info) { bluecard_receive()
383 iobase = info->p_dev->resource[0]->start; bluecard_receive()
385 if (test_bit(XMIT_SENDING_READY, &(info->tx_state))) bluecard_receive()
386 bluecard_enable_activity_led(info); bluecard_receive()
393 if (!info->rx_skb) { bluecard_receive()
394 info->rx_state = RECV_WAIT_PACKET_TYPE; bluecard_receive()
395 info->rx_count = 0; bluecard_receive()
396 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); bluecard_receive()
397 if (!info->rx_skb) { bluecard_receive()
403 if (info->rx_state == RECV_WAIT_PACKET_TYPE) { bluecard_receive()
405 bt_cb(info->rx_skb)->pkt_type = buf[i]; bluecard_receive()
407 switch (bt_cb(info->rx_skb)->pkt_type) { bluecard_receive()
412 set_bit(XMIT_BUF_ONE_READY, &(info->tx_state)); bluecard_receive()
413 set_bit(XMIT_BUF_TWO_READY, &(info->tx_state)); bluecard_receive()
414 set_bit(XMIT_SENDING_READY, &(info->tx_state)); bluecard_receive()
415 bluecard_write_wakeup(info); bluecard_receive()
418 kfree_skb(info->rx_skb); bluecard_receive()
419 info->rx_skb = NULL; bluecard_receive()
423 info->rx_state = RECV_WAIT_EVENT_HEADER; bluecard_receive()
424 info->rx_count = HCI_EVENT_HDR_SIZE; bluecard_receive()
428 info->rx_state = RECV_WAIT_ACL_HEADER; bluecard_receive()
429 info->rx_count = HCI_ACL_HDR_SIZE; bluecard_receive()
433 info->rx_state = RECV_WAIT_SCO_HEADER; bluecard_receive()
434 info->rx_count = HCI_SCO_HDR_SIZE; bluecard_receive()
439 BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type); bluecard_receive()
440 info->hdev->stat.err_rx++; bluecard_receive()
442 kfree_skb(info->rx_skb); bluecard_receive()
443 info->rx_skb = NULL; bluecard_receive()
450 *skb_put(info->rx_skb, 1) = buf[i]; bluecard_receive()
451 info->rx_count--; bluecard_receive()
453 if (info->rx_count == 0) { bluecard_receive()
460 switch (info->rx_state) { bluecard_receive()
463 eh = hci_event_hdr(info->rx_skb); bluecard_receive()
464 info->rx_state = RECV_WAIT_DATA; bluecard_receive()
465 info->rx_count = eh->plen; bluecard_receive()
469 ah = hci_acl_hdr(info->rx_skb); bluecard_receive()
471 info->rx_state = RECV_WAIT_DATA; bluecard_receive()
472 info->rx_count = dlen; bluecard_receive()
476 sh = hci_sco_hdr(info->rx_skb); bluecard_receive()
477 info->rx_state = RECV_WAIT_DATA; bluecard_receive()
478 info->rx_count = sh->dlen; bluecard_receive()
482 hci_recv_frame(info->hdev, info->rx_skb); bluecard_receive()
483 info->rx_skb = NULL; bluecard_receive()
495 info->hdev->stat.byte_rx += len; bluecard_receive()
501 struct bluecard_info *info = dev_inst; bluecard_interrupt() local
505 if (!info || !info->hdev) bluecard_interrupt()
509 if (!test_bit(CARD_READY, &(info->hw_state))) bluecard_interrupt()
512 iobase = info->p_dev->resource[0]->start; bluecard_interrupt()
514 spin_lock(&(info->lock)); bluecard_interrupt()
517 info->ctrl_reg &= ~REG_CONTROL_INTERRUPT; bluecard_interrupt()
518 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_interrupt()
525 bluecard_receive(info, 0x00); bluecard_interrupt()
531 bluecard_receive(info, 0x10); bluecard_interrupt()
537 set_bit(XMIT_BUF_ONE_READY, &(info->tx_state)); bluecard_interrupt()
539 bluecard_write_wakeup(info); bluecard_interrupt()
543 set_bit(XMIT_BUF_TWO_READY, &(info->tx_state)); bluecard_interrupt()
545 bluecard_write_wakeup(info); bluecard_interrupt()
551 info->ctrl_reg |= REG_CONTROL_INTERRUPT; bluecard_interrupt()
552 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_interrupt()
554 spin_unlock(&(info->lock)); bluecard_interrupt()
566 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_set_baud_rate() local
601 skb_queue_tail(&(info->txq), skb); bluecard_hci_set_baud_rate()
603 bluecard_write_wakeup(info); bluecard_hci_set_baud_rate()
615 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_flush() local
618 skb_queue_purge(&(info->txq)); bluecard_hci_flush()
626 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_open() local
628 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) bluecard_hci_open()
631 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) { bluecard_hci_open()
632 unsigned int iobase = info->p_dev->resource[0]->start; bluecard_hci_open()
644 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_close() local
648 if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) { bluecard_hci_close()
649 unsigned int iobase = info->p_dev->resource[0]->start; bluecard_hci_close()
661 struct bluecard_info *info = hci_get_drvdata(hdev); bluecard_hci_send_frame() local
677 skb_queue_tail(&(info->txq), skb); bluecard_hci_send_frame()
679 bluecard_write_wakeup(info); bluecard_hci_send_frame()
689 static int bluecard_open(struct bluecard_info *info) bluecard_open() argument
691 unsigned int iobase = info->p_dev->resource[0]->start; bluecard_open()
695 spin_lock_init(&(info->lock)); bluecard_open()
697 init_timer(&(info->timer)); bluecard_open()
698 info->timer.function = &bluecard_activity_led_timeout; bluecard_open()
699 info->timer.data = (u_long)info; bluecard_open()
701 skb_queue_head_init(&(info->txq)); bluecard_open()
703 info->rx_state = RECV_WAIT_PACKET_TYPE; bluecard_open()
704 info->rx_count = 0; bluecard_open()
705 info->rx_skb = NULL; bluecard_open()
714 info->hdev = hdev; bluecard_open()
717 hci_set_drvdata(hdev, info); bluecard_open()
718 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); bluecard_open()
728 set_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)); bluecard_open()
731 set_bit(CARD_HAS_POWER_LED, &(info->hw_state)); bluecard_open()
734 set_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state)); bluecard_open()
737 info->ctrl_reg = REG_CONTROL_BT_RESET | REG_CONTROL_CARD_RESET; bluecard_open()
738 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_open()
750 info->ctrl_reg = REG_CONTROL_BT_ON | REG_CONTROL_BT_RES_PU; bluecard_open()
751 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_open()
755 info->ctrl_reg |= REG_CONTROL_INTERRUPT; bluecard_open()
756 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_open()
760 info->ctrl_reg |= REG_CONTROL_RTS; bluecard_open()
761 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_open()
764 info->ctrl_reg |= 0x03; bluecard_open()
765 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_open()
768 info->ctrl_reg &= ~REG_CONTROL_RTS; bluecard_open()
769 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_open()
771 set_bit(XMIT_BUF_ONE_READY, &(info->tx_state)); bluecard_open()
772 set_bit(XMIT_BUF_TWO_READY, &(info->tx_state)); bluecard_open()
773 set_bit(XMIT_SENDING_READY, &(info->tx_state)); bluecard_open()
781 set_bit(CARD_READY, &(info->hw_state)); bluecard_open()
784 skb_queue_purge(&(info->txq)); bluecard_open()
795 info->hdev = NULL; bluecard_open()
804 static int bluecard_close(struct bluecard_info *info) bluecard_close() argument
806 unsigned int iobase = info->p_dev->resource[0]->start; bluecard_close()
807 struct hci_dev *hdev = info->hdev; bluecard_close()
814 clear_bit(CARD_READY, &(info->hw_state)); bluecard_close()
817 info->ctrl_reg = REG_CONTROL_BT_RESET | REG_CONTROL_CARD_RESET; bluecard_close()
818 outb(info->ctrl_reg, iobase + REG_CONTROL); bluecard_close()
831 struct bluecard_info *info; bluecard_probe() local
833 /* Create new info device */ bluecard_probe()
834 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL); bluecard_probe()
835 if (!info) bluecard_probe()
838 info->p_dev = link; bluecard_probe()
839 link->priv = info; bluecard_probe()
855 struct bluecard_info *info = link->priv; bluecard_config() local
882 if (bluecard_open(info) != 0) bluecard_config()
895 struct bluecard_info *info = link->priv; bluecard_release() local
897 bluecard_close(info); bluecard_release()
899 del_timer_sync(&(info->timer)); bluecard_release()
H A Ddtl1_cs.c129 static void dtl1_write_wakeup(struct dtl1_info *info) dtl1_write_wakeup() argument
131 if (!info) { dtl1_write_wakeup()
136 if (test_bit(XMIT_WAITING, &(info->tx_state))) { dtl1_write_wakeup()
137 set_bit(XMIT_WAKEUP, &(info->tx_state)); dtl1_write_wakeup()
141 if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) { dtl1_write_wakeup()
142 set_bit(XMIT_WAKEUP, &(info->tx_state)); dtl1_write_wakeup()
147 unsigned int iobase = info->p_dev->resource[0]->start; dtl1_write_wakeup()
151 clear_bit(XMIT_WAKEUP, &(info->tx_state)); dtl1_write_wakeup()
153 if (!pcmcia_dev_present(info->p_dev)) dtl1_write_wakeup()
156 skb = skb_dequeue(&(info->txq)); dtl1_write_wakeup()
164 set_bit(XMIT_WAITING, &(info->tx_state)); dtl1_write_wakeup()
168 skb_queue_head(&(info->txq), skb); dtl1_write_wakeup()
171 info->hdev->stat.byte_tx += len; dtl1_write_wakeup()
173 } while (test_bit(XMIT_WAKEUP, &(info->tx_state))); dtl1_write_wakeup()
175 clear_bit(XMIT_SENDING, &(info->tx_state)); dtl1_write_wakeup()
179 static void dtl1_control(struct dtl1_info *info, struct sk_buff *skb) dtl1_control() argument
191 if (((info->flowmask & 0x07) == 0) && ((flowmask & 0x07) != 0)) { dtl1_control()
192 clear_bit(XMIT_WAITING, &(info->tx_state)); dtl1_control()
193 dtl1_write_wakeup(info); dtl1_control()
196 info->flowmask = flowmask; dtl1_control()
202 static void dtl1_receive(struct dtl1_info *info) dtl1_receive() argument
208 if (!info) { dtl1_receive()
213 iobase = info->p_dev->resource[0]->start; dtl1_receive()
216 info->hdev->stat.byte_rx++; dtl1_receive()
219 if (info->rx_skb == NULL) { dtl1_receive()
220 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); dtl1_receive()
221 if (!info->rx_skb) { dtl1_receive()
223 info->rx_state = RECV_WAIT_NSH; dtl1_receive()
224 info->rx_count = NSHL; dtl1_receive()
229 *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); dtl1_receive()
230 nsh = (struct nsh *)info->rx_skb->data; dtl1_receive()
232 info->rx_count--; dtl1_receive()
234 if (info->rx_count == 0) { dtl1_receive()
236 switch (info->rx_state) { dtl1_receive()
238 info->rx_state = RECV_WAIT_DATA; dtl1_receive()
239 info->rx_count = nsh->len + (nsh->len & 0x0001); dtl1_receive()
242 bt_cb(info->rx_skb)->pkt_type = nsh->type; dtl1_receive()
246 info->rx_skb->tail--; dtl1_receive()
247 info->rx_skb->len--; dtl1_receive()
251 skb_pull(info->rx_skb, NSHL); dtl1_receive()
253 switch (bt_cb(info->rx_skb)->pkt_type) { dtl1_receive()
256 dtl1_control(info, info->rx_skb); dtl1_receive()
262 bt_cb(info->rx_skb)->pkt_type &= 0x0f; dtl1_receive()
263 hci_recv_frame(info->hdev, info->rx_skb); dtl1_receive()
267 BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type); dtl1_receive()
268 kfree_skb(info->rx_skb); dtl1_receive()
272 info->rx_state = RECV_WAIT_NSH; dtl1_receive()
273 info->rx_count = NSHL; dtl1_receive()
274 info->rx_skb = NULL; dtl1_receive()
290 struct dtl1_info *info = dev_inst; dtl1_interrupt() local
297 if (!info || !info->hdev) dtl1_interrupt()
301 iobase = info->p_dev->resource[0]->start; dtl1_interrupt()
303 spin_lock(&(info->lock)); dtl1_interrupt()
318 dtl1_receive(info); dtl1_interrupt()
323 dtl1_write_wakeup(info); dtl1_interrupt()
341 if (info->ri_latch ^ (msr & UART_MSR_RI)) { dtl1_interrupt()
342 info->ri_latch = msr & UART_MSR_RI; dtl1_interrupt()
343 clear_bit(XMIT_WAITING, &(info->tx_state)); dtl1_interrupt()
344 dtl1_write_wakeup(info); dtl1_interrupt()
348 spin_unlock(&(info->lock)); dtl1_interrupt()
366 struct dtl1_info *info = hci_get_drvdata(hdev); dtl1_hci_flush() local
369 skb_queue_purge(&(info->txq)); dtl1_hci_flush()
385 struct dtl1_info *info = hci_get_drvdata(hdev); dtl1_hci_send_frame() local
420 skb_queue_tail(&(info->txq), s); dtl1_hci_send_frame()
422 dtl1_write_wakeup(info); dtl1_hci_send_frame()
434 static int dtl1_open(struct dtl1_info *info) dtl1_open() argument
437 unsigned int iobase = info->p_dev->resource[0]->start; dtl1_open()
440 spin_lock_init(&(info->lock)); dtl1_open()
442 skb_queue_head_init(&(info->txq)); dtl1_open()
444 info->rx_state = RECV_WAIT_NSH; dtl1_open()
445 info->rx_count = NSHL; dtl1_open()
446 info->rx_skb = NULL; dtl1_open()
448 set_bit(XMIT_WAITING, &(info->tx_state)); dtl1_open()
457 info->hdev = hdev; dtl1_open()
460 hci_set_drvdata(hdev, info); dtl1_open()
461 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); dtl1_open()
468 spin_lock_irqsave(&(info->lock), flags); dtl1_open()
480 info->ri_latch = inb(info->p_dev->resource[0]->start + UART_MSR) dtl1_open()
486 spin_unlock_irqrestore(&(info->lock), flags); dtl1_open()
494 info->hdev = NULL; dtl1_open()
503 static int dtl1_close(struct dtl1_info *info) dtl1_close() argument
506 unsigned int iobase = info->p_dev->resource[0]->start; dtl1_close()
507 struct hci_dev *hdev = info->hdev; dtl1_close()
514 spin_lock_irqsave(&(info->lock), flags); dtl1_close()
522 spin_unlock_irqrestore(&(info->lock), flags); dtl1_close()
532 struct dtl1_info *info; dtl1_probe() local
534 /* Create new info device */ dtl1_probe()
535 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL); dtl1_probe()
536 if (!info) dtl1_probe()
539 info->p_dev = link; dtl1_probe()
540 link->priv = info; dtl1_probe()
550 struct dtl1_info *info = link->priv; dtl1_detach() local
552 dtl1_close(info); dtl1_detach()
569 struct dtl1_info *info = link->priv; dtl1_config() local
586 ret = dtl1_open(info); dtl1_config()
H A Dbtuart_cs.c130 static void btuart_write_wakeup(struct btuart_info *info) btuart_write_wakeup() argument
132 if (!info) { btuart_write_wakeup()
137 if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) { btuart_write_wakeup()
138 set_bit(XMIT_WAKEUP, &(info->tx_state)); btuart_write_wakeup()
143 unsigned int iobase = info->p_dev->resource[0]->start; btuart_write_wakeup()
147 clear_bit(XMIT_WAKEUP, &(info->tx_state)); btuart_write_wakeup()
149 if (!pcmcia_dev_present(info->p_dev)) btuart_write_wakeup()
152 skb = skb_dequeue(&(info->txq)); btuart_write_wakeup()
158 set_bit(XMIT_WAKEUP, &(info->tx_state)); btuart_write_wakeup()
164 skb_queue_head(&(info->txq), skb); btuart_write_wakeup()
167 info->hdev->stat.byte_tx += len; btuart_write_wakeup()
169 } while (test_bit(XMIT_WAKEUP, &(info->tx_state))); btuart_write_wakeup()
171 clear_bit(XMIT_SENDING, &(info->tx_state)); btuart_write_wakeup()
175 static void btuart_receive(struct btuart_info *info) btuart_receive() argument
180 if (!info) { btuart_receive()
185 iobase = info->p_dev->resource[0]->start; btuart_receive()
188 info->hdev->stat.byte_rx++; btuart_receive()
191 if (!info->rx_skb) { btuart_receive()
192 info->rx_state = RECV_WAIT_PACKET_TYPE; btuart_receive()
193 info->rx_count = 0; btuart_receive()
194 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); btuart_receive()
195 if (!info->rx_skb) { btuart_receive()
201 if (info->rx_state == RECV_WAIT_PACKET_TYPE) { btuart_receive()
203 bt_cb(info->rx_skb)->pkt_type = inb(iobase + UART_RX); btuart_receive()
205 switch (bt_cb(info->rx_skb)->pkt_type) { btuart_receive()
208 info->rx_state = RECV_WAIT_EVENT_HEADER; btuart_receive()
209 info->rx_count = HCI_EVENT_HDR_SIZE; btuart_receive()
213 info->rx_state = RECV_WAIT_ACL_HEADER; btuart_receive()
214 info->rx_count = HCI_ACL_HDR_SIZE; btuart_receive()
218 info->rx_state = RECV_WAIT_SCO_HEADER; btuart_receive()
219 info->rx_count = HCI_SCO_HDR_SIZE; btuart_receive()
224 BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type); btuart_receive()
225 info->hdev->stat.err_rx++; btuart_receive()
227 kfree_skb(info->rx_skb); btuart_receive()
228 info->rx_skb = NULL; btuart_receive()
235 *skb_put(info->rx_skb, 1) = inb(iobase + UART_RX); btuart_receive()
236 info->rx_count--; btuart_receive()
238 if (info->rx_count == 0) { btuart_receive()
246 switch (info->rx_state) { btuart_receive()
249 eh = hci_event_hdr(info->rx_skb); btuart_receive()
250 info->rx_state = RECV_WAIT_DATA; btuart_receive()
251 info->rx_count = eh->plen; btuart_receive()
255 ah = hci_acl_hdr(info->rx_skb); btuart_receive()
257 info->rx_state = RECV_WAIT_DATA; btuart_receive()
258 info->rx_count = dlen; btuart_receive()
262 sh = hci_sco_hdr(info->rx_skb); btuart_receive()
263 info->rx_state = RECV_WAIT_DATA; btuart_receive()
264 info->rx_count = sh->dlen; btuart_receive()
268 hci_recv_frame(info->hdev, info->rx_skb); btuart_receive()
269 info->rx_skb = NULL; btuart_receive()
288 struct btuart_info *info = dev_inst; btuart_interrupt() local
294 if (!info || !info->hdev) btuart_interrupt()
298 iobase = info->p_dev->resource[0]->start; btuart_interrupt()
300 spin_lock(&(info->lock)); btuart_interrupt()
315 btuart_receive(info); btuart_interrupt()
320 btuart_write_wakeup(info); btuart_interrupt()
336 spin_unlock(&(info->lock)); btuart_interrupt()
342 static void btuart_change_speed(struct btuart_info *info, btuart_change_speed() argument
351 if (!info) { btuart_change_speed()
356 iobase = info->p_dev->resource[0]->start; btuart_change_speed()
358 spin_lock_irqsave(&(info->lock), flags); btuart_change_speed()
390 spin_unlock_irqrestore(&(info->lock), flags); btuart_change_speed()
400 struct btuart_info *info = hci_get_drvdata(hdev); btuart_hci_flush() local
403 skb_queue_purge(&(info->txq)); btuart_hci_flush()
425 struct btuart_info *info = hci_get_drvdata(hdev); btuart_hci_send_frame() local
441 skb_queue_tail(&(info->txq), skb); btuart_hci_send_frame()
443 btuart_write_wakeup(info); btuart_hci_send_frame()
453 static int btuart_open(struct btuart_info *info) btuart_open() argument
456 unsigned int iobase = info->p_dev->resource[0]->start; btuart_open()
459 spin_lock_init(&(info->lock)); btuart_open()
461 skb_queue_head_init(&(info->txq)); btuart_open()
463 info->rx_state = RECV_WAIT_PACKET_TYPE; btuart_open()
464 info->rx_count = 0; btuart_open()
465 info->rx_skb = NULL; btuart_open()
474 info->hdev = hdev; btuart_open()
477 hci_set_drvdata(hdev, info); btuart_open()
478 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); btuart_open()
485 spin_lock_irqsave(&(info->lock), flags); btuart_open()
500 spin_unlock_irqrestore(&(info->lock), flags); btuart_open()
502 btuart_change_speed(info, DEFAULT_BAUD_RATE); btuart_open()
510 info->hdev = NULL; btuart_open()
519 static int btuart_close(struct btuart_info *info) btuart_close() argument
522 unsigned int iobase = info->p_dev->resource[0]->start; btuart_close()
523 struct hci_dev *hdev = info->hdev; btuart_close()
530 spin_lock_irqsave(&(info->lock), flags); btuart_close()
538 spin_unlock_irqrestore(&(info->lock), flags); btuart_close()
548 struct btuart_info *info; btuart_probe() local
550 /* Create new info device */ btuart_probe()
551 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL); btuart_probe()
552 if (!info) btuart_probe()
555 info->p_dev = link; btuart_probe()
556 link->priv = info; btuart_probe()
611 struct btuart_info *info = link->priv; btuart_config() local
639 if (btuart_open(info) != 0) btuart_config()
652 struct btuart_info *info = link->priv; btuart_release() local
654 btuart_close(info); btuart_release()
H A Dbt3c_cs.c178 static void bt3c_write_wakeup(struct bt3c_info *info) bt3c_write_wakeup() argument
180 if (!info) { bt3c_write_wakeup()
185 if (test_and_set_bit(XMIT_SENDING, &(info->tx_state))) bt3c_write_wakeup()
189 unsigned int iobase = info->p_dev->resource[0]->start; bt3c_write_wakeup()
193 if (!pcmcia_dev_present(info->p_dev)) bt3c_write_wakeup()
196 skb = skb_dequeue(&(info->txq)); bt3c_write_wakeup()
198 clear_bit(XMIT_SENDING, &(info->tx_state)); bt3c_write_wakeup()
210 info->hdev->stat.byte_tx += len; bt3c_write_wakeup()
216 static void bt3c_receive(struct bt3c_info *info) bt3c_receive() argument
221 if (!info) { bt3c_receive()
226 iobase = info->p_dev->resource[0]->start; bt3c_receive()
233 info->hdev->stat.byte_rx++; bt3c_receive()
236 if (!info->rx_skb) { bt3c_receive()
237 info->rx_state = RECV_WAIT_PACKET_TYPE; bt3c_receive()
238 info->rx_count = 0; bt3c_receive()
239 info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC); bt3c_receive()
240 if (!info->rx_skb) { bt3c_receive()
247 if (info->rx_state == RECV_WAIT_PACKET_TYPE) { bt3c_receive()
249 bt_cb(info->rx_skb)->pkt_type = inb(iobase + DATA_L); bt3c_receive()
252 switch (bt_cb(info->rx_skb)->pkt_type) { bt3c_receive()
255 info->rx_state = RECV_WAIT_EVENT_HEADER; bt3c_receive()
256 info->rx_count = HCI_EVENT_HDR_SIZE; bt3c_receive()
260 info->rx_state = RECV_WAIT_ACL_HEADER; bt3c_receive()
261 info->rx_count = HCI_ACL_HDR_SIZE; bt3c_receive()
265 info->rx_state = RECV_WAIT_SCO_HEADER; bt3c_receive()
266 info->rx_count = HCI_SCO_HDR_SIZE; bt3c_receive()
271 BT_ERR("Unknown HCI packet with type 0x%02x received", bt_cb(info->rx_skb)->pkt_type); bt3c_receive()
272 info->hdev->stat.err_rx++; bt3c_receive()
274 kfree_skb(info->rx_skb); bt3c_receive()
275 info->rx_skb = NULL; bt3c_receive()
284 *skb_put(info->rx_skb, 1) = x; bt3c_receive()
286 info->rx_count--; bt3c_receive()
288 if (info->rx_count == 0) { bt3c_receive()
295 switch (info->rx_state) { bt3c_receive()
298 eh = hci_event_hdr(info->rx_skb); bt3c_receive()
299 info->rx_state = RECV_WAIT_DATA; bt3c_receive()
300 info->rx_count = eh->plen; bt3c_receive()
304 ah = hci_acl_hdr(info->rx_skb); bt3c_receive()
306 info->rx_state = RECV_WAIT_DATA; bt3c_receive()
307 info->rx_count = dlen; bt3c_receive()
311 sh = hci_sco_hdr(info->rx_skb); bt3c_receive()
312 info->rx_state = RECV_WAIT_DATA; bt3c_receive()
313 info->rx_count = sh->dlen; bt3c_receive()
317 hci_recv_frame(info->hdev, info->rx_skb); bt3c_receive()
318 info->rx_skb = NULL; bt3c_receive()
335 struct bt3c_info *info = dev_inst; bt3c_interrupt() local
340 if (!info || !info->hdev) bt3c_interrupt()
344 iobase = info->p_dev->resource[0]->start; bt3c_interrupt()
346 spin_lock(&(info->lock)); bt3c_interrupt()
357 BT_INFO("%s: Antenna %s", info->hdev->name, bt3c_interrupt()
361 bt3c_receive(info); bt3c_interrupt()
363 clear_bit(XMIT_SENDING, &(info->tx_state)); bt3c_interrupt()
364 bt3c_write_wakeup(info); bt3c_interrupt()
374 spin_unlock(&(info->lock)); bt3c_interrupt()
386 struct bt3c_info *info = hci_get_drvdata(hdev); bt3c_hci_flush() local
389 skb_queue_purge(&(info->txq)); bt3c_hci_flush()
411 struct bt3c_info *info = hci_get_drvdata(hdev); bt3c_hci_send_frame() local
428 skb_queue_tail(&(info->txq), skb); bt3c_hci_send_frame()
430 spin_lock_irqsave(&(info->lock), flags); bt3c_hci_send_frame()
432 bt3c_write_wakeup(info); bt3c_hci_send_frame()
434 spin_unlock_irqrestore(&(info->lock), flags); bt3c_hci_send_frame()
444 static int bt3c_load_firmware(struct bt3c_info *info, bt3c_load_firmware() argument
454 iobase = info->p_dev->resource[0]->start; bt3c_load_firmware()
534 static int bt3c_open(struct bt3c_info *info) bt3c_open() argument
540 spin_lock_init(&(info->lock)); bt3c_open()
542 skb_queue_head_init(&(info->txq)); bt3c_open()
544 info->rx_state = RECV_WAIT_PACKET_TYPE; bt3c_open()
545 info->rx_count = 0; bt3c_open()
546 info->rx_skb = NULL; bt3c_open()
555 info->hdev = hdev; bt3c_open()
558 hci_set_drvdata(hdev, info); bt3c_open()
559 SET_HCIDEV_DEV(hdev, &info->p_dev->dev); bt3c_open()
567 err = request_firmware(&firmware, "BT3CPCC.bin", &info->p_dev->dev); bt3c_open()
573 err = bt3c_load_firmware(info, firmware->data, firmware->size); bt3c_open()
595 info->hdev = NULL; bt3c_open()
601 static int bt3c_close(struct bt3c_info *info) bt3c_close() argument
603 struct hci_dev *hdev = info->hdev; bt3c_close()
618 struct bt3c_info *info; bt3c_probe() local
620 /* Create new info device */ bt3c_probe()
621 info = devm_kzalloc(&link->dev, sizeof(*info), GFP_KERNEL); bt3c_probe()
622 if (!info) bt3c_probe()
625 info->p_dev = link; bt3c_probe()
626 link->priv = info; bt3c_probe()
681 struct bt3c_info *info = link->priv; bt3c_config() local
709 if (bt3c_open(info) != 0) bt3c_config()
722 struct bt3c_info *info = link->priv; bt3c_release() local
724 bt3c_close(info); bt3c_release()
/linux-4.4.14/drivers/video/fbdev/core/
H A Dfb_sys_fops.c16 ssize_t fb_sys_read(struct fb_info *info, char __user *buf, size_t count, fb_sys_read() argument
24 if (info->state != FBINFO_STATE_RUNNING) fb_sys_read()
27 total_size = info->screen_size; fb_sys_read()
30 total_size = info->fix.smem_len; fb_sys_read()
41 src = (void __force *)(info->screen_base + p); fb_sys_read()
43 if (info->fbops->fb_sync) fb_sys_read()
44 info->fbops->fb_sync(info); fb_sys_read()
56 ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, fb_sys_write() argument
64 if (info->state != FBINFO_STATE_RUNNING) fb_sys_write()
67 total_size = info->screen_size; fb_sys_write()
70 total_size = info->fix.smem_len; fb_sys_write()
87 dst = (void __force *) (info->screen_base + p); fb_sys_write()
89 if (info->fbops->fb_sync) fb_sys_write()
90 info->fbops->fb_sync(info); fb_sys_write()
H A Dfbmem.c77 int lock_fb_info(struct fb_info *info) lock_fb_info() argument
79 mutex_lock(&info->lock); lock_fb_info()
80 if (!info->fbops) { lock_fb_info()
81 mutex_unlock(&info->lock); lock_fb_info()
158 char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size) fb_get_buffer_offset() argument
167 if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC)) fb_get_buffer_offset()
168 info->fbops->fb_sync(info); fb_get_buffer_offset()
180 if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC)) fb_get_buffer_offset()
181 info->fbops->fb_sync(info); fb_get_buffer_offset()
198 static void fb_set_logocmap(struct fb_info *info, fb_set_logocmap() argument
228 fb_set_cmap(&palette_cmap, info); fb_set_logocmap()
232 static void fb_set_logo_truepalette(struct fb_info *info, fb_set_logo_truepalette() argument
247 redmask = mask[info->var.red.length < 8 ? info->var.red.length : 8]; fb_set_logo_truepalette()
248 greenmask = mask[info->var.green.length < 8 ? info->var.green.length : 8]; fb_set_logo_truepalette()
249 bluemask = mask[info->var.blue.length < 8 ? info->var.blue.length : 8]; fb_set_logo_truepalette()
250 redshift = info->var.red.offset - (8 - info->var.red.length); fb_set_logo_truepalette()
251 greenshift = info->var.green.offset - (8 - info->var.green.length); fb_set_logo_truepalette()
252 blueshift = info->var.blue.offset - (8 - info->var.blue.length); fb_set_logo_truepalette()
262 static void fb_set_logo_directpalette(struct fb_info *info, fb_set_logo_directpalette() argument
269 redshift = info->var.red.offset; fb_set_logo_directpalette()
270 greenshift = info->var.green.offset; fb_set_logo_directpalette()
271 blueshift = info->var.blue.offset; fb_set_logo_directpalette()
277 static void fb_set_logo(struct fb_info *info, fb_set_logo() argument
283 u8 xor = (info->fix.visual == FB_VISUAL_MONO01) ? 0xff : 0; fb_set_logo()
286 switch (fb_get_color_depth(&info->var, &info->fix)) { fb_set_logo()
298 if (info->fix.visual == FB_VISUAL_MONO01 || fb_set_logo()
299 info->fix.visual == FB_VISUAL_MONO10) fb_set_logo()
300 fg = ~((u8) (0xfff << info->var.green.length)); fb_set_logo()
338 * For visuals that require color info from the pseudo_palette, we also construct
390 static void fb_rotate_logo(struct fb_info *info, u8 *dst, fb_rotate_logo() argument
398 image->dx = info->var.xres - image->width - image->dx; fb_rotate_logo()
399 image->dy = info->var.yres - image->height - image->dy; fb_rotate_logo()
408 image->dx = info->var.xres - image->width - tmp; fb_rotate_logo()
417 image->dy = info->var.yres - image->height - tmp; fb_rotate_logo()
423 static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, fb_do_show_logo() argument
430 x < num && image->dx + image->width <= info->var.xres; fb_do_show_logo()
432 info->fbops->fb_imageblit(info, image); fb_do_show_logo()
437 info->fbops->fb_imageblit(info, image); fb_do_show_logo()
442 x < num && image->dy + image->height <= info->var.yres; fb_do_show_logo()
444 info->fbops->fb_imageblit(info, image); fb_do_show_logo()
449 info->fbops->fb_imageblit(info, image); fb_do_show_logo()
455 static int fb_show_logo_line(struct fb_info *info, int rotate, fb_show_logo_line() argument
464 if (logo == NULL || info->state != FBINFO_STATE_RUNNING || fb_show_logo_line()
465 info->flags & FBINFO_MODULE) fb_show_logo_line()
472 fb_set_logocmap(info, logo); fb_show_logo_line()
481 fb_set_logo_truepalette(info, logo, palette); fb_show_logo_line()
483 fb_set_logo_directpalette(info, logo, palette); fb_show_logo_line()
485 saved_pseudo_palette = info->pseudo_palette; fb_show_logo_line()
486 info->pseudo_palette = palette; fb_show_logo_line()
494 info->pseudo_palette = saved_pseudo_palette; fb_show_logo_line()
498 fb_set_logo(info, logo, logo_new, fb_logo.depth); fb_show_logo_line()
510 fb_rotate_logo(info, logo_rotate, &image, rotate); fb_show_logo_line()
513 fb_do_show_logo(info, &image, rotate, n); fb_show_logo_line()
517 info->pseudo_palette = saved_pseudo_palette; fb_show_logo_line()
543 static int fb_prepare_extra_logos(struct fb_info *info, unsigned int height, fb_prepare_extra_logos() argument
549 if (info->fix.visual != FB_VISUAL_TRUECOLOR) fb_prepare_extra_logos()
567 static int fb_show_extra_logos(struct fb_info *info, int y, int rotate) fb_show_extra_logos() argument
572 y += fb_show_logo_line(info, rotate, fb_show_extra_logos()
580 static inline int fb_prepare_extra_logos(struct fb_info *info, fb_prepare_extra_logos() argument
587 static inline int fb_show_extra_logos(struct fb_info *info, int y, int rotate) fb_show_extra_logos() argument
595 int fb_prepare_logo(struct fb_info *info, int rotate) fb_prepare_logo() argument
597 int depth = fb_get_color_depth(&info->var, &info->fix); fb_prepare_logo()
602 if (info->flags & FBINFO_MISC_TILEBLITTING || fb_prepare_logo()
603 info->flags & FBINFO_MODULE) fb_prepare_logo()
606 if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) { fb_prepare_logo()
607 depth = info->var.blue.length; fb_prepare_logo()
608 if (info->var.red.length < depth) fb_prepare_logo()
609 depth = info->var.red.length; fb_prepare_logo()
610 if (info->var.green.length < depth) fb_prepare_logo()
611 depth = info->var.green.length; fb_prepare_logo()
614 if (info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR && depth > 4) { fb_prepare_logo()
627 yres = info->var.yres; fb_prepare_logo()
629 yres = info->var.xres; fb_prepare_logo()
646 switch (info->fix.visual) { fb_prepare_logo()
660 return fb_prepare_extra_logos(info, fb_logo.logo->height, yres); fb_prepare_logo()
663 int fb_show_logo(struct fb_info *info, int rotate) fb_show_logo() argument
667 y = fb_show_logo_line(info, rotate, fb_logo.logo, 0, fb_show_logo()
669 y = fb_show_extra_logos(info, y, rotate); fb_show_logo()
674 int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; } fb_show_logo() argument
675 int fb_show_logo(struct fb_info *info, int rotate) { return 0; } fb_show_logo() argument
739 struct fb_info *info = registered_fb[fbidx]; file_fb_info() local
741 if (info != file->private_data) file_fb_info()
742 info = NULL; file_fb_info()
743 return info; file_fb_info()
750 struct fb_info *info = file_fb_info(file); fb_read() local
756 if (!info || ! info->screen_base) fb_read()
759 if (info->state != FBINFO_STATE_RUNNING) fb_read()
762 if (info->fbops->fb_read) fb_read()
763 return info->fbops->fb_read(info, buf, count, ppos); fb_read()
765 total_size = info->screen_size; fb_read()
768 total_size = info->fix.smem_len; fb_read()
784 src = (u8 __iomem *) (info->screen_base + p); fb_read()
786 if (info->fbops->fb_sync) fb_read()
787 info->fbops->fb_sync(info); fb_read()
815 struct fb_info *info = file_fb_info(file); fb_write() local
821 if (!info || !info->screen_base) fb_write()
824 if (info->state != FBINFO_STATE_RUNNING) fb_write()
827 if (info->fbops->fb_write) fb_write()
828 return info->fbops->fb_write(info, buf, count, ppos); fb_write()
830 total_size = info->screen_size; fb_write()
833 total_size = info->fix.smem_len; fb_write()
855 dst = (u8 __iomem *) (info->screen_base + p); fb_write()
857 if (info->fbops->fb_sync) fb_write()
858 info->fbops->fb_sync(info); fb_write()
884 fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) fb_pan_display() argument
886 struct fb_fix_screeninfo *fix = &info->fix; fb_pan_display()
887 unsigned int yres = info->var.yres; fb_pan_display()
904 if (err || !info->fbops->fb_pan_display || fb_pan_display()
905 var->yoffset > info->var.yres_virtual - yres || fb_pan_display()
906 var->xoffset > info->var.xres_virtual - info->var.xres) fb_pan_display()
909 if ((err = info->fbops->fb_pan_display(var, info))) fb_pan_display()
911 info->var.xoffset = var->xoffset; fb_pan_display()
912 info->var.yoffset = var->yoffset; fb_pan_display()
914 info->var.vmode |= FB_VMODE_YWRAP; fb_pan_display()
916 info->var.vmode &= ~FB_VMODE_YWRAP; fb_pan_display()
921 static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var, fb_check_caps() argument
931 event.info = info; fb_check_caps()
934 info->fbops->fb_get_caps(info, &fbcaps, var); fb_check_caps()
945 fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) fb_set_var() argument
947 int flags = info->flags; fb_set_var()
954 fb_var_to_videomode(&mode2, &info->var); fb_set_var()
961 event.info = info; fb_set_var()
967 fb_delete_videomode(&mode1, &info->modelist); fb_set_var()
975 memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { fb_set_var()
981 if ((info->fix.capabilities & FB_CAP_FOURCC) && fb_set_var()
992 if (!info->fbops->fb_check_var) { fb_set_var()
993 *var = info->var; fb_set_var()
997 ret = info->fbops->fb_check_var(var, info); fb_set_var()
1006 if (info->fbops->fb_get_caps) { fb_set_var()
1007 ret = fb_check_caps(info, var, activate); fb_set_var()
1013 old_var = info->var; fb_set_var()
1014 info->var = *var; fb_set_var()
1016 if (info->fbops->fb_set_par) { fb_set_var()
1017 ret = info->fbops->fb_set_par(info); fb_set_var()
1020 info->var = old_var; fb_set_var()
1028 fb_pan_display(info, &info->var); fb_set_var()
1029 fb_set_cmap(&info->cmap, info); fb_set_var()
1030 fb_var_to_videomode(&mode, &info->var); fb_set_var()
1032 if (info->modelist.prev && info->modelist.next && fb_set_var()
1033 !list_empty(&info->modelist)) fb_set_var()
1034 ret = fb_add_videomode(&mode, &info->modelist); fb_set_var()
1042 info->flags &= ~FBINFO_MISC_USEREVENT; fb_set_var()
1043 event.info = info; fb_set_var()
1056 fb_blank(struct fb_info *info, int blank) fb_blank() argument
1064 event.info = info; fb_blank()
1069 if (info->fbops->fb_blank) fb_blank()
1070 ret = info->fbops->fb_blank(blank, info); fb_blank()
1087 static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, do_fb_ioctl() argument
1102 if (!lock_fb_info(info)) do_fb_ioctl()
1104 var = info->var; do_fb_ioctl()
1105 unlock_fb_info(info); do_fb_ioctl()
1113 if (!lock_fb_info(info)) { do_fb_ioctl()
1117 info->flags |= FBINFO_MISC_USEREVENT; do_fb_ioctl()
1118 ret = fb_set_var(info, &var); do_fb_ioctl()
1119 info->flags &= ~FBINFO_MISC_USEREVENT; do_fb_ioctl()
1120 unlock_fb_info(info); do_fb_ioctl()
1126 if (!lock_fb_info(info)) do_fb_ioctl()
1128 fix = info->fix; do_fb_ioctl()
1129 unlock_fb_info(info); do_fb_ioctl()
1136 ret = fb_set_user_cmap(&cmap, info); do_fb_ioctl()
1141 if (!lock_fb_info(info)) do_fb_ioctl()
1143 cmap_from = info->cmap; do_fb_ioctl()
1144 unlock_fb_info(info); do_fb_ioctl()
1151 if (!lock_fb_info(info)) { do_fb_ioctl()
1155 ret = fb_pan_display(info, &var); do_fb_ioctl()
1156 unlock_fb_info(info); do_fb_ioctl()
1171 if (!lock_fb_info(info)) do_fb_ioctl()
1173 event.info = info; do_fb_ioctl()
1175 unlock_fb_info(info); do_fb_ioctl()
1193 if (!lock_fb_info(info)) { do_fb_ioctl()
1197 event.info = info; do_fb_ioctl()
1199 unlock_fb_info(info); do_fb_ioctl()
1204 if (!lock_fb_info(info)) { do_fb_ioctl()
1208 info->flags |= FBINFO_MISC_USEREVENT; do_fb_ioctl()
1209 ret = fb_blank(info, arg); do_fb_ioctl()
1210 info->flags &= ~FBINFO_MISC_USEREVENT; do_fb_ioctl()
1211 unlock_fb_info(info); do_fb_ioctl()
1215 if (!lock_fb_info(info)) do_fb_ioctl()
1217 fb = info->fbops; do_fb_ioctl()
1219 ret = fb->fb_ioctl(info, cmd, arg); do_fb_ioctl()
1222 unlock_fb_info(info); do_fb_ioctl()
1229 struct fb_info *info = file_fb_info(file); fb_ioctl() local
1231 if (!info) fb_ioctl()
1233 return do_fb_ioctl(info, cmd, arg); fb_ioctl()
1263 static int fb_getput_cmap(struct fb_info *info, unsigned int cmd, fb_getput_cmap() argument
1287 err = do_fb_ioctl(info, cmd, (unsigned long) cmap); fb_getput_cmap()
1331 static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd, fb_get_fscreeninfo() argument
1343 err = do_fb_ioctl(info, cmd, (unsigned long) &fix); fb_get_fscreeninfo()
1355 struct fb_info *info = file_fb_info(file); fb_compat_ioctl() local
1359 if (!info) fb_compat_ioctl()
1361 fb = info->fbops; fb_compat_ioctl()
1370 ret = do_fb_ioctl(info, cmd, arg); fb_compat_ioctl()
1374 ret = fb_get_fscreeninfo(info, cmd, arg); fb_compat_ioctl()
1379 ret = fb_getput_cmap(info, cmd, arg); fb_compat_ioctl()
1384 ret = fb->fb_compat_ioctl(info, cmd, arg); fb_compat_ioctl()
1394 struct fb_info *info = file_fb_info(file); fb_mmap() local
1400 if (!info) fb_mmap()
1402 fb = info->fbops; fb_mmap()
1405 mutex_lock(&info->mm_lock); fb_mmap()
1408 res = fb->fb_mmap(info, vma); fb_mmap()
1409 mutex_unlock(&info->mm_lock); fb_mmap()
1417 start = info->fix.smem_start; fb_mmap()
1418 len = info->fix.smem_len; fb_mmap()
1421 if (info->var.accel_flags) { fb_mmap()
1422 mutex_unlock(&info->mm_lock); fb_mmap()
1427 start = info->fix.mmio_start; fb_mmap()
1428 len = info->fix.mmio_len; fb_mmap()
1430 mutex_unlock(&info->mm_lock); fb_mmap()
1440 __acquires(&info->lock)
1441 __releases(&info->lock)
1444 struct fb_info *info; variable in typeref:struct:fb_info
1447 info = get_fb_info(fbidx);
1448 if (!info) {
1450 info = get_fb_info(fbidx);
1451 if (!info)
1454 if (IS_ERR(info))
1455 return PTR_ERR(info);
1457 mutex_lock(&info->lock);
1458 if (!try_module_get(info->fbops->owner)) {
1462 file->private_data = info;
1463 if (info->fbops->fb_open) {
1464 res = info->fbops->fb_open(info,1);
1466 module_put(info->fbops->owner);
1469 if (info->fbdefio)
1470 fb_deferred_io_open(info, inode, file);
1473 mutex_unlock(&info->lock);
1475 put_fb_info(info); variable
1481 __acquires(&info->lock)
1482 __releases(&info->lock)
1484 struct fb_info * const info = file->private_data; variable
1486 mutex_lock(&info->lock);
1487 if (info->fbops->fb_release)
1488 info->fbops->fb_release(info,1);
1489 module_put(info->fbops->owner);
1490 mutex_unlock(&info->lock);
1491 put_fb_info(info); variable
1677 event.info = fb_info; do_register_framebuffer()
1705 event.info = fb_info; do_unregister_framebuffer()
1723 event.info = fb_info; do_unregister_framebuffer()
1728 /* this may free fb info */ do_unregister_framebuffer()
1764 * @fb_info: frame buffer info structure
1786 * @fb_info: frame buffer info structure
1815 * @info: framebuffer affected
1822 void fb_set_suspend(struct fb_info *info, int state) fb_set_suspend() argument
1826 event.info = info; fb_set_suspend()
1829 info->state = FBINFO_STATE_SUSPENDED; fb_set_suspend()
1831 info->state = FBINFO_STATE_RUNNING; fb_set_suspend()
1879 int fb_new_modelist(struct fb_info *info) fb_new_modelist() argument
1882 struct fb_var_screeninfo var = info->var; fb_new_modelist()
1888 list_for_each_safe(pos, n, &info->modelist) { fb_new_modelist()
1893 err = fb_set_var(info, &var); fb_new_modelist()
1903 if (!list_empty(&info->modelist)) { fb_new_modelist()
1904 event.info = info; fb_new_modelist()
/linux-4.4.14/drivers/block/
H A Dxen-blkfront.c110 #define BLK_RING_SIZE(info) \
111 __CONST_RING_SIZE(blkif, XEN_PAGE_SIZE * (info)->nr_ring_pages)
201 static int blkfront_setup_indirect(struct blkfront_info *info);
202 static int blkfront_gather_backend_features(struct blkfront_info *info);
204 static int get_id_from_freelist(struct blkfront_info *info) get_id_from_freelist() argument
206 unsigned long free = info->shadow_free; get_id_from_freelist()
207 BUG_ON(free >= BLK_RING_SIZE(info)); get_id_from_freelist()
208 info->shadow_free = info->shadow[free].req.u.rw.id; get_id_from_freelist()
209 info->shadow[free].req.u.rw.id = 0x0fffffee; /* debug */ get_id_from_freelist()
213 static int add_id_to_freelist(struct blkfront_info *info, add_id_to_freelist() argument
216 if (info->shadow[id].req.u.rw.id != id) add_id_to_freelist()
218 if (info->shadow[id].request == NULL) add_id_to_freelist()
220 info->shadow[id].req.u.rw.id = info->shadow_free; add_id_to_freelist()
221 info->shadow[id].request = NULL; add_id_to_freelist()
222 info->shadow_free = id; add_id_to_freelist()
226 static int fill_grant_buffer(struct blkfront_info *info, int num) fill_grant_buffer() argument
237 if (info->feature_persistent) { fill_grant_buffer()
247 list_add(&gnt_list_entry->node, &info->grants); fill_grant_buffer()
255 &info->grants, node) { fill_grant_buffer()
257 if (info->feature_persistent) fill_grant_buffer()
266 static struct grant *get_free_grant(struct blkfront_info *info) get_free_grant() argument
270 BUG_ON(list_empty(&info->grants)); get_free_grant()
271 gnt_list_entry = list_first_entry(&info->grants, struct grant, get_free_grant()
276 info->persistent_gnts_c--; get_free_grant()
282 const struct blkfront_info *info) grant_foreign_access()
285 info->xbdev->otherend_id, grant_foreign_access()
292 struct blkfront_info *info) get_grant()
294 struct grant *gnt_list_entry = get_free_grant(info); get_grant()
302 if (info->feature_persistent) get_grant()
303 grant_foreign_access(gnt_list_entry, info); get_grant()
307 info->xbdev->otherend_id, get_grant()
315 struct blkfront_info *info) get_indirect_grant()
317 struct grant *gnt_list_entry = get_free_grant(info); get_indirect_grant()
325 if (!info->feature_persistent) { get_indirect_grant()
329 BUG_ON(list_empty(&info->indirect_pages)); get_indirect_grant()
330 indirect_page = list_first_entry(&info->indirect_pages, get_indirect_grant()
335 grant_foreign_access(gnt_list_entry, info); get_indirect_grant()
406 struct blkfront_info *info = (struct blkfront_info *)arg; blkif_restart_queue_callback() local
407 schedule_work(&info->work); blkif_restart_queue_callback()
412 /* We don't have real geometry info, but let's at least return blkif_getgeo()
429 struct blkfront_info *info = bdev->bd_disk->private_data; blkif_ioctl() local
432 dev_dbg(&info->xbdev->dev, "command: 0x%x, argument: 0x%lx\n", blkif_ioctl()
437 dev_dbg(&info->xbdev->dev, "FIXME: support multisession CDs later\n"); blkif_ioctl()
444 struct gendisk *gd = info->gd; blkif_ioctl()
461 struct blkfront_info *info = req->rq_disk->private_data; blkif_queue_discard_req() local
466 ring_req = RING_GET_REQUEST(&info->ring, info->ring.req_prod_pvt); blkif_queue_discard_req()
467 id = get_id_from_freelist(info); blkif_queue_discard_req()
468 info->shadow[id].request = req; blkif_queue_discard_req()
474 if ((req->cmd_flags & REQ_SECURE) && info->feature_secdiscard) blkif_queue_discard_req()
479 info->ring.req_prod_pvt++; blkif_queue_discard_req()
482 info->shadow[id].req = *ring_req; blkif_queue_discard_req()
490 struct blkfront_info *info; member in struct:setup_rw_req
510 struct blkfront_info *info = setup->info; blkif_setup_rw_req_grant() local
511 struct blk_shadow *shadow = &info->shadow[setup->id]; blkif_setup_rw_req_grant()
519 gnt_list_entry = get_indirect_grant(&setup->gref_head, info); blkif_setup_rw_req_grant()
525 gnt_list_entry = get_grant(&setup->gref_head, gfn, info); blkif_setup_rw_req_grant()
571 struct blkfront_info *info = req->rq_disk->private_data; blkif_queue_rw_req() local
578 .info = info, blkif_queue_rw_req()
579 .need_copy = rq_data_dir(req) && info->feature_persistent, blkif_queue_rw_req()
600 if (info->persistent_gnts_c < max_grefs) { blkif_queue_rw_req()
603 max_grefs - info->persistent_gnts_c, blkif_queue_rw_req()
606 &info->callback, blkif_queue_rw_req()
608 info, blkif_queue_rw_req()
616 ring_req = RING_GET_REQUEST(&info->ring, info->ring.req_prod_pvt); blkif_queue_rw_req()
617 id = get_id_from_freelist(info); blkif_queue_rw_req()
618 info->shadow[id].request = req; blkif_queue_rw_req()
620 BUG_ON(info->max_indirect_segments == 0 && blkif_queue_rw_req()
622 BUG_ON(info->max_indirect_segments && blkif_queue_rw_req()
623 GREFS(req->nr_phys_segments) > info->max_indirect_segments); blkif_queue_rw_req()
625 num_sg = blk_rq_map_sg(req->q, req, info->shadow[id].sg); blkif_queue_rw_req()
628 for_each_sg(info->shadow[id].sg, sg, num_sg, i) blkif_queue_rw_req()
632 info->shadow[id].num_sg = num_sg; blkif_queue_rw_req()
643 ring_req->u.indirect.handle = info->handle; blkif_queue_rw_req()
647 ring_req->u.rw.handle = info->handle; blkif_queue_rw_req()
658 switch (info->feature_flush & blkif_queue_rw_req()
677 for_each_sg(info->shadow[id].sg, sg, num_sg, i) { blkif_queue_rw_req()
697 info->ring.req_prod_pvt++; blkif_queue_rw_req()
700 info->shadow[id].req = *ring_req; blkif_queue_rw_req()
716 struct blkfront_info *info = req->rq_disk->private_data; blkif_queue_request() local
718 if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) blkif_queue_request()
727 static inline void flush_requests(struct blkfront_info *info) flush_requests() argument
731 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&info->ring, notify); flush_requests()
734 notify_remote_via_irq(info->irq); flush_requests()
738 struct blkfront_info *info) blkif_request_flush_invalid()
742 !(info->feature_flush & REQ_FLUSH)) || blkif_request_flush_invalid()
744 !(info->feature_flush & REQ_FUA))); blkif_request_flush_invalid()
750 struct blkfront_info *info = qd->rq->rq_disk->private_data; blkif_queue_rq() local
753 spin_lock_irq(&info->io_lock); blkif_queue_rq()
754 if (RING_FULL(&info->ring)) blkif_queue_rq()
757 if (blkif_request_flush_invalid(qd->rq, info)) blkif_queue_rq()
763 flush_requests(info); blkif_queue_rq()
764 spin_unlock_irq(&info->io_lock); blkif_queue_rq()
768 spin_unlock_irq(&info->io_lock); blkif_queue_rq()
772 spin_unlock_irq(&info->io_lock); blkif_queue_rq()
787 struct blkfront_info *info = gd->private_data; xlvbd_init_blk_queue() local
789 memset(&info->tag_set, 0, sizeof(info->tag_set)); xlvbd_init_blk_queue()
790 info->tag_set.ops = &blkfront_mq_ops; xlvbd_init_blk_queue()
791 info->tag_set.nr_hw_queues = 1; xlvbd_init_blk_queue()
792 info->tag_set.queue_depth = BLK_RING_SIZE(info); xlvbd_init_blk_queue()
793 info->tag_set.numa_node = NUMA_NO_NODE; xlvbd_init_blk_queue()
794 info->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_SG_MERGE; xlvbd_init_blk_queue()
795 info->tag_set.cmd_size = 0; xlvbd_init_blk_queue()
796 info->tag_set.driver_data = info; xlvbd_init_blk_queue()
798 if (blk_mq_alloc_tag_set(&info->tag_set)) xlvbd_init_blk_queue()
800 rq = blk_mq_init_queue(&info->tag_set); xlvbd_init_blk_queue()
802 blk_mq_free_tag_set(&info->tag_set); xlvbd_init_blk_queue()
808 if (info->feature_discard) { xlvbd_init_blk_queue()
811 rq->limits.discard_granularity = info->discard_granularity; xlvbd_init_blk_queue()
812 rq->limits.discard_alignment = info->discard_alignment; xlvbd_init_blk_queue()
813 if (info->feature_secdiscard) xlvbd_init_blk_queue()
852 static void xlvbd_flush(struct blkfront_info *info) xlvbd_flush() argument
854 blk_queue_flush(info->rq, info->feature_flush); xlvbd_flush()
856 info->gd->disk_name, flush_info(info->feature_flush), xlvbd_flush()
857 "persistent grants:", info->feature_persistent ? xlvbd_flush()
859 info->max_indirect_segments ? "enabled;" : "disabled;"); xlvbd_flush()
931 struct blkfront_info *info, xlvbd_alloc_gendisk()
943 BUG_ON(info->gd != NULL); xlvbd_alloc_gendisk()
944 BUG_ON(info->rq != NULL); xlvbd_alloc_gendisk()
946 if ((info->vdevice>>EXT_SHIFT) > 1) { xlvbd_alloc_gendisk()
948 printk(KERN_WARNING "blkfront: vdevice 0x%x is above the extended range; ignoring\n", info->vdevice); xlvbd_alloc_gendisk()
952 if (!VDEV_IS_EXTENDED(info->vdevice)) { xlvbd_alloc_gendisk()
953 err = xen_translate_vdev(info->vdevice, &minor, &offset); xlvbd_alloc_gendisk()
958 minor = BLKIF_MINOR_EXT(info->vdevice); xlvbd_alloc_gendisk()
964 "from xvde on\n", info->vdevice); xlvbd_alloc_gendisk()
968 info->vdevice, minor); xlvbd_alloc_gendisk()
996 gd->private_data = info; xlvbd_alloc_gendisk()
997 gd->driverfs_dev = &(info->xbdev->dev); xlvbd_alloc_gendisk()
1001 info->max_indirect_segments ? : xlvbd_alloc_gendisk()
1007 info->rq = gd->queue; xlvbd_alloc_gendisk()
1008 info->gd = gd; xlvbd_alloc_gendisk()
1010 xlvbd_flush(info); xlvbd_alloc_gendisk()
1029 static void xlvbd_release_gendisk(struct blkfront_info *info) xlvbd_release_gendisk() argument
1033 if (info->rq == NULL) xlvbd_release_gendisk()
1037 blk_mq_stop_hw_queues(info->rq); xlvbd_release_gendisk()
1040 gnttab_cancel_free_callback(&info->callback); xlvbd_release_gendisk()
1043 flush_work(&info->work); xlvbd_release_gendisk()
1045 del_gendisk(info->gd); xlvbd_release_gendisk()
1047 minor = info->gd->first_minor; xlvbd_release_gendisk()
1048 nr_minors = info->gd->minors; xlvbd_release_gendisk()
1051 blk_cleanup_queue(info->rq); xlvbd_release_gendisk()
1052 blk_mq_free_tag_set(&info->tag_set); xlvbd_release_gendisk()
1053 info->rq = NULL; xlvbd_release_gendisk()
1055 put_disk(info->gd); xlvbd_release_gendisk()
1056 info->gd = NULL; xlvbd_release_gendisk()
1060 static void kick_pending_request_queues(struct blkfront_info *info) kick_pending_request_queues() argument
1062 if (!RING_FULL(&info->ring)) kick_pending_request_queues()
1063 blk_mq_start_stopped_hw_queues(info->rq, true); kick_pending_request_queues()
1068 struct blkfront_info *info = container_of(work, struct blkfront_info, work); blkif_restart_queue() local
1070 spin_lock_irq(&info->io_lock); blkif_restart_queue()
1071 if (info->connected == BLKIF_STATE_CONNECTED) blkif_restart_queue()
1072 kick_pending_request_queues(info); blkif_restart_queue()
1073 spin_unlock_irq(&info->io_lock); blkif_restart_queue()
1076 static void blkif_free(struct blkfront_info *info, int suspend) blkif_free() argument
1083 spin_lock_irq(&info->io_lock); blkif_free()
1084 info->connected = suspend ? blkif_free()
1087 if (info->rq) blkif_free()
1088 blk_mq_stop_hw_queues(info->rq); blkif_free()
1091 if (!list_empty(&info->grants)) { blkif_free()
1093 &info->grants, node) { blkif_free()
1098 info->persistent_gnts_c--; blkif_free()
1100 if (info->feature_persistent) blkif_free()
1105 BUG_ON(info->persistent_gnts_c != 0); blkif_free()
1111 if (!list_empty(&info->indirect_pages)) { blkif_free()
1114 BUG_ON(info->feature_persistent); blkif_free()
1115 list_for_each_entry_safe(indirect_page, n, &info->indirect_pages, lru) { blkif_free()
1121 for (i = 0; i < BLK_RING_SIZE(info); i++) { blkif_free()
1126 if (!info->shadow[i].request) blkif_free()
1129 segs = info->shadow[i].req.operation == BLKIF_OP_INDIRECT ? blkif_free()
1130 info->shadow[i].req.u.indirect.nr_segments : blkif_free()
1131 info->shadow[i].req.u.rw.nr_segments; blkif_free()
1133 persistent_gnt = info->shadow[i].grants_used[j]; blkif_free()
1135 if (info->feature_persistent) blkif_free()
1140 if (info->shadow[i].req.operation != BLKIF_OP_INDIRECT) blkif_free()
1148 persistent_gnt = info->shadow[i].indirect_grants[j]; blkif_free()
1155 kfree(info->shadow[i].grants_used); blkif_free()
1156 info->shadow[i].grants_used = NULL; blkif_free()
1157 kfree(info->shadow[i].indirect_grants); blkif_free()
1158 info->shadow[i].indirect_grants = NULL; blkif_free()
1159 kfree(info->shadow[i].sg); blkif_free()
1160 info->shadow[i].sg = NULL; blkif_free()
1164 gnttab_cancel_free_callback(&info->callback); blkif_free()
1165 spin_unlock_irq(&info->io_lock); blkif_free()
1168 flush_work(&info->work); blkif_free()
1171 for (i = 0; i < info->nr_ring_pages; i++) { blkif_free()
1172 if (info->ring_ref[i] != GRANT_INVALID_REF) { blkif_free()
1173 gnttab_end_foreign_access(info->ring_ref[i], 0, 0); blkif_free()
1174 info->ring_ref[i] = GRANT_INVALID_REF; blkif_free()
1177 free_pages((unsigned long)info->ring.sring, get_order(info->nr_ring_pages * PAGE_SIZE)); blkif_free()
1178 info->ring.sring = NULL; blkif_free()
1180 if (info->irq) blkif_free()
1181 unbind_from_irqhandler(info->irq, info); blkif_free()
1182 info->evtchn = info->irq = 0; blkif_free()
1196 struct copy_from_grant *info = data; blkif_copy_from_grant() local
1199 const struct blk_shadow *s = info->s; blkif_copy_from_grant()
1201 shared_data = kmap_atomic(s->grants_used[info->grant_idx]->page); blkif_copy_from_grant()
1203 memcpy(info->bvec_data + info->bvec_offset, blkif_copy_from_grant()
1206 info->bvec_offset += len; blkif_copy_from_grant()
1207 info->grant_idx++; blkif_copy_from_grant()
1212 static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, blkif_completion() argument
1227 if (bret->operation == BLKIF_OP_READ && info->feature_persistent) { blkif_completion()
1252 if (!info->feature_persistent) blkif_completion()
1255 list_add(&s->grants_used[i]->node, &info->grants); blkif_completion()
1256 info->persistent_gnts_c++; blkif_completion()
1266 list_add_tail(&s->grants_used[i]->node, &info->grants); blkif_completion()
1272 if (!info->feature_persistent) blkif_completion()
1275 list_add(&s->indirect_grants[i]->node, &info->grants); blkif_completion()
1276 info->persistent_gnts_c++; blkif_completion()
1285 if (!info->feature_persistent) { blkif_completion()
1287 list_add(&indirect_page->lru, &info->indirect_pages); blkif_completion()
1290 list_add_tail(&s->indirect_grants[i]->node, &info->grants); blkif_completion()
1302 struct blkfront_info *info = (struct blkfront_info *)dev_id; blkif_interrupt() local
1305 spin_lock_irqsave(&info->io_lock, flags); blkif_interrupt()
1307 if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) { blkif_interrupt()
1308 spin_unlock_irqrestore(&info->io_lock, flags); blkif_interrupt()
1313 rp = info->ring.sring->rsp_prod; blkif_interrupt()
1316 for (i = info->ring.rsp_cons; i != rp; i++) { blkif_interrupt()
1319 bret = RING_GET_RESPONSE(&info->ring, i); blkif_interrupt()
1326 if (id >= BLK_RING_SIZE(info)) { blkif_interrupt()
1328 info->gd->disk_name, op_name(bret->operation), id); blkif_interrupt()
1333 req = info->shadow[id].request; blkif_interrupt()
1336 blkif_completion(&info->shadow[id], info, bret); blkif_interrupt()
1338 if (add_id_to_freelist(info, id)) { blkif_interrupt()
1340 info->gd->disk_name, op_name(bret->operation), id); blkif_interrupt()
1348 struct request_queue *rq = info->rq; blkif_interrupt()
1350 info->gd->disk_name, op_name(bret->operation)); blkif_interrupt()
1352 info->feature_discard = 0; blkif_interrupt()
1353 info->feature_secdiscard = 0; blkif_interrupt()
1363 info->gd->disk_name, op_name(bret->operation)); blkif_interrupt()
1367 info->shadow[id].req.u.rw.nr_segments == 0)) { blkif_interrupt()
1369 info->gd->disk_name, op_name(bret->operation)); blkif_interrupt()
1375 info->feature_flush = 0; blkif_interrupt()
1376 xlvbd_flush(info); blkif_interrupt()
1382 dev_dbg(&info->xbdev->dev, "Bad return from blkdev data " blkif_interrupt()
1392 info->ring.rsp_cons = i; blkif_interrupt()
1394 if (i != info->ring.req_prod_pvt) { blkif_interrupt()
1396 RING_FINAL_CHECK_FOR_RESPONSES(&info->ring, more_to_do); blkif_interrupt()
1400 info->ring.sring->rsp_event = i + 1; blkif_interrupt()
1402 kick_pending_request_queues(info); blkif_interrupt()
1404 spin_unlock_irqrestore(&info->io_lock, flags); blkif_interrupt()
1411 struct blkfront_info *info) setup_blkring()
1415 unsigned long ring_size = info->nr_ring_pages * XEN_PAGE_SIZE; setup_blkring()
1418 for (i = 0; i < info->nr_ring_pages; i++) setup_blkring()
1419 info->ring_ref[i] = GRANT_INVALID_REF; setup_blkring()
1428 FRONT_RING_INIT(&info->ring, sring, ring_size); setup_blkring()
1430 err = xenbus_grant_ring(dev, info->ring.sring, info->nr_ring_pages, gref); setup_blkring()
1433 info->ring.sring = NULL; setup_blkring()
1436 for (i = 0; i < info->nr_ring_pages; i++) setup_blkring()
1437 info->ring_ref[i] = gref[i]; setup_blkring()
1439 err = xenbus_alloc_evtchn(dev, &info->evtchn); setup_blkring()
1443 err = bind_evtchn_to_irqhandler(info->evtchn, blkif_interrupt, 0, setup_blkring()
1444 "blkif", info); setup_blkring()
1450 info->irq = err; setup_blkring()
1454 blkif_free(info, 0); setup_blkring()
1461 struct blkfront_info *info) talk_to_blkback()
1469 err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, talk_to_blkback()
1472 info->nr_ring_pages = 1; talk_to_blkback()
1475 info->nr_ring_pages = 1 << ring_page_order; talk_to_blkback()
1479 err = setup_blkring(dev, info); talk_to_blkback()
1490 if (info->nr_ring_pages == 1) { talk_to_blkback()
1492 "ring-ref", "%u", info->ring_ref[0]); talk_to_blkback()
1505 for (i = 0; i < info->nr_ring_pages; i++) { talk_to_blkback()
1510 "%u", info->ring_ref[i]); talk_to_blkback()
1518 "event-channel", "%u", info->evtchn); talk_to_blkback()
1543 for (i = 0; i < BLK_RING_SIZE(info); i++) talk_to_blkback()
1544 info->shadow[i].req.u.rw.id = i+1; talk_to_blkback()
1545 info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff; talk_to_blkback()
1555 blkif_free(info, 0); talk_to_blkback()
1570 struct blkfront_info *info; blkfront_probe() local
1614 info = kzalloc(sizeof(*info), GFP_KERNEL); blkfront_probe()
1615 if (!info) { blkfront_probe()
1616 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure"); blkfront_probe()
1620 mutex_init(&info->mutex); blkfront_probe()
1621 spin_lock_init(&info->io_lock); blkfront_probe()
1622 info->xbdev = dev; blkfront_probe()
1623 info->vdevice = vdevice; blkfront_probe()
1624 INIT_LIST_HEAD(&info->grants); blkfront_probe()
1625 INIT_LIST_HEAD(&info->indirect_pages); blkfront_probe()
1626 info->persistent_gnts_c = 0; blkfront_probe()
1627 info->connected = BLKIF_STATE_DISCONNECTED; blkfront_probe()
1628 INIT_WORK(&info->work, blkif_restart_queue); blkfront_probe()
1631 info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0); blkfront_probe()
1632 dev_set_drvdata(&dev->dev, info); blkfront_probe()
1650 static int blkif_recover(struct blkfront_info *info) blkif_recover() argument
1664 copy = kmemdup(info->shadow, sizeof(info->shadow), blkif_recover()
1670 memset(&info->shadow, 0, sizeof(info->shadow)); blkif_recover()
1671 for (i = 0; i < BLK_RING_SIZE(info); i++) blkif_recover()
1672 info->shadow[i].req.u.rw.id = i+1; blkif_recover()
1673 info->shadow_free = info->ring.req_prod_pvt; blkif_recover()
1674 info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff; blkif_recover()
1676 rc = blkfront_gather_backend_features(info); blkif_recover()
1682 segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST; blkif_recover()
1683 blk_queue_max_segments(info->rq, segs); blkif_recover()
1686 for (i = 0; i < BLK_RING_SIZE(info); i++) { blkif_recover()
1712 xenbus_switch_state(info->xbdev, XenbusStateConnected); blkif_recover()
1714 spin_lock_irq(&info->io_lock); blkif_recover()
1717 info->connected = BLKIF_STATE_CONNECTED; blkif_recover()
1720 kick_pending_request_queues(info); blkif_recover()
1728 spin_unlock_irq(&info->io_lock); blkif_recover()
1729 blk_mq_kick_requeue_list(info->rq); blkif_recover()
1775 struct blkfront_info *info = dev_get_drvdata(&dev->dev); blkfront_resume() local
1780 blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); blkfront_resume()
1782 err = talk_to_blkback(dev, info); blkfront_resume()
1794 blkfront_closing(struct blkfront_info *info) blkfront_closing() argument
1796 struct xenbus_device *xbdev = info->xbdev; blkfront_closing()
1799 mutex_lock(&info->mutex); blkfront_closing()
1802 mutex_unlock(&info->mutex); blkfront_closing()
1806 if (info->gd) blkfront_closing()
1807 bdev = bdget_disk(info->gd, 0); blkfront_closing()
1809 mutex_unlock(&info->mutex); blkfront_closing()
1823 xlvbd_release_gendisk(info); blkfront_closing()
1831 static void blkfront_setup_discard(struct blkfront_info *info) blkfront_setup_discard() argument
1838 info->feature_discard = 1; blkfront_setup_discard()
1839 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_setup_discard()
1844 info->discard_granularity = discard_granularity; blkfront_setup_discard()
1845 info->discard_alignment = discard_alignment; blkfront_setup_discard()
1847 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_setup_discard()
1851 info->feature_secdiscard = !!discard_secure; blkfront_setup_discard()
1854 static int blkfront_setup_indirect(struct blkfront_info *info) blkfront_setup_indirect() argument
1859 if (info->max_indirect_segments == 0) blkfront_setup_indirect()
1862 grants = info->max_indirect_segments; blkfront_setup_indirect()
1865 err = fill_grant_buffer(info, blkfront_setup_indirect()
1866 (grants + INDIRECT_GREFS(grants)) * BLK_RING_SIZE(info)); blkfront_setup_indirect()
1870 if (!info->feature_persistent && info->max_indirect_segments) { blkfront_setup_indirect()
1876 int num = INDIRECT_GREFS(grants) * BLK_RING_SIZE(info); blkfront_setup_indirect()
1878 BUG_ON(!list_empty(&info->indirect_pages)); blkfront_setup_indirect()
1883 list_add(&indirect_page->lru, &info->indirect_pages); blkfront_setup_indirect()
1887 for (i = 0; i < BLK_RING_SIZE(info); i++) { blkfront_setup_indirect()
1888 info->shadow[i].grants_used = kzalloc( blkfront_setup_indirect()
1889 sizeof(info->shadow[i].grants_used[0]) * grants, blkfront_setup_indirect()
1891 info->shadow[i].sg = kzalloc(sizeof(info->shadow[i].sg[0]) * psegs, GFP_NOIO); blkfront_setup_indirect()
1892 if (info->max_indirect_segments) blkfront_setup_indirect()
1893 info->shadow[i].indirect_grants = kzalloc( blkfront_setup_indirect()
1894 sizeof(info->shadow[i].indirect_grants[0]) * blkfront_setup_indirect()
1897 if ((info->shadow[i].grants_used == NULL) || blkfront_setup_indirect()
1898 (info->shadow[i].sg == NULL) || blkfront_setup_indirect()
1899 (info->max_indirect_segments && blkfront_setup_indirect()
1900 (info->shadow[i].indirect_grants == NULL))) blkfront_setup_indirect()
1902 sg_init_table(info->shadow[i].sg, psegs); blkfront_setup_indirect()
1909 for (i = 0; i < BLK_RING_SIZE(info); i++) { blkfront_setup_indirect()
1910 kfree(info->shadow[i].grants_used); blkfront_setup_indirect()
1911 info->shadow[i].grants_used = NULL; blkfront_setup_indirect()
1912 kfree(info->shadow[i].sg); blkfront_setup_indirect()
1913 info->shadow[i].sg = NULL; blkfront_setup_indirect()
1914 kfree(info->shadow[i].indirect_grants); blkfront_setup_indirect()
1915 info->shadow[i].indirect_grants = NULL; blkfront_setup_indirect()
1917 if (!list_empty(&info->indirect_pages)) { blkfront_setup_indirect()
1919 list_for_each_entry_safe(indirect_page, n, &info->indirect_pages, lru) { blkfront_setup_indirect()
1930 static int blkfront_gather_backend_features(struct blkfront_info *info) blkfront_gather_backend_features() argument
1936 info->feature_flush = 0; blkfront_gather_backend_features()
1938 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_gather_backend_features()
1950 info->feature_flush = REQ_FLUSH | REQ_FUA; blkfront_gather_backend_features()
1955 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_gather_backend_features()
1960 info->feature_flush = REQ_FLUSH; blkfront_gather_backend_features()
1962 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_gather_backend_features()
1967 blkfront_setup_discard(info); blkfront_gather_backend_features()
1969 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_gather_backend_features()
1973 info->feature_persistent = 0; blkfront_gather_backend_features()
1975 info->feature_persistent = persistent; blkfront_gather_backend_features()
1977 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_gather_backend_features()
1981 info->max_indirect_segments = 0; blkfront_gather_backend_features()
1983 info->max_indirect_segments = min(indirect_segments, blkfront_gather_backend_features()
1986 return blkfront_setup_indirect(info); blkfront_gather_backend_features()
1993 static void blkfront_connect(struct blkfront_info *info) blkfront_connect() argument
2001 switch (info->connected) { blkfront_connect()
2007 err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, blkfront_connect()
2013 set_capacity(info->gd, sectors); blkfront_connect()
2014 revalidate_disk(info->gd); blkfront_connect()
2024 blkif_recover(info); blkfront_connect()
2031 dev_dbg(&info->xbdev->dev, "%s:%s.\n", blkfront_connect()
2032 __func__, info->xbdev->otherend); blkfront_connect()
2034 err = xenbus_gather(XBT_NIL, info->xbdev->otherend, blkfront_connect()
2036 "info", "%u", &binfo, blkfront_connect()
2040 xenbus_dev_fatal(info->xbdev, err, blkfront_connect()
2042 info->xbdev->otherend); blkfront_connect()
2051 err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, blkfront_connect()
2056 err = blkfront_gather_backend_features(info); blkfront_connect()
2058 xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s", blkfront_connect()
2059 info->xbdev->otherend); blkfront_connect()
2063 err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size, blkfront_connect()
2066 xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s", blkfront_connect()
2067 info->xbdev->otherend); blkfront_connect()
2071 xenbus_switch_state(info->xbdev, XenbusStateConnected); blkfront_connect()
2074 spin_lock_irq(&info->io_lock); blkfront_connect()
2075 info->connected = BLKIF_STATE_CONNECTED; blkfront_connect()
2076 kick_pending_request_queues(info); blkfront_connect()
2077 spin_unlock_irq(&info->io_lock); blkfront_connect()
2079 add_disk(info->gd); blkfront_connect()
2081 info->is_ready = 1; blkfront_connect()
2090 struct blkfront_info *info = dev_get_drvdata(&dev->dev); blkback_changed() local
2098 if (talk_to_blkback(dev, info)) { blkback_changed()
2099 kfree(info); blkback_changed()
2111 blkfront_connect(info); blkback_changed()
2119 if (info) blkback_changed()
2120 blkfront_closing(info); blkback_changed()
2127 struct blkfront_info *info = dev_get_drvdata(&xbdev->dev); blkfront_remove() local
2133 blkif_free(info, 0); blkfront_remove()
2135 mutex_lock(&info->mutex); blkfront_remove()
2137 disk = info->gd; blkfront_remove()
2141 info->xbdev = NULL; blkfront_remove()
2142 mutex_unlock(&info->mutex); blkfront_remove()
2145 kfree(info); blkfront_remove()
2156 info = disk->private_data; blkfront_remove()
2162 if (info && !bdev->bd_openers) { blkfront_remove()
2163 xlvbd_release_gendisk(info); blkfront_remove()
2165 kfree(info); blkfront_remove()
2176 struct blkfront_info *info = dev_get_drvdata(&dev->dev); blkfront_is_ready() local
2178 return info->is_ready && info->xbdev; blkfront_is_ready()
2184 struct blkfront_info *info; blkif_open() local
2189 info = disk->private_data; blkif_open()
2190 if (!info) { blkif_open()
2196 mutex_lock(&info->mutex); blkif_open()
2198 if (!info->gd) blkif_open()
2202 mutex_unlock(&info->mutex); blkif_open()
2211 struct blkfront_info *info = disk->private_data; blkif_release() local
2231 mutex_lock(&info->mutex); blkif_release()
2232 xbdev = info->xbdev; blkif_release()
2237 xlvbd_release_gendisk(info); blkif_release()
2238 xenbus_frontend_closed(info->xbdev); blkif_release()
2241 mutex_unlock(&info->mutex); blkif_release()
2246 xlvbd_release_gendisk(info); blkif_release()
2248 kfree(info); blkif_release()
281 grant_foreign_access(const struct grant *gnt_list_entry, const struct blkfront_info *info) grant_foreign_access() argument
290 get_grant(grant_ref_t *gref_head, unsigned long gfn, struct blkfront_info *info) get_grant() argument
314 get_indirect_grant(grant_ref_t *gref_head, struct blkfront_info *info) get_indirect_grant() argument
737 blkif_request_flush_invalid(struct request *req, struct blkfront_info *info) blkif_request_flush_invalid() argument
930 xlvbd_alloc_gendisk(blkif_sector_t capacity, struct blkfront_info *info, u16 vdisk_info, u16 sector_size, unsigned int physical_sector_size) xlvbd_alloc_gendisk() argument
1410 setup_blkring(struct xenbus_device *dev, struct blkfront_info *info) setup_blkring() argument
1460 talk_to_blkback(struct xenbus_device *dev, struct blkfront_info *info) talk_to_blkback() argument
/linux-4.4.14/arch/um/os-Linux/
H A Dtty.c21 struct grantpt_info *info = arg; grantpt_cb() local
23 info->res = grantpt(info->fd); grantpt_cb()
24 info->err = errno; grantpt_cb()
29 struct grantpt_info info; get_pty() local
40 info.fd = fd; get_pty()
41 initial_thread_cb(grantpt_cb, &info); get_pty()
43 if (info.res < 0) { get_pty()
44 err = -info.err; get_pty()
46 "errno = %d\n", -info.err); get_pty()
/linux-4.4.14/drivers/media/i2c/m5mols/
H A Dm5mols_controls.c133 int m5mols_do_scenemode(struct m5mols_info *info, u8 mode) m5mols_do_scenemode() argument
135 struct v4l2_subdev *sd = &info->sd; m5mols_do_scenemode()
142 ret = v4l2_ctrl_s_ctrl(info->lock_3a, 0); m5mols_do_scenemode()
163 if (!ret && is_available_af(info)) m5mols_do_scenemode()
165 if (!ret && is_available_af(info)) m5mols_do_scenemode()
172 ret = m5mols_set_mode(info, REG_CAPTURE); m5mols_do_scenemode()
184 ret = m5mols_set_mode(info, REG_MONITOR); m5mols_do_scenemode()
189 static int m5mols_3a_lock(struct m5mols_info *info, struct v4l2_ctrl *ctrl) m5mols_3a_lock() argument
197 ret = m5mols_write(&info->sd, AE_LOCK, ae_lock ? m5mols_3a_lock()
204 && info->auto_wb->val) { m5mols_3a_lock()
207 ret = m5mols_write(&info->sd, AWB_LOCK, awb_lock ? m5mols_3a_lock()
213 if (!info->ver.af || !af_lock) m5mols_3a_lock()
217 ret = m5mols_write(&info->sd, AF_EXECUTE, REG_AF_STOP); m5mols_3a_lock()
222 static int m5mols_set_metering_mode(struct m5mols_info *info, int mode) m5mols_set_metering_mode() argument
238 return m5mols_write(&info->sd, AE_MODE, metering); m5mols_set_metering_mode()
241 static int m5mols_set_exposure(struct m5mols_info *info, int exposure) m5mols_set_exposure() argument
243 struct v4l2_subdev *sd = &info->sd; m5mols_set_exposure()
248 info->lock_3a->val &= ~V4L2_LOCK_EXPOSURE; m5mols_set_exposure()
249 m5mols_3a_lock(info, info->lock_3a); m5mols_set_exposure()
251 ret = m5mols_set_metering_mode(info, info->metering->val); m5mols_set_exposure()
257 __func__, info->exposure_bias->val, m5mols_set_exposure()
258 info->metering->val); m5mols_set_exposure()
260 return m5mols_write(sd, AE_INDEX, info->exposure_bias->val); m5mols_set_exposure()
267 info->exposure->val); m5mols_set_exposure()
270 info->exposure->val); m5mols_set_exposure()
273 __func__, info->exposure->val); m5mols_set_exposure()
279 static int m5mols_set_white_balance(struct m5mols_info *info, int val) m5mols_set_white_balance() argument
293 struct v4l2_subdev *sd = &info->sd; m5mols_set_white_balance()
317 static int m5mols_set_saturation(struct m5mols_info *info, int val) m5mols_set_saturation() argument
319 int ret = m5mols_write(&info->sd, MON_CHROMA_LVL, val); m5mols_set_saturation()
323 return m5mols_write(&info->sd, MON_CHROMA_EN, REG_CHROMA_ON); m5mols_set_saturation()
326 static int m5mols_set_color_effect(struct m5mols_info *info, int val) m5mols_set_color_effect() argument
331 struct v4l2_subdev *sd = &info->sd; m5mols_set_color_effect()
368 static int m5mols_set_iso(struct m5mols_info *info, int auto_iso) m5mols_set_iso() argument
370 u32 iso = auto_iso ? 0 : info->iso->val + 1; m5mols_set_iso()
372 return m5mols_write(&info->sd, AE_ISO, iso); m5mols_set_iso()
375 static int m5mols_set_wdr(struct m5mols_info *info, int wdr) m5mols_set_wdr() argument
379 ret = m5mols_write(&info->sd, MON_TONE_CTL, wdr ? 9 : 5); m5mols_set_wdr()
383 ret = m5mols_set_mode(info, REG_CAPTURE); m5mols_set_wdr()
387 return m5mols_write(&info->sd, CAPP_WDR_EN, wdr); m5mols_set_wdr()
390 static int m5mols_set_stabilization(struct m5mols_info *info, int val) m5mols_set_stabilization() argument
392 struct v4l2_subdev *sd = &info->sd; m5mols_set_stabilization()
406 struct m5mols_info *info = to_m5mols(sd); m5mols_g_volatile_ctrl() local
411 __func__, ctrl->name, info->isp_ready); m5mols_g_volatile_ctrl()
413 if (!info->isp_ready) m5mols_g_volatile_ctrl()
422 info->iso->val = status - 1; m5mols_g_volatile_ctrl()
432 info->lock_3a->val |= V4L2_LOCK_EXPOSURE; m5mols_g_volatile_ctrl()
438 info->lock_3a->val |= V4L2_LOCK_EXPOSURE; m5mols_g_volatile_ctrl()
442 info->lock_3a->val |= V4L2_LOCK_EXPOSURE; m5mols_g_volatile_ctrl()
453 struct m5mols_info *info = to_m5mols(sd); m5mols_s_ctrl() local
454 int last_mode = info->mode; m5mols_s_ctrl()
461 if (!info->isp_ready) { m5mols_s_ctrl()
462 info->ctrl_sync = 0; m5mols_s_ctrl()
469 if (ctrl_mode && ctrl_mode != info->mode) { m5mols_s_ctrl()
470 ret = m5mols_set_mode(info, ctrl_mode); m5mols_s_ctrl()
477 ret = m5mols_3a_lock(info, ctrl); m5mols_s_ctrl()
485 ret = m5mols_set_exposure(info, ctrl->val); m5mols_s_ctrl()
489 ret = m5mols_set_iso(info, ctrl->val); m5mols_s_ctrl()
493 ret = m5mols_set_white_balance(info, ctrl->val); m5mols_s_ctrl()
497 ret = m5mols_set_saturation(info, ctrl->val); m5mols_s_ctrl()
501 ret = m5mols_set_color_effect(info, ctrl->val); m5mols_s_ctrl()
505 ret = m5mols_set_wdr(info, ctrl->val); m5mols_s_ctrl()
509 ret = m5mols_set_stabilization(info, ctrl->val); m5mols_s_ctrl()
517 if (ret == 0 && info->mode != last_mode) m5mols_s_ctrl()
518 ret = m5mols_set_mode(info, last_mode); m5mols_s_ctrl()
542 struct m5mols_info *info = to_m5mols(sd); m5mols_init_controls() local
552 zoom_step = is_manufacturer(info, REG_SAMSUNG_OPTICS) ? 31 : 1; m5mols_init_controls()
553 v4l2_ctrl_handler_init(&info->handle, 20); m5mols_init_controls()
555 info->auto_wb = v4l2_ctrl_new_std_menu(&info->handle, m5mols_init_controls()
560 info->auto_exposure = v4l2_ctrl_new_std_menu(&info->handle, m5mols_init_controls()
564 info->exposure = v4l2_ctrl_new_std(&info->handle, m5mols_init_controls()
568 info->exposure_bias = v4l2_ctrl_new_int_menu(&info->handle, m5mols_init_controls()
574 info->metering = v4l2_ctrl_new_std_menu(&info->handle, m5mols_init_controls()
579 info->auto_iso = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
582 info->iso = v4l2_ctrl_new_int_menu(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
586 info->saturation = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
589 info->zoom = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
592 info->colorfx = v4l2_ctrl_new_std_menu(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
595 info->wdr = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
598 info->stabilization = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
601 info->jpeg_quality = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
604 info->lock_3a = v4l2_ctrl_new_std(&info->handle, &m5mols_ctrl_ops, m5mols_init_controls()
607 if (info->handle.error) { m5mols_init_controls()
608 int ret = info->handle.error; m5mols_init_controls()
610 v4l2_ctrl_handler_free(&info->handle); m5mols_init_controls()
614 v4l2_ctrl_auto_cluster(4, &info->auto_exposure, 1, false); m5mols_init_controls()
615 info->auto_iso->flags |= V4L2_CTRL_FLAG_VOLATILE | m5mols_init_controls()
617 v4l2_ctrl_auto_cluster(2, &info->auto_iso, 0, false); m5mols_init_controls()
619 info->lock_3a->flags |= V4L2_CTRL_FLAG_VOLATILE; m5mols_init_controls()
621 m5mols_set_ctrl_mode(info->auto_exposure, REG_PARAMETER); m5mols_init_controls()
622 m5mols_set_ctrl_mode(info->auto_wb, REG_PARAMETER); m5mols_init_controls()
623 m5mols_set_ctrl_mode(info->colorfx, REG_MONITOR); m5mols_init_controls()
625 sd->ctrl_handler = &info->handle; m5mols_init_controls()
/linux-4.4.14/drivers/mtd/onenand/
H A Dgeneric.c39 struct onenand_info *info; generic_onenand_probe() local
45 info = kzalloc(sizeof(struct onenand_info), GFP_KERNEL); generic_onenand_probe()
46 if (!info) generic_onenand_probe()
54 info->onenand.base = ioremap(res->start, size); generic_onenand_probe()
55 if (!info->onenand.base) { generic_onenand_probe()
60 info->onenand.mmcontrol = pdata ? pdata->mmcontrol : NULL; generic_onenand_probe()
61 info->onenand.irq = platform_get_irq(pdev, 0); generic_onenand_probe()
63 info->mtd.dev.parent = &pdev->dev; generic_onenand_probe()
64 info->mtd.priv = &info->onenand; generic_onenand_probe()
66 if (onenand_scan(&info->mtd, 1)) { generic_onenand_probe()
71 err = mtd_device_parse_register(&info->mtd, NULL, NULL, generic_onenand_probe()
75 platform_set_drvdata(pdev, info); generic_onenand_probe()
80 iounmap(info->onenand.base); generic_onenand_probe()
84 kfree(info); generic_onenand_probe()
91 struct onenand_info *info = platform_get_drvdata(pdev); generic_onenand_remove() local
95 if (info) { generic_onenand_remove()
96 onenand_release(&info->mtd); generic_onenand_remove()
98 iounmap(info->onenand.base); generic_onenand_remove()
99 kfree(info); generic_onenand_remove()
/linux-4.4.14/drivers/char/agp/
H A Dparisc-agp.c83 struct _parisc_agp_info *info = &parisc_agp_info; parisc_agp_configure() local
85 agp_bridge->gart_bus_addr = info->gart_base; parisc_agp_configure()
86 agp_bridge->capndx = info->lba_cap_offset; parisc_agp_configure()
87 agp_bridge->mode = readl(info->lba_regs+info->lba_cap_offset+PCI_AGP_STATUS); parisc_agp_configure()
95 struct _parisc_agp_info *info = &parisc_agp_info; parisc_agp_tlbflush() local
97 writeq(info->gart_base | ilog2(info->gart_size), info->ioc_regs+IOC_PCOM); parisc_agp_tlbflush()
98 readq(info->ioc_regs+IOC_PCOM); /* flush */ parisc_agp_tlbflush()
104 struct _parisc_agp_info *info = &parisc_agp_info; parisc_agp_create_gatt_table() local
107 for (i = 0; i < info->gatt_entries; i++) { parisc_agp_create_gatt_table()
108 info->gatt[i] = (unsigned long)agp_bridge->scratch_page; parisc_agp_create_gatt_table()
117 struct _parisc_agp_info *info = &parisc_agp_info; parisc_agp_free_gatt_table() local
119 info->gatt[0] = SBA_AGPGART_COOKIE; parisc_agp_free_gatt_table()
127 struct _parisc_agp_info *info = &parisc_agp_info; parisc_agp_insert_memory() local
137 io_pg_start = info->io_pages_per_kpage * pg_start; parisc_agp_insert_memory()
138 io_pg_count = info->io_pages_per_kpage * mem->page_count; parisc_agp_insert_memory()
139 if ((io_pg_start + io_pg_count) > info->gatt_entries) { parisc_agp_insert_memory()
145 if (info->gatt[j]) parisc_agp_insert_memory()
160 k < info->io_pages_per_kpage; parisc_agp_insert_memory()
161 k++, j++, paddr += info->io_page_size) { parisc_agp_insert_memory()
162 info->gatt[j] = parisc_agp_insert_memory()
176 struct _parisc_agp_info *info = &parisc_agp_info; parisc_agp_remove_memory() local
184 io_pg_start = info->io_pages_per_kpage * pg_start; parisc_agp_remove_memory()
185 io_pg_count = info->io_pages_per_kpage * mem->page_count; parisc_agp_remove_memory()
187 info->gatt[i] = agp_bridge->scratch_page; parisc_agp_remove_memory()
204 struct _parisc_agp_info *info = &parisc_agp_info; parisc_agp_enable() local
207 command = readl(info->lba_regs + info->lba_cap_offset + PCI_AGP_STATUS); parisc_agp_enable()
212 writel(command, info->lba_regs + info->lba_cap_offset + PCI_AGP_COMMAND); parisc_agp_enable()
244 struct _parisc_agp_info *info = &parisc_agp_info; agp_ioc_init() local
250 info->ioc_regs = ioc_regs; agp_ioc_init()
252 io_tlb_ps = readq(info->ioc_regs+IOC_TCNFG); agp_ioc_init()
261 info->gatt = NULL; agp_ioc_init()
262 info->gatt_entries = 0; agp_ioc_init()
265 info->io_page_size = 1 << io_tlb_shift; agp_ioc_init()
266 info->io_pages_per_kpage = PAGE_SIZE / info->io_page_size; agp_ioc_init()
268 iova_base = readq(info->ioc_regs+IOC_IBASE) & ~0x1; agp_ioc_init()
269 info->gart_base = iova_base + PLUTO_IOVA_SIZE - PLUTO_GART_SIZE; agp_ioc_init()
271 info->gart_size = PLUTO_GART_SIZE; agp_ioc_init()
272 info->gatt_entries = info->gart_size / info->io_page_size; agp_ioc_init()
274 io_pdir = phys_to_virt(readq(info->ioc_regs+IOC_PDIR_BASE)); agp_ioc_init()
275 info->gatt = &io_pdir[(PLUTO_IOVA_SIZE/2) >> PAGE_SHIFT]; agp_ioc_init()
277 if (info->gatt[0] != SBA_AGPGART_COOKIE) { agp_ioc_init()
278 info->gatt = NULL; agp_ioc_init()
279 info->gatt_entries = 0; agp_ioc_init()
291 struct _parisc_agp_info *info = &parisc_agp_info; lba_find_capability() local
296 status = readw(info->lba_regs + PCI_STATUS); lba_find_capability()
299 pos = readb(info->lba_regs + PCI_CAPABILITY_LIST); lba_find_capability()
302 id = readb(info->lba_regs + pos + PCI_CAP_LIST_ID); lba_find_capability()
307 pos = readb(info->lba_regs + pos + PCI_CAP_LIST_NEXT); lba_find_capability()
315 struct _parisc_agp_info *info = &parisc_agp_info; agp_lba_init() local
318 info->lba_regs = lba_hpa; agp_lba_init()
319 info->lba_cap_offset = lba_find_capability(PCI_CAP_ID_AGP); agp_lba_init()
321 cap = readl(lba_hpa + info->lba_cap_offset) & 0xff; agp_lba_init()
324 cap, info->lba_cap_offset); agp_lba_init()
/linux-4.4.14/drivers/tty/serial/
H A Dcrisv10.c155 static void change_speed(struct e100_serial *info);
164 static int get_lsr_info(struct e100_serial *info, unsigned int *value);
192 /* Values for info->errorcode */
197 #define FORCE_EOP(info) *R_SET_EOP = 1U << info->iseteop;
902 #define E100_RTS_GET(info) ((info)->rx_ctrl & E100_RTS_MASK)
904 #define E100_CTS_GET(info) ((info)->ioport[REG_STATUS] & E100_CTS_MASK)
908 #define E100_DTR_GET(info) ((*e100_modem_pins[(info)->line].dtr_shadow) & e100_modem_pins[(info)->line].dtr_mask)
911 #define E100_RI_GET(info) ((*e100_modem_pins[(info)->line].ri_port) & e100_modem_pins[(info)->line].ri_mask)
912 #define E100_CD_GET(info) ((*e100_modem_pins[(info)->line].cd_port) & e100_modem_pins[(info)->line].cd_mask)
915 #define E100_DSR_GET(info) ((*e100_modem_pins[(info)->line].dsr_port) & e100_modem_pins[(info)->line].dsr_mask)
918 static void update_char_time(struct e100_serial * info) update_char_time() argument
920 tcflag_t cflags = info->port.tty->termios.c_cflag; update_char_time()
937 info->char_time_usec = ((bits * 1000000) / info->baud) + 1; update_char_time()
938 info->flush_time_usec = 4*info->char_time_usec; update_char_time()
939 if (info->flush_time_usec < MIN_FLUSH_TIME_USEC) update_char_time()
940 info->flush_time_usec = MIN_FLUSH_TIME_USEC; update_char_time()
1003 e100_dtr(struct e100_serial *info, int set) e100_dtr() argument
1005 unsigned char mask = e100_modem_pins[info->line].dtr_mask; e100_dtr()
1008 printk("ser%i dtr %i mask: 0x%02X\n", info->line, set, mask); e100_dtr()
1010 info->line, *e100_modem_pins[info->line].dtr_shadow, e100_dtr()
1011 E100_DTR_GET(info)); e100_dtr()
1018 *e100_modem_pins[info->line].dtr_shadow &= ~mask; e100_dtr()
1019 *e100_modem_pins[info->line].dtr_shadow |= (set ? 0 : mask); e100_dtr()
1020 *e100_modem_pins[info->line].dtr_port = *e100_modem_pins[info->line].dtr_shadow; e100_dtr()
1026 info->line, *e100_modem_pins[info->line].dtr_shadow, e100_dtr()
1027 E100_DTR_GET(info)); e100_dtr()
1035 e100_rts(struct e100_serial *info, int set) e100_rts() argument
1039 info->rx_ctrl &= ~E100_RTS_MASK; e100_rts()
1040 info->rx_ctrl |= (set ? 0 : E100_RTS_MASK); /* RTS is active low */ e100_rts()
1041 info->ioport[REG_REC_CTRL] = info->rx_ctrl; e100_rts()
1044 printk("ser%i rts %i\n", info->line, set); e100_rts()
1051 e100_ri_out(struct e100_serial *info, int set) e100_ri_out() argument
1055 unsigned char mask = e100_modem_pins[info->line].ri_mask; e100_ri_out()
1059 *e100_modem_pins[info->line].ri_shadow &= ~mask; e100_ri_out()
1060 *e100_modem_pins[info->line].ri_shadow |= (set ? 0 : mask); e100_ri_out()
1061 *e100_modem_pins[info->line].ri_port = *e100_modem_pins[info->line].ri_shadow; e100_ri_out()
1066 e100_cd_out(struct e100_serial *info, int set) e100_cd_out() argument
1070 unsigned char mask = e100_modem_pins[info->line].cd_mask; e100_cd_out()
1074 *e100_modem_pins[info->line].cd_shadow &= ~mask; e100_cd_out()
1075 *e100_modem_pins[info->line].cd_shadow |= (set ? 0 : mask); e100_cd_out()
1076 *e100_modem_pins[info->line].cd_port = *e100_modem_pins[info->line].cd_shadow; e100_cd_out()
1082 e100_disable_rx(struct e100_serial *info) e100_disable_rx() argument
1085 info->ioport[REG_REC_CTRL] = e100_disable_rx()
1086 (info->rx_ctrl &= ~IO_MASK(R_SERIAL0_REC_CTRL, rec_enable)); e100_disable_rx()
1090 e100_enable_rx(struct e100_serial *info) e100_enable_rx() argument
1093 info->ioport[REG_REC_CTRL] = e100_enable_rx()
1094 (info->rx_ctrl |= IO_MASK(R_SERIAL0_REC_CTRL, rec_enable)); e100_enable_rx()
1100 e100_disable_rxdma_irq(struct e100_serial *info) e100_disable_rxdma_irq() argument
1103 printk("rxdma_irq(%d): 0\n",info->line); e100_disable_rxdma_irq()
1105 DINTR1(DEBUG_LOG(info->line,"IRQ disable_rxdma_irq %i\n", info->line)); e100_disable_rxdma_irq()
1106 *R_IRQ_MASK2_CLR = (info->irq << 2) | (info->irq << 3); e100_disable_rxdma_irq()
1110 e100_enable_rxdma_irq(struct e100_serial *info) e100_enable_rxdma_irq() argument
1113 printk("rxdma_irq(%d): 1\n",info->line); e100_enable_rxdma_irq()
1115 DINTR1(DEBUG_LOG(info->line,"IRQ enable_rxdma_irq %i\n", info->line)); e100_enable_rxdma_irq()
1116 *R_IRQ_MASK2_SET = (info->irq << 2) | (info->irq << 3); e100_enable_rxdma_irq()
1121 static void e100_disable_txdma_irq(struct e100_serial *info) e100_disable_txdma_irq() argument
1124 printk("txdma_irq(%d): 0\n",info->line); e100_disable_txdma_irq()
1126 DINTR1(DEBUG_LOG(info->line,"IRQ disable_txdma_irq %i\n", info->line)); e100_disable_txdma_irq()
1127 *R_IRQ_MASK2_CLR = info->irq; e100_disable_txdma_irq()
1130 static void e100_enable_txdma_irq(struct e100_serial *info) e100_enable_txdma_irq() argument
1133 printk("txdma_irq(%d): 1\n",info->line); e100_enable_txdma_irq()
1135 DINTR1(DEBUG_LOG(info->line,"IRQ enable_txdma_irq %i\n", info->line)); e100_enable_txdma_irq()
1136 *R_IRQ_MASK2_SET = info->irq; e100_enable_txdma_irq()
1139 static void e100_disable_txdma_channel(struct e100_serial *info) e100_disable_txdma_channel() argument
1147 DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); e100_disable_txdma_channel()
1148 if (info->line == 0) { e100_disable_txdma_channel()
1154 } else if (info->line == 1) { e100_disable_txdma_channel()
1160 } else if (info->line == 2) { e100_disable_txdma_channel()
1166 } else if (info->line == 3) { e100_disable_txdma_channel()
1178 static void e100_enable_txdma_channel(struct e100_serial *info) e100_enable_txdma_channel() argument
1183 DFLOW(DEBUG_LOG(info->line, "enable_txdma_channel %i\n", info->line)); e100_enable_txdma_channel()
1185 if (info->line == 0) { e100_enable_txdma_channel()
1188 } else if (info->line == 1) { e100_enable_txdma_channel()
1191 } else if (info->line == 2) { e100_enable_txdma_channel()
1194 } else if (info->line == 3) { e100_enable_txdma_channel()
1202 static void e100_disable_rxdma_channel(struct e100_serial *info) e100_disable_rxdma_channel() argument
1210 if (info->line == 0) { e100_disable_rxdma_channel()
1216 } else if (info->line == 1) { e100_disable_rxdma_channel()
1222 } else if (info->line == 2) { e100_disable_rxdma_channel()
1228 } else if (info->line == 3) { e100_disable_rxdma_channel()
1240 static void e100_enable_rxdma_channel(struct e100_serial *info) e100_enable_rxdma_channel() argument
1246 if (info->line == 0) { e100_enable_rxdma_channel()
1249 } else if (info->line == 1) { e100_enable_rxdma_channel()
1252 } else if (info->line == 2) { e100_enable_rxdma_channel()
1255 } else if (info->line == 3) { e100_enable_rxdma_channel()
1268 e100_disable_serial_data_irq(struct e100_serial *info) e100_disable_serial_data_irq() argument
1271 printk("ser_irq(%d): 0\n",info->line); e100_disable_serial_data_irq()
1273 DINTR1(DEBUG_LOG(info->line,"IRQ disable data_irq %i\n", info->line)); e100_disable_serial_data_irq()
1274 *R_IRQ_MASK1_CLR = (1U << (8+2*info->line)); e100_disable_serial_data_irq()
1278 e100_enable_serial_data_irq(struct e100_serial *info) e100_enable_serial_data_irq() argument
1281 printk("ser_irq(%d): 1\n",info->line); e100_enable_serial_data_irq()
1283 (8+2*info->line), e100_enable_serial_data_irq()
1284 (1U << (8+2*info->line))); e100_enable_serial_data_irq()
1286 DINTR1(DEBUG_LOG(info->line,"IRQ enable data_irq %i\n", info->line)); e100_enable_serial_data_irq()
1287 *R_IRQ_MASK1_SET = (1U << (8+2*info->line)); e100_enable_serial_data_irq()
1292 e100_disable_serial_tx_ready_irq(struct e100_serial *info) e100_disable_serial_tx_ready_irq() argument
1295 printk("ser_tx_irq(%d): 0\n",info->line); e100_disable_serial_tx_ready_irq()
1297 DINTR1(DEBUG_LOG(info->line,"IRQ disable ready_irq %i\n", info->line)); e100_disable_serial_tx_ready_irq()
1298 *R_IRQ_MASK1_CLR = (1U << (8+1+2*info->line)); e100_disable_serial_tx_ready_irq()
1302 e100_enable_serial_tx_ready_irq(struct e100_serial *info) e100_enable_serial_tx_ready_irq() argument
1305 printk("ser_tx_irq(%d): 1\n",info->line); e100_enable_serial_tx_ready_irq()
1307 (8+1+2*info->line), e100_enable_serial_tx_ready_irq()
1308 (1U << (8+1+2*info->line))); e100_enable_serial_tx_ready_irq()
1310 DINTR2(DEBUG_LOG(info->line,"IRQ enable ready_irq %i\n", info->line)); e100_enable_serial_tx_ready_irq()
1311 *R_IRQ_MASK1_SET = (1U << (8+1+2*info->line)); e100_enable_serial_tx_ready_irq()
1314 static inline void e100_enable_rx_irq(struct e100_serial *info) e100_enable_rx_irq() argument
1316 if (info->uses_dma_in) e100_enable_rx_irq()
1317 e100_enable_rxdma_irq(info); e100_enable_rx_irq()
1319 e100_enable_serial_data_irq(info); e100_enable_rx_irq()
1321 static inline void e100_disable_rx_irq(struct e100_serial *info) e100_disable_rx_irq() argument
1323 if (info->uses_dma_in) e100_disable_rx_irq()
1324 e100_disable_rxdma_irq(info); e100_disable_rx_irq()
1326 e100_disable_serial_data_irq(info); e100_disable_rx_irq()
1334 struct e100_serial * info = (struct e100_serial *)tty->driver_data; e100_enable_rs485() local
1340 info->rs485 = *r; e100_enable_rs485()
1343 if (info->rs485.delay_rts_before_send >= 1000) e100_enable_rs485()
1344 info->rs485.delay_rts_before_send = 1000; e100_enable_rs485()
1347 info->rs485.rts_on_send, e100_enable_rs485()
1348 info->rs485.rts_after_sent, e100_enable_rs485()
1349 info->rs485.enabled e100_enable_rs485()
1359 struct e100_serial * info = (struct e100_serial *)tty->driver_data; e100_write_rs485() local
1360 int old_value = (info->rs485.flags) & SER_RS485_ENABLED; e100_write_rs485()
1367 info->rs485.flags |= SER_RS485_ENABLED; e100_write_rs485()
1371 info->rs485.flags &= ~(SER_RS485_ENABLED); e100_write_rs485()
1379 struct e100_serial *info = (struct e100_serial *)data; rs485_toggle_rts_timer_function() local
1381 fast_timers_rs485[info->line].function = NULL; rs485_toggle_rts_timer_function()
1382 e100_rts(info, (info->rs485.flags & SER_RS485_RTS_AFTER_SEND)); rs485_toggle_rts_timer_function()
1384 e100_enable_rx(info); rs485_toggle_rts_timer_function()
1385 e100_enable_rx_irq(info); rs485_toggle_rts_timer_function()
1403 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_stop() local
1404 if (info) { rs_stop()
1409 DFLOW(DEBUG_LOG(info->line, "XOFF rs_stop xmit %i\n", rs_stop()
1410 CIRC_CNT(info->xmit.head, rs_stop()
1411 info->xmit.tail,SERIAL_XMIT_SIZE))); rs_stop()
1414 STOP_CHAR(info->port.tty)); rs_stop()
1420 *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; rs_stop()
1428 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_start() local
1429 if (info) { rs_start()
1434 DFLOW(DEBUG_LOG(info->line, "XOFF rs_start xmit %i\n", rs_start()
1435 CIRC_CNT(info->xmit.head, rs_start()
1436 info->xmit.tail,SERIAL_XMIT_SIZE))); rs_start()
1443 *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; rs_start()
1444 if (!info->uses_dma_out && rs_start()
1445 info->xmit.head != info->xmit.tail && info->xmit.buf) rs_start()
1446 e100_enable_serial_tx_ready_irq(info); rs_start()
1477 static void rs_sched_event(struct e100_serial *info, int event) rs_sched_event() argument
1479 if (info->event & (1 << event)) rs_sched_event()
1481 info->event |= 1 << event; rs_sched_event()
1482 schedule_work(&info->work); rs_sched_event()
1487 * We don't pay attention to info->x_char, which means if the TTY wants to
1488 * use XON/XOFF it will set info->x_char but we won't send any X char!
1497 transmit_chars_dma(struct e100_serial *info) transmit_chars_dma() argument
1503 *info->oclrintradr = transmit_chars_dma()
1508 if (info->line == SERIAL_DEBUG_LINE) transmit_chars_dma()
1511 if (!info->tr_running) { transmit_chars_dma()
1517 descr = &info->tr_descr; transmit_chars_dma()
1529 DFLOW(DEBUG_LOG(info->line, "TX %i done\n", sentl)); transmit_chars_dma()
1532 info->icount.tx += sentl; transmit_chars_dma()
1535 info->xmit.tail = (info->xmit.tail + sentl) & (SERIAL_XMIT_SIZE - 1); transmit_chars_dma()
1539 if (CIRC_CNT(info->xmit.head, transmit_chars_dma()
1540 info->xmit.tail, transmit_chars_dma()
1542 rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); transmit_chars_dma()
1546 c = CIRC_CNT_TO_END(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); transmit_chars_dma()
1557 info->tr_running = 0; transmit_chars_dma()
1560 if (info->rs485.flags & SER_RS485_ENABLED) { transmit_chars_dma()
1562 start_one_shot_timer(&fast_timers_rs485[info->line], transmit_chars_dma()
1564 (unsigned long)info, transmit_chars_dma()
1565 info->char_time_usec*2, transmit_chars_dma()
1572 /* ok we can schedule a dma send of c chars starting at info->xmit.tail */ transmit_chars_dma()
1574 DFLOW(DEBUG_LOG(info->line, "TX %i\n", c)); transmit_chars_dma()
1577 descr->buf = virt_to_phys(info->xmit.buf + info->xmit.tail); transmit_chars_dma()
1580 *info->ofirstadr = virt_to_phys(descr); /* write to R_DMAx_FIRST */ transmit_chars_dma()
1581 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, start); transmit_chars_dma()
1587 start_transmit(struct e100_serial *info) start_transmit() argument
1590 if (info->line == SERIAL_DEBUG_LINE) start_transmit()
1594 info->tr_descr.sw_len = 0; start_transmit()
1595 info->tr_descr.hw_len = 0; start_transmit()
1596 info->tr_descr.status = 0; start_transmit()
1597 info->tr_running = 1; start_transmit()
1598 if (info->uses_dma_out) start_transmit()
1599 transmit_chars_dma(info); start_transmit()
1601 e100_enable_serial_tx_ready_irq(info); start_transmit()
1608 #define START_FLUSH_FAST_TIMER_TIME(info, string, usec) {\
1611 if (fast_timers[info->line].function == NULL) { \
1613 TIMERD(DEBUG_LOG(info->line, "start_timer %i ", info->line)); \
1614 TIMERD(DEBUG_LOG(info->line, "num started: %i\n", serial_fast_timer_started)); \
1615 start_one_shot_timer(&fast_timers[info->line], \
1617 (unsigned long)info, \
1622 TIMERD(DEBUG_LOG(info->line, "timer %i already running\n", info->line)); \
1626 #define START_FLUSH_FAST_TIMER(info, string) START_FLUSH_FAST_TIMER_TIME(info, string, info->flush_time_usec)
1629 #define START_FLUSH_FAST_TIMER_TIME(info, string, usec)
1630 #define START_FLUSH_FAST_TIMER(info, string)
1650 append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer) append_recv_buffer() argument
1656 if (!info->first_recv_buffer) append_recv_buffer()
1657 info->first_recv_buffer = buffer; append_recv_buffer()
1659 info->last_recv_buffer->next = buffer; append_recv_buffer()
1661 info->last_recv_buffer = buffer; append_recv_buffer()
1663 info->recv_cnt += buffer->length; append_recv_buffer()
1664 if (info->recv_cnt > info->max_recv_cnt) append_recv_buffer()
1665 info->max_recv_cnt = info->recv_cnt; append_recv_buffer()
1671 add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char flag) add_char_and_flag() argument
1674 if (info->uses_dma_in) { add_char_and_flag()
1683 append_recv_buffer(info, buffer); add_char_and_flag()
1685 info->icount.rx++; add_char_and_flag()
1687 tty_insert_flip_char(&info->port, data, flag); add_char_and_flag()
1688 info->icount.rx++; add_char_and_flag()
1694 static unsigned int handle_descr_data(struct e100_serial *info, handle_descr_data() argument
1700 if (info->recv_cnt + recvl > 65536) { handle_descr_data()
1708 if (info->errorcode == ERRCODE_SET_BREAK) handle_descr_data()
1710 info->errorcode = 0; handle_descr_data()
1712 append_recv_buffer(info, buffer); handle_descr_data()
1723 static unsigned int handle_all_descr_data(struct e100_serial *info) handle_all_descr_data() argument
1731 descr = &info->rec_descr[info->cur_rec_descr]; handle_all_descr_data()
1733 if (descr == phys_to_virt(*info->idescradr)) handle_all_descr_data()
1736 if (++info->cur_rec_descr == SERIAL_RECV_DESCRIPTORS) handle_all_descr_data()
1737 info->cur_rec_descr = 0; handle_all_descr_data()
1752 DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl); handle_all_descr_data()
1753 if (info->port.tty->stopped) { handle_all_descr_data()
1755 DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]); handle_all_descr_data()
1756 DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]); handle_all_descr_data()
1757 DEBUG_LOG(info->line, "rx 0x%02X\n", buf[2]); handle_all_descr_data()
1762 info->icount.rx += recvl; handle_all_descr_data()
1764 ret += handle_descr_data(info, descr, recvl); handle_all_descr_data()
1770 static void receive_chars_dma(struct e100_serial *info) receive_chars_dma() argument
1776 *info->iclrintradr = receive_chars_dma()
1780 tty = info->port.tty; receive_chars_dma()
1785 if (info->uses_dma_in) receive_chars_dma()
1786 e100_enable_serial_data_irq(info); receive_chars_dma()
1789 if (info->errorcode == ERRCODE_INSERT_BREAK) receive_chars_dma()
1790 add_char_and_flag(info, '\0', TTY_BREAK); receive_chars_dma()
1792 handle_all_descr_data(info); receive_chars_dma()
1795 rstat = info->ioport[REG_STATUS]; receive_chars_dma()
1797 DFLOW(DEBUG_LOG(info->line, "XOFF detect stat %x\n", rstat)); receive_chars_dma()
1804 unsigned char data = info->ioport[REG_DATA]; receive_chars_dma()
1806 DEBUG_LOG(info->line, "#dERR: s d 0x%04X\n", receive_chars_dma()
1810 add_char_and_flag(info, data, TTY_PARITY); receive_chars_dma()
1812 add_char_and_flag(info, data, TTY_OVERRUN); receive_chars_dma()
1814 add_char_and_flag(info, data, TTY_FRAME); receive_chars_dma()
1817 START_FLUSH_FAST_TIMER(info, "receive_chars"); receive_chars_dma()
1820 *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, restart); receive_chars_dma()
1823 static int start_recv_dma(struct e100_serial *info) start_recv_dma() argument
1825 struct etrax_dma_descr *descr = info->rec_descr; start_recv_dma()
1847 info->cur_rec_descr = 0; start_recv_dma()
1850 *info->ifirstadr = virt_to_phys(&descr[info->cur_rec_descr]); start_recv_dma()
1851 *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, start); start_recv_dma()
1858 start_receive(struct e100_serial *info) start_receive() argument
1860 if (info->uses_dma_in) { start_receive()
1863 *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); start_receive()
1864 while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) == start_receive()
1867 start_recv_dma(info); start_receive()
1875 info->irq is the bit number for the DMAO_DESCR so to check the others we
1876 shift info->irq to the left.
1887 struct e100_serial *info; tr_interrupt() local
1897 info = rs_table + i; tr_interrupt()
1898 if (!info->enabled || !info->uses_dma_out) tr_interrupt()
1901 if (ireg & info->irq) { tr_interrupt()
1904 DINTR2(DEBUG_LOG(info->line, "tr_interrupt %i\n", i)); tr_interrupt()
1908 info->last_tx_active_usec = GET_JIFFIES_USEC(); tr_interrupt()
1909 info->last_tx_active = jiffies; tr_interrupt()
1910 transmit_chars_dma(info); tr_interrupt()
1914 status lines and if so call status_handle(info) */ tr_interrupt()
1924 struct e100_serial *info; rec_interrupt() local
1934 info = rs_table + i; rec_interrupt()
1935 if (!info->enabled || !info->uses_dma_in) rec_interrupt()
1938 if (ireg & ((info->irq << 2) | (info->irq << 3))) { rec_interrupt()
1941 receive_chars_dma(info); rec_interrupt()
1945 status lines and if so call status_handle(info) */ rec_interrupt()
1950 static int force_eop_if_needed(struct e100_serial *info) force_eop_if_needed() argument
1955 unsigned char rstat = info->ioport[REG_STATUS]; force_eop_if_needed()
1964 DEBUG_LOG(info->line, "timeout err: rstat 0x%03X\n", force_eop_if_needed()
1965 rstat | (info->line << 8)); force_eop_if_needed()
1971 TIMERD(DEBUG_LOG(info->line, "timeout: rstat 0x%03X\n", force_eop_if_needed()
1972 rstat | (info->line << 8))); force_eop_if_needed()
1974 (void)info->ioport[REG_DATA]; force_eop_if_needed()
1976 info->forced_eop = 0; force_eop_if_needed()
1977 START_FLUSH_FAST_TIMER(info, "magic"); force_eop_if_needed()
1984 if (!info->forced_eop) { force_eop_if_needed()
1985 info->forced_eop = 1; force_eop_if_needed()
1986 TIMERD(DEBUG_LOG(info->line, "timeout EOP %i\n", info->line)); force_eop_if_needed()
1987 FORCE_EOP(info); force_eop_if_needed()
1993 static void flush_to_flip_buffer(struct e100_serial *info) flush_to_flip_buffer() argument
2000 while ((buffer = info->first_recv_buffer) != NULL) { flush_to_flip_buffer()
2003 tty_insert_flip_string(&info->port, buffer->buffer, count); flush_to_flip_buffer()
2004 info->recv_cnt -= count; flush_to_flip_buffer()
2007 info->first_recv_buffer = buffer->next; flush_to_flip_buffer()
2016 if (!info->first_recv_buffer) flush_to_flip_buffer()
2017 info->last_recv_buffer = NULL; flush_to_flip_buffer()
2022 tty_flip_buffer_push(&info->port); flush_to_flip_buffer()
2025 static void check_flush_timeout(struct e100_serial *info) check_flush_timeout() argument
2028 flush_to_flip_buffer(info); check_flush_timeout()
2032 if (info->first_recv_buffer) check_flush_timeout()
2033 START_FLUSH_FAST_TIMER_TIME(info, "flip", 2000); check_flush_timeout()
2039 force_eop_if_needed(info); check_flush_timeout()
2045 struct e100_serial *info = (struct e100_serial *)data; flush_timeout_function() local
2047 fast_timers[info->line].function = NULL; flush_timeout_function()
2049 TIMERD(DEBUG_LOG(info->line, "flush_timeout %i ", info->line)); flush_timeout_function()
2050 TIMERD(DEBUG_LOG(info->line, "num expired: %i\n", serial_fast_timer_expired)); flush_timeout_function()
2051 check_flush_timeout(info); flush_timeout_function()
2066 struct e100_serial *info; timed_flush_handler() local
2070 info = rs_table + i; timed_flush_handler()
2071 if (info->uses_dma_in) timed_flush_handler()
2072 check_flush_timeout(info); timed_flush_handler()
2110 we set info->errorcode = ERRCODE_INSERT_BREAK, but we can't really
2130 we set info->errorcode = ERRCODE_SET_BREAK so the receive interrupt
2133 and we set info->errorcode = ERRCODE_INSERT_BREAK.
2139 info->errorcode = ERRCODE_SET_BREAK.
2150 static void handle_ser_rx_interrupt_no_dma(struct e100_serial *info) handle_ser_rx_interrupt_no_dma() argument
2155 data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]); handle_ser_rx_interrupt_no_dma()
2158 DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); handle_ser_rx_interrupt_no_dma()
2160 DINTR2(DEBUG_LOG(info->line, "ser_rx %c\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read))); handle_ser_rx_interrupt_no_dma()
2166 info->last_rx_active_usec = GET_JIFFIES_USEC(); handle_ser_rx_interrupt_no_dma()
2167 info->last_rx_active = jiffies; handle_ser_rx_interrupt_no_dma()
2168 DINTR1(DEBUG_LOG(info->line, "ser_rx err stat_data %04X\n", data_read)); handle_ser_rx_interrupt_no_dma()
2183 if (!info->break_detected_cnt) { handle_ser_rx_interrupt_no_dma()
2184 DEBUG_LOG(info->line, "#BRK start\n", 0); handle_ser_rx_interrupt_no_dma()
2194 DEBUG_LOG(info->line, "# BL BRK\n", 0); handle_ser_rx_interrupt_no_dma()
2195 info->errorcode = ERRCODE_INSERT_BREAK; handle_ser_rx_interrupt_no_dma()
2197 info->break_detected_cnt++; handle_ser_rx_interrupt_no_dma()
2202 if (info->break_detected_cnt) { handle_ser_rx_interrupt_no_dma()
2203 DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); handle_ser_rx_interrupt_no_dma()
2204 info->errorcode = ERRCODE_INSERT_BREAK; handle_ser_rx_interrupt_no_dma()
2209 if (info->errorcode == ERRCODE_INSERT_BREAK) { handle_ser_rx_interrupt_no_dma()
2210 tty_insert_flip_char(&info->port, 0, flag); handle_ser_rx_interrupt_no_dma()
2211 info->icount.rx++; handle_ser_rx_interrupt_no_dma()
2215 info->icount.parity++; handle_ser_rx_interrupt_no_dma()
2218 info->icount.overrun++; handle_ser_rx_interrupt_no_dma()
2221 info->icount.frame++; handle_ser_rx_interrupt_no_dma()
2224 tty_insert_flip_char(&info->port, data, flag); handle_ser_rx_interrupt_no_dma()
2225 info->errorcode = 0; handle_ser_rx_interrupt_no_dma()
2227 info->break_detected_cnt = 0; handle_ser_rx_interrupt_no_dma()
2240 tty_insert_flip_char(&info->port, handle_ser_rx_interrupt_no_dma()
2244 DEBUG_LOG(info->line, "ser_rx int but no data_avail %08lX\n", data_read); handle_ser_rx_interrupt_no_dma()
2248 info->icount.rx++; handle_ser_rx_interrupt_no_dma()
2249 data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]); handle_ser_rx_interrupt_no_dma()
2251 DEBUG_LOG(info->line, "ser_rx %c in loop\n", IO_EXTRACT(R_SERIAL0_READ, data_in, data_read)); handle_ser_rx_interrupt_no_dma()
2255 tty_flip_buffer_push(&info->port); handle_ser_rx_interrupt_no_dma()
2258 static void handle_ser_rx_interrupt(struct e100_serial *info) handle_ser_rx_interrupt() argument
2265 /* DEBUG_LOG(info->line, "ser_interrupt stat %03X\n", rstat | (i << 8)); */ handle_ser_rx_interrupt()
2266 if (!info->uses_dma_in) { handle_ser_rx_interrupt()
2267 handle_ser_rx_interrupt_no_dma(info); handle_ser_rx_interrupt()
2271 rstat = info->ioport[REG_STATUS]; handle_ser_rx_interrupt()
2273 DFLOW(DEBUG_LOG(info->line, "XOFF detect\n", 0)); handle_ser_rx_interrupt()
2279 info->last_rx_active_usec = GET_JIFFIES_USEC(); handle_ser_rx_interrupt()
2280 info->last_rx_active = jiffies; handle_ser_rx_interrupt()
2284 data = info->ioport[REG_DATA]; handle_ser_rx_interrupt()
2285 DINTR1(DEBUG_LOG(info->line, "ser_rx! %c\n", data)); handle_ser_rx_interrupt()
2286 DINTR1(DEBUG_LOG(info->line, "ser_rx err stat %02X\n", rstat)); handle_ser_rx_interrupt()
2292 if (!info->break_detected_cnt) { handle_ser_rx_interrupt()
2293 DEBUG_LOG(info->line, "#BRK start\n", 0); handle_ser_rx_interrupt()
2303 DEBUG_LOG(info->line, "# BL BRK\n", 0); handle_ser_rx_interrupt()
2304 info->errorcode = ERRCODE_INSERT_BREAK; handle_ser_rx_interrupt()
2306 info->break_detected_cnt++; handle_ser_rx_interrupt()
2311 if (info->break_detected_cnt) { handle_ser_rx_interrupt()
2312 DEBUG_LOG(info->line, "EBRK %i\n", info->break_detected_cnt); handle_ser_rx_interrupt()
2313 info->errorcode = ERRCODE_INSERT_BREAK; handle_ser_rx_interrupt()
2315 if (info->errorcode == ERRCODE_INSERT_BREAK) { handle_ser_rx_interrupt()
2316 info->icount.brk++; handle_ser_rx_interrupt()
2317 add_char_and_flag(info, '\0', TTY_BREAK); handle_ser_rx_interrupt()
2321 info->icount.parity++; handle_ser_rx_interrupt()
2322 add_char_and_flag(info, data, TTY_PARITY); handle_ser_rx_interrupt()
2324 info->icount.overrun++; handle_ser_rx_interrupt()
2325 add_char_and_flag(info, data, TTY_OVERRUN); handle_ser_rx_interrupt()
2327 info->icount.frame++; handle_ser_rx_interrupt()
2328 add_char_and_flag(info, data, TTY_FRAME); handle_ser_rx_interrupt()
2331 info->errorcode = 0; handle_ser_rx_interrupt()
2333 info->break_detected_cnt = 0; handle_ser_rx_interrupt()
2334 DEBUG_LOG(info->line, "#iERR s d %04X\n", handle_ser_rx_interrupt()
2341 if (info->break_detected_cnt) { handle_ser_rx_interrupt()
2348 (curr_time - info->last_rx_active) * (1000000/HZ) + handle_ser_rx_interrupt()
2349 curr_time_u - info->last_rx_active_usec; handle_ser_rx_interrupt()
2350 if (elapsed_usec < 2*info->char_time_usec) { handle_ser_rx_interrupt()
2351 DEBUG_LOG(info->line, "FBRK %i\n", info->line); handle_ser_rx_interrupt()
2355 info->errorcode = ERRCODE_SET_BREAK; handle_ser_rx_interrupt()
2357 DEBUG_LOG(info->line, "Not end of BRK (V)%i\n", info->line); handle_ser_rx_interrupt()
2359 DEBUG_LOG(info->line, "num brk %i\n", info->break_detected_cnt); handle_ser_rx_interrupt()
2365 e100_disable_serial_data_irq(info); handle_ser_rx_interrupt()
2366 DINTR2(DEBUG_LOG(info->line, "ser_rx OK %d\n", info->line)); handle_ser_rx_interrupt()
2367 info->break_detected_cnt = 0; handle_ser_rx_interrupt()
2371 *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, restart); handle_ser_rx_interrupt()
2372 START_FLUSH_FAST_TIMER(info, "ser_int"); handle_ser_rx_interrupt()
2375 static void handle_ser_tx_interrupt(struct e100_serial *info) handle_ser_tx_interrupt() argument
2379 if (info->x_char) { handle_ser_tx_interrupt()
2381 DFLOW(DEBUG_LOG(info->line, "tx_int: xchar 0x%02X\n", info->x_char)); handle_ser_tx_interrupt()
2383 rstat = info->ioport[REG_STATUS]; handle_ser_tx_interrupt()
2384 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); handle_ser_tx_interrupt()
2386 info->ioport[REG_TR_DATA] = info->x_char; handle_ser_tx_interrupt()
2387 info->icount.tx++; handle_ser_tx_interrupt()
2388 info->x_char = 0; handle_ser_tx_interrupt()
2390 e100_enable_serial_tx_ready_irq(info); handle_ser_tx_interrupt()
2394 if (info->uses_dma_out) { handle_ser_tx_interrupt()
2398 DFLOW(DEBUG_LOG(info->line, "tx_int: xchar sent\n", 0)); handle_ser_tx_interrupt()
2400 rstat = info->ioport[REG_STATUS]; handle_ser_tx_interrupt()
2401 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); handle_ser_tx_interrupt()
2402 e100_disable_serial_tx_ready_irq(info); handle_ser_tx_interrupt()
2403 if (info->port.tty->stopped) handle_ser_tx_interrupt()
2404 rs_stop(info->port.tty); handle_ser_tx_interrupt()
2406 e100_enable_txdma_channel(info); handle_ser_tx_interrupt()
2411 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, continue); handle_ser_tx_interrupt()
2416 if (info->xmit.head == info->xmit.tail handle_ser_tx_interrupt()
2417 || info->port.tty->stopped) { handle_ser_tx_interrupt()
2418 DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", handle_ser_tx_interrupt()
2419 info->port.tty->stopped)); handle_ser_tx_interrupt()
2420 e100_disable_serial_tx_ready_irq(info); handle_ser_tx_interrupt()
2421 info->tr_running = 0; handle_ser_tx_interrupt()
2424 DINTR2(DEBUG_LOG(info->line, "tx_int %c\n", info->xmit.buf[info->xmit.tail])); handle_ser_tx_interrupt()
2427 info->ioport[REG_TR_DATA] = info->xmit.buf[info->xmit.tail]; handle_ser_tx_interrupt()
2428 info->xmit.tail = (info->xmit.tail + 1) & (SERIAL_XMIT_SIZE-1); handle_ser_tx_interrupt()
2429 info->icount.tx++; handle_ser_tx_interrupt()
2430 if (info->xmit.head == info->xmit.tail) { handle_ser_tx_interrupt()
2432 if (info->rs485.flags & SER_RS485_ENABLED) { handle_ser_tx_interrupt()
2434 start_one_shot_timer(&fast_timers_rs485[info->line], handle_ser_tx_interrupt()
2436 (unsigned long)info, handle_ser_tx_interrupt()
2437 info->char_time_usec*2, handle_ser_tx_interrupt()
2441 info->last_tx_active_usec = GET_JIFFIES_USEC(); handle_ser_tx_interrupt()
2442 info->last_tx_active = jiffies; handle_ser_tx_interrupt()
2443 e100_disable_serial_tx_ready_irq(info); handle_ser_tx_interrupt()
2444 info->tr_running = 0; handle_ser_tx_interrupt()
2445 DFLOW(DEBUG_LOG(info->line, "tx_int: stop2\n", 0)); handle_ser_tx_interrupt()
2448 e100_enable_serial_tx_ready_irq(info); handle_ser_tx_interrupt()
2452 if (CIRC_CNT(info->xmit.head, handle_ser_tx_interrupt()
2453 info->xmit.tail, handle_ser_tx_interrupt()
2455 rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); handle_ser_tx_interrupt()
2467 struct e100_serial *info; ser_interrupt() local
2478 info = rs_table; ser_interrupt()
2484 handle_ser_rx_interrupt(info); ser_interrupt()
2486 info += 1; ser_interrupt()
2522 info = rs_table; ser_interrupt()
2527 handle_ser_tx_interrupt(info); ser_interrupt()
2529 info += 1; ser_interrupt()
2576 struct e100_serial *info; do_softint() local
2579 info = container_of(work, struct e100_serial, work); do_softint()
2581 tty = info->port.tty; do_softint()
2585 if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) do_softint()
2590 startup(struct e100_serial * info) startup() argument
2604 if (info->port.flags & ASYNC_INITIALIZED) { startup()
2610 if (info->xmit.buf) startup()
2613 info->xmit.buf = (unsigned char *) xmit_page; startup()
2616 printk("starting up ttyS%d (xmit_buf 0x%p)...\n", info->line, info->xmit.buf); startup()
2628 if (info->dma_in_enabled) { startup()
2629 info->uses_dma_in = 1; startup()
2630 e100_enable_rxdma_channel(info); startup()
2632 *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); startup()
2635 while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->icmdadr) == startup()
2639 *info->iclrintradr = startup()
2643 e100_disable_rxdma_channel(info); startup()
2646 if (info->dma_out_enabled) { startup()
2647 info->uses_dma_out = 1; startup()
2648 e100_enable_txdma_channel(info); startup()
2649 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); startup()
2651 while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) == startup()
2655 *info->oclrintradr = startup()
2659 e100_disable_txdma_channel(info); startup()
2662 if (info->port.tty) startup()
2663 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); startup()
2665 info->xmit.head = info->xmit.tail = 0; startup()
2666 info->first_recv_buffer = info->last_recv_buffer = NULL; startup()
2667 info->recv_cnt = info->max_recv_cnt = 0; startup()
2670 info->rec_descr[i].buf = 0; startup()
2677 e100_enable_serial_data_irq(info); startup()
2679 change_speed(info); startup()
2683 (void)info->ioport[REG_DATA]; startup()
2686 if (info->uses_dma_out) startup()
2687 e100_enable_txdma_irq(info); startup()
2689 e100_enable_rx_irq(info); startup()
2691 info->tr_running = 0; /* to be sure we don't lock up the transmitter */ startup()
2695 start_receive(info); startup()
2699 info->tr_descr.sw_len = 0; startup()
2700 info->tr_descr.hw_len = 0; startup()
2701 info->tr_descr.status = 0; startup()
2705 e100_rts(info, 1); startup()
2706 e100_dtr(info, 1); startup()
2708 info->port.flags |= ASYNC_INITIALIZED; startup()
2719 shutdown(struct e100_serial * info) shutdown() argument
2722 struct etrax_dma_descr *descr = info->rec_descr; shutdown()
2727 DFLOW(DEBUG_LOG(info->line, "shutdown %i\n", info->line)); shutdown()
2728 e100_disable_rx(info); shutdown()
2729 info->ioport[REG_TR_CTRL] = (info->tx_ctrl &= ~0x40); shutdown()
2732 if (info->uses_dma_in) { shutdown()
2733 e100_disable_rxdma_irq(info); shutdown()
2734 *info->icmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); shutdown()
2735 info->uses_dma_in = 0; shutdown()
2737 e100_disable_serial_data_irq(info); shutdown()
2740 if (info->uses_dma_out) { shutdown()
2741 e100_disable_txdma_irq(info); shutdown()
2742 info->tr_running = 0; shutdown()
2743 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, reset); shutdown()
2744 info->uses_dma_out = 0; shutdown()
2746 e100_disable_serial_tx_ready_irq(info); shutdown()
2747 info->tr_running = 0; shutdown()
2750 if (!(info->port.flags & ASYNC_INITIALIZED)) shutdown()
2754 printk("Shutting down serial port %d (irq %d)....\n", info->line, shutdown()
2755 info->irq); shutdown()
2760 if (info->xmit.buf) { shutdown()
2761 free_page((unsigned long)info->xmit.buf); shutdown()
2762 info->xmit.buf = NULL; shutdown()
2772 if (!info->port.tty || (info->port.tty->termios.c_cflag & HUPCL)) { shutdown()
2774 e100_dtr(info, 0); shutdown()
2775 e100_rts(info, 0); /* could check CRTSCTS before doing this */ shutdown()
2778 if (info->port.tty) shutdown()
2779 set_bit(TTY_IO_ERROR, &info->port.tty->flags); shutdown()
2781 info->port.flags &= ~ASYNC_INITIALIZED; shutdown()
2789 change_speed(struct e100_serial *info) change_speed() argument
2796 if (!info->port.tty) change_speed()
2798 if (!info->ioport) change_speed()
2801 cflag = info->port.tty->termios.c_cflag; change_speed()
2806 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) { change_speed()
2808 u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */ change_speed()
2814 (unsigned long)info->baud_base, info->custom_divisor)); change_speed()
2815 if (info->baud_base == SERIAL_PRESCALE_BASE) { change_speed()
2817 u16 divisor = info->custom_divisor; change_speed()
2826 info->baud = SERIAL_PRESCALE_BASE/divisor; change_speed()
2834 (unsigned long)info->baud_base, info->custom_divisor); change_speed()
2837 r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8)); change_speed()
2842 u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */ change_speed()
2847 r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8)); change_speed()
2850 info->baud = cflag_to_baud(cflag); change_speed()
2851 info->ioport[REG_BAUD] = cflag_to_etrax_baud(cflag); change_speed()
2857 info->rx_ctrl &= ~(IO_MASK(R_SERIAL0_REC_CTRL, rec_bitnr) | change_speed()
2862 info->tx_ctrl &= ~(IO_MASK(R_SERIAL0_TR_CTRL, tr_bitnr) | change_speed()
2870 info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit); change_speed()
2871 info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit); change_speed()
2876 info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, stop_bits, two_bits); change_speed()
2881 info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable); change_speed()
2882 info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable); change_speed()
2887 info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_stick_par, stick); change_speed()
2888 info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, stick); change_speed()
2892 info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_par, odd); change_speed()
2893 info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd); change_speed()
2898 DFLOW(DEBUG_LOG(info->line, "FLOW auto_cts enabled\n", 0)); change_speed()
2899 info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, active); change_speed()
2904 info->tx_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_enable, enable); change_speed()
2905 info->rx_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable); change_speed()
2909 info->ioport[REG_TR_CTRL] = info->tx_ctrl; change_speed()
2910 info->ioport[REG_REC_CTRL] = info->rx_ctrl; change_speed()
2911 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty)); change_speed()
2913 if (info->port.tty->termios.c_iflag & IXON ) { change_speed()
2914 DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", change_speed()
2915 STOP_CHAR(info->port.tty))); change_speed()
2919 *((unsigned long *)&info->ioport[REG_XOFF]) = xoff; change_speed()
2922 update_char_time(info); change_speed()
2931 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_flush_chars() local
2934 if (info->tr_running || rs_flush_chars()
2935 info->xmit.head == info->xmit.tail || rs_flush_chars()
2937 !info->xmit.buf) rs_flush_chars()
2947 start_transmit(info); rs_flush_chars()
2955 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_raw_write() local
2960 if (!info->xmit.buf) rs_raw_write()
2964 if (info->line == SERIAL_DEBUG_LINE) rs_raw_write()
2966 count, info->ioport[REG_STATUS]); rs_raw_write()
2970 DFLOW(DEBUG_LOG(info->line, "write count %i ", count)); rs_raw_write()
2971 DFLOW(DEBUG_LOG(info->line, "ldisc %i\n", tty->ldisc.chars_in_buffer(tty))); rs_raw_write()
2975 * because the DMA interrupt handler moves the info->xmit values. rs_raw_write()
2983 c = CIRC_SPACE_TO_END(info->xmit.head, rs_raw_write()
2984 info->xmit.tail, rs_raw_write()
2992 memcpy(info->xmit.buf + info->xmit.head, buf, c); rs_raw_write()
2993 info->xmit.head = (info->xmit.head + c) & rs_raw_write()
3005 DFLOW(DEBUG_LOG(info->line, "write ret %i\n", ret)); rs_raw_write()
3007 if (info->xmit.head != info->xmit.tail && rs_raw_write()
3009 !info->tr_running) { rs_raw_write()
3010 start_transmit(info); rs_raw_write()
3021 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_write() local
3023 if (info->rs485.flags & SER_RS485_ENABLED) rs_write()
3030 fast_timers_rs485[info->line].function = NULL; rs_write()
3031 del_fast_timer(&fast_timers_rs485[info->line]); rs_write()
3033 e100_rts(info, (info->rs485.flags & SER_RS485_RTS_ON_SEND)); rs_write()
3035 e100_disable_rx(info); rs_write()
3036 e100_enable_rx_irq(info); rs_write()
3038 if (info->rs485.delay_rts_before_send > 0) rs_write()
3039 msleep(info->rs485.delay_rts_before_send); rs_write()
3046 if (info->rs485.flags & SER_RS485_ENABLED) rs_write()
3060 schedule_usleep(info->char_time_usec * 2); rs_write()
3064 get_lsr_info(info, &val); rs_write()
3067 e100_rts(info, (info->rs485.flags & SER_RS485_RTS_AFTER_SEND)); rs_write()
3070 e100_enable_rx(info); rs_write()
3071 e100_enable_rxdma_irq(info); rs_write()
3085 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_write_room() local
3087 return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); rs_write_room()
3098 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_chars_in_buffer() local
3100 return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); rs_chars_in_buffer()
3108 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_flush_buffer() local
3112 info->xmit.head = info->xmit.tail = 0; rs_flush_buffer()
3122 * Since we use DMA we don't check for info->x_char in transmit_chars_dma(),
3129 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_send_xchar() local
3132 if (info->uses_dma_out) { rs_send_xchar()
3134 *info->ocmdadr = IO_STATE(R_DMA_CH6_CMD, cmd, hold); rs_send_xchar()
3135 while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *info->ocmdadr) != rs_send_xchar()
3137 e100_disable_txdma_channel(info); rs_send_xchar()
3145 DFLOW(DEBUG_LOG(info->line, "rs_send_xchar 0x%02X\n", ch)); rs_send_xchar()
3146 info->x_char = ch; rs_send_xchar()
3147 e100_enable_serial_tx_ready_irq(info); rs_send_xchar()
3162 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_throttle() local
3167 DFLOW(DEBUG_LOG(info->line,"rs_throttle %lu\n", tty->ldisc.chars_in_buffer(tty))); rs_throttle()
3172 e100_rts(info, 0); rs_throttle()
3182 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_unthrottle() local
3187 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle ldisc %d\n", tty->ldisc.chars_in_buffer(tty))); rs_unthrottle()
3188 DFLOW(DEBUG_LOG(info->line,"rs_unthrottle flip.count: %i\n", tty->flip.count)); rs_unthrottle()
3192 e100_rts(info, 1); rs_unthrottle()
3196 if (info->x_char) rs_unthrottle()
3197 info->x_char = 0; rs_unthrottle()
3211 get_serial_info(struct e100_serial * info, get_serial_info() argument
3224 tmp.type = info->type; get_serial_info()
3225 tmp.line = info->line; get_serial_info()
3226 tmp.port = (int)info->ioport; get_serial_info()
3227 tmp.irq = info->irq; get_serial_info()
3228 tmp.flags = info->port.flags; get_serial_info()
3229 tmp.baud_base = info->baud_base; get_serial_info()
3230 tmp.close_delay = info->port.close_delay; get_serial_info()
3231 tmp.closing_wait = info->port.closing_wait; get_serial_info()
3232 tmp.custom_divisor = info->custom_divisor; get_serial_info()
3239 set_serial_info(struct e100_serial *info, set_serial_info() argument
3249 old_info = *info; set_serial_info()
3252 if ((new_serial.type != info->type) || set_serial_info()
3253 (new_serial.close_delay != info->port.close_delay) || set_serial_info()
3255 (info->port.flags & ~ASYNC_USR_MASK))) set_serial_info()
3257 info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | set_serial_info()
3262 if (info->port.count > 1) set_serial_info()
3270 info->baud_base = new_serial.baud_base; set_serial_info()
3271 info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) | set_serial_info()
3273 info->custom_divisor = new_serial.custom_divisor; set_serial_info()
3274 info->type = new_serial.type; set_serial_info()
3275 info->port.close_delay = new_serial.close_delay; set_serial_info()
3276 info->port.closing_wait = new_serial.closing_wait; set_serial_info()
3277 info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; set_serial_info()
3280 if (info->port.flags & ASYNC_INITIALIZED) { set_serial_info()
3281 change_speed(info); set_serial_info()
3283 retval = startup(info); set_serial_info()
3288 * get_lsr_info - get line status register info
3290 * Purpose: Let user call ioctl() to get info when the UART physically
3298 get_lsr_info(struct e100_serial * info, unsigned int *value) get_lsr_info() argument
3304 (curr_time - info->last_tx_active) * 1000000/HZ + get_lsr_info()
3305 curr_time_usec - info->last_tx_active_usec; get_lsr_info()
3307 if (info->xmit.head != info->xmit.tail || get_lsr_info()
3308 elapsed_usec < 2*info->char_time_usec) { get_lsr_info()
3357 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_break() local
3360 if (!info->ioport) rs_break()
3367 info->tx_ctrl &= 0x3F; rs_break()
3370 info->tx_ctrl |= (0x80 | 0x40); rs_break()
3372 info->ioport[REG_TR_CTRL] = info->tx_ctrl; rs_break()
3380 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_tiocmset() local
3386 e100_rts(info, 0); rs_tiocmset()
3388 e100_dtr(info, 0); rs_tiocmset()
3391 e100_ri_out(info, 0); rs_tiocmset()
3393 e100_cd_out(info, 0); rs_tiocmset()
3396 e100_rts(info, 1); rs_tiocmset()
3398 e100_dtr(info, 1); rs_tiocmset()
3401 e100_ri_out(info, 1); rs_tiocmset()
3403 e100_cd_out(info, 1); rs_tiocmset()
3412 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_tiocmget() local
3419 (!E100_RTS_GET(info) ? TIOCM_RTS : 0) rs_tiocmget()
3420 | (!E100_DTR_GET(info) ? TIOCM_DTR : 0) rs_tiocmget()
3421 | (!E100_RI_GET(info) ? TIOCM_RNG : 0) rs_tiocmget()
3422 | (!E100_DSR_GET(info) ? TIOCM_DSR : 0) rs_tiocmget()
3423 | (!E100_CD_GET(info) ? TIOCM_CAR : 0) rs_tiocmget()
3424 | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); rs_tiocmget()
3430 info->line, result, result); rs_tiocmget()
3447 struct e100_serial * info = (struct e100_serial *)tty->driver_data; rs_ioctl() local
3458 return get_serial_info(info, rs_ioctl()
3461 return set_serial_info(info, rs_ioctl()
3464 return get_lsr_info(info, (unsigned int *) arg); rs_ioctl()
3468 info, sizeof(struct e100_serial))) rs_ioctl()
3553 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_set_termios() local
3555 change_speed(info); rs_set_termios()
3577 struct e100_serial * info = (struct e100_serial *)tty->driver_data; rs_close() local
3580 if (!info) rs_close()
3594 info->line, info->count); rs_close()
3596 if ((tty->count == 1) && (info->port.count != 1)) { rs_close()
3606 "info->count is %d\n", info->port.count); rs_close()
3607 info->port.count = 1; rs_close()
3609 if (--info->port.count < 0) { rs_close()
3611 info->line, info->port.count); rs_close()
3612 info->port.count = 0; rs_close()
3614 if (info->port.count) { rs_close()
3618 info->port.flags |= ASYNC_CLOSING; rs_close()
3624 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) rs_close()
3625 tty_wait_until_sent(tty, info->port.closing_wait); rs_close()
3631 e100_disable_serial_data_irq(info); rs_close()
3634 e100_disable_rx(info); rs_close()
3635 e100_disable_rx_irq(info); rs_close()
3637 if (info->port.flags & ASYNC_INITIALIZED) { rs_close()
3646 shutdown(info); rs_close()
3650 info->event = 0; rs_close()
3651 info->port.tty = NULL; rs_close()
3652 if (info->port.blocked_open) { rs_close()
3653 if (info->port.close_delay) rs_close()
3654 schedule_timeout_interruptible(info->port.close_delay); rs_close()
3655 wake_up_interruptible(&info->port.open_wait); rs_close()
3657 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); rs_close()
3663 if (info->rs485.flags & SER_RS485_ENABLED) { rs_close()
3664 info->rs485.flags &= ~(SER_RS485_ENABLED); rs_close()
3674 if (info->dma_in_enabled) { rs_close()
3675 free_irq(info->dma_in_irq_nbr, info); rs_close()
3676 cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description); rs_close()
3677 info->uses_dma_in = 0; rs_close()
3680 info->dma_in_irq_description); rs_close()
3683 if (info->dma_out_enabled) { rs_close()
3684 free_irq(info->dma_out_irq_nbr, info); rs_close()
3685 cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description); rs_close()
3686 info->uses_dma_out = 0; rs_close()
3689 info->dma_out_irq_description); rs_close()
3700 struct e100_serial *info = (struct e100_serial *)tty->driver_data; rs_wait_until_sent() local
3704 (curr_time - info->last_tx_active) * (1000000/HZ) + rs_wait_until_sent()
3705 curr_time_usec - info->last_tx_active_usec; rs_wait_until_sent()
3712 while (info->xmit.head != info->xmit.tail || /* More in send queue */ rs_wait_until_sent()
3713 (*info->ostatusadr & 0x007f) || /* more in FIFO */ rs_wait_until_sent()
3714 (elapsed_usec < 2*info->char_time_usec)) { rs_wait_until_sent()
3723 (curr_time - info->last_tx_active) * (1000000/HZ) + rs_wait_until_sent()
3724 curr_time_usec - info->last_tx_active_usec; rs_wait_until_sent()
3735 struct e100_serial * info = (struct e100_serial *)tty->driver_data; rs_hangup() local
3738 shutdown(info); rs_hangup()
3739 info->event = 0; rs_hangup()
3740 info->port.count = 0; rs_hangup()
3741 info->port.flags &= ~ASYNC_NORMAL_ACTIVE; rs_hangup()
3742 info->port.tty = NULL; rs_hangup()
3743 wake_up_interruptible(&info->port.open_wait); rs_hangup()
3753 struct e100_serial *info) block_til_ready()
3766 info->port.flags |= ASYNC_NORMAL_ACTIVE; block_til_ready()
3777 * this loop, info->port.count is dropped by one, so that block_til_ready()
3782 add_wait_queue(&info->port.open_wait, &wait); block_til_ready()
3785 info->line, info->port.count); block_til_ready()
3788 info->port.count--; block_til_ready()
3790 info->port.blocked_open++; block_til_ready()
3794 e100_rts(info, 1); block_til_ready()
3795 e100_dtr(info, 1); block_til_ready()
3799 !(info->port.flags & ASYNC_INITIALIZED)) { block_til_ready()
3801 if (info->port.flags & ASYNC_HUP_NOTIFY) block_til_ready()
3819 info->line, info->port.count); block_til_ready()
3826 remove_wait_queue(&info->port.open_wait, &wait); block_til_ready()
3828 info->port.count++; block_til_ready()
3829 info->port.blocked_open--; block_til_ready()
3832 info->line, info->port.count); block_til_ready()
3836 info->port.flags |= ASYNC_NORMAL_ACTIVE; block_til_ready()
3841 deinit_port(struct e100_serial *info) deinit_port() argument
3843 if (info->dma_out_enabled) { deinit_port()
3844 cris_free_dma(info->dma_out_nbr, info->dma_out_irq_description); deinit_port()
3845 free_irq(info->dma_out_irq_nbr, info); deinit_port()
3847 if (info->dma_in_enabled) { deinit_port()
3848 cris_free_dma(info->dma_in_nbr, info->dma_in_irq_description); deinit_port()
3849 free_irq(info->dma_in_irq_nbr, info); deinit_port()
3860 struct e100_serial *info; rs_open() local
3864 info = rs_table + tty->index; rs_open()
3865 if (!info->enabled) rs_open()
3870 info->port.count); rs_open()
3873 info->port.count++; rs_open()
3874 tty->driver_data = info; rs_open()
3875 info->port.tty = tty; rs_open()
3877 info->port.low_latency = !!(info->port.flags & ASYNC_LOW_LATENCY); rs_open()
3882 if (info->port.count == 1) { rs_open()
3884 if (info->dma_in_enabled) { rs_open()
3885 if (request_irq(info->dma_in_irq_nbr, rs_open()
3887 info->dma_in_irq_flags, rs_open()
3888 info->dma_in_irq_description, rs_open()
3889 info)) { rs_open()
3892 info->dma_in_irq_description); rs_open()
3895 info->dma_in_enabled = 0; rs_open()
3896 } else if (cris_request_dma(info->dma_in_nbr, rs_open()
3897 info->dma_in_irq_description, rs_open()
3899 info->dma_owner)) { rs_open()
3900 free_irq(info->dma_in_irq_nbr, info); rs_open()
3903 info->dma_in_irq_description); rs_open()
3906 info->dma_in_enabled = 0; rs_open()
3911 info->dma_in_irq_description); rs_open()
3914 if (info->dma_out_enabled) { rs_open()
3915 if (request_irq(info->dma_out_irq_nbr, rs_open()
3917 info->dma_out_irq_flags, rs_open()
3918 info->dma_out_irq_description, rs_open()
3919 info)) { rs_open()
3922 info->dma_out_irq_description); rs_open()
3925 info->dma_out_enabled = 0; rs_open()
3926 } else if (cris_request_dma(info->dma_out_nbr, rs_open()
3927 info->dma_out_irq_description, rs_open()
3929 info->dma_owner)) { rs_open()
3930 free_irq(info->dma_out_irq_nbr, info); rs_open()
3933 info->dma_out_irq_description); rs_open()
3936 info->dma_out_enabled = 0; rs_open()
3941 info->dma_out_irq_description); rs_open()
3950 retval = startup(info); rs_open()
3953 deinit_port(info); rs_open()
3955 /* FIXME Decrease count info->port.count here too? */ rs_open()
3960 retval = block_til_ready(tty, filp, info); rs_open()
3967 deinit_port(info); rs_open()
3973 printk("rs_open ttyS%d successful...\n", info->line); rs_open()
3977 DFLIP( if (info->line == SERIAL_DEBUG_LINE) { rs_open()
3978 info->icount.rx = 0; rs_open()
3989 static void seq_line_info(struct seq_file *m, struct e100_serial *info) seq_line_info() argument
3994 info->line, (unsigned long)info->ioport, info->irq); seq_line_info()
3996 if (!info->ioport || (info->type == PORT_UNKNOWN)) { seq_line_info()
4001 seq_printf(m, " baud:%d", info->baud); seq_line_info()
4003 (unsigned long)info->icount.tx, seq_line_info()
4004 (unsigned long)info->icount.rx); seq_line_info()
4005 tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); seq_line_info()
4012 (unsigned long)info->recv_cnt, seq_line_info()
4013 (unsigned long)info->max_recv_cnt); seq_line_info()
4016 if (info->port.tty) { seq_line_info()
4017 if (info->port.tty->stopped) seq_line_info()
4019 (int)info->port.tty->stopped); seq_line_info()
4023 unsigned char rstat = info->ioport[REG_STATUS]; seq_line_info()
4030 if (info->icount.frame) seq_line_info()
4031 seq_printf(m, " fe:%lu", (unsigned long)info->icount.frame); seq_line_info()
4033 if (info->icount.parity) seq_line_info()
4034 seq_printf(m, " pe:%lu", (unsigned long)info->icount.parity); seq_line_info()
4036 if (info->icount.brk) seq_line_info()
4037 seq_printf(m, " brk:%lu", (unsigned long)info->icount.brk); seq_line_info()
4039 if (info->icount.overrun) seq_line_info()
4040 seq_printf(m, " oe:%lu", (unsigned long)info->icount.overrun); seq_line_info()
4045 if (!E100_RTS_GET(info)) seq_line_info()
4047 if (!E100_CTS_GET(info)) seq_line_info()
4049 if (!E100_DTR_GET(info)) seq_line_info()
4051 if (!E100_DSR_GET(info)) seq_line_info()
4053 if (!E100_CD_GET(info)) seq_line_info()
4055 if (!E100_RI_GET(info)) seq_line_info()
4140 struct e100_serial *info; rs_init() local
4186 for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { rs_init()
4187 if (info->enabled) { rs_init()
4188 if (cris_request_io_interface(info->io_if, rs_init()
4189 info->io_if_description)) { rs_init()
4193 info->io_if_description, i); rs_init()
4194 info->enabled = 0; rs_init()
4197 tty_port_init(&info->port); rs_init()
4198 info->uses_dma_in = 0; rs_init()
4199 info->uses_dma_out = 0; rs_init()
4200 info->line = i; rs_init()
4201 info->port.tty = NULL; rs_init()
4202 info->type = PORT_ETRAX; rs_init()
4203 info->tr_running = 0; rs_init()
4204 info->forced_eop = 0; rs_init()
4205 info->baud_base = DEF_BAUD_BASE; rs_init()
4206 info->custom_divisor = 0; rs_init()
4207 info->x_char = 0; rs_init()
4208 info->event = 0; rs_init()
4209 info->xmit.buf = NULL; rs_init()
4210 info->xmit.tail = info->xmit.head = 0; rs_init()
4211 info->first_recv_buffer = info->last_recv_buffer = NULL; rs_init()
4212 info->recv_cnt = info->max_recv_cnt = 0; rs_init()
4213 info->last_tx_active_usec = 0; rs_init()
4214 info->last_tx_active = 0; rs_init()
4218 info->rs485.flags &= ~(SER_RS485_RTS_ON_SEND); rs_init()
4219 info->rs485.flags |= SER_RS485_RTS_AFTER_SEND; rs_init()
4220 info->rs485.delay_rts_before_send = 0; rs_init()
4221 info->rs485.flags &= ~(SER_RS485_ENABLED); rs_init()
4223 INIT_WORK(&info->work, do_softint); rs_init()
4225 if (info->enabled) { rs_init()
4227 serial_driver->name, info->line, info->ioport); rs_init()
4229 tty_port_link_device(&info->port, driver, i); rs_init()
3752 block_til_ready(struct tty_struct *tty, struct file * filp, struct e100_serial *info) block_til_ready() argument
H A D68328serial.c141 static void change_speed(struct m68k_serial *info, struct tty_struct *tty);
165 static inline int serial_paranoia_check(struct m68k_serial *info, serial_paranoia_check() argument
174 if (!info) { serial_paranoia_check()
178 if (info->magic != SERIAL_MAGIC) { serial_paranoia_check()
214 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_stop() local
215 m68328_uart *uart = &uart_addr[info->line]; rs_stop()
218 if (serial_paranoia_check(info, tty->name, "rs_stop")) rs_stop()
246 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_start() local
247 m68328_uart *uart = &uart_addr[info->line]; rs_start()
250 if (serial_paranoia_check(info, tty->name, "rs_start")) rs_start()
254 if (info->xmit_cnt && info->xmit_buf && !(uart->ustcnt & USTCNT_TXEN)) { rs_start()
264 static void receive_chars(struct m68k_serial *info, unsigned short rx) receive_chars() argument
266 m68328_uart *uart = &uart_addr[info->line]; receive_chars()
277 if(info->is_cons) { receive_chars()
303 tty_insert_flip_char(&info->tport, ch, flag); receive_chars()
308 tty_schedule_flip(&info->tport); receive_chars()
311 static void transmit_chars(struct m68k_serial *info, struct tty_struct *tty) transmit_chars() argument
313 m68328_uart *uart = &uart_addr[info->line]; transmit_chars()
315 if (info->x_char) { transmit_chars()
317 uart->utx.b.txdata = info->x_char; transmit_chars()
318 info->x_char = 0; transmit_chars()
322 if ((info->xmit_cnt <= 0) || !tty || tty->stopped) { transmit_chars()
329 uart->utx.b.txdata = info->xmit_buf[info->xmit_tail++]; transmit_chars()
330 info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); transmit_chars()
331 info->xmit_cnt--; transmit_chars()
333 if(info->xmit_cnt <= 0) { transmit_chars()
349 struct m68k_serial *info = dev_id; rs_interrupt() local
350 struct tty_struct *tty = tty_port_tty_get(&info->tport); rs_interrupt()
355 uart = &uart_addr[info->line]; rs_interrupt()
362 receive_chars(info, rx); rs_interrupt()
364 transmit_chars(info, tty); rs_interrupt()
366 receive_chars(info, rx); rs_interrupt()
373 static int startup(struct m68k_serial *info, struct tty_struct *tty) startup() argument
375 m68328_uart *uart = &uart_addr[info->line]; startup()
378 if (info->tport.flags & ASYNC_INITIALIZED) startup()
381 if (!info->xmit_buf) { startup()
382 info->xmit_buf = (unsigned char *) __get_free_page(GFP_KERNEL); startup()
383 if (!info->xmit_buf) startup()
410 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; startup()
416 change_speed(info, tty); startup()
418 info->tport.flags |= ASYNC_INITIALIZED; startup()
427 static void shutdown(struct m68k_serial *info, struct tty_struct *tty) shutdown() argument
429 m68328_uart *uart = &uart_addr[info->line]; shutdown()
433 if (!(info->tport.flags & ASYNC_INITIALIZED)) shutdown()
438 if (info->xmit_buf) { shutdown()
439 free_page((unsigned long) info->xmit_buf); shutdown()
440 info->xmit_buf = 0; shutdown()
446 info->tport.flags &= ~ASYNC_INITIALIZED; shutdown()
502 static void change_speed(struct m68k_serial *info, struct tty_struct *tty) change_speed() argument
504 m68328_uart *uart = &uart_addr[info->line]; change_speed()
511 port = info->port; change_speed()
560 struct m68k_serial *info = &m68k_soft[0]; rs_fair_output() local
563 if (info == NULL) return; rs_fair_output()
564 if (info->xmit_buf == NULL) return; rs_fair_output()
567 left = info->xmit_cnt; rs_fair_output()
569 c = info->xmit_buf[info->xmit_tail]; rs_fair_output()
570 info->xmit_tail = (info->xmit_tail+1) & (SERIAL_XMIT_SIZE-1); rs_fair_output()
571 info->xmit_cnt--; rs_fair_output()
577 left = min(info->xmit_cnt, left-1); rs_fair_output()
608 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_set_ldisc() local
610 if (serial_paranoia_check(info, tty->name, "rs_set_ldisc")) rs_set_ldisc()
613 info->is_cons = (tty->termios.c_line == N_TTY); rs_set_ldisc()
615 printk("ttyS%d console mode %s\n", info->line, info->is_cons ? "on" : "off"); rs_set_ldisc()
620 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; local
621 m68328_uart *uart = &uart_addr[info->line];
624 if (serial_paranoia_check(info, tty->name, "rs_flush_chars"))
633 if (info->xmit_cnt <= 0 || tty->stopped || !info->xmit_buf) {
650 uart->utx.b.txdata = info->xmit_buf[info->xmit_tail++];
651 info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1);
652 info->xmit_cnt--;
668 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_write() local
669 m68328_uart *uart = &uart_addr[info->line]; rs_write()
672 if (serial_paranoia_check(info, tty->name, "rs_write")) rs_write()
675 if (!tty || !info->xmit_buf) rs_write()
681 c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, rs_write()
682 SERIAL_XMIT_SIZE - info->xmit_head)); rs_write()
688 memcpy(info->xmit_buf + info->xmit_head, buf, c); rs_write()
691 info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); rs_write()
692 info->xmit_cnt += c; rs_write()
699 if (info->xmit_cnt && !tty->stopped) { rs_write()
703 while(info->xmit_cnt) { rs_write()
713 uart->utx.b.txdata = info->xmit_buf[info->xmit_tail++]; rs_write()
714 info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE-1); rs_write()
715 info->xmit_cnt--; rs_write()
729 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_write_room() local
732 if (serial_paranoia_check(info, tty->name, "rs_write_room")) rs_write_room()
734 ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; rs_write_room()
742 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_chars_in_buffer() local
744 if (serial_paranoia_check(info, tty->name, "rs_chars_in_buffer")) rs_chars_in_buffer()
746 return info->xmit_cnt; rs_chars_in_buffer()
751 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_flush_buffer() local
754 if (serial_paranoia_check(info, tty->name, "rs_flush_buffer")) rs_flush_buffer()
757 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; rs_flush_buffer()
772 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_throttle() local
774 if (serial_paranoia_check(info, tty->name, "rs_throttle")) rs_throttle()
778 info->x_char = STOP_CHAR(tty); rs_throttle()
785 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_unthrottle() local
787 if (serial_paranoia_check(info, tty->name, "rs_unthrottle")) rs_unthrottle()
791 if (info->x_char) rs_unthrottle()
792 info->x_char = 0; rs_unthrottle()
794 info->x_char = START_CHAR(tty); rs_unthrottle()
806 static int get_serial_info(struct m68k_serial * info, get_serial_info() argument
814 tmp.type = info->type; get_serial_info()
815 tmp.line = info->line; get_serial_info()
816 tmp.port = info->port; get_serial_info()
817 tmp.irq = info->irq; get_serial_info()
818 tmp.flags = info->tport.flags; get_serial_info()
819 tmp.baud_base = info->baud_base; get_serial_info()
820 tmp.close_delay = info->tport.close_delay; get_serial_info()
821 tmp.closing_wait = info->tport.closing_wait; get_serial_info()
822 tmp.custom_divisor = info->custom_divisor; get_serial_info()
829 static int set_serial_info(struct m68k_serial *info, struct tty_struct *tty, set_serial_info() argument
832 struct tty_port *port = &info->tport; set_serial_info()
841 old_info = *info; set_serial_info()
844 if ((new_serial.baud_base != info->baud_base) || set_serial_info()
845 (new_serial.type != info->type) || set_serial_info()
852 info->custom_divisor = new_serial.custom_divisor; set_serial_info()
864 info->baud_base = new_serial.baud_base; set_serial_info()
867 info->type = new_serial.type; set_serial_info()
872 retval = startup(info, tty); set_serial_info()
877 * get_lsr_info - get line status register info
879 * Purpose: Let user call ioctl() to get info when the UART physically
886 static int get_lsr_info(struct m68k_serial * info, unsigned int *value) get_lsr_info() argument
889 m68328_uart *uart = &uart_addr[info->line]; get_lsr_info()
907 static void send_break(struct m68k_serial * info, unsigned int duration) send_break() argument
909 m68328_uart *uart = &uart_addr[info->line]; send_break()
911 if (!info->port) send_break()
925 struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; rs_ioctl() local
928 if (serial_paranoia_check(info, tty->name, "rs_ioctl")) rs_ioctl()
945 send_break(info, 250); /* 1/4 second */ rs_ioctl()
952 send_break(info, arg ? arg*(100) : 250); rs_ioctl()
955 return get_serial_info(info, rs_ioctl()
958 return set_serial_info(info, tty, rs_ioctl()
961 return get_lsr_info(info, (unsigned int *) arg); rs_ioctl()
964 info, sizeof(struct m68k_serial))) rs_ioctl()
975 struct m68k_serial *info = (struct m68k_serial *)tty->driver_data; rs_set_termios() local
977 change_speed(info, tty); rs_set_termios()
997 struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; rs_close() local
998 struct tty_port *port = &info->tport; rs_close()
999 m68328_uart *uart = &uart_addr[info->line]; rs_close()
1002 if (serial_paranoia_check(info, tty->name, "rs_close")) rs_close()
1026 info->line, port->count); rs_close()
1051 shutdown(info, tty); rs_close()
1056 tty_port_tty_set(&info->tport, NULL); rs_close()
1082 struct m68k_serial * info = (struct m68k_serial *)tty->driver_data; rs_hangup() local
1084 if (serial_paranoia_check(info, tty->name, "rs_hangup")) rs_hangup()
1088 shutdown(info, tty); rs_hangup()
1089 info->tport.count = 0; rs_hangup()
1090 info->tport.flags &= ~ASYNC_NORMAL_ACTIVE; rs_hangup()
1091 tty_port_tty_set(&info->tport, NULL); rs_hangup()
1092 wake_up_interruptible(&info->tport.open_wait); rs_hangup()
1103 struct m68k_serial *info; rs_open() local
1106 info = &m68k_soft[tty->index]; rs_open()
1108 if (serial_paranoia_check(info, tty->name, "rs_open")) rs_open()
1111 info->tport.count++; rs_open()
1112 tty->driver_data = info; rs_open()
1113 tty_port_tty_set(&info->tport, tty); rs_open()
1118 retval = startup(info, tty); rs_open()
1122 return tty_port_block_til_ready(&info->tport, tty, filp); rs_open()
1159 struct m68k_serial *info; rs68328_init() local
1185 info = &m68k_soft[i]; rs68328_init()
1186 tty_port_init(&info->tport); rs68328_init()
1187 info->tport.ops = &rs_port_ops; rs68328_init()
1188 info->magic = SERIAL_MAGIC; rs68328_init()
1189 info->port = (int) &uart_addr[i]; rs68328_init()
1190 info->irq = uart_irqs[i]; rs68328_init()
1191 info->custom_divisor = 16; rs68328_init()
1192 info->x_char = 0; rs68328_init()
1193 info->line = i; rs68328_init()
1194 info->is_cons = 1; /* Means shortcuts work */ rs68328_init()
1196 printk("%s%d at 0x%08x (irq = %d)", serial_driver->name, info->line, rs68328_init()
1197 info->port, info->irq); rs68328_init()
1208 "M68328_UART", info)) rs68328_init()
1211 tty_port_link_device(&info->tport, serial_driver, i); rs68328_init()
H A Dof_serial.c63 struct of_serial_info *info) of_platform_serial_setup()
74 info->clk = devm_clk_get(&ofdev->dev, NULL); of_platform_serial_setup()
75 if (IS_ERR(info->clk)) { of_platform_serial_setup()
78 return PTR_ERR(info->clk); of_platform_serial_setup()
81 ret = clk_prepare_enable(info->clk); of_platform_serial_setup()
85 clk = clk_get_rate(info->clk); of_platform_serial_setup()
164 if (info->clk) of_platform_serial_setup()
165 clk_disable_unprepare(info->clk); of_platform_serial_setup()
176 struct of_serial_info *info; of_platform_serial_probe() local
188 info = kzalloc(sizeof(*info), GFP_KERNEL); of_platform_serial_probe()
189 if (info == NULL) of_platform_serial_probe()
193 ret = of_platform_serial_setup(ofdev, port_type, &port, info); of_platform_serial_probe()
231 info->type = port_type; of_platform_serial_probe()
232 info->line = ret; of_platform_serial_probe()
233 platform_set_drvdata(ofdev, info); of_platform_serial_probe()
236 kfree(info); of_platform_serial_probe()
246 struct of_serial_info *info = platform_get_drvdata(ofdev); of_platform_serial_remove() local
247 switch (info->type) { of_platform_serial_remove()
250 serial8250_unregister_port(info->line); of_platform_serial_remove()
255 nwpserial_unregister_port(info->line); of_platform_serial_remove()
263 if (info->clk) of_platform_serial_remove()
264 clk_disable_unprepare(info->clk); of_platform_serial_remove()
265 kfree(info); of_platform_serial_remove()
271 static void of_serial_suspend_8250(struct of_serial_info *info) of_serial_suspend_8250() argument
273 struct uart_8250_port *port8250 = serial8250_get_port(info->line); of_serial_suspend_8250()
276 serial8250_suspend_port(info->line); of_serial_suspend_8250()
277 if (info->clk && (!uart_console(port) || console_suspend_enabled)) of_serial_suspend_8250()
278 clk_disable_unprepare(info->clk); of_serial_suspend_8250()
281 static void of_serial_resume_8250(struct of_serial_info *info) of_serial_resume_8250() argument
283 struct uart_8250_port *port8250 = serial8250_get_port(info->line); of_serial_resume_8250()
286 if (info->clk && (!uart_console(port) || console_suspend_enabled)) of_serial_resume_8250()
287 clk_prepare_enable(info->clk); of_serial_resume_8250()
289 serial8250_resume_port(info->line); of_serial_resume_8250()
292 static inline void of_serial_suspend_8250(struct of_serial_info *info) of_serial_suspend_8250() argument
296 static inline void of_serial_resume_8250(struct of_serial_info *info) of_serial_resume_8250() argument
303 struct of_serial_info *info = dev_get_drvdata(dev); of_serial_suspend() local
305 switch (info->type) { of_serial_suspend()
307 of_serial_suspend_8250(info); of_serial_suspend()
318 struct of_serial_info *info = dev_get_drvdata(dev); of_serial_resume() local
320 switch (info->type) { of_serial_resume()
322 of_serial_resume_8250(info); of_serial_resume()
61 of_platform_serial_setup(struct platform_device *ofdev, int type, struct uart_port *port, struct of_serial_info *info) of_platform_serial_setup() argument
/linux-4.4.14/drivers/tty/hvc/
H A Dhvc_xen.c204 struct xencons_info *info; xen_hvm_console_init() local
209 info = vtermno_to_xencons(HVC_COOKIE); xen_hvm_console_init()
210 if (!info) { xen_hvm_console_init()
211 info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL); xen_hvm_console_init()
212 if (!info) xen_hvm_console_init()
214 } else if (info->intf != NULL) { xen_hvm_console_init()
227 info->evtchn = v; xen_hvm_console_init()
233 info->intf = xen_remap(gfn << XEN_PAGE_SHIFT, XEN_PAGE_SIZE); xen_hvm_console_init()
234 if (info->intf == NULL) xen_hvm_console_init()
236 info->vtermno = HVC_COOKIE; xen_hvm_console_init()
239 list_add_tail(&info->list, &xenconsoles); xen_hvm_console_init()
244 kfree(info); xen_hvm_console_init()
250 struct xencons_info *info; xen_pv_console_init() local
258 info = vtermno_to_xencons(HVC_COOKIE); xen_pv_console_init()
259 if (!info) { xen_pv_console_init()
260 info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL); xen_pv_console_init()
261 if (!info) xen_pv_console_init()
263 } else if (info->intf != NULL) { xen_pv_console_init()
267 info->evtchn = xen_start_info->console.domU.evtchn; xen_pv_console_init()
269 info->intf = gfn_to_virt(xen_start_info->console.domU.mfn); xen_pv_console_init()
270 info->vtermno = HVC_COOKIE; xen_pv_console_init()
273 list_add_tail(&info->list, &xenconsoles); xen_pv_console_init()
281 struct xencons_info *info; xen_initial_domain_console_init() local
286 info = vtermno_to_xencons(HVC_COOKIE); xen_initial_domain_console_init()
287 if (!info) { xen_initial_domain_console_init()
288 info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL); xen_initial_domain_console_init()
289 if (!info) xen_initial_domain_console_init()
293 info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0, false); xen_initial_domain_console_init()
294 info->vtermno = HVC_COOKIE; xen_initial_domain_console_init()
297 list_add_tail(&info->list, &xenconsoles); xen_initial_domain_console_init()
303 static void xen_console_update_evtchn(struct xencons_info *info) xen_console_update_evtchn() argument
311 info->evtchn = v; xen_console_update_evtchn()
313 info->evtchn = xen_start_info->console.domU.evtchn; xen_console_update_evtchn()
318 struct xencons_info *info = vtermno_to_xencons(HVC_COOKIE); xen_console_resume() local
319 if (info != NULL && info->irq) { xen_console_resume()
321 xen_console_update_evtchn(info); xen_console_resume()
322 rebind_evtchn_irq(info->evtchn, info->irq); xen_console_resume()
326 static void xencons_disconnect_backend(struct xencons_info *info) xencons_disconnect_backend() argument
328 if (info->irq > 0) xencons_disconnect_backend()
329 unbind_from_irqhandler(info->irq, NULL); xencons_disconnect_backend()
330 info->irq = 0; xencons_disconnect_backend()
331 if (info->evtchn > 0) xencons_disconnect_backend()
332 xenbus_free_evtchn(info->xbdev, info->evtchn); xencons_disconnect_backend()
333 info->evtchn = 0; xencons_disconnect_backend()
334 if (info->gntref > 0) xencons_disconnect_backend()
335 gnttab_free_grant_references(info->gntref); xencons_disconnect_backend()
336 info->gntref = 0; xencons_disconnect_backend()
337 if (info->hvc != NULL) xencons_disconnect_backend()
338 hvc_remove(info->hvc); xencons_disconnect_backend()
339 info->hvc = NULL; xencons_disconnect_backend()
342 static void xencons_free(struct xencons_info *info) xencons_free() argument
344 free_page((unsigned long)info->intf); xencons_free()
345 info->intf = NULL; xencons_free()
346 info->vtermno = 0; xencons_free()
347 kfree(info); xencons_free()
350 static int xen_console_remove(struct xencons_info *info) xen_console_remove() argument
352 xencons_disconnect_backend(info); xen_console_remove()
354 list_del(&info->list); xen_console_remove()
356 if (info->xbdev != NULL) xen_console_remove()
357 xencons_free(info); xen_console_remove()
360 iounmap(info->intf); xen_console_remove()
361 kfree(info); xen_console_remove()
373 struct xencons_info *info) xencons_connect_backend()
382 info->evtchn = evtchn; xencons_connect_backend()
386 info->irq = irq; xencons_connect_backend()
388 info->hvc = hvc_alloc(xenbus_devid_to_vtermno(devid), xencons_connect_backend()
390 if (IS_ERR(info->hvc)) xencons_connect_backend()
391 return PTR_ERR(info->hvc); xencons_connect_backend()
395 info->gntref = gref_head; xencons_connect_backend()
399 gnttab_grant_foreign_access_ref(ref, info->xbdev->otherend_id, xencons_connect_backend()
400 virt_to_gfn(info->intf), 0); xencons_connect_backend()
436 struct xencons_info *info; xencons_probe() local
442 info = kzalloc(sizeof(struct xencons_info), GFP_KERNEL); xencons_probe()
443 if (!info) xencons_probe()
445 dev_set_drvdata(&dev->dev, info); xencons_probe()
446 info->xbdev = dev; xencons_probe()
447 info->vtermno = xenbus_devid_to_vtermno(devid); xencons_probe()
448 info->intf = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO); xencons_probe()
449 if (!info->intf) xencons_probe()
452 ret = xencons_connect_backend(dev, info); xencons_probe()
456 list_add_tail(&info->list, &xenconsoles); xencons_probe()
465 xencons_disconnect_backend(info); xencons_probe()
466 xencons_free(info); xencons_probe()
472 struct xencons_info *info = dev_get_drvdata(&dev->dev); xencons_resume() local
474 xencons_disconnect_backend(info); xencons_resume()
475 memset(info->intf, 0, XEN_PAGE_SIZE); xencons_resume()
476 return xencons_connect_backend(dev, info); xencons_resume()
525 struct xencons_info *info; xen_hvc_init() local
536 info = vtermno_to_xencons(HVC_COOKIE); xen_hvc_init()
546 info = vtermno_to_xencons(HVC_COOKIE); xen_hvc_init()
547 info->irq = bind_evtchn_to_irq(info->evtchn); xen_hvc_init()
549 if (info->irq < 0) xen_hvc_init()
550 info->irq = 0; /* NO_IRQ */ xen_hvc_init()
552 irq_set_noprobe(info->irq); xen_hvc_init()
554 info->hvc = hvc_alloc(HVC_COOKIE, info->irq, ops, 256); xen_hvc_init()
555 if (IS_ERR(info->hvc)) { xen_hvc_init()
556 r = PTR_ERR(info->hvc); xen_hvc_init()
558 list_del(&info->list); xen_hvc_init()
560 if (info->irq) xen_hvc_init()
561 unbind_from_irqhandler(info->irq, NULL); xen_hvc_init()
562 kfree(info); xen_hvc_init()
372 xencons_connect_backend(struct xenbus_device *dev, struct xencons_info *info) xencons_connect_backend() argument
/linux-4.4.14/fs/quota/
H A Dquota_tree.c25 static int get_index(struct qtree_mem_dqinfo *info, struct kqid qid, int depth) get_index() argument
27 unsigned int epb = info->dqi_usable_bs >> 2; get_index()
30 depth = info->dqi_qtree_depth - depth - 1; get_index()
37 static int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info) qtree_dqstr_in_blk() argument
39 return (info->dqi_usable_bs - sizeof(struct qt_disk_dqdbheader)) qtree_dqstr_in_blk()
40 / info->dqi_entry_size; qtree_dqstr_in_blk()
52 static ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) read_blk() argument
54 struct super_block *sb = info->dqi_sb; read_blk()
56 memset(buf, 0, info->dqi_usable_bs); read_blk()
57 return sb->s_op->quota_read(sb, info->dqi_type, buf, read_blk()
58 info->dqi_usable_bs, blk << info->dqi_blocksize_bits); read_blk()
61 static ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, char *buf) write_blk() argument
63 struct super_block *sb = info->dqi_sb; write_blk()
66 ret = sb->s_op->quota_write(sb, info->dqi_type, buf, write_blk()
67 info->dqi_usable_bs, blk << info->dqi_blocksize_bits); write_blk()
68 if (ret != info->dqi_usable_bs) { write_blk()
77 static int get_free_dqblk(struct qtree_mem_dqinfo *info) get_free_dqblk() argument
79 char *buf = getdqbuf(info->dqi_usable_bs); get_free_dqblk()
85 if (info->dqi_free_blk) { get_free_dqblk()
86 blk = info->dqi_free_blk; get_free_dqblk()
87 ret = read_blk(info, blk, buf); get_free_dqblk()
90 info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free); get_free_dqblk()
93 memset(buf, 0, info->dqi_usable_bs); get_free_dqblk()
95 ret = write_blk(info, info->dqi_blocks, buf); get_free_dqblk()
98 blk = info->dqi_blocks++; get_free_dqblk()
100 mark_info_dirty(info->dqi_sb, info->dqi_type); get_free_dqblk()
108 static int put_free_dqblk(struct qtree_mem_dqinfo *info, char *buf, uint blk) put_free_dqblk() argument
113 dh->dqdh_next_free = cpu_to_le32(info->dqi_free_blk); put_free_dqblk()
116 err = write_blk(info, blk, buf); put_free_dqblk()
119 info->dqi_free_blk = blk; put_free_dqblk()
120 mark_info_dirty(info->dqi_sb, info->dqi_type); put_free_dqblk()
125 static int remove_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, remove_free_dqentry() argument
128 char *tmpbuf = getdqbuf(info->dqi_usable_bs); remove_free_dqentry()
137 err = read_blk(info, nextblk, tmpbuf); remove_free_dqentry()
142 err = write_blk(info, nextblk, tmpbuf); remove_free_dqentry()
147 err = read_blk(info, prevblk, tmpbuf); remove_free_dqentry()
152 err = write_blk(info, prevblk, tmpbuf); remove_free_dqentry()
156 info->dqi_free_entry = nextblk; remove_free_dqentry()
157 mark_info_dirty(info->dqi_sb, info->dqi_type); remove_free_dqentry()
162 if (write_blk(info, blk, buf) < 0) remove_free_dqentry()
163 quota_error(info->dqi_sb, "Can't write block (%u) " remove_free_dqentry()
172 static int insert_free_dqentry(struct qtree_mem_dqinfo *info, char *buf, insert_free_dqentry() argument
175 char *tmpbuf = getdqbuf(info->dqi_usable_bs); insert_free_dqentry()
181 dh->dqdh_next_free = cpu_to_le32(info->dqi_free_entry); insert_free_dqentry()
183 err = write_blk(info, blk, buf); insert_free_dqentry()
186 if (info->dqi_free_entry) { insert_free_dqentry()
187 err = read_blk(info, info->dqi_free_entry, tmpbuf); insert_free_dqentry()
192 err = write_blk(info, info->dqi_free_entry, tmpbuf); insert_free_dqentry()
197 info->dqi_free_entry = blk; insert_free_dqentry()
198 mark_info_dirty(info->dqi_sb, info->dqi_type); insert_free_dqentry()
206 int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk) qtree_entry_unused() argument
210 for (i = 0; i < info->dqi_entry_size; i++) qtree_entry_unused()
218 static uint find_free_dqentry(struct qtree_mem_dqinfo *info, find_free_dqentry() argument
223 char *buf = getdqbuf(info->dqi_usable_bs); find_free_dqentry()
232 if (info->dqi_free_entry) { find_free_dqentry()
233 blk = info->dqi_free_entry; find_free_dqentry()
234 *err = read_blk(info, blk, buf); find_free_dqentry()
238 blk = get_free_dqblk(info); find_free_dqentry()
244 memset(buf, 0, info->dqi_usable_bs); find_free_dqentry()
247 info->dqi_free_entry = blk; find_free_dqentry()
251 if (le16_to_cpu(dh->dqdh_entries) + 1 >= qtree_dqstr_in_blk(info)) { find_free_dqentry()
252 *err = remove_free_dqentry(info, buf, blk); find_free_dqentry()
262 for (i = 0; i < qtree_dqstr_in_blk(info); i++) { find_free_dqentry()
263 if (qtree_entry_unused(info, ddquot)) find_free_dqentry()
265 ddquot += info->dqi_entry_size; find_free_dqentry()
268 if (i == qtree_dqstr_in_blk(info)) { find_free_dqentry()
274 *err = write_blk(info, blk, buf); find_free_dqentry()
280 dquot->dq_off = (blk << info->dqi_blocksize_bits) + find_free_dqentry()
282 i * info->dqi_entry_size; find_free_dqentry()
291 static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, do_insert_tree() argument
294 char *buf = getdqbuf(info->dqi_usable_bs); do_insert_tree()
302 ret = get_free_dqblk(info); do_insert_tree()
306 memset(buf, 0, info->dqi_usable_bs); do_insert_tree()
309 ret = read_blk(info, *treeblk, buf); do_insert_tree()
317 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); do_insert_tree()
320 if (depth == info->dqi_qtree_depth - 1) { do_insert_tree()
325 le32_to_cpu(ref[get_index(info, do_insert_tree()
331 newblk = find_free_dqentry(info, dquot, &ret); do_insert_tree()
333 ret = do_insert_tree(info, dquot, &newblk, depth+1); do_insert_tree()
336 ref[get_index(info, dquot->dq_id, depth)] = do_insert_tree()
338 ret = write_blk(info, *treeblk, buf); do_insert_tree()
340 put_free_dqblk(info, buf, *treeblk); do_insert_tree()
348 static inline int dq_insert_tree(struct qtree_mem_dqinfo *info, dq_insert_tree() argument
354 if (info->dqi_blocks <= QT_TREEOFF) { dq_insert_tree()
359 return do_insert_tree(info, dquot, &tmp, 0); dq_insert_tree()
366 int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) qtree_write_dquot() argument
371 char *ddquot = getdqbuf(info->dqi_entry_size); qtree_write_dquot()
378 ret = dq_insert_tree(info, dquot); qtree_write_dquot()
387 info->dqi_ops->mem2disk_dqblk(ddquot, dquot); qtree_write_dquot()
389 ret = sb->s_op->quota_write(sb, type, ddquot, info->dqi_entry_size, qtree_write_dquot()
391 if (ret != info->dqi_entry_size) { qtree_write_dquot()
406 static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, free_dqentry() argument
410 char *buf = getdqbuf(info->dqi_usable_bs); free_dqentry()
415 if (dquot->dq_off >> info->dqi_blocksize_bits != blk) { free_dqentry()
418 (uint)(dquot->dq_off >> info->dqi_blocksize_bits)); free_dqentry()
421 ret = read_blk(info, blk, buf); free_dqentry()
430 ret = remove_free_dqentry(info, buf, blk); free_dqentry()
432 ret = put_free_dqblk(info, buf, blk); free_dqentry()
440 (dquot->dq_off & ((1 << info->dqi_blocksize_bits) - 1)), free_dqentry()
441 0, info->dqi_entry_size); free_dqentry()
443 qtree_dqstr_in_blk(info) - 1) { free_dqentry()
445 ret = insert_free_dqentry(info, buf, blk); free_dqentry()
452 ret = write_blk(info, blk, buf); free_dqentry()
467 static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, remove_tree() argument
470 char *buf = getdqbuf(info->dqi_usable_bs); remove_tree()
477 ret = read_blk(info, *blk, buf); remove_tree()
483 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); remove_tree()
484 if (depth == info->dqi_qtree_depth - 1) { remove_tree()
485 ret = free_dqentry(info, dquot, newblk); remove_tree()
488 ret = remove_tree(info, dquot, &newblk, depth+1); remove_tree()
492 ref[get_index(info, dquot->dq_id, depth)] = cpu_to_le32(0); remove_tree()
494 for (i = 0; i < (info->dqi_usable_bs >> 2) && !ref[i]; i++) remove_tree()
497 if (i == (info->dqi_usable_bs >> 2) remove_tree()
499 put_free_dqblk(info, buf, *blk); remove_tree()
502 ret = write_blk(info, *blk, buf); remove_tree()
515 int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) qtree_delete_dquot() argument
521 return remove_tree(info, dquot, &tmp, 0); qtree_delete_dquot()
526 static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info, find_block_dqentry() argument
529 char *buf = getdqbuf(info->dqi_usable_bs); find_block_dqentry()
536 ret = read_blk(info, blk, buf); find_block_dqentry()
543 for (i = 0; i < qtree_dqstr_in_blk(info); i++) { find_block_dqentry()
544 if (info->dqi_ops->is_id(ddquot, dquot)) find_block_dqentry()
546 ddquot += info->dqi_entry_size; find_block_dqentry()
548 if (i == qtree_dqstr_in_blk(info)) { find_block_dqentry()
555 ret = (blk << info->dqi_blocksize_bits) + sizeof(struct find_block_dqentry()
556 qt_disk_dqdbheader) + i * info->dqi_entry_size; find_block_dqentry()
564 static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info, find_tree_dqentry() argument
567 char *buf = getdqbuf(info->dqi_usable_bs); find_tree_dqentry()
573 ret = read_blk(info, blk, buf); find_tree_dqentry()
580 blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); find_tree_dqentry()
583 if (depth < info->dqi_qtree_depth - 1) find_tree_dqentry()
584 ret = find_tree_dqentry(info, dquot, blk, depth+1); find_tree_dqentry()
586 ret = find_block_dqentry(info, dquot, blk); find_tree_dqentry()
593 static inline loff_t find_dqentry(struct qtree_mem_dqinfo *info, find_dqentry() argument
596 return find_tree_dqentry(info, dquot, QT_TREEOFF, 0); find_dqentry()
599 int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) qtree_read_dquot() argument
616 offset = find_dqentry(info, dquot); qtree_read_dquot()
631 ddquot = getdqbuf(info->dqi_entry_size); qtree_read_dquot()
634 ret = sb->s_op->quota_read(sb, type, ddquot, info->dqi_entry_size, qtree_read_dquot()
636 if (ret != info->dqi_entry_size) { qtree_read_dquot()
647 info->dqi_ops->disk2mem_dqblk(dquot, ddquot); qtree_read_dquot()
663 int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) qtree_release_dquot() argument
667 return qtree_delete_dquot(info, dquot); qtree_release_dquot()
/linux-4.4.14/drivers/firmware/
H A Dedd.c59 struct edd_info *info; member in struct:edd_device
97 return edev->info; edd_dev_get_info()
107 edev->info = &edd.edd_info[i]; edd_dev_set_info()
132 struct edd_info *info; edd_show_host_bus() local
138 info = edd_dev_get_info(edev); edd_show_host_bus()
139 if (!info || !buf) edd_show_host_bus()
143 if (isprint(info->params.host_bus_type[i])) { edd_show_host_bus()
144 p += scnprintf(p, left, "%c", info->params.host_bus_type[i]); edd_show_host_bus()
150 if (!strncmp(info->params.host_bus_type, "ISA", 3)) { edd_show_host_bus()
152 info->params.interface_path.isa.base_address); edd_show_host_bus()
153 } else if (!strncmp(info->params.host_bus_type, "PCIX", 4) || edd_show_host_bus()
154 !strncmp(info->params.host_bus_type, "PCI", 3) || edd_show_host_bus()
155 !strncmp(info->params.host_bus_type, "XPRS", 4)) { edd_show_host_bus()
158 info->params.interface_path.pci.bus, edd_show_host_bus()
159 info->params.interface_path.pci.slot, edd_show_host_bus()
160 info->params.interface_path.pci.function, edd_show_host_bus()
161 info->params.interface_path.pci.channel); edd_show_host_bus()
162 } else if (!strncmp(info->params.host_bus_type, "IBND", 4) || edd_show_host_bus()
163 !strncmp(info->params.host_bus_type, "HTPT", 4)) { edd_show_host_bus()
166 info->params.interface_path.ibnd.reserved); edd_show_host_bus()
170 info->params.interface_path.unknown.reserved); edd_show_host_bus()
178 struct edd_info *info; edd_show_interface() local
184 info = edd_dev_get_info(edev); edd_show_interface()
185 if (!info || !buf) edd_show_interface()
189 if (isprint(info->params.interface_type[i])) { edd_show_interface()
190 p += scnprintf(p, left, "%c", info->params.interface_type[i]); edd_show_interface()
195 if (!strncmp(info->params.interface_type, "ATAPI", 5)) { edd_show_interface()
197 info->params.device_path.atapi.device, edd_show_interface()
198 info->params.device_path.atapi.lun); edd_show_interface()
199 } else if (!strncmp(info->params.interface_type, "ATA", 3)) { edd_show_interface()
201 info->params.device_path.ata.device); edd_show_interface()
202 } else if (!strncmp(info->params.interface_type, "SCSI", 4)) { edd_show_interface()
204 info->params.device_path.scsi.id, edd_show_interface()
205 info->params.device_path.scsi.lun); edd_show_interface()
206 } else if (!strncmp(info->params.interface_type, "USB", 3)) { edd_show_interface()
208 info->params.device_path.usb.serial_number); edd_show_interface()
209 } else if (!strncmp(info->params.interface_type, "1394", 4)) { edd_show_interface()
211 info->params.device_path.i1394.eui); edd_show_interface()
212 } else if (!strncmp(info->params.interface_type, "FIBRE", 5)) { edd_show_interface()
214 info->params.device_path.fibre.wwid, edd_show_interface()
215 info->params.device_path.fibre.lun); edd_show_interface()
216 } else if (!strncmp(info->params.interface_type, "I2O", 3)) { edd_show_interface()
218 info->params.device_path.i2o.identity_tag); edd_show_interface()
219 } else if (!strncmp(info->params.interface_type, "RAID", 4)) { edd_show_interface()
221 info->params.device_path.raid.array_number); edd_show_interface()
222 } else if (!strncmp(info->params.interface_type, "SATA", 4)) { edd_show_interface()
224 info->params.device_path.sata.device); edd_show_interface()
227 info->params.device_path.unknown.reserved1, edd_show_interface()
228 info->params.device_path.unknown.reserved2); edd_show_interface()
244 struct edd_info *info; edd_show_raw_data() local
245 ssize_t len = sizeof (info->params); edd_show_raw_data()
248 info = edd_dev_get_info(edev); edd_show_raw_data()
249 if (!info || !buf) edd_show_raw_data()
252 if (!(info->params.key == 0xBEDD || info->params.key == 0xDDBE)) edd_show_raw_data()
253 len = info->params.length; edd_show_raw_data()
256 if (len > (sizeof(info->params))) edd_show_raw_data()
257 len = sizeof(info->params); edd_show_raw_data()
259 memcpy(buf, &info->params, len); edd_show_raw_data()
266 struct edd_info *info; edd_show_version() local
270 info = edd_dev_get_info(edev); edd_show_version()
271 if (!info || !buf) edd_show_version()
274 p += scnprintf(p, left, "0x%02x\n", info->version); edd_show_version()
289 struct edd_info *info; edd_show_extensions() local
293 info = edd_dev_get_info(edev); edd_show_extensions()
294 if (!info || !buf) edd_show_extensions()
297 if (info->interface_support & EDD_EXT_FIXED_DISK_ACCESS) { edd_show_extensions()
300 if (info->interface_support & EDD_EXT_DEVICE_LOCKING_AND_EJECTING) { edd_show_extensions()
303 if (info->interface_support & EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT) { edd_show_extensions()
306 if (info->interface_support & EDD_EXT_64BIT_EXTENSIONS) { edd_show_extensions()
315 struct edd_info *info; edd_show_info_flags() local
319 info = edd_dev_get_info(edev); edd_show_info_flags()
320 if (!info || !buf) edd_show_info_flags()
323 if (info->params.info_flags & EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT) edd_show_info_flags()
325 if (info->params.info_flags & EDD_INFO_GEOMETRY_VALID) edd_show_info_flags()
327 if (info->params.info_flags & EDD_INFO_REMOVABLE) edd_show_info_flags()
329 if (info->params.info_flags & EDD_INFO_WRITE_VERIFY) edd_show_info_flags()
331 if (info->params.info_flags & EDD_INFO_MEDIA_CHANGE_NOTIFICATION) edd_show_info_flags()
333 if (info->params.info_flags & EDD_INFO_LOCKABLE) edd_show_info_flags()
335 if (info->params.info_flags & EDD_INFO_NO_MEDIA_PRESENT) edd_show_info_flags()
337 if (info->params.info_flags & EDD_INFO_USE_INT13_FN50) edd_show_info_flags()
345 struct edd_info *info; edd_show_legacy_max_cylinder() local
349 info = edd_dev_get_info(edev); edd_show_legacy_max_cylinder()
350 if (!info || !buf) edd_show_legacy_max_cylinder()
353 p += snprintf(p, left, "%u\n", info->legacy_max_cylinder); edd_show_legacy_max_cylinder()
360 struct edd_info *info; edd_show_legacy_max_head() local
364 info = edd_dev_get_info(edev); edd_show_legacy_max_head()
365 if (!info || !buf) edd_show_legacy_max_head()
368 p += snprintf(p, left, "%u\n", info->legacy_max_head); edd_show_legacy_max_head()
375 struct edd_info *info; edd_show_legacy_sectors_per_track() local
379 info = edd_dev_get_info(edev); edd_show_legacy_sectors_per_track()
380 if (!info || !buf) edd_show_legacy_sectors_per_track()
383 p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track); edd_show_legacy_sectors_per_track()
390 struct edd_info *info; edd_show_default_cylinders() local
394 info = edd_dev_get_info(edev); edd_show_default_cylinders()
395 if (!info || !buf) edd_show_default_cylinders()
398 p += scnprintf(p, left, "%u\n", info->params.num_default_cylinders); edd_show_default_cylinders()
405 struct edd_info *info; edd_show_default_heads() local
409 info = edd_dev_get_info(edev); edd_show_default_heads()
410 if (!info || !buf) edd_show_default_heads()
413 p += scnprintf(p, left, "%u\n", info->params.num_default_heads); edd_show_default_heads()
420 struct edd_info *info; edd_show_default_sectors_per_track() local
424 info = edd_dev_get_info(edev); edd_show_default_sectors_per_track()
425 if (!info || !buf) edd_show_default_sectors_per_track()
428 p += scnprintf(p, left, "%u\n", info->params.sectors_per_track); edd_show_default_sectors_per_track()
435 struct edd_info *info; edd_show_sectors() local
439 info = edd_dev_get_info(edev); edd_show_sectors()
440 if (!info || !buf) edd_show_sectors()
443 p += scnprintf(p, left, "%llu\n", info->params.number_of_sectors); edd_show_sectors()
461 struct edd_info *info; edd_has_legacy_max_cylinder() local
464 info = edd_dev_get_info(edev); edd_has_legacy_max_cylinder()
465 if (!info) edd_has_legacy_max_cylinder()
467 return info->legacy_max_cylinder > 0; edd_has_legacy_max_cylinder()
473 struct edd_info *info; edd_has_legacy_max_head() local
476 info = edd_dev_get_info(edev); edd_has_legacy_max_head()
477 if (!info) edd_has_legacy_max_head()
479 return info->legacy_max_head > 0; edd_has_legacy_max_head()
485 struct edd_info *info; edd_has_legacy_sectors_per_track() local
488 info = edd_dev_get_info(edev); edd_has_legacy_sectors_per_track()
489 if (!info) edd_has_legacy_sectors_per_track()
491 return info->legacy_sectors_per_track > 0; edd_has_legacy_sectors_per_track()
497 struct edd_info *info; edd_has_default_cylinders() local
500 info = edd_dev_get_info(edev); edd_has_default_cylinders()
501 if (!info) edd_has_default_cylinders()
503 return info->params.num_default_cylinders > 0; edd_has_default_cylinders()
509 struct edd_info *info; edd_has_default_heads() local
512 info = edd_dev_get_info(edev); edd_has_default_heads()
513 if (!info) edd_has_default_heads()
515 return info->params.num_default_heads > 0; edd_has_default_heads()
521 struct edd_info *info; edd_has_default_sectors_per_track() local
524 info = edd_dev_get_info(edev); edd_has_default_sectors_per_track()
525 if (!info) edd_has_default_sectors_per_track()
527 return info->params.sectors_per_track > 0; edd_has_default_sectors_per_track()
533 struct edd_info *info; edd_has_edd30() local
539 info = edd_dev_get_info(edev); edd_has_edd30()
540 if (!info) edd_has_edd30()
543 if (!(info->params.key == 0xBEDD || info->params.key == 0xDDBE)) { edd_has_edd30()
549 if (info->params.device_path_info_length != 44) edd_has_edd30()
552 for (i = 30; i < info->params.device_path_info_length + 30; i++) edd_has_edd30()
553 csum += *(((u8 *)&info->params) + i); edd_has_edd30()
647 struct edd_info *info; edd_dev_is_type() local
650 info = edd_dev_get_info(edev); edd_dev_is_type()
652 if (type && info) { edd_dev_is_type()
653 if (!strncmp(info->params.host_bus_type, type, strlen(type)) || edd_dev_is_type()
654 !strncmp(info->params.interface_type, type, strlen(type))) edd_dev_is_type()
669 struct edd_info *info = edd_dev_get_info(edev); edd_get_pci_dev() local
672 return pci_get_bus_and_slot(info->params.interface_path.pci.bus, edd_get_pci_dev()
673 PCI_DEVFN(info->params.interface_path.pci.slot, edd_get_pci_dev()
674 info->params.interface_path.pci. edd_get_pci_dev()
/linux-4.4.14/drivers/hwmon/pmbus/
H A Dpmbus.c34 struct pmbus_driver_info *info) pmbus_find_sensor_groups()
40 info->func[0] |= PMBUS_HAVE_VIN; pmbus_find_sensor_groups()
42 info->func[0] |= PMBUS_HAVE_VCAP; pmbus_find_sensor_groups()
44 info->func[0] |= PMBUS_HAVE_IIN; pmbus_find_sensor_groups()
46 info->func[0] |= PMBUS_HAVE_PIN; pmbus_find_sensor_groups()
47 if (info->func[0] pmbus_find_sensor_groups()
49 info->func[0] |= PMBUS_HAVE_STATUS_INPUT; pmbus_find_sensor_groups()
52 info->func[0] |= PMBUS_HAVE_FAN12; pmbus_find_sensor_groups()
54 info->func[0] |= PMBUS_HAVE_STATUS_FAN12; pmbus_find_sensor_groups()
58 info->func[0] |= PMBUS_HAVE_FAN34; pmbus_find_sensor_groups()
60 info->func[0] |= PMBUS_HAVE_STATUS_FAN34; pmbus_find_sensor_groups()
63 info->func[0] |= PMBUS_HAVE_TEMP; pmbus_find_sensor_groups()
65 info->func[0] |= PMBUS_HAVE_TEMP2; pmbus_find_sensor_groups()
67 info->func[0] |= PMBUS_HAVE_TEMP3; pmbus_find_sensor_groups()
68 if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2 pmbus_find_sensor_groups()
72 info->func[0] |= PMBUS_HAVE_STATUS_TEMP; pmbus_find_sensor_groups()
75 for (page = 0; page < info->pages; page++) { pmbus_find_sensor_groups()
77 info->func[page] |= PMBUS_HAVE_VOUT; pmbus_find_sensor_groups()
80 info->func[page] |= PMBUS_HAVE_STATUS_VOUT; pmbus_find_sensor_groups()
83 info->func[page] |= PMBUS_HAVE_IOUT; pmbus_find_sensor_groups()
86 info->func[page] |= PMBUS_HAVE_STATUS_IOUT; pmbus_find_sensor_groups()
89 info->func[page] |= PMBUS_HAVE_POUT; pmbus_find_sensor_groups()
97 struct pmbus_driver_info *info) pmbus_identify()
101 if (!info->pages) { pmbus_identify()
116 info->pages = page; pmbus_identify()
118 info->pages = 1; pmbus_identify()
131 info->format[PSC_VOLTAGE_OUT] = vid; pmbus_identify()
132 info->vrm_version = vr11; pmbus_identify()
135 info->format[PSC_VOLTAGE_OUT] = direct; pmbus_identify()
155 if (info->format[PSC_VOLTAGE_OUT] == direct) { pmbus_identify()
161 pmbus_find_sensor_groups(client, info); pmbus_identify()
169 struct pmbus_driver_info *info; pmbus_probe() local
171 info = devm_kzalloc(&client->dev, sizeof(struct pmbus_driver_info), pmbus_probe()
173 if (!info) pmbus_probe()
176 info->pages = id->driver_data; pmbus_probe()
177 info->identify = pmbus_identify; pmbus_probe()
179 return pmbus_do_probe(client, id, info); pmbus_probe()
33 pmbus_find_sensor_groups(struct i2c_client *client, struct pmbus_driver_info *info) pmbus_find_sensor_groups() argument
96 pmbus_identify(struct i2c_client *client, struct pmbus_driver_info *info) pmbus_identify() argument
/linux-4.4.14/arch/parisc/kernel/
H A Dunwind.c170 /* Called from setup_arch to import the kernel unwind info */ unwind_init()
208 static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int frame_size) unwind_special() argument
214 struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size - PT_SZ_ALGN); unwind_special()
216 info->prev_sp = regs->gr[30]; unwind_special()
217 info->prev_ip = regs->iaoq[0]; unwind_special()
225 static void unwind_frame_regs(struct unwind_frame_info *info) unwind_frame_regs() argument
233 e = find_unwind_entry(info->ip); unwind_frame_regs()
237 dbg("Cannot find unwind entry for 0x%lx; forced unwinding\n", info->ip); unwind_frame_regs()
245 kallsyms_lookup(info->ip, NULL, NULL, &modname, unwind_frame_regs()
248 dbg("info->ip = 0x%lx, name = %s\n", info->ip, symname); unwind_frame_regs()
251 info->prev_sp = info->sp - CALLEE_SAVE_FRAME_SIZE; unwind_frame_regs()
252 info->prev_ip = *(unsigned long *)(info->prev_sp - RP_OFFSET); unwind_frame_regs()
255 info->ip, info->prev_sp, unwind_frame_regs()
256 info->prev_ip); unwind_frame_regs()
260 info->prev_ip = info->prev_sp = 0; unwind_frame_regs()
273 sp = info->sp & ~63; unwind_frame_regs()
277 info->prev_sp = sp - 64; unwind_frame_regs()
278 info->prev_ip = 0; unwind_frame_regs()
279 if (get_user(tmp, (unsigned long *)(info->prev_sp - RP_OFFSET))) unwind_frame_regs()
281 info->prev_ip = tmp; unwind_frame_regs()
282 sp = info->prev_sp; unwind_frame_regs()
283 } while (!kernel_text_address(info->prev_ip)); unwind_frame_regs()
285 info->rp = 0; unwind_frame_regs()
287 dbg("analyzing func @ %lx with no unwind info, setting " unwind_frame_regs()
288 "prev_sp=%lx prev_ip=%lx\n", info->ip, unwind_frame_regs()
289 info->prev_sp, info->prev_ip); unwind_frame_regs()
301 npc < info->ip; unwind_frame_regs()
312 "%lx, frame_size = %ld\n", info->ip, unwind_frame_regs()
319 "%lx, frame_size = %ld\n", info->ip, unwind_frame_regs()
326 "-20(sp) @ %lx\n", info->ip, npc); unwind_frame_regs()
332 "-16(sp) @ %lx\n", info->ip, npc); unwind_frame_regs()
336 if (!unwind_special(info, e->region_start, frame_size)) { unwind_frame_regs()
337 info->prev_sp = info->sp - frame_size; unwind_frame_regs()
339 info->rp = info->r31; unwind_frame_regs()
341 info->rp = *(unsigned long *)(info->prev_sp - rpoffset); unwind_frame_regs()
342 info->prev_ip = info->rp; unwind_frame_regs()
343 info->rp = 0; unwind_frame_regs()
347 "prev_ip=%lx npc=%lx\n", info->ip, info->prev_sp, unwind_frame_regs()
348 info->prev_ip, npc); unwind_frame_regs()
352 void unwind_frame_init(struct unwind_frame_info *info, struct task_struct *t, unwind_frame_init() argument
355 memset(info, 0, sizeof(struct unwind_frame_info)); unwind_frame_init()
356 info->t = t; unwind_frame_init()
357 info->sp = regs->gr[30]; unwind_frame_init()
358 info->ip = regs->iaoq[0]; unwind_frame_init()
359 info->rp = regs->gr[2]; unwind_frame_init()
360 info->r31 = regs->gr[31]; unwind_frame_init()
363 t ? (int)t->pid : -1, info->sp, info->ip); unwind_frame_init()
366 void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct task_struct *t) unwind_frame_init_from_blocked_task() argument
377 unwind_frame_init(info, t, r2); unwind_frame_init_from_blocked_task()
381 void unwind_frame_init_running(struct unwind_frame_info *info, struct pt_regs *regs) unwind_frame_init_running() argument
383 unwind_frame_init(info, current, regs); unwind_frame_init_running()
406 int unwind_to_user(struct unwind_frame_info *info) unwind_to_user() argument
411 ret = unwind_once(info); unwind_to_user()
412 } while (!ret && !(info->ip & 3)); unwind_to_user()
419 struct unwind_frame_info info; return_address() local
423 /* initialize unwind info */ return_address()
429 unwind_frame_init(&info, current, &r); return_address()
434 if (unwind_once(&info) < 0 || info.ip == 0) return_address()
436 if (!kernel_text_address(info.ip)) return_address()
438 } while (info.ip && level--); return_address()
440 return info.ip; return_address()
/linux-4.4.14/arch/x86/um/os-Linux/
H A Dtls.c28 user_desc_t info; check_host_supports_tls() local
29 info.entry_number = val[i]; check_host_supports_tls()
31 if (syscall(__NR_get_thread_area, &info) == 0) { check_host_supports_tls()
47 int os_set_thread_area(user_desc_t *info, int pid) os_set_thread_area() argument
51 ret = ptrace(PTRACE_SET_THREAD_AREA, pid, info->entry_number, os_set_thread_area()
52 (unsigned long) info); os_set_thread_area()
58 int os_get_thread_area(user_desc_t *info, int pid) os_get_thread_area() argument
62 ret = ptrace(PTRACE_GET_THREAD_AREA, pid, info->entry_number, os_get_thread_area()
63 (unsigned long) info); os_get_thread_area()
/linux-4.4.14/net/l2tp/
H A Dl2tp_netlink.c58 static struct l2tp_session *l2tp_nl_session_find(struct genl_info *info) l2tp_nl_session_find() argument
65 struct net *net = genl_info_net(info); l2tp_nl_session_find()
67 if (info->attrs[L2TP_ATTR_IFNAME]) { l2tp_nl_session_find()
68 ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]); l2tp_nl_session_find()
70 } else if ((info->attrs[L2TP_ATTR_SESSION_ID]) && l2tp_nl_session_find()
71 (info->attrs[L2TP_ATTR_CONN_ID])) { l2tp_nl_session_find()
72 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]); l2tp_nl_session_find()
73 session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]); l2tp_nl_session_find()
82 static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_noop() argument
94 hdr = genlmsg_put(msg, info->snd_portid, info->snd_seq, l2tp_nl_cmd_noop()
103 return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid); l2tp_nl_cmd_noop()
113 struct genl_info *info, l2tp_tunnel_notify()
124 ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq, l2tp_tunnel_notify()
141 struct genl_info *info, l2tp_session_notify()
152 ret = l2tp_nl_session_send(msg, info->snd_portid, info->snd_seq, l2tp_session_notify()
168 static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_tunnel_create() argument
177 struct net *net = genl_info_net(info); l2tp_nl_cmd_tunnel_create()
179 if (!info->attrs[L2TP_ATTR_CONN_ID]) { l2tp_nl_cmd_tunnel_create()
183 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]); l2tp_nl_cmd_tunnel_create()
185 if (!info->attrs[L2TP_ATTR_PEER_CONN_ID]) { l2tp_nl_cmd_tunnel_create()
189 peer_tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_PEER_CONN_ID]); l2tp_nl_cmd_tunnel_create()
191 if (!info->attrs[L2TP_ATTR_PROTO_VERSION]) { l2tp_nl_cmd_tunnel_create()
195 proto_version = nla_get_u8(info->attrs[L2TP_ATTR_PROTO_VERSION]); l2tp_nl_cmd_tunnel_create()
197 if (!info->attrs[L2TP_ATTR_ENCAP_TYPE]) { l2tp_nl_cmd_tunnel_create()
201 cfg.encap = nla_get_u16(info->attrs[L2TP_ATTR_ENCAP_TYPE]); l2tp_nl_cmd_tunnel_create()
204 if (info->attrs[L2TP_ATTR_FD]) { l2tp_nl_cmd_tunnel_create()
205 fd = nla_get_u32(info->attrs[L2TP_ATTR_FD]); l2tp_nl_cmd_tunnel_create()
208 if (info->attrs[L2TP_ATTR_IP6_SADDR] && l2tp_nl_cmd_tunnel_create()
209 info->attrs[L2TP_ATTR_IP6_DADDR]) { l2tp_nl_cmd_tunnel_create()
211 info->attrs[L2TP_ATTR_IP6_SADDR]); l2tp_nl_cmd_tunnel_create()
213 info->attrs[L2TP_ATTR_IP6_DADDR]); l2tp_nl_cmd_tunnel_create()
216 if (info->attrs[L2TP_ATTR_IP_SADDR] && l2tp_nl_cmd_tunnel_create()
217 info->attrs[L2TP_ATTR_IP_DADDR]) { l2tp_nl_cmd_tunnel_create()
219 info->attrs[L2TP_ATTR_IP_SADDR]); l2tp_nl_cmd_tunnel_create()
221 info->attrs[L2TP_ATTR_IP_DADDR]); l2tp_nl_cmd_tunnel_create()
226 if (info->attrs[L2TP_ATTR_UDP_SPORT]) l2tp_nl_cmd_tunnel_create()
227 cfg.local_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_SPORT]); l2tp_nl_cmd_tunnel_create()
228 if (info->attrs[L2TP_ATTR_UDP_DPORT]) l2tp_nl_cmd_tunnel_create()
229 cfg.peer_udp_port = nla_get_u16(info->attrs[L2TP_ATTR_UDP_DPORT]); l2tp_nl_cmd_tunnel_create()
230 if (info->attrs[L2TP_ATTR_UDP_CSUM]) l2tp_nl_cmd_tunnel_create()
231 cfg.use_udp_checksums = nla_get_flag(info->attrs[L2TP_ATTR_UDP_CSUM]); l2tp_nl_cmd_tunnel_create()
234 if (info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX]) l2tp_nl_cmd_tunnel_create()
235 cfg.udp6_zero_tx_checksums = nla_get_flag(info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX]); l2tp_nl_cmd_tunnel_create()
236 if (info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX]) l2tp_nl_cmd_tunnel_create()
237 cfg.udp6_zero_rx_checksums = nla_get_flag(info->attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX]); l2tp_nl_cmd_tunnel_create()
241 if (info->attrs[L2TP_ATTR_DEBUG]) l2tp_nl_cmd_tunnel_create()
242 cfg.debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]); l2tp_nl_cmd_tunnel_create()
260 ret = l2tp_tunnel_notify(&l2tp_nl_family, info, l2tp_nl_cmd_tunnel_create()
266 static int l2tp_nl_cmd_tunnel_delete(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_tunnel_delete() argument
271 struct net *net = genl_info_net(info); l2tp_nl_cmd_tunnel_delete()
273 if (!info->attrs[L2TP_ATTR_CONN_ID]) { l2tp_nl_cmd_tunnel_delete()
277 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]); l2tp_nl_cmd_tunnel_delete()
285 l2tp_tunnel_notify(&l2tp_nl_family, info, l2tp_nl_cmd_tunnel_delete()
294 static int l2tp_nl_cmd_tunnel_modify(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_tunnel_modify() argument
299 struct net *net = genl_info_net(info); l2tp_nl_cmd_tunnel_modify()
301 if (!info->attrs[L2TP_ATTR_CONN_ID]) { l2tp_nl_cmd_tunnel_modify()
305 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]); l2tp_nl_cmd_tunnel_modify()
313 if (info->attrs[L2TP_ATTR_DEBUG]) l2tp_nl_cmd_tunnel_modify()
314 tunnel->debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]); l2tp_nl_cmd_tunnel_modify()
316 ret = l2tp_tunnel_notify(&l2tp_nl_family, info, l2tp_nl_cmd_tunnel_modify()
413 static int l2tp_nl_cmd_tunnel_get(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_tunnel_get() argument
419 struct net *net = genl_info_net(info); l2tp_nl_cmd_tunnel_get()
421 if (!info->attrs[L2TP_ATTR_CONN_ID]) { l2tp_nl_cmd_tunnel_get()
426 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]); l2tp_nl_cmd_tunnel_get()
440 ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq, l2tp_nl_cmd_tunnel_get()
445 return genlmsg_unicast(net, msg, info->snd_portid); l2tp_nl_cmd_tunnel_get()
479 static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_session_create() argument
488 struct net *net = genl_info_net(info); l2tp_nl_cmd_session_create()
490 if (!info->attrs[L2TP_ATTR_CONN_ID]) { l2tp_nl_cmd_session_create()
494 tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]); l2tp_nl_cmd_session_create()
501 if (!info->attrs[L2TP_ATTR_SESSION_ID]) { l2tp_nl_cmd_session_create()
505 session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]); l2tp_nl_cmd_session_create()
512 if (!info->attrs[L2TP_ATTR_PEER_SESSION_ID]) { l2tp_nl_cmd_session_create()
516 peer_session_id = nla_get_u32(info->attrs[L2TP_ATTR_PEER_SESSION_ID]); l2tp_nl_cmd_session_create()
518 if (!info->attrs[L2TP_ATTR_PW_TYPE]) { l2tp_nl_cmd_session_create()
522 cfg.pw_type = nla_get_u16(info->attrs[L2TP_ATTR_PW_TYPE]); l2tp_nl_cmd_session_create()
529 if (info->attrs[L2TP_ATTR_OFFSET]) l2tp_nl_cmd_session_create()
530 cfg.offset = nla_get_u16(info->attrs[L2TP_ATTR_OFFSET]); l2tp_nl_cmd_session_create()
532 if (info->attrs[L2TP_ATTR_DATA_SEQ]) l2tp_nl_cmd_session_create()
533 cfg.data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]); l2tp_nl_cmd_session_create()
536 if (info->attrs[L2TP_ATTR_L2SPEC_TYPE]) l2tp_nl_cmd_session_create()
537 cfg.l2specific_type = nla_get_u8(info->attrs[L2TP_ATTR_L2SPEC_TYPE]); l2tp_nl_cmd_session_create()
540 if (info->attrs[L2TP_ATTR_L2SPEC_LEN]) l2tp_nl_cmd_session_create()
541 cfg.l2specific_len = nla_get_u8(info->attrs[L2TP_ATTR_L2SPEC_LEN]); l2tp_nl_cmd_session_create()
543 if (info->attrs[L2TP_ATTR_COOKIE]) { l2tp_nl_cmd_session_create()
544 u16 len = nla_len(info->attrs[L2TP_ATTR_COOKIE]); l2tp_nl_cmd_session_create()
550 memcpy(&cfg.cookie[0], nla_data(info->attrs[L2TP_ATTR_COOKIE]), len); l2tp_nl_cmd_session_create()
552 if (info->attrs[L2TP_ATTR_PEER_COOKIE]) { l2tp_nl_cmd_session_create()
553 u16 len = nla_len(info->attrs[L2TP_ATTR_PEER_COOKIE]); l2tp_nl_cmd_session_create()
559 memcpy(&cfg.peer_cookie[0], nla_data(info->attrs[L2TP_ATTR_PEER_COOKIE]), len); l2tp_nl_cmd_session_create()
561 if (info->attrs[L2TP_ATTR_IFNAME]) l2tp_nl_cmd_session_create()
562 cfg.ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]); l2tp_nl_cmd_session_create()
564 if (info->attrs[L2TP_ATTR_VLAN_ID]) l2tp_nl_cmd_session_create()
565 cfg.vlan_id = nla_get_u16(info->attrs[L2TP_ATTR_VLAN_ID]); l2tp_nl_cmd_session_create()
568 if (info->attrs[L2TP_ATTR_DEBUG]) l2tp_nl_cmd_session_create()
569 cfg.debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]); l2tp_nl_cmd_session_create()
571 if (info->attrs[L2TP_ATTR_RECV_SEQ]) l2tp_nl_cmd_session_create()
572 cfg.recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]); l2tp_nl_cmd_session_create()
574 if (info->attrs[L2TP_ATTR_SEND_SEQ]) l2tp_nl_cmd_session_create()
575 cfg.send_seq = nla_get_u8(info->attrs[L2TP_ATTR_SEND_SEQ]); l2tp_nl_cmd_session_create()
577 if (info->attrs[L2TP_ATTR_LNS_MODE]) l2tp_nl_cmd_session_create()
578 cfg.lns_mode = nla_get_u8(info->attrs[L2TP_ATTR_LNS_MODE]); l2tp_nl_cmd_session_create()
580 if (info->attrs[L2TP_ATTR_RECV_TIMEOUT]) l2tp_nl_cmd_session_create()
581 cfg.reorder_timeout = nla_get_msecs(info->attrs[L2TP_ATTR_RECV_TIMEOUT]); l2tp_nl_cmd_session_create()
583 if (info->attrs[L2TP_ATTR_MTU]) l2tp_nl_cmd_session_create()
584 cfg.mtu = nla_get_u16(info->attrs[L2TP_ATTR_MTU]); l2tp_nl_cmd_session_create()
586 if (info->attrs[L2TP_ATTR_MRU]) l2tp_nl_cmd_session_create()
587 cfg.mru = nla_get_u16(info->attrs[L2TP_ATTR_MRU]); l2tp_nl_cmd_session_create()
607 if (!info->attrs[L2TP_ATTR_VLAN_ID]) { l2tp_nl_cmd_session_create()
631 ret = l2tp_session_notify(&l2tp_nl_family, info, session, l2tp_nl_cmd_session_create()
639 static int l2tp_nl_cmd_session_delete(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_session_delete() argument
645 session = l2tp_nl_session_find(info); l2tp_nl_cmd_session_delete()
651 l2tp_session_notify(&l2tp_nl_family, info, l2tp_nl_cmd_session_delete()
663 static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_session_modify() argument
668 session = l2tp_nl_session_find(info); l2tp_nl_cmd_session_modify()
674 if (info->attrs[L2TP_ATTR_DEBUG]) l2tp_nl_cmd_session_modify()
675 session->debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]); l2tp_nl_cmd_session_modify()
677 if (info->attrs[L2TP_ATTR_DATA_SEQ]) l2tp_nl_cmd_session_modify()
678 session->data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]); l2tp_nl_cmd_session_modify()
680 if (info->attrs[L2TP_ATTR_RECV_SEQ]) l2tp_nl_cmd_session_modify()
681 session->recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]); l2tp_nl_cmd_session_modify()
683 if (info->attrs[L2TP_ATTR_SEND_SEQ]) { l2tp_nl_cmd_session_modify()
684 session->send_seq = nla_get_u8(info->attrs[L2TP_ATTR_SEND_SEQ]); l2tp_nl_cmd_session_modify()
688 if (info->attrs[L2TP_ATTR_LNS_MODE]) l2tp_nl_cmd_session_modify()
689 session->lns_mode = nla_get_u8(info->attrs[L2TP_ATTR_LNS_MODE]); l2tp_nl_cmd_session_modify()
691 if (info->attrs[L2TP_ATTR_RECV_TIMEOUT]) l2tp_nl_cmd_session_modify()
692 session->reorder_timeout = nla_get_msecs(info->attrs[L2TP_ATTR_RECV_TIMEOUT]); l2tp_nl_cmd_session_modify()
694 if (info->attrs[L2TP_ATTR_MTU]) l2tp_nl_cmd_session_modify()
695 session->mtu = nla_get_u16(info->attrs[L2TP_ATTR_MTU]); l2tp_nl_cmd_session_modify()
697 if (info->attrs[L2TP_ATTR_MRU]) l2tp_nl_cmd_session_modify()
698 session->mru = nla_get_u16(info->attrs[L2TP_ATTR_MRU]); l2tp_nl_cmd_session_modify()
700 ret = l2tp_session_notify(&l2tp_nl_family, info, l2tp_nl_cmd_session_modify()
783 static int l2tp_nl_cmd_session_get(struct sk_buff *skb, struct genl_info *info) l2tp_nl_cmd_session_get() argument
789 session = l2tp_nl_session_find(info); l2tp_nl_cmd_session_get()
801 ret = l2tp_nl_session_send(msg, info->snd_portid, info->snd_seq, l2tp_nl_cmd_session_get()
806 return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid); l2tp_nl_cmd_session_get()
112 l2tp_tunnel_notify(struct genl_family *family, struct genl_info *info, struct l2tp_tunnel *tunnel, u8 cmd) l2tp_tunnel_notify() argument
140 l2tp_session_notify(struct genl_family *family, struct genl_info *info, struct l2tp_session *session, u8 cmd) l2tp_session_notify() argument
/linux-4.4.14/drivers/ata/
H A Dpata_at32.c92 struct at32_ide_info *info, pata_at32_setup_timing()
95 struct smc_config *smc = &info->smc; pata_at32_setup_timing()
144 return smc_set_configuration(info->cs, smc); pata_at32_setup_timing()
153 struct at32_ide_info *info = ap->host->private_data; pata_at32_set_piomode() local
165 ret = pata_at32_setup_timing(ap->dev, info, &timing); pata_at32_set_piomode()
183 struct at32_ide_info *info) pata_at32_init_one()
211 ap->ioaddr.altstatus_addr = info->alt_addr + (0x06 << 1); pata_at32_init_one()
212 ap->ioaddr.ctl_addr = info->alt_addr + (0x06 << 1); pata_at32_init_one()
214 ap->ioaddr.data_addr = info->ide_addr + (ATA_REG_DATA << 1); pata_at32_init_one()
215 ap->ioaddr.error_addr = info->ide_addr + (ATA_REG_ERR << 1); pata_at32_init_one()
216 ap->ioaddr.feature_addr = info->ide_addr + (ATA_REG_FEATURE << 1); pata_at32_init_one()
217 ap->ioaddr.nsect_addr = info->ide_addr + (ATA_REG_NSECT << 1); pata_at32_init_one()
218 ap->ioaddr.lbal_addr = info->ide_addr + (ATA_REG_LBAL << 1); pata_at32_init_one()
219 ap->ioaddr.lbam_addr = info->ide_addr + (ATA_REG_LBAM << 1); pata_at32_init_one()
220 ap->ioaddr.lbah_addr = info->ide_addr + (ATA_REG_LBAH << 1); pata_at32_init_one()
221 ap->ioaddr.device_addr = info->ide_addr + (ATA_REG_DEVICE << 1); pata_at32_init_one()
222 ap->ioaddr.status_addr = info->ide_addr + (ATA_REG_STATUS << 1); pata_at32_init_one()
223 ap->ioaddr.command_addr = info->ide_addr + (ATA_REG_CMD << 1); pata_at32_init_one()
225 /* Set info as private data of ATA host */ pata_at32_init_one()
226 host->private_data = info; pata_at32_init_one()
229 return ata_host_activate(host, info->irq, ata_sff_interrupt, pata_at32_init_one()
241 struct at32_ide_info *info) pata_at32_debug_bus()
249 iowrite8(d1, info->alt_addr + (0x06 << 1)); pata_at32_debug_bus()
250 iowrite8(d2, info->alt_addr + (0x06 << 1)); pata_at32_debug_bus()
253 iowrite8(d1, info->ide_addr + (i << 1)); pata_at32_debug_bus()
254 iowrite8(d2, info->ide_addr + (i << 1)); pata_at32_debug_bus()
258 iowrite16(d1, info->ide_addr); pata_at32_debug_bus()
259 iowrite16(d1 << 8, info->ide_addr); pata_at32_debug_bus()
261 iowrite16(d1, info->ide_addr); pata_at32_debug_bus()
262 iowrite16(d1 << 8, info->ide_addr); pata_at32_debug_bus()
273 struct at32_ide_info *info; pata_at32_probe() local
293 info = kzalloc(sizeof(struct at32_ide_info), GFP_KERNEL); pata_at32_probe()
294 if (!info) pata_at32_probe()
297 info->irq = irq; pata_at32_probe()
298 info->cs = board->cs; pata_at32_probe()
301 info->res_ide.start = res->start + CF_IDE_OFFSET; pata_at32_probe()
302 info->res_ide.end = info->res_ide.start + CF_RES_SIZE - 1; pata_at32_probe()
303 info->res_ide.name = "ide"; pata_at32_probe()
304 info->res_ide.flags = IORESOURCE_MEM; pata_at32_probe()
306 ret = request_resource(res, &info->res_ide); pata_at32_probe()
310 info->res_alt.start = res->start + CF_ALT_IDE_OFFSET; pata_at32_probe()
311 info->res_alt.end = info->res_alt.start + CF_RES_SIZE - 1; pata_at32_probe()
312 info->res_alt.name = "alt"; pata_at32_probe()
313 info->res_alt.flags = IORESOURCE_MEM; pata_at32_probe()
315 ret = request_resource(res, &info->res_alt); pata_at32_probe()
320 info->smc.bus_width = 2; /* 16 bit data bus */ pata_at32_probe()
321 info->smc.nrd_controlled = 1; /* Sample data on rising edge of NRD */ pata_at32_probe()
322 info->smc.nwe_controlled = 0; /* Drive data on falling edge of NCS */ pata_at32_probe()
323 info->smc.nwait_mode = 3; /* NWAIT is in READY mode */ pata_at32_probe()
324 info->smc.byte_write = 0; /* Byte select access type */ pata_at32_probe()
325 info->smc.tdf_mode = 0; /* TDF optimization disabled */ pata_at32_probe()
326 info->smc.tdf_cycles = 0; /* No TDF wait cycles */ pata_at32_probe()
329 ret = pata_at32_setup_timing(dev, info, &initial_timing); pata_at32_probe()
335 info->ide_addr = devm_ioremap(dev, info->res_ide.start, 16); pata_at32_probe()
336 info->alt_addr = devm_ioremap(dev, info->res_alt.start, 16); pata_at32_probe()
337 if (!info->ide_addr || !info->alt_addr) pata_at32_probe()
341 pata_at32_debug_bus(dev, info); pata_at32_probe()
345 ret = pata_at32_init_one(dev, info); pata_at32_probe()
354 release_resource(&info->res_alt); pata_at32_probe()
356 release_resource(&info->res_ide); pata_at32_probe()
358 kfree(info); pata_at32_probe()
366 struct at32_ide_info *info; pata_at32_remove() local
371 info = host->private_data; pata_at32_remove()
374 if (!info) pata_at32_remove()
377 release_resource(&info->res_ide); pata_at32_remove()
378 release_resource(&info->res_alt); pata_at32_remove()
380 kfree(info); pata_at32_remove()
91 pata_at32_setup_timing(struct device *dev, struct at32_ide_info *info, const struct ata_timing *ata) pata_at32_setup_timing() argument
182 pata_at32_init_one(struct device *dev, struct at32_ide_info *info) pata_at32_init_one() argument
240 pata_at32_debug_bus(struct device *dev, struct at32_ide_info *info) pata_at32_debug_bus() argument
/linux-4.4.14/drivers/media/platform/blackfin/
H A Dppi.c51 const struct ppi_info *info = ppi->info; ppi_irq_err() local
53 switch (info->type) { ppi_irq_err()
56 struct bfin_ppi_regs *reg = info->base; ppi_irq_err()
70 struct bfin_eppi_regs *reg = info->base; ppi_irq_err()
81 struct bfin_eppi3_regs *reg = info->base; ppi_irq_err()
99 const struct ppi_info *info = ppi->info; ppi_attach_irq() local
102 ret = request_dma(info->dma_ch, "PPI_DMA"); ppi_attach_irq()
108 set_dma_callback(info->dma_ch, handler, ppi); ppi_attach_irq()
111 ret = request_irq(info->irq_err, ppi_irq_err, 0, "PPI ERROR", ppi); ppi_attach_irq()
114 free_dma(info->dma_ch); ppi_attach_irq()
122 const struct ppi_info *info = ppi->info; ppi_detach_irq() local
125 free_irq(info->irq_err, ppi); ppi_detach_irq()
126 free_dma(info->dma_ch); ppi_detach_irq()
131 const struct ppi_info *info = ppi->info; ppi_start() local
134 enable_dma(info->dma_ch); ppi_start()
138 switch (info->type) { ppi_start()
141 struct bfin_ppi_regs *reg = info->base; ppi_start()
147 struct bfin_eppi_regs *reg = info->base; ppi_start()
153 struct bfin_eppi3_regs *reg = info->base; ppi_start()
167 const struct ppi_info *info = ppi->info; ppi_stop() local
171 switch (info->type) { ppi_stop()
174 struct bfin_ppi_regs *reg = info->base; ppi_stop()
180 struct bfin_eppi_regs *reg = info->base; ppi_stop()
186 struct bfin_eppi3_regs *reg = info->base; ppi_stop()
195 clear_dma_irqstat(info->dma_ch); ppi_stop()
196 disable_dma(info->dma_ch); ppi_stop()
204 const struct ppi_info *info = ppi->info; ppi_set_params() local
237 switch (info->type) { ppi_set_params()
240 struct bfin_ppi_regs *reg = info->base; ppi_set_params()
252 struct bfin_eppi_regs *reg = info->base; ppi_set_params()
269 struct bfin_eppi3_regs *reg = info->base; ppi_set_params()
304 set_dma_x_count(info->dma_ch, bytes_per_line >> 2); ppi_set_params()
305 set_dma_x_modify(info->dma_ch, 4); ppi_set_params()
306 set_dma_y_modify(info->dma_ch, 4); ppi_set_params()
309 set_dma_x_count(info->dma_ch, bytes_per_line >> 1); ppi_set_params()
310 set_dma_x_modify(info->dma_ch, 2); ppi_set_params()
311 set_dma_y_modify(info->dma_ch, 2); ppi_set_params()
313 set_dma_y_count(info->dma_ch, params->height); ppi_set_params()
314 set_dma_config(info->dma_ch, dma_config); ppi_set_params()
322 set_dma_start_addr(ppi->info->dma_ch, addr); ppi_update_addr()
326 const struct ppi_info *info) ppi_create_instance()
330 if (!info || !info->pin_req) ppi_create_instance()
334 if (peripheral_request_list(info->pin_req, KBUILD_MODNAME)) { ppi_create_instance()
342 peripheral_free_list(info->pin_req); ppi_create_instance()
347 ppi->info = info; ppi_create_instance()
357 peripheral_free_list(ppi->info->pin_req); ppi_delete_instance()
325 ppi_create_instance(struct platform_device *pdev, const struct ppi_info *info) ppi_create_instance() argument
/linux-4.4.14/drivers/pinctrl/
H A Dpinctrl-lantiq.c23 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_get_group_count() local
24 return info->num_grps; ltq_get_group_count()
30 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_get_group_name() local
31 if (selector >= info->num_grps) ltq_get_group_name()
33 return info->grps[selector].name; ltq_get_group_name()
41 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_get_group_pins() local
42 if (selector >= info->num_grps) ltq_get_group_pins()
44 *pins = info->grps[selector].pins; ltq_get_group_pins()
45 *num_pins = info->grps[selector].npins; ltq_get_group_pins()
72 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctldev); ltq_pinctrl_dt_subnode_to_map() local
105 for (i = 0; i < info->num_params; i++) { ltq_pinctrl_dt_subnode_to_map()
108 info->params[i].property, &val); ltq_pinctrl_dt_subnode_to_map()
111 LTQ_PINCONF_PACK(info->params[i].param, ltq_pinctrl_dt_subnode_to_map()
184 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_pmx_func_count() local
186 return info->num_funcs; ltq_pmx_func_count()
192 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_pmx_func_name() local
194 if (selector >= info->num_funcs) ltq_pmx_func_name()
197 return info->funcs[selector].name; ltq_pmx_func_name()
205 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_pmx_get_groups() local
207 *groups = info->funcs[func].groups; ltq_pmx_get_groups()
208 *num_groups = info->funcs[func].num_groups; ltq_pmx_get_groups()
227 static int match_mfp(const struct ltq_pinmux_info *info, int pin) match_mfp() argument
230 for (i = 0; i < info->num_mfp; i++) { match_mfp()
231 if (info->mfp[i].pin == pin) match_mfp()
239 const struct ltq_pinmux_info *info, match_group_mux()
244 pin = match_mfp(info, grp->pins[i]); match_group_mux()
246 dev_err(info->dev, "could not find mfp for pin %d\n", match_group_mux()
250 ret = match_mux(&info->mfp[pin], mux); match_group_mux()
252 dev_err(info->dev, "Can't find mux %d on pin%d\n", match_group_mux()
264 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_pmx_set() local
265 const struct ltq_pin_group *pin_grp = &info->grps[group]; ltq_pmx_set()
269 (match_group_mux(pin_grp, info, pin_grp->mux) < 0)) { ltq_pmx_set()
270 dev_err(info->dev, "Failed to set the pin group: %s\n", ltq_pmx_set()
271 info->grps[group].name); ltq_pmx_set()
275 pin = match_mfp(info, pin_grp->pins[i]); ltq_pmx_set()
277 dev_err(info->dev, "could not find mfp for pin %d\n", ltq_pmx_set()
281 pin_func = match_mux(&info->mfp[pin], pin_grp->mux); ltq_pmx_set()
282 ret = info->apply_mux(pctrldev, pin, pin_func); ltq_pmx_set()
284 dev_err(info->dev, ltq_pmx_set()
297 struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); ltq_pmx_gpio_request_enable() local
298 int mfp = match_mfp(info, pin); ltq_pmx_gpio_request_enable()
302 dev_err(info->dev, "could not find mfp for pin %d\n", pin); ltq_pmx_gpio_request_enable()
306 pin_func = match_mux(&info->mfp[mfp], 0); ltq_pmx_gpio_request_enable()
308 dev_err(info->dev, "No GPIO function on pin%d\n", mfp); ltq_pmx_gpio_request_enable()
312 return info->apply_mux(pctrldev, mfp, pin_func); ltq_pmx_gpio_request_enable()
328 struct ltq_pinmux_info *info) ltq_pinctrl_register()
332 if (!info) ltq_pinctrl_register()
334 desc = info->desc; ltq_pinctrl_register()
337 info->dev = &pdev->dev; ltq_pinctrl_register()
339 info->pctrl = pinctrl_register(desc, &pdev->dev, info); ltq_pinctrl_register()
340 if (IS_ERR(info->pctrl)) { ltq_pinctrl_register()
342 return PTR_ERR(info->pctrl); ltq_pinctrl_register()
344 platform_set_drvdata(pdev, info); ltq_pinctrl_register()
238 match_group_mux(const struct ltq_pin_group *grp, const struct ltq_pinmux_info *info, unsigned mux) match_group_mux() argument
327 ltq_pinctrl_register(struct platform_device *pdev, struct ltq_pinmux_info *info) ltq_pinctrl_register() argument
/linux-4.4.14/drivers/video/fbdev/nvidia/
H A Dnv_accel.c72 static inline void nvidiafb_safe_mode(struct fb_info *info) nvidiafb_safe_mode() argument
74 struct nvidia_par *par = info->par; nvidiafb_safe_mode()
77 info->pixmap.scan_align = 1; nvidiafb_safe_mode()
81 static inline void NVFlush(struct fb_info *info) NVFlush() argument
83 struct nvidia_par *par = info->par; NVFlush()
90 nvidiafb_safe_mode(info); NVFlush()
94 static inline void NVSync(struct fb_info *info) NVSync() argument
96 struct nvidia_par *par = info->par; NVSync()
103 nvidiafb_safe_mode(info); NVSync()
115 static void NVDmaWait(struct fb_info *info, int size) NVDmaWait() argument
117 struct nvidia_par *par = info->par; NVDmaWait()
151 nvidiafb_safe_mode(info); NVDmaWait()
155 static void NVSetPattern(struct fb_info *info, u32 clr0, u32 clr1, NVSetPattern() argument
158 struct nvidia_par *par = info->par; NVSetPattern()
160 NVDmaStart(info, par, PATTERN_COLOR_0, 4); NVSetPattern()
167 static void NVSetRopSolid(struct fb_info *info, u32 rop, u32 planemask) NVSetRopSolid() argument
169 struct nvidia_par *par = info->par; NVSetRopSolid()
172 NVSetPattern(info, 0, planemask, ~0, ~0); NVSetRopSolid()
174 NVDmaStart(info, par, ROP_SET, 1); NVSetRopSolid()
180 NVSetPattern(info, ~0, ~0, ~0, ~0); NVSetRopSolid()
181 NVDmaStart(info, par, ROP_SET, 1); NVSetRopSolid()
187 static void NVSetClippingRectangle(struct fb_info *info, int x1, int y1, NVSetClippingRectangle() argument
190 struct nvidia_par *par = info->par; NVSetClippingRectangle()
194 NVDmaStart(info, par, CLIP_POINT, 2); NVSetClippingRectangle()
199 void NVResetGraphics(struct fb_info *info) NVResetGraphics() argument
201 struct nvidia_par *par = info->par; NVResetGraphics()
205 pitch = info->fix.line_length; NVResetGraphics()
234 switch (info->var.bits_per_pixel) { NVResetGraphics()
256 NVDmaStart(info, par, SURFACE_FORMAT, 4); NVResetGraphics()
262 NVDmaStart(info, par, PATTERN_FORMAT, 1); NVResetGraphics()
265 NVDmaStart(info, par, RECT_FORMAT, 1); NVResetGraphics()
268 NVDmaStart(info, par, LINE_FORMAT, 1); NVResetGraphics()
272 NVSetRopSolid(info, ROP_COPY, ~0); NVResetGraphics()
274 NVSetClippingRectangle(info, 0, 0, info->var.xres_virtual, NVResetGraphics()
275 info->var.yres_virtual); NVResetGraphics()
280 int nvidiafb_sync(struct fb_info *info) nvidiafb_sync() argument
282 struct nvidia_par *par = info->par; nvidiafb_sync()
284 if (info->state != FBINFO_STATE_RUNNING) nvidiafb_sync()
288 NVFlush(info); nvidiafb_sync()
291 NVSync(info); nvidiafb_sync()
296 void nvidiafb_copyarea(struct fb_info *info, const struct fb_copyarea *region) nvidiafb_copyarea() argument
298 struct nvidia_par *par = info->par; nvidiafb_copyarea()
300 if (info->state != FBINFO_STATE_RUNNING) nvidiafb_copyarea()
304 cfb_copyarea(info, region); nvidiafb_copyarea()
308 NVDmaStart(info, par, BLIT_POINT_SRC, 3); nvidiafb_copyarea()
316 void nvidiafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) nvidiafb_fillrect() argument
318 struct nvidia_par *par = info->par; nvidiafb_fillrect()
321 if (info->state != FBINFO_STATE_RUNNING) nvidiafb_fillrect()
325 cfb_fillrect(info, rect); nvidiafb_fillrect()
329 if (info->var.bits_per_pixel == 8) nvidiafb_fillrect()
332 color = ((u32 *) info->pseudo_palette)[rect->color]; nvidiafb_fillrect()
335 NVSetRopSolid(info, rect->rop, ~0); nvidiafb_fillrect()
337 NVDmaStart(info, par, RECT_SOLID_COLOR, 1); nvidiafb_fillrect()
340 NVDmaStart(info, par, RECT_SOLID_RECTS(0), 2); nvidiafb_fillrect()
347 NVSetRopSolid(info, ROP_COPY, ~0); nvidiafb_fillrect()
350 static void nvidiafb_mono_color_expand(struct fb_info *info, nvidiafb_mono_color_expand() argument
353 struct nvidia_par *par = info->par; nvidiafb_mono_color_expand()
354 u32 fg, bg, mask = ~(~0 >> (32 - info->var.bits_per_pixel)); nvidiafb_mono_color_expand()
361 if (info->var.bits_per_pixel == 8) { nvidiafb_mono_color_expand()
365 fg = ((u32 *) info->pseudo_palette)[image->fg_color] | mask; nvidiafb_mono_color_expand()
366 bg = ((u32 *) info->pseudo_palette)[image->bg_color] | mask; nvidiafb_mono_color_expand()
369 NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_CLIP, 7); nvidiafb_mono_color_expand()
380 NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0), nvidiafb_mono_color_expand()
393 NVDmaStart(info, par, RECT_EXPAND_TWO_COLOR_DATA(0), dsize); nvidiafb_mono_color_expand()
405 void nvidiafb_imageblit(struct fb_info *info, const struct fb_image *image) nvidiafb_imageblit() argument
407 struct nvidia_par *par = info->par; nvidiafb_imageblit()
409 if (info->state != FBINFO_STATE_RUNNING) nvidiafb_imageblit()
413 nvidiafb_mono_color_expand(info, image); nvidiafb_imageblit()
415 cfb_imageblit(info, image); nvidiafb_imageblit()
H A Dnvidia.c297 static int nvidia_calc_regs(struct fb_info *info) nvidia_calc_regs() argument
299 struct nvidia_par *par = info->par; nvidia_calc_regs()
301 int i, depth = fb_get_color_depth(&info->var, &info->fix); nvidia_calc_regs()
302 int h_display = info->var.xres / 8 - 1; nvidia_calc_regs()
303 int h_start = (info->var.xres + info->var.right_margin) / 8 - 1; nvidia_calc_regs()
304 int h_end = (info->var.xres + info->var.right_margin + nvidia_calc_regs()
305 info->var.hsync_len) / 8 - 1; nvidia_calc_regs()
306 int h_total = (info->var.xres + info->var.right_margin + nvidia_calc_regs()
307 info->var.hsync_len + info->var.left_margin) / 8 - 5; nvidia_calc_regs()
310 int v_display = info->var.yres - 1; nvidia_calc_regs()
311 int v_start = info->var.yres + info->var.lower_margin - 1; nvidia_calc_regs()
312 int v_end = (info->var.yres + info->var.lower_margin + nvidia_calc_regs()
313 info->var.vsync_len) - 1; nvidia_calc_regs()
314 int v_total = (info->var.yres + info->var.lower_margin + nvidia_calc_regs()
315 info->var.vsync_len + info->var.upper_margin) - 2; nvidia_calc_regs()
323 if (info->var.vmode & FB_VMODE_INTERLACED) nvidia_calc_regs()
354 | ((info->var.vmode & FB_VMODE_DOUBLE) ? 0x80 : 0x00); nvidia_calc_regs()
358 state->crtc[0x13] = ((info->var.xres_virtual / 8) * nvidia_calc_regs()
359 (info->var.bits_per_pixel / 8)); nvidia_calc_regs()
384 if (info->var.vmode & FB_VMODE_INTERLACED) { nvidia_calc_regs()
402 par->CURSOR = (volatile u32 __iomem *)(info->screen_base + nvidia_calc_regs()
405 if (info->var.sync & FB_SYNC_HOR_HIGH_ACT) nvidia_calc_regs()
409 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) nvidia_calc_regs()
414 NVCalcStateExt(par, state, i, info->var.xres_virtual, nvidia_calc_regs()
415 info->var.xres, info->var.yres_virtual, nvidia_calc_regs()
416 1000000000 / info->var.pixclock, info->var.vmode); nvidia_calc_regs()
422 if (!par->fpScaler || (par->fpWidth <= info->var.xres) nvidia_calc_regs()
423 || (par->fpHeight <= info->var.yres)) { nvidia_calc_regs()
462 if (info->var.vmode & FB_VMODE_DOUBLE) nvidia_calc_regs()
489 state->displayV = info->var.xres; nvidia_calc_regs()
494 static void nvidia_init_vga(struct fb_info *info) nvidia_init_vga() argument
496 struct nvidia_par *par = info->par; nvidia_init_vga()
529 static int nvidiafb_cursor(struct fb_info *info, struct fb_cursor *cursor) nvidiafb_cursor() argument
531 struct nvidia_par *par = info->par; nvidiafb_cursor()
552 yy = cursor->image.dy - info->var.yoffset; nvidiafb_cursor()
553 xx = cursor->image.dx - info->var.xoffset; nvidiafb_cursor()
587 bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) | nvidiafb_cursor()
588 ((info->cmap.green[bg_idx] & 0xf8) << 2) | nvidiafb_cursor()
589 ((info->cmap.blue[bg_idx] & 0xf8) >> 3) | 1 << 15; nvidiafb_cursor()
591 fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) | nvidiafb_cursor()
592 ((info->cmap.green[fg_idx] & 0xf8) << 2) | nvidiafb_cursor()
593 ((info->cmap.blue[fg_idx] & 0xf8) >> 3) | 1 << 15; nvidiafb_cursor()
610 static int nvidiafb_set_par(struct fb_info *info) nvidiafb_set_par() argument
612 struct nvidia_par *par = info->par; nvidiafb_set_par()
630 info->fix.visual = (info->var.bits_per_pixel == 8) ? nvidiafb_set_par()
633 nvidia_init_vga(info); nvidiafb_set_par()
634 nvidia_calc_regs(info); nvidiafb_set_par()
660 info->fix.line_length = (info->var.xres_virtual * nvidiafb_set_par()
661 info->var.bits_per_pixel) >> 3; nvidiafb_set_par()
662 if (info->var.accel_flags) { nvidiafb_set_par()
663 info->fbops->fb_imageblit = nvidiafb_imageblit; nvidiafb_set_par()
664 info->fbops->fb_fillrect = nvidiafb_fillrect; nvidiafb_set_par()
665 info->fbops->fb_copyarea = nvidiafb_copyarea; nvidiafb_set_par()
666 info->fbops->fb_sync = nvidiafb_sync; nvidiafb_set_par()
667 info->pixmap.scan_align = 4; nvidiafb_set_par()
668 info->flags &= ~FBINFO_HWACCEL_DISABLED; nvidiafb_set_par()
669 info->flags |= FBINFO_READS_FAST; nvidiafb_set_par()
670 NVResetGraphics(info); nvidiafb_set_par()
672 info->fbops->fb_imageblit = cfb_imageblit; nvidiafb_set_par()
673 info->fbops->fb_fillrect = cfb_fillrect; nvidiafb_set_par()
674 info->fbops->fb_copyarea = cfb_copyarea; nvidiafb_set_par()
675 info->fbops->fb_sync = NULL; nvidiafb_set_par()
676 info->pixmap.scan_align = 1; nvidiafb_set_par()
677 info->flags |= FBINFO_HWACCEL_DISABLED; nvidiafb_set_par()
678 info->flags &= ~FBINFO_READS_FAST; nvidiafb_set_par()
687 btext_update_display(info->fix.smem_start, nvidiafb_set_par()
688 info->var.xres, info->var.yres, nvidiafb_set_par()
689 info->var.bits_per_pixel, info->fix.line_length); nvidiafb_set_par()
699 struct fb_info *info) nvidiafb_setcolreg()
701 struct nvidia_par *par = info->par; nvidiafb_setcolreg()
705 if (regno >= (1 << info->var.green.length)) nvidiafb_setcolreg()
708 if (info->var.grayscale) { nvidiafb_setcolreg()
713 if (regno < 16 && info->fix.visual == FB_VISUAL_DIRECTCOLOR) { nvidiafb_setcolreg()
714 ((u32 *) info->pseudo_palette)[regno] = nvidiafb_setcolreg()
715 (regno << info->var.red.offset) | nvidiafb_setcolreg()
716 (regno << info->var.green.offset) | nvidiafb_setcolreg()
717 (regno << info->var.blue.offset); nvidiafb_setcolreg()
720 switch (info->var.bits_per_pixel) { nvidiafb_setcolreg()
726 if (info->var.green.length == 5) { nvidiafb_setcolreg()
762 struct fb_info *info) nvidiafb_check_var()
764 struct nvidia_par *par = info->par; nvidiafb_check_var()
820 if (!info->monspecs.hfmax || !info->monspecs.vfmax || nvidiafb_check_var()
821 !info->monspecs.dclkmax || !fb_validate_mode(var, info)) nvidiafb_check_var()
825 if (!mode_valid && info->monspecs.gtf) { nvidiafb_check_var()
826 if (!fb_get_mode(FB_MAXTIMINGS, 0, var, info)) nvidiafb_check_var()
833 mode = fb_find_best_mode(var, &info->modelist); nvidiafb_check_var()
840 if (!mode_valid && info->monspecs.modedb_len) nvidiafb_check_var()
855 mode = fb_find_best_mode(var, &info->modelist); nvidiafb_check_var()
873 vramlen = info->screen_size; nvidiafb_check_var()
915 struct fb_info *info) nvidiafb_pan_display()
917 struct nvidia_par *par = info->par; nvidiafb_pan_display()
920 total = var->yoffset * info->fix.line_length + var->xoffset; nvidiafb_pan_display()
927 static int nvidiafb_blank(int blank, struct fb_info *info) nvidiafb_blank() argument
929 struct nvidia_par *par = info->par; nvidiafb_blank()
994 static int nvidiafb_open(struct fb_info *info, int user) nvidiafb_open() argument
996 struct nvidia_par *par = info->par; nvidiafb_open()
1007 static int nvidiafb_release(struct fb_info *info, int user) nvidiafb_release() argument
1009 struct nvidia_par *par = info->par; nvidiafb_release()
1046 struct fb_info *info = pci_get_drvdata(dev); nvidiafb_suspend() local
1047 struct nvidia_par *par = info->par; nvidiafb_suspend()
1055 fb_set_suspend(info, 1); nvidiafb_suspend()
1056 nvidiafb_blank(FB_BLANK_POWERDOWN, info); nvidiafb_suspend()
1070 struct fb_info *info = pci_get_drvdata(dev); nvidiafb_resume() local
1071 struct nvidia_par *par = info->par; nvidiafb_resume()
1086 nvidiafb_set_par(info); nvidiafb_resume()
1087 fb_set_suspend (info, 0); nvidiafb_resume()
1088 nvidiafb_blank(FB_BLANK_UNBLANK, info); nvidiafb_resume()
1099 static int nvidia_set_fbinfo(struct fb_info *info) nvidia_set_fbinfo() argument
1101 struct fb_monspecs *specs = &info->monspecs; nvidia_set_fbinfo()
1103 struct nvidia_par *par = info->par; nvidia_set_fbinfo()
1107 info->flags = FBINFO_DEFAULT nvidia_set_fbinfo()
1113 fb_videomode_to_modelist(info->monspecs.modedb, nvidia_set_fbinfo()
1114 info->monspecs.modedb_len, &info->modelist); nvidia_set_fbinfo()
1132 mode = fb_find_best_display(specs, &info->modelist); nvidia_set_fbinfo()
1140 fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb, nvidia_set_fbinfo()
1145 fb_find_mode(&nvidiafb_default_var, info, mode_option, nvidia_set_fbinfo()
1148 info->var = nvidiafb_default_var; nvidia_set_fbinfo()
1149 info->fix.visual = (info->var.bits_per_pixel == 8) ? nvidia_set_fbinfo()
1151 info->pseudo_palette = par->pseudo_palette; nvidia_set_fbinfo()
1152 fb_alloc_cmap(&info->cmap, 256, 0); nvidia_set_fbinfo()
1153 fb_destroy_modedb(info->monspecs.modedb); nvidia_set_fbinfo()
1154 info->monspecs.modedb = NULL; nvidia_set_fbinfo()
1157 lpitch = info->var.xres_virtual * nvidia_set_fbinfo()
1158 ((info->var.bits_per_pixel + 7) >> 3); nvidia_set_fbinfo()
1159 info->var.yres_virtual = info->screen_size / lpitch; nvidia_set_fbinfo()
1161 info->pixmap.scan_align = 4; nvidia_set_fbinfo()
1162 info->pixmap.buf_align = 4; nvidia_set_fbinfo()
1163 info->pixmap.access_align = 32; nvidia_set_fbinfo()
1164 info->pixmap.size = 8 * 1024; nvidia_set_fbinfo()
1165 info->pixmap.flags = FB_PIXMAP_SYSTEM; nvidia_set_fbinfo()
1168 info->fbops->fb_cursor = NULL; nvidia_set_fbinfo()
1170 info->var.accel_flags = (!noaccel); nvidia_set_fbinfo()
1174 info->fix.accel = FB_ACCEL_NV4; nvidia_set_fbinfo()
1177 info->fix.accel = FB_ACCEL_NV_10; nvidia_set_fbinfo()
1180 info->fix.accel = FB_ACCEL_NV_20; nvidia_set_fbinfo()
1183 info->fix.accel = FB_ACCEL_NV_30; nvidia_set_fbinfo()
1186 info->fix.accel = FB_ACCEL_NV_40; nvidia_set_fbinfo()
1192 return nvidiafb_check_var(&info->var, info); nvidia_set_fbinfo()
1195 static u32 nvidia_get_chipset(struct fb_info *info) nvidia_get_chipset() argument
1197 struct nvidia_par *par = info->par; nvidia_get_chipset()
1218 static u32 nvidia_get_arch(struct fb_info *info) nvidia_get_arch() argument
1220 struct nvidia_par *par = info->par; nvidia_get_arch()
1273 struct fb_info *info; nvidiafb_probe() local
1280 info = framebuffer_alloc(sizeof(struct nvidia_par), &pd->dev); nvidiafb_probe()
1282 if (!info) nvidiafb_probe()
1285 par = info->par; nvidiafb_probe()
1287 info->pixmap.addr = kzalloc(8 * 1024, GFP_KERNEL); nvidiafb_probe()
1289 if (info->pixmap.addr == NULL) nvidiafb_probe()
1328 par->Chipset = nvidia_get_chipset(info); nvidiafb_probe()
1329 par->Architecture = nvidia_get_arch(info); nvidiafb_probe()
1338 if (NVCommonSetup(info)) nvidiafb_probe()
1359 info->screen_base = ioremap_wc(nvidiafb_fix.smem_start, nvidiafb_probe()
1361 info->screen_size = par->FbUsableSize; nvidiafb_probe()
1364 if (!info->screen_base) { nvidiafb_probe()
1369 par->FbStart = info->screen_base; nvidiafb_probe()
1375 info->fbops = &nvidia_fb_ops; nvidiafb_probe()
1376 info->fix = nvidiafb_fix; nvidiafb_probe()
1378 if (nvidia_set_fbinfo(info) < 0) { nvidiafb_probe()
1385 pci_set_drvdata(pd, info); nvidiafb_probe()
1390 if (register_framebuffer(info) < 0) { nvidiafb_probe()
1398 info->fix.id, nvidiafb_probe()
1399 par->FbMapSize / (1024 * 1024), info->fix.smem_start); nvidiafb_probe()
1405 iounmap(info->screen_base); nvidiafb_probe()
1407 fb_destroy_modedb(info->monspecs.modedb); nvidiafb_probe()
1414 kfree(info->pixmap.addr); nvidiafb_probe()
1416 framebuffer_release(info); nvidiafb_probe()
1423 struct fb_info *info = pci_get_drvdata(pd); nvidiafb_remove() local
1424 struct nvidia_par *par = info->par; nvidiafb_remove()
1428 unregister_framebuffer(info); nvidiafb_remove()
1432 iounmap(info->screen_base); nvidiafb_remove()
1433 fb_destroy_modedb(info->monspecs.modedb); nvidiafb_remove()
1437 kfree(info->pixmap.addr); nvidiafb_remove()
1438 framebuffer_release(info); nvidiafb_remove()
697 nvidiafb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) nvidiafb_setcolreg() argument
761 nvidiafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) nvidiafb_check_var() argument
914 nvidiafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) nvidiafb_pan_display() argument
/linux-4.4.14/net/ieee802154/
H A Dnl-mac.c151 static struct net_device *ieee802154_nl_get_dev(struct genl_info *info) ieee802154_nl_get_dev() argument
155 if (info->attrs[IEEE802154_ATTR_DEV_NAME]) { ieee802154_nl_get_dev()
158 nla_strlcpy(name, info->attrs[IEEE802154_ATTR_DEV_NAME], ieee802154_nl_get_dev()
161 } else if (info->attrs[IEEE802154_ATTR_DEV_INDEX]) { ieee802154_nl_get_dev()
163 nla_get_u32(info->attrs[IEEE802154_ATTR_DEV_INDEX])); ieee802154_nl_get_dev()
179 int ieee802154_associate_req(struct sk_buff *skb, struct genl_info *info) ieee802154_associate_req() argument
186 if (!info->attrs[IEEE802154_ATTR_CHANNEL] || ieee802154_associate_req()
187 !info->attrs[IEEE802154_ATTR_COORD_PAN_ID] || ieee802154_associate_req()
188 (!info->attrs[IEEE802154_ATTR_COORD_HW_ADDR] && ieee802154_associate_req()
189 !info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR]) || ieee802154_associate_req()
190 !info->attrs[IEEE802154_ATTR_CAPABILITY]) ieee802154_associate_req()
193 dev = ieee802154_nl_get_dev(info); ieee802154_associate_req()
199 if (info->attrs[IEEE802154_ATTR_COORD_HW_ADDR]) { ieee802154_associate_req()
202 info->attrs[IEEE802154_ATTR_COORD_HW_ADDR]); ieee802154_associate_req()
206 info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR]); ieee802154_associate_req()
209 info->attrs[IEEE802154_ATTR_COORD_PAN_ID]); ieee802154_associate_req()
211 if (info->attrs[IEEE802154_ATTR_PAGE]) ieee802154_associate_req()
212 page = nla_get_u8(info->attrs[IEEE802154_ATTR_PAGE]); ieee802154_associate_req()
217 nla_get_u8(info->attrs[IEEE802154_ATTR_CHANNEL]), ieee802154_associate_req()
219 nla_get_u8(info->attrs[IEEE802154_ATTR_CAPABILITY])); ieee802154_associate_req()
226 int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info) ieee802154_associate_resp() argument
232 if (!info->attrs[IEEE802154_ATTR_STATUS] || ieee802154_associate_resp()
233 !info->attrs[IEEE802154_ATTR_DEST_HW_ADDR] || ieee802154_associate_resp()
234 !info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]) ieee802154_associate_resp()
237 dev = ieee802154_nl_get_dev(info); ieee802154_associate_resp()
245 info->attrs[IEEE802154_ATTR_DEST_HW_ADDR]); ieee802154_associate_resp()
251 nla_get_shortaddr(info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]), ieee802154_associate_resp()
252 nla_get_u8(info->attrs[IEEE802154_ATTR_STATUS])); ieee802154_associate_resp()
259 int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info) ieee802154_disassociate_req() argument
265 if ((!info->attrs[IEEE802154_ATTR_DEST_HW_ADDR] && ieee802154_disassociate_req()
266 !info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]) || ieee802154_disassociate_req()
267 !info->attrs[IEEE802154_ATTR_REASON]) ieee802154_disassociate_req()
270 dev = ieee802154_nl_get_dev(info); ieee802154_disassociate_req()
276 if (info->attrs[IEEE802154_ATTR_DEST_HW_ADDR]) { ieee802154_disassociate_req()
279 info->attrs[IEEE802154_ATTR_DEST_HW_ADDR]); ieee802154_disassociate_req()
283 info->attrs[IEEE802154_ATTR_DEST_SHORT_ADDR]); ieee802154_disassociate_req()
290 nla_get_u8(info->attrs[IEEE802154_ATTR_REASON])); ieee802154_disassociate_req()
301 int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) ieee802154_start_req() argument
311 if (!info->attrs[IEEE802154_ATTR_COORD_PAN_ID] || ieee802154_start_req()
312 !info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR] || ieee802154_start_req()
313 !info->attrs[IEEE802154_ATTR_CHANNEL] || ieee802154_start_req()
314 !info->attrs[IEEE802154_ATTR_BCN_ORD] || ieee802154_start_req()
315 !info->attrs[IEEE802154_ATTR_SF_ORD] || ieee802154_start_req()
316 !info->attrs[IEEE802154_ATTR_PAN_COORD] || ieee802154_start_req()
317 !info->attrs[IEEE802154_ATTR_BAT_EXT] || ieee802154_start_req()
318 !info->attrs[IEEE802154_ATTR_COORD_REALIGN] ieee802154_start_req()
322 dev = ieee802154_nl_get_dev(info); ieee802154_start_req()
336 info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR]); ieee802154_start_req()
338 info->attrs[IEEE802154_ATTR_COORD_PAN_ID]); ieee802154_start_req()
340 channel = nla_get_u8(info->attrs[IEEE802154_ATTR_CHANNEL]); ieee802154_start_req()
341 bcn_ord = nla_get_u8(info->attrs[IEEE802154_ATTR_BCN_ORD]); ieee802154_start_req()
342 sf_ord = nla_get_u8(info->attrs[IEEE802154_ATTR_SF_ORD]); ieee802154_start_req()
343 pan_coord = nla_get_u8(info->attrs[IEEE802154_ATTR_PAN_COORD]); ieee802154_start_req()
344 blx = nla_get_u8(info->attrs[IEEE802154_ATTR_BAT_EXT]); ieee802154_start_req()
345 coord_realign = nla_get_u8(info->attrs[IEEE802154_ATTR_COORD_REALIGN]); ieee802154_start_req()
347 if (info->attrs[IEEE802154_ATTR_PAGE]) ieee802154_start_req()
348 page = nla_get_u8(info->attrs[IEEE802154_ATTR_PAGE]); ieee802154_start_req()
373 int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info) ieee802154_scan_req() argument
382 if (!info->attrs[IEEE802154_ATTR_SCAN_TYPE] || ieee802154_scan_req()
383 !info->attrs[IEEE802154_ATTR_CHANNELS] || ieee802154_scan_req()
384 !info->attrs[IEEE802154_ATTR_DURATION]) ieee802154_scan_req()
387 dev = ieee802154_nl_get_dev(info); ieee802154_scan_req()
393 type = nla_get_u8(info->attrs[IEEE802154_ATTR_SCAN_TYPE]); ieee802154_scan_req()
394 channels = nla_get_u32(info->attrs[IEEE802154_ATTR_CHANNELS]); ieee802154_scan_req()
395 duration = nla_get_u8(info->attrs[IEEE802154_ATTR_DURATION]); ieee802154_scan_req()
397 if (info->attrs[IEEE802154_ATTR_PAGE]) ieee802154_scan_req()
398 page = nla_get_u8(info->attrs[IEEE802154_ATTR_PAGE]); ieee802154_scan_req()
410 int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info) ieee802154_list_iface() argument
421 dev = ieee802154_nl_get_dev(info); ieee802154_list_iface()
429 rc = ieee802154_nl_fill_iface(msg, info->snd_portid, info->snd_seq, ieee802154_list_iface()
436 return genlmsg_reply(msg, info); ieee802154_list_iface()
470 int ieee802154_set_macparams(struct sk_buff *skb, struct genl_info *info) ieee802154_set_macparams() argument
480 dev = ieee802154_nl_get_dev(info); ieee802154_set_macparams()
496 if (!info->attrs[IEEE802154_ATTR_LBT_ENABLED] && ieee802154_set_macparams()
497 !info->attrs[IEEE802154_ATTR_CCA_MODE] && ieee802154_set_macparams()
498 !info->attrs[IEEE802154_ATTR_CCA_ED_LEVEL] && ieee802154_set_macparams()
499 !info->attrs[IEEE802154_ATTR_CSMA_RETRIES] && ieee802154_set_macparams()
500 !info->attrs[IEEE802154_ATTR_CSMA_MIN_BE] && ieee802154_set_macparams()
501 !info->attrs[IEEE802154_ATTR_CSMA_MAX_BE] && ieee802154_set_macparams()
502 !info->attrs[IEEE802154_ATTR_FRAME_RETRIES]) ieee802154_set_macparams()
511 if (info->attrs[IEEE802154_ATTR_TXPOWER]) ieee802154_set_macparams()
512 params.transmit_power = nla_get_s8(info->attrs[IEEE802154_ATTR_TXPOWER]) * 100; ieee802154_set_macparams()
514 if (info->attrs[IEEE802154_ATTR_LBT_ENABLED]) ieee802154_set_macparams()
515 params.lbt = nla_get_u8(info->attrs[IEEE802154_ATTR_LBT_ENABLED]); ieee802154_set_macparams()
517 if (info->attrs[IEEE802154_ATTR_CCA_MODE]) ieee802154_set_macparams()
518 params.cca.mode = nla_get_u8(info->attrs[IEEE802154_ATTR_CCA_MODE]); ieee802154_set_macparams()
520 if (info->attrs[IEEE802154_ATTR_CCA_ED_LEVEL]) ieee802154_set_macparams()
521 params.cca_ed_level = nla_get_s32(info->attrs[IEEE802154_ATTR_CCA_ED_LEVEL]) * 100; ieee802154_set_macparams()
523 if (info->attrs[IEEE802154_ATTR_CSMA_RETRIES]) ieee802154_set_macparams()
524 params.csma_retries = nla_get_u8(info->attrs[IEEE802154_ATTR_CSMA_RETRIES]); ieee802154_set_macparams()
526 if (info->attrs[IEEE802154_ATTR_CSMA_MIN_BE]) ieee802154_set_macparams()
527 params.min_be = nla_get_u8(info->attrs[IEEE802154_ATTR_CSMA_MIN_BE]); ieee802154_set_macparams()
529 if (info->attrs[IEEE802154_ATTR_CSMA_MAX_BE]) ieee802154_set_macparams()
530 params.max_be = nla_get_u8(info->attrs[IEEE802154_ATTR_CSMA_MAX_BE]); ieee802154_set_macparams()
532 if (info->attrs[IEEE802154_ATTR_FRAME_RETRIES]) ieee802154_set_macparams()
533 params.frame_retries = nla_get_s8(info->attrs[IEEE802154_ATTR_FRAME_RETRIES]); ieee802154_set_macparams()
549 ieee802154_llsec_parse_key_id(struct genl_info *info, ieee802154_llsec_parse_key_id() argument
554 if (!info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]) ieee802154_llsec_parse_key_id()
557 desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]); ieee802154_llsec_parse_key_id()
560 if (!info->attrs[IEEE802154_ATTR_PAN_ID] && ieee802154_llsec_parse_key_id()
561 !(info->attrs[IEEE802154_ATTR_SHORT_ADDR] || ieee802154_llsec_parse_key_id()
562 info->attrs[IEEE802154_ATTR_HW_ADDR])) ieee802154_llsec_parse_key_id()
565 desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); ieee802154_llsec_parse_key_id()
567 if (info->attrs[IEEE802154_ATTR_SHORT_ADDR]) { ieee802154_llsec_parse_key_id()
569 desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); ieee802154_llsec_parse_key_id()
572 desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); ieee802154_llsec_parse_key_id()
577 !info->attrs[IEEE802154_ATTR_LLSEC_KEY_ID]) ieee802154_llsec_parse_key_id()
581 !info->attrs[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT]) ieee802154_llsec_parse_key_id()
585 !info->attrs[IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED]) ieee802154_llsec_parse_key_id()
589 desc->id = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_ID]); ieee802154_llsec_parse_key_id()
594 u32 source = nla_get_u32(info->attrs[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT]); ieee802154_llsec_parse_key_id()
600 desc->extended_source = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED]); ieee802154_llsec_parse_key_id()
647 int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_getparams() argument
658 dev = ieee802154_nl_get_dev(info); ieee802154_llsec_getparams()
672 hdr = genlmsg_put(msg, 0, info->snd_seq, &nl802154_family, 0, ieee802154_llsec_getparams()
692 return ieee802154_nl_reply(msg, info); ieee802154_llsec_getparams()
700 int ieee802154_llsec_setparams(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_setparams() argument
710 dev = ieee802154_nl_get_dev(info); ieee802154_llsec_setparams()
714 if (!info->attrs[IEEE802154_ATTR_LLSEC_ENABLED] && ieee802154_llsec_setparams()
715 !info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE] && ieee802154_llsec_setparams()
716 !info->attrs[IEEE802154_ATTR_LLSEC_SECLEVEL]) ieee802154_llsec_setparams()
725 if (info->attrs[IEEE802154_ATTR_LLSEC_SECLEVEL] && ieee802154_llsec_setparams()
726 nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_SECLEVEL]) > 7) ieee802154_llsec_setparams()
729 if (info->attrs[IEEE802154_ATTR_LLSEC_ENABLED]) { ieee802154_llsec_setparams()
730 params.enabled = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_ENABLED]); ieee802154_llsec_setparams()
734 if (info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]) { ieee802154_llsec_setparams()
735 if (ieee802154_llsec_parse_key_id(info, &params.out_key)) ieee802154_llsec_setparams()
741 if (info->attrs[IEEE802154_ATTR_LLSEC_SECLEVEL]) { ieee802154_llsec_setparams()
742 params.out_level = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_SECLEVEL]); ieee802154_llsec_setparams()
746 if (info->attrs[IEEE802154_ATTR_LLSEC_FRAME_COUNTER]) { ieee802154_llsec_setparams()
747 u32 fc = nla_get_u32(info->attrs[IEEE802154_ATTR_LLSEC_FRAME_COUNTER]); ieee802154_llsec_setparams()
816 ieee802154_nl_llsec_change(struct sk_buff *skb, struct genl_info *info, ieee802154_nl_llsec_change() argument
822 dev = ieee802154_nl_get_dev(info); ieee802154_nl_llsec_change()
829 rc = fn(dev, info); ieee802154_nl_llsec_change()
836 ieee802154_llsec_parse_key(struct genl_info *info, ieee802154_llsec_parse_key() argument
844 if (!info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES] || ieee802154_llsec_parse_key()
845 !info->attrs[IEEE802154_ATTR_LLSEC_KEY_BYTES]) ieee802154_llsec_parse_key()
848 frames = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES]); ieee802154_llsec_parse_key()
850 !info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS]) ieee802154_llsec_parse_key()
853 if (info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS]) { ieee802154_llsec_parse_key()
855 info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS], ieee802154_llsec_parse_key()
868 nla_memcpy(key->key, info->attrs[IEEE802154_ATTR_LLSEC_KEY_BYTES], ieee802154_llsec_parse_key()
874 static int llsec_add_key(struct net_device *dev, struct genl_info *info) llsec_add_key() argument
880 if (ieee802154_llsec_parse_key(info, &key) || llsec_add_key()
881 ieee802154_llsec_parse_key_id(info, &id)) llsec_add_key()
887 int ieee802154_llsec_add_key(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_add_key() argument
889 if ((info->nlhdr->nlmsg_flags & (NLM_F_CREATE | NLM_F_EXCL)) != ieee802154_llsec_add_key()
893 return ieee802154_nl_llsec_change(skb, info, llsec_add_key); ieee802154_llsec_add_key()
896 static int llsec_remove_key(struct net_device *dev, struct genl_info *info) llsec_remove_key() argument
901 if (ieee802154_llsec_parse_key_id(info, &id)) llsec_remove_key()
907 int ieee802154_llsec_del_key(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_del_key() argument
909 return ieee802154_nl_llsec_change(skb, info, llsec_remove_key); ieee802154_llsec_del_key()
980 llsec_parse_dev(struct genl_info *info, llsec_parse_dev() argument
985 if (!info->attrs[IEEE802154_ATTR_LLSEC_FRAME_COUNTER] || llsec_parse_dev()
986 !info->attrs[IEEE802154_ATTR_HW_ADDR] || llsec_parse_dev()
987 !info->attrs[IEEE802154_ATTR_LLSEC_DEV_OVERRIDE] || llsec_parse_dev()
988 !info->attrs[IEEE802154_ATTR_LLSEC_DEV_KEY_MODE] || llsec_parse_dev()
989 (!!info->attrs[IEEE802154_ATTR_PAN_ID] != llsec_parse_dev()
990 !!info->attrs[IEEE802154_ATTR_SHORT_ADDR])) llsec_parse_dev()
993 if (info->attrs[IEEE802154_ATTR_PAN_ID]) { llsec_parse_dev()
994 dev->pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); llsec_parse_dev()
995 dev->short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); llsec_parse_dev()
1000 dev->hwaddr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); llsec_parse_dev()
1001 dev->frame_counter = nla_get_u32(info->attrs[IEEE802154_ATTR_LLSEC_FRAME_COUNTER]); llsec_parse_dev()
1002 dev->seclevel_exempt = !!nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_DEV_OVERRIDE]); llsec_parse_dev()
1003 dev->key_mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_DEV_KEY_MODE]); llsec_parse_dev()
1011 static int llsec_add_dev(struct net_device *dev, struct genl_info *info) llsec_add_dev() argument
1016 if (llsec_parse_dev(info, &desc)) llsec_add_dev()
1022 int ieee802154_llsec_add_dev(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_add_dev() argument
1024 if ((info->nlhdr->nlmsg_flags & (NLM_F_CREATE | NLM_F_EXCL)) != ieee802154_llsec_add_dev()
1028 return ieee802154_nl_llsec_change(skb, info, llsec_add_dev); ieee802154_llsec_add_dev()
1031 static int llsec_del_dev(struct net_device *dev, struct genl_info *info) llsec_del_dev() argument
1036 if (!info->attrs[IEEE802154_ATTR_HW_ADDR]) llsec_del_dev()
1039 devaddr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); llsec_del_dev()
1044 int ieee802154_llsec_del_dev(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_del_dev() argument
1046 return ieee802154_nl_llsec_change(skb, info, llsec_del_dev); ieee802154_llsec_del_dev()
1109 static int llsec_add_devkey(struct net_device *dev, struct genl_info *info) llsec_add_devkey() argument
1115 if (!info->attrs[IEEE802154_ATTR_LLSEC_FRAME_COUNTER] || llsec_add_devkey()
1116 !info->attrs[IEEE802154_ATTR_HW_ADDR] || llsec_add_devkey()
1117 ieee802154_llsec_parse_key_id(info, &key.key_id)) llsec_add_devkey()
1120 devaddr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); llsec_add_devkey()
1121 key.frame_counter = nla_get_u32(info->attrs[IEEE802154_ATTR_LLSEC_FRAME_COUNTER]); llsec_add_devkey()
1126 int ieee802154_llsec_add_devkey(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_add_devkey() argument
1128 if ((info->nlhdr->nlmsg_flags & (NLM_F_CREATE | NLM_F_EXCL)) != ieee802154_llsec_add_devkey()
1132 return ieee802154_nl_llsec_change(skb, info, llsec_add_devkey); ieee802154_llsec_add_devkey()
1135 static int llsec_del_devkey(struct net_device *dev, struct genl_info *info) llsec_del_devkey() argument
1141 if (!info->attrs[IEEE802154_ATTR_HW_ADDR] || llsec_del_devkey()
1142 ieee802154_llsec_parse_key_id(info, &key.key_id)) llsec_del_devkey()
1145 devaddr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); llsec_del_devkey()
1150 int ieee802154_llsec_del_devkey(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_del_devkey() argument
1152 return ieee802154_nl_llsec_change(skb, info, llsec_del_devkey); ieee802154_llsec_del_devkey()
1224 llsec_parse_seclevel(struct genl_info *info, llsec_parse_seclevel() argument
1229 if (!info->attrs[IEEE802154_ATTR_LLSEC_FRAME_TYPE] || llsec_parse_seclevel()
1230 !info->attrs[IEEE802154_ATTR_LLSEC_SECLEVELS] || llsec_parse_seclevel()
1231 !info->attrs[IEEE802154_ATTR_LLSEC_DEV_OVERRIDE]) llsec_parse_seclevel()
1234 sl->frame_type = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_FRAME_TYPE]); llsec_parse_seclevel()
1236 if (!info->attrs[IEEE802154_ATTR_LLSEC_CMD_FRAME_ID]) llsec_parse_seclevel()
1239 sl->cmd_frame_id = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_CMD_FRAME_ID]); llsec_parse_seclevel()
1242 sl->sec_levels = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_SECLEVELS]); llsec_parse_seclevel()
1243 sl->device_override = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_DEV_OVERRIDE]); llsec_parse_seclevel()
1248 static int llsec_add_seclevel(struct net_device *dev, struct genl_info *info) llsec_add_seclevel() argument
1253 if (llsec_parse_seclevel(info, &sl)) llsec_add_seclevel()
1259 int ieee802154_llsec_add_seclevel(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_add_seclevel() argument
1261 if ((info->nlhdr->nlmsg_flags & (NLM_F_CREATE | NLM_F_EXCL)) != ieee802154_llsec_add_seclevel()
1265 return ieee802154_nl_llsec_change(skb, info, llsec_add_seclevel); ieee802154_llsec_add_seclevel()
1268 static int llsec_del_seclevel(struct net_device *dev, struct genl_info *info) llsec_del_seclevel() argument
1273 if (llsec_parse_seclevel(info, &sl)) llsec_del_seclevel()
1279 int ieee802154_llsec_del_seclevel(struct sk_buff *skb, struct genl_info *info) ieee802154_llsec_del_seclevel() argument
1281 return ieee802154_nl_llsec_change(skb, info, llsec_del_seclevel); ieee802154_llsec_del_seclevel()
H A Dieee802154.h41 struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info,
43 int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info);
48 int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info);
50 int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info);
51 int ieee802154_del_iface(struct sk_buff *skb, struct genl_info *info);
58 int ieee802154_associate_req(struct sk_buff *skb, struct genl_info *info);
59 int ieee802154_associate_resp(struct sk_buff *skb, struct genl_info *info);
60 int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info);
61 int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info);
62 int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info);
63 int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info);
65 int ieee802154_set_macparams(struct sk_buff *skb, struct genl_info *info);
67 int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info);
68 int ieee802154_llsec_setparams(struct sk_buff *skb, struct genl_info *info);
69 int ieee802154_llsec_add_key(struct sk_buff *skb, struct genl_info *info);
70 int ieee802154_llsec_del_key(struct sk_buff *skb, struct genl_info *info);
73 int ieee802154_llsec_add_dev(struct sk_buff *skb, struct genl_info *info);
74 int ieee802154_llsec_del_dev(struct sk_buff *skb, struct genl_info *info);
77 int ieee802154_llsec_add_devkey(struct sk_buff *skb, struct genl_info *info);
78 int ieee802154_llsec_del_devkey(struct sk_buff *skb, struct genl_info *info);
81 int ieee802154_llsec_add_seclevel(struct sk_buff *skb, struct genl_info *info);
82 int ieee802154_llsec_del_seclevel(struct sk_buff *skb, struct genl_info *info);
/linux-4.4.14/drivers/macintosh/
H A Dapm_emu.c28 static void pmu_apm_get_power_status(struct apm_power_info *info) pmu_apm_get_power_status() argument
40 info->battery_status = APM_BATTERY_STATUS_UNKNOWN; pmu_apm_get_power_status()
41 info->battery_flag = APM_BATTERY_FLAG_UNKNOWN; pmu_apm_get_power_status()
42 info->units = APM_UNITS_MINS; pmu_apm_get_power_status()
45 info->ac_line_status = APM_AC_ONLINE; pmu_apm_get_power_status()
47 info->ac_line_status = APM_AC_OFFLINE; pmu_apm_get_power_status()
68 info->ac_line_status = APM_AC_ONLINE; pmu_apm_get_power_status()
79 info->battery_status = APM_BATTERY_STATUS_CHARGING; pmu_apm_get_power_status()
80 info->battery_flag = APM_BATTERY_FLAG_CHARGING; pmu_apm_get_power_status()
82 info->battery_status = APM_BATTERY_STATUS_CRITICAL; pmu_apm_get_power_status()
83 info->battery_flag = APM_BATTERY_FLAG_CRITICAL; pmu_apm_get_power_status()
85 info->battery_status = APM_BATTERY_STATUS_LOW; pmu_apm_get_power_status()
86 info->battery_flag = APM_BATTERY_FLAG_LOW; pmu_apm_get_power_status()
88 info->battery_status = APM_BATTERY_STATUS_HIGH; pmu_apm_get_power_status()
89 info->battery_flag = APM_BATTERY_FLAG_HIGH; pmu_apm_get_power_status()
93 info->battery_life = percentage; pmu_apm_get_power_status()
94 info->time = time_units; pmu_apm_get_power_status()
/linux-4.4.14/drivers/nfc/st21nfca/
H A Dse.c65 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_get_bwi() local
69 td = ST21NFCA_ATR_GET_Y_FROM_TD(info->se_info.atr[i]); st21nfca_se_get_bwi()
74 return info->se_info.atr[i] >> 4; st21nfca_se_get_bwi()
84 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_get_atr() local
92 memcpy(info->se_info.atr, skb->data, skb->len); st21nfca_se_get_atr()
93 info->se_info.wt_timeout = st21nfca_se_get_atr()
102 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_control_se() local
113 info->se_info.count_pipes = 0; st21nfca_hci_control_se()
114 info->se_info.expected_pipes = ST21NFCA_SE_COUNT_PIPE_UICC; st21nfca_hci_control_se()
121 info->se_info.count_pipes = 0; st21nfca_hci_control_se()
122 info->se_info.expected_pipes = ST21NFCA_SE_COUNT_PIPE_EMBEDDED; st21nfca_hci_control_se()
132 reinit_completion(&info->se_info.req_completion); st21nfca_hci_control_se()
138 mod_timer(&info->se_info.se_active_timer, jiffies + st21nfca_hci_control_se()
140 info->se_info.se_active = true; st21nfca_hci_control_se()
143 wait_for_completion_interruptible(&info->se_info.req_completion); st21nfca_hci_control_se()
167 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_discover_se() local
173 if (info->se_status->is_uicc_present) { st21nfca_hci_discover_se()
178 if (info->se_status->is_ese_present) { st21nfca_hci_discover_se()
193 * info->se_status->is_uicc_enable is true should never happen. st21nfca_hci_enable_se()
222 * info->se_status->is_uicc_enable is true should never happen st21nfca_hci_disable_se()
237 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_hci_se_io() local
243 info->se_info.cb = cb; st21nfca_hci_se_io()
244 info->se_info.cb_context = cb_context; st21nfca_hci_se_io()
245 mod_timer(&info->se_info.bwi_timer, jiffies + st21nfca_hci_se_io()
246 msecs_to_jiffies(info->se_info.wt_timeout)); st21nfca_hci_se_io()
247 info->se_info.bwi_active = true; st21nfca_hci_se_io()
270 struct st21nfca_hci_info *info = (struct st21nfca_hci_info *) data; st21nfca_se_wt_timeout() local
274 info->se_info.bwi_active = false; st21nfca_se_wt_timeout()
276 if (!info->se_info.xch_error) { st21nfca_se_wt_timeout()
277 info->se_info.xch_error = true; st21nfca_se_wt_timeout()
278 nfc_hci_send_event(info->hdev, ST21NFCA_APDU_READER_GATE, st21nfca_se_wt_timeout()
281 info->se_info.xch_error = false; st21nfca_se_wt_timeout()
282 nfc_hci_send_event(info->hdev, ST21NFCA_DEVICE_MGNT_GATE, st21nfca_se_wt_timeout()
285 info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME); st21nfca_se_wt_timeout()
290 struct st21nfca_hci_info *info = (struct st21nfca_hci_info *) data; st21nfca_se_activation_timeout() local
294 info->se_info.se_active = false; st21nfca_se_activation_timeout()
296 complete(&info->se_info.req_completion); st21nfca_se_activation_timeout()
359 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_apdu_reader_event_received() local
365 del_timer_sync(&info->se_info.bwi_timer); st21nfca_apdu_reader_event_received()
366 info->se_info.bwi_active = false; st21nfca_apdu_reader_event_received()
372 info->se_info.cb(info->se_info.cb_context, st21nfca_apdu_reader_event_received()
376 mod_timer(&info->se_info.bwi_timer, jiffies + st21nfca_apdu_reader_event_received()
377 msecs_to_jiffies(info->se_info.wt_timeout)); st21nfca_apdu_reader_event_received()
392 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_init() local
394 init_completion(&info->se_info.req_completion); st21nfca_se_init()
396 init_timer(&info->se_info.bwi_timer); st21nfca_se_init()
397 info->se_info.bwi_timer.data = (unsigned long)info; st21nfca_se_init()
398 info->se_info.bwi_timer.function = st21nfca_se_wt_timeout; st21nfca_se_init()
399 info->se_info.bwi_active = false; st21nfca_se_init()
401 init_timer(&info->se_info.se_active_timer); st21nfca_se_init()
402 info->se_info.se_active_timer.data = (unsigned long)info; st21nfca_se_init()
403 info->se_info.se_active_timer.function = st21nfca_se_activation_timeout; st21nfca_se_init()
404 info->se_info.se_active = false; st21nfca_se_init()
406 info->se_info.count_pipes = 0; st21nfca_se_init()
407 info->se_info.expected_pipes = 0; st21nfca_se_init()
409 info->se_info.xch_error = false; st21nfca_se_init()
411 info->se_info.wt_timeout = st21nfca_se_init()
418 struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); st21nfca_se_deinit() local
420 if (info->se_info.bwi_active) st21nfca_se_deinit()
421 del_timer_sync(&info->se_info.bwi_timer); st21nfca_se_deinit()
422 if (info->se_info.se_active) st21nfca_se_deinit()
423 del_timer_sync(&info->se_info.se_active_timer); st21nfca_se_deinit()
425 info->se_info.bwi_active = false; st21nfca_se_deinit()
426 info->se_info.se_active = false; st21nfca_se_deinit()
/linux-4.4.14/drivers/pwm/
H A Dpwm-tipwmss.c38 struct pwmss_info *info = dev_get_drvdata(dev); pwmss_submodule_state_change() local
41 mutex_lock(&info->pwmss_lock); pwmss_submodule_state_change()
42 val = readw(info->mmio_base + PWMSS_CLKCONFIG); pwmss_submodule_state_change()
44 writew(val , info->mmio_base + PWMSS_CLKCONFIG); pwmss_submodule_state_change()
45 mutex_unlock(&info->pwmss_lock); pwmss_submodule_state_change()
47 return readw(info->mmio_base + PWMSS_CLKSTATUS); pwmss_submodule_state_change()
61 struct pwmss_info *info; pwmss_probe() local
64 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); pwmss_probe()
65 if (!info) pwmss_probe()
68 mutex_init(&info->pwmss_lock); pwmss_probe()
71 info->mmio_base = devm_ioremap_resource(&pdev->dev, r); pwmss_probe()
72 if (IS_ERR(info->mmio_base)) pwmss_probe()
73 return PTR_ERR(info->mmio_base); pwmss_probe()
77 platform_set_drvdata(pdev, info); pwmss_probe()
89 struct pwmss_info *info = platform_get_drvdata(pdev); pwmss_remove() local
93 mutex_destroy(&info->pwmss_lock); pwmss_remove()
100 struct pwmss_info *info = dev_get_drvdata(dev); pwmss_suspend() local
102 info->pwmss_clkconfig = readw(info->mmio_base + PWMSS_CLKCONFIG); pwmss_suspend()
109 struct pwmss_info *info = dev_get_drvdata(dev); pwmss_resume() local
112 writew(info->pwmss_clkconfig, info->mmio_base + PWMSS_CLKCONFIG); pwmss_resume()
/linux-4.4.14/drivers/nfc/fdp/
H A Dfdp.c92 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_create_conn() local
100 r = nci_core_conn_create(info->ndev, FDP_PATCH_CONN_DEST, 1, fdp_nci_create_conn()
153 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_send_patch_cb() local
155 info->setup_patch_sent = 1; fdp_nci_send_patch_cb()
156 wake_up(&info->setup_wq); fdp_nci_send_patch_cb()
169 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_set_data_pkt_counter() local
170 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_set_data_pkt_counter()
173 atomic_set(&info->data_pkt_counter, count); fdp_nci_set_data_pkt_counter()
174 info->data_pkt_counter_cb = cb; fdp_nci_set_data_pkt_counter()
190 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_send_patch() local
197 if ((type == NCI_PATCH_TYPE_OTP && !info->otp_patch) || fdp_nci_send_patch()
198 (type == NCI_PATCH_TYPE_RAM && !info->ram_patch)) fdp_nci_send_patch()
202 fw = info->otp_patch; fdp_nci_send_patch()
204 fw = info->ram_patch; fdp_nci_send_patch()
249 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_open() local
250 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_open()
254 r = info->phy_ops->enable(info->phy); fdp_nci_open()
261 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_close() local
262 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_close()
270 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_send() local
271 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_send()
275 if (atomic_dec_and_test(&info->data_pkt_counter)) fdp_nci_send()
276 info->data_pkt_counter_cb(ndev); fdp_nci_send()
278 return info->phy_ops->write(info->phy, skb); fdp_nci_send()
283 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_recv_frame() local
284 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_recv_frame()
293 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_request_firmware() local
294 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_request_firmware()
298 r = request_firmware(&info->ram_patch, FDP_RAM_PATCH_NAME, dev); fdp_nci_request_firmware()
304 data = (u8 *) info->ram_patch->data; fdp_nci_request_firmware()
305 info->ram_patch_version = fdp_nci_request_firmware()
312 info->ram_patch_version, (int) info->ram_patch->size); fdp_nci_request_firmware()
315 r = request_firmware(&info->otp_patch, FDP_OTP_PATCH_NAME, dev); fdp_nci_request_firmware()
321 data = (u8 *) info->otp_patch->data; fdp_nci_request_firmware()
322 info->otp_patch_version = fdp_nci_request_firmware()
329 info->otp_patch_version, (int) info->otp_patch->size); fdp_nci_request_firmware()
338 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_release_firmware() local
340 if (info->otp_patch) { fdp_nci_release_firmware()
341 release_firmware(info->otp_patch); fdp_nci_release_firmware()
342 info->otp_patch = NULL; fdp_nci_release_firmware()
345 if (info->ram_patch) { fdp_nci_release_firmware()
346 release_firmware(info->ram_patch); fdp_nci_release_firmware()
347 info->otp_patch = NULL; fdp_nci_release_firmware()
353 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_patch_otp() local
354 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_patch_otp()
358 if (info->otp_version >= info->otp_patch_version) fdp_nci_patch_otp()
361 info->setup_patch_sent = 0; fdp_nci_patch_otp()
362 info->setup_reset_ntf = 0; fdp_nci_patch_otp()
363 info->setup_patch_ntf = 0; fdp_nci_patch_otp()
383 wait_event_interruptible(info->setup_wq, fdp_nci_patch_otp()
384 info->setup_patch_sent == 1); fdp_nci_patch_otp()
390 r = nci_core_conn_close(info->ndev, conn_id); fdp_nci_patch_otp()
402 wait_event_interruptible(info->setup_wq, info->setup_patch_ntf); fdp_nci_patch_otp()
405 r = info->setup_patch_status; fdp_nci_patch_otp()
416 wait_event_interruptible(info->setup_wq, info->setup_reset_ntf); fdp_nci_patch_otp()
424 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_patch_ram() local
425 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_patch_ram()
429 if (info->ram_version >= info->ram_patch_version) fdp_nci_patch_ram()
432 info->setup_patch_sent = 0; fdp_nci_patch_ram()
433 info->setup_reset_ntf = 0; fdp_nci_patch_ram()
434 info->setup_patch_ntf = 0; fdp_nci_patch_ram()
454 wait_event_interruptible(info->setup_wq, fdp_nci_patch_ram()
455 info->setup_patch_sent == 1); fdp_nci_patch_ram()
461 r = nci_core_conn_close(info->ndev, conn_id); fdp_nci_patch_ram()
473 wait_event_interruptible(info->setup_wq, info->setup_patch_ntf); fdp_nci_patch_ram()
476 r = info->setup_patch_status; fdp_nci_patch_ram()
487 wait_event_interruptible(info->setup_wq, info->setup_reset_ntf); fdp_nci_patch_ram()
496 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_setup() local
497 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_setup()
518 if (info->otp_version < info->otp_patch_version) { fdp_nci_setup()
526 if (info->ram_version < info->ram_patch_version) { fdp_nci_setup()
546 if (info->otp_version != info->otp_patch_version || fdp_nci_setup()
547 info->ram_version != info->ram_patch_version) { fdp_nci_setup()
568 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_post_setup() local
569 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_post_setup()
573 if (info->fw_vsc_cfg && info->fw_vsc_cfg[0]) { fdp_nci_post_setup()
576 r = fdp_nci_set_production_data(ndev, info->fw_vsc_cfg[3], fdp_nci_post_setup()
577 &info->fw_vsc_cfg[4]); fdp_nci_post_setup()
586 r = fdp_nci_set_clock(ndev, info->clock_type, info->clock_freq); fdp_nci_post_setup()
609 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_core_reset_ntf_packet() local
610 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_core_reset_ntf_packet()
613 info->setup_reset_ntf = 1; fdp_nci_core_reset_ntf_packet()
614 wake_up(&info->setup_wq); fdp_nci_core_reset_ntf_packet()
622 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_prop_patch_ntf_packet() local
623 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_prop_patch_ntf_packet()
626 info->setup_patch_ntf = 1; fdp_nci_prop_patch_ntf_packet()
627 info->setup_patch_status = skb->data[0]; fdp_nci_prop_patch_ntf_packet()
628 wake_up(&info->setup_wq); fdp_nci_prop_patch_ntf_packet()
636 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_prop_patch_rsp_packet() local
637 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_prop_patch_rsp_packet()
649 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_prop_set_production_data_rsp_packet() local
650 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_prop_set_production_data_rsp_packet()
662 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_core_get_config_rsp_packet() local
663 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_core_get_config_rsp_packet()
675 info->ram_version = le32_to_cpup((__le32 *) p); fdp_nci_core_get_config_rsp_packet()
680 info->otp_version = le32_to_cpup((__le32 *) p); fdp_nci_core_get_config_rsp_packet()
685 info->otp_version = le32_to_cpup((__le32 *) p); fdp_nci_core_get_config_rsp_packet()
690 info->key_index = *p++; fdp_nci_core_get_config_rsp_packet()
695 dev_dbg(dev, "OTP version %d\n", info->otp_version); fdp_nci_core_get_config_rsp_packet()
696 dev_dbg(dev, "RAM version %d\n", info->ram_version); fdp_nci_core_get_config_rsp_packet()
697 dev_dbg(dev, "key index %d\n", info->key_index); fdp_nci_core_get_config_rsp_packet()
747 struct fdp_nci_info *info; fdp_nci_probe() local
752 info = kzalloc(sizeof(struct fdp_nci_info), GFP_KERNEL); fdp_nci_probe()
753 if (!info) { fdp_nci_probe()
758 info->phy = phy; fdp_nci_probe()
759 info->phy_ops = phy_ops; fdp_nci_probe()
760 info->clock_type = clock_type; fdp_nci_probe()
761 info->clock_freq = clock_freq; fdp_nci_probe()
762 info->fw_vsc_cfg = fw_vsc_cfg; fdp_nci_probe()
764 init_waitqueue_head(&info->setup_wq); fdp_nci_probe()
787 info->ndev = ndev; fdp_nci_probe()
789 nci_set_drvdata(ndev, info); fdp_nci_probe()
796 kfree(info); fdp_nci_probe()
804 struct fdp_nci_info *info = nci_get_drvdata(ndev); fdp_nci_remove() local
805 struct device *dev = &info->phy->i2c_dev->dev; fdp_nci_remove()
811 kfree(info); fdp_nci_remove()
/linux-4.4.14/drivers/scsi/
H A Dxen-scsifront.c131 static void scsifront_wake_up(struct vscsifrnt_info *info) scsifront_wake_up() argument
133 info->wait_ring_available = 0; scsifront_wake_up()
134 wake_up(&info->wq_sync); scsifront_wake_up()
137 static int scsifront_get_rqid(struct vscsifrnt_info *info) scsifront_get_rqid() argument
142 spin_lock_irqsave(&info->shadow_lock, flags); scsifront_get_rqid()
144 free = find_first_bit(info->shadow_free_bitmap, VSCSIIF_MAX_REQS); scsifront_get_rqid()
145 __clear_bit(free, info->shadow_free_bitmap); scsifront_get_rqid()
147 spin_unlock_irqrestore(&info->shadow_lock, flags); scsifront_get_rqid()
152 static int _scsifront_put_rqid(struct vscsifrnt_info *info, uint32_t id) _scsifront_put_rqid() argument
154 int empty = bitmap_empty(info->shadow_free_bitmap, VSCSIIF_MAX_REQS); _scsifront_put_rqid()
156 __set_bit(id, info->shadow_free_bitmap); _scsifront_put_rqid()
157 info->shadow[id] = NULL; _scsifront_put_rqid()
159 return empty || info->wait_ring_available; _scsifront_put_rqid()
162 static void scsifront_put_rqid(struct vscsifrnt_info *info, uint32_t id) scsifront_put_rqid() argument
167 spin_lock_irqsave(&info->shadow_lock, flags); scsifront_put_rqid()
168 kick = _scsifront_put_rqid(info, id); scsifront_put_rqid()
169 spin_unlock_irqrestore(&info->shadow_lock, flags); scsifront_put_rqid()
172 scsifront_wake_up(info); scsifront_put_rqid()
175 static struct vscsiif_request *scsifront_pre_req(struct vscsifrnt_info *info) scsifront_pre_req() argument
177 struct vscsiif_front_ring *ring = &(info->ring); scsifront_pre_req()
181 id = scsifront_get_rqid(info); /* use id in response */ scsifront_pre_req()
185 ring_req = RING_GET_REQUEST(&(info->ring), ring->req_prod_pvt); scsifront_pre_req()
194 static void scsifront_do_request(struct vscsifrnt_info *info) scsifront_do_request() argument
196 struct vscsiif_front_ring *ring = &(info->ring); scsifront_do_request()
201 notify_remote_via_irq(info->irq); scsifront_do_request()
204 static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id) scsifront_gnttab_done() argument
206 struct vscsifrnt_shadow *s = info->shadow[id]; scsifront_gnttab_done()
214 shost_printk(KERN_ALERT, info->host, KBUILD_MODNAME scsifront_gnttab_done()
224 static void scsifront_cdb_cmd_done(struct vscsifrnt_info *info, scsifront_cdb_cmd_done() argument
232 sc = info->shadow[id]->sc; scsifront_cdb_cmd_done()
236 scsifront_gnttab_done(info, id); scsifront_cdb_cmd_done()
237 scsifront_put_rqid(info, id); scsifront_cdb_cmd_done()
251 static void scsifront_sync_cmd_done(struct vscsifrnt_info *info, scsifront_sync_cmd_done() argument
256 struct vscsifrnt_shadow *shadow = info->shadow[id]; scsifront_sync_cmd_done()
259 spin_lock_irqsave(&info->shadow_lock, flags); scsifront_sync_cmd_done()
266 kick = _scsifront_put_rqid(info, id); scsifront_sync_cmd_done()
267 spin_unlock_irqrestore(&info->shadow_lock, flags); scsifront_sync_cmd_done()
270 scsifront_wake_up(info); scsifront_sync_cmd_done()
273 shost_printk(KERN_ERR, info->host, KBUILD_MODNAME scsifront_sync_cmd_done()
278 spin_unlock_irqrestore(&info->shadow_lock, flags); scsifront_sync_cmd_done()
283 static void scsifront_do_response(struct vscsifrnt_info *info, scsifront_do_response() argument
287 test_bit(ring_rsp->rqid, info->shadow_free_bitmap), scsifront_do_response()
291 if (info->shadow[ring_rsp->rqid]->act == VSCSIIF_ACT_SCSI_CDB) scsifront_do_response()
292 scsifront_cdb_cmd_done(info, ring_rsp); scsifront_do_response()
294 scsifront_sync_cmd_done(info, ring_rsp); scsifront_do_response()
297 static int scsifront_ring_drain(struct vscsifrnt_info *info) scsifront_ring_drain() argument
303 rp = info->ring.sring->rsp_prod; scsifront_ring_drain()
305 for (i = info->ring.rsp_cons; i != rp; i++) { scsifront_ring_drain()
306 ring_rsp = RING_GET_RESPONSE(&info->ring, i); scsifront_ring_drain()
307 scsifront_do_response(info, ring_rsp); scsifront_ring_drain()
310 info->ring.rsp_cons = i; scsifront_ring_drain()
312 if (i != info->ring.req_prod_pvt) scsifront_ring_drain()
313 RING_FINAL_CHECK_FOR_RESPONSES(&info->ring, more_to_do); scsifront_ring_drain()
315 info->ring.sring->rsp_event = i + 1; scsifront_ring_drain()
320 static int scsifront_cmd_done(struct vscsifrnt_info *info) scsifront_cmd_done() argument
325 spin_lock_irqsave(info->host->host_lock, flags); scsifront_cmd_done()
327 more_to_do = scsifront_ring_drain(info); scsifront_cmd_done()
329 info->wait_ring_available = 0; scsifront_cmd_done()
331 spin_unlock_irqrestore(info->host->host_lock, flags); scsifront_cmd_done()
333 wake_up(&info->wq_sync); scsifront_cmd_done()
340 struct vscsifrnt_info *info = dev_id; scsifront_irq_fn() local
342 while (scsifront_cmd_done(info)) scsifront_irq_fn()
349 static void scsifront_finish_all(struct vscsifrnt_info *info) scsifront_finish_all() argument
354 scsifront_ring_drain(info); scsifront_finish_all()
357 if (test_bit(i, info->shadow_free_bitmap)) scsifront_finish_all()
363 scsifront_do_response(info, &resp); scsifront_finish_all()
367 static int map_data_for_request(struct vscsifrnt_info *info, map_data_for_request() argument
390 if (data_grants > info->host->sg_tablesize) { map_data_for_request()
391 shost_printk(KERN_ERR, info->host, KBUILD_MODNAME map_data_for_request()
407 shost_printk(KERN_ERR, info->host, KBUILD_MODNAME map_data_for_request()
423 info->dev->otherend_id, map_data_for_request()
457 info->dev->otherend_id, scsi_for_each_sg()
485 struct vscsifrnt_info *info, struct scsi_cmnd *sc, scsifront_command2ring()
492 ring_req = scsifront_pre_req(info); scsifront_command2ring()
496 info->shadow[ring_req->rqid] = shadow; scsifront_command2ring()
514 static int scsifront_enter(struct vscsifrnt_info *info) scsifront_enter() argument
516 if (info->pause) scsifront_enter()
518 info->callers++; scsifront_enter()
522 static void scsifront_return(struct vscsifrnt_info *info) scsifront_return() argument
524 info->callers--; scsifront_return()
525 if (info->callers) scsifront_return()
528 if (!info->waiting_pause) scsifront_return()
531 info->waiting_pause = 0; scsifront_return()
532 wake_up(&info->wq_pause); scsifront_return()
538 struct vscsifrnt_info *info = shost_priv(shost); scsifront_queuecommand() local
546 if (scsifront_enter(info)) { scsifront_queuecommand()
550 if (RING_FULL(&info->ring)) scsifront_queuecommand()
553 ring_req = scsifront_command2ring(info, sc, shadow); scsifront_queuecommand()
565 err = map_data_for_request(info, sc, ring_req, shadow); scsifront_queuecommand()
568 scsifront_put_rqid(info, rqid); scsifront_queuecommand()
569 scsifront_return(info); scsifront_queuecommand()
578 scsifront_do_request(info); scsifront_queuecommand()
579 scsifront_return(info); scsifront_queuecommand()
585 scsifront_return(info); scsifront_queuecommand()
599 struct vscsifrnt_info *info = shost_priv(host); scsifront_action_handler() local
611 if (!RING_FULL(&info->ring)) { scsifront_action_handler()
612 ring_req = scsifront_command2ring(info, sc, shadow); scsifront_action_handler()
616 if (err || info->pause) { scsifront_action_handler()
621 info->wait_ring_available = 1; scsifront_action_handler()
623 err = wait_event_interruptible(info->wq_sync, scsifront_action_handler()
624 !info->wait_ring_available); scsifront_action_handler()
628 if (scsifront_enter(info)) { scsifront_action_handler()
642 scsifront_do_request(info); scsifront_action_handler()
650 scsifront_put_rqid(info, shadow->rqid); scsifront_action_handler()
653 spin_lock(&info->shadow_lock); scsifront_action_handler()
655 spin_unlock(&info->shadow_lock); scsifront_action_handler()
659 scsifront_return(info); scsifront_action_handler()
678 struct vscsifrnt_info *info = shost_priv(sdev->host); scsifront_sdev_configure() local
680 if (info && current == info->curr) scsifront_sdev_configure()
681 xenbus_printf(XBT_NIL, info->dev->nodename, scsifront_sdev_configure()
682 info->dev_state_path, "%d", XenbusStateConnected); scsifront_sdev_configure()
689 struct vscsifrnt_info *info = shost_priv(sdev->host); scsifront_sdev_destroy() local
691 if (info && current == info->curr) scsifront_sdev_destroy()
692 xenbus_printf(XBT_NIL, info->dev->nodename, scsifront_sdev_destroy()
693 info->dev_state_path, "%d", XenbusStateClosed); scsifront_sdev_destroy()
713 static int scsifront_alloc_ring(struct vscsifrnt_info *info) scsifront_alloc_ring() argument
715 struct xenbus_device *dev = info->dev; scsifront_alloc_ring()
728 FRONT_RING_INIT(&info->ring, sring, PAGE_SIZE); scsifront_alloc_ring()
737 info->ring_ref = gref; scsifront_alloc_ring()
739 err = xenbus_alloc_evtchn(dev, &info->evtchn); scsifront_alloc_ring()
745 err = bind_evtchn_to_irq(info->evtchn); scsifront_alloc_ring()
751 info->irq = err; scsifront_alloc_ring()
753 err = request_threaded_irq(info->irq, NULL, scsifront_irq_fn, scsifront_alloc_ring()
754 IRQF_ONESHOT, "scsifront", info); scsifront_alloc_ring()
764 unbind_from_irqhandler(info->irq, info); scsifront_alloc_ring()
766 gnttab_end_foreign_access(info->ring_ref, 0, scsifront_alloc_ring()
767 (unsigned long)info->ring.sring); scsifront_alloc_ring()
772 static void scsifront_free_ring(struct vscsifrnt_info *info) scsifront_free_ring() argument
774 unbind_from_irqhandler(info->irq, info); scsifront_free_ring()
775 gnttab_end_foreign_access(info->ring_ref, 0, scsifront_free_ring()
776 (unsigned long)info->ring.sring); scsifront_free_ring()
779 static int scsifront_init_ring(struct vscsifrnt_info *info) scsifront_init_ring() argument
781 struct xenbus_device *dev = info->dev; scsifront_init_ring()
787 err = scsifront_alloc_ring(info); scsifront_init_ring()
790 pr_debug("%s: %u %u\n", __func__, info->ring_ref, info->evtchn); scsifront_init_ring()
798 info->ring_ref); scsifront_init_ring()
805 info->evtchn); scsifront_init_ring()
825 scsifront_free_ring(info); scsifront_init_ring()
834 struct vscsifrnt_info *info; scsifront_probe() local
839 host = scsi_host_alloc(&scsifront_sht, sizeof(*info)); scsifront_probe()
844 info = (struct vscsifrnt_info *)host->hostdata; scsifront_probe()
846 dev_set_drvdata(&dev->dev, info); scsifront_probe()
847 info->dev = dev; scsifront_probe()
849 bitmap_fill(info->shadow_free_bitmap, VSCSIIF_MAX_REQS); scsifront_probe()
851 err = scsifront_init_ring(info); scsifront_probe()
857 init_waitqueue_head(&info->wq_sync); scsifront_probe()
858 init_waitqueue_head(&info->wq_pause); scsifront_probe()
859 spin_lock_init(&info->shadow_lock); scsifront_probe()
874 info->host = host; scsifront_probe()
875 info->host_active = 1; scsifront_probe()
882 scsifront_free_ring(info); scsifront_probe()
889 struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev); scsifront_resume() local
890 struct Scsi_Host *host = info->host; scsifront_resume()
896 scsifront_finish_all(info); scsifront_resume()
901 scsifront_free_ring(info); scsifront_resume()
902 err = scsifront_init_ring(info); scsifront_resume()
916 struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev); scsifront_suspend() local
917 struct Scsi_Host *host = info->host; scsifront_suspend()
922 info->pause = 1; scsifront_suspend()
923 while (info->callers && !err) { scsifront_suspend()
924 info->waiting_pause = 1; scsifront_suspend()
925 info->wait_ring_available = 0; scsifront_suspend()
927 wake_up(&info->wq_sync); scsifront_suspend()
928 err = wait_event_interruptible(info->wq_pause, scsifront_suspend()
929 !info->waiting_pause); scsifront_suspend()
938 struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev); scsifront_remove() local
943 if (info->host_active) { scsifront_remove()
945 scsi_remove_host(info->host); scsifront_remove()
946 info->host_active = 0; scsifront_remove()
950 scsifront_free_ring(info); scsifront_remove()
951 scsi_host_put(info->host); scsifront_remove()
956 static void scsifront_disconnect(struct vscsifrnt_info *info) scsifront_disconnect() argument
958 struct xenbus_device *dev = info->dev; scsifront_disconnect()
959 struct Scsi_Host *host = info->host; scsifront_disconnect()
970 if (info->host_active) { scsifront_disconnect()
972 info->host_active = 0; scsifront_disconnect()
979 static void scsifront_do_lun_hotplug(struct vscsifrnt_info *info, int op) scsifront_do_lun_hotplug() argument
981 struct xenbus_device *dev = info->dev; scsifront_do_lun_hotplug()
995 BUG_ON(info->curr); scsifront_do_lun_hotplug()
996 info->curr = current; scsifront_do_lun_hotplug()
1018 snprintf(info->dev_state_path, sizeof(info->dev_state_path), scsifront_do_lun_hotplug()
1026 if (scsi_add_device(info->host, chn, tgt, lun)) { scsifront_do_lun_hotplug()
1029 info->dev_state_path, scsifront_do_lun_hotplug()
1037 sdev = scsi_device_lookup(info->host, chn, tgt, lun); scsifront_do_lun_hotplug()
1046 info->dev_state_path, scsifront_do_lun_hotplug()
1054 info->curr = NULL; scsifront_do_lun_hotplug()
1060 struct vscsifrnt_info *info) scsifront_read_backend_params()
1064 struct Scsi_Host *host = info->host; scsifront_read_backend_params()
1076 if (!info->pause && sg_grant) scsifront_read_backend_params()
1078 else if (info->pause && nr_segs < host->sg_tablesize) scsifront_read_backend_params()
1090 struct vscsifrnt_info *info = dev_get_drvdata(&dev->dev); scsifront_backend_changed() local
1102 scsifront_read_backend_params(dev, info); scsifront_backend_changed()
1104 if (info->pause) { scsifront_backend_changed()
1105 scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_READD_LUN); scsifront_backend_changed()
1107 info->pause = 0; scsifront_backend_changed()
1113 scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_ADD_LUN); scsifront_backend_changed()
1124 scsifront_disconnect(info); scsifront_backend_changed()
1128 scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_DEL_LUN); scsifront_backend_changed()
1133 scsifront_do_lun_hotplug(info, VSCSIFRONT_OP_ADD_LUN); scsifront_backend_changed()
484 scsifront_command2ring( struct vscsifrnt_info *info, struct scsi_cmnd *sc, struct vscsifrnt_shadow *shadow) scsifront_command2ring() argument
1059 scsifront_read_backend_params(struct xenbus_device *dev, struct vscsifrnt_info *info) scsifront_read_backend_params() argument
/linux-4.4.14/drivers/devfreq/event/
H A Dexynos-ppmu.c113 struct exynos_ppmu *info = devfreq_event_get_drvdata(edev); exynos_ppmu_disable() local
122 info->ppmu.base + PPMU_CNTENC); exynos_ppmu_disable()
125 pmnc = __raw_readl(info->ppmu.base + PPMU_PMNC); exynos_ppmu_disable()
127 __raw_writel(pmnc, info->ppmu.base + PPMU_PMNC); exynos_ppmu_disable()
134 struct exynos_ppmu *info = devfreq_event_get_drvdata(edev); exynos_ppmu_set_event() local
142 cntens = __raw_readl(info->ppmu.base + PPMU_CNTENS); exynos_ppmu_set_event()
144 __raw_writel(cntens, info->ppmu.base + PPMU_CNTENS); exynos_ppmu_set_event()
148 info->ppmu.base + PPMU_BEVTxSEL(id)); exynos_ppmu_set_event()
151 pmnc = __raw_readl(info->ppmu.base + PPMU_PMNC); exynos_ppmu_set_event()
158 __raw_writel(pmnc, info->ppmu.base + PPMU_PMNC); exynos_ppmu_set_event()
166 struct exynos_ppmu *info = devfreq_event_get_drvdata(edev); exynos_ppmu_get_event() local
174 pmnc = __raw_readl(info->ppmu.base + PPMU_PMNC); exynos_ppmu_get_event()
176 __raw_writel(pmnc, info->ppmu.base + PPMU_PMNC); exynos_ppmu_get_event()
179 edata->total_count = __raw_readl(info->ppmu.base + PPMU_CCNT); exynos_ppmu_get_event()
187 = __raw_readl(info->ppmu.base + PPMU_PMNCT(id)); exynos_ppmu_get_event()
191 ((__raw_readl(info->ppmu.base + PPMU_PMCNT3_HIGH) << 8) exynos_ppmu_get_event()
192 | __raw_readl(info->ppmu.base + PPMU_PMCNT3_LOW)); exynos_ppmu_get_event()
199 cntenc = __raw_readl(info->ppmu.base + PPMU_CNTENC); exynos_ppmu_get_event()
201 __raw_writel(cntenc, info->ppmu.base + PPMU_CNTENC); exynos_ppmu_get_event()
220 struct exynos_ppmu *info = devfreq_event_get_drvdata(edev); exynos_ppmu_v2_disable() local
227 __raw_writel(clear, info->ppmu.base + PPMU_V2_FLAG); exynos_ppmu_v2_disable()
228 __raw_writel(clear, info->ppmu.base + PPMU_V2_INTENC); exynos_ppmu_v2_disable()
229 __raw_writel(clear, info->ppmu.base + PPMU_V2_CNTENC); exynos_ppmu_v2_disable()
230 __raw_writel(clear, info->ppmu.base + PPMU_V2_CNT_RESET); exynos_ppmu_v2_disable()
232 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CIG_CFG0); exynos_ppmu_v2_disable()
233 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CIG_CFG1); exynos_ppmu_v2_disable()
234 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CIG_CFG2); exynos_ppmu_v2_disable()
235 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CIG_RESULT); exynos_ppmu_v2_disable()
236 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CNT_AUTO); exynos_ppmu_v2_disable()
237 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CH_EV0_TYPE); exynos_ppmu_v2_disable()
238 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CH_EV1_TYPE); exynos_ppmu_v2_disable()
239 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CH_EV2_TYPE); exynos_ppmu_v2_disable()
240 __raw_writel(0x0, info->ppmu.base + PPMU_V2_CH_EV3_TYPE); exynos_ppmu_v2_disable()
241 __raw_writel(0x0, info->ppmu.base + PPMU_V2_SM_ID_V); exynos_ppmu_v2_disable()
242 __raw_writel(0x0, info->ppmu.base + PPMU_V2_SM_ID_A); exynos_ppmu_v2_disable()
243 __raw_writel(0x0, info->ppmu.base + PPMU_V2_SM_OTHERS_V); exynos_ppmu_v2_disable()
244 __raw_writel(0x0, info->ppmu.base + PPMU_V2_SM_OTHERS_A); exynos_ppmu_v2_disable()
245 __raw_writel(0x0, info->ppmu.base + PPMU_V2_INTERRUPT_RESET); exynos_ppmu_v2_disable()
248 pmnc = __raw_readl(info->ppmu.base + PPMU_V2_PMNC); exynos_ppmu_v2_disable()
250 __raw_writel(pmnc, info->ppmu.base + PPMU_V2_PMNC); exynos_ppmu_v2_disable()
257 struct exynos_ppmu *info = devfreq_event_get_drvdata(edev); exynos_ppmu_v2_set_event() local
262 cntens = __raw_readl(info->ppmu.base + PPMU_V2_CNTENS); exynos_ppmu_v2_set_event()
264 __raw_writel(cntens, info->ppmu.base + PPMU_V2_CNTENS); exynos_ppmu_v2_set_event()
272 info->ppmu.base + PPMU_V2_CH_EVx_TYPE(id)); exynos_ppmu_v2_set_event()
276 info->ppmu.base + PPMU_V2_CH_EVx_TYPE(id)); exynos_ppmu_v2_set_event()
281 pmnc = __raw_readl(info->ppmu.base + PPMU_V2_PMNC); exynos_ppmu_v2_set_event()
291 __raw_writel(pmnc, info->ppmu.base + PPMU_V2_PMNC); exynos_ppmu_v2_set_event()
299 struct exynos_ppmu *info = devfreq_event_get_drvdata(edev); exynos_ppmu_v2_get_event() local
306 pmnc = __raw_readl(info->ppmu.base + PPMU_V2_PMNC); exynos_ppmu_v2_get_event()
308 __raw_writel(pmnc, info->ppmu.base + PPMU_V2_PMNC); exynos_ppmu_v2_get_event()
311 edata->total_count = __raw_readl(info->ppmu.base + PPMU_V2_CCNT); exynos_ppmu_v2_get_event()
317 load_count = __raw_readl(info->ppmu.base + PPMU_V2_PMNCT(id)); exynos_ppmu_v2_get_event()
320 pmcnt_high = __raw_readl(info->ppmu.base + PPMU_V2_PMCNT3_HIGH); exynos_ppmu_v2_get_event()
321 pmcnt_low = __raw_readl(info->ppmu.base + PPMU_V2_PMCNT3_LOW); exynos_ppmu_v2_get_event()
329 cntenc = __raw_readl(info->ppmu.base + PPMU_V2_CNTENC); exynos_ppmu_v2_get_event()
331 __raw_writel(cntenc, info->ppmu.base + PPMU_V2_CNTENC); exynos_ppmu_v2_get_event()
364 struct exynos_ppmu *info) of_get_devfreq_events()
368 struct device *dev = info->dev; of_get_devfreq_events()
384 info->num_events = count; of_get_devfreq_events()
404 desc[j].driver_data = info; for_each_child_of_node()
412 info->desc = desc;
419 static int exynos_ppmu_parse_dt(struct exynos_ppmu *info) exynos_ppmu_parse_dt() argument
421 struct device *dev = info->dev; exynos_ppmu_parse_dt()
431 info->ppmu.base = of_iomap(np, 0); exynos_ppmu_parse_dt()
432 if (IS_ERR_OR_NULL(info->ppmu.base)) { exynos_ppmu_parse_dt()
437 info->ppmu.clk = devm_clk_get(dev, "ppmu"); exynos_ppmu_parse_dt()
438 if (IS_ERR(info->ppmu.clk)) { exynos_ppmu_parse_dt()
439 info->ppmu.clk = NULL; exynos_ppmu_parse_dt()
443 ret = of_get_devfreq_events(np, info); exynos_ppmu_parse_dt()
452 iounmap(info->ppmu.base); exynos_ppmu_parse_dt()
459 struct exynos_ppmu *info; exynos_ppmu_probe() local
464 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); exynos_ppmu_probe()
465 if (!info) exynos_ppmu_probe()
468 mutex_init(&info->lock); exynos_ppmu_probe()
469 info->dev = &pdev->dev; exynos_ppmu_probe()
472 ret = exynos_ppmu_parse_dt(info); exynos_ppmu_probe()
478 desc = info->desc; exynos_ppmu_probe()
480 size = sizeof(struct devfreq_event_dev *) * info->num_events; exynos_ppmu_probe()
481 info->edev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); exynos_ppmu_probe()
482 if (!info->edev) { exynos_ppmu_probe()
487 edev = info->edev; exynos_ppmu_probe()
488 platform_set_drvdata(pdev, info); exynos_ppmu_probe()
490 for (i = 0; i < info->num_events; i++) { exynos_ppmu_probe()
500 clk_prepare_enable(info->ppmu.clk); exynos_ppmu_probe()
504 iounmap(info->ppmu.base); exynos_ppmu_probe()
511 struct exynos_ppmu *info = platform_get_drvdata(pdev); exynos_ppmu_remove() local
513 clk_disable_unprepare(info->ppmu.clk); exynos_ppmu_remove()
514 iounmap(info->ppmu.base); exynos_ppmu_remove()
363 of_get_devfreq_events(struct device_node *np, struct exynos_ppmu *info) of_get_devfreq_events() argument
/linux-4.4.14/drivers/staging/android/ion/
H A Dion_cma_heap.c50 struct ion_cma_buffer_info *info; ion_cma_allocate() local
60 info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL); ion_cma_allocate()
61 if (!info) ion_cma_allocate()
64 info->cpu_addr = dma_alloc_coherent(dev, len, &(info->handle), ion_cma_allocate()
67 if (!info->cpu_addr) { ion_cma_allocate()
72 info->table = kmalloc(sizeof(struct sg_table), GFP_KERNEL); ion_cma_allocate()
73 if (!info->table) ion_cma_allocate()
76 if (dma_get_sgtable(dev, info->table, info->cpu_addr, info->handle, ion_cma_allocate()
80 buffer->priv_virt = info; ion_cma_allocate()
85 kfree(info->table); ion_cma_allocate()
87 dma_free_coherent(dev, len, info->cpu_addr, info->handle); ion_cma_allocate()
89 kfree(info); ion_cma_allocate()
97 struct ion_cma_buffer_info *info = buffer->priv_virt; ion_cma_free() local
101 dma_free_coherent(dev, buffer->size, info->cpu_addr, info->handle); ion_cma_free()
103 sg_free_table(info->table); ion_cma_free()
104 kfree(info->table); ion_cma_free()
105 kfree(info); ion_cma_free()
114 struct ion_cma_buffer_info *info = buffer->priv_virt; ion_cma_phys() local
117 &info->handle); ion_cma_phys()
119 *addr = info->handle; ion_cma_phys()
128 struct ion_cma_buffer_info *info = buffer->priv_virt; ion_cma_heap_map_dma() local
130 return info->table; ion_cma_heap_map_dma()
143 struct ion_cma_buffer_info *info = buffer->priv_virt; ion_cma_mmap() local
145 return dma_mmap_coherent(dev, vma, info->cpu_addr, info->handle, ion_cma_mmap()
152 struct ion_cma_buffer_info *info = buffer->priv_virt; ion_cma_map_kernel() local
154 return info->cpu_addr; ion_cma_map_kernel()
/linux-4.4.14/drivers/tty/serial/8250/
H A D8250_acorn.c44 struct serial_card_info *info; serial_card_probe() local
50 info = kzalloc(sizeof(struct serial_card_info), GFP_KERNEL); serial_card_probe()
51 if (!info) serial_card_probe()
54 info->num_ports = type->num_ports; serial_card_probe()
57 info->vaddr = ecardm_iomap(ec, type->type, 0, 0); serial_card_probe()
58 if (!info->vaddr) { serial_card_probe()
59 kfree(info); serial_card_probe()
63 ecard_set_drvdata(ec, info); serial_card_probe()
73 for (i = 0; i < info->num_ports; i ++) { serial_card_probe()
74 uart.port.membase = info->vaddr + type->offset[i]; serial_card_probe()
77 info->ports[i] = serial8250_register_8250_port(&uart); serial_card_probe()
85 struct serial_card_info *info = ecard_get_drvdata(ec); serial_card_remove() local
90 for (i = 0; i < info->num_ports; i++) serial_card_remove()
91 if (info->ports[i] > 0) serial_card_remove()
92 serial8250_unregister_port(info->ports[i]); serial_card_remove()
94 kfree(info); serial_card_remove()
/linux-4.4.14/arch/sh/boards/mach-hp6xx/
H A Dhp6xx_apm.c32 static void hp6x0_apm_get_power_status(struct apm_power_info *info) hp6x0_apm_get_power_status() argument
45 info->battery_life = percentage; hp6x0_apm_get_power_status()
48 info->units = 0; hp6x0_apm_get_power_status()
51 info->time = (2 * battery); hp6x0_apm_get_power_status()
53 info->ac_line_status = (battery > HP680_BATTERY_AC_ON) ? hp6x0_apm_get_power_status()
58 info->battery_status = APM_BATTERY_STATUS_NOT_PRESENT; hp6x0_apm_get_power_status()
59 info->battery_flag = 0x80; hp6x0_apm_get_power_status()
61 info->battery_status = APM_BATTERY_STATUS_CHARGING; hp6x0_apm_get_power_status()
62 info->battery_flag = 0x08; hp6x0_apm_get_power_status()
63 info->ac_line_status = 0x01; hp6x0_apm_get_power_status()
65 info->battery_status = APM_BATTERY_STATUS_CRITICAL; hp6x0_apm_get_power_status()
66 info->battery_flag = 0x04; hp6x0_apm_get_power_status()
68 info->battery_status = APM_BATTERY_STATUS_LOW; hp6x0_apm_get_power_status()
69 info->battery_flag = 0x02; hp6x0_apm_get_power_status()
71 info->battery_status = APM_BATTERY_STATUS_HIGH; hp6x0_apm_get_power_status()
72 info->battery_flag = 0x01; hp6x0_apm_get_power_status()
/linux-4.4.14/fs/dlm/
H A Dplock.c28 struct dlm_plock_info info; member in struct:plock_op
40 static inline void set_version(struct dlm_plock_info *info) set_version() argument
42 info->version[0] = DLM_PLOCK_VERSION_MAJOR; set_version()
43 info->version[1] = DLM_PLOCK_VERSION_MINOR; set_version()
44 info->version[2] = DLM_PLOCK_VERSION_PATCH; set_version()
47 static int check_version(struct dlm_plock_info *info) check_version() argument
49 if ((DLM_PLOCK_VERSION_MAJOR != info->version[0]) || check_version()
50 (DLM_PLOCK_VERSION_MINOR < info->version[1])) { check_version()
56 info->version[0], check_version()
57 info->version[1], check_version()
58 info->version[2]); check_version()
66 set_version(&op->info); send_op()
89 op->info.optype = DLM_PLOCK_OP_UNLOCK; do_unlock_close()
90 op->info.pid = fl->fl_pid; do_unlock_close()
91 op->info.fsid = ls->ls_global_id; do_unlock_close()
92 op->info.number = number; do_unlock_close()
93 op->info.start = 0; do_unlock_close()
94 op->info.end = OFFSET_MAX; do_unlock_close()
96 op->info.owner = (__u64) fl->fl_pid; do_unlock_close()
98 op->info.owner = (__u64)(long) fl->fl_owner; do_unlock_close()
100 op->info.flags |= DLM_PLOCK_FL_CLOSE; do_unlock_close()
123 op->info.optype = DLM_PLOCK_OP_LOCK; dlm_posix_lock()
124 op->info.pid = fl->fl_pid; dlm_posix_lock()
125 op->info.ex = (fl->fl_type == F_WRLCK); dlm_posix_lock()
126 op->info.wait = IS_SETLKW(cmd); dlm_posix_lock()
127 op->info.fsid = ls->ls_global_id; dlm_posix_lock()
128 op->info.number = number; dlm_posix_lock()
129 op->info.start = fl->fl_start; dlm_posix_lock()
130 op->info.end = fl->fl_end; dlm_posix_lock()
134 op->info.owner = (__u64) fl->fl_pid; dlm_posix_lock()
141 op->info.owner = (__u64)(long) fl->fl_owner; dlm_posix_lock()
172 rv = op->info.rv; dlm_posix_lock()
200 (unsigned long long)op->info.number); dlm_plock_callback()
211 if (op->info.rv) { dlm_plock_callback()
212 notify(fl, op->info.rv); dlm_plock_callback()
228 (unsigned long long)op->info.number, file, fl); dlm_plock_callback()
275 op->info.optype = DLM_PLOCK_OP_UNLOCK; dlm_posix_unlock()
276 op->info.pid = fl->fl_pid; dlm_posix_unlock()
277 op->info.fsid = ls->ls_global_id; dlm_posix_unlock()
278 op->info.number = number; dlm_posix_unlock()
279 op->info.start = fl->fl_start; dlm_posix_unlock()
280 op->info.end = fl->fl_end; dlm_posix_unlock()
282 op->info.owner = (__u64) fl->fl_pid; dlm_posix_unlock()
284 op->info.owner = (__u64)(long) fl->fl_owner; dlm_posix_unlock()
287 op->info.flags |= DLM_PLOCK_FL_CLOSE; dlm_posix_unlock()
304 rv = op->info.rv; dlm_posix_unlock()
335 op->info.optype = DLM_PLOCK_OP_GET; dlm_posix_get()
336 op->info.pid = fl->fl_pid; dlm_posix_get()
337 op->info.ex = (fl->fl_type == F_WRLCK); dlm_posix_get()
338 op->info.fsid = ls->ls_global_id; dlm_posix_get()
339 op->info.number = number; dlm_posix_get()
340 op->info.start = fl->fl_start; dlm_posix_get()
341 op->info.end = fl->fl_end; dlm_posix_get()
343 op->info.owner = (__u64) fl->fl_pid; dlm_posix_get()
345 op->info.owner = (__u64)(long) fl->fl_owner; dlm_posix_get()
358 /* info.rv from userspace is 1 for conflict, 0 for no-conflict, dlm_posix_get()
361 rv = op->info.rv; dlm_posix_get()
368 fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; dlm_posix_get()
370 fl->fl_pid = op->info.pid; dlm_posix_get()
371 fl->fl_start = op->info.start; dlm_posix_get()
372 fl->fl_end = op->info.end; dlm_posix_get()
387 struct dlm_plock_info info; dev_read() local
390 if (count < sizeof(info)) dev_read()
396 if (op->info.flags & DLM_PLOCK_FL_CLOSE) dev_read()
400 memcpy(&info, &op->info, sizeof(info)); dev_read()
411 if (op->info.flags & DLM_PLOCK_FL_CLOSE) dev_read()
414 if (copy_to_user(u, &info, sizeof(info))) dev_read()
416 return sizeof(info); dev_read()
424 struct dlm_plock_info info; dev_write() local
428 if (count != sizeof(info)) dev_write()
431 if (copy_from_user(&info, u, sizeof(info))) dev_write()
434 if (check_version(&info)) dev_write()
439 if (op->info.fsid == info.fsid && dev_write()
440 op->info.number == info.number && dev_write()
441 op->info.owner == info.owner) { dev_write()
444 memcpy(&op->info, &info, sizeof(info)); dev_write()
461 log_print("dev_write no op %x %llx", info.fsid, dev_write()
462 (unsigned long long)info.number); dev_write()
/linux-4.4.14/kernel/
H A Dup.c10 int smp_call_function_single(int cpu, void (*func) (void *info), void *info, smp_call_function_single() argument
18 func(info); smp_call_function_single()
30 csd->func(csd->info); smp_call_function_single_async()
36 int on_each_cpu(smp_call_func_t func, void *info, int wait) on_each_cpu() argument
41 func(info); on_each_cpu()
54 smp_call_func_t func, void *info, bool wait) on_each_cpu_mask()
60 func(info); on_each_cpu_mask()
70 void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), on_each_cpu_cond() argument
71 smp_call_func_t func, void *info, bool wait, on_each_cpu_cond()
77 if (cond_func(0, info)) { on_each_cpu_cond()
79 func(info); on_each_cpu_cond()
53 on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func, void *info, bool wait) on_each_cpu_mask() argument
/linux-4.4.14/drivers/video/fbdev/aty/
H A Dmach64_cursor.c67 static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor) atyfb_cursor() argument
69 struct atyfb_par *par = (struct atyfb_par *) info->par; atyfb_cursor()
90 x = cursor->image.dx - cursor->hot.x - info->var.xoffset; atyfb_cursor()
98 y = cursor->image.dy - cursor->hot.y - info->var.yoffset; atyfb_cursor()
117 aty_st_le32(CUR_OFFSET, (info->fix.smem_len >> 3) + (yoff << 1), par); atyfb_cursor()
130 fg = ((info->cmap.red[fg_idx] & 0xff) << 24) | atyfb_cursor()
131 ((info->cmap.green[fg_idx] & 0xff) << 16) | atyfb_cursor()
132 ((info->cmap.blue[fg_idx] & 0xff) << 8) | 0xff; atyfb_cursor()
134 bg = ((info->cmap.red[bg_idx] & 0xff) << 24) | atyfb_cursor()
135 ((info->cmap.green[bg_idx] & 0xff) << 16) | atyfb_cursor()
136 ((info->cmap.blue[bg_idx] & 0xff) << 8); atyfb_cursor()
146 u8 __iomem *dst = (u8 __iomem *)info->sprite.addr; atyfb_cursor()
149 unsigned int align = info->sprite.scan_align; atyfb_cursor()
196 int aty_init_cursor(struct fb_info *info) aty_init_cursor() argument
200 info->fix.smem_len -= PAGE_SIZE; aty_init_cursor()
203 addr = (unsigned long) info->screen_base - 0x800000 + info->fix.smem_len; aty_init_cursor()
204 info->sprite.addr = (u8 *) addr; aty_init_cursor()
207 addr = info->fix.smem_start - 0x800000 + info->fix.smem_len; aty_init_cursor()
208 info->sprite.addr = (u8 *) ioremap(addr, 1024); aty_init_cursor()
210 addr = (unsigned long) info->screen_base + info->fix.smem_len; aty_init_cursor()
211 info->sprite.addr = (u8 *) addr; aty_init_cursor()
214 if (!info->sprite.addr) aty_init_cursor()
216 info->sprite.size = PAGE_SIZE; aty_init_cursor()
217 info->sprite.scan_align = 16; /* Scratch pad 64 bytes wide */ aty_init_cursor()
218 info->sprite.buf_align = 16; /* and 64 lines tall. */ aty_init_cursor()
219 info->sprite.flags = FB_PIXMAP_IO; aty_init_cursor()
221 info->fbops->fb_cursor = atyfb_cursor; aty_init_cursor()
/linux-4.4.14/arch/powerpc/platforms/cell/
H A Dcpufreq_spudemand.c43 static int calc_freq(struct spu_gov_info_struct *info) calc_freq() argument
48 cpu = info->policy->cpu; calc_freq()
51 CALC_LOAD(info->busy_spus, EXP, busy_spus * FIXED_1); calc_freq()
52 pr_debug("cpu %d: busy_spus=%d, info->busy_spus=%ld\n", calc_freq()
53 cpu, busy_spus, info->busy_spus); calc_freq()
55 return info->policy->max * info->busy_spus / FIXED_1; calc_freq()
60 struct spu_gov_info_struct *info; spu_gov_work() local
64 info = container_of(work, struct spu_gov_info_struct, work.work); spu_gov_work()
66 /* after cancel_delayed_work_sync we unset info->policy */ spu_gov_work()
67 BUG_ON(info->policy == NULL); spu_gov_work()
69 target_freq = calc_freq(info); spu_gov_work()
70 __cpufreq_driver_target(info->policy, target_freq, CPUFREQ_RELATION_H); spu_gov_work()
72 delay = usecs_to_jiffies(info->poll_int); spu_gov_work()
73 schedule_delayed_work_on(info->policy->cpu, &info->work, delay); spu_gov_work()
76 static void spu_gov_init_work(struct spu_gov_info_struct *info) spu_gov_init_work() argument
78 int delay = usecs_to_jiffies(info->poll_int); spu_gov_init_work()
79 INIT_DEFERRABLE_WORK(&info->work, spu_gov_work); spu_gov_init_work()
80 schedule_delayed_work_on(info->policy->cpu, &info->work, delay); spu_gov_init_work()
83 static void spu_gov_cancel_work(struct spu_gov_info_struct *info) spu_gov_cancel_work() argument
85 cancel_delayed_work_sync(&info->work); spu_gov_cancel_work()
91 struct spu_gov_info_struct *info, *affected_info; spu_gov_govern() local
95 info = &per_cpu(spu_gov_info, cpu); spu_gov_govern()
117 info->poll_int = POLL_TIME; spu_gov_govern()
120 spu_gov_init_work(info); spu_gov_govern()
126 spu_gov_cancel_work(info); spu_gov_govern()
130 info = &per_cpu(spu_gov_info, i); spu_gov_govern()
131 info->policy = NULL; spu_gov_govern()
/linux-4.4.14/drivers/pinctrl/freescale/
H A Dpinctrl-imx.c44 const struct imx_pinctrl_soc_info *info; member in struct:imx_pinctrl
48 const struct imx_pinctrl_soc_info *info, imx_pinctrl_find_group_by_name()
54 for (i = 0; i < info->ngroups; i++) { imx_pinctrl_find_group_by_name()
55 if (!strcmp(info->groups[i].name, name)) { imx_pinctrl_find_group_by_name()
56 grp = &info->groups[i]; imx_pinctrl_find_group_by_name()
67 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_get_groups_count() local
69 return info->ngroups; imx_get_groups_count()
76 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_get_group_name() local
78 return info->groups[selector].name; imx_get_group_name()
86 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_get_group_pins() local
88 if (selector >= info->ngroups) imx_get_group_pins()
91 *pins = info->groups[selector].pin_ids; imx_get_group_pins()
92 *npins = info->groups[selector].npins; imx_get_group_pins()
108 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_dt_node_to_map() local
119 grp = imx_pinctrl_find_group_by_name(info, np->name); imx_dt_node_to_map()
121 dev_err(info->dev, "unable to find group for node %s\n", imx_dt_node_to_map()
188 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pmx_set() local
198 grp = &info->groups[group]; imx_pmx_set()
202 info->functions[selector].name, grp->name); imx_pmx_set()
207 pin_reg = &info->pin_regs[pin_id]; imx_pmx_set()
211 info->pins[pin_id].name); imx_pmx_set()
215 if (info->flags & SHARE_MUX_CONF_REG) { imx_pmx_set()
277 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pmx_get_funcs_count() local
279 return info->nfunctions; imx_pmx_get_funcs_count()
286 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pmx_get_func_name() local
288 return info->functions[selector].name; imx_pmx_get_func_name()
296 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pmx_get_groups() local
298 *groups = info->functions[selector].groups; imx_pmx_get_groups()
299 *num_groups = info->functions[selector].num_groups; imx_pmx_get_groups()
308 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pmx_gpio_request_enable() local
316 if (!(info->flags & SHARE_MUX_CONF_REG)) imx_pmx_gpio_request_enable()
319 pin_reg = &info->pin_regs[offset]; imx_pmx_gpio_request_enable()
324 for (group = 0; group < info->ngroups; group++) { imx_pmx_gpio_request_enable()
325 grp = &info->groups[group]; imx_pmx_gpio_request_enable()
348 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pmx_gpio_set_direction() local
356 if (!(info->flags & SHARE_MUX_CONF_REG)) imx_pmx_gpio_set_direction()
359 pin_reg = &info->pin_regs[offset]; imx_pmx_gpio_set_direction()
387 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pinconf_get() local
388 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; imx_pinconf_get()
391 dev_err(info->dev, "Pin(%s) does not support config function\n", imx_pinconf_get()
392 info->pins[pin_id].name); imx_pinconf_get()
398 if (info->flags & SHARE_MUX_CONF_REG) imx_pinconf_get()
409 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pinconf_set() local
410 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; imx_pinconf_set()
414 dev_err(info->dev, "Pin(%s) does not support config function\n", imx_pinconf_set()
415 info->pins[pin_id].name); imx_pinconf_set()
420 info->pins[pin_id].name); imx_pinconf_set()
423 if (info->flags & SHARE_MUX_CONF_REG) { imx_pinconf_set()
443 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pinconf_dbg_show() local
444 const struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id]; imx_pinconf_dbg_show()
460 const struct imx_pinctrl_soc_info *info = ipctl->info; imx_pinconf_group_dbg_show() local
466 if (group > info->ngroups) imx_pinconf_group_dbg_show()
470 grp = &info->groups[group]; imx_pinconf_group_dbg_show()
504 struct imx_pinctrl_soc_info *info, imx_pinctrl_parse_groups()
512 dev_dbg(info->dev, "group(%d): %s\n", index, np->name); imx_pinctrl_parse_groups()
514 if (info->flags & SHARE_MUX_CONF_REG) imx_pinctrl_parse_groups()
527 dev_err(info->dev, "no fsl,pins property in node %s\n", np->full_name); imx_pinctrl_parse_groups()
533 dev_err(info->dev, "Invalid fsl,pins property in node %s\n", np->full_name); imx_pinctrl_parse_groups()
538 grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(struct imx_pin), imx_pinctrl_parse_groups()
540 grp->pin_ids = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int), imx_pinctrl_parse_groups()
552 if (!(info->flags & ZERO_OFFSET_VALID) && !mux_reg) imx_pinctrl_parse_groups()
555 if (info->flags & SHARE_MUX_CONF_REG) { imx_pinctrl_parse_groups()
564 pin_reg = &info->pin_regs[pin_id]; imx_pinctrl_parse_groups()
579 dev_dbg(info->dev, "%s: 0x%x 0x%08lx", info->pins[pin_id].name, imx_pinctrl_parse_groups()
587 struct imx_pinctrl_soc_info *info, imx_pinctrl_parse_functions()
595 dev_dbg(info->dev, "parse function(%d): %s\n", index, np->name); imx_pinctrl_parse_functions()
597 func = &info->functions[index]; imx_pinctrl_parse_functions()
603 dev_err(info->dev, "no groups defined in %s\n", np->full_name); imx_pinctrl_parse_functions()
606 func->groups = devm_kzalloc(info->dev, imx_pinctrl_parse_functions()
611 grp = &info->groups[info->group_index++]; for_each_child_of_node()
612 imx_pinctrl_parse_groups(child, grp, info, i++); for_each_child_of_node()
642 struct imx_pinctrl_soc_info *info) imx_pinctrl_probe_dt()
664 info->nfunctions = nfuncs; imx_pinctrl_probe_dt()
665 info->functions = devm_kzalloc(&pdev->dev, nfuncs * sizeof(struct imx_pmx_func), imx_pinctrl_probe_dt()
667 if (!info->functions) imx_pinctrl_probe_dt()
671 info->ngroups = of_get_child_count(np); imx_pinctrl_probe_dt()
673 info->ngroups = 0; imx_pinctrl_probe_dt()
675 info->ngroups += of_get_child_count(child); imx_pinctrl_probe_dt()
677 info->groups = devm_kzalloc(&pdev->dev, info->ngroups * sizeof(struct imx_pin_group), imx_pinctrl_probe_dt()
679 if (!info->groups) imx_pinctrl_probe_dt()
683 imx_pinctrl_parse_functions(np, info, 0); imx_pinctrl_probe_dt()
686 imx_pinctrl_parse_functions(child, info, i++); imx_pinctrl_probe_dt()
693 struct imx_pinctrl_soc_info *info) imx_pinctrl_probe()
701 if (!info || !info->pins || !info->npins) { imx_pinctrl_probe()
702 dev_err(&pdev->dev, "wrong pinctrl info\n"); imx_pinctrl_probe()
705 info->dev = &pdev->dev; imx_pinctrl_probe()
712 info->pin_regs = devm_kmalloc(&pdev->dev, sizeof(*info->pin_regs) * imx_pinctrl_probe()
713 info->npins, GFP_KERNEL); imx_pinctrl_probe()
714 if (!info->pin_regs) imx_pinctrl_probe()
717 for (i = 0; i < info->npins; i++) { imx_pinctrl_probe()
718 info->pin_regs[i].mux_reg = -1; imx_pinctrl_probe()
719 info->pin_regs[i].conf_reg = -1; imx_pinctrl_probe()
744 imx_pinctrl_desc.pins = info->pins; imx_pinctrl_probe()
745 imx_pinctrl_desc.npins = info->npins; imx_pinctrl_probe()
747 ret = imx_pinctrl_probe_dt(pdev, info); imx_pinctrl_probe()
753 ipctl->info = info; imx_pinctrl_probe()
754 ipctl->dev = info->dev; imx_pinctrl_probe()
47 imx_pinctrl_find_group_by_name( const struct imx_pinctrl_soc_info *info, const char *name) imx_pinctrl_find_group_by_name() argument
502 imx_pinctrl_parse_groups(struct device_node *np, struct imx_pin_group *grp, struct imx_pinctrl_soc_info *info, u32 index) imx_pinctrl_parse_groups() argument
586 imx_pinctrl_parse_functions(struct device_node *np, struct imx_pinctrl_soc_info *info, u32 index) imx_pinctrl_parse_functions() argument
641 imx_pinctrl_probe_dt(struct platform_device *pdev, struct imx_pinctrl_soc_info *info) imx_pinctrl_probe_dt() argument
692 imx_pinctrl_probe(struct platform_device *pdev, struct imx_pinctrl_soc_info *info) imx_pinctrl_probe() argument
/linux-4.4.14/drivers/video/fbdev/omap2/dss/
H A Doverlay-sysfs.c118 struct omap_overlay_info info; overlay_input_size_show() local
120 ovl->get_overlay_info(ovl, &info); overlay_input_size_show()
123 info.width, info.height); overlay_input_size_show()
128 struct omap_overlay_info info; overlay_screen_width_show() local
130 ovl->get_overlay_info(ovl, &info); overlay_screen_width_show()
132 return snprintf(buf, PAGE_SIZE, "%d\n", info.screen_width); overlay_screen_width_show()
137 struct omap_overlay_info info; overlay_position_show() local
139 ovl->get_overlay_info(ovl, &info); overlay_position_show()
142 info.pos_x, info.pos_y); overlay_position_show()
150 struct omap_overlay_info info; overlay_position_store() local
152 ovl->get_overlay_info(ovl, &info); overlay_position_store()
154 info.pos_x = simple_strtoul(buf, &last, 10); overlay_position_store()
159 info.pos_y = simple_strtoul(last, &last, 10); overlay_position_store()
161 r = ovl->set_overlay_info(ovl, &info); overlay_position_store()
176 struct omap_overlay_info info; overlay_output_size_show() local
178 ovl->get_overlay_info(ovl, &info); overlay_output_size_show()
181 info.out_width, info.out_height); overlay_output_size_show()
189 struct omap_overlay_info info; overlay_output_size_store() local
191 ovl->get_overlay_info(ovl, &info); overlay_output_size_store()
193 info.out_width = simple_strtoul(buf, &last, 10); overlay_output_size_store()
198 info.out_height = simple_strtoul(last, &last, 10); overlay_output_size_store()
200 r = ovl->set_overlay_info(ovl, &info); overlay_output_size_store()
241 struct omap_overlay_info info; overlay_global_alpha_show() local
243 ovl->get_overlay_info(ovl, &info); overlay_global_alpha_show()
246 info.global_alpha); overlay_global_alpha_show()
254 struct omap_overlay_info info; overlay_global_alpha_store() local
263 ovl->get_overlay_info(ovl, &info); overlay_global_alpha_store()
265 info.global_alpha = alpha; overlay_global_alpha_store()
267 r = ovl->set_overlay_info(ovl, &info); overlay_global_alpha_store()
283 struct omap_overlay_info info; overlay_pre_mult_alpha_show() local
285 ovl->get_overlay_info(ovl, &info); overlay_pre_mult_alpha_show()
288 info.pre_mult_alpha); overlay_pre_mult_alpha_show()
296 struct omap_overlay_info info; overlay_pre_mult_alpha_store() local
305 ovl->get_overlay_info(ovl, &info); overlay_pre_mult_alpha_store()
307 info.pre_mult_alpha = alpha; overlay_pre_mult_alpha_store()
309 r = ovl->set_overlay_info(ovl, &info); overlay_pre_mult_alpha_store()
324 struct omap_overlay_info info; overlay_zorder_show() local
326 ovl->get_overlay_info(ovl, &info); overlay_zorder_show()
328 return snprintf(buf, PAGE_SIZE, "%d\n", info.zorder); overlay_zorder_show()
336 struct omap_overlay_info info; overlay_zorder_store() local
345 ovl->get_overlay_info(ovl, &info); overlay_zorder_store()
347 info.zorder = zorder; overlay_zorder_store()
349 r = ovl->set_overlay_info(ovl, &info); overlay_zorder_store()
H A Dmanager-sysfs.c130 struct omap_overlay_manager_info info; manager_default_color_show() local
132 mgr->get_manager_info(mgr, &info); manager_default_color_show()
134 return snprintf(buf, PAGE_SIZE, "%#x\n", info.default_color); manager_default_color_show()
140 struct omap_overlay_manager_info info; manager_default_color_store() local
148 mgr->get_manager_info(mgr, &info); manager_default_color_store()
150 info.default_color = color; manager_default_color_store()
152 r = mgr->set_manager_info(mgr, &info); manager_default_color_store()
172 struct omap_overlay_manager_info info; manager_trans_key_type_show() local
174 mgr->get_manager_info(mgr, &info); manager_trans_key_type_show()
176 key_type = info.trans_key_type; manager_trans_key_type_show()
186 struct omap_overlay_manager_info info; manager_trans_key_type_store() local
198 mgr->get_manager_info(mgr, &info); manager_trans_key_type_store()
200 info.trans_key_type = key_type; manager_trans_key_type_store()
202 r = mgr->set_manager_info(mgr, &info); manager_trans_key_type_store()
216 struct omap_overlay_manager_info info; manager_trans_key_value_show() local
218 mgr->get_manager_info(mgr, &info); manager_trans_key_value_show()
220 return snprintf(buf, PAGE_SIZE, "%#x\n", info.trans_key); manager_trans_key_value_show()
226 struct omap_overlay_manager_info info; manager_trans_key_value_store() local
234 mgr->get_manager_info(mgr, &info); manager_trans_key_value_store()
236 info.trans_key = key_value; manager_trans_key_value_store()
238 r = mgr->set_manager_info(mgr, &info); manager_trans_key_value_store()
252 struct omap_overlay_manager_info info; manager_trans_key_enabled_show() local
254 mgr->get_manager_info(mgr, &info); manager_trans_key_enabled_show()
256 return snprintf(buf, PAGE_SIZE, "%d\n", info.trans_enabled); manager_trans_key_enabled_show()
262 struct omap_overlay_manager_info info; manager_trans_key_enabled_store() local
270 mgr->get_manager_info(mgr, &info); manager_trans_key_enabled_store()
272 info.trans_enabled = enable; manager_trans_key_enabled_store()
274 r = mgr->set_manager_info(mgr, &info); manager_trans_key_enabled_store()
288 struct omap_overlay_manager_info info; manager_alpha_blending_enabled_show() local
293 mgr->get_manager_info(mgr, &info); manager_alpha_blending_enabled_show()
296 info.partial_alpha_enabled); manager_alpha_blending_enabled_show()
303 struct omap_overlay_manager_info info; manager_alpha_blending_enabled_store() local
314 mgr->get_manager_info(mgr, &info); manager_alpha_blending_enabled_store()
316 info.partial_alpha_enabled = enable; manager_alpha_blending_enabled_store()
318 r = mgr->set_manager_info(mgr, &info); manager_alpha_blending_enabled_store()
332 struct omap_overlay_manager_info info; manager_cpr_enable_show() local
334 mgr->get_manager_info(mgr, &info); manager_cpr_enable_show()
336 return snprintf(buf, PAGE_SIZE, "%d\n", info.cpr_enable); manager_cpr_enable_show()
342 struct omap_overlay_manager_info info; manager_cpr_enable_store() local
353 mgr->get_manager_info(mgr, &info); manager_cpr_enable_store()
355 if (info.cpr_enable == enable) manager_cpr_enable_store()
358 info.cpr_enable = enable; manager_cpr_enable_store()
360 r = mgr->set_manager_info(mgr, &info); manager_cpr_enable_store()
374 struct omap_overlay_manager_info info; manager_cpr_coef_show() local
376 mgr->get_manager_info(mgr, &info); manager_cpr_coef_show()
380 info.cpr_coefs.rr, manager_cpr_coef_show()
381 info.cpr_coefs.rg, manager_cpr_coef_show()
382 info.cpr_coefs.rb, manager_cpr_coef_show()
383 info.cpr_coefs.gr, manager_cpr_coef_show()
384 info.cpr_coefs.gg, manager_cpr_coef_show()
385 info.cpr_coefs.gb, manager_cpr_coef_show()
386 info.cpr_coefs.br, manager_cpr_coef_show()
387 info.cpr_coefs.bg, manager_cpr_coef_show()
388 info.cpr_coefs.bb); manager_cpr_coef_show()
394 struct omap_overlay_manager_info info; manager_cpr_coef_store() local
417 mgr->get_manager_info(mgr, &info); manager_cpr_coef_store()
419 info.cpr_coefs = coefs; manager_cpr_coef_store()
421 r = mgr->set_manager_info(mgr, &info); manager_cpr_coef_store()
/linux-4.4.14/arch/powerpc/lib/
H A Drheap.c45 static int grow(rh_info_t * info, int max_blocks) grow() argument
52 if (max_blocks <= info->max_blocks) grow()
55 new_blocks = max_blocks - info->max_blocks; grow()
61 if (info->max_blocks > 0) { grow()
64 memcpy(block, info->block, grow()
65 sizeof(rh_block_t) * info->max_blocks); grow()
67 delta = (char *)block - (char *)info->block; grow()
70 blks = (unsigned long)info->block; grow()
71 blke = (unsigned long)(info->block + info->max_blocks); grow()
73 for (i = 0, blk = block; i < info->max_blocks; i++, blk++) grow()
76 fixup(blks, blke, delta, &info->empty_list); grow()
77 fixup(blks, blke, delta, &info->free_list); grow()
78 fixup(blks, blke, delta, &info->taken_list); grow()
81 if ((info->flags & RHIF_STATIC_BLOCK) == 0) grow()
82 kfree(info->block); grow()
85 info->block = block; grow()
86 info->empty_slots += new_blocks; grow()
87 info->max_blocks = max_blocks; grow()
88 info->flags &= ~RHIF_STATIC_BLOCK; grow()
91 blk = block + info->max_blocks - new_blocks; grow()
93 list_add(&blk->list, &info->empty_list); grow()
103 static int assure_empty(rh_info_t * info, int slots) assure_empty() argument
112 if (info->empty_slots >= slots) assure_empty()
116 max_blocks = ((info->max_blocks + slots) + 15) & ~15; assure_empty()
118 return grow(info, max_blocks); assure_empty()
121 static rh_block_t *get_slot(rh_info_t * info) get_slot() argument
127 if (info->empty_slots == 0) { get_slot()
133 blk = list_entry(info->empty_list.next, rh_block_t, list); get_slot()
135 info->empty_slots--; get_slot()
145 static inline void release_slot(rh_info_t * info, rh_block_t * blk) release_slot() argument
147 list_add(&blk->list, &info->empty_list); release_slot()
148 info->empty_slots++; release_slot()
151 static void attach_free_block(rh_info_t * info, rh_block_t * blkn) attach_free_block() argument
172 list_for_each(l, &info->free_list) { attach_free_block()
205 list_add(&blkn->list, &info->free_list); attach_free_block()
211 release_slot(info, blkn); attach_free_block()
229 release_slot(info, after); attach_free_block()
232 static void attach_taken_block(rh_info_t * info, rh_block_t * blkn) attach_taken_block() argument
238 list_for_each(l, &info->taken_list) { attach_taken_block()
246 list_add_tail(&blkn->list, &info->taken_list); attach_taken_block()
255 rh_info_t *info; rh_create() local
261 info = kmalloc(sizeof(*info), GFP_ATOMIC); rh_create()
262 if (info == NULL) rh_create()
265 info->alignment = alignment; rh_create()
268 info->block = NULL; rh_create()
269 info->max_blocks = 0; rh_create()
270 info->empty_slots = 0; rh_create()
271 info->flags = 0; rh_create()
273 INIT_LIST_HEAD(&info->empty_list); rh_create()
274 INIT_LIST_HEAD(&info->free_list); rh_create()
275 INIT_LIST_HEAD(&info->taken_list); rh_create()
277 return info; rh_create()
285 void rh_destroy(rh_info_t * info) rh_destroy() argument
287 if ((info->flags & RHIF_STATIC_BLOCK) == 0) rh_destroy()
288 kfree(info->block); rh_destroy()
290 if ((info->flags & RHIF_STATIC_INFO) == 0) rh_destroy()
291 kfree(info); rh_destroy()
296 * Initialize in place a remote heap info block. This is needed to support
300 void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks, rh_init() argument
310 info->alignment = alignment; rh_init()
313 info->block = block; rh_init()
314 info->max_blocks = max_blocks; rh_init()
315 info->empty_slots = max_blocks; rh_init()
316 info->flags = RHIF_STATIC_INFO | RHIF_STATIC_BLOCK; rh_init()
318 INIT_LIST_HEAD(&info->empty_list); rh_init()
319 INIT_LIST_HEAD(&info->free_list); rh_init()
320 INIT_LIST_HEAD(&info->taken_list); rh_init()
324 list_add(&blk->list, &info->empty_list); rh_init()
329 int rh_attach_region(rh_info_t * info, unsigned long start, int size) rh_attach_region() argument
338 m = info->alignment - 1; rh_attach_region()
354 r = assure_empty(info, 1); rh_attach_region()
358 blk = get_slot(info); rh_attach_region()
363 attach_free_block(info, blk); rh_attach_region()
370 unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size) rh_detach_region() argument
383 m = info->alignment - 1; rh_detach_region()
391 if (assure_empty(info, 1) < 0) rh_detach_region()
395 list_for_each(l, &info->free_list) { rh_detach_region()
412 release_slot(info, blk); rh_detach_region()
427 newblk = get_slot(info); rh_detach_region()
442 unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner) rh_alloc_align() argument
454 size = (size + (info->alignment - 1)) & ~(info->alignment - 1); rh_alloc_align()
456 if (assure_empty(info, 2) < 0) rh_alloc_align()
460 list_for_each(l, &info->free_list) { rh_alloc_align()
485 spblk = get_slot(info); rh_alloc_align()
491 newblk = get_slot(info); rh_alloc_align()
502 release_slot(info, blk); rh_alloc_align()
507 attach_taken_block(info, newblk); rh_alloc_align()
517 unsigned long rh_alloc(rh_info_t * info, int size, const char *owner) rh_alloc() argument
519 return rh_alloc_align(info, size, info->alignment, owner); rh_alloc()
527 unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, const char *owner) rh_alloc_fixed() argument
540 m = info->alignment - 1; rh_alloc_fixed()
548 if (assure_empty(info, 2) < 0) rh_alloc_fixed()
552 list_for_each(l, &info->free_list) { rh_alloc_fixed()
572 attach_taken_block(info, blk); rh_alloc_fixed()
589 newblk2 = get_slot(info); rh_alloc_fixed()
596 newblk1 = get_slot(info); rh_alloc_fixed()
602 attach_taken_block(info, newblk1); rh_alloc_fixed()
612 int rh_free(rh_info_t * info, unsigned long start) rh_free() argument
620 list_for_each(l, &info->taken_list) { rh_free()
635 attach_free_block(info, blk); rh_free()
641 int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats) rh_get_stats() argument
651 h = &info->free_list; rh_get_stats()
655 h = &info->taken_list; rh_get_stats()
679 int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner) rh_set_owner() argument
687 list_for_each(l, &info->taken_list) { rh_set_owner()
704 void rh_dump(rh_info_t * info) rh_dump() argument
713 "info @0x%p (%d slots empty / %d max)\n", rh_dump()
714 info, info->empty_slots, info->max_blocks); rh_dump()
717 nr = rh_get_stats(info, RHGS_FREE, maxnr, st); rh_dump()
728 nr = rh_get_stats(info, RHGS_TAKEN, maxnr, st); rh_dump()
740 void rh_dump_blk(rh_info_t * info, rh_block_t * blk) rh_dump_blk() argument
/linux-4.4.14/drivers/acpi/acpica/
H A Dnseval.c56 struct acpi_evaluate_info *info);
62 * PARAMETERS: info - Evaluation info block, contains these fields
84 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) acpi_ns_evaluate() argument
90 if (!info) { acpi_ns_evaluate()
94 if (!info->node) { acpi_ns_evaluate()
104 acpi_ns_get_node(info->prefix_node, info->relative_pathname, acpi_ns_evaluate()
105 ACPI_NS_NO_UPSEARCH, &info->node); acpi_ns_evaluate()
115 if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { acpi_ns_evaluate()
116 info->node = acpi_ns_evaluate()
118 info->node->object); acpi_ns_evaluate()
121 /* Complete the info block initialization */ acpi_ns_evaluate()
123 info->return_object = NULL; acpi_ns_evaluate()
124 info->node_flags = info->node->flags; acpi_ns_evaluate()
125 info->obj_desc = acpi_ns_get_attached_object(info->node); acpi_ns_evaluate()
128 info->relative_pathname, info->node, acpi_ns_evaluate()
129 acpi_ns_get_attached_object(info->node))); acpi_ns_evaluate()
131 /* Get info if we have a predefined name (_HID, etc.) */ acpi_ns_evaluate()
133 info->predefined = acpi_ns_evaluate()
134 acpi_ut_match_predefined_method(info->node->name.ascii); acpi_ns_evaluate()
138 info->full_pathname = acpi_ns_get_external_pathname(info->node); acpi_ns_evaluate()
139 if (!info->full_pathname) { acpi_ns_evaluate()
145 info->param_count = 0; acpi_ns_evaluate()
146 if (info->parameters) { acpi_ns_evaluate()
147 while (info->parameters[info->param_count]) { acpi_ns_evaluate()
148 info->param_count++; acpi_ns_evaluate()
153 if (info->param_count > ACPI_METHOD_NUM_ARGS) { acpi_ns_evaluate()
154 ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, acpi_ns_evaluate()
157 info->param_count, acpi_ns_evaluate()
160 info->param_count = ACPI_METHOD_NUM_ARGS; acpi_ns_evaluate()
168 acpi_ns_check_acpi_compliance(info->full_pathname, info->node, acpi_ns_evaluate()
169 info->predefined); acpi_ns_evaluate()
175 acpi_ns_check_argument_count(info->full_pathname, info->node, acpi_ns_evaluate()
176 info->param_count, info->predefined); acpi_ns_evaluate()
180 acpi_ns_check_argument_types(info); acpi_ns_evaluate()
189 switch (acpi_ns_get_type(info->node)) { acpi_ns_evaluate()
202 info->full_pathname, acpi_ns_evaluate()
203 acpi_ut_get_type_name(info->node->type))); acpi_ns_evaluate()
215 if (!info->obj_desc) { acpi_ns_evaluate()
218 info->full_pathname)); acpi_ns_evaluate()
225 info->full_pathname, acpi_ns_evaluate()
226 info->obj_desc->method.aml_start + 1, acpi_ns_evaluate()
227 info->obj_desc->method.aml_length - 1)); acpi_ns_evaluate()
238 status = acpi_ps_execute_method(info); acpi_ns_evaluate()
267 info->return_object = acpi_ns_evaluate()
268 ACPI_CAST_PTR(union acpi_operand_object, info->node); acpi_ns_evaluate()
273 &info->return_object), NULL); acpi_ns_evaluate()
277 info->return_object = NULL; acpi_ns_evaluate()
282 info->return_object, acpi_ns_evaluate()
283 acpi_ut_get_object_type_name(info-> acpi_ns_evaluate()
294 (void)acpi_ns_check_return_value(info->node, info, info->param_count, acpi_ns_evaluate()
295 status, &info->return_object); acpi_ns_evaluate()
303 if (info->flags & ACPI_IGNORE_RETURN_VALUE) { acpi_ns_evaluate()
304 acpi_ut_remove_reference(info->return_object); acpi_ns_evaluate()
305 info->return_object = NULL; acpi_ns_evaluate()
315 info->relative_pathname)); acpi_ns_evaluate()
322 ACPI_FREE(info->full_pathname); acpi_ns_evaluate()
323 info->full_pathname = NULL; acpi_ns_evaluate()
345 struct acpi_evaluate_info *info; acpi_ns_exec_module_code_list() local
359 info = ACPI_ALLOCATE(sizeof(struct acpi_evaluate_info)); acpi_ns_exec_module_code_list()
360 if (!info) { acpi_ns_exec_module_code_list()
373 acpi_ns_exec_module_code(prev, info); acpi_ns_exec_module_code_list()
385 ACPI_FREE(info); acpi_ns_exec_module_code_list()
395 * info - Info block for method evaluation
408 struct acpi_evaluate_info *info) acpi_ns_exec_module_code()
443 memset(info, 0, sizeof(struct acpi_evaluate_info)); acpi_ns_exec_module_code()
444 info->prefix_node = parent_node; acpi_ns_exec_module_code()
466 status = acpi_ns_evaluate(info); acpi_ns_exec_module_code()
474 if (info->return_object) { acpi_ns_exec_module_code()
475 acpi_ut_remove_reference(info->return_object); acpi_ns_exec_module_code()
407 acpi_ns_exec_module_code(union acpi_operand_object *method_obj, struct acpi_evaluate_info *info) acpi_ns_exec_module_code() argument
/linux-4.4.14/drivers/auxdisplay/
H A Dcfag12864bfb.c67 static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma) cfag12864bfb_mmap() argument
86 struct fb_info *info = framebuffer_alloc(0, &device->dev); cfag12864bfb_probe() local
88 if (!info) cfag12864bfb_probe()
91 info->screen_base = (char __iomem *) cfag12864b_buffer; cfag12864bfb_probe()
92 info->screen_size = CFAG12864B_SIZE; cfag12864bfb_probe()
93 info->fbops = &cfag12864bfb_ops; cfag12864bfb_probe()
94 info->fix = cfag12864bfb_fix; cfag12864bfb_probe()
95 info->var = cfag12864bfb_var; cfag12864bfb_probe()
96 info->pseudo_palette = NULL; cfag12864bfb_probe()
97 info->par = NULL; cfag12864bfb_probe()
98 info->flags = FBINFO_FLAG_DEFAULT; cfag12864bfb_probe()
100 if (register_framebuffer(info) < 0) cfag12864bfb_probe()
103 platform_set_drvdata(device, info); cfag12864bfb_probe()
105 fb_info(info, "%s frame buffer device\n", info->fix.id); cfag12864bfb_probe()
110 framebuffer_release(info); cfag12864bfb_probe()
118 struct fb_info *info = platform_get_drvdata(device); cfag12864bfb_remove() local
120 if (info) { cfag12864bfb_remove()
121 unregister_framebuffer(info); cfag12864bfb_remove()
122 framebuffer_release(info); cfag12864bfb_remove()
/linux-4.4.14/arch/x86/kernel/
H A Dtls.c30 static bool tls_desc_okay(const struct user_desc *info) tls_desc_okay() argument
53 if (LDT_empty(info) || LDT_zero(info)) tls_desc_okay()
60 if (!info->seg_32bit) tls_desc_okay()
64 if (info->contents > 1) tls_desc_okay()
76 if (info->seg_not_present) tls_desc_okay()
83 const struct user_desc *info, int n) set_tls_desc()
95 if (LDT_empty(info) || LDT_zero(info)) set_tls_desc()
98 fill_ldt(desc, info); set_tls_desc()
99 ++info; set_tls_desc()
116 struct user_desc info; do_set_thread_area() local
118 if (copy_from_user(&info, u_info, sizeof(info))) do_set_thread_area()
121 if (!tls_desc_okay(&info)) do_set_thread_area()
125 idx = info.entry_number; do_set_thread_area()
142 set_tls_desc(p, idx, &info, 1); do_set_thread_area()
157 static void fill_user_desc(struct user_desc *info, int idx, fill_user_desc() argument
161 memset(info, 0, sizeof(*info)); fill_user_desc()
162 info->entry_number = idx; fill_user_desc()
163 info->base_addr = get_desc_base(desc); fill_user_desc()
164 info->limit = get_desc_limit(desc); fill_user_desc()
165 info->seg_32bit = desc->d; fill_user_desc()
166 info->contents = desc->type >> 2; fill_user_desc()
167 info->read_exec_only = !(desc->type & 2); fill_user_desc()
168 info->limit_in_pages = desc->g; fill_user_desc()
169 info->seg_not_present = !desc->p; fill_user_desc()
170 info->useable = desc->avl; fill_user_desc()
172 info->lm = desc->l; fill_user_desc()
179 struct user_desc info; do_get_thread_area() local
187 fill_user_desc(&info, idx, do_get_thread_area()
190 if (copy_to_user(u_info, &info, sizeof(info))) do_get_thread_area()
227 struct user_desc *info = kbuf; regset_tls_get() local
229 fill_user_desc(info++, GDT_ENTRY_TLS_MIN + pos++, regset_tls_get()
234 struct user_desc info; regset_tls_get() local
235 fill_user_desc(&info, GDT_ENTRY_TLS_MIN + pos++, tls++); regset_tls_get()
236 if (__copy_to_user(u_info++, &info, sizeof(info))) regset_tls_get()
249 const struct user_desc *info; regset_tls_set() local
258 info = kbuf; regset_tls_set()
262 info = infobuf; regset_tls_set()
265 if (!tls_desc_okay(info + i)) regset_tls_set()
270 info, count / sizeof(struct user_desc)); regset_tls_set()
82 set_tls_desc(struct task_struct *p, int idx, const struct user_desc *info, int n) set_tls_desc() argument
/linux-4.4.14/arch/sh/mm/
H A Dmmap.c39 struct vm_unmapped_area_info info; arch_get_unmapped_area() local
70 info.flags = 0; arch_get_unmapped_area()
71 info.length = len; arch_get_unmapped_area()
72 info.low_limit = TASK_UNMAPPED_BASE; arch_get_unmapped_area()
73 info.high_limit = TASK_SIZE; arch_get_unmapped_area()
74 info.align_mask = do_colour_align ? (PAGE_MASK & shm_align_mask) : 0; arch_get_unmapped_area()
75 info.align_offset = pgoff << PAGE_SHIFT; arch_get_unmapped_area()
76 return vm_unmapped_area(&info); arch_get_unmapped_area()
88 struct vm_unmapped_area_info info; arch_get_unmapped_area_topdown() local
120 info.flags = VM_UNMAPPED_AREA_TOPDOWN; arch_get_unmapped_area_topdown()
121 info.length = len; arch_get_unmapped_area_topdown()
122 info.low_limit = PAGE_SIZE; arch_get_unmapped_area_topdown()
123 info.high_limit = mm->mmap_base; arch_get_unmapped_area_topdown()
124 info.align_mask = do_colour_align ? (PAGE_MASK & shm_align_mask) : 0; arch_get_unmapped_area_topdown()
125 info.align_offset = pgoff << PAGE_SHIFT; arch_get_unmapped_area_topdown()
126 addr = vm_unmapped_area(&info); arch_get_unmapped_area_topdown()
136 info.flags = 0; arch_get_unmapped_area_topdown()
137 info.low_limit = TASK_UNMAPPED_BASE; arch_get_unmapped_area_topdown()
138 info.high_limit = TASK_SIZE; arch_get_unmapped_area_topdown()
139 addr = vm_unmapped_area(&info); arch_get_unmapped_area_topdown()
/linux-4.4.14/drivers/gpu/drm/nouveau/
H A Dnouveau_fbcon.c59 nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) nouveau_fbcon_fillrect() argument
61 struct nouveau_fbdev *fbcon = info->par; nouveau_fbcon_fillrect()
66 if (info->state != FBINFO_STATE_RUNNING) nouveau_fbcon_fillrect()
70 if (!in_interrupt() && !(info->flags & FBINFO_HWACCEL_DISABLED) && nouveau_fbcon_fillrect()
72 if (device->info.family < NV_DEVICE_INFO_V0_TESLA) nouveau_fbcon_fillrect()
73 ret = nv04_fbcon_fillrect(info, rect); nouveau_fbcon_fillrect()
75 if (device->info.family < NV_DEVICE_INFO_V0_FERMI) nouveau_fbcon_fillrect()
76 ret = nv50_fbcon_fillrect(info, rect); nouveau_fbcon_fillrect()
78 ret = nvc0_fbcon_fillrect(info, rect); nouveau_fbcon_fillrect()
86 nouveau_fbcon_gpu_lockup(info); nouveau_fbcon_fillrect()
87 drm_fb_helper_cfb_fillrect(info, rect); nouveau_fbcon_fillrect()
91 nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image) nouveau_fbcon_copyarea() argument
93 struct nouveau_fbdev *fbcon = info->par; nouveau_fbcon_copyarea()
98 if (info->state != FBINFO_STATE_RUNNING) nouveau_fbcon_copyarea()
102 if (!in_interrupt() && !(info->flags & FBINFO_HWACCEL_DISABLED) && nouveau_fbcon_copyarea()
104 if (device->info.family < NV_DEVICE_INFO_V0_TESLA) nouveau_fbcon_copyarea()
105 ret = nv04_fbcon_copyarea(info, image); nouveau_fbcon_copyarea()
107 if (device->info.family < NV_DEVICE_INFO_V0_FERMI) nouveau_fbcon_copyarea()
108 ret = nv50_fbcon_copyarea(info, image); nouveau_fbcon_copyarea()
110 ret = nvc0_fbcon_copyarea(info, image); nouveau_fbcon_copyarea()
118 nouveau_fbcon_gpu_lockup(info); nouveau_fbcon_copyarea()
119 drm_fb_helper_cfb_copyarea(info, image); nouveau_fbcon_copyarea()
123 nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) nouveau_fbcon_imageblit() argument
125 struct nouveau_fbdev *fbcon = info->par; nouveau_fbcon_imageblit()
130 if (info->state != FBINFO_STATE_RUNNING) nouveau_fbcon_imageblit()
134 if (!in_interrupt() && !(info->flags & FBINFO_HWACCEL_DISABLED) && nouveau_fbcon_imageblit()
136 if (device->info.family < NV_DEVICE_INFO_V0_TESLA) nouveau_fbcon_imageblit()
137 ret = nv04_fbcon_imageblit(info, image); nouveau_fbcon_imageblit()
139 if (device->info.family < NV_DEVICE_INFO_V0_FERMI) nouveau_fbcon_imageblit()
140 ret = nv50_fbcon_imageblit(info, image); nouveau_fbcon_imageblit()
142 ret = nvc0_fbcon_imageblit(info, image); nouveau_fbcon_imageblit()
150 nouveau_fbcon_gpu_lockup(info); nouveau_fbcon_imageblit()
151 drm_fb_helper_cfb_imageblit(info, image); nouveau_fbcon_imageblit()
155 nouveau_fbcon_sync(struct fb_info *info) nouveau_fbcon_sync() argument
157 struct nouveau_fbdev *fbcon = info->par; nouveau_fbcon_sync()
163 info->state != FBINFO_STATE_RUNNING || nouveau_fbcon_sync()
164 info->flags & FBINFO_HWACCEL_DISABLED) nouveau_fbcon_sync()
173 nouveau_fbcon_gpu_lockup(info); nouveau_fbcon_sync()
182 nouveau_fbcon_open(struct fb_info *info, int user) nouveau_fbcon_open() argument
184 struct nouveau_fbdev *fbcon = info->par; nouveau_fbcon_open()
193 nouveau_fbcon_release(struct fb_info *info, int user) nouveau_fbcon_release() argument
195 struct nouveau_fbdev *fbcon = info->par; nouveau_fbcon_release()
278 struct fb_info *info = fbcon->helper.fbdev; nouveau_fbcon_accel_init() local
281 if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) nouveau_fbcon_accel_init()
282 ret = nv04_fbcon_accel_init(info); nouveau_fbcon_accel_init()
284 if (drm->device.info.family < NV_DEVICE_INFO_V0_FERMI) nouveau_fbcon_accel_init()
285 ret = nv50_fbcon_accel_init(info); nouveau_fbcon_accel_init()
287 ret = nvc0_fbcon_accel_init(info); nouveau_fbcon_accel_init()
290 info->fbops = &nouveau_fbcon_ops; nouveau_fbcon_accel_init()
316 struct fb_info *info = fbcon->helper.fbdev; nouveau_fbcon_zfill() local
324 rect.width = info->var.xres_virtual; nouveau_fbcon_zfill()
325 rect.height = info->var.yres_virtual; nouveau_fbcon_zfill()
328 info->fbops->fb_fillrect(info, &rect); nouveau_fbcon_zfill()
340 struct fb_info *info; nouveau_fbcon_create() local
380 if (chan && device->info.family >= NV_DEVICE_INFO_V0_TESLA) { nouveau_fbcon_create()
391 info = drm_fb_helper_alloc_fbi(helper); nouveau_fbcon_create()
392 if (IS_ERR(info)) { nouveau_fbcon_create()
393 ret = PTR_ERR(info); nouveau_fbcon_create()
396 info->skip_vt_switch = 1; nouveau_fbcon_create()
398 info->par = fbcon; nouveau_fbcon_create()
408 strcpy(info->fix.id, "nouveaufb"); nouveau_fbcon_create()
410 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_DISABLED; nouveau_fbcon_create()
412 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA | nouveau_fbcon_create()
415 info->flags |= FBINFO_CAN_FORCE_OUTPUT; nouveau_fbcon_create()
416 info->fbops = &nouveau_fbcon_sw_ops; nouveau_fbcon_create()
417 info->fix.smem_start = nvbo->bo.mem.bus.base + nouveau_fbcon_create()
419 info->fix.smem_len = size; nouveau_fbcon_create()
421 info->screen_base = nvbo_kmap_obj_iovirtual(nouveau_fb->nvbo); nouveau_fbcon_create()
422 info->screen_size = size; nouveau_fbcon_create()
424 drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); nouveau_fbcon_create()
425 drm_fb_helper_fill_var(info, &fbcon->helper, sizes->fb_width, sizes->fb_height); nouveau_fbcon_create()
427 /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ nouveau_fbcon_create()
440 vga_switcheroo_client_fb_set(dev->pdev, info); nouveau_fbcon_create()
485 void nouveau_fbcon_gpu_lockup(struct fb_info *info) nouveau_fbcon_gpu_lockup() argument
487 struct nouveau_fbdev *fbcon = info->par; nouveau_fbcon_gpu_lockup()
491 info->flags |= FBINFO_HWACCEL_DISABLED; nouveau_fbcon_gpu_lockup()
545 if (drm->device.info.ram_size <= 32 * 1024 * 1024) nouveau_fbcon_init()
548 if (drm->device.info.ram_size <= 64 * 1024 * 1024) nouveau_fbcon_init()
/linux-4.4.14/ipc/
H A Dmqueue.c90 static void remove_notification(struct mqueue_inode_info *info);
120 static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) msg_insert() argument
125 p = &info->msg_tree.rb_node; msg_insert()
137 if (info->node_cache) { msg_insert()
138 leaf = info->node_cache; msg_insert()
139 info->node_cache = NULL; msg_insert()
148 rb_insert_color(&leaf->rb_node, &info->msg_tree); msg_insert()
150 info->attr.mq_curmsgs++; msg_insert()
151 info->qsize += msg->m_ts; msg_insert()
156 static inline struct msg_msg *msg_get(struct mqueue_inode_info *info) msg_get() argument
163 p = &info->msg_tree.rb_node; msg_get()
174 if (info->attr.mq_curmsgs) { msg_get()
178 info->attr.mq_curmsgs = 0; msg_get()
187 rb_erase(&leaf->rb_node, &info->msg_tree); msg_get()
188 if (info->node_cache) { msg_get()
191 info->node_cache = leaf; msg_get()
199 rb_erase(&leaf->rb_node, &info->msg_tree); msg_get()
200 if (info->node_cache) { msg_get()
203 info->node_cache = leaf; msg_get()
207 info->attr.mq_curmsgs--; msg_get()
208 info->qsize -= msg->m_ts; msg_get()
231 struct mqueue_inode_info *info; mqueue_get_inode() local
236 /* mqueue specific info */ mqueue_get_inode()
237 info = MQUEUE_I(inode); mqueue_get_inode()
238 spin_lock_init(&info->lock); mqueue_get_inode()
239 init_waitqueue_head(&info->wait_q); mqueue_get_inode()
240 INIT_LIST_HEAD(&info->e_wait_q[0].list); mqueue_get_inode()
241 INIT_LIST_HEAD(&info->e_wait_q[1].list); mqueue_get_inode()
242 info->notify_owner = NULL; mqueue_get_inode()
243 info->notify_user_ns = NULL; mqueue_get_inode()
244 info->qsize = 0; mqueue_get_inode()
245 info->user = NULL; /* set when all is ok */ mqueue_get_inode()
246 info->msg_tree = RB_ROOT; mqueue_get_inode()
247 info->node_cache = NULL; mqueue_get_inode()
248 memset(&info->attr, 0, sizeof(info->attr)); mqueue_get_inode()
249 info->attr.mq_maxmsg = min(ipc_ns->mq_msg_max, mqueue_get_inode()
251 info->attr.mq_msgsize = min(ipc_ns->mq_msgsize_max, mqueue_get_inode()
254 info->attr.mq_maxmsg = attr->mq_maxmsg; mqueue_get_inode()
255 info->attr.mq_msgsize = attr->mq_msgsize; mqueue_get_inode()
270 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + mqueue_get_inode()
271 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * mqueue_get_inode()
274 mq_bytes = mq_treesize + (info->attr.mq_maxmsg * mqueue_get_inode()
275 info->attr.mq_msgsize); mqueue_get_inode()
281 /* mqueue_evict_inode() releases info->messages */ mqueue_get_inode()
289 info->user = get_uid(u); mqueue_get_inode()
372 struct mqueue_inode_info *info; mqueue_evict_inode() local
384 info = MQUEUE_I(inode); mqueue_evict_inode()
385 spin_lock(&info->lock); mqueue_evict_inode()
386 while ((msg = msg_get(info)) != NULL) mqueue_evict_inode()
388 kfree(info->node_cache); mqueue_evict_inode()
389 spin_unlock(&info->lock); mqueue_evict_inode()
392 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + mqueue_evict_inode()
393 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * mqueue_evict_inode()
396 mq_bytes = mq_treesize + (info->attr.mq_maxmsg * mqueue_evict_inode()
397 info->attr.mq_msgsize); mqueue_evict_inode()
399 user = info->user; mqueue_evict_inode()
477 * to read only queue size & notification info (the only values
484 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); mqueue_read_file() local
488 spin_lock(&info->lock); mqueue_read_file()
491 info->qsize, mqueue_read_file()
492 info->notify_owner ? info->notify.sigev_notify : 0, mqueue_read_file()
493 (info->notify_owner && mqueue_read_file()
494 info->notify.sigev_notify == SIGEV_SIGNAL) ? mqueue_read_file()
495 info->notify.sigev_signo : 0, mqueue_read_file()
496 pid_vnr(info->notify_owner)); mqueue_read_file()
497 spin_unlock(&info->lock); mqueue_read_file()
511 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); mqueue_flush_file() local
513 spin_lock(&info->lock); mqueue_flush_file()
514 if (task_tgid(current) == info->notify_owner) mqueue_flush_file()
515 remove_notification(info); mqueue_flush_file()
517 spin_unlock(&info->lock); mqueue_flush_file()
523 struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); mqueue_poll_file() local
526 poll_wait(filp, &info->wait_q, poll_tab); mqueue_poll_file()
528 spin_lock(&info->lock); mqueue_poll_file()
529 if (info->attr.mq_curmsgs) mqueue_poll_file()
532 if (info->attr.mq_curmsgs < info->attr.mq_maxmsg) mqueue_poll_file()
534 spin_unlock(&info->lock); mqueue_poll_file()
539 /* Adds current to info->e_wait_q[sr] before element with smaller prio */ wq_add()
540 static void wq_add(struct mqueue_inode_info *info, int sr, wq_add() argument
547 list_for_each_entry(walk, &info->e_wait_q[sr].list, list) { wq_add()
553 list_add_tail(&ewp->list, &info->e_wait_q[sr].list); wq_add()
561 static int wq_sleep(struct mqueue_inode_info *info, int sr, wq_sleep() argument
567 wq_add(info, sr, ewp); wq_sleep()
572 spin_unlock(&info->lock); wq_sleep()
580 spin_lock(&info->lock); wq_sleep()
596 spin_unlock(&info->lock); wq_sleep()
605 struct mqueue_inode_info *info, int sr) wq_get_first_waiter()
609 ptr = info->e_wait_q[sr].list.prev; wq_get_first_waiter()
610 if (ptr == &info->e_wait_q[sr].list) wq_get_first_waiter()
624 static void __do_notify(struct mqueue_inode_info *info) __do_notify() argument
631 if (info->notify_owner && __do_notify()
632 info->attr.mq_curmsgs == 1) { __do_notify()
634 switch (info->notify.sigev_notify) { __do_notify()
640 sig_i.si_signo = info->notify.sigev_signo; __do_notify()
643 sig_i.si_value = info->notify.sigev_value; __do_notify()
644 /* map current pid/uid into info->owner's namespaces */ __do_notify()
647 ns_of_pid(info->notify_owner)); __do_notify()
648 sig_i.si_uid = from_kuid_munged(info->notify_user_ns, current_uid()); __do_notify()
651 kill_pid_info(info->notify.sigev_signo, __do_notify()
652 &sig_i, info->notify_owner); __do_notify()
655 set_cookie(info->notify_cookie, NOTIFY_WOKENUP); __do_notify()
656 netlink_sendskb(info->notify_sock, info->notify_cookie); __do_notify()
660 put_pid(info->notify_owner); __do_notify()
661 put_user_ns(info->notify_user_ns); __do_notify()
662 info->notify_owner = NULL; __do_notify()
663 info->notify_user_ns = NULL; __do_notify()
665 wake_up(&info->wait_q); __do_notify()
680 static void remove_notification(struct mqueue_inode_info *info) remove_notification() argument
682 if (info->notify_owner != NULL && remove_notification()
683 info->notify.sigev_notify == SIGEV_THREAD) { remove_notification()
684 set_cookie(info->notify_cookie, NOTIFY_REMOVED); remove_notification()
685 netlink_sendskb(info->notify_sock, info->notify_cookie); remove_notification()
687 put_pid(info->notify_owner); remove_notification()
688 put_user_ns(info->notify_user_ns); remove_notification()
689 info->notify_owner = NULL; remove_notification()
690 info->notify_user_ns = NULL; remove_notification()
907 * - Queue the receiver task for later wakeup (without the info->lock).
920 struct mqueue_inode_info *info, pipelined_send()
941 struct mqueue_inode_info *info) pipelined_receive()
943 struct ext_wait_queue *sender = wq_get_first_waiter(info, SEND); pipelined_receive()
947 wake_up_interruptible(&info->wait_q); pipelined_receive()
950 if (msg_insert(sender->msg, info)) pipelined_receive()
967 struct mqueue_inode_info *info; SYSCALL_DEFINE5() local
997 info = MQUEUE_I(inode); SYSCALL_DEFINE5()
1005 if (unlikely(msg_len > info->attr.mq_msgsize)) { SYSCALL_DEFINE5()
1025 if (!info->node_cache) SYSCALL_DEFINE5()
1028 spin_lock(&info->lock); SYSCALL_DEFINE5()
1030 if (!info->node_cache && new_leaf) { SYSCALL_DEFINE5()
1033 info->node_cache = new_leaf; SYSCALL_DEFINE5()
1039 if (info->attr.mq_curmsgs == info->attr.mq_maxmsg) { SYSCALL_DEFINE5()
1046 ret = wq_sleep(info, SEND, timeout, &wait); SYSCALL_DEFINE5()
1048 * wq_sleep must be called with info->lock held, and SYSCALL_DEFINE5()
1054 receiver = wq_get_first_waiter(info, RECV); SYSCALL_DEFINE5()
1056 pipelined_send(&wake_q, info, msg_ptr, receiver); SYSCALL_DEFINE5()
1059 ret = msg_insert(msg_ptr, info); SYSCALL_DEFINE5()
1062 __do_notify(info); SYSCALL_DEFINE5()
1068 spin_unlock(&info->lock); SYSCALL_DEFINE5()
1087 struct mqueue_inode_info *info; SYSCALL_DEFINE5() local
1113 info = MQUEUE_I(inode); SYSCALL_DEFINE5()
1122 if (unlikely(msg_len < info->attr.mq_msgsize)) { SYSCALL_DEFINE5()
1132 if (!info->node_cache) SYSCALL_DEFINE5()
1135 spin_lock(&info->lock); SYSCALL_DEFINE5()
1137 if (!info->node_cache && new_leaf) { SYSCALL_DEFINE5()
1140 info->node_cache = new_leaf; SYSCALL_DEFINE5()
1145 if (info->attr.mq_curmsgs == 0) { SYSCALL_DEFINE5()
1147 spin_unlock(&info->lock); SYSCALL_DEFINE5()
1152 ret = wq_sleep(info, RECV, timeout, &wait); SYSCALL_DEFINE5()
1158 msg_ptr = msg_get(info); SYSCALL_DEFINE5()
1164 pipelined_receive(&wake_q, info); SYSCALL_DEFINE5()
1165 spin_unlock(&info->lock); SYSCALL_DEFINE5()
1197 struct mqueue_inode_info *info; SYSCALL_DEFINE2() local
1275 info = MQUEUE_I(inode); SYSCALL_DEFINE2()
1278 spin_lock(&info->lock); SYSCALL_DEFINE2()
1280 if (info->notify_owner == task_tgid(current)) { SYSCALL_DEFINE2()
1281 remove_notification(info); SYSCALL_DEFINE2()
1284 } else if (info->notify_owner != NULL) { SYSCALL_DEFINE2()
1289 info->notify.sigev_notify = SIGEV_NONE; SYSCALL_DEFINE2()
1292 info->notify_sock = sock; SYSCALL_DEFINE2()
1293 info->notify_cookie = nc; SYSCALL_DEFINE2()
1296 info->notify.sigev_notify = SIGEV_THREAD; SYSCALL_DEFINE2()
1299 info->notify.sigev_signo = notification.sigev_signo; SYSCALL_DEFINE2()
1300 info->notify.sigev_value = notification.sigev_value; SYSCALL_DEFINE2()
1301 info->notify.sigev_notify = SIGEV_SIGNAL; SYSCALL_DEFINE2()
1305 info->notify_owner = get_pid(task_tgid(current)); SYSCALL_DEFINE2()
1306 info->notify_user_ns = get_user_ns(current_user_ns()); SYSCALL_DEFINE2()
1309 spin_unlock(&info->lock); SYSCALL_DEFINE2()
1329 struct mqueue_inode_info *info; SYSCALL_DEFINE3() local
1349 info = MQUEUE_I(inode); SYSCALL_DEFINE3()
1351 spin_lock(&info->lock); SYSCALL_DEFINE3()
1353 omqstat = info->attr; SYSCALL_DEFINE3()
1367 spin_unlock(&info->lock); SYSCALL_DEFINE3()
604 wq_get_first_waiter( struct mqueue_inode_info *info, int sr) wq_get_first_waiter() argument
919 pipelined_send(struct wake_q_head *wake_q, struct mqueue_inode_info *info, struct msg_msg *message, struct ext_wait_queue *receiver) pipelined_send() argument
940 pipelined_receive(struct wake_q_head *wake_q, struct mqueue_inode_info *info) pipelined_receive() argument
/linux-4.4.14/drivers/acpi/
H A Dacpi_memhotplug.c87 struct acpi_memory_info *info, *new; acpi_memory_get_resource() local
95 list_for_each_entry(info, &mem_device->res_list, list) { acpi_memory_get_resource()
97 if ((info->caching == address64.info.mem.caching) && acpi_memory_get_resource()
98 (info->write_protect == address64.info.mem.write_protect) && acpi_memory_get_resource()
99 (info->start_addr + info->length == address64.address.minimum)) { acpi_memory_get_resource()
100 info->length += address64.address.address_length; acpi_memory_get_resource()
110 new->caching = address64.info.mem.caching; acpi_memory_get_resource()
111 new->write_protect = address64.info.mem.write_protect; acpi_memory_get_resource()
122 struct acpi_memory_info *info, *n; acpi_memory_free_device_resources() local
124 list_for_each_entry_safe(info, n, &mem_device->res_list, list) acpi_memory_free_device_resources()
125 kfree(info); acpi_memory_free_device_resources()
168 static unsigned long acpi_meminfo_start_pfn(struct acpi_memory_info *info) acpi_meminfo_start_pfn() argument
170 return PFN_DOWN(info->start_addr); acpi_meminfo_start_pfn()
173 static unsigned long acpi_meminfo_end_pfn(struct acpi_memory_info *info) acpi_meminfo_end_pfn() argument
175 return PFN_UP(info->start_addr + info->length-1); acpi_meminfo_end_pfn()
183 static int acpi_bind_memory_blocks(struct acpi_memory_info *info, acpi_bind_memory_blocks() argument
186 return walk_memory_range(acpi_meminfo_start_pfn(info), acpi_bind_memory_blocks()
187 acpi_meminfo_end_pfn(info), adev, acpi_bind_memory_blocks()
197 static void acpi_unbind_memory_blocks(struct acpi_memory_info *info) acpi_unbind_memory_blocks() argument
199 walk_memory_range(acpi_meminfo_start_pfn(info), acpi_unbind_memory_blocks()
200 acpi_meminfo_end_pfn(info), NULL, acpi_unbind_memblk); acpi_unbind_memory_blocks()
207 struct acpi_memory_info *info; acpi_memory_enable_device() local
217 list_for_each_entry(info, &mem_device->res_list, list) { acpi_memory_enable_device()
218 if (info->enabled) { /* just sanity check...*/ acpi_memory_enable_device()
226 if (!info->length) acpi_memory_enable_device()
229 node = memory_add_physaddr_to_nid(info->start_addr); acpi_memory_enable_device()
231 result = add_memory(node, info->start_addr, info->length); acpi_memory_enable_device()
241 result = acpi_bind_memory_blocks(info, mem_device->device); acpi_memory_enable_device()
243 acpi_unbind_memory_blocks(info); acpi_memory_enable_device()
247 info->enabled = 1; acpi_memory_enable_device()
274 struct acpi_memory_info *info, *n; acpi_memory_remove_memory() local
277 list_for_each_entry_safe(info, n, &mem_device->res_list, list) { acpi_memory_remove_memory()
278 if (!info->enabled) acpi_memory_remove_memory()
282 nid = memory_add_physaddr_to_nid(info->start_addr); acpi_memory_remove_memory()
284 acpi_unbind_memory_blocks(info); acpi_memory_remove_memory()
285 remove_memory(nid, info->start_addr, info->length); acpi_memory_remove_memory()
286 list_del(&info->list); acpi_memory_remove_memory()
287 kfree(info); acpi_memory_remove_memory()
/linux-4.4.14/net/dccp/
H A Ddiag.c19 static void dccp_get_info(struct sock *sk, struct tcp_info *info) dccp_get_info() argument
24 memset(info, 0, sizeof(*info)); dccp_get_info()
26 info->tcpi_state = sk->sk_state; dccp_get_info()
27 info->tcpi_retransmits = icsk->icsk_retransmits; dccp_get_info()
28 info->tcpi_probes = icsk->icsk_probes_out; dccp_get_info()
29 info->tcpi_backoff = icsk->icsk_backoff; dccp_get_info()
30 info->tcpi_pmtu = icsk->icsk_pmtu_cookie; dccp_get_info()
33 info->tcpi_options |= TCPI_OPT_SACK; dccp_get_info()
36 ccid_hc_rx_get_info(dp->dccps_hc_rx_ccid, sk, info); dccp_get_info()
39 ccid_hc_tx_get_info(dp->dccps_hc_tx_ccid, sk, info); dccp_get_info()
/linux-4.4.14/include/net/
H A Dcfg80211-wext.h24 struct iw_request_info *info,
26 int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
28 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
31 struct iw_request_info *info,
34 struct iw_request_info *info,
37 struct iw_request_info *info,
40 struct iw_request_info *info,
43 struct iw_request_info *info,
46 struct iw_request_info *info,
49 struct iw_request_info *info,
52 struct iw_request_info *info,
/linux-4.4.14/drivers/video/fbdev/kyro/
H A Dfbdev.c78 /* global graphics card info structure (one per card) */
300 static int kyro_dev_video_mode_set(struct fb_info *info) kyro_dev_video_mode_set() argument
302 struct kyrofb_info *par = info->par; kyro_dev_video_mode_set()
312 info->var.bits_per_pixel, kyro_dev_video_mode_set()
313 info->var.xres, info->var.yres, kyro_dev_video_mode_set()
325 deviceInfo.ulNextFreeVidMem = info->var.xres * info->var.yres * kyro_dev_video_mode_set()
326 info->var.bits_per_pixel; kyro_dev_video_mode_set()
393 static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) kyrofb_check_var() argument
395 struct kyrofb_info *par = info->par; kyrofb_check_var()
469 static int kyrofb_set_par(struct fb_info *info) kyrofb_set_par() argument
471 struct kyrofb_info *par = info->par; kyrofb_set_par()
476 par->XRES = info->var.xres; kyrofb_set_par()
477 par->YRES = info->var.yres; kyrofb_set_par()
480 par->PIXDEPTH = info->var.bits_per_pixel; kyrofb_set_par()
484 lineclock = (info->var.pixclock * (info->var.xres + kyrofb_set_par()
485 info->var.right_margin + kyrofb_set_par()
486 info->var.hsync_len + kyrofb_set_par()
487 info->var.left_margin)) / 1000; kyrofb_set_par()
491 frameclock = lineclock * (info->var.yres + kyrofb_set_par()
492 info->var.lower_margin + kyrofb_set_par()
493 info->var.vsync_len + kyrofb_set_par()
494 info->var.upper_margin); kyrofb_set_par()
499 par->PIXCLK = ((1000000000 + (info->var.pixclock / 2)) kyrofb_set_par()
500 / info->var.pixclock) * 10; kyrofb_set_par()
503 par->HFP = info->var.right_margin; kyrofb_set_par()
504 par->HST = info->var.hsync_len; kyrofb_set_par()
505 par->HBP = info->var.left_margin; kyrofb_set_par()
509 par->VFP = info->var.lower_margin; kyrofb_set_par()
510 par->VST = info->var.vsync_len; kyrofb_set_par()
511 par->VBP = info->var.upper_margin; kyrofb_set_par()
514 par->HSP = (info->var.sync & FB_SYNC_HOR_HIGH_ACT) ? 1 : 0; kyrofb_set_par()
515 par->VSP = (info->var.sync & FB_SYNC_VERT_HIGH_ACT) ? 1 : 0; kyrofb_set_par()
517 kyro_dev_video_mode_set(info); kyrofb_set_par()
520 info->fix.line_length = get_line_length(par->XRES, par->PIXDEPTH); kyrofb_set_par()
521 info->fix.visual = FB_VISUAL_TRUECOLOR; kyrofb_set_par()
527 u_int blue, u_int transp, struct fb_info *info) kyrofb_setcolreg()
529 struct kyrofb_info *par = info->par; kyrofb_setcolreg()
535 switch (info->var.bits_per_pixel) { kyrofb_setcolreg()
579 static int kyrofb_ioctl(struct fb_info *info, kyrofb_ioctl() argument
664 struct fb_info *info; kyrofb_probe() local
674 info = framebuffer_alloc(sizeof(struct kyrofb_info), &pdev->dev); kyrofb_probe()
675 if (!info) kyrofb_probe()
678 currentpar = info->par; kyrofb_probe()
690 info->screen_base = pci_ioremap_wc_bar(pdev, 0); kyrofb_probe()
691 if (!info->screen_base) kyrofb_probe()
701 info->fbops = &kyrofb_ops; kyrofb_probe()
702 info->fix = kyro_fix; kyrofb_probe()
703 info->pseudo_palette = currentpar->palette; kyrofb_probe()
704 info->flags = FBINFO_DEFAULT; kyrofb_probe()
712 if (!fb_find_mode(&info->var, info, mode_option, kyro_modedb, kyrofb_probe()
714 info->var = kyro_var; kyrofb_probe()
716 fb_alloc_cmap(&info->cmap, 256, 0); kyrofb_probe()
718 kyrofb_set_par(info); kyrofb_probe()
719 kyrofb_check_var(&info->var, info); kyrofb_probe()
721 size = get_line_length(info->var.xres_virtual, kyrofb_probe()
722 info->var.bits_per_pixel); kyrofb_probe()
723 size *= info->var.yres_virtual; kyrofb_probe()
725 fb_memset(info->screen_base, 0, size); kyrofb_probe()
727 if (register_framebuffer(info) < 0) kyrofb_probe()
730 fb_info(info, "%s frame buffer device, at %dx%d@%d using %ldk/%ldk of VRAM\n", kyrofb_probe()
731 info->fix.id, kyrofb_probe()
732 info->var.xres, info->var.yres, info->var.bits_per_pixel, kyrofb_probe()
733 size >> 10, (unsigned long)info->fix.smem_len >> 10); kyrofb_probe()
735 pci_set_drvdata(pdev, info); kyrofb_probe()
740 iounmap(info->screen_base); kyrofb_probe()
744 framebuffer_release(info); kyrofb_probe()
751 struct fb_info *info = pci_get_drvdata(pdev); kyrofb_remove() local
752 struct kyrofb_info *par = info->par; kyrofb_remove()
764 iounmap(info->screen_base); kyrofb_remove()
769 unregister_framebuffer(info); kyrofb_remove()
770 framebuffer_release(info); kyrofb_remove()
526 kyrofb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info) kyrofb_setcolreg() argument
/linux-4.4.14/drivers/media/i2c/
H A Dnoon010pc30.c245 static inline int set_i2c_page(struct noon010_info *info, set_i2c_page() argument
251 if (info->i2c_reg_page != page && (reg & 0xFF) != 0x03) { set_i2c_page()
254 info->i2c_reg_page = page; set_i2c_page()
262 struct noon010_info *info = to_noon010(sd); cam_i2c_read() local
263 int ret = set_i2c_page(info, client, reg_addr); cam_i2c_read()
273 struct noon010_info *info = to_noon010(sd); cam_i2c_write() local
274 int ret = set_i2c_page(info, client, reg_addr); cam_i2c_write()
297 struct noon010_info *info = to_noon010(sd); noon010_power_ctrl() local
308 info->i2c_reg_page = -1; noon010_power_ctrl()
327 struct noon010_info *info = to_noon010(sd); noon010_set_flip() local
342 info->hflip = hflip; noon010_set_flip()
343 info->vflip = vflip; noon010_set_flip()
351 struct noon010_info *info = to_noon010(sd); noon010_set_params() local
354 info->curr_win->vid_ctl1); noon010_set_params()
358 info->curr_fmt->ispctl1_reg); noon010_set_params()
390 /* Called with info.lock mutex held */ power_enable()
391 static int power_enable(struct noon010_info *info) power_enable() argument
395 if (info->power) { power_enable()
396 v4l2_info(&info->sd, "%s: sensor is already on\n", __func__); power_enable()
400 if (gpio_is_valid(info->gpio_nstby)) power_enable()
401 gpio_set_value(info->gpio_nstby, 0); power_enable()
403 if (gpio_is_valid(info->gpio_nreset)) power_enable()
404 gpio_set_value(info->gpio_nreset, 0); power_enable()
406 ret = regulator_bulk_enable(NOON010_NUM_SUPPLIES, info->supply); power_enable()
410 if (gpio_is_valid(info->gpio_nreset)) { power_enable()
412 gpio_set_value(info->gpio_nreset, 1); power_enable()
414 if (gpio_is_valid(info->gpio_nstby)) { power_enable()
416 gpio_set_value(info->gpio_nstby, 1); power_enable()
418 if (gpio_is_valid(info->gpio_nreset)) { power_enable()
420 gpio_set_value(info->gpio_nreset, 0); power_enable()
422 gpio_set_value(info->gpio_nreset, 1); power_enable()
425 info->power = 1; power_enable()
427 v4l2_dbg(1, debug, &info->sd, "%s: sensor is on\n", __func__); power_enable()
431 /* Called with info.lock mutex held */ power_disable()
432 static int power_disable(struct noon010_info *info) power_disable() argument
436 if (!info->power) { power_disable()
437 v4l2_info(&info->sd, "%s: sensor is already off\n", __func__); power_disable()
441 ret = regulator_bulk_disable(NOON010_NUM_SUPPLIES, info->supply); power_disable()
445 if (gpio_is_valid(info->gpio_nstby)) power_disable()
446 gpio_set_value(info->gpio_nstby, 0); power_disable()
448 if (gpio_is_valid(info->gpio_nreset)) power_disable()
449 gpio_set_value(info->gpio_nreset, 0); power_disable()
451 info->power = 0; power_disable()
453 v4l2_dbg(1, debug, &info->sd, "%s: sensor is off\n", __func__); power_disable()
461 struct noon010_info *info = to_noon010(sd); noon010_s_ctrl() local
467 mutex_lock(&info->lock); noon010_s_ctrl()
473 if (!info->power) noon010_s_ctrl()
490 mutex_unlock(&info->lock); noon010_s_ctrl()
509 struct noon010_info *info = to_noon010(sd); noon010_get_fmt() local
521 mutex_lock(&info->lock); noon010_get_fmt()
522 mf->width = info->curr_win->width; noon010_get_fmt()
523 mf->height = info->curr_win->height; noon010_get_fmt()
524 mf->code = info->curr_fmt->code; noon010_get_fmt()
525 mf->colorspace = info->curr_fmt->colorspace; noon010_get_fmt()
528 mutex_unlock(&info->lock); noon010_get_fmt()
549 struct noon010_info *info = to_noon010(sd); noon010_set_fmt() local
567 mutex_lock(&info->lock); noon010_set_fmt()
568 if (!info->streaming) { noon010_set_fmt()
569 info->apply_new_cfg = 1; noon010_set_fmt()
570 info->curr_fmt = nf; noon010_set_fmt()
571 info->curr_win = size; noon010_set_fmt()
575 mutex_unlock(&info->lock); noon010_set_fmt()
593 struct noon010_info *info = to_noon010(sd); noon010_s_power() local
596 mutex_lock(&info->lock); noon010_s_power()
598 ret = power_enable(info); noon010_s_power()
603 ret = power_disable(info); noon010_s_power()
605 mutex_unlock(&info->lock); noon010_s_power()
609 ret = v4l2_ctrl_handler_setup(&info->hdl); noon010_s_power()
616 struct noon010_info *info = to_noon010(sd); noon010_s_stream() local
619 mutex_lock(&info->lock); noon010_s_stream()
620 if (!info->streaming != !on) { noon010_s_stream()
623 info->streaming = on; noon010_s_stream()
625 if (!ret && on && info->apply_new_cfg) { noon010_s_stream()
628 info->apply_new_cfg = 0; noon010_s_stream()
630 mutex_unlock(&info->lock); noon010_s_stream()
636 struct noon010_info *info = to_noon010(sd); noon010_log_status() local
638 v4l2_ctrl_handler_log_status(&info->hdl, sd->name); noon010_log_status()
684 static int noon010_detect(struct i2c_client *client, struct noon010_info *info) noon010_detect() argument
688 ret = power_enable(info); noon010_detect()
696 power_disable(info); noon010_detect()
704 struct noon010_info *info; noon010_probe() local
716 info = devm_kzalloc(&client->dev, sizeof(*info), GFP_KERNEL); noon010_probe()
717 if (!info) noon010_probe()
720 mutex_init(&info->lock); noon010_probe()
721 sd = &info->sd; noon010_probe()
728 v4l2_ctrl_handler_init(&info->hdl, 3); noon010_probe()
730 v4l2_ctrl_new_std(&info->hdl, &noon010_ctrl_ops, noon010_probe()
732 v4l2_ctrl_new_std(&info->hdl, &noon010_ctrl_ops, noon010_probe()
734 v4l2_ctrl_new_std(&info->hdl, &noon010_ctrl_ops, noon010_probe()
737 sd->ctrl_handler = &info->hdl; noon010_probe()
739 ret = info->hdl.error; noon010_probe()
743 info->i2c_reg_page = -1; noon010_probe()
744 info->gpio_nreset = -EINVAL; noon010_probe()
745 info->gpio_nstby = -EINVAL; noon010_probe()
746 info->curr_fmt = &noon010_formats[0]; noon010_probe()
747 info->curr_win = &noon010_sizes[0]; noon010_probe()
757 info->gpio_nreset = pdata->gpio_nreset; noon010_probe()
758 gpio_export(info->gpio_nreset, 0); noon010_probe()
769 info->gpio_nstby = pdata->gpio_nstby; noon010_probe()
770 gpio_export(info->gpio_nstby, 0); noon010_probe()
774 info->supply[i].supply = noon010_supply_name[i]; noon010_probe()
777 info->supply); noon010_probe()
781 info->pad.flags = MEDIA_PAD_FL_SOURCE; noon010_probe()
783 ret = media_entity_init(&sd->entity, 1, &info->pad, 0); noon010_probe()
787 ret = noon010_detect(client, info); noon010_probe()
792 v4l2_ctrl_handler_free(&info->hdl); noon010_probe()
800 struct noon010_info *info = to_noon010(sd); noon010_remove() local
803 v4l2_ctrl_handler_free(&info->hdl); noon010_remove()
/linux-4.4.14/arch/sparc/kernel/
H A Dtraps_32.c93 siginfo_t info; do_hw_interrupt() local
104 info.si_signo = SIGILL; do_hw_interrupt()
105 info.si_errno = 0; do_hw_interrupt()
106 info.si_code = ILL_ILLTRP; do_hw_interrupt()
107 info.si_addr = (void __user *)regs->pc; do_hw_interrupt()
108 info.si_trapno = type - 0x80; do_hw_interrupt()
109 force_sig_info(SIGILL, &info, current); do_hw_interrupt()
115 siginfo_t info; do_illegal_instruction() local
124 info.si_signo = SIGILL; do_illegal_instruction()
125 info.si_errno = 0; do_illegal_instruction()
126 info.si_code = ILL_ILLOPC; do_illegal_instruction()
127 info.si_addr = (void __user *)pc; do_illegal_instruction()
128 info.si_trapno = 0; do_illegal_instruction()
129 send_sig_info(SIGILL, &info, current); do_illegal_instruction()
135 siginfo_t info; do_priv_instruction() local
139 info.si_signo = SIGILL; do_priv_instruction()
140 info.si_errno = 0; do_priv_instruction()
141 info.si_code = ILL_PRVOPC; do_priv_instruction()
142 info.si_addr = (void __user *)pc; do_priv_instruction()
143 info.si_trapno = 0; do_priv_instruction()
144 send_sig_info(SIGILL, &info, current); do_priv_instruction()
152 siginfo_t info; do_memaccess_unaligned() local
165 info.si_signo = SIGBUS; do_memaccess_unaligned()
166 info.si_errno = 0; do_memaccess_unaligned()
167 info.si_code = BUS_ADRALN; do_memaccess_unaligned()
168 info.si_addr = /* FIXME: Should dig out mna address */ (void *)0; do_memaccess_unaligned()
169 info.si_trapno = 0; do_memaccess_unaligned()
170 send_sig_info(SIGBUS, &info, current); do_memaccess_unaligned()
226 siginfo_t info; local
303 info.si_signo = SIGFPE;
304 info.si_errno = 0;
305 info.si_addr = (void __user *)pc;
306 info.si_trapno = 0;
307 info.si_code = __SI_FAULT;
310 info.si_code = FPE_FLTINV;
312 info.si_code = FPE_FLTOVF;
314 info.si_code = FPE_FLTUND;
316 info.si_code = FPE_FLTDIV;
318 info.si_code = FPE_FLTRES;
320 send_sig_info(SIGFPE, &info, fpt);
332 siginfo_t info; handle_tag_overflow() local
336 info.si_signo = SIGEMT; handle_tag_overflow()
337 info.si_errno = 0; handle_tag_overflow()
338 info.si_code = EMT_TAGOVF; handle_tag_overflow()
339 info.si_addr = (void __user *)pc; handle_tag_overflow()
340 info.si_trapno = 0; handle_tag_overflow()
341 send_sig_info(SIGEMT, &info, current); handle_tag_overflow()
359 siginfo_t info; handle_reg_access() local
365 info.si_signo = SIGBUS; handle_reg_access()
366 info.si_errno = 0; handle_reg_access()
367 info.si_code = BUS_OBJERR; handle_reg_access()
368 info.si_addr = (void __user *)pc; handle_reg_access()
369 info.si_trapno = 0; handle_reg_access()
370 force_sig_info(SIGBUS, &info, current); handle_reg_access()
376 siginfo_t info; handle_cp_disabled() local
378 info.si_signo = SIGILL; handle_cp_disabled()
379 info.si_errno = 0; handle_cp_disabled()
380 info.si_code = ILL_COPROC; handle_cp_disabled()
381 info.si_addr = (void __user *)pc; handle_cp_disabled()
382 info.si_trapno = 0; handle_cp_disabled()
383 send_sig_info(SIGILL, &info, current); handle_cp_disabled()
389 siginfo_t info; handle_cp_exception() local
395 info.si_signo = SIGILL; handle_cp_exception()
396 info.si_errno = 0; handle_cp_exception()
397 info.si_code = ILL_COPROC; handle_cp_exception()
398 info.si_addr = (void __user *)pc; handle_cp_exception()
399 info.si_trapno = 0; handle_cp_exception()
400 send_sig_info(SIGILL, &info, current); handle_cp_exception()
406 siginfo_t info; handle_hw_divzero() local
408 info.si_signo = SIGFPE; handle_hw_divzero()
409 info.si_errno = 0; handle_hw_divzero()
410 info.si_code = FPE_INTDIV; handle_hw_divzero()
411 info.si_addr = (void __user *)pc; handle_hw_divzero()
412 info.si_trapno = 0; handle_hw_divzero()
413 send_sig_info(SIGFPE, &info, current); handle_hw_divzero()
/linux-4.4.14/drivers/video/console/
H A Dtileblit.c19 static void tile_bmove(struct vc_data *vc, struct fb_info *info, int sy, tile_bmove() argument
31 info->tileops->fb_tilecopy(info, &area); tile_bmove()
34 static void tile_clear(struct vc_data *vc, struct fb_info *info, int sy, tile_clear() argument
43 rect.fg = attr_fgcol_ec(fgshift, vc, info); tile_clear()
44 rect.bg = attr_bgcol_ec(bgshift, vc, info); tile_clear()
51 info->tileops->fb_tilefill(info, &rect); tile_clear()
54 static void tile_putcs(struct vc_data *vc, struct fb_info *info, tile_putcs() argument
69 blit.indices = (u32 *) fb_get_buffer_offset(info, &info->pixmap, size); tile_putcs()
73 info->tileops->fb_tileblit(info, &blit); tile_putcs()
76 static void tile_clear_margins(struct vc_data *vc, struct fb_info *info, tile_clear_margins() argument
82 static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode, tile_cursor() argument
116 info->tileops->fb_tilecursor(info, &cursor); tile_cursor()
119 static int tile_update_start(struct fb_info *info) tile_update_start() argument
121 struct fbcon_ops *ops = info->fbcon_par; tile_update_start()
124 err = fb_pan_display(info, &ops->var); tile_update_start()
125 ops->var.xoffset = info->var.xoffset; tile_update_start()
126 ops->var.yoffset = info->var.yoffset; tile_update_start()
127 ops->var.vmode = info->var.vmode; tile_update_start()
131 void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info) fbcon_set_tileops() argument
134 struct fbcon_ops *ops = info->fbcon_par; fbcon_set_tileops()
150 info->tileops->fb_settile(info, &map); fbcon_set_tileops()
H A Dfbcon.c185 static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var,
189 static void fbcon_modechanged(struct fb_info *info);
190 static void fbcon_set_all_vcs(struct fb_info *info);
196 static inline void fbcon_set_rotation(struct fb_info *info) fbcon_set_rotation() argument
198 struct fbcon_ops *ops = info->fbcon_par; fbcon_set_rotation()
200 if (!(info->flags & FBINFO_MISC_TILEBLITTING) && fbcon_set_rotation()
207 static void fbcon_rotate(struct fb_info *info, u32 rotate) fbcon_rotate() argument
209 struct fbcon_ops *ops= info->fbcon_par; fbcon_rotate()
217 if (info == fb_info) { fbcon_rotate()
225 fbcon_modechanged(info); fbcon_rotate()
229 static void fbcon_rotate_all(struct fb_info *info, u32 rotate) fbcon_rotate_all() argument
231 struct fbcon_ops *ops = info->fbcon_par; fbcon_rotate_all()
242 registered_fb[con2fb_map[i]] != info) fbcon_rotate_all()
249 fbcon_set_all_vcs(info); fbcon_rotate_all()
252 static inline void fbcon_set_rotation(struct fb_info *info) fbcon_set_rotation() argument
254 struct fbcon_ops *ops = info->fbcon_par; fbcon_set_rotation()
259 static void fbcon_rotate(struct fb_info *info, u32 rotate) fbcon_rotate() argument
264 static void fbcon_rotate_all(struct fb_info *info, u32 rotate) fbcon_rotate_all() argument
270 static int fbcon_get_rotate(struct fb_info *info) fbcon_get_rotate() argument
272 struct fbcon_ops *ops = info->fbcon_par; fbcon_get_rotate()
277 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info) fbcon_is_inactive() argument
279 struct fbcon_ops *ops = info->fbcon_par; fbcon_is_inactive()
281 return (info->state != FBINFO_STATE_RUNNING || fbcon_is_inactive()
286 static int get_color(struct vc_data *vc, struct fb_info *info, get_color() argument
289 int depth = fb_get_color_depth(&info->var, &info->fix); get_color()
305 int col = mono_col(info); get_color()
307 int fg = (info->fix.visual != FB_VISUAL_MONO01) ? col : 0; get_color()
308 int bg = (info->fix.visual != FB_VISUAL_MONO01) ? 0 : col; get_color()
367 struct fb_info *info = container_of(work, struct fb_info, queue); fb_flashcursor() local
368 struct fbcon_ops *ops = info->fbcon_par; fb_flashcursor()
385 registered_fb[con2fb_map[vc->vc_num]] != info || fb_flashcursor()
394 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), fb_flashcursor()
395 get_color(vc, info, c, 0)); fb_flashcursor()
401 struct fb_info *info = (struct fb_info *) dev_addr; cursor_timer_handler() local
402 struct fbcon_ops *ops = info->fbcon_par; cursor_timer_handler()
404 queue_work(system_power_efficient_wq, &info->queue); cursor_timer_handler()
408 static void fbcon_add_cursor_timer(struct fb_info *info) fbcon_add_cursor_timer() argument
410 struct fbcon_ops *ops = info->fbcon_par; fbcon_add_cursor_timer()
412 if ((!info->queue.func || info->queue.func == fb_flashcursor) && fbcon_add_cursor_timer()
415 if (!info->queue.func) fbcon_add_cursor_timer()
416 INIT_WORK(&info->queue, fb_flashcursor); fbcon_add_cursor_timer()
421 ops->cursor_timer.data = (unsigned long ) info; fbcon_add_cursor_timer()
427 static void fbcon_del_cursor_timer(struct fb_info *info) fbcon_del_cursor_timer() argument
429 struct fbcon_ops *ops = info->fbcon_par; fbcon_del_cursor_timer()
431 if (info->queue.func == fb_flashcursor && fbcon_del_cursor_timer()
556 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, fbcon_prepare_logo() argument
562 static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, fbcon_prepare_logo() argument
566 struct fbcon_ops *ops = info->fbcon_par; fbcon_prepare_logo()
571 if (info->flags & FBINFO_MODULE) { fbcon_prepare_logo()
580 if (fb_get_color_depth(&info->var, &info->fix) == 1) fbcon_prepare_logo()
582 logo_height = fb_prepare_logo(info, ops->rotate); fbcon_prepare_logo()
649 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) set_blitting_type() argument
651 struct fbcon_ops *ops = info->fbcon_par; set_blitting_type()
655 if ((info->flags & FBINFO_MISC_TILEBLITTING)) set_blitting_type()
656 fbcon_set_tileops(vc, info); set_blitting_type()
658 fbcon_set_rotation(info); set_blitting_type()
663 static int fbcon_invalid_charcount(struct fb_info *info, unsigned charcount) fbcon_invalid_charcount() argument
667 if (info->flags & FBINFO_MISC_TILEBLITTING && fbcon_invalid_charcount()
668 info->tileops->fb_get_tilemax(info) < charcount) fbcon_invalid_charcount()
674 static void set_blitting_type(struct vc_data *vc, struct fb_info *info) set_blitting_type() argument
676 struct fbcon_ops *ops = info->fbcon_par; set_blitting_type()
678 info->flags &= ~FBINFO_MISC_TILEBLITTING; set_blitting_type()
680 fbcon_set_rotation(info); set_blitting_type()
684 static int fbcon_invalid_charcount(struct fb_info *info, unsigned charcount) fbcon_invalid_charcount() argument
692 static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, con2fb_acquire_newinfo() argument
698 if (!try_module_get(info->fbops->owner)) con2fb_acquire_newinfo()
701 if (!err && info->fbops->fb_open && con2fb_acquire_newinfo()
702 info->fbops->fb_open(info, 0)) con2fb_acquire_newinfo()
713 info->fbcon_par = ops; con2fb_acquire_newinfo()
716 set_blitting_type(vc, info); con2fb_acquire_newinfo()
721 module_put(info->fbops->owner); con2fb_acquire_newinfo()
773 static void con2fb_init_display(struct vc_data *vc, struct fb_info *info, con2fb_init_display() argument
776 struct fbcon_ops *ops = info->fbcon_par; con2fb_init_display()
781 if (info->fbops->fb_set_par && !(ops->flags & FBCON_FLAGS_INIT)) { con2fb_init_display()
782 ret = info->fbops->fb_set_par(info); con2fb_init_display()
792 fbcon_set_disp(info, &info->var, unit); con2fb_init_display()
822 struct fb_info *info = registered_fb[newidx]; set_con2fb_map() local
829 if (!info) set_con2fb_map()
844 err = con2fb_acquire_newinfo(vc, info, unit, oldidx); set_con2fb_map()
852 err = con2fb_release_oldinfo(vc, oldinfo, info, unit, oldidx, set_con2fb_map()
860 fbcon_add_cursor_timer(info); set_con2fb_map()
862 con2fb_init_display(vc, info, unit, show_logo); set_con2fb_map()
877 struct fb_info *info) var_to_display()
892 disp->mode = fb_match_mode(var, &info->modelist); var_to_display()
925 struct fb_info *info = NULL; fbcon_startup() local
939 info = registered_fb[info_idx]; fbcon_startup()
940 if (!info) fbcon_startup()
943 owner = info->fbops->owner; fbcon_startup()
946 if (info->fbops->fb_open && info->fbops->fb_open(info, 0)) { fbcon_startup()
961 info->fbcon_par = ops; fbcon_startup()
963 set_blitting_type(vc, info); fbcon_startup()
965 if (info->fix.type != FB_TYPE_TEXT) { fbcon_startup()
993 font = get_default_font(info->var.xres, fbcon_startup()
994 info->var.yres, fbcon_startup()
995 info->pixmap.blit_x, fbcon_startup()
996 info->pixmap.blit_y); fbcon_startup()
1005 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); fbcon_startup()
1006 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); fbcon_startup()
1011 DPRINTK("mode: %s\n", info->fix.id); fbcon_startup()
1012 DPRINTK("visual: %d\n", info->fix.visual); fbcon_startup()
1013 DPRINTK("res: %dx%d-%d\n", info->var.xres, fbcon_startup()
1014 info->var.yres, fbcon_startup()
1015 info->var.bits_per_pixel); fbcon_startup()
1017 fbcon_add_cursor_timer(info); fbcon_startup()
1024 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_init() local
1032 if (info_idx == -1 || info == NULL) fbcon_init()
1035 cap = info->flags; fbcon_init()
1038 (info->fix.type == FB_TYPE_TEXT)) fbcon_init()
1041 if (var_to_display(p, &info->var, info)) fbcon_init()
1044 if (!info->fbcon_par) fbcon_init()
1045 con2fb_acquire_newinfo(vc, info, vc->vc_num, -1); fbcon_init()
1066 font = get_default_font(info->var.xres, fbcon_init()
1067 info->var.yres, fbcon_init()
1068 info->pixmap.blit_x, fbcon_init()
1069 info->pixmap.blit_y); fbcon_init()
1081 vc->vc_panic_force_write = !!(info->flags & FBINFO_CAN_FORCE_OUTPUT); fbcon_init()
1082 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); fbcon_init()
1097 ops = info->fbcon_par; fbcon_init()
1100 set_blitting_type(vc, info); fbcon_init()
1104 new_cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); fbcon_init()
1105 new_rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); fbcon_init()
1117 if (info->fbops->fb_set_par && fbcon_init()
1119 ret = info->fbops->fb_set_par(info); fbcon_init()
1150 fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows); fbcon_init()
1155 if (ops->rotate_font && ops->rotate_font(info, vc)) { fbcon_init()
1157 set_blitting_type(vc, info); fbcon_init()
1174 struct fb_info *info; fbcon_deinit() local
1184 info = registered_fb[idx]; fbcon_deinit()
1186 if (!info) fbcon_deinit()
1189 if (info->flags & FBINFO_MISC_FIRMWARE) fbcon_deinit()
1191 ops = info->fbcon_par; fbcon_deinit()
1197 fbcon_del_cursor_timer(info); fbcon_deinit()
1240 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_clear() local
1241 struct fbcon_ops *ops = info->fbcon_par; fbcon_clear()
1246 if (fbcon_is_inactive(vc, info)) fbcon_clear()
1268 ops->clear(vc, info, real_y(p, sy), sx, b, width); fbcon_clear()
1269 ops->clear(vc, info, real_y(p, sy + b), sx, height - b, fbcon_clear()
1272 ops->clear(vc, info, real_y(p, sy), sx, height, width); fbcon_clear()
1278 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_putcs() local
1280 struct fbcon_ops *ops = info->fbcon_par; fbcon_putcs()
1282 if (!fbcon_is_inactive(vc, info)) fbcon_putcs()
1283 ops->putcs(vc, info, s, count, real_y(p, ypos), xpos, fbcon_putcs()
1284 get_color(vc, info, scr_readw(s), 1), fbcon_putcs()
1285 get_color(vc, info, scr_readw(s), 0)); fbcon_putcs()
1298 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_clear_margins() local
1299 struct fbcon_ops *ops = info->fbcon_par; fbcon_clear_margins()
1301 if (!fbcon_is_inactive(vc, info)) fbcon_clear_margins()
1302 ops->clear_margins(vc, info, bottom_only); fbcon_clear_margins()
1307 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_cursor() local
1308 struct fbcon_ops *ops = info->fbcon_par; fbcon_cursor()
1314 if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) fbcon_cursor()
1318 fbcon_del_cursor_timer(info); fbcon_cursor()
1320 fbcon_add_cursor_timer(info); fbcon_cursor()
1332 ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1), fbcon_cursor()
1333 get_color(vc, info, c, 0)); fbcon_cursor()
1340 static void fbcon_set_disp(struct fb_info *info, struct fb_var_screeninfo *var, fbcon_set_disp() argument
1346 struct fbcon_ops *ops = info->fbcon_par; fbcon_set_disp()
1351 if (var_to_display(p, var, info)) fbcon_set_disp()
1375 info->var.activate = var->activate; fbcon_set_disp()
1376 var->yoffset = info->var.yoffset; fbcon_set_disp()
1377 var->xoffset = info->var.xoffset; fbcon_set_disp()
1378 fb_set_var(info, var); fbcon_set_disp()
1379 ops->var = info->var; fbcon_set_disp()
1380 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); fbcon_set_disp()
1395 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); fbcon_set_disp()
1396 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); fbcon_set_disp()
1410 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; ywrap_up() local
1411 struct fbcon_ops *ops = info->fbcon_par; ywrap_up()
1420 ops->update_start(info); ywrap_up()
1429 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; ywrap_down() local
1430 struct fbcon_ops *ops = info->fbcon_par; ywrap_down()
1439 ops->update_start(info); ywrap_down()
1448 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; ypan_up() local
1450 struct fbcon_ops *ops = info->fbcon_par; ypan_up()
1454 ops->bmove(vc, info, p->vrows - vc->vc_rows, ypan_up()
1462 ops->update_start(info); ypan_up()
1472 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; ypan_up_redraw() local
1473 struct fbcon_ops *ops = info->fbcon_par; ypan_up_redraw()
1486 ops->update_start(info); ypan_up_redraw()
1496 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; ypan_down() local
1498 struct fbcon_ops *ops = info->fbcon_par; ypan_down()
1502 ops->bmove(vc, info, 0, 0, p->vrows - vc->vc_rows, ypan_down()
1510 ops->update_start(info); ypan_down()
1520 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; ypan_down_redraw() local
1521 struct fbcon_ops *ops = info->fbcon_par; ypan_down_redraw()
1534 ops->update_start(info); ypan_down_redraw()
1669 static void fbcon_redraw_blit(struct vc_data *vc, struct fb_info *info, fbcon_redraw_blit() argument
1676 struct fbcon_ops *ops = info->fbcon_par; fbcon_redraw_blit()
1689 ops->bmove(vc, info, line + ycount, x, fbcon_redraw_blit()
1705 ops->bmove(vc, info, line + ycount, x, line, x, 1, fbcon_redraw_blit()
1802 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_scroll() local
1804 int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK; fbcon_scroll()
1806 if (fbcon_is_inactive(vc, info)) fbcon_scroll()
1827 fbcon_redraw_blit(vc, info, p, t, b - t - count, fbcon_scroll()
1848 } else if (info->flags & FBINFO_READS_FAST) fbcon_scroll()
1889 } else if (info->flags & FBINFO_READS_FAST) fbcon_scroll()
1918 fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, fbcon_scroll()
1939 } else if (info->flags & FBINFO_READS_FAST) fbcon_scroll()
1961 } else if (info->flags & FBINFO_READS_FAST) fbcon_scroll()
2006 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_bmove() local
2009 if (fbcon_is_inactive(vc, info)) fbcon_bmove()
2029 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_bmove_rec() local
2030 struct fbcon_ops *ops = info->fbcon_par; fbcon_bmove_rec()
2064 ops->bmove(vc, info, real_y(p, sy), sx, real_y(p, dy), dx, fbcon_bmove_rec()
2069 struct fb_info *info, updatescrollmode()
2072 struct fbcon_ops *ops = info->fbcon_par; updatescrollmode()
2074 int cap = info->flags; updatescrollmode()
2076 int ypan = FBCON_SWAP(ops->rotate, info->fix.ypanstep, updatescrollmode()
2077 info->fix.xpanstep); updatescrollmode()
2078 int ywrap = FBCON_SWAP(ops->rotate, info->fix.ywrapstep, t); updatescrollmode()
2079 int yres = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); updatescrollmode()
2080 int vyres = FBCON_SWAP(ops->rotate, info->var.yres_virtual, updatescrollmode()
2081 info->var.xres_virtual); updatescrollmode()
2118 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_resize() local
2119 struct fbcon_ops *ops = info->fbcon_par; fbcon_resize()
2121 struct fb_var_screeninfo var = info->var; fbcon_resize()
2132 x_diff = info->var.xres - var.xres; fbcon_resize()
2133 y_diff = info->var.yres - var.yres; fbcon_resize()
2139 mode = fb_find_best_mode(&var, &info->modelist); fbcon_resize()
2152 fb_set_var(info, &var); fbcon_resize()
2154 var_to_display(p, &info->var, info); fbcon_resize()
2155 ops->var = info->var; fbcon_resize()
2157 updatescrollmode(p, info, vc); fbcon_resize()
2163 struct fb_info *info, *old_info = NULL; fbcon_switch() local
2169 info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_switch()
2170 ops = info->fbcon_par; fbcon_switch()
2194 * update all info->currcon. Perhaps, we can place this fbcon_switch()
2198 * info->currcon = vc->vc_num; fbcon_switch()
2215 info->var.activate = var.activate; fbcon_switch()
2216 var.vmode |= info->var.vmode & ~FB_VMODE_MASK; fbcon_switch()
2217 fb_set_var(info, &var); fbcon_switch()
2218 ops->var = info->var; fbcon_switch()
2220 if (old_info != NULL && (old_info != info || fbcon_switch()
2221 info->flags & FBINFO_MISC_ALWAYS_SETPAR)) { fbcon_switch()
2222 if (info->fbops->fb_set_par) { fbcon_switch()
2223 ret = info->fbops->fb_set_par(info); fbcon_switch()
2231 if (old_info != info) fbcon_switch()
2235 if (fbcon_is_inactive(vc, info) || fbcon_switch()
2237 fbcon_del_cursor_timer(info); fbcon_switch()
2239 fbcon_add_cursor_timer(info); fbcon_switch()
2241 set_blitting_type(vc, info); fbcon_switch()
2244 if (ops->rotate_font && ops->rotate_font(info, vc)) { fbcon_switch()
2246 set_blitting_type(vc, info); fbcon_switch()
2249 vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); fbcon_switch()
2258 updatescrollmode(p, info, vc); fbcon_switch()
2278 if (!fbcon_is_inactive(vc, info)) { fbcon_switch()
2280 ops->update_start(info); fbcon_switch()
2290 fb_show_logo(info, ops->rotate); fbcon_switch()
2300 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info, fbcon_generic_blank() argument
2317 if (!lock_fb_info(info)) fbcon_generic_blank()
2319 event.info = info; fbcon_generic_blank()
2322 unlock_fb_info(info); fbcon_generic_blank()
2327 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_blank() local
2328 struct fbcon_ops *ops = info->fbcon_par; fbcon_blank()
2331 struct fb_var_screeninfo var = info->var; fbcon_blank()
2337 fb_set_var(info, &var); fbcon_blank()
2339 ops->var = info->var; fbcon_blank()
2343 if (!fbcon_is_inactive(vc, info)) { fbcon_blank()
2349 if (!(info->flags & FBINFO_MISC_USEREVENT)) fbcon_blank()
2350 if (fb_blank(info, blank)) fbcon_blank()
2351 fbcon_generic_blank(vc, info, blank); fbcon_blank()
2358 if (mode_switch || fbcon_is_inactive(vc, info) || fbcon_blank()
2360 fbcon_del_cursor_timer(info); fbcon_blank()
2362 fbcon_add_cursor_timer(info); fbcon_blank()
2369 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_debug_enter() local
2370 struct fbcon_ops *ops = info->fbcon_par; fbcon_debug_enter()
2374 if (info->fbops->fb_debug_enter) fbcon_debug_enter()
2375 info->fbops->fb_debug_enter(info); fbcon_debug_enter()
2382 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_debug_leave() local
2383 struct fbcon_ops *ops = info->fbcon_par; fbcon_debug_leave()
2386 if (info->fbops->fb_debug_leave) fbcon_debug_leave()
2387 info->fbops->fb_debug_leave(info); fbcon_debug_leave()
2445 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_do_set_font() local
2446 struct fbcon_ops *ops = info->fbcon_par; fbcon_do_set_font()
2528 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); fbcon_do_set_font()
2529 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); fbcon_do_set_font()
2570 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_set_font() local
2585 if (!(info->pixmap.blit_x & (1 << (font->width - 1))) || fbcon_set_font()
2586 !(info->pixmap.blit_y & (1 << (font->height - 1)))) fbcon_set_font()
2590 if (fbcon_invalid_charcount(info, charcount)) fbcon_set_font()
2633 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_set_def_font() local
2637 f = get_default_font(info->var.xres, info->var.yres, fbcon_set_def_font()
2638 info->pixmap.blit_x, info->pixmap.blit_y); fbcon_set_def_font()
2657 struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; fbcon_set_palette() local
2661 if (fbcon_is_inactive(vc, info)) fbcon_set_palette()
2667 depth = fb_get_color_depth(&info->var, &info->fix); fbcon_set_palette()
2687 return fb_set_cmap(&palette_cmap, info); fbcon_set_palette()
2770 struct fb_info *info = registered_fb[con2fb_map[fg_console]]; fbcon_scrolldelta() local
2771 struct fbcon_ops *ops = info->fbcon_par; fbcon_scrolldelta()
2827 if (fbcon_is_inactive(vc, info)) fbcon_scrolldelta()
2836 info->var.vmode |= FB_VMODE_YWRAP; fbcon_scrolldelta()
2841 info->var.vmode &= ~FB_VMODE_YWRAP; fbcon_scrolldelta()
2851 ops->update_start(info); fbcon_scrolldelta()
2865 static void fbcon_suspended(struct fb_info *info) fbcon_suspended() argument
2868 struct fbcon_ops *ops = info->fbcon_par; fbcon_suspended()
2878 static void fbcon_resumed(struct fb_info *info) fbcon_resumed() argument
2881 struct fbcon_ops *ops = info->fbcon_par; fbcon_resumed()
2890 static void fbcon_modechanged(struct fb_info *info) fbcon_modechanged() argument
2892 struct fbcon_ops *ops = info->fbcon_par; fbcon_modechanged()
2901 registered_fb[con2fb_map[ops->currcon]] != info) fbcon_modechanged()
2905 set_blitting_type(vc, info); fbcon_modechanged()
2908 var_to_display(p, &info->var, info); fbcon_modechanged()
2909 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); fbcon_modechanged()
2910 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); fbcon_modechanged()
2914 updatescrollmode(p, info, vc); fbcon_modechanged()
2918 if (!fbcon_is_inactive(vc, info)) { fbcon_modechanged()
2920 ops->update_start(info); fbcon_modechanged()
2930 static void fbcon_set_all_vcs(struct fb_info *info) fbcon_set_all_vcs() argument
2932 struct fbcon_ops *ops = info->fbcon_par; fbcon_set_all_vcs()
2943 registered_fb[con2fb_map[i]] != info) fbcon_set_all_vcs()
2952 set_blitting_type(vc, info); fbcon_set_all_vcs()
2953 var_to_display(p, &info->var, info); fbcon_set_all_vcs()
2954 cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); fbcon_set_all_vcs()
2955 rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); fbcon_set_all_vcs()
2962 fbcon_modechanged(info); fbcon_set_all_vcs()
2965 static int fbcon_mode_deleted(struct fb_info *info, fbcon_mode_deleted() argument
2978 if (fb_info != info) fbcon_mode_deleted()
3033 struct fb_info *info = registered_fb[idx]; fbcon_fb_unbind() local
3046 info, NULL, i, fbcon_fb_unbind()
3062 static int fbcon_fb_unregistered(struct fb_info *info) fbcon_fb_unregistered() argument
3066 idx = info->node; fbcon_fb_unregistered()
3115 static void fbcon_select_primary(struct fb_info *info) fbcon_select_primary() argument
3118 fb_is_primary_device(info)) { fbcon_select_primary()
3122 info->fix.id, info->node); fbcon_select_primary()
3123 primary_device = info->node; fbcon_select_primary()
3130 "fb%i, to tty %i-%i\n", info->node, fbcon_select_primary()
3138 static inline void fbcon_select_primary(struct fb_info *info) fbcon_select_primary() argument
3145 static int fbcon_fb_registered(struct fb_info *info) fbcon_fb_registered() argument
3149 idx = info->node; fbcon_fb_registered()
3150 fbcon_select_primary(info); fbcon_fb_registered()
3172 static void fbcon_fb_blanked(struct fb_info *info, int blank) fbcon_fb_blanked() argument
3174 struct fbcon_ops *ops = info->fbcon_par; fbcon_fb_blanked()
3182 registered_fb[con2fb_map[ops->currcon]] != info) fbcon_fb_blanked()
3194 static void fbcon_new_modelist(struct fb_info *info) fbcon_new_modelist() argument
3202 if (registered_fb[con2fb_map[i]] != info) fbcon_new_modelist()
3209 &info->modelist); fbcon_new_modelist()
3211 fbcon_set_disp(info, &var, vc->vc_num); fbcon_new_modelist()
3215 static void fbcon_get_requirement(struct fb_info *info, fbcon_get_requirement() argument
3227 info->node == con2fb_map[i]) { fbcon_get_requirement()
3241 info->node == con2fb_map[fg_console]) { fbcon_get_requirement()
3255 struct fb_info *info = event->info; fbcon_event_notify() local
3271 fbcon_suspended(info); fbcon_event_notify()
3274 fbcon_resumed(info); fbcon_event_notify()
3277 fbcon_modechanged(info); fbcon_event_notify()
3280 fbcon_set_all_vcs(info); fbcon_event_notify()
3284 ret = fbcon_mode_deleted(info, mode); fbcon_event_notify()
3287 idx = info->node; fbcon_event_notify()
3291 ret = fbcon_fb_registered(info); fbcon_event_notify()
3294 ret = fbcon_fb_unregistered(info); fbcon_event_notify()
3307 fbcon_fb_blanked(info, *(int *)event->data); fbcon_event_notify()
3310 fbcon_new_modelist(info); fbcon_event_notify()
3314 fbcon_get_requirement(info, caps); fbcon_event_notify()
3317 idx = info->node; fbcon_event_notify()
3365 struct fb_info *info; store_rotate() local
3378 info = registered_fb[idx]; store_rotate()
3380 fbcon_rotate(info, rotate); store_rotate()
3390 struct fb_info *info; store_rotate_all() local
3403 info = registered_fb[idx]; store_rotate_all()
3405 fbcon_rotate_all(info, rotate); store_rotate_all()
3414 struct fb_info *info; show_rotate() local
3426 info = registered_fb[idx]; show_rotate()
3427 rotate = fbcon_get_rotate(info); show_rotate()
3436 struct fb_info *info; show_cursor_blink() local
3449 info = registered_fb[idx]; show_cursor_blink()
3450 ops = info->fbcon_par; show_cursor_blink()
3465 struct fb_info *info; store_cursor_blink() local
3478 info = registered_fb[idx]; store_cursor_blink()
3480 if (!info->fbcon_par) store_cursor_blink()
3487 fbcon_add_cursor_timer(info); store_cursor_blink()
3490 fbcon_del_cursor_timer(info); store_cursor_blink()
3550 struct fb_info *info; fbcon_exit() local
3563 info = registered_fb[i]; fbcon_exit()
3565 if (info == NULL) fbcon_exit()
3568 if (info->queue.func) fbcon_exit()
3569 pending = cancel_work_sync(&info->queue); fbcon_exit()
3581 if (info->fbops->fb_release) fbcon_exit()
3582 info->fbops->fb_release(info, 0); fbcon_exit()
3583 module_put(info->fbops->owner); fbcon_exit()
3585 if (info->fbcon_par) { fbcon_exit()
3586 struct fbcon_ops *ops = info->fbcon_par; fbcon_exit()
3588 fbcon_del_cursor_timer(info); fbcon_exit()
3591 kfree(info->fbcon_par); fbcon_exit()
3592 info->fbcon_par = NULL; fbcon_exit()
3595 if (info->queue.func == fb_flashcursor) fbcon_exit()
3596 info->queue.func = NULL; fbcon_exit()
875 var_to_display(struct display *disp, struct fb_var_screeninfo *var, struct fb_info *info) var_to_display() argument
2068 updatescrollmode(struct display *p, struct fb_info *info, struct vc_data *vc) updatescrollmode() argument
H A Dfbcon_cw.c48 static void cw_bmove(struct vc_data *vc, struct fb_info *info, int sy, cw_bmove() argument
51 struct fbcon_ops *ops = info->fbcon_par; cw_bmove()
53 u32 vxres = GETVXRES(ops->p->scrollmode, info); cw_bmove()
62 info->fbops->fb_copyarea(info, &area); cw_bmove()
65 static void cw_clear(struct vc_data *vc, struct fb_info *info, int sy, cw_clear() argument
68 struct fbcon_ops *ops = info->fbcon_par; cw_clear()
71 u32 vxres = GETVXRES(ops->p->scrollmode, info); cw_clear()
73 region.color = attr_bgcol_ec(bgshift,vc,info); cw_clear()
80 info->fbops->fb_fillrect(info, &region); cw_clear()
83 static inline void cw_putcs_aligned(struct vc_data *vc, struct fb_info *info, cw_putcs_aligned() argument
88 struct fbcon_ops *ops = info->fbcon_par; cw_putcs_aligned()
111 info->fbops->fb_imageblit(info, image); cw_putcs_aligned()
114 static void cw_putcs(struct vc_data *vc, struct fb_info *info, cw_putcs() argument
119 struct fbcon_ops *ops = info->fbcon_par; cw_putcs()
122 u32 maxcnt = info->pixmap.size/cellsize; cw_putcs()
123 u32 scan_align = info->pixmap.scan_align - 1; cw_putcs()
124 u32 buf_align = info->pixmap.buf_align - 1; cw_putcs()
126 u32 attribute = get_attribute(info, scr_readw(s)); cw_putcs()
128 u32 vxres = GETVXRES(ops->p->scrollmode, info); cw_putcs()
157 dst = fb_get_buffer_offset(info, &info->pixmap, size); cw_putcs()
159 cw_putcs_aligned(vc, info, s, attribute, cnt, pitch, cw_putcs()
174 static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, cw_clear_margins() argument
179 unsigned int rw = info->var.yres - (vc->vc_cols*cw); cw_clear_margins()
180 unsigned int bh = info->var.xres - (vc->vc_rows*ch); cw_clear_margins()
181 unsigned int rs = info->var.yres - rw; cw_clear_margins()
189 region.dy = info->var.yoffset + rs; cw_clear_margins()
191 region.width = info->var.xres_virtual; cw_clear_margins()
192 info->fbops->fb_fillrect(info, &region); cw_clear_margins()
196 region.dx = info->var.xoffset; cw_clear_margins()
197 region.dy = info->var.yoffset; cw_clear_margins()
198 region.height = info->var.yres; cw_clear_margins()
200 info->fbops->fb_fillrect(info, &region); cw_clear_margins()
204 static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, cw_cursor() argument
208 struct fbcon_ops *ops = info->fbcon_par; cw_cursor()
215 u32 vxres = GETVXRES(ops->p->scrollmode, info); cw_cursor()
232 attribute = get_attribute(info, c); cw_cursor()
368 if (info->fbops->fb_cursor) cw_cursor()
369 err = info->fbops->fb_cursor(info, &cursor); cw_cursor()
372 soft_cursor(info, &cursor); cw_cursor()
377 static int cw_update_start(struct fb_info *info) cw_update_start() argument
379 struct fbcon_ops *ops = info->fbcon_par; cw_update_start()
380 u32 vxres = GETVXRES(ops->p->scrollmode, info); cw_update_start()
384 xoffset = vxres - (info->var.xres + ops->var.yoffset); cw_update_start()
387 err = fb_pan_display(info, &ops->var); cw_update_start()
388 ops->var.xoffset = info->var.xoffset; cw_update_start()
389 ops->var.yoffset = info->var.yoffset; cw_update_start()
390 ops->var.vmode = info->var.vmode; cw_update_start()
/linux-4.4.14/arch/ia64/hp/sim/
H A Dsimserial.c95 struct serial_state *info = dev_id; rs_interrupt_single() local
97 receive_chars(&info->port); rs_interrupt_single()
110 struct serial_state *info = tty->driver_data; rs_put_char() local
113 if (!info->xmit.buf) rs_put_char()
117 if (CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) == 0) { rs_put_char()
121 info->xmit.buf[info->xmit.head] = ch; rs_put_char()
122 info->xmit.head = (info->xmit.head + 1) & (SERIAL_XMIT_SIZE-1); rs_put_char()
127 static void transmit_chars(struct tty_struct *tty, struct serial_state *info, transmit_chars() argument
135 if (info->x_char) { transmit_chars()
136 char c = info->x_char; transmit_chars()
140 info->x_char = 0; transmit_chars()
145 if (info->xmit.head == info->xmit.tail || tty->stopped) { transmit_chars()
148 info->xmit.head, info->xmit.tail, tty->stopped); transmit_chars()
160 count = min(CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE), transmit_chars()
161 SERIAL_XMIT_SIZE - info->xmit.tail); transmit_chars()
162 console->write(console, info->xmit.buf+info->xmit.tail, count); transmit_chars()
164 info->xmit.tail = (info->xmit.tail+count) & (SERIAL_XMIT_SIZE-1); transmit_chars()
169 count = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); transmit_chars()
171 console->write(console, info->xmit.buf, count); transmit_chars()
172 info->xmit.tail += count; transmit_chars()
180 struct serial_state *info = tty->driver_data; rs_flush_chars() local
182 if (info->xmit.head == info->xmit.tail || tty->stopped || rs_flush_chars()
183 !info->xmit.buf) rs_flush_chars()
186 transmit_chars(tty, info, NULL); rs_flush_chars()
192 struct serial_state *info = tty->driver_data; rs_write() local
196 if (!info->xmit.buf) rs_write()
201 c = CIRC_SPACE_TO_END(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); rs_write()
207 memcpy(info->xmit.buf + info->xmit.head, buf, c); rs_write()
208 info->xmit.head = ((info->xmit.head + c) & rs_write()
218 if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) && rs_write()
220 transmit_chars(tty, info, NULL); rs_write()
227 struct serial_state *info = tty->driver_data; rs_write_room() local
229 return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); rs_write_room()
234 struct serial_state *info = tty->driver_data; rs_chars_in_buffer() local
236 return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); rs_chars_in_buffer()
241 struct serial_state *info = tty->driver_data; rs_flush_buffer() local
245 info->xmit.head = info->xmit.tail = 0; rs_flush_buffer()
257 struct serial_state *info = tty->driver_data; rs_send_xchar() local
259 info->x_char = ch; rs_send_xchar()
265 transmit_chars(tty, info, NULL); rs_send_xchar()
287 struct serial_state *info = tty->driver_data; rs_unthrottle() local
290 if (info->x_char) rs_unthrottle()
291 info->x_char = 0; rs_unthrottle()
333 struct serial_state *info = container_of(port, struct serial_state, shutdown() local
338 if (info->irq) shutdown()
339 free_irq(info->irq, info); shutdown()
341 if (info->xmit.buf) { shutdown()
342 free_page((unsigned long) info->xmit.buf); shutdown()
343 info->xmit.buf = NULL; shutdown()
350 struct serial_state *info = tty->driver_data; rs_close() local
352 tty_port_close(&info->port, tty, filp); rs_close()
357 struct serial_state *info = tty->driver_data; rs_hangup() local
360 tty_port_hangup(&info->port); rs_hangup()
416 struct serial_state *info = rs_table + tty->index; rs_open() local
417 struct tty_port *port = &info->port; rs_open()
419 tty->driver_data = info; rs_open()
/linux-4.4.14/drivers/hid/
H A Dhid-picolcd_fb.c235 static void picolcd_fb_update(struct fb_info *info) picolcd_fb_update() argument
239 struct picolcd_fb_data *fbdata = info->par; picolcd_fb_update()
242 mutex_lock(&info->lock); picolcd_fb_update()
268 mutex_unlock(&info->lock); picolcd_fb_update()
272 mutex_lock(&info->lock); picolcd_fb_update()
287 mutex_unlock(&info->lock); picolcd_fb_update()
293 mutex_unlock(&info->lock); picolcd_fb_update()
297 static void picolcd_fb_fillrect(struct fb_info *info, picolcd_fb_fillrect() argument
300 if (!info->par) picolcd_fb_fillrect()
302 sys_fillrect(info, rect); picolcd_fb_fillrect()
304 schedule_delayed_work(&info->deferred_work, 0); picolcd_fb_fillrect()
308 static void picolcd_fb_copyarea(struct fb_info *info, picolcd_fb_copyarea() argument
311 if (!info->par) picolcd_fb_copyarea()
313 sys_copyarea(info, area); picolcd_fb_copyarea()
315 schedule_delayed_work(&info->deferred_work, 0); picolcd_fb_copyarea()
319 static void picolcd_fb_imageblit(struct fb_info *info, const struct fb_image *image) picolcd_fb_imageblit() argument
321 if (!info->par) picolcd_fb_imageblit()
323 sys_imageblit(info, image); picolcd_fb_imageblit()
325 schedule_delayed_work(&info->deferred_work, 0); picolcd_fb_imageblit()
332 static ssize_t picolcd_fb_write(struct fb_info *info, const char __user *buf, picolcd_fb_write() argument
336 if (!info->par) picolcd_fb_write()
338 ret = fb_sys_write(info, buf, count, ppos); picolcd_fb_write()
340 schedule_delayed_work(&info->deferred_work, 0); picolcd_fb_write()
344 static int picolcd_fb_blank(int blank, struct fb_info *info) picolcd_fb_blank() argument
350 static void picolcd_fb_destroy(struct fb_info *info) picolcd_fb_destroy() argument
352 struct picolcd_fb_data *fbdata = info->par; picolcd_fb_destroy()
355 fb_deferred_io_cleanup(info); picolcd_fb_destroy()
360 vfree((u8 *)info->fix.smem_start); picolcd_fb_destroy()
361 framebuffer_release(info); picolcd_fb_destroy()
364 static int picolcd_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) picolcd_fb_check_var() argument
386 static int picolcd_set_par(struct fb_info *info) picolcd_set_par() argument
388 struct picolcd_fb_data *fbdata = info->par; picolcd_set_par()
390 if (info->var.bits_per_pixel == fbdata->bpp) picolcd_set_par()
393 if (info->var.bits_per_pixel != 1 && info->var.bits_per_pixel != 8) picolcd_set_par()
397 tmp_fb = kmalloc(PICOLCDFB_SIZE*info->var.bits_per_pixel, GFP_KERNEL); picolcd_set_par()
402 if (info->var.bits_per_pixel == 1) { picolcd_set_par()
413 info->fix.visual = FB_VISUAL_MONO01; picolcd_set_par()
414 info->fix.line_length = PICOLCDFB_WIDTH / 8; picolcd_set_par()
420 info->fix.visual = FB_VISUAL_DIRECTCOLOR; picolcd_set_par()
421 info->fix.line_length = PICOLCDFB_WIDTH; picolcd_set_par()
425 fbdata->bpp = info->var.bits_per_pixel; picolcd_set_par()
445 static void picolcd_fb_deferred_io(struct fb_info *info, struct list_head *pagelist) picolcd_fb_deferred_io() argument
447 picolcd_fb_update(info); picolcd_fb_deferred_io()
511 struct fb_info *info = NULL; picolcd_init_framebuffer() local
520 info = framebuffer_alloc(256 * sizeof(u32) + picolcd_init_framebuffer()
524 if (info == NULL) { picolcd_init_framebuffer()
529 info->fbdefio = info->par; picolcd_init_framebuffer()
530 *info->fbdefio = picolcd_fb_defio; picolcd_init_framebuffer()
531 info->par += sizeof(struct fb_deferred_io); picolcd_init_framebuffer()
532 palette = info->par; picolcd_init_framebuffer()
533 info->par += 256 * sizeof(u32); picolcd_init_framebuffer()
536 info->pseudo_palette = palette; picolcd_init_framebuffer()
537 info->fbops = &picolcdfb_ops; picolcd_init_framebuffer()
538 info->var = picolcdfb_var; picolcd_init_framebuffer()
539 info->fix = picolcdfb_fix; picolcd_init_framebuffer()
540 info->fix.smem_len = PICOLCDFB_SIZE*8; picolcd_init_framebuffer()
541 info->flags = FBINFO_FLAG_DEFAULT; picolcd_init_framebuffer()
543 fbdata = info->par; picolcd_init_framebuffer()
549 fbdata->vbitmap = info->par + sizeof(struct picolcd_fb_data); picolcd_init_framebuffer()
555 info->screen_base = (char __force __iomem *)fbdata->bitmap; picolcd_init_framebuffer()
556 info->fix.smem_start = (unsigned long)fbdata->bitmap; picolcd_init_framebuffer()
558 data->fb_info = info; picolcd_init_framebuffer()
572 fb_deferred_io_init(info); picolcd_init_framebuffer()
573 error = register_framebuffer(info); picolcd_init_framebuffer()
582 fb_deferred_io_cleanup(info); picolcd_init_framebuffer()
589 framebuffer_release(info); picolcd_init_framebuffer()
595 struct fb_info *info = data->fb_info; picolcd_exit_framebuffer() local
599 if (!info) picolcd_exit_framebuffer()
603 fbdata = info->par; picolcd_exit_framebuffer()
613 flush_delayed_work(&info->deferred_work); picolcd_exit_framebuffer()
616 unregister_framebuffer(info); picolcd_exit_framebuffer()

Completed in 7669 milliseconds

1234567891011>>