sossi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. /*
  2. * OMAP1 Special OptimiSed Screen Interface support
  3. *
  4. * Copyright (C) 2004-2005 Nokia Corporation
  5. * Author: Juha Yrjölä <juha.yrjola@nokia.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. */
  21. #include <linux/module.h>
  22. #include <linux/mm.h>
  23. #include <linux/clk.h>
  24. #include <linux/irq.h>
  25. #include <linux/io.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/omap-dma.h>
  28. #include "omapfb.h"
  29. #include "lcdc.h"
  30. #define MODULE_NAME "omapfb-sossi"
  31. #define OMAP_SOSSI_BASE 0xfffbac00
  32. #define SOSSI_ID_REG 0x00
  33. #define SOSSI_INIT1_REG 0x04
  34. #define SOSSI_INIT2_REG 0x08
  35. #define SOSSI_INIT3_REG 0x0c
  36. #define SOSSI_FIFO_REG 0x10
  37. #define SOSSI_REOTABLE_REG 0x14
  38. #define SOSSI_TEARING_REG 0x18
  39. #define SOSSI_INIT1B_REG 0x1c
  40. #define SOSSI_FIFOB_REG 0x20
  41. #define DMA_GSCR 0xfffedc04
  42. #define DMA_LCD_CCR 0xfffee3c2
  43. #define DMA_LCD_CTRL 0xfffee3c4
  44. #define DMA_LCD_LCH_CTRL 0xfffee3ea
  45. #define CONF_SOSSI_RESET_R (1 << 23)
  46. #define RD_ACCESS 0
  47. #define WR_ACCESS 1
  48. #define SOSSI_MAX_XMIT_BYTES (512 * 1024)
  49. static struct {
  50. void __iomem *base;
  51. struct clk *fck;
  52. unsigned long fck_hz;
  53. spinlock_t lock;
  54. int bus_pick_count;
  55. int bus_pick_width;
  56. int tearsync_mode;
  57. int tearsync_line;
  58. void (*lcdc_callback)(void *data);
  59. void *lcdc_callback_data;
  60. int vsync_dma_pending;
  61. /* timing for read and write access */
  62. int clk_div;
  63. u8 clk_tw0[2];
  64. u8 clk_tw1[2];
  65. /*
  66. * if last_access is the same as current we don't have to change
  67. * the timings
  68. */
  69. int last_access;
  70. struct omapfb_device *fbdev;
  71. } sossi;
  72. static inline u32 sossi_read_reg(int reg)
  73. {
  74. return readl(sossi.base + reg);
  75. }
  76. static inline u16 sossi_read_reg16(int reg)
  77. {
  78. return readw(sossi.base + reg);
  79. }
  80. static inline u8 sossi_read_reg8(int reg)
  81. {
  82. return readb(sossi.base + reg);
  83. }
  84. static inline void sossi_write_reg(int reg, u32 value)
  85. {
  86. writel(value, sossi.base + reg);
  87. }
  88. static inline void sossi_write_reg16(int reg, u16 value)
  89. {
  90. writew(value, sossi.base + reg);
  91. }
  92. static inline void sossi_write_reg8(int reg, u8 value)
  93. {
  94. writeb(value, sossi.base + reg);
  95. }
  96. static void sossi_set_bits(int reg, u32 bits)
  97. {
  98. sossi_write_reg(reg, sossi_read_reg(reg) | bits);
  99. }
  100. static void sossi_clear_bits(int reg, u32 bits)
  101. {
  102. sossi_write_reg(reg, sossi_read_reg(reg) & ~bits);
  103. }
  104. #define HZ_TO_PS(x) (1000000000 / (x / 1000))
  105. static u32 ps_to_sossi_ticks(u32 ps, int div)
  106. {
  107. u32 clk_period = HZ_TO_PS(sossi.fck_hz) * div;
  108. return (clk_period + ps - 1) / clk_period;
  109. }
  110. static int calc_rd_timings(struct extif_timings *t)
  111. {
  112. u32 tw0, tw1;
  113. int reon, reoff, recyc, actim;
  114. int div = t->clk_div;
  115. /*
  116. * Make sure that after conversion it still holds that:
  117. * reoff > reon, recyc >= reoff, actim > reon
  118. */
  119. reon = ps_to_sossi_ticks(t->re_on_time, div);
  120. /* reon will be exactly one sossi tick */
  121. if (reon > 1)
  122. return -1;
  123. reoff = ps_to_sossi_ticks(t->re_off_time, div);
  124. if (reoff <= reon)
  125. reoff = reon + 1;
  126. tw0 = reoff - reon;
  127. if (tw0 > 0x10)
  128. return -1;
  129. recyc = ps_to_sossi_ticks(t->re_cycle_time, div);
  130. if (recyc <= reoff)
  131. recyc = reoff + 1;
  132. tw1 = recyc - tw0;
  133. /* values less then 3 result in the SOSSI block resetting itself */
  134. if (tw1 < 3)
  135. tw1 = 3;
  136. if (tw1 > 0x40)
  137. return -1;
  138. actim = ps_to_sossi_ticks(t->access_time, div);
  139. if (actim < reoff)
  140. actim++;
  141. /*
  142. * access time (data hold time) will be exactly one sossi
  143. * tick
  144. */
  145. if (actim - reoff > 1)
  146. return -1;
  147. t->tim[0] = tw0 - 1;
  148. t->tim[1] = tw1 - 1;
  149. return 0;
  150. }
  151. static int calc_wr_timings(struct extif_timings *t)
  152. {
  153. u32 tw0, tw1;
  154. int weon, weoff, wecyc;
  155. int div = t->clk_div;
  156. /*
  157. * Make sure that after conversion it still holds that:
  158. * weoff > weon, wecyc >= weoff
  159. */
  160. weon = ps_to_sossi_ticks(t->we_on_time, div);
  161. /* weon will be exactly one sossi tick */
  162. if (weon > 1)
  163. return -1;
  164. weoff = ps_to_sossi_ticks(t->we_off_time, div);
  165. if (weoff <= weon)
  166. weoff = weon + 1;
  167. tw0 = weoff - weon;
  168. if (tw0 > 0x10)
  169. return -1;
  170. wecyc = ps_to_sossi_ticks(t->we_cycle_time, div);
  171. if (wecyc <= weoff)
  172. wecyc = weoff + 1;
  173. tw1 = wecyc - tw0;
  174. /* values less then 3 result in the SOSSI block resetting itself */
  175. if (tw1 < 3)
  176. tw1 = 3;
  177. if (tw1 > 0x40)
  178. return -1;
  179. t->tim[2] = tw0 - 1;
  180. t->tim[3] = tw1 - 1;
  181. return 0;
  182. }
  183. static void _set_timing(int div, int tw0, int tw1)
  184. {
  185. u32 l;
  186. #ifdef VERBOSE
  187. dev_dbg(sossi.fbdev->dev, "Using TW0 = %d, TW1 = %d, div = %d\n",
  188. tw0 + 1, tw1 + 1, div);
  189. #endif
  190. clk_set_rate(sossi.fck, sossi.fck_hz / div);
  191. clk_enable(sossi.fck);
  192. l = sossi_read_reg(SOSSI_INIT1_REG);
  193. l &= ~((0x0f << 20) | (0x3f << 24));
  194. l |= (tw0 << 20) | (tw1 << 24);
  195. sossi_write_reg(SOSSI_INIT1_REG, l);
  196. clk_disable(sossi.fck);
  197. }
  198. static void _set_bits_per_cycle(int bus_pick_count, int bus_pick_width)
  199. {
  200. u32 l;
  201. l = sossi_read_reg(SOSSI_INIT3_REG);
  202. l &= ~0x3ff;
  203. l |= ((bus_pick_count - 1) << 5) | ((bus_pick_width - 1) & 0x1f);
  204. sossi_write_reg(SOSSI_INIT3_REG, l);
  205. }
  206. static void _set_tearsync_mode(int mode, unsigned line)
  207. {
  208. u32 l;
  209. l = sossi_read_reg(SOSSI_TEARING_REG);
  210. l &= ~(((1 << 11) - 1) << 15);
  211. l |= line << 15;
  212. l &= ~(0x3 << 26);
  213. l |= mode << 26;
  214. sossi_write_reg(SOSSI_TEARING_REG, l);
  215. if (mode)
  216. sossi_set_bits(SOSSI_INIT2_REG, 1 << 6); /* TE logic */
  217. else
  218. sossi_clear_bits(SOSSI_INIT2_REG, 1 << 6);
  219. }
  220. static inline void set_timing(int access)
  221. {
  222. if (access != sossi.last_access) {
  223. sossi.last_access = access;
  224. _set_timing(sossi.clk_div,
  225. sossi.clk_tw0[access], sossi.clk_tw1[access]);
  226. }
  227. }
  228. static void sossi_start_transfer(void)
  229. {
  230. /* WE */
  231. sossi_clear_bits(SOSSI_INIT2_REG, 1 << 4);
  232. /* CS active low */
  233. sossi_clear_bits(SOSSI_INIT1_REG, 1 << 30);
  234. }
  235. static void sossi_stop_transfer(void)
  236. {
  237. /* WE */
  238. sossi_set_bits(SOSSI_INIT2_REG, 1 << 4);
  239. /* CS active low */
  240. sossi_set_bits(SOSSI_INIT1_REG, 1 << 30);
  241. }
  242. static void wait_end_of_write(void)
  243. {
  244. /* Before reading we must check if some writings are going on */
  245. while (!(sossi_read_reg(SOSSI_INIT2_REG) & (1 << 3)));
  246. }
  247. static void send_data(const void *data, unsigned int len)
  248. {
  249. while (len >= 4) {
  250. sossi_write_reg(SOSSI_FIFO_REG, *(const u32 *) data);
  251. len -= 4;
  252. data += 4;
  253. }
  254. while (len >= 2) {
  255. sossi_write_reg16(SOSSI_FIFO_REG, *(const u16 *) data);
  256. len -= 2;
  257. data += 2;
  258. }
  259. while (len) {
  260. sossi_write_reg8(SOSSI_FIFO_REG, *(const u8 *) data);
  261. len--;
  262. data++;
  263. }
  264. }
  265. static void set_cycles(unsigned int len)
  266. {
  267. unsigned long nr_cycles = len / (sossi.bus_pick_width / 8);
  268. BUG_ON((nr_cycles - 1) & ~0x3ffff);
  269. sossi_clear_bits(SOSSI_INIT1_REG, 0x3ffff);
  270. sossi_set_bits(SOSSI_INIT1_REG, (nr_cycles - 1) & 0x3ffff);
  271. }
  272. static int sossi_convert_timings(struct extif_timings *t)
  273. {
  274. int r = 0;
  275. int div = t->clk_div;
  276. t->converted = 0;
  277. if (div <= 0 || div > 8)
  278. return -1;
  279. /* no CS on SOSSI, so ignore cson, csoff, cs_pulsewidth */
  280. if ((r = calc_rd_timings(t)) < 0)
  281. return r;
  282. if ((r = calc_wr_timings(t)) < 0)
  283. return r;
  284. t->tim[4] = div;
  285. t->converted = 1;
  286. return 0;
  287. }
  288. static void sossi_set_timings(const struct extif_timings *t)
  289. {
  290. BUG_ON(!t->converted);
  291. sossi.clk_tw0[RD_ACCESS] = t->tim[0];
  292. sossi.clk_tw1[RD_ACCESS] = t->tim[1];
  293. sossi.clk_tw0[WR_ACCESS] = t->tim[2];
  294. sossi.clk_tw1[WR_ACCESS] = t->tim[3];
  295. sossi.clk_div = t->tim[4];
  296. }
  297. static void sossi_get_clk_info(u32 *clk_period, u32 *max_clk_div)
  298. {
  299. *clk_period = HZ_TO_PS(sossi.fck_hz);
  300. *max_clk_div = 8;
  301. }
  302. static void sossi_set_bits_per_cycle(int bpc)
  303. {
  304. int bus_pick_count, bus_pick_width;
  305. /*
  306. * We set explicitly the the bus_pick_count as well, although
  307. * with remapping/reordering disabled it will be calculated by HW
  308. * as (32 / bus_pick_width).
  309. */
  310. switch (bpc) {
  311. case 8:
  312. bus_pick_count = 4;
  313. bus_pick_width = 8;
  314. break;
  315. case 16:
  316. bus_pick_count = 2;
  317. bus_pick_width = 16;
  318. break;
  319. default:
  320. BUG();
  321. return;
  322. }
  323. sossi.bus_pick_width = bus_pick_width;
  324. sossi.bus_pick_count = bus_pick_count;
  325. }
  326. static int sossi_setup_tearsync(unsigned pin_cnt,
  327. unsigned hs_pulse_time, unsigned vs_pulse_time,
  328. int hs_pol_inv, int vs_pol_inv, int div)
  329. {
  330. int hs, vs;
  331. u32 l;
  332. if (pin_cnt != 1 || div < 1 || div > 8)
  333. return -EINVAL;
  334. hs = ps_to_sossi_ticks(hs_pulse_time, div);
  335. vs = ps_to_sossi_ticks(vs_pulse_time, div);
  336. if (vs < 8 || vs <= hs || vs >= (1 << 12))
  337. return -EDOM;
  338. vs /= 8;
  339. vs--;
  340. if (hs > 8)
  341. hs = 8;
  342. if (hs)
  343. hs--;
  344. dev_dbg(sossi.fbdev->dev,
  345. "setup_tearsync: hs %d vs %d hs_inv %d vs_inv %d\n",
  346. hs, vs, hs_pol_inv, vs_pol_inv);
  347. clk_enable(sossi.fck);
  348. l = sossi_read_reg(SOSSI_TEARING_REG);
  349. l &= ~((1 << 15) - 1);
  350. l |= vs << 3;
  351. l |= hs;
  352. if (hs_pol_inv)
  353. l |= 1 << 29;
  354. else
  355. l &= ~(1 << 29);
  356. if (vs_pol_inv)
  357. l |= 1 << 28;
  358. else
  359. l &= ~(1 << 28);
  360. sossi_write_reg(SOSSI_TEARING_REG, l);
  361. clk_disable(sossi.fck);
  362. return 0;
  363. }
  364. static int sossi_enable_tearsync(int enable, unsigned line)
  365. {
  366. int mode;
  367. dev_dbg(sossi.fbdev->dev, "tearsync %d line %d\n", enable, line);
  368. if (line >= 1 << 11)
  369. return -EINVAL;
  370. if (enable) {
  371. if (line)
  372. mode = 2; /* HS or VS */
  373. else
  374. mode = 3; /* VS only */
  375. } else
  376. mode = 0;
  377. sossi.tearsync_line = line;
  378. sossi.tearsync_mode = mode;
  379. return 0;
  380. }
  381. static void sossi_write_command(const void *data, unsigned int len)
  382. {
  383. clk_enable(sossi.fck);
  384. set_timing(WR_ACCESS);
  385. _set_bits_per_cycle(sossi.bus_pick_count, sossi.bus_pick_width);
  386. /* CMD#/DATA */
  387. sossi_clear_bits(SOSSI_INIT1_REG, 1 << 18);
  388. set_cycles(len);
  389. sossi_start_transfer();
  390. send_data(data, len);
  391. sossi_stop_transfer();
  392. wait_end_of_write();
  393. clk_disable(sossi.fck);
  394. }
  395. static void sossi_write_data(const void *data, unsigned int len)
  396. {
  397. clk_enable(sossi.fck);
  398. set_timing(WR_ACCESS);
  399. _set_bits_per_cycle(sossi.bus_pick_count, sossi.bus_pick_width);
  400. /* CMD#/DATA */
  401. sossi_set_bits(SOSSI_INIT1_REG, 1 << 18);
  402. set_cycles(len);
  403. sossi_start_transfer();
  404. send_data(data, len);
  405. sossi_stop_transfer();
  406. wait_end_of_write();
  407. clk_disable(sossi.fck);
  408. }
  409. static void sossi_transfer_area(int width, int height,
  410. void (callback)(void *data), void *data)
  411. {
  412. BUG_ON(callback == NULL);
  413. sossi.lcdc_callback = callback;
  414. sossi.lcdc_callback_data = data;
  415. clk_enable(sossi.fck);
  416. set_timing(WR_ACCESS);
  417. _set_bits_per_cycle(sossi.bus_pick_count, sossi.bus_pick_width);
  418. _set_tearsync_mode(sossi.tearsync_mode, sossi.tearsync_line);
  419. /* CMD#/DATA */
  420. sossi_set_bits(SOSSI_INIT1_REG, 1 << 18);
  421. set_cycles(width * height * sossi.bus_pick_width / 8);
  422. sossi_start_transfer();
  423. if (sossi.tearsync_mode) {
  424. /*
  425. * Wait for the sync signal and start the transfer only
  426. * then. We can't seem to be able to use HW sync DMA for
  427. * this since LCD DMA shows huge latencies, as if it
  428. * would ignore some of the DMA requests from SoSSI.
  429. */
  430. unsigned long flags;
  431. spin_lock_irqsave(&sossi.lock, flags);
  432. sossi.vsync_dma_pending++;
  433. spin_unlock_irqrestore(&sossi.lock, flags);
  434. } else
  435. /* Just start the transfer right away. */
  436. omap_enable_lcd_dma();
  437. }
  438. static void sossi_dma_callback(void *data)
  439. {
  440. omap_stop_lcd_dma();
  441. sossi_stop_transfer();
  442. clk_disable(sossi.fck);
  443. sossi.lcdc_callback(sossi.lcdc_callback_data);
  444. }
  445. static void sossi_read_data(void *data, unsigned int len)
  446. {
  447. clk_enable(sossi.fck);
  448. set_timing(RD_ACCESS);
  449. _set_bits_per_cycle(sossi.bus_pick_count, sossi.bus_pick_width);
  450. /* CMD#/DATA */
  451. sossi_set_bits(SOSSI_INIT1_REG, 1 << 18);
  452. set_cycles(len);
  453. sossi_start_transfer();
  454. while (len >= 4) {
  455. *(u32 *) data = sossi_read_reg(SOSSI_FIFO_REG);
  456. len -= 4;
  457. data += 4;
  458. }
  459. while (len >= 2) {
  460. *(u16 *) data = sossi_read_reg16(SOSSI_FIFO_REG);
  461. len -= 2;
  462. data += 2;
  463. }
  464. while (len) {
  465. *(u8 *) data = sossi_read_reg8(SOSSI_FIFO_REG);
  466. len--;
  467. data++;
  468. }
  469. sossi_stop_transfer();
  470. clk_disable(sossi.fck);
  471. }
  472. static irqreturn_t sossi_match_irq(int irq, void *data)
  473. {
  474. unsigned long flags;
  475. spin_lock_irqsave(&sossi.lock, flags);
  476. if (sossi.vsync_dma_pending) {
  477. sossi.vsync_dma_pending--;
  478. omap_enable_lcd_dma();
  479. }
  480. spin_unlock_irqrestore(&sossi.lock, flags);
  481. return IRQ_HANDLED;
  482. }
  483. static int sossi_init(struct omapfb_device *fbdev)
  484. {
  485. u32 l, k;
  486. struct clk *fck;
  487. struct clk *dpll1out_ck;
  488. int r;
  489. sossi.base = ioremap(OMAP_SOSSI_BASE, SZ_1K);
  490. if (!sossi.base) {
  491. dev_err(fbdev->dev, "can't ioremap SoSSI\n");
  492. return -ENOMEM;
  493. }
  494. sossi.fbdev = fbdev;
  495. spin_lock_init(&sossi.lock);
  496. dpll1out_ck = clk_get(fbdev->dev, "ck_dpll1out");
  497. if (IS_ERR(dpll1out_ck)) {
  498. dev_err(fbdev->dev, "can't get DPLL1OUT clock\n");
  499. return PTR_ERR(dpll1out_ck);
  500. }
  501. /*
  502. * We need the parent clock rate, which we might divide further
  503. * depending on the timing requirements of the controller. See
  504. * _set_timings.
  505. */
  506. sossi.fck_hz = clk_get_rate(dpll1out_ck);
  507. clk_put(dpll1out_ck);
  508. fck = clk_get(fbdev->dev, "ck_sossi");
  509. if (IS_ERR(fck)) {
  510. dev_err(fbdev->dev, "can't get SoSSI functional clock\n");
  511. return PTR_ERR(fck);
  512. }
  513. sossi.fck = fck;
  514. /* Reset and enable the SoSSI module */
  515. l = omap_readl(MOD_CONF_CTRL_1);
  516. l |= CONF_SOSSI_RESET_R;
  517. omap_writel(l, MOD_CONF_CTRL_1);
  518. l &= ~CONF_SOSSI_RESET_R;
  519. omap_writel(l, MOD_CONF_CTRL_1);
  520. clk_enable(sossi.fck);
  521. l = omap_readl(ARM_IDLECT2);
  522. l &= ~(1 << 8); /* DMACK_REQ */
  523. omap_writel(l, ARM_IDLECT2);
  524. l = sossi_read_reg(SOSSI_INIT2_REG);
  525. /* Enable and reset the SoSSI block */
  526. l |= (1 << 0) | (1 << 1);
  527. sossi_write_reg(SOSSI_INIT2_REG, l);
  528. /* Take SoSSI out of reset */
  529. l &= ~(1 << 1);
  530. sossi_write_reg(SOSSI_INIT2_REG, l);
  531. sossi_write_reg(SOSSI_ID_REG, 0);
  532. l = sossi_read_reg(SOSSI_ID_REG);
  533. k = sossi_read_reg(SOSSI_ID_REG);
  534. if (l != 0x55555555 || k != 0xaaaaaaaa) {
  535. dev_err(fbdev->dev,
  536. "invalid SoSSI sync pattern: %08x, %08x\n", l, k);
  537. r = -ENODEV;
  538. goto err;
  539. }
  540. if ((r = omap_lcdc_set_dma_callback(sossi_dma_callback, NULL)) < 0) {
  541. dev_err(fbdev->dev, "can't get LCDC IRQ\n");
  542. r = -ENODEV;
  543. goto err;
  544. }
  545. l = sossi_read_reg(SOSSI_ID_REG); /* Component code */
  546. l = sossi_read_reg(SOSSI_ID_REG);
  547. dev_info(fbdev->dev, "SoSSI version %d.%d initialized\n",
  548. l >> 16, l & 0xffff);
  549. l = sossi_read_reg(SOSSI_INIT1_REG);
  550. l |= (1 << 19); /* DMA_MODE */
  551. l &= ~(1 << 31); /* REORDERING */
  552. sossi_write_reg(SOSSI_INIT1_REG, l);
  553. if ((r = request_irq(INT_1610_SoSSI_MATCH, sossi_match_irq,
  554. IRQ_TYPE_EDGE_FALLING,
  555. "sossi_match", sossi.fbdev->dev)) < 0) {
  556. dev_err(sossi.fbdev->dev, "can't get SoSSI match IRQ\n");
  557. goto err;
  558. }
  559. clk_disable(sossi.fck);
  560. return 0;
  561. err:
  562. clk_disable(sossi.fck);
  563. clk_put(sossi.fck);
  564. return r;
  565. }
  566. static void sossi_cleanup(void)
  567. {
  568. omap_lcdc_free_dma_callback();
  569. clk_put(sossi.fck);
  570. iounmap(sossi.base);
  571. }
  572. struct lcd_ctrl_extif omap1_ext_if = {
  573. .init = sossi_init,
  574. .cleanup = sossi_cleanup,
  575. .get_clk_info = sossi_get_clk_info,
  576. .convert_timings = sossi_convert_timings,
  577. .set_timings = sossi_set_timings,
  578. .set_bits_per_cycle = sossi_set_bits_per_cycle,
  579. .setup_tearsync = sossi_setup_tearsync,
  580. .enable_tearsync = sossi_enable_tearsync,
  581. .write_command = sossi_write_command,
  582. .read_data = sossi_read_data,
  583. .write_data = sossi_write_data,
  584. .transfer_area = sossi_transfer_area,
  585. .max_transmit_size = SOSSI_MAX_XMIT_BYTES,
  586. };