sossi.c 15 KB

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