parade-ps8622.c 16 KB

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