ps8622.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. /*
  2. * Parade PS8622 eDP/LVDS bridge driver
  3. *
  4. * Copyright (C) 2014 Google, Inc.
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <linux/backlight.h>
  16. #include <linux/delay.h>
  17. #include <linux/err.h>
  18. #include <linux/fb.h>
  19. #include <linux/gpio.h>
  20. #include <linux/i2c.h>
  21. #include <linux/module.h>
  22. #include <linux/of.h>
  23. #include <linux/of_device.h>
  24. #include <linux/of_graph.h>
  25. #include <linux/pm.h>
  26. #include <linux/regulator/consumer.h>
  27. #include <drm/drm_panel.h>
  28. #include "drmP.h"
  29. #include "drm_crtc.h"
  30. #include "drm_crtc_helper.h"
  31. /* Brightness scale on the Parade chip */
  32. #define PS8622_MAX_BRIGHTNESS 0xff
  33. /* Timings taken from the version 1.7 datasheet for the PS8622/PS8625 */
  34. #define PS8622_POWER_RISE_T1_MIN_US 10
  35. #define PS8622_POWER_RISE_T1_MAX_US 10000
  36. #define PS8622_RST_HIGH_T2_MIN_US 3000
  37. #define PS8622_RST_HIGH_T2_MAX_US 30000
  38. #define PS8622_PWMO_END_T12_MS 200
  39. #define PS8622_POWER_FALL_T16_MAX_US 10000
  40. #define PS8622_POWER_OFF_T17_MS 500
  41. #if ((PS8622_RST_HIGH_T2_MIN_US + PS8622_POWER_RISE_T1_MAX_US) > \
  42. (PS8622_RST_HIGH_T2_MAX_US + PS8622_POWER_RISE_T1_MIN_US))
  43. #error "T2.min + T1.max must be less than T2.max + T1.min"
  44. #endif
  45. struct ps8622_bridge {
  46. struct drm_connector connector;
  47. struct i2c_client *client;
  48. struct drm_bridge bridge;
  49. struct drm_panel *panel;
  50. struct regulator *v12;
  51. struct backlight_device *bl;
  52. struct gpio_desc *gpio_slp;
  53. struct gpio_desc *gpio_rst;
  54. u32 max_lane_count;
  55. u32 lane_count;
  56. bool enabled;
  57. };
  58. static inline struct ps8622_bridge *
  59. bridge_to_ps8622(struct drm_bridge *bridge)
  60. {
  61. return container_of(bridge, struct ps8622_bridge, bridge);
  62. }
  63. static inline struct ps8622_bridge *
  64. connector_to_ps8622(struct drm_connector *connector)
  65. {
  66. return container_of(connector, struct ps8622_bridge, connector);
  67. }
  68. static int ps8622_set(struct i2c_client *client, u8 page, u8 reg, u8 val)
  69. {
  70. int ret;
  71. struct i2c_adapter *adap = client->adapter;
  72. struct i2c_msg msg;
  73. u8 data[] = {reg, val};
  74. msg.addr = client->addr + page;
  75. msg.flags = 0;
  76. msg.len = sizeof(data);
  77. msg.buf = data;
  78. ret = i2c_transfer(adap, &msg, 1);
  79. if (ret != 1)
  80. pr_warn("PS8622 I2C write (0x%02x,0x%02x,0x%02x) failed: %d\n",
  81. client->addr + page, reg, val, ret);
  82. return !(ret == 1);
  83. }
  84. static int ps8622_send_config(struct ps8622_bridge *ps8622)
  85. {
  86. struct i2c_client *cl = ps8622->client;
  87. int err = 0;
  88. /* HPD low */
  89. err = ps8622_set(cl, 0x02, 0xa1, 0x01);
  90. if (err)
  91. goto error;
  92. /* SW setting: [1:0] SW output 1.2V voltage is lower to 96% */
  93. err = ps8622_set(cl, 0x04, 0x14, 0x01);
  94. if (err)
  95. goto error;
  96. /* RCO SS setting: [5:4] = b01 0.5%, b10 1%, b11 1.5% */
  97. err = ps8622_set(cl, 0x04, 0xe3, 0x20);
  98. if (err)
  99. goto error;
  100. /* [7] RCO SS enable */
  101. err = ps8622_set(cl, 0x04, 0xe2, 0x80);
  102. if (err)
  103. goto error;
  104. /* RPHY Setting
  105. * [3:2] CDR tune wait cycle before measure for fine tune
  106. * b00: 1us b01: 0.5us b10:2us, b11: 4us
  107. */
  108. err = ps8622_set(cl, 0x04, 0x8a, 0x0c);
  109. if (err)
  110. goto error;
  111. /* [3] RFD always on */
  112. err = ps8622_set(cl, 0x04, 0x89, 0x08);
  113. if (err)
  114. goto error;
  115. /* CTN lock in/out: 20000ppm/80000ppm. Lock out 2 times. */
  116. err = ps8622_set(cl, 0x04, 0x71, 0x2d);
  117. if (err)
  118. goto error;
  119. /* 2.7G CDR settings: NOF=40LSB for HBR CDR setting */
  120. err = ps8622_set(cl, 0x04, 0x7d, 0x07);
  121. if (err)
  122. goto error;
  123. /* [1:0] Fmin=+4bands */
  124. err = ps8622_set(cl, 0x04, 0x7b, 0x00);
  125. if (err)
  126. goto error;
  127. /* [7:5] DCO_FTRNG=+-40% */
  128. err = ps8622_set(cl, 0x04, 0x7a, 0xfd);
  129. if (err)
  130. goto error;
  131. /* 1.62G CDR settings: [5:2]NOF=64LSB [1:0]DCO scale is 2/5 */
  132. err = ps8622_set(cl, 0x04, 0xc0, 0x12);
  133. if (err)
  134. goto error;
  135. /* Gitune=-37% */
  136. err = ps8622_set(cl, 0x04, 0xc1, 0x92);
  137. if (err)
  138. goto error;
  139. /* Fbstep=100% */
  140. err = ps8622_set(cl, 0x04, 0xc2, 0x1c);
  141. if (err)
  142. goto error;
  143. /* [7] LOS signal disable */
  144. err = ps8622_set(cl, 0x04, 0x32, 0x80);
  145. if (err)
  146. goto error;
  147. /* RPIO Setting: [7:4] LVDS driver bias current : 75% (250mV swing) */
  148. err = ps8622_set(cl, 0x04, 0x00, 0xb0);
  149. if (err)
  150. goto error;
  151. /* [7:6] Right-bar GPIO output strength is 8mA */
  152. err = ps8622_set(cl, 0x04, 0x15, 0x40);
  153. if (err)
  154. goto error;
  155. /* EQ Training State Machine Setting, RCO calibration start */
  156. err = ps8622_set(cl, 0x04, 0x54, 0x10);
  157. if (err)
  158. goto error;
  159. /* Logic, needs more than 10 I2C command */
  160. /* [4:0] MAX_LANE_COUNT set to max supported lanes */
  161. err = ps8622_set(cl, 0x01, 0x02, 0x80 | ps8622->max_lane_count);
  162. if (err)
  163. goto error;
  164. /* [4:0] LANE_COUNT_SET set to chosen lane count */
  165. err = ps8622_set(cl, 0x01, 0x21, 0x80 | ps8622->lane_count);
  166. if (err)
  167. goto error;
  168. err = ps8622_set(cl, 0x00, 0x52, 0x20);
  169. if (err)
  170. goto error;
  171. /* HPD CP toggle enable */
  172. err = ps8622_set(cl, 0x00, 0xf1, 0x03);
  173. if (err)
  174. goto error;
  175. err = ps8622_set(cl, 0x00, 0x62, 0x41);
  176. if (err)
  177. goto error;
  178. /* Counter number, add 1ms counter delay */
  179. err = ps8622_set(cl, 0x00, 0xf6, 0x01);
  180. if (err)
  181. goto error;
  182. /* [6]PWM function control by DPCD0040f[7], default is PWM block */
  183. err = ps8622_set(cl, 0x00, 0x77, 0x06);
  184. if (err)
  185. goto error;
  186. /* 04h Adjust VTotal toleranceto fix the 30Hz no display issue */
  187. err = ps8622_set(cl, 0x00, 0x4c, 0x04);
  188. if (err)
  189. goto error;
  190. /* DPCD00400='h00, Parade OUI ='h001cf8 */
  191. err = ps8622_set(cl, 0x01, 0xc0, 0x00);
  192. if (err)
  193. goto error;
  194. /* DPCD00401='h1c */
  195. err = ps8622_set(cl, 0x01, 0xc1, 0x1c);
  196. if (err)
  197. goto error;
  198. /* DPCD00402='hf8 */
  199. err = ps8622_set(cl, 0x01, 0xc2, 0xf8);
  200. if (err)
  201. goto error;
  202. /* DPCD403~408 = ASCII code, D2SLV5='h4432534c5635 */
  203. err = ps8622_set(cl, 0x01, 0xc3, 0x44);
  204. if (err)
  205. goto error;
  206. /* DPCD404 */
  207. err = ps8622_set(cl, 0x01, 0xc4, 0x32);
  208. if (err)
  209. goto error;
  210. /* DPCD405 */
  211. err = ps8622_set(cl, 0x01, 0xc5, 0x53);
  212. if (err)
  213. goto error;
  214. /* DPCD406 */
  215. err = ps8622_set(cl, 0x01, 0xc6, 0x4c);
  216. if (err)
  217. goto error;
  218. /* DPCD407 */
  219. err = ps8622_set(cl, 0x01, 0xc7, 0x56);
  220. if (err)
  221. goto error;
  222. /* DPCD408 */
  223. err = ps8622_set(cl, 0x01, 0xc8, 0x35);
  224. if (err)
  225. goto error;
  226. /* DPCD40A, Initial Code major revision '01' */
  227. err = ps8622_set(cl, 0x01, 0xca, 0x01);
  228. if (err)
  229. goto error;
  230. /* DPCD40B, Initial Code minor revision '05' */
  231. err = ps8622_set(cl, 0x01, 0xcb, 0x05);
  232. if (err)
  233. goto error;
  234. if (ps8622->bl) {
  235. /* DPCD720, internal PWM */
  236. err = ps8622_set(cl, 0x01, 0xa5, 0xa0);
  237. if (err)
  238. goto error;
  239. /* FFh for 100% brightness, 0h for 0% brightness */
  240. err = ps8622_set(cl, 0x01, 0xa7,
  241. ps8622->bl->props.brightness);
  242. if (err)
  243. goto error;
  244. } else {
  245. /* DPCD720, external PWM */
  246. err = ps8622_set(cl, 0x01, 0xa5, 0x80);
  247. if (err)
  248. goto error;
  249. }
  250. /* Set LVDS output as 6bit-VESA mapping, single LVDS channel */
  251. err = ps8622_set(cl, 0x01, 0xcc, 0x13);
  252. if (err)
  253. goto error;
  254. /* Enable SSC set by register */
  255. err = ps8622_set(cl, 0x02, 0xb1, 0x20);
  256. if (err)
  257. goto error;
  258. /* Set SSC enabled and +/-1% central spreading */
  259. err = ps8622_set(cl, 0x04, 0x10, 0x16);
  260. if (err)
  261. goto error;
  262. /* Logic end */
  263. /* MPU Clock source: LC => RCO */
  264. err = ps8622_set(cl, 0x04, 0x59, 0x60);
  265. if (err)
  266. goto error;
  267. /* LC -> RCO */
  268. err = ps8622_set(cl, 0x04, 0x54, 0x14);
  269. if (err)
  270. goto error;
  271. /* HPD high */
  272. err = ps8622_set(cl, 0x02, 0xa1, 0x91);
  273. error:
  274. return err ? -EIO : 0;
  275. }
  276. static int ps8622_backlight_update(struct backlight_device *bl)
  277. {
  278. struct ps8622_bridge *ps8622 = dev_get_drvdata(&bl->dev);
  279. int ret, brightness = bl->props.brightness;
  280. if (bl->props.power != FB_BLANK_UNBLANK ||
  281. bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
  282. brightness = 0;
  283. if (!ps8622->enabled)
  284. return -EINVAL;
  285. ret = ps8622_set(ps8622->client, 0x01, 0xa7, brightness);
  286. return ret;
  287. }
  288. static const struct backlight_ops ps8622_backlight_ops = {
  289. .update_status = ps8622_backlight_update,
  290. };
  291. static void ps8622_pre_enable(struct drm_bridge *bridge)
  292. {
  293. struct ps8622_bridge *ps8622 = bridge_to_ps8622(bridge);
  294. int ret;
  295. if (ps8622->enabled)
  296. return;
  297. gpiod_set_value(ps8622->gpio_rst, 0);
  298. if (ps8622->v12) {
  299. ret = regulator_enable(ps8622->v12);
  300. if (ret)
  301. DRM_ERROR("fails to enable ps8622->v12");
  302. }
  303. if (drm_panel_prepare(ps8622->panel)) {
  304. DRM_ERROR("failed to prepare panel\n");
  305. return;
  306. }
  307. gpiod_set_value(ps8622->gpio_slp, 1);
  308. /*
  309. * T1 is the range of time that it takes for the power to rise after we
  310. * enable the lcd/ps8622 fet. T2 is the range of time in which the
  311. * data sheet specifies we should deassert the reset pin.
  312. *
  313. * If it takes T1.max for the power to rise, we need to wait atleast
  314. * T2.min before deasserting the reset pin. If it takes T1.min for the
  315. * power to rise, we need to wait at most T2.max before deasserting the
  316. * reset pin.
  317. */
  318. usleep_range(PS8622_RST_HIGH_T2_MIN_US + PS8622_POWER_RISE_T1_MAX_US,
  319. PS8622_RST_HIGH_T2_MAX_US + PS8622_POWER_RISE_T1_MIN_US);
  320. gpiod_set_value(ps8622->gpio_rst, 1);
  321. /* wait 20ms after RST high */
  322. usleep_range(20000, 30000);
  323. ret = ps8622_send_config(ps8622);
  324. if (ret) {
  325. DRM_ERROR("Failed to send config to bridge (%d)\n", ret);
  326. return;
  327. }
  328. ps8622->enabled = true;
  329. }
  330. static void ps8622_enable(struct drm_bridge *bridge)
  331. {
  332. struct ps8622_bridge *ps8622 = bridge_to_ps8622(bridge);
  333. if (drm_panel_enable(ps8622->panel)) {
  334. DRM_ERROR("failed to enable panel\n");
  335. return;
  336. }
  337. }
  338. static void ps8622_disable(struct drm_bridge *bridge)
  339. {
  340. struct ps8622_bridge *ps8622 = bridge_to_ps8622(bridge);
  341. if (drm_panel_disable(ps8622->panel)) {
  342. DRM_ERROR("failed to disable panel\n");
  343. return;
  344. }
  345. msleep(PS8622_PWMO_END_T12_MS);
  346. }
  347. static void ps8622_post_disable(struct drm_bridge *bridge)
  348. {
  349. struct ps8622_bridge *ps8622 = bridge_to_ps8622(bridge);
  350. if (!ps8622->enabled)
  351. return;
  352. ps8622->enabled = false;
  353. /*
  354. * This doesn't matter if the regulators are turned off, but something
  355. * else might keep them on. In that case, we want to assert the slp gpio
  356. * to lower power.
  357. */
  358. gpiod_set_value(ps8622->gpio_slp, 0);
  359. if (drm_panel_unprepare(ps8622->panel)) {
  360. DRM_ERROR("failed to unprepare panel\n");
  361. return;
  362. }
  363. if (ps8622->v12)
  364. regulator_disable(ps8622->v12);
  365. /*
  366. * Sleep for at least the amount of time that it takes the power rail to
  367. * fall to prevent asserting the rst gpio from doing anything.
  368. */
  369. usleep_range(PS8622_POWER_FALL_T16_MAX_US,
  370. 2 * PS8622_POWER_FALL_T16_MAX_US);
  371. gpiod_set_value(ps8622->gpio_rst, 0);
  372. msleep(PS8622_POWER_OFF_T17_MS);
  373. }
  374. static int ps8622_get_modes(struct drm_connector *connector)
  375. {
  376. struct ps8622_bridge *ps8622;
  377. ps8622 = connector_to_ps8622(connector);
  378. return drm_panel_get_modes(ps8622->panel);
  379. }
  380. static struct drm_encoder *ps8622_best_encoder(struct drm_connector *connector)
  381. {
  382. struct ps8622_bridge *ps8622;
  383. ps8622 = connector_to_ps8622(connector);
  384. return ps8622->bridge.encoder;
  385. }
  386. static const struct drm_connector_helper_funcs ps8622_connector_helper_funcs = {
  387. .get_modes = ps8622_get_modes,
  388. .best_encoder = ps8622_best_encoder,
  389. };
  390. static enum drm_connector_status ps8622_detect(struct drm_connector *connector,
  391. bool force)
  392. {
  393. return connector_status_connected;
  394. }
  395. static void ps8622_connector_destroy(struct drm_connector *connector)
  396. {
  397. drm_connector_cleanup(connector);
  398. }
  399. static const struct drm_connector_funcs ps8622_connector_funcs = {
  400. .dpms = drm_helper_connector_dpms,
  401. .fill_modes = drm_helper_probe_single_connector_modes,
  402. .detect = ps8622_detect,
  403. .destroy = ps8622_connector_destroy,
  404. };
  405. static int ps8622_attach(struct drm_bridge *bridge)
  406. {
  407. struct ps8622_bridge *ps8622 = bridge_to_ps8622(bridge);
  408. int ret;
  409. if (!bridge->encoder) {
  410. DRM_ERROR("Parent encoder object not found");
  411. return -ENODEV;
  412. }
  413. ps8622->connector.polled = DRM_CONNECTOR_POLL_HPD;
  414. ret = drm_connector_init(bridge->dev, &ps8622->connector,
  415. &ps8622_connector_funcs, DRM_MODE_CONNECTOR_LVDS);
  416. if (ret) {
  417. DRM_ERROR("Failed to initialize connector with drm\n");
  418. return ret;
  419. }
  420. drm_connector_helper_add(&ps8622->connector,
  421. &ps8622_connector_helper_funcs);
  422. drm_connector_register(&ps8622->connector);
  423. drm_mode_connector_attach_encoder(&ps8622->connector,
  424. bridge->encoder);
  425. if (ps8622->panel)
  426. drm_panel_attach(ps8622->panel, &ps8622->connector);
  427. drm_helper_hpd_irq_event(ps8622->connector.dev);
  428. return ret;
  429. }
  430. static const struct drm_bridge_funcs ps8622_bridge_funcs = {
  431. .pre_enable = ps8622_pre_enable,
  432. .enable = ps8622_enable,
  433. .disable = ps8622_disable,
  434. .post_disable = ps8622_post_disable,
  435. .attach = ps8622_attach,
  436. };
  437. static const struct of_device_id ps8622_devices[] = {
  438. {.compatible = "parade,ps8622",},
  439. {.compatible = "parade,ps8625",},
  440. {}
  441. };
  442. MODULE_DEVICE_TABLE(of, ps8622_devices);
  443. static int ps8622_probe(struct i2c_client *client,
  444. const struct i2c_device_id *id)
  445. {
  446. struct device *dev = &client->dev;
  447. struct device_node *endpoint, *panel_node;
  448. struct ps8622_bridge *ps8622;
  449. int ret;
  450. ps8622 = devm_kzalloc(dev, sizeof(*ps8622), GFP_KERNEL);
  451. if (!ps8622)
  452. return -ENOMEM;
  453. endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
  454. if (endpoint) {
  455. panel_node = of_graph_get_remote_port_parent(endpoint);
  456. if (panel_node) {
  457. ps8622->panel = of_drm_find_panel(panel_node);
  458. of_node_put(panel_node);
  459. if (!ps8622->panel)
  460. return -EPROBE_DEFER;
  461. }
  462. }
  463. ps8622->client = client;
  464. ps8622->v12 = devm_regulator_get(dev, "vdd12");
  465. if (IS_ERR(ps8622->v12)) {
  466. dev_info(dev, "no 1.2v regulator found for PS8622\n");
  467. ps8622->v12 = NULL;
  468. }
  469. ps8622->gpio_slp = devm_gpiod_get(dev, "sleep");
  470. if (IS_ERR(ps8622->gpio_slp)) {
  471. ret = PTR_ERR(ps8622->gpio_slp);
  472. dev_err(dev, "cannot get gpio_slp %d\n", ret);
  473. return ret;
  474. }
  475. ret = gpiod_direction_output(ps8622->gpio_slp, 1);
  476. if (ret) {
  477. dev_err(dev, "cannot configure gpio_slp\n");
  478. return ret;
  479. }
  480. ps8622->gpio_rst = devm_gpiod_get(dev, "reset");
  481. if (IS_ERR(ps8622->gpio_rst)) {
  482. ret = PTR_ERR(ps8622->gpio_rst);
  483. dev_err(dev, "cannot get gpio_rst %d\n", ret);
  484. return ret;
  485. }
  486. /*
  487. * Assert the reset pin high to avoid the bridge being
  488. * initialized prematurely
  489. */
  490. ret = gpiod_direction_output(ps8622->gpio_rst, 1);
  491. if (ret) {
  492. dev_err(dev, "cannot configure gpio_rst\n");
  493. return ret;
  494. }
  495. ps8622->max_lane_count = id->driver_data;
  496. if (of_property_read_u32(dev->of_node, "lane-count",
  497. &ps8622->lane_count)) {
  498. ps8622->lane_count = ps8622->max_lane_count;
  499. } else if (ps8622->lane_count > ps8622->max_lane_count) {
  500. dev_info(dev, "lane-count property is too high,"
  501. "using max_lane_count\n");
  502. ps8622->lane_count = ps8622->max_lane_count;
  503. }
  504. if (!of_find_property(dev->of_node, "use-external-pwm", NULL)) {
  505. ps8622->bl = backlight_device_register("ps8622-backlight",
  506. dev, ps8622, &ps8622_backlight_ops,
  507. NULL);
  508. if (IS_ERR(ps8622->bl)) {
  509. DRM_ERROR("failed to register backlight\n");
  510. ret = PTR_ERR(ps8622->bl);
  511. ps8622->bl = NULL;
  512. return ret;
  513. }
  514. ps8622->bl->props.max_brightness = PS8622_MAX_BRIGHTNESS;
  515. ps8622->bl->props.brightness = PS8622_MAX_BRIGHTNESS;
  516. }
  517. ps8622->bridge.funcs = &ps8622_bridge_funcs;
  518. ps8622->bridge.of_node = dev->of_node;
  519. ret = drm_bridge_add(&ps8622->bridge);
  520. if (ret) {
  521. DRM_ERROR("Failed to add bridge\n");
  522. return ret;
  523. }
  524. i2c_set_clientdata(client, ps8622);
  525. return 0;
  526. }
  527. static int ps8622_remove(struct i2c_client *client)
  528. {
  529. struct ps8622_bridge *ps8622 = i2c_get_clientdata(client);
  530. if (ps8622->bl)
  531. backlight_device_unregister(ps8622->bl);
  532. drm_bridge_remove(&ps8622->bridge);
  533. return 0;
  534. }
  535. static const struct i2c_device_id ps8622_i2c_table[] = {
  536. /* Device type, max_lane_count */
  537. {"ps8622", 1},
  538. {"ps8625", 2},
  539. {},
  540. };
  541. MODULE_DEVICE_TABLE(i2c, ps8622_i2c_table);
  542. static struct i2c_driver ps8622_driver = {
  543. .id_table = ps8622_i2c_table,
  544. .probe = ps8622_probe,
  545. .remove = ps8622_remove,
  546. .driver = {
  547. .name = "ps8622",
  548. .owner = THIS_MODULE,
  549. .of_match_table = ps8622_devices,
  550. },
  551. };
  552. module_i2c_driver(ps8622_driver);
  553. MODULE_AUTHOR("Vincent Palatin <vpalatin@chromium.org>");
  554. MODULE_DESCRIPTION("Parade ps8622/ps8625 eDP-LVDS converter driver");
  555. MODULE_LICENSE("GPL v2");