gth.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. /*
  2. * Intel(R) Trace Hub Global Trace Hub
  3. *
  4. * Copyright (C) 2014-2015 Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. */
  15. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  16. #include <linux/types.h>
  17. #include <linux/module.h>
  18. #include <linux/device.h>
  19. #include <linux/io.h>
  20. #include <linux/mm.h>
  21. #include <linux/slab.h>
  22. #include <linux/bitmap.h>
  23. #include <linux/pm_runtime.h>
  24. #include "intel_th.h"
  25. #include "gth.h"
  26. struct gth_device;
  27. /**
  28. * struct gth_output - GTH view on an output port
  29. * @gth: backlink to the GTH device
  30. * @output: link to output device's output descriptor
  31. * @index: output port number
  32. * @port_type: one of GTH_* port type values
  33. * @master: bitmap of masters configured for this output
  34. */
  35. struct gth_output {
  36. struct gth_device *gth;
  37. struct intel_th_output *output;
  38. unsigned int index;
  39. unsigned int port_type;
  40. DECLARE_BITMAP(master, TH_CONFIGURABLE_MASTERS + 1);
  41. };
  42. /**
  43. * struct gth_device - GTH device
  44. * @dev: driver core's device
  45. * @base: register window base address
  46. * @output_group: attributes describing output ports
  47. * @master_group: attributes describing master assignments
  48. * @output: output ports
  49. * @master: master/output port assignments
  50. * @gth_lock: serializes accesses to GTH bits
  51. */
  52. struct gth_device {
  53. struct device *dev;
  54. void __iomem *base;
  55. struct attribute_group output_group;
  56. struct attribute_group master_group;
  57. struct gth_output output[TH_POSSIBLE_OUTPUTS];
  58. signed char master[TH_CONFIGURABLE_MASTERS + 1];
  59. spinlock_t gth_lock;
  60. };
  61. static void gth_output_set(struct gth_device *gth, int port,
  62. unsigned int config)
  63. {
  64. unsigned long reg = port & 4 ? REG_GTH_GTHOPT1 : REG_GTH_GTHOPT0;
  65. u32 val;
  66. int shift = (port & 3) * 8;
  67. val = ioread32(gth->base + reg);
  68. val &= ~(0xff << shift);
  69. val |= config << shift;
  70. iowrite32(val, gth->base + reg);
  71. }
  72. static unsigned int gth_output_get(struct gth_device *gth, int port)
  73. {
  74. unsigned long reg = port & 4 ? REG_GTH_GTHOPT1 : REG_GTH_GTHOPT0;
  75. u32 val;
  76. int shift = (port & 3) * 8;
  77. val = ioread32(gth->base + reg);
  78. val &= 0xff << shift;
  79. val >>= shift;
  80. return val;
  81. }
  82. static void gth_smcfreq_set(struct gth_device *gth, int port,
  83. unsigned int freq)
  84. {
  85. unsigned long reg = REG_GTH_SMCR0 + ((port / 2) * 4);
  86. int shift = (port & 1) * 16;
  87. u32 val;
  88. val = ioread32(gth->base + reg);
  89. val &= ~(0xffff << shift);
  90. val |= freq << shift;
  91. iowrite32(val, gth->base + reg);
  92. }
  93. static unsigned int gth_smcfreq_get(struct gth_device *gth, int port)
  94. {
  95. unsigned long reg = REG_GTH_SMCR0 + ((port / 2) * 4);
  96. int shift = (port & 1) * 16;
  97. u32 val;
  98. val = ioread32(gth->base + reg);
  99. val &= 0xffff << shift;
  100. val >>= shift;
  101. return val;
  102. }
  103. /*
  104. * "masters" attribute group
  105. */
  106. struct master_attribute {
  107. struct device_attribute attr;
  108. struct gth_device *gth;
  109. unsigned int master;
  110. };
  111. static void
  112. gth_master_set(struct gth_device *gth, unsigned int master, int port)
  113. {
  114. unsigned int reg = REG_GTH_SWDEST0 + ((master >> 1) & ~3u);
  115. unsigned int shift = (master & 0x7) * 4;
  116. u32 val;
  117. if (master >= 256) {
  118. reg = REG_GTH_GSWTDEST;
  119. shift = 0;
  120. }
  121. val = ioread32(gth->base + reg);
  122. val &= ~(0xf << shift);
  123. if (port >= 0)
  124. val |= (0x8 | port) << shift;
  125. iowrite32(val, gth->base + reg);
  126. }
  127. static ssize_t master_attr_show(struct device *dev,
  128. struct device_attribute *attr,
  129. char *buf)
  130. {
  131. struct master_attribute *ma =
  132. container_of(attr, struct master_attribute, attr);
  133. struct gth_device *gth = ma->gth;
  134. size_t count;
  135. int port;
  136. spin_lock(&gth->gth_lock);
  137. port = gth->master[ma->master];
  138. spin_unlock(&gth->gth_lock);
  139. if (port >= 0)
  140. count = snprintf(buf, PAGE_SIZE, "%x\n", port);
  141. else
  142. count = snprintf(buf, PAGE_SIZE, "disabled\n");
  143. return count;
  144. }
  145. static ssize_t master_attr_store(struct device *dev,
  146. struct device_attribute *attr,
  147. const char *buf, size_t count)
  148. {
  149. struct master_attribute *ma =
  150. container_of(attr, struct master_attribute, attr);
  151. struct gth_device *gth = ma->gth;
  152. int old_port, port;
  153. if (kstrtoint(buf, 10, &port) < 0)
  154. return -EINVAL;
  155. if (port >= TH_POSSIBLE_OUTPUTS || port < -1)
  156. return -EINVAL;
  157. spin_lock(&gth->gth_lock);
  158. /* disconnect from the previous output port, if any */
  159. old_port = gth->master[ma->master];
  160. if (old_port >= 0) {
  161. gth->master[ma->master] = -1;
  162. clear_bit(ma->master, gth->output[old_port].master);
  163. /*
  164. * if the port is active, program this setting,
  165. * implies that runtime PM is on
  166. */
  167. if (gth->output[old_port].output->active)
  168. gth_master_set(gth, ma->master, -1);
  169. }
  170. /* connect to the new output port, if any */
  171. if (port >= 0) {
  172. /* check if there's a driver for this port */
  173. if (!gth->output[port].output) {
  174. count = -ENODEV;
  175. goto unlock;
  176. }
  177. set_bit(ma->master, gth->output[port].master);
  178. /* if the port is active, program this setting, see above */
  179. if (gth->output[port].output->active)
  180. gth_master_set(gth, ma->master, port);
  181. }
  182. gth->master[ma->master] = port;
  183. unlock:
  184. spin_unlock(&gth->gth_lock);
  185. return count;
  186. }
  187. struct output_attribute {
  188. struct device_attribute attr;
  189. struct gth_device *gth;
  190. unsigned int port;
  191. unsigned int parm;
  192. };
  193. #define OUTPUT_PARM(_name, _mask, _r, _w, _what) \
  194. [TH_OUTPUT_PARM(_name)] = { .name = __stringify(_name), \
  195. .get = gth_ ## _what ## _get, \
  196. .set = gth_ ## _what ## _set, \
  197. .mask = (_mask), \
  198. .readable = (_r), \
  199. .writable = (_w) }
  200. static const struct output_parm {
  201. const char *name;
  202. unsigned int (*get)(struct gth_device *gth, int port);
  203. void (*set)(struct gth_device *gth, int port,
  204. unsigned int val);
  205. unsigned int mask;
  206. unsigned int readable : 1,
  207. writable : 1;
  208. } output_parms[] = {
  209. OUTPUT_PARM(port, 0x7, 1, 0, output),
  210. OUTPUT_PARM(null, BIT(3), 1, 1, output),
  211. OUTPUT_PARM(drop, BIT(4), 1, 1, output),
  212. OUTPUT_PARM(reset, BIT(5), 1, 0, output),
  213. OUTPUT_PARM(flush, BIT(7), 0, 1, output),
  214. OUTPUT_PARM(smcfreq, 0xffff, 1, 1, smcfreq),
  215. };
  216. static void
  217. gth_output_parm_set(struct gth_device *gth, int port, unsigned int parm,
  218. unsigned int val)
  219. {
  220. unsigned int config = output_parms[parm].get(gth, port);
  221. unsigned int mask = output_parms[parm].mask;
  222. unsigned int shift = __ffs(mask);
  223. config &= ~mask;
  224. config |= (val << shift) & mask;
  225. output_parms[parm].set(gth, port, config);
  226. }
  227. static unsigned int
  228. gth_output_parm_get(struct gth_device *gth, int port, unsigned int parm)
  229. {
  230. unsigned int config = output_parms[parm].get(gth, port);
  231. unsigned int mask = output_parms[parm].mask;
  232. unsigned int shift = __ffs(mask);
  233. config &= mask;
  234. config >>= shift;
  235. return config;
  236. }
  237. /*
  238. * Reset outputs and sources
  239. */
  240. static int intel_th_gth_reset(struct gth_device *gth)
  241. {
  242. u32 scratchpad;
  243. int port, i;
  244. scratchpad = ioread32(gth->base + REG_GTH_SCRPD0);
  245. if (scratchpad & SCRPD_DEBUGGER_IN_USE)
  246. return -EBUSY;
  247. /* Always save/restore STH and TU registers in S0ix entry/exit */
  248. scratchpad |= SCRPD_STH_IS_ENABLED | SCRPD_TRIGGER_IS_ENABLED;
  249. iowrite32(scratchpad, gth->base + REG_GTH_SCRPD0);
  250. /* output ports */
  251. for (port = 0; port < 8; port++) {
  252. if (gth_output_parm_get(gth, port, TH_OUTPUT_PARM(port)) ==
  253. GTH_NONE)
  254. continue;
  255. gth_output_set(gth, port, 0);
  256. gth_smcfreq_set(gth, port, 16);
  257. }
  258. /* disable overrides */
  259. iowrite32(0, gth->base + REG_GTH_DESTOVR);
  260. /* masters swdest_0~31 and gswdest */
  261. for (i = 0; i < 33; i++)
  262. iowrite32(0, gth->base + REG_GTH_SWDEST0 + i * 4);
  263. /* sources */
  264. iowrite32(0, gth->base + REG_GTH_SCR);
  265. iowrite32(0xfc, gth->base + REG_GTH_SCR2);
  266. return 0;
  267. }
  268. /*
  269. * "outputs" attribute group
  270. */
  271. static ssize_t output_attr_show(struct device *dev,
  272. struct device_attribute *attr,
  273. char *buf)
  274. {
  275. struct output_attribute *oa =
  276. container_of(attr, struct output_attribute, attr);
  277. struct gth_device *gth = oa->gth;
  278. size_t count;
  279. pm_runtime_get_sync(dev);
  280. spin_lock(&gth->gth_lock);
  281. count = snprintf(buf, PAGE_SIZE, "%x\n",
  282. gth_output_parm_get(gth, oa->port, oa->parm));
  283. spin_unlock(&gth->gth_lock);
  284. pm_runtime_put(dev);
  285. return count;
  286. }
  287. static ssize_t output_attr_store(struct device *dev,
  288. struct device_attribute *attr,
  289. const char *buf, size_t count)
  290. {
  291. struct output_attribute *oa =
  292. container_of(attr, struct output_attribute, attr);
  293. struct gth_device *gth = oa->gth;
  294. unsigned int config;
  295. if (kstrtouint(buf, 16, &config) < 0)
  296. return -EINVAL;
  297. pm_runtime_get_sync(dev);
  298. spin_lock(&gth->gth_lock);
  299. gth_output_parm_set(gth, oa->port, oa->parm, config);
  300. spin_unlock(&gth->gth_lock);
  301. pm_runtime_put(dev);
  302. return count;
  303. }
  304. static int intel_th_master_attributes(struct gth_device *gth)
  305. {
  306. struct master_attribute *master_attrs;
  307. struct attribute **attrs;
  308. int i, nattrs = TH_CONFIGURABLE_MASTERS + 2;
  309. attrs = devm_kcalloc(gth->dev, nattrs, sizeof(void *), GFP_KERNEL);
  310. if (!attrs)
  311. return -ENOMEM;
  312. master_attrs = devm_kcalloc(gth->dev, nattrs,
  313. sizeof(struct master_attribute),
  314. GFP_KERNEL);
  315. if (!master_attrs)
  316. return -ENOMEM;
  317. for (i = 0; i < TH_CONFIGURABLE_MASTERS + 1; i++) {
  318. char *name;
  319. name = devm_kasprintf(gth->dev, GFP_KERNEL, "%d%s", i,
  320. i == TH_CONFIGURABLE_MASTERS ? "+" : "");
  321. if (!name)
  322. return -ENOMEM;
  323. master_attrs[i].attr.attr.name = name;
  324. master_attrs[i].attr.attr.mode = S_IRUGO | S_IWUSR;
  325. master_attrs[i].attr.show = master_attr_show;
  326. master_attrs[i].attr.store = master_attr_store;
  327. sysfs_attr_init(&master_attrs[i].attr.attr);
  328. attrs[i] = &master_attrs[i].attr.attr;
  329. master_attrs[i].gth = gth;
  330. master_attrs[i].master = i;
  331. }
  332. gth->master_group.name = "masters";
  333. gth->master_group.attrs = attrs;
  334. return sysfs_create_group(&gth->dev->kobj, &gth->master_group);
  335. }
  336. static int intel_th_output_attributes(struct gth_device *gth)
  337. {
  338. struct output_attribute *out_attrs;
  339. struct attribute **attrs;
  340. int i, j, nouts = TH_POSSIBLE_OUTPUTS;
  341. int nparms = ARRAY_SIZE(output_parms);
  342. int nattrs = nouts * nparms + 1;
  343. attrs = devm_kcalloc(gth->dev, nattrs, sizeof(void *), GFP_KERNEL);
  344. if (!attrs)
  345. return -ENOMEM;
  346. out_attrs = devm_kcalloc(gth->dev, nattrs,
  347. sizeof(struct output_attribute),
  348. GFP_KERNEL);
  349. if (!out_attrs)
  350. return -ENOMEM;
  351. for (i = 0; i < nouts; i++) {
  352. for (j = 0; j < nparms; j++) {
  353. unsigned int idx = i * nparms + j;
  354. char *name;
  355. name = devm_kasprintf(gth->dev, GFP_KERNEL, "%d_%s", i,
  356. output_parms[j].name);
  357. if (!name)
  358. return -ENOMEM;
  359. out_attrs[idx].attr.attr.name = name;
  360. if (output_parms[j].readable) {
  361. out_attrs[idx].attr.attr.mode |= S_IRUGO;
  362. out_attrs[idx].attr.show = output_attr_show;
  363. }
  364. if (output_parms[j].writable) {
  365. out_attrs[idx].attr.attr.mode |= S_IWUSR;
  366. out_attrs[idx].attr.store = output_attr_store;
  367. }
  368. sysfs_attr_init(&out_attrs[idx].attr.attr);
  369. attrs[idx] = &out_attrs[idx].attr.attr;
  370. out_attrs[idx].gth = gth;
  371. out_attrs[idx].port = i;
  372. out_attrs[idx].parm = j;
  373. }
  374. }
  375. gth->output_group.name = "outputs";
  376. gth->output_group.attrs = attrs;
  377. return sysfs_create_group(&gth->dev->kobj, &gth->output_group);
  378. }
  379. /**
  380. * intel_th_gth_disable() - disable tracing to an output device
  381. * @thdev: GTH device
  382. * @output: output device's descriptor
  383. *
  384. * This will deconfigure all masters set to output to this device,
  385. * disable tracing using force storeEn off signal and wait for the
  386. * "pipeline empty" bit for corresponding output port.
  387. */
  388. static void intel_th_gth_disable(struct intel_th_device *thdev,
  389. struct intel_th_output *output)
  390. {
  391. struct gth_device *gth = dev_get_drvdata(&thdev->dev);
  392. unsigned long count;
  393. int master;
  394. u32 reg;
  395. spin_lock(&gth->gth_lock);
  396. output->active = false;
  397. for_each_set_bit(master, gth->output[output->port].master,
  398. TH_CONFIGURABLE_MASTERS) {
  399. gth_master_set(gth, master, -1);
  400. }
  401. spin_unlock(&gth->gth_lock);
  402. iowrite32(0, gth->base + REG_GTH_SCR);
  403. iowrite32(0xfd, gth->base + REG_GTH_SCR2);
  404. /* wait on pipeline empty for the given port */
  405. for (reg = 0, count = GTH_PLE_WAITLOOP_DEPTH;
  406. count && !(reg & BIT(output->port)); count--) {
  407. reg = ioread32(gth->base + REG_GTH_STAT);
  408. cpu_relax();
  409. }
  410. /* clear force capture done for next captures */
  411. iowrite32(0xfc, gth->base + REG_GTH_SCR2);
  412. if (!count)
  413. dev_dbg(&thdev->dev, "timeout waiting for GTH[%d] PLE\n",
  414. output->port);
  415. reg = ioread32(gth->base + REG_GTH_SCRPD0);
  416. reg &= ~output->scratchpad;
  417. iowrite32(reg, gth->base + REG_GTH_SCRPD0);
  418. }
  419. /**
  420. * intel_th_gth_enable() - enable tracing to an output device
  421. * @thdev: GTH device
  422. * @output: output device's descriptor
  423. *
  424. * This will configure all masters set to output to this device and
  425. * enable tracing using force storeEn signal.
  426. */
  427. static void intel_th_gth_enable(struct intel_th_device *thdev,
  428. struct intel_th_output *output)
  429. {
  430. struct gth_device *gth = dev_get_drvdata(&thdev->dev);
  431. u32 scr = 0xfc0000, scrpd;
  432. int master;
  433. spin_lock(&gth->gth_lock);
  434. for_each_set_bit(master, gth->output[output->port].master,
  435. TH_CONFIGURABLE_MASTERS + 1) {
  436. gth_master_set(gth, master, output->port);
  437. }
  438. if (output->multiblock)
  439. scr |= 0xff;
  440. output->active = true;
  441. spin_unlock(&gth->gth_lock);
  442. scrpd = ioread32(gth->base + REG_GTH_SCRPD0);
  443. scrpd |= output->scratchpad;
  444. iowrite32(scrpd, gth->base + REG_GTH_SCRPD0);
  445. iowrite32(scr, gth->base + REG_GTH_SCR);
  446. iowrite32(0, gth->base + REG_GTH_SCR2);
  447. }
  448. /**
  449. * intel_th_gth_assign() - assign output device to a GTH output port
  450. * @thdev: GTH device
  451. * @othdev: output device
  452. *
  453. * This will match a given output device parameters against present
  454. * output ports on the GTH and fill out relevant bits in output device's
  455. * descriptor.
  456. *
  457. * Return: 0 on success, -errno on error.
  458. */
  459. static int intel_th_gth_assign(struct intel_th_device *thdev,
  460. struct intel_th_device *othdev)
  461. {
  462. struct gth_device *gth = dev_get_drvdata(&thdev->dev);
  463. int i, id;
  464. if (othdev->type != INTEL_TH_OUTPUT)
  465. return -EINVAL;
  466. for (i = 0, id = 0; i < TH_POSSIBLE_OUTPUTS; i++) {
  467. if (gth->output[i].port_type != othdev->output.type)
  468. continue;
  469. if (othdev->id == -1 || othdev->id == id)
  470. goto found;
  471. id++;
  472. }
  473. return -ENOENT;
  474. found:
  475. spin_lock(&gth->gth_lock);
  476. othdev->output.port = i;
  477. othdev->output.active = false;
  478. gth->output[i].output = &othdev->output;
  479. spin_unlock(&gth->gth_lock);
  480. return 0;
  481. }
  482. /**
  483. * intel_th_gth_unassign() - deassociate an output device from its output port
  484. * @thdev: GTH device
  485. * @othdev: output device
  486. */
  487. static void intel_th_gth_unassign(struct intel_th_device *thdev,
  488. struct intel_th_device *othdev)
  489. {
  490. struct gth_device *gth = dev_get_drvdata(&thdev->dev);
  491. int port = othdev->output.port;
  492. spin_lock(&gth->gth_lock);
  493. othdev->output.port = -1;
  494. othdev->output.active = false;
  495. gth->output[port].output = NULL;
  496. spin_unlock(&gth->gth_lock);
  497. }
  498. static int
  499. intel_th_gth_set_output(struct intel_th_device *thdev, unsigned int master)
  500. {
  501. struct gth_device *gth = dev_get_drvdata(&thdev->dev);
  502. int port = 0; /* FIXME: make default output configurable */
  503. /*
  504. * everything above TH_CONFIGURABLE_MASTERS is controlled by the
  505. * same register
  506. */
  507. if (master > TH_CONFIGURABLE_MASTERS)
  508. master = TH_CONFIGURABLE_MASTERS;
  509. spin_lock(&gth->gth_lock);
  510. if (gth->master[master] == -1) {
  511. set_bit(master, gth->output[port].master);
  512. gth->master[master] = port;
  513. }
  514. spin_unlock(&gth->gth_lock);
  515. return 0;
  516. }
  517. static int intel_th_gth_probe(struct intel_th_device *thdev)
  518. {
  519. struct device *dev = &thdev->dev;
  520. struct gth_device *gth;
  521. struct resource *res;
  522. void __iomem *base;
  523. int i, ret;
  524. res = intel_th_device_get_resource(thdev, IORESOURCE_MEM, 0);
  525. if (!res)
  526. return -ENODEV;
  527. base = devm_ioremap(dev, res->start, resource_size(res));
  528. if (!base)
  529. return -ENOMEM;
  530. gth = devm_kzalloc(dev, sizeof(*gth), GFP_KERNEL);
  531. if (!gth)
  532. return -ENOMEM;
  533. gth->dev = dev;
  534. gth->base = base;
  535. spin_lock_init(&gth->gth_lock);
  536. ret = intel_th_gth_reset(gth);
  537. if (ret)
  538. return ret;
  539. for (i = 0; i < TH_CONFIGURABLE_MASTERS + 1; i++)
  540. gth->master[i] = -1;
  541. for (i = 0; i < TH_POSSIBLE_OUTPUTS; i++) {
  542. gth->output[i].gth = gth;
  543. gth->output[i].index = i;
  544. gth->output[i].port_type =
  545. gth_output_parm_get(gth, i, TH_OUTPUT_PARM(port));
  546. }
  547. if (intel_th_output_attributes(gth) ||
  548. intel_th_master_attributes(gth)) {
  549. pr_warn("Can't initialize sysfs attributes\n");
  550. if (gth->output_group.attrs)
  551. sysfs_remove_group(&gth->dev->kobj, &gth->output_group);
  552. return -ENOMEM;
  553. }
  554. dev_set_drvdata(dev, gth);
  555. return 0;
  556. }
  557. static void intel_th_gth_remove(struct intel_th_device *thdev)
  558. {
  559. struct gth_device *gth = dev_get_drvdata(&thdev->dev);
  560. sysfs_remove_group(&gth->dev->kobj, &gth->output_group);
  561. sysfs_remove_group(&gth->dev->kobj, &gth->master_group);
  562. }
  563. static struct intel_th_driver intel_th_gth_driver = {
  564. .probe = intel_th_gth_probe,
  565. .remove = intel_th_gth_remove,
  566. .assign = intel_th_gth_assign,
  567. .unassign = intel_th_gth_unassign,
  568. .set_output = intel_th_gth_set_output,
  569. .enable = intel_th_gth_enable,
  570. .disable = intel_th_gth_disable,
  571. .driver = {
  572. .name = "gth",
  573. .owner = THIS_MODULE,
  574. },
  575. };
  576. module_driver(intel_th_gth_driver,
  577. intel_th_driver_register,
  578. intel_th_driver_unregister);
  579. MODULE_ALIAS("intel_th_switch");
  580. MODULE_LICENSE("GPL v2");
  581. MODULE_DESCRIPTION("Intel(R) Trace Hub Global Trace Hub driver");
  582. MODULE_AUTHOR("Alexander Shishkin <alexander.shishkin@linux.intel.com>");