dsi_phy.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #define pr_fmt(fmt) "msm-dsi-phy:[%s] " fmt, __func__
  6. #include <linux/of_device.h>
  7. #include <linux/err.h>
  8. #include <linux/regulator/consumer.h>
  9. #include <linux/clk.h>
  10. #include <linux/msm-bus.h>
  11. #include <linux/list.h>
  12. #include "msm_drv.h"
  13. #include "msm_kms.h"
  14. #include "dsi_phy.h"
  15. #include "dsi_phy_hw.h"
  16. #include "dsi_clk.h"
  17. #include "dsi_pwr.h"
  18. #include "dsi_catalog.h"
  19. #include "sde_dbg.h"
  20. #define DSI_PHY_DEFAULT_LABEL "MDSS PHY CTRL"
  21. #define BITS_PER_BYTE 8
  22. struct dsi_phy_list_item {
  23. struct msm_dsi_phy *phy;
  24. struct list_head list;
  25. };
  26. static LIST_HEAD(dsi_phy_list);
  27. static DEFINE_MUTEX(dsi_phy_list_lock);
  28. static const struct dsi_ver_spec_info dsi_phy_v0_0_hpm = {
  29. .version = DSI_PHY_VERSION_0_0_HPM,
  30. .lane_cfg_count = 4,
  31. .strength_cfg_count = 2,
  32. .regulator_cfg_count = 1,
  33. .timing_cfg_count = 8,
  34. };
  35. static const struct dsi_ver_spec_info dsi_phy_v0_0_lpm = {
  36. .version = DSI_PHY_VERSION_0_0_LPM,
  37. .lane_cfg_count = 4,
  38. .strength_cfg_count = 2,
  39. .regulator_cfg_count = 1,
  40. .timing_cfg_count = 8,
  41. };
  42. static const struct dsi_ver_spec_info dsi_phy_v1_0 = {
  43. .version = DSI_PHY_VERSION_1_0,
  44. .lane_cfg_count = 4,
  45. .strength_cfg_count = 2,
  46. .regulator_cfg_count = 1,
  47. .timing_cfg_count = 8,
  48. };
  49. static const struct dsi_ver_spec_info dsi_phy_v2_0 = {
  50. .version = DSI_PHY_VERSION_2_0,
  51. .lane_cfg_count = 4,
  52. .strength_cfg_count = 2,
  53. .regulator_cfg_count = 1,
  54. .timing_cfg_count = 8,
  55. };
  56. static const struct dsi_ver_spec_info dsi_phy_v3_0 = {
  57. .version = DSI_PHY_VERSION_3_0,
  58. .lane_cfg_count = 4,
  59. .strength_cfg_count = 2,
  60. .regulator_cfg_count = 0,
  61. .timing_cfg_count = 12,
  62. };
  63. static const struct dsi_ver_spec_info dsi_phy_v4_0 = {
  64. .version = DSI_PHY_VERSION_4_0,
  65. .lane_cfg_count = 4,
  66. .strength_cfg_count = 2,
  67. .regulator_cfg_count = 0,
  68. .timing_cfg_count = 14,
  69. };
  70. static const struct dsi_ver_spec_info dsi_phy_v4_1 = {
  71. .version = DSI_PHY_VERSION_4_1,
  72. .lane_cfg_count = 4,
  73. .strength_cfg_count = 2,
  74. .regulator_cfg_count = 0,
  75. .timing_cfg_count = 14,
  76. };
  77. static const struct of_device_id msm_dsi_phy_of_match[] = {
  78. { .compatible = "qcom,dsi-phy-v0.0-hpm",
  79. .data = &dsi_phy_v0_0_hpm,},
  80. { .compatible = "qcom,dsi-phy-v0.0-lpm",
  81. .data = &dsi_phy_v0_0_lpm,},
  82. { .compatible = "qcom,dsi-phy-v1.0",
  83. .data = &dsi_phy_v1_0,},
  84. { .compatible = "qcom,dsi-phy-v2.0",
  85. .data = &dsi_phy_v2_0,},
  86. { .compatible = "qcom,dsi-phy-v3.0",
  87. .data = &dsi_phy_v3_0,},
  88. { .compatible = "qcom,dsi-phy-v4.0",
  89. .data = &dsi_phy_v4_0,},
  90. { .compatible = "qcom,dsi-phy-v4.1",
  91. .data = &dsi_phy_v4_1,},
  92. {}
  93. };
  94. static int dsi_phy_regmap_init(struct platform_device *pdev,
  95. struct msm_dsi_phy *phy)
  96. {
  97. int rc = 0;
  98. void __iomem *ptr;
  99. ptr = msm_ioremap(pdev, "dsi_phy", phy->name);
  100. if (IS_ERR(ptr)) {
  101. rc = PTR_ERR(ptr);
  102. return rc;
  103. }
  104. phy->hw.base = ptr;
  105. ptr = msm_ioremap(pdev, "dyn_refresh_base", phy->name);
  106. phy->hw.dyn_pll_base = ptr;
  107. pr_debug("[%s] map dsi_phy registers to %pK\n",
  108. phy->name, phy->hw.base);
  109. switch (phy->ver_info->version) {
  110. case DSI_PHY_VERSION_2_0:
  111. ptr = msm_ioremap(pdev, "phy_clamp_base", phy->name);
  112. if (IS_ERR(ptr))
  113. phy->hw.phy_clamp_base = NULL;
  114. else
  115. phy->hw.phy_clamp_base = ptr;
  116. break;
  117. default:
  118. break;
  119. }
  120. return rc;
  121. }
  122. static int dsi_phy_regmap_deinit(struct msm_dsi_phy *phy)
  123. {
  124. pr_debug("[%s] unmap registers\n", phy->name);
  125. return 0;
  126. }
  127. static int dsi_phy_supplies_init(struct platform_device *pdev,
  128. struct msm_dsi_phy *phy)
  129. {
  130. int rc = 0;
  131. int i = 0;
  132. struct dsi_regulator_info *regs;
  133. struct regulator *vreg = NULL;
  134. regs = &phy->pwr_info.digital;
  135. regs->vregs = devm_kzalloc(&pdev->dev, sizeof(struct dsi_vreg),
  136. GFP_KERNEL);
  137. if (!regs->vregs)
  138. goto error;
  139. regs->count = 1;
  140. snprintf(regs->vregs->vreg_name,
  141. ARRAY_SIZE(regs->vregs[i].vreg_name),
  142. "%s", "gdsc");
  143. rc = dsi_pwr_get_dt_vreg_data(&pdev->dev,
  144. &phy->pwr_info.phy_pwr,
  145. "qcom,phy-supply-entries");
  146. if (rc) {
  147. pr_err("failed to get host power supplies, rc = %d\n", rc);
  148. goto error_digital;
  149. }
  150. regs = &phy->pwr_info.digital;
  151. for (i = 0; i < regs->count; i++) {
  152. vreg = devm_regulator_get(&pdev->dev, regs->vregs[i].vreg_name);
  153. rc = PTR_RET(vreg);
  154. if (rc) {
  155. pr_err("failed to get %s regulator\n",
  156. regs->vregs[i].vreg_name);
  157. goto error_host_pwr;
  158. }
  159. regs->vregs[i].vreg = vreg;
  160. }
  161. regs = &phy->pwr_info.phy_pwr;
  162. for (i = 0; i < regs->count; i++) {
  163. vreg = devm_regulator_get(&pdev->dev, regs->vregs[i].vreg_name);
  164. rc = PTR_RET(vreg);
  165. if (rc) {
  166. pr_err("failed to get %s regulator\n",
  167. regs->vregs[i].vreg_name);
  168. for (--i; i >= 0; i--)
  169. devm_regulator_put(regs->vregs[i].vreg);
  170. goto error_digital_put;
  171. }
  172. regs->vregs[i].vreg = vreg;
  173. }
  174. return rc;
  175. error_digital_put:
  176. regs = &phy->pwr_info.digital;
  177. for (i = 0; i < regs->count; i++)
  178. devm_regulator_put(regs->vregs[i].vreg);
  179. error_host_pwr:
  180. devm_kfree(&pdev->dev, phy->pwr_info.phy_pwr.vregs);
  181. phy->pwr_info.phy_pwr.vregs = NULL;
  182. phy->pwr_info.phy_pwr.count = 0;
  183. error_digital:
  184. devm_kfree(&pdev->dev, phy->pwr_info.digital.vregs);
  185. phy->pwr_info.digital.vregs = NULL;
  186. phy->pwr_info.digital.count = 0;
  187. error:
  188. return rc;
  189. }
  190. static int dsi_phy_supplies_deinit(struct msm_dsi_phy *phy)
  191. {
  192. int i = 0;
  193. int rc = 0;
  194. struct dsi_regulator_info *regs;
  195. regs = &phy->pwr_info.digital;
  196. for (i = 0; i < regs->count; i++) {
  197. if (!regs->vregs[i].vreg)
  198. pr_err("vreg is NULL, should not reach here\n");
  199. else
  200. devm_regulator_put(regs->vregs[i].vreg);
  201. }
  202. regs = &phy->pwr_info.phy_pwr;
  203. for (i = 0; i < regs->count; i++) {
  204. if (!regs->vregs[i].vreg)
  205. pr_err("vreg is NULL, should not reach here\n");
  206. else
  207. devm_regulator_put(regs->vregs[i].vreg);
  208. }
  209. if (phy->pwr_info.phy_pwr.vregs) {
  210. devm_kfree(&phy->pdev->dev, phy->pwr_info.phy_pwr.vregs);
  211. phy->pwr_info.phy_pwr.vregs = NULL;
  212. phy->pwr_info.phy_pwr.count = 0;
  213. }
  214. if (phy->pwr_info.digital.vregs) {
  215. devm_kfree(&phy->pdev->dev, phy->pwr_info.digital.vregs);
  216. phy->pwr_info.digital.vregs = NULL;
  217. phy->pwr_info.digital.count = 0;
  218. }
  219. return rc;
  220. }
  221. static int dsi_phy_parse_dt_per_lane_cfgs(struct platform_device *pdev,
  222. struct dsi_phy_per_lane_cfgs *cfg,
  223. char *property)
  224. {
  225. int rc = 0, i = 0, j = 0;
  226. const u8 *data;
  227. u32 len = 0;
  228. data = of_get_property(pdev->dev.of_node, property, &len);
  229. if (!data) {
  230. pr_err("Unable to read Phy %s settings\n", property);
  231. return -EINVAL;
  232. }
  233. if (len != DSI_LANE_MAX * cfg->count_per_lane) {
  234. pr_err("incorrect phy %s settings, exp=%d, act=%d\n",
  235. property, (DSI_LANE_MAX * cfg->count_per_lane), len);
  236. return -EINVAL;
  237. }
  238. for (i = DSI_LOGICAL_LANE_0; i < DSI_LANE_MAX; i++) {
  239. for (j = 0; j < cfg->count_per_lane; j++) {
  240. cfg->lane[i][j] = *data;
  241. data++;
  242. }
  243. }
  244. return rc;
  245. }
  246. static int dsi_phy_settings_init(struct platform_device *pdev,
  247. struct msm_dsi_phy *phy)
  248. {
  249. int rc = 0;
  250. struct dsi_phy_per_lane_cfgs *lane = &phy->cfg.lanecfg;
  251. struct dsi_phy_per_lane_cfgs *strength = &phy->cfg.strength;
  252. struct dsi_phy_per_lane_cfgs *timing = &phy->cfg.timing;
  253. struct dsi_phy_per_lane_cfgs *regs = &phy->cfg.regulators;
  254. lane->count_per_lane = phy->ver_info->lane_cfg_count;
  255. rc = dsi_phy_parse_dt_per_lane_cfgs(pdev, lane,
  256. "qcom,platform-lane-config");
  257. if (rc) {
  258. pr_err("failed to parse lane cfgs, rc=%d\n", rc);
  259. goto err;
  260. }
  261. strength->count_per_lane = phy->ver_info->strength_cfg_count;
  262. rc = dsi_phy_parse_dt_per_lane_cfgs(pdev, strength,
  263. "qcom,platform-strength-ctrl");
  264. if (rc) {
  265. pr_err("failed to parse lane cfgs, rc=%d\n", rc);
  266. goto err;
  267. }
  268. regs->count_per_lane = phy->ver_info->regulator_cfg_count;
  269. if (regs->count_per_lane > 0) {
  270. rc = dsi_phy_parse_dt_per_lane_cfgs(pdev, regs,
  271. "qcom,platform-regulator-settings");
  272. if (rc) {
  273. pr_err("failed to parse lane cfgs, rc=%d\n", rc);
  274. goto err;
  275. }
  276. }
  277. /* Actual timing values are dependent on panel */
  278. timing->count_per_lane = phy->ver_info->timing_cfg_count;
  279. phy->allow_phy_power_off = of_property_read_bool(pdev->dev.of_node,
  280. "qcom,panel-allow-phy-poweroff");
  281. of_property_read_u32(pdev->dev.of_node,
  282. "qcom,dsi-phy-regulator-min-datarate-bps",
  283. &phy->regulator_min_datarate_bps);
  284. phy->cfg.force_clk_lane_hs = of_property_read_bool(pdev->dev.of_node,
  285. "qcom,panel-force-clock-lane-hs");
  286. return 0;
  287. err:
  288. lane->count_per_lane = 0;
  289. strength->count_per_lane = 0;
  290. regs->count_per_lane = 0;
  291. timing->count_per_lane = 0;
  292. return rc;
  293. }
  294. static int dsi_phy_settings_deinit(struct msm_dsi_phy *phy)
  295. {
  296. memset(&phy->cfg.lanecfg, 0x0, sizeof(phy->cfg.lanecfg));
  297. memset(&phy->cfg.strength, 0x0, sizeof(phy->cfg.strength));
  298. memset(&phy->cfg.timing, 0x0, sizeof(phy->cfg.timing));
  299. memset(&phy->cfg.regulators, 0x0, sizeof(phy->cfg.regulators));
  300. return 0;
  301. }
  302. static int dsi_phy_driver_probe(struct platform_device *pdev)
  303. {
  304. struct msm_dsi_phy *dsi_phy;
  305. struct dsi_phy_list_item *item;
  306. const struct of_device_id *id;
  307. const struct dsi_ver_spec_info *ver_info;
  308. int rc = 0;
  309. u32 index = 0;
  310. if (!pdev || !pdev->dev.of_node) {
  311. pr_err("pdev not found\n");
  312. return -ENODEV;
  313. }
  314. id = of_match_node(msm_dsi_phy_of_match, pdev->dev.of_node);
  315. if (!id)
  316. return -ENODEV;
  317. ver_info = id->data;
  318. item = devm_kzalloc(&pdev->dev, sizeof(*item), GFP_KERNEL);
  319. if (!item)
  320. return -ENOMEM;
  321. dsi_phy = devm_kzalloc(&pdev->dev, sizeof(*dsi_phy), GFP_KERNEL);
  322. if (!dsi_phy) {
  323. devm_kfree(&pdev->dev, item);
  324. return -ENOMEM;
  325. }
  326. rc = of_property_read_u32(pdev->dev.of_node, "cell-index", &index);
  327. if (rc) {
  328. pr_debug("cell index not set, default to 0\n");
  329. index = 0;
  330. }
  331. dsi_phy->index = index;
  332. dsi_phy->name = of_get_property(pdev->dev.of_node, "label", NULL);
  333. if (!dsi_phy->name)
  334. dsi_phy->name = DSI_PHY_DEFAULT_LABEL;
  335. pr_debug("Probing %s device\n", dsi_phy->name);
  336. dsi_phy->ver_info = ver_info;
  337. rc = dsi_phy_regmap_init(pdev, dsi_phy);
  338. if (rc) {
  339. pr_err("Failed to parse register information, rc=%d\n", rc);
  340. goto fail;
  341. }
  342. rc = dsi_phy_supplies_init(pdev, dsi_phy);
  343. if (rc) {
  344. pr_err("failed to parse voltage supplies, rc = %d\n", rc);
  345. goto fail_regmap;
  346. }
  347. rc = dsi_catalog_phy_setup(&dsi_phy->hw, ver_info->version,
  348. dsi_phy->index);
  349. if (rc) {
  350. pr_err("Catalog does not support version (%d)\n",
  351. ver_info->version);
  352. goto fail_supplies;
  353. }
  354. rc = dsi_phy_settings_init(pdev, dsi_phy);
  355. if (rc) {
  356. pr_err("Failed to parse phy setting, rc=%d\n", rc);
  357. goto fail_supplies;
  358. }
  359. item->phy = dsi_phy;
  360. mutex_lock(&dsi_phy_list_lock);
  361. list_add(&item->list, &dsi_phy_list);
  362. mutex_unlock(&dsi_phy_list_lock);
  363. mutex_init(&dsi_phy->phy_lock);
  364. /** TODO: initialize debugfs */
  365. dsi_phy->pdev = pdev;
  366. platform_set_drvdata(pdev, dsi_phy);
  367. pr_info("Probe successful for %s\n", dsi_phy->name);
  368. return 0;
  369. fail_supplies:
  370. (void)dsi_phy_supplies_deinit(dsi_phy);
  371. fail_regmap:
  372. (void)dsi_phy_regmap_deinit(dsi_phy);
  373. fail:
  374. devm_kfree(&pdev->dev, dsi_phy);
  375. devm_kfree(&pdev->dev, item);
  376. return rc;
  377. }
  378. static int dsi_phy_driver_remove(struct platform_device *pdev)
  379. {
  380. int rc = 0;
  381. struct msm_dsi_phy *phy = platform_get_drvdata(pdev);
  382. struct list_head *pos, *tmp;
  383. if (!pdev || !phy) {
  384. pr_err("Invalid device\n");
  385. return -EINVAL;
  386. }
  387. mutex_lock(&dsi_phy_list_lock);
  388. list_for_each_safe(pos, tmp, &dsi_phy_list) {
  389. struct dsi_phy_list_item *n;
  390. n = list_entry(pos, struct dsi_phy_list_item, list);
  391. if (n->phy == phy) {
  392. list_del(&n->list);
  393. devm_kfree(&pdev->dev, n);
  394. break;
  395. }
  396. }
  397. mutex_unlock(&dsi_phy_list_lock);
  398. mutex_lock(&phy->phy_lock);
  399. rc = dsi_phy_settings_deinit(phy);
  400. if (rc)
  401. pr_err("failed to deinitialize phy settings, rc=%d\n", rc);
  402. rc = dsi_phy_supplies_deinit(phy);
  403. if (rc)
  404. pr_err("failed to deinitialize voltage supplies, rc=%d\n", rc);
  405. rc = dsi_phy_regmap_deinit(phy);
  406. if (rc)
  407. pr_err("failed to deinitialize regmap, rc=%d\n", rc);
  408. mutex_unlock(&phy->phy_lock);
  409. mutex_destroy(&phy->phy_lock);
  410. devm_kfree(&pdev->dev, phy);
  411. platform_set_drvdata(pdev, NULL);
  412. return 0;
  413. }
  414. static struct platform_driver dsi_phy_platform_driver = {
  415. .probe = dsi_phy_driver_probe,
  416. .remove = dsi_phy_driver_remove,
  417. .driver = {
  418. .name = "dsi_phy",
  419. .of_match_table = msm_dsi_phy_of_match,
  420. },
  421. };
  422. static void dsi_phy_enable_hw(struct msm_dsi_phy *phy)
  423. {
  424. if (phy->hw.ops.regulator_enable)
  425. phy->hw.ops.regulator_enable(&phy->hw, &phy->cfg.regulators);
  426. if (phy->hw.ops.enable)
  427. phy->hw.ops.enable(&phy->hw, &phy->cfg);
  428. }
  429. static void dsi_phy_disable_hw(struct msm_dsi_phy *phy)
  430. {
  431. if (phy->hw.ops.disable)
  432. phy->hw.ops.disable(&phy->hw, &phy->cfg);
  433. if (phy->hw.ops.regulator_disable)
  434. phy->hw.ops.regulator_disable(&phy->hw);
  435. }
  436. /**
  437. * dsi_phy_get() - get a dsi phy handle from device node
  438. * @of_node: device node for dsi phy controller
  439. *
  440. * Gets the DSI PHY handle for the corresponding of_node. The ref count is
  441. * incremented to one all subsequents get will fail until the original client
  442. * calls a put.
  443. *
  444. * Return: DSI PHY handle or an error code.
  445. */
  446. struct msm_dsi_phy *dsi_phy_get(struct device_node *of_node)
  447. {
  448. struct list_head *pos, *tmp;
  449. struct msm_dsi_phy *phy = NULL;
  450. mutex_lock(&dsi_phy_list_lock);
  451. list_for_each_safe(pos, tmp, &dsi_phy_list) {
  452. struct dsi_phy_list_item *n;
  453. n = list_entry(pos, struct dsi_phy_list_item, list);
  454. if (n->phy->pdev->dev.of_node == of_node) {
  455. phy = n->phy;
  456. break;
  457. }
  458. }
  459. mutex_unlock(&dsi_phy_list_lock);
  460. if (!phy) {
  461. pr_err("Device with of node not found\n");
  462. phy = ERR_PTR(-EPROBE_DEFER);
  463. return phy;
  464. }
  465. mutex_lock(&phy->phy_lock);
  466. if (phy->refcount > 0) {
  467. pr_err("[PHY_%d] Device under use\n", phy->index);
  468. phy = ERR_PTR(-EINVAL);
  469. } else {
  470. phy->refcount++;
  471. }
  472. mutex_unlock(&phy->phy_lock);
  473. return phy;
  474. }
  475. /**
  476. * dsi_phy_put() - release dsi phy handle
  477. * @dsi_phy: DSI PHY handle.
  478. *
  479. * Release the DSI PHY hardware. Driver will clean up all resources and puts
  480. * back the DSI PHY into reset state.
  481. */
  482. void dsi_phy_put(struct msm_dsi_phy *dsi_phy)
  483. {
  484. mutex_lock(&dsi_phy->phy_lock);
  485. if (dsi_phy->refcount == 0)
  486. pr_err("Unbalanced %s call\n", __func__);
  487. else
  488. dsi_phy->refcount--;
  489. mutex_unlock(&dsi_phy->phy_lock);
  490. }
  491. /**
  492. * dsi_phy_drv_init() - initialize dsi phy driver
  493. * @dsi_phy: DSI PHY handle.
  494. *
  495. * Initializes DSI PHY driver. Should be called after dsi_phy_get().
  496. *
  497. * Return: error code.
  498. */
  499. int dsi_phy_drv_init(struct msm_dsi_phy *dsi_phy)
  500. {
  501. char dbg_name[DSI_DEBUG_NAME_LEN];
  502. snprintf(dbg_name, DSI_DEBUG_NAME_LEN, "dsi%d_phy", dsi_phy->index);
  503. sde_dbg_reg_register_base(dbg_name, dsi_phy->hw.base,
  504. msm_iomap_size(dsi_phy->pdev, "dsi_phy"));
  505. return 0;
  506. }
  507. /**
  508. * dsi_phy_drv_deinit() - de-initialize dsi phy driver
  509. * @dsi_phy: DSI PHY handle.
  510. *
  511. * Release all resources acquired by dsi_phy_drv_init().
  512. *
  513. * Return: error code.
  514. */
  515. int dsi_phy_drv_deinit(struct msm_dsi_phy *dsi_phy)
  516. {
  517. return 0;
  518. }
  519. int dsi_phy_clk_cb_register(struct msm_dsi_phy *dsi_phy,
  520. struct clk_ctrl_cb *clk_cb)
  521. {
  522. if (!dsi_phy || !clk_cb) {
  523. pr_err("Invalid params\n");
  524. return -EINVAL;
  525. }
  526. dsi_phy->clk_cb.priv = clk_cb->priv;
  527. dsi_phy->clk_cb.dsi_clk_cb = clk_cb->dsi_clk_cb;
  528. return 0;
  529. }
  530. /**
  531. * dsi_phy_validate_mode() - validate a display mode
  532. * @dsi_phy: DSI PHY handle.
  533. * @mode: Mode information.
  534. *
  535. * Validation will fail if the mode cannot be supported by the PHY driver or
  536. * hardware.
  537. *
  538. * Return: error code.
  539. */
  540. int dsi_phy_validate_mode(struct msm_dsi_phy *dsi_phy,
  541. struct dsi_mode_info *mode)
  542. {
  543. int rc = 0;
  544. if (!dsi_phy || !mode) {
  545. pr_err("Invalid params\n");
  546. return -EINVAL;
  547. }
  548. pr_debug("[PHY_%d] Skipping validation\n", dsi_phy->index);
  549. return rc;
  550. }
  551. /**
  552. * dsi_phy_set_power_state() - enable/disable dsi phy power supplies
  553. * @dsi_phy: DSI PHY handle.
  554. * @enable: Boolean flag to enable/disable.
  555. *
  556. * Return: error code.
  557. */
  558. int dsi_phy_set_power_state(struct msm_dsi_phy *dsi_phy, bool enable)
  559. {
  560. int rc = 0;
  561. if (!dsi_phy) {
  562. pr_err("Invalid params\n");
  563. return -EINVAL;
  564. }
  565. mutex_lock(&dsi_phy->phy_lock);
  566. if (enable == dsi_phy->power_state) {
  567. pr_err("[PHY_%d] No state change\n", dsi_phy->index);
  568. goto error;
  569. }
  570. if (enable) {
  571. rc = dsi_pwr_enable_regulator(&dsi_phy->pwr_info.digital, true);
  572. if (rc) {
  573. pr_err("failed to enable digital regulator\n");
  574. goto error;
  575. }
  576. if (dsi_phy->dsi_phy_state == DSI_PHY_ENGINE_OFF &&
  577. dsi_phy->regulator_required) {
  578. rc = dsi_pwr_enable_regulator(
  579. &dsi_phy->pwr_info.phy_pwr, true);
  580. if (rc) {
  581. pr_err("failed to enable phy power\n");
  582. (void)dsi_pwr_enable_regulator(
  583. &dsi_phy->pwr_info.digital, false);
  584. goto error;
  585. }
  586. }
  587. } else {
  588. if (dsi_phy->dsi_phy_state == DSI_PHY_ENGINE_OFF &&
  589. dsi_phy->regulator_required) {
  590. rc = dsi_pwr_enable_regulator(
  591. &dsi_phy->pwr_info.phy_pwr, false);
  592. if (rc) {
  593. pr_err("failed to enable digital regulator\n");
  594. goto error;
  595. }
  596. }
  597. rc = dsi_pwr_enable_regulator(&dsi_phy->pwr_info.digital,
  598. false);
  599. if (rc) {
  600. pr_err("failed to enable phy power\n");
  601. goto error;
  602. }
  603. }
  604. dsi_phy->power_state = enable;
  605. error:
  606. mutex_unlock(&dsi_phy->phy_lock);
  607. return rc;
  608. }
  609. static int dsi_phy_enable_ulps(struct msm_dsi_phy *phy,
  610. struct dsi_host_config *config, bool clamp_enabled)
  611. {
  612. int rc = 0;
  613. u32 lanes = 0;
  614. u32 ulps_lanes;
  615. lanes = config->common_config.data_lanes;
  616. lanes |= DSI_CLOCK_LANE;
  617. /*
  618. * If DSI clamps are enabled, it means that the DSI lanes are
  619. * already in idle state. Checking for lanes to be in idle state
  620. * should be skipped during ULPS entry programming while coming
  621. * out of idle screen.
  622. */
  623. if (!clamp_enabled) {
  624. rc = phy->hw.ops.ulps_ops.wait_for_lane_idle(&phy->hw, lanes);
  625. if (rc) {
  626. pr_err("lanes not entering idle, skip ULPS\n");
  627. return rc;
  628. }
  629. }
  630. phy->hw.ops.ulps_ops.ulps_request(&phy->hw, &phy->cfg, lanes);
  631. ulps_lanes = phy->hw.ops.ulps_ops.get_lanes_in_ulps(&phy->hw);
  632. if (!phy->hw.ops.ulps_ops.is_lanes_in_ulps(lanes, ulps_lanes)) {
  633. pr_err("Failed to enter ULPS, request=0x%x, actual=0x%x\n",
  634. lanes, ulps_lanes);
  635. rc = -EIO;
  636. }
  637. return rc;
  638. }
  639. static int dsi_phy_disable_ulps(struct msm_dsi_phy *phy,
  640. struct dsi_host_config *config)
  641. {
  642. u32 ulps_lanes, lanes = 0;
  643. lanes = config->common_config.data_lanes;
  644. lanes |= DSI_CLOCK_LANE;
  645. ulps_lanes = phy->hw.ops.ulps_ops.get_lanes_in_ulps(&phy->hw);
  646. if (!phy->hw.ops.ulps_ops.is_lanes_in_ulps(lanes, ulps_lanes)) {
  647. pr_err("Mismatch in ULPS: lanes:%d, ulps_lanes:%d\n",
  648. lanes, ulps_lanes);
  649. return -EIO;
  650. }
  651. phy->hw.ops.ulps_ops.ulps_exit(&phy->hw, &phy->cfg, lanes);
  652. ulps_lanes = phy->hw.ops.ulps_ops.get_lanes_in_ulps(&phy->hw);
  653. if (phy->hw.ops.ulps_ops.is_lanes_in_ulps(lanes, ulps_lanes)) {
  654. pr_err("Lanes (0x%x) stuck in ULPS\n", ulps_lanes);
  655. return -EIO;
  656. }
  657. return 0;
  658. }
  659. void dsi_phy_toggle_resync_fifo(struct msm_dsi_phy *phy)
  660. {
  661. if (!phy)
  662. return;
  663. if (!phy->hw.ops.toggle_resync_fifo)
  664. return;
  665. phy->hw.ops.toggle_resync_fifo(&phy->hw);
  666. }
  667. void dsi_phy_reset_clk_en_sel(struct msm_dsi_phy *phy)
  668. {
  669. if (!phy)
  670. return;
  671. if (!phy->hw.ops.reset_clk_en_sel)
  672. return;
  673. phy->hw.ops.reset_clk_en_sel(&phy->hw);
  674. }
  675. int dsi_phy_set_ulps(struct msm_dsi_phy *phy, struct dsi_host_config *config,
  676. bool enable, bool clamp_enabled)
  677. {
  678. int rc = 0;
  679. if (!phy) {
  680. pr_err("Invalid params\n");
  681. return DSI_PHY_ULPS_ERROR;
  682. }
  683. if (!phy->hw.ops.ulps_ops.ulps_request ||
  684. !phy->hw.ops.ulps_ops.ulps_exit ||
  685. !phy->hw.ops.ulps_ops.get_lanes_in_ulps ||
  686. !phy->hw.ops.ulps_ops.is_lanes_in_ulps ||
  687. !phy->hw.ops.ulps_ops.wait_for_lane_idle) {
  688. pr_debug("DSI PHY ULPS ops not present\n");
  689. return DSI_PHY_ULPS_NOT_HANDLED;
  690. }
  691. mutex_lock(&phy->phy_lock);
  692. if (enable)
  693. rc = dsi_phy_enable_ulps(phy, config, clamp_enabled);
  694. else
  695. rc = dsi_phy_disable_ulps(phy, config);
  696. if (rc) {
  697. pr_err("[DSI_PHY%d] Ulps state change(%d) failed, rc=%d\n",
  698. phy->index, enable, rc);
  699. rc = DSI_PHY_ULPS_ERROR;
  700. goto error;
  701. }
  702. pr_debug("[DSI_PHY%d] ULPS state = %d\n", phy->index, enable);
  703. error:
  704. mutex_unlock(&phy->phy_lock);
  705. return rc;
  706. }
  707. /**
  708. * dsi_phy_enable() - enable DSI PHY hardware
  709. * @dsi_phy: DSI PHY handle.
  710. * @config: DSI host configuration.
  711. * @pll_source: Source PLL for PHY clock.
  712. * @skip_validation: Validation will not be performed on parameters.
  713. * @is_cont_splash_enabled: check whether continuous splash enabled.
  714. *
  715. * Validates and enables DSI PHY.
  716. *
  717. * Return: error code.
  718. */
  719. int dsi_phy_enable(struct msm_dsi_phy *phy,
  720. struct dsi_host_config *config,
  721. enum dsi_phy_pll_source pll_source,
  722. bool skip_validation,
  723. bool is_cont_splash_enabled)
  724. {
  725. int rc = 0;
  726. if (!phy || !config) {
  727. pr_err("Invalid params\n");
  728. return -EINVAL;
  729. }
  730. mutex_lock(&phy->phy_lock);
  731. if (!skip_validation)
  732. pr_debug("[PHY_%d] TODO: perform validation\n", phy->index);
  733. memcpy(&phy->mode, &config->video_timing, sizeof(phy->mode));
  734. memcpy(&phy->cfg.lane_map, &config->lane_map, sizeof(config->lane_map));
  735. phy->data_lanes = config->common_config.data_lanes;
  736. phy->dst_format = config->common_config.dst_format;
  737. phy->cfg.pll_source = pll_source;
  738. phy->cfg.bit_clk_rate_hz = config->bit_clk_rate_hz;
  739. /**
  740. * If PHY timing parameters are not present in panel dtsi file,
  741. * then calculate them in the driver
  742. */
  743. if (!phy->cfg.is_phy_timing_present)
  744. rc = phy->hw.ops.calculate_timing_params(&phy->hw,
  745. &phy->mode,
  746. &config->common_config,
  747. &phy->cfg.timing, false);
  748. if (rc) {
  749. pr_err("[%s] failed to set timing, rc=%d\n", phy->name, rc);
  750. goto error;
  751. }
  752. if (!is_cont_splash_enabled) {
  753. dsi_phy_enable_hw(phy);
  754. pr_debug("cont splash not enabled, phy enable required\n");
  755. }
  756. phy->dsi_phy_state = DSI_PHY_ENGINE_ON;
  757. error:
  758. mutex_unlock(&phy->phy_lock);
  759. return rc;
  760. }
  761. /* update dsi phy timings for dynamic clk switch use case */
  762. int dsi_phy_update_phy_timings(struct msm_dsi_phy *phy,
  763. struct dsi_host_config *config)
  764. {
  765. int rc = 0;
  766. if (!phy || !config) {
  767. pr_err("invalid argument\n");
  768. return -EINVAL;
  769. }
  770. memcpy(&phy->mode, &config->video_timing, sizeof(phy->mode));
  771. rc = phy->hw.ops.calculate_timing_params(&phy->hw, &phy->mode,
  772. &config->common_config,
  773. &phy->cfg.timing, true);
  774. if (rc)
  775. pr_err("failed to calculate phy timings %d\n", rc);
  776. return rc;
  777. }
  778. int dsi_phy_lane_reset(struct msm_dsi_phy *phy)
  779. {
  780. int ret = 0;
  781. if (!phy)
  782. return ret;
  783. mutex_lock(&phy->phy_lock);
  784. if (phy->hw.ops.phy_lane_reset)
  785. ret = phy->hw.ops.phy_lane_reset(&phy->hw);
  786. mutex_unlock(&phy->phy_lock);
  787. return ret;
  788. }
  789. /**
  790. * dsi_phy_disable() - disable DSI PHY hardware.
  791. * @phy: DSI PHY handle.
  792. *
  793. * Return: error code.
  794. */
  795. int dsi_phy_disable(struct msm_dsi_phy *phy)
  796. {
  797. int rc = 0;
  798. if (!phy) {
  799. pr_err("Invalid params\n");
  800. return -EINVAL;
  801. }
  802. mutex_lock(&phy->phy_lock);
  803. dsi_phy_disable_hw(phy);
  804. phy->dsi_phy_state = DSI_PHY_ENGINE_OFF;
  805. mutex_unlock(&phy->phy_lock);
  806. return rc;
  807. }
  808. /**
  809. * dsi_phy_set_clamp_state() - configure clamps for DSI lanes
  810. * @phy: DSI PHY handle.
  811. * @enable: boolean to specify clamp enable/disable.
  812. *
  813. * Return: error code.
  814. */
  815. int dsi_phy_set_clamp_state(struct msm_dsi_phy *phy, bool enable)
  816. {
  817. if (!phy)
  818. return -EINVAL;
  819. pr_debug("[%s] enable=%d\n", phy->name, enable);
  820. if (phy->hw.ops.clamp_ctrl)
  821. phy->hw.ops.clamp_ctrl(&phy->hw, enable);
  822. return 0;
  823. }
  824. /**
  825. * dsi_phy_idle_ctrl() - enable/disable DSI PHY during idle screen
  826. * @phy: DSI PHY handle
  827. * @enable: boolean to specify PHY enable/disable.
  828. *
  829. * Return: error code.
  830. */
  831. int dsi_phy_idle_ctrl(struct msm_dsi_phy *phy, bool enable)
  832. {
  833. if (!phy) {
  834. pr_err("Invalid params\n");
  835. return -EINVAL;
  836. }
  837. pr_debug("[%s] enable=%d\n", phy->name, enable);
  838. mutex_lock(&phy->phy_lock);
  839. if (enable) {
  840. if (phy->hw.ops.phy_idle_on)
  841. phy->hw.ops.phy_idle_on(&phy->hw, &phy->cfg);
  842. if (phy->hw.ops.regulator_enable)
  843. phy->hw.ops.regulator_enable(&phy->hw,
  844. &phy->cfg.regulators);
  845. if (phy->hw.ops.enable)
  846. phy->hw.ops.enable(&phy->hw, &phy->cfg);
  847. phy->dsi_phy_state = DSI_PHY_ENGINE_ON;
  848. } else {
  849. phy->dsi_phy_state = DSI_PHY_ENGINE_OFF;
  850. if (phy->hw.ops.disable)
  851. phy->hw.ops.disable(&phy->hw, &phy->cfg);
  852. if (phy->hw.ops.phy_idle_off)
  853. phy->hw.ops.phy_idle_off(&phy->hw);
  854. }
  855. mutex_unlock(&phy->phy_lock);
  856. return 0;
  857. }
  858. /**
  859. * dsi_phy_set_clk_freq() - set DSI PHY clock frequency setting
  860. * @phy: DSI PHY handle
  861. * @clk_freq: link clock frequency
  862. *
  863. * Return: error code.
  864. */
  865. int dsi_phy_set_clk_freq(struct msm_dsi_phy *phy,
  866. struct link_clk_freq *clk_freq)
  867. {
  868. if (!phy || !clk_freq) {
  869. pr_err("Invalid params\n");
  870. return -EINVAL;
  871. }
  872. phy->regulator_required = clk_freq->byte_clk_rate >
  873. (phy->regulator_min_datarate_bps / BITS_PER_BYTE);
  874. /*
  875. * DSI PLL needs 0p9 LDO1A for Powering DSI PLL block.
  876. * PLL driver can vote for this regulator in PLL driver file, but for
  877. * the usecase where we come out of idle(static screen), if PLL and
  878. * PHY vote for regulator ,there will be performance delays as both
  879. * votes go through RPM to enable regulators.
  880. */
  881. phy->regulator_required = true;
  882. pr_debug("[%s] lane_datarate=%u min_datarate=%u required=%d\n",
  883. phy->name,
  884. clk_freq->byte_clk_rate * BITS_PER_BYTE,
  885. phy->regulator_min_datarate_bps,
  886. phy->regulator_required);
  887. return 0;
  888. }
  889. /**
  890. * dsi_phy_set_timing_params() - timing parameters for the panel
  891. * @phy: DSI PHY handle
  892. * @timing: array holding timing params.
  893. * @size: size of the array.
  894. *
  895. * When PHY timing calculator is not implemented, this array will be used to
  896. * pass PHY timing information.
  897. *
  898. * Return: error code.
  899. */
  900. int dsi_phy_set_timing_params(struct msm_dsi_phy *phy,
  901. u32 *timing, u32 size)
  902. {
  903. int rc = 0;
  904. if (!phy || !timing || !size) {
  905. pr_err("Invalid params\n");
  906. return -EINVAL;
  907. }
  908. mutex_lock(&phy->phy_lock);
  909. if (phy->hw.ops.phy_timing_val)
  910. rc = phy->hw.ops.phy_timing_val(&phy->cfg.timing, timing, size);
  911. if (!rc)
  912. phy->cfg.is_phy_timing_present = true;
  913. mutex_unlock(&phy->phy_lock);
  914. return rc;
  915. }
  916. /**
  917. * dsi_phy_conv_phy_to_logical_lane() - Convert physical to logical lane
  918. * @lane_map: logical lane
  919. * @phy_lane: physical lane
  920. *
  921. * Return: Error code on failure. Lane number on success.
  922. */
  923. int dsi_phy_conv_phy_to_logical_lane(
  924. struct dsi_lane_map *lane_map, enum dsi_phy_data_lanes phy_lane)
  925. {
  926. int i = 0;
  927. if (phy_lane > DSI_PHYSICAL_LANE_3)
  928. return -EINVAL;
  929. for (i = DSI_LOGICAL_LANE_0; i < (DSI_LANE_MAX - 1); i++) {
  930. if (lane_map->lane_map_v2[i] == phy_lane)
  931. break;
  932. }
  933. return i;
  934. }
  935. /**
  936. * dsi_phy_conv_logical_to_phy_lane() - Convert logical to physical lane
  937. * @lane_map: physical lane
  938. * @lane: logical lane
  939. *
  940. * Return: Error code on failure. Lane number on success.
  941. */
  942. int dsi_phy_conv_logical_to_phy_lane(
  943. struct dsi_lane_map *lane_map, enum dsi_logical_lane lane)
  944. {
  945. int i = 0;
  946. if (lane > (DSI_LANE_MAX - 1))
  947. return -EINVAL;
  948. for (i = DSI_LOGICAL_LANE_0; i < (DSI_LANE_MAX - 1); i++) {
  949. if (BIT(i) == lane_map->lane_map_v2[lane])
  950. break;
  951. }
  952. return i;
  953. }
  954. /**
  955. * dsi_phy_config_dynamic_refresh() - Configure dynamic refresh registers
  956. * @phy: DSI PHY handle
  957. * @delay: pipe delays for dynamic refresh
  958. * @is_master: Boolean to indicate if for master or slave.
  959. */
  960. void dsi_phy_config_dynamic_refresh(struct msm_dsi_phy *phy,
  961. struct dsi_dyn_clk_delay *delay,
  962. bool is_master)
  963. {
  964. struct dsi_phy_cfg *cfg;
  965. if (!phy)
  966. return;
  967. mutex_lock(&phy->phy_lock);
  968. cfg = &phy->cfg;
  969. if (phy->hw.ops.dyn_refresh_ops.dyn_refresh_config)
  970. phy->hw.ops.dyn_refresh_ops.dyn_refresh_config(&phy->hw, cfg,
  971. is_master);
  972. if (phy->hw.ops.dyn_refresh_ops.dyn_refresh_pipe_delay)
  973. phy->hw.ops.dyn_refresh_ops.dyn_refresh_pipe_delay(
  974. &phy->hw, delay);
  975. mutex_unlock(&phy->phy_lock);
  976. }
  977. /**
  978. * dsi_phy_dynamic_refresh_trigger() - trigger dynamic refresh
  979. * @phy: DSI PHY handle
  980. * @is_master: Boolean to indicate if for master or slave.
  981. */
  982. void dsi_phy_dynamic_refresh_trigger(struct msm_dsi_phy *phy, bool is_master)
  983. {
  984. u32 off;
  985. if (!phy)
  986. return;
  987. mutex_lock(&phy->phy_lock);
  988. /*
  989. * program PLL_SWI_INTF_SEL and SW_TRIGGER bit only for
  990. * master and program SYNC_MODE bit only for slave.
  991. */
  992. if (is_master)
  993. off = BIT(DYN_REFRESH_INTF_SEL) | BIT(DYN_REFRESH_SWI_CTRL) |
  994. BIT(DYN_REFRESH_SW_TRIGGER);
  995. else
  996. off = BIT(DYN_REFRESH_SYNC_MODE) | BIT(DYN_REFRESH_SWI_CTRL);
  997. if (phy->hw.ops.dyn_refresh_ops.dyn_refresh_helper)
  998. phy->hw.ops.dyn_refresh_ops.dyn_refresh_helper(&phy->hw, off);
  999. mutex_unlock(&phy->phy_lock);
  1000. }
  1001. /**
  1002. * dsi_phy_cache_phy_timings - cache the phy timings calculated as part of
  1003. * dynamic refresh.
  1004. * @phy: DSI PHY Handle.
  1005. * @dst: Pointer to cache location.
  1006. * @size: Number of phy lane settings.
  1007. */
  1008. int dsi_phy_dyn_refresh_cache_phy_timings(struct msm_dsi_phy *phy, u32 *dst,
  1009. u32 size)
  1010. {
  1011. int rc = 0;
  1012. if (!phy || !dst || !size)
  1013. return -EINVAL;
  1014. if (phy->hw.ops.dyn_refresh_ops.cache_phy_timings)
  1015. rc = phy->hw.ops.dyn_refresh_ops.cache_phy_timings(
  1016. &phy->cfg.timing, dst, size);
  1017. if (rc)
  1018. pr_err("failed to cache phy timings %d\n", rc);
  1019. return rc;
  1020. }
  1021. /**
  1022. * dsi_phy_dynamic_refresh_clear() - clear dynamic refresh config
  1023. * @phy: DSI PHY handle
  1024. */
  1025. void dsi_phy_dynamic_refresh_clear(struct msm_dsi_phy *phy)
  1026. {
  1027. if (!phy)
  1028. return;
  1029. mutex_lock(&phy->phy_lock);
  1030. if (phy->hw.ops.dyn_refresh_ops.dyn_refresh_helper)
  1031. phy->hw.ops.dyn_refresh_ops.dyn_refresh_helper(&phy->hw, 0);
  1032. mutex_unlock(&phy->phy_lock);
  1033. }
  1034. /**
  1035. * dsi_phy_set_continuous_clk() - set/unset force clock lane HS request
  1036. * @phy: DSI PHY handle
  1037. * @enable: variable to control continuous clock
  1038. */
  1039. void dsi_phy_set_continuous_clk(struct msm_dsi_phy *phy, bool enable)
  1040. {
  1041. if (!phy)
  1042. return;
  1043. mutex_lock(&phy->phy_lock);
  1044. if (phy->hw.ops.set_continuous_clk)
  1045. phy->hw.ops.set_continuous_clk(&phy->hw, enable);
  1046. else
  1047. pr_warn("set_continuous_clk ops not present\n");
  1048. mutex_unlock(&phy->phy_lock);
  1049. }
  1050. void dsi_phy_drv_register(void)
  1051. {
  1052. platform_driver_register(&dsi_phy_platform_driver);
  1053. }
  1054. void dsi_phy_drv_unregister(void)
  1055. {
  1056. platform_driver_unregister(&dsi_phy_platform_driver);
  1057. }